summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan McDonald <danmcd@joyent.com>2021-03-26 12:11:36 -0400
committerDan McDonald <danmcd@joyent.com>2021-03-26 12:11:38 -0400
commit47f932df82ca981aa929650baee08fb181c3eada (patch)
tree464dd9c9164bd0d9d3218af3303941105677ef8c
parent0eb9f0cca48b7b34380838b2e9020d2d44e7a27c (diff)
parentd4d62540c939a1f768b551ce50297d66799bd53e (diff)
downloadillumos-joyent-47f932df82ca981aa929650baee08fb181c3eada.tar.gz
[illumos-gate merge]
commit d4d62540c939a1f768b551ce50297d66799bd53e 13652 xargs: writing 1 byte into a region of size 0 commit 49950d9c675502476d8644b1e5bb1bf0d743f53b 13666 stackalign: add SPARC support commit 373fc975de7796bc28f551ba20f2d72b529dfe48 13670 OmniOS openssl package renames commit 3307fc5b1f2f4445f00811b556ab80d50467262a 13660 stackalign: cast between incompatible function types commit 89af4c7b28b4436849bcbafbdebd243918ee0969 13661 printf builtin should ignore leading -- commit e49fc96399e3e599d5736b0968a49892988d60b3 13612 Convert ksh93.1 to mdoc commit ff02f816914596a5b08ed3ef117ba39db27d217f 13656 pbchk: filter HTTP 401 responses commit c063eb990f530561e469b3c1e4bb64230456c0da 2755 split ksh93 from core package 13460 ksh93 tests should be moved out of usr/demo 518 ksh documentation should be moved out of SUNWcsr commit a7792e7bce645a8015cc7d0eda87b7a21f380874 13653 Failing to enable promiscuous mode should not be a fatal error in snoop(1M) commit 8a37ae750765321f9d9de63763676fa7280d93da 13630 libpcidb could know about class codes Conflicts: usr/src/test/util-tests/tests/Makefile usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop.h usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop.c
-rw-r--r--exception_lists/packaging6
-rw-r--r--exception_lists/packaging.deps2
-rw-r--r--usr/src/cmd/Makefile1
-rw-r--r--usr/src/cmd/ast/libshell/Makefile1
-rw-r--r--usr/src/cmd/ast/libshell/Makefile.demo110
-rw-r--r--usr/src/cmd/ast/libshell/Makefile.tests159
-rw-r--r--usr/src/cmd/ast/libshell/common/tests/README.tests8
-rw-r--r--usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop.c21
-rw-r--r--usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop.h4
-rw-r--r--usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_capture.c44
-rw-r--r--usr/src/cmd/pcidb/Makefile45
-rw-r--r--usr/src/cmd/pcidb/pcidb.c884
-rwxr-xr-xusr/src/cmd/tail/tests/sun_solaris_tail.sh48
-rw-r--r--usr/src/cmd/xargs/xargs.c11
-rw-r--r--usr/src/contrib/ast/src/cmd/ksh93/bltins/print.c9
-rwxr-xr-xusr/src/contrib/ast/src/cmd/ksh93/tests/builtins.sh12
-rw-r--r--usr/src/lib/libpcidb/Makefile.com7
-rw-r--r--usr/src/lib/libpcidb/common/mapfile-vers48
-rw-r--r--usr/src/lib/libpcidb/common/pcidb.c701
-rw-r--r--usr/src/lib/libpcidb/common/pcidb.h30
-rw-r--r--usr/src/man/man1/ksh93.113905
-rw-r--r--usr/src/man/man1m/snoop.1m22
-rw-r--r--usr/src/pkg/manifests/SUNWcs.man1.inc27
-rw-r--r--usr/src/pkg/manifests/SUNWcs.mf58
-rw-r--r--usr/src/pkg/manifests/diagnostic-pci.mf26
-rw-r--r--usr/src/pkg/manifests/shell-ksh93.mf149
-rw-r--r--usr/src/pkg/manifests/source-demo-system.mf116
-rw-r--r--usr/src/pkg/manifests/system-library.mf15
-rw-r--r--usr/src/pkg/manifests/system-test-ksh93.mf139
-rw-r--r--usr/src/pkg/manifests/system-test-utiltest.mf2
-rw-r--r--usr/src/test/os-tests/tests/stackalign/Makefile6
-rw-r--r--usr/src/test/os-tests/tests/stackalign/stack_sparc.s71
-rw-r--r--usr/src/test/os-tests/tests/stackalign/stack_sparcv9.s73
-rw-r--r--usr/src/test/os-tests/tests/stackalign/stackalign.c15
-rw-r--r--usr/src/test/util-tests/runfiles/default.run2
-rw-r--r--usr/src/test/util-tests/tests/Makefile2
-rw-r--r--usr/src/test/util-tests/tests/pcidb/Makefile36
-rw-r--r--usr/src/test/util-tests/tests/pcidb/pcidbtest.ksh223
-rw-r--r--usr/src/tools/onbld/Checks/DbLookups.py2
39 files changed, 9305 insertions, 7735 deletions
diff --git a/exception_lists/packaging b/exception_lists/packaging
index 587560225b..61f31d8ef4 100644
--- a/exception_lists/packaging
+++ b/exception_lists/packaging
@@ -29,7 +29,7 @@
# Copyright 2018 Nexenta Systems, Inc.
# Copyright 2018 Jason King
# Copyright 2019, Joyent, Inc.
-# Copyright 2019 OmniOS Community Edition (OmniOSce) Association.
+# Copyright 2021 OmniOS Community Edition (OmniOSce) Association.
# Copyright 2020 Peter Tribble
#
@@ -452,6 +452,10 @@ usr/lib/sparcv9/libdll.so sparc
# libpp (a helper library needed by AST's msgcc)
usr/lib/libpp.so
usr/lib/locale/C/LC_MESSAGES/libpp
+# libcmd
+usr/lib/libcmd.so
+usr/lib/amd64/libcmd.so i386
+usr/lib/sparcv9/libcmd.so sparc
# libshell
usr/lib/libshell.so
usr/lib/amd64/libshell.so i386
diff --git a/exception_lists/packaging.deps b/exception_lists/packaging.deps
index 5673f33843..8b9ff69c04 100644
--- a/exception_lists/packaging.deps
+++ b/exception_lists/packaging.deps
@@ -22,6 +22,8 @@ pkg:/library/nspr
pkg:/library/nspr/header-nspr
pkg:/library/perl-5/xml-parser
pkg:/library/security/openssl
+pkg:/library/security/openssl-10
+pkg:/library/security/openssl-11
pkg:/library/security/trousers
pkg:/library/zlib
pkg:/package/pkg
diff --git a/usr/src/cmd/Makefile b/usr/src/cmd/Makefile
index 103bc26923..bd426edbb5 100644
--- a/usr/src/cmd/Makefile
+++ b/usr/src/cmd/Makefile
@@ -304,6 +304,7 @@ COMMON_SUBDIRS= \
passwd \
pathchk \
pbind \
+ pcidb \
pcidr \
pcieb \
pcitool \
diff --git a/usr/src/cmd/ast/libshell/Makefile b/usr/src/cmd/ast/libshell/Makefile
index 817297a67b..73bbad600c 100644
--- a/usr/src/cmd/ast/libshell/Makefile
+++ b/usr/src/cmd/ast/libshell/Makefile
@@ -61,6 +61,7 @@ $(SUBDIRS): FRC
FRC:
ASTSRC= $(CONTRIB)/ast/src/cmd/ksh93
+include Makefile.tests
include Makefile.demo
include Makefile.doc
diff --git a/usr/src/cmd/ast/libshell/Makefile.demo b/usr/src/cmd/ast/libshell/Makefile.demo
index ebddf0e6cc..594ab8b11e 100644
--- a/usr/src/cmd/ast/libshell/Makefile.demo
+++ b/usr/src/cmd/ast/libshell/Makefile.demo
@@ -60,111 +60,9 @@ DF_FUN= \
fun/popd \
fun/pushd
-DF_TESTS= \
- tests/shtests \
- tests/alias.sh \
- tests/append.sh \
- tests/arith.sh \
- tests/arrays.sh \
- tests/arrays2.sh \
- tests/attributes.sh \
- tests/basic.sh \
- tests/bracket.sh \
- tests/builtins.sh \
- tests/case.sh \
- tests/comvar.sh \
- tests/comvario.sh \
- tests/coprocess.sh \
- tests/cubetype.sh \
- tests/enum.sh \
- tests/exit.sh \
- tests/expand.sh \
- tests/functions.sh \
- tests/glob.sh \
- tests/grep.sh \
- tests/heredoc.sh \
- tests/io.sh \
- tests/leaks.sh \
- tests/locale.sh \
- tests/math.sh \
- tests/nameref.sh \
- tests/namespace.sh \
- tests/options.sh \
- tests/path.sh \
- tests/pointtype.sh \
- tests/pty.sh \
- tests/quoting.sh \
- tests/quoting2.sh \
- tests/readcsv.sh \
- tests/recttype.sh \
- tests/restricted.sh \
- tests/return.sh \
- tests/select.sh \
- tests/sigchld.sh \
- tests/signal.sh \
- tests/statics.sh \
- tests/subshell.sh \
- tests/substring.sh \
- tests/tilde.sh \
- tests/timetype.sh \
- tests/treemove.sh \
- tests/types.sh \
- tests/variables.sh \
- tests/vartree1.sh \
- tests/vartree2.sh
-
-
-DF_XTESTS= \
- tests/README.tests \
- tests/illumos_4149_builtin_head.sh \
- tests/illumos_13434_chunked_heredoc.sh \
- tests/sun_solaris_array_default_datatype.sh \
- tests/sun_solaris_builtin_poll.sh \
- tests/sun_solaris_builtin_sum.sh \
- tests/sun_solaris_builtin_tail.sh \
- tests/sun_solaris_command_substitution.sh \
- tests/sun_solaris_compound_misc.sh \
- tests/sun_solaris_compound_nameref.sh \
- tests/sun_solaris_compoundvario.sh \
- tests/sun_solaris_cr_xxxxxxxx_template.sh \
- tests/sun_solaris_cr_6687139_command_substitution_exec_redirection_allocation_loop.sh \
- tests/sun_solaris_cr_6713682_compound_var_bleeds_through_subshell.sh \
- tests/sun_solaris_cr_6722134_background_CHLD_trap.sh \
- tests/sun_solaris_cr_6753538_subshell_leaks_umask.sh \
- tests/sun_solaris_cr_6754020_weird_square_bracket_expansion.sh \
- tests/sun_solaris_cr_6763594_command_failure_execs_twice.sh \
- tests/sun_solaris_cr_6766246_pattern_matching_bug.sh \
- tests/sun_solaris_cr_6769332_substitutions_terminate_shell_after_257_iterations.sh \
- tests/sun_solaris_cr_6777491_lacks_arithmetric_function_iszero.sh \
- tests/sun_solaris_cr_6778077_sigthaw_trap.sh \
- tests/sun_solaris_cr_6789247_printf_hexfloat_rounding.sh \
- tests/sun_solaris_cr_6800929_large_command_substitution_hang.sh \
- tests/sun_solaris_cr_6805792_varmovetest1.sh \
- tests/sun_solaris_cr_6805794_character_to_wchar_not_working.sh \
- tests/sun_solaris_cr_6805795_negative_zero.sh \
- tests/sun_solaris_cr_6807179_shellpattern_uses_getpwnam.sh \
- tests/sun_solaris_cr_6835835_builtin_cat_n_broken.sh \
- tests/sun_solaris_cr_6848486_echo_test_with_test_undefined_executes_test_builtin.sh \
- tests/sun_solaris_cr_6855875_typeset_hexfloat_has_too_few_digits.sh \
- tests/sun_solaris_cr_6862121_shbinexec_kernel_module_defunct.sh \
- tests/sun_solaris_cr_6881017_background_process_in_subshell_hangs_caller.sh \
- tests/sun_solaris_cr_6887363_shell_sometimes_mishandles_return_value_of_its_child_process.sh \
- tests/sun_solaris_cr_6904557_wc_no_longer_counts_number_of_bytes_correctly.sh \
- tests/sun_solaris_cr_6904575_cut_-d_with_multibyte_character_no_longer_works.sh \
- tests/sun_solaris_cr_6904878_join_-t_no_longer_works_with_multibyte_char_separator.sh \
- tests/sun_solaris_cr_6907460_EXIT_trap_handlers_are_sometimes_executed_twice.sh \
- tests/sun_solaris_getconf.sh \
- tests/sun_solaris_locale_misc.sh \
- tests/sun_solaris_local_compound_nameref001.sh \
- tests/sun_solaris_staticvariables.sh \
- tests/sun_solaris_vartree001.sh \
- tests/sun_solaris_vartree002.sh \
- tests/sun_solaris_vartree003.sh
-
-DEMOFILES= $(DF_SRC) $(DF_BIN) $(DF_FUN) $(DF_TESTS) $(DF_XTESTS)
+DEMOFILES= $(DF_SRC) $(DF_BIN) $(DF_FUN)
# Rules for executables
-$(ROOTDEMODIRBASE)/tests/shtests := FILEMODE= 755
$(ROOTDEMODIRBASE)/fun/% := FILEMODE= 755
$(ROOTDEMODIRBASE)/bin/% := FILEMODE= 755
@@ -176,14 +74,10 @@ $(ROOTDEMODIRBASE)/bin/%: common/scripts/%.sh
$(ROOTDEMODIRBASE)/src/%.sh: common/scripts/%.sh
$(INS.file)
-$(ROOTDEMODIRBASE)/tests/%: common/tests/%
- $(INS.file)
-
ROOTDEMODIRS= $(ROOTDEMODIRBASE) .WAIT \
$(ROOTDEMODIRBASE)/bin \
$(ROOTDEMODIRBASE)/fun \
- $(ROOTDEMODIRBASE)/src \
- $(ROOTDEMODIRBASE)/tests
+ $(ROOTDEMODIRBASE)/src
_demoinstall: $(ROOTDEMODIRS) .WAIT $(ROOTDEMOFILES)
install: _demoinstall
diff --git a/usr/src/cmd/ast/libshell/Makefile.tests b/usr/src/cmd/ast/libshell/Makefile.tests
new file mode 100644
index 0000000000..6077a28c23
--- /dev/null
+++ b/usr/src/cmd/ast/libshell/Makefile.tests
@@ -0,0 +1,159 @@
+#
+# CDDL HEADER START
+#
+# 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]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright 2021 OmniOS Community Edition (OmniOSce) Association.
+#
+
+#
+# These are tests that come from usr/src/contrib/ast, and the test driver
+# itself.
+#
+DF_TESTS= \
+ shtests \
+ tests/alias.sh \
+ tests/append.sh \
+ tests/arith.sh \
+ tests/arrays.sh \
+ tests/arrays2.sh \
+ tests/attributes.sh \
+ tests/basic.sh \
+ tests/bracket.sh \
+ tests/builtins.sh \
+ tests/case.sh \
+ tests/comvar.sh \
+ tests/comvario.sh \
+ tests/coprocess.sh \
+ tests/cubetype.sh \
+ tests/enum.sh \
+ tests/exit.sh \
+ tests/expand.sh \
+ tests/functions.sh \
+ tests/glob.sh \
+ tests/grep.sh \
+ tests/heredoc.sh \
+ tests/io.sh \
+ tests/leaks.sh \
+ tests/locale.sh \
+ tests/math.sh \
+ tests/nameref.sh \
+ tests/namespace.sh \
+ tests/options.sh \
+ tests/path.sh \
+ tests/pointtype.sh \
+ tests/pty.sh \
+ tests/quoting.sh \
+ tests/quoting2.sh \
+ tests/readcsv.sh \
+ tests/recttype.sh \
+ tests/restricted.sh \
+ tests/return.sh \
+ tests/select.sh \
+ tests/sigchld.sh \
+ tests/signal.sh \
+ tests/statics.sh \
+ tests/subshell.sh \
+ tests/substring.sh \
+ tests/tilde.sh \
+ tests/timetype.sh \
+ tests/treemove.sh \
+ tests/types.sh \
+ tests/variables.sh \
+ tests/vartree1.sh \
+ tests/vartree2.sh
+
+#
+# These are additional illumos tests and the README
+#
+
+DF_XTESTS= \
+ README.tests \
+ tests/illumos_13434_chunked_heredoc.sh \
+ tests/illumos_4149_builtin_head.sh \
+ tests/sun_solaris_array_default_datatype.sh \
+ tests/sun_solaris_builtin_poll.sh \
+ tests/sun_solaris_builtin_sum.sh \
+ tests/sun_solaris_builtin_tail.sh \
+ tests/sun_solaris_command_substitution.sh \
+ tests/sun_solaris_compound_misc.sh \
+ tests/sun_solaris_compound_nameref.sh \
+ tests/sun_solaris_compoundvario.sh \
+ tests/sun_solaris_cr_xxxxxxxx_template.sh \
+ tests/sun_solaris_cr_6687139_command_substitution_exec_redirection_allocation_loop.sh \
+ tests/sun_solaris_cr_6713682_compound_var_bleeds_through_subshell.sh \
+ tests/sun_solaris_cr_6722134_background_CHLD_trap.sh \
+ tests/sun_solaris_cr_6753538_subshell_leaks_umask.sh \
+ tests/sun_solaris_cr_6754020_weird_square_bracket_expansion.sh \
+ tests/sun_solaris_cr_6763594_command_failure_execs_twice.sh \
+ tests/sun_solaris_cr_6766246_pattern_matching_bug.sh \
+ tests/sun_solaris_cr_6769332_substitutions_terminate_shell_after_257_iterations.sh \
+ tests/sun_solaris_cr_6777491_lacks_arithmetric_function_iszero.sh \
+ tests/sun_solaris_cr_6778077_sigthaw_trap.sh \
+ tests/sun_solaris_cr_6789247_printf_hexfloat_rounding.sh \
+ tests/sun_solaris_cr_6800929_large_command_substitution_hang.sh \
+ tests/sun_solaris_cr_6805792_varmovetest1.sh \
+ tests/sun_solaris_cr_6805794_character_to_wchar_not_working.sh \
+ tests/sun_solaris_cr_6805795_negative_zero.sh \
+ tests/sun_solaris_cr_6807179_shellpattern_uses_getpwnam.sh \
+ tests/sun_solaris_cr_6835835_builtin_cat_n_broken.sh \
+ tests/sun_solaris_cr_6848486_echo_test_with_test_undefined_executes_test_builtin.sh \
+ tests/sun_solaris_cr_6855875_typeset_hexfloat_has_too_few_digits.sh \
+ tests/sun_solaris_cr_6862121_shbinexec_kernel_module_defunct.sh \
+ tests/sun_solaris_cr_6881017_background_process_in_subshell_hangs_caller.sh \
+ tests/sun_solaris_cr_6887363_shell_sometimes_mishandles_return_value_of_its_child_process.sh \
+ tests/sun_solaris_cr_6904557_wc_no_longer_counts_number_of_bytes_correctly.sh \
+ tests/sun_solaris_cr_6904575_cut_-d_with_multibyte_character_no_longer_works.sh \
+ tests/sun_solaris_cr_6904878_join_-t_no_longer_works_with_multibyte_char_separator.sh \
+ tests/sun_solaris_cr_6907460_EXIT_trap_handlers_are_sometimes_executed_twice.sh \
+ tests/sun_solaris_getconf.sh \
+ tests/sun_solaris_locale_misc.sh \
+ tests/sun_solaris_local_compound_nameref001.sh \
+ tests/sun_solaris_staticvariables.sh \
+ tests/sun_solaris_vartree001.sh \
+ tests/sun_solaris_vartree002.sh \
+ tests/sun_solaris_vartree003.sh
+
+TESTFILES= $(DF_TESTS) $(DF_XTESTS)
+
+TESTFILESRCDIR= $(ASTSRC)
+ROOTTESTDIRBASE= $(ROOT)/opt/ksh93-tests
+
+# Rules for executables
+$(ROOTTESTDIRBASE)/shtests := FILEMODE= 755
+
+$(ROOTTESTDIRBASE)/% $(ROOTTESTDIRBASE)/tests/%: common/tests/%
+ $(INS.file)
+
+$(ROOTTESTDIRBASE)/%: $(TESTFILESRCDIR)/%
+ $(INS.file)
+
+$(ROOTTESTDIRBASE)/%: $(TESTFILESRCDIR)/tests/%
+ $(INS.file)
+
+$(ROOTTESTDIRBASE) $(ROOTTESTDIRBASE)/tests:
+ $(INS.dir)
+
+ROOTTESTDIRS= $(ROOTTESTDIRBASE) .WAIT $(ROOTTESTDIRBASE)/tests
+ROOTTESTFILES= $(TESTFILES:%=$(ROOTTESTDIRBASE)/%)
+
+_testinstall: $(ROOTTESTDIRS) .WAIT $(ROOTTESTFILES)
+install: _testinstall
diff --git a/usr/src/cmd/ast/libshell/common/tests/README.tests b/usr/src/cmd/ast/libshell/common/tests/README.tests
index 91a83d4394..84969cebec 100644
--- a/usr/src/cmd/ast/libshell/common/tests/README.tests
+++ b/usr/src/cmd/ast/libshell/common/tests/README.tests
@@ -3,7 +3,7 @@
## Introduction
-The directory /usr/demo/ksh/tests/ contains the ksh93 test suite
+The directory /opt/ksh93-tests/ contains the ksh93 test suite
which is used to verify the correct behaviour of ksh93.
The test suite is split into modules with the ending *.sh
@@ -11,7 +11,7 @@ and a frontend called "shtests" which is used to run the tests.
## Basic description:
-/usr/demo/ksh/tests/shtests <options> <varname=value> <testmodule>
+/opt/ksh93-tests/shtests <options> <varname=value> <testmodule>
By default, with no <options>, each test is run three times:
@@ -35,8 +35,8 @@ By default, with no <options>, each test is run three times:
The tests can be executed like this:
$ export SHELL=<path-to-ksh93-executable>
$ export SHCOMP=/usr/bin/shcomp
-for t in /usr/demo/ksh/tests/*.sh ; do
- $SHELL /usr/demo/ksh/tests/shtests "$t"
+for t in /opt/ksh93-tests/tests/*.sh; do
+ $SHELL /opt/ksh93-tests/shtests "$t"
done
Note that you MUST NOT use "/usr/bin/ksh93" as value for
diff --git a/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop.c b/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop.c
index 6abda78efc..c9b1eb848e 100644
--- a/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop.c
+++ b/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop.c
@@ -22,6 +22,8 @@
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
+ *
+ * Copyright 2021 Joyent, Inc.
*/
#include <stdio.h>
@@ -79,6 +81,7 @@ int x_length = 0x7fffffff;
FILE *namefile;
boolean_t Pflg;
boolean_t Iflg;
+boolean_t fflg;
boolean_t qflg;
boolean_t rflg;
#ifdef DEBUG
@@ -228,7 +231,7 @@ main(int argc, char **argv)
}
(void) setvbuf(stdout, NULL, _IOLBF, BUFSIZ);
- while ((c = getopt(argc, argv, "at:CPDSi:o:Nn:s:d:I:vVp:f:c:x:U?rqz:Z"))
+ while ((c = getopt(argc, argv, "at:CPDSi:o:Nn:s:d:I:vVp:fc:x:U?rqz:Z"))
!= EOF) {
switch (c) {
case 'a':
@@ -306,21 +309,7 @@ main(int argc, char **argv)
}
break;
case 'f':
- (void) gethostname(self, MAXHOSTNAMELEN);
- p = strchr(optarg, ':');
- if (p) {
- *p = '\0';
- if (strcmp(optarg, self) == 0 ||
- strcmp(p+1, self) == 0)
- (void) fprintf(stderr,
- "Warning: cannot capture packets from %s\n",
- self);
- *p = ' ';
- } else if (strcmp(optarg, self) == 0)
- (void) fprintf(stderr,
- "Warning: cannot capture packets from %s\n",
- self);
- argstr = optarg;
+ fflg = B_TRUE;
break;
case 'x':
p = optarg;
diff --git a/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop.h b/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop.h
index ff9099bbf9..19a8c25a87 100644
--- a/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop.h
+++ b/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop.h
@@ -24,7 +24,7 @@
* Use is subject to license terms.
*
* Copyright 2011 Nexenta Systems, Inc. All rights reserved.
- * Copyright 2018 Joyent, Inc.
+ * Copyright 2021 Joyent, Inc.
*/
#ifndef _SNOOP_H
@@ -349,7 +349,7 @@ extern char *prot_title;
extern unsigned int encap_levels, total_encap_levels;
extern int quitting;
-extern boolean_t Iflg, Pflg, rflg;
+extern boolean_t Iflg, Pflg, fflg, rflg;
/*
* Global error recovery routine: used to reset snoop variables after
diff --git a/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_capture.c b/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_capture.c
index 8fbf3fc15f..5ce947b476 100644
--- a/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_capture.c
+++ b/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_capture.c
@@ -22,6 +22,7 @@
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
* Copyright 2012 Milan Jurik. All rights reserved.
+ * Copyright 2021 Joyent, Inc.
*/
#include <stdio.h>
@@ -178,8 +179,8 @@ void
init_datalink(dlpi_handle_t dh, ulong_t snaplen, ulong_t chunksize,
struct timeval *timeout, struct Pf_ext_packetfilt *fp)
{
- int retv;
- int netfd;
+ int retv;
+ int netfd;
retv = dlpi_bind(dh, DLPI_ANY_SAP, NULL);
if (retv != DLPI_SUCCESS)
@@ -200,22 +201,43 @@ init_datalink(dlpi_handle_t dh, ulong_t snaplen, ulong_t chunksize,
(void) fprintf(stderr, "(promiscuous mode)\n");
retv = dlpi_promiscon(dh, DL_PROMISC_PHYS);
if (retv != DLPI_SUCCESS) {
- pr_errdlpi(dh, "promiscuous mode(physical) failed",
- retv);
+ if (fflg) {
+ (void) fprintf(stderr, "Note: enabling "
+ "promiscuous mode (physical) failed; "
+ "packet capture may not be complete\n");
+ } else {
+ pr_errdlpi(dh,
+ "promiscuous mode (physical) failed; "
+ "use -f to ignore", retv);
+ }
}
} else {
(void) fprintf(stderr, "(non promiscuous)\n");
retv = dlpi_promiscon(dh, DL_PROMISC_MULTI);
if (retv != DLPI_SUCCESS) {
- pr_errdlpi(dh, "promiscuous mode(multicast) failed",
- retv);
+ if (fflg) {
+ (void) fprintf(stderr, "Note: enabling "
+ "promiscuous mode (multicast) failed; "
+ "packet capture may not be complete\n");
+ } else {
+ pr_errdlpi(dh,
+ "promiscuous mode (multicast) failed; "
+ "use -f to ignore", retv);
+ }
}
}
retv = dlpi_promiscon(dh, DL_PROMISC_SAP);
- if (retv != DLPI_SUCCESS)
- pr_errdlpi(dh, "promiscuous mode(SAP) failed", retv);
-
+ if (retv != DLPI_SUCCESS) {
+ if (fflg) {
+ (void) fprintf(stderr, "Note: enabling promiscuous "
+ "mode (SAP) failed; packet capture may not be "
+ "complete\n");
+ } else {
+ pr_errdlpi(dh, "promiscuous mode (SAP) failed; "
+ "use -f to ignore", retv);
+ }
+ }
netfd = dlpi_fd(dh);
if (fp) {
@@ -264,7 +286,7 @@ void
net_read(dlpi_handle_t dh, size_t chunksize, int filter, void (*proc)(),
int flags)
{
- int retval;
+ int retval;
extern int count;
size_t msglen;
@@ -301,7 +323,7 @@ net_read(dlpi_handle_t dh, size_t chunksize, int filter, void (*proc)(),
*/
void
corrupt(volatile char *pktp, volatile char *pstop, char *buf,
- volatile char *bufstop)
+ volatile char *bufstop)
{
int c;
int i;
diff --git a/usr/src/cmd/pcidb/Makefile b/usr/src/cmd/pcidb/Makefile
new file mode 100644
index 0000000000..41a5737c7a
--- /dev/null
+++ b/usr/src/cmd/pcidb/Makefile
@@ -0,0 +1,45 @@
+#
+# This file and its contents are supplied under the terms of the
+# Common Development and Distribution License ("CDDL"), version 1.0.
+# You may only use this file in accordance with the terms of version
+# 1.0 of the CDDL.
+#
+# A full copy of the text of the CDDL should have accompanied this
+# source. A copy of the CDDL is also available via the Internet at
+# http://www.illumos.org/license/CDDL.
+#
+
+#
+# Copyright 2021 Oxide Computer Company
+#
+
+PROG= pcidb
+
+include ../Makefile.cmd
+include ../Makefile.cmd.64
+include ../Makefile.ctf
+
+CFLAGS += $(CCVERBOSE)
+CSTD = $(CSTD_GNU99)
+LDLIBS += -lpcidb -lofmt
+OBJS = pcidb.o
+ROOTCMDDIR = $(ROOTLIB)/pci
+
+.KEEP_STATE:
+
+$(PROG): $(OBJS)
+ $(LINK.c) -o $@ $(OBJS) $(LDLIBS)
+ $(POST_PROCESS)
+
+%.o: %.c
+ $(COMPILE.c) $<
+ $(POST_PROCESS_O)
+
+all: $(PROG)
+
+install: all $(ROOTCMD)
+
+clean:
+ $(RM) $(OBJS)
+
+include ../Makefile.targ
diff --git a/usr/src/cmd/pcidb/pcidb.c b/usr/src/cmd/pcidb/pcidb.c
new file mode 100644
index 0000000000..7a0785c7ae
--- /dev/null
+++ b/usr/src/cmd/pcidb/pcidb.c
@@ -0,0 +1,884 @@
+/*
+ * This file and its contents are supplied under the terms of the
+ * Common Development and Distribution License ("CDDL"), version 1.0.
+ * You may only use this file in accordance with the terms of version
+ * 1.0 of the CDDL.
+ *
+ * A full copy of the text of the CDDL should have accompanied this
+ * source. A copy of the CDDL is also available via the Internet at
+ * http://www.illumos.org/license/CDDL.
+ */
+
+/*
+ * Copyright 2021 Oxide Computer Company
+ */
+
+/*
+ * A tool to interface with the pci.ids database driven by libpcidb.
+ */
+
+#include <stdio.h>
+#include <stdarg.h>
+#include <pcidb.h>
+#include <err.h>
+#include <libgen.h>
+#include <string.h>
+#include <strings.h>
+#include <stdlib.h>
+#include <ofmt.h>
+#include <errno.h>
+#include <sys/debug.h>
+#include <priv.h>
+
+#define EXIT_USAGE 2
+
+static char *pcidb_progname;
+
+typedef enum {
+ PCIDB_MODE_UNKNOWN,
+ PCIDB_MODE_LIST,
+ PCIDB_MODE_SEARCH,
+ PCIDB_MODE_LOOKUP
+} pcidb_mode_t;
+
+typedef enum {
+ PCIDB_TABLE_NONE,
+ PCIDB_TABLE_VENDOR,
+ PCIDB_TABLE_DEVICE,
+ PCIDB_TABLE_SUBSYSTEM,
+ PCIDB_TABLE_CLASS,
+ PCIDB_TABLE_SUBCLASS,
+ PCIDB_TABLE_PROGIF
+} pcidb_table_t;
+
+typedef enum {
+ PCIDB_OFMT_VID,
+ PCIDB_OFMT_VENSTR,
+ PCIDB_OFMT_DID,
+ PCIDB_OFMT_DEVSTR,
+ PCIDB_OFMT_SVID,
+ PCIDB_OFMT_SDID,
+ PCIDB_OFMT_SUBVENSTR,
+ PCIDB_OFMT_SUBSYSSTR,
+ PCIDB_OFMT_BCC,
+ PCIDB_OFMT_CLASSSTR,
+ PCIDB_OFMT_SCC,
+ PCIDB_OFMT_SUBCLASSSTR,
+ PCIDB_OFMT_PI,
+ PCIDB_OFMT_PROGIFSTR
+} pcidb_ofmt_t;
+
+typedef struct pcidb_filter {
+ uint32_t pft_vend;
+ uint32_t pft_dev;
+ uint32_t pft_subven;
+ uint32_t pft_subdev;
+ uint32_t pft_class;
+ uint32_t pft_subclass;
+ uint32_t pft_progif;
+} pcidb_filter_t;
+
+#define PCIDB_NOFILTER UINT32_MAX
+
+typedef struct pcidb_walk {
+ pcidb_hdl_t *pw_hdl;
+ ofmt_handle_t pw_ofmt;
+ pcidb_vendor_t *pw_vendor;
+ pcidb_device_t *pw_device;
+ pcidb_subvd_t *pw_subvd;
+ pcidb_class_t *pw_class;
+ pcidb_subclass_t *pw_subclass;
+ pcidb_progif_t *pw_progif;
+ boolean_t pw_strcase;
+ uint_t pw_nfilters;
+ pcidb_filter_t *pw_filters;
+} pcidb_walk_t;
+
+static boolean_t
+pcidb_write_vendor(ofmt_arg_t *ofarg, char *buf, uint_t buflen)
+{
+ pcidb_walk_t *walk = ofarg->ofmt_cbarg;
+
+ VERIFY(walk->pw_vendor != NULL);
+ switch (ofarg->ofmt_id) {
+ case PCIDB_OFMT_VID:
+ (void) snprintf(buf, buflen, "%x",
+ pcidb_vendor_id(walk->pw_vendor));
+ break;
+ case PCIDB_OFMT_VENSTR:
+ (void) strlcpy(buf, pcidb_vendor_name(walk->pw_vendor), buflen);
+ break;
+ default:
+ abort();
+ }
+ return (B_TRUE);
+}
+
+static boolean_t
+pcidb_write_device(ofmt_arg_t *ofarg, char *buf, uint_t buflen)
+{
+ pcidb_walk_t *walk = ofarg->ofmt_cbarg;
+
+ VERIFY(walk->pw_device != NULL);
+ switch (ofarg->ofmt_id) {
+ case PCIDB_OFMT_DID:
+ (void) snprintf(buf, buflen, "%x",
+ pcidb_device_id(walk->pw_device));
+ break;
+ case PCIDB_OFMT_DEVSTR:
+ (void) strlcpy(buf, pcidb_device_name(walk->pw_device), buflen);
+ break;
+ default:
+ abort();
+ }
+ return (B_TRUE);
+}
+
+static boolean_t
+pcidb_write_subsystem(ofmt_arg_t *ofarg, char *buf, uint_t buflen)
+{
+ pcidb_walk_t *walk = ofarg->ofmt_cbarg;
+ pcidb_vendor_t *vendor;
+
+ VERIFY(walk->pw_subvd != NULL);
+ switch (ofarg->ofmt_id) {
+ case PCIDB_OFMT_SVID:
+ (void) snprintf(buf, buflen, "%x",
+ pcidb_subvd_svid(walk->pw_subvd));
+ break;
+ case PCIDB_OFMT_SDID:
+ (void) snprintf(buf, buflen, "%x",
+ pcidb_subvd_sdid(walk->pw_subvd));
+ break;
+ case PCIDB_OFMT_SUBSYSSTR:
+ (void) strlcpy(buf, pcidb_subvd_name(walk->pw_subvd), buflen);
+ break;
+ case PCIDB_OFMT_SUBVENSTR:
+ vendor = pcidb_lookup_vendor(walk->pw_hdl,
+ pcidb_subvd_svid(walk->pw_subvd));
+ if (vendor == NULL) {
+ return (B_FALSE);
+ }
+ (void) strlcpy(buf, pcidb_vendor_name(vendor), buflen);
+ break;
+ default:
+ abort();
+ }
+ return (B_TRUE);
+}
+
+static boolean_t
+pcidb_write_class(ofmt_arg_t *ofarg, char *buf, uint_t buflen)
+{
+ pcidb_walk_t *walk = ofarg->ofmt_cbarg;
+
+ VERIFY(walk->pw_class != NULL);
+ switch (ofarg->ofmt_id) {
+ case PCIDB_OFMT_BCC:
+ (void) snprintf(buf, buflen, "%x",
+ pcidb_class_code(walk->pw_class));
+ break;
+ case PCIDB_OFMT_CLASSSTR:
+ (void) strlcpy(buf, pcidb_class_name(walk->pw_class), buflen);
+ break;
+ default:
+ abort();
+ }
+ return (B_TRUE);
+}
+
+static boolean_t
+pcidb_write_subclass(ofmt_arg_t *ofarg, char *buf, uint_t buflen)
+{
+ pcidb_walk_t *walk = ofarg->ofmt_cbarg;
+
+ VERIFY(walk->pw_subclass != NULL);
+ switch (ofarg->ofmt_id) {
+ case PCIDB_OFMT_SCC:
+ (void) snprintf(buf, buflen, "%x",
+ pcidb_subclass_code(walk->pw_subclass));
+ break;
+ case PCIDB_OFMT_SUBCLASSSTR:
+ (void) strlcpy(buf, pcidb_subclass_name(walk->pw_subclass),
+ buflen);
+ break;
+ default:
+ abort();
+ }
+ return (B_TRUE);
+}
+
+static boolean_t
+pcidb_write_progif(ofmt_arg_t *ofarg, char *buf, uint_t buflen)
+{
+ pcidb_walk_t *walk = ofarg->ofmt_cbarg;
+
+ VERIFY(walk->pw_progif != NULL);
+ switch (ofarg->ofmt_id) {
+ case PCIDB_OFMT_PI:
+ (void) snprintf(buf, buflen, "%x",
+ pcidb_progif_code(walk->pw_progif));
+ break;
+ case PCIDB_OFMT_PROGIFSTR:
+ (void) strlcpy(buf, pcidb_progif_name(walk->pw_progif),
+ buflen);
+ break;
+ default:
+ abort();
+ }
+ return (B_TRUE);
+}
+
+static const char *pcidb_vendor_fields = "vid,vendor";
+static const ofmt_field_t pcidb_vendor_ofmt[] = {
+ { "VID", 8, PCIDB_OFMT_VID, pcidb_write_vendor },
+ { "VENDOR", 30, PCIDB_OFMT_VENSTR, pcidb_write_vendor },
+ { NULL, 0, 0, NULL }
+};
+
+static const char *pcidb_device_fields = "vid,did,vendor,device";
+static const ofmt_field_t pcidb_device_ofmt[] = {
+ { "VID", 8, PCIDB_OFMT_VID, pcidb_write_vendor },
+ { "VENDOR", 30, PCIDB_OFMT_VENSTR, pcidb_write_vendor },
+ { "DID", 8, PCIDB_OFMT_DID, pcidb_write_device },
+ { "DEVICE", 30, PCIDB_OFMT_DEVSTR, pcidb_write_device },
+ { NULL, 0, 0, NULL }
+};
+
+static const char *pcidb_subsystem_fields = "vid,did,svid,sdid,subsystem";
+static const ofmt_field_t pcidb_subsystem_ofmt[] = {
+ { "VID", 8, PCIDB_OFMT_VID, pcidb_write_vendor },
+ { "VENDOR", 30, PCIDB_OFMT_VENSTR, pcidb_write_vendor },
+ { "DID", 8, PCIDB_OFMT_DID, pcidb_write_device },
+ { "DEVICE", 30, PCIDB_OFMT_DEVSTR, pcidb_write_device },
+ { "SVID", 8, PCIDB_OFMT_SVID, pcidb_write_subsystem },
+ { "SDID", 8, PCIDB_OFMT_SDID, pcidb_write_subsystem },
+ { "SUBSYSTEM", 30, PCIDB_OFMT_SUBSYSSTR, pcidb_write_subsystem },
+ { "SUBVENDOR", 30, PCIDB_OFMT_SUBVENSTR, pcidb_write_subsystem },
+ { NULL, 0, 0, NULL }
+};
+
+static const char *pcidb_class_fields = "bcc,class";
+static const ofmt_field_t pcidb_class_ofmt[] = {
+ { "BCC", 6, PCIDB_OFMT_BCC, pcidb_write_class },
+ { "CLASS", 30, PCIDB_OFMT_CLASSSTR, pcidb_write_class },
+ { NULL, 0, 0, NULL }
+};
+
+static const char *pcidb_subclass_fields = "bcc,scc,class,subclass";
+static const ofmt_field_t pcidb_subclass_ofmt[] = {
+ { "BCC", 6, PCIDB_OFMT_BCC, pcidb_write_class },
+ { "CLASS", 30, PCIDB_OFMT_CLASSSTR, pcidb_write_class },
+ { "SCC", 6, PCIDB_OFMT_SCC, pcidb_write_subclass },
+ { "SUBCLASS", 30, PCIDB_OFMT_SUBCLASSSTR, pcidb_write_subclass },
+ { NULL, 0, 0, NULL }
+};
+
+static const char *pcidb_progif_fields = "bcc,scc,pi,subclass,interface";
+static const ofmt_field_t pcidb_progif_ofmt[] = {
+ { "BCC", 6, PCIDB_OFMT_BCC, pcidb_write_class },
+ { "CLASS", 30, PCIDB_OFMT_CLASSSTR, pcidb_write_class },
+ { "SCC", 6, PCIDB_OFMT_SCC, pcidb_write_subclass },
+ { "SUBCLASS", 30, PCIDB_OFMT_SUBCLASSSTR, pcidb_write_subclass },
+ { "PI", 6, PCIDB_OFMT_PI, pcidb_write_progif },
+ { "INTERFACE", 30, PCIDB_OFMT_PROGIFSTR, pcidb_write_progif },
+ { NULL, 0, 0, NULL }
+};
+
+static void
+pcidb_ofmt_errx(const char *fmt, ...)
+{
+ va_list ap;
+
+ va_start(ap, fmt);
+ verrx(EXIT_FAILURE, fmt, ap);
+}
+
+static boolean_t
+pcidb_filter_match(pcidb_walk_t *walk)
+{
+ if (walk->pw_nfilters == 0) {
+ return (B_TRUE);
+ }
+
+ for (uint_t i = 0; i < walk->pw_nfilters; i++) {
+ const pcidb_filter_t *filt = &walk->pw_filters[i];
+ if (filt->pft_vend != PCIDB_NOFILTER &&
+ (walk->pw_vendor == NULL ||
+ filt->pft_vend != pcidb_vendor_id(walk->pw_vendor))) {
+ continue;
+ }
+
+ if (filt->pft_dev != PCIDB_NOFILTER &&
+ (walk->pw_device == NULL ||
+ filt->pft_dev != pcidb_device_id(walk->pw_device))) {
+ continue;
+ }
+
+ if (filt->pft_subven != PCIDB_NOFILTER &&
+ (walk->pw_subvd == NULL ||
+ filt->pft_subven != pcidb_subvd_svid(walk->pw_subvd))) {
+ continue;
+ }
+
+ if (filt->pft_subdev != PCIDB_NOFILTER &&
+ (walk->pw_subvd == NULL ||
+ filt->pft_subdev != pcidb_subvd_sdid(walk->pw_subvd))) {
+ continue;
+ }
+
+ if (filt->pft_class != PCIDB_NOFILTER &&
+ (walk->pw_class == NULL ||
+ filt->pft_class != pcidb_class_code(walk->pw_class))) {
+ continue;
+ }
+
+ if (filt->pft_subclass != PCIDB_NOFILTER &&
+ (walk->pw_subclass == NULL ||
+ filt->pft_subclass !=
+ pcidb_subclass_code(walk->pw_subclass))) {
+ continue;
+ }
+
+ if (filt->pft_progif != PCIDB_NOFILTER &&
+ (walk->pw_progif == NULL ||
+ filt->pft_progif != pcidb_progif_code(walk->pw_progif))) {
+ continue;
+ }
+
+ return (B_TRUE);
+ }
+
+ return (B_FALSE);
+}
+
+static void
+pcidb_walk_vendors(pcidb_walk_t *walk)
+{
+ pcidb_hdl_t *hdl = walk->pw_hdl;
+
+ for (pcidb_vendor_t *vend = pcidb_vendor_iter(hdl); vend != NULL;
+ vend = pcidb_vendor_iter_next(vend)) {
+ walk->pw_vendor = vend;
+ if (!pcidb_filter_match(walk))
+ continue;
+ ofmt_print(walk->pw_ofmt, walk);
+ }
+}
+
+static void
+pcidb_walk_devices(pcidb_walk_t *walk)
+{
+ pcidb_hdl_t *hdl = walk->pw_hdl;
+
+ for (pcidb_vendor_t *vend = pcidb_vendor_iter(hdl); vend != NULL;
+ vend = pcidb_vendor_iter_next(vend)) {
+ walk->pw_vendor = vend;
+ for (pcidb_device_t *dev = pcidb_device_iter(vend); dev != NULL;
+ dev = pcidb_device_iter_next(dev)) {
+ walk->pw_device = dev;
+ if (!pcidb_filter_match(walk))
+ continue;
+ ofmt_print(walk->pw_ofmt, walk);
+ }
+ }
+}
+
+static void
+pcidb_walk_subsystems(pcidb_walk_t *walk)
+{
+ pcidb_hdl_t *hdl = walk->pw_hdl;
+
+ for (pcidb_vendor_t *vend = pcidb_vendor_iter(hdl); vend != NULL;
+ vend = pcidb_vendor_iter_next(vend)) {
+ walk->pw_vendor = vend;
+ for (pcidb_device_t *dev = pcidb_device_iter(vend); dev != NULL;
+ dev = pcidb_device_iter_next(dev)) {
+ walk->pw_device = dev;
+ for (pcidb_subvd_t *sub = pcidb_subvd_iter(dev);
+ sub != NULL; sub = pcidb_subvd_iter_next(sub)) {
+ walk->pw_subvd = sub;
+ if (!pcidb_filter_match(walk))
+ continue;
+ ofmt_print(walk->pw_ofmt, walk);
+ }
+ }
+
+ }
+}
+
+static void
+pcidb_walk_classes(pcidb_walk_t *walk)
+{
+ for (pcidb_class_t *class = pcidb_class_iter(walk->pw_hdl);
+ class != NULL; class = pcidb_class_iter_next(class)) {
+ walk->pw_class = class;
+ if (!pcidb_filter_match(walk))
+ continue;
+ ofmt_print(walk->pw_ofmt, walk);
+ }
+}
+
+static void
+pcidb_walk_subclasses(pcidb_walk_t *walk)
+{
+ for (pcidb_class_t *class = pcidb_class_iter(walk->pw_hdl);
+ class != NULL; class = pcidb_class_iter_next(class)) {
+ walk->pw_class = class;
+ for (pcidb_subclass_t *sub = pcidb_subclass_iter(class);
+ sub != NULL; sub = pcidb_subclass_iter_next(sub)) {
+ walk->pw_subclass = sub;
+ if (!pcidb_filter_match(walk))
+ continue;
+ ofmt_print(walk->pw_ofmt, walk);
+ }
+ }
+}
+
+static void
+pcidb_walk_progifs(pcidb_walk_t *walk)
+{
+ for (pcidb_class_t *class = pcidb_class_iter(walk->pw_hdl);
+ class != NULL; class = pcidb_class_iter_next(class)) {
+ walk->pw_class = class;
+ for (pcidb_subclass_t *sub = pcidb_subclass_iter(class);
+ sub != NULL; sub = pcidb_subclass_iter_next(sub)) {
+ walk->pw_subclass = sub;
+ for (pcidb_progif_t *progif = pcidb_progif_iter(sub);
+ progif != NULL;
+ progif = pcidb_progif_iter_next(progif)) {
+ walk->pw_progif = progif;
+ if (!pcidb_filter_match(walk))
+ continue;
+ ofmt_print(walk->pw_ofmt, walk);
+ }
+ }
+ }
+}
+
+static void
+pcidb_parse_class_filter(pcidb_filter_t *filter, char *arg, const char *orig)
+{
+ size_t len;
+ unsigned long val;
+ char *eptr;
+
+ filter->pft_vend = filter->pft_dev = PCIDB_NOFILTER;
+ filter->pft_subven = filter->pft_subdev = PCIDB_NOFILTER;
+
+ len = strlen(arg);
+ if (len != 2 && len != 4 && len != 6) {
+ errx(EXIT_FAILURE, "invalid class filter: '%s': bad length",
+ orig);
+ }
+
+ errno = 0;
+ val = strtoul(arg, &eptr, 16);
+ if (errno != 0 || *eptr != '\0') {
+ errx(EXIT_FAILURE, "invalid class filter: '%s': failed to "
+ "parse hex string", orig);
+ }
+
+ if (len == 6) {
+ filter->pft_progif = val & 0xff;
+ val = val >> 8;
+ } else {
+ filter->pft_progif = PCIDB_NOFILTER;
+ }
+
+ if (len >= 4) {
+ filter->pft_subclass = val & 0xff;
+ val = val >> 8;
+ } else {
+ filter->pft_subclass = PCIDB_NOFILTER;
+ }
+
+ filter->pft_class = val & 0xff;
+}
+
+static void
+pcidb_parse_device_filter(pcidb_filter_t *filter, char *arg, const char *orig)
+{
+ unsigned long val;
+ uint32_t primary, secondary;
+ char *eptr;
+
+ filter->pft_vend = filter->pft_dev = PCIDB_NOFILTER;
+ filter->pft_subven = filter->pft_subdev = PCIDB_NOFILTER;
+ filter->pft_class = filter->pft_subclass = PCIDB_NOFILTER;
+ filter->pft_progif = PCIDB_NOFILTER;
+
+ errno = 0;
+ val = strtoul(arg, &eptr, 16);
+ if (errno != 0 || (*eptr != '\0' && *eptr != ',')) {
+ errx(EXIT_FAILURE, "invalid device filter: '%s': failed to "
+ "parse hex string", orig);
+ }
+
+ if (val > UINT16_MAX) {
+ errx(EXIT_FAILURE, "invalid id: %x is larger than 0xffff", val);
+ }
+
+ primary = (uint32_t)val;
+ if (*eptr == '\0') {
+ filter->pft_vend = primary;
+ return;
+ } else if (strcmp(eptr, ",s") == 0) {
+ filter->pft_subven = primary;
+ return;
+ } else if (eptr[1] == '\0') {
+ errx(EXIT_FAILURE, "invalid device filter: '%s': filter "
+ "terminated early", arg);
+ }
+
+ arg = eptr + 1;
+ val = strtoul(arg, &eptr, 16);
+ if (errno != 0 || (*eptr != '\0' && *eptr != ',' && *eptr != '.')) {
+ errx(EXIT_FAILURE, "invalid device filter: '%s': failed to "
+ "parse hex string at %s", orig, arg);
+ }
+
+ if (val > UINT16_MAX) {
+ errx(EXIT_FAILURE, "invalid id: %x is larger than 0xffff", val);
+ }
+
+ secondary = (uint32_t)val;
+ if (*eptr == '\0') {
+ filter->pft_vend = primary;
+ filter->pft_dev = secondary;
+ return;
+ } else if (eptr[1] == '\0') {
+ errx(EXIT_FAILURE, "invalid device filter: '%s': filter "
+ "terminated early", arg);
+ }
+
+ if (*eptr == ',') {
+ if (eptr[1] == 'p' && eptr[2] == '\0') {
+ filter->pft_vend = primary;
+ filter->pft_dev = secondary;
+ return;
+ }
+ if (eptr[1] == 's' && eptr[2] == '\0') {
+ filter->pft_subven = primary;
+ filter->pft_subdev = secondary;
+ return;
+ }
+ errx(EXIT_FAILURE, "invalid device filter: '%s': invalid "
+ "trailing comma at %s, expected either ,p or ,s",
+ orig, eptr);
+ }
+
+ filter->pft_vend = primary;
+ filter->pft_dev = secondary;
+
+ arg = eptr + 1;
+ errno = 0;
+ val = strtoul(arg, &eptr, 16);
+ if (errno != 0 || (*eptr != '\0' && *eptr != ',')) {
+ errx(EXIT_FAILURE, "invalid device filter: '%s': failed to "
+ "parse hex string at %s", orig, arg);
+ }
+
+ if (val > UINT16_MAX) {
+ errx(EXIT_FAILURE, "invalid id: %x is larger than 0xffff", val);
+ }
+
+ filter->pft_subven = (uint32_t)val;
+ if (*eptr == '\0') {
+ return;
+ } else if (eptr[1] == '\0') {
+ errx(EXIT_FAILURE, "invalid device filter: '%s': filter "
+ "terminated early", arg);
+ }
+
+ arg = eptr + 1;
+ errno = 0;
+ val = strtoul(arg, &eptr, 16);
+ if (errno != 0 || *eptr != '\0') {
+ errx(EXIT_FAILURE, "invalid device filter: '%s': failed to "
+ "parse hex string at %s", orig, arg);
+ }
+
+ if (val > UINT16_MAX) {
+ errx(EXIT_FAILURE, "invalid id: %x is larger than 0xffff", val);
+ }
+
+ filter->pft_subdev = (uint32_t)val;
+}
+
+
+/*
+ * Process a series of alias style ways of indicating numeric filters. Use the
+ * basic alias format for now.
+ */
+static void
+pcidb_process_filters(int argc, char *argv[], pcidb_walk_t *walkp)
+{
+ if (argc <= 0) {
+ walkp->pw_nfilters = 0;
+ return;
+ }
+
+ walkp->pw_nfilters = argc;
+ walkp->pw_filters = calloc(walkp->pw_nfilters, sizeof (pcidb_filter_t));
+ if (walkp->pw_filters == NULL) {
+ err(EXIT_FAILURE, "failed to allocate memory for filters");
+ }
+
+ for (int i = 0; i < argc; i++) {
+ char *str = strdup(argv[i]);
+
+ if (str == NULL) {
+ errx(EXIT_FAILURE, "failed to duplicate string %s",
+ argv[i]);
+ }
+
+ if (strncmp(str, "pciexclass,", 11) == 0) {
+ pcidb_parse_class_filter(&walkp->pw_filters[i],
+ str + 11, argv[i]);
+ } else if (strncmp(str, "pciclass,", 9) == 0) {
+ pcidb_parse_class_filter(&walkp->pw_filters[i], str + 9,
+ argv[i]);
+ } else if (strncmp(str, "pciex", 5) == 0) {
+ pcidb_parse_device_filter(&walkp->pw_filters[i],
+ str + 5, argv[i]);
+ } else if (strncmp(str, "pci", 3) == 0) {
+ pcidb_parse_device_filter(&walkp->pw_filters[i],
+ str + 3, argv[i]);
+ } else {
+ errx(EXIT_FAILURE, "invalid filter string: %s", str);
+ }
+
+ free(str);
+ }
+}
+
+static void
+pcidb_drop_privs(void)
+{
+ priv_set_t *curprivs, *targprivs;
+
+ if ((curprivs = priv_allocset()) == NULL) {
+ err(EXIT_FAILURE, "failed to allocate privilege set to drop "
+ "privs");
+ }
+
+ if (getppriv(PRIV_EFFECTIVE, curprivs) != 0) {
+ err(EXIT_FAILURE, "failed to get current privileges");
+ }
+
+ if ((targprivs = priv_allocset()) == NULL) {
+ err(EXIT_FAILURE, "failed to allocate privilege set to drop "
+ "privs");
+ }
+
+ /*
+ * Set our privileges to the minimum required. Because stdout will have
+ * already been opened, all we need is the ability to read files from
+ * basic privileges. We opt to keep FILE_DAC_READ if the caller has it
+ * just in case there is something weird about the location of the
+ * pci.ids files.
+ */
+ priv_basicset(targprivs);
+ VERIFY0(priv_delset(targprivs, PRIV_FILE_LINK_ANY));
+ VERIFY0(priv_delset(targprivs, PRIV_PROC_INFO));
+ VERIFY0(priv_delset(targprivs, PRIV_PROC_SESSION));
+ VERIFY0(priv_delset(targprivs, PRIV_PROC_FORK));
+ VERIFY0(priv_delset(targprivs, PRIV_NET_ACCESS));
+ VERIFY0(priv_delset(targprivs, PRIV_FILE_WRITE));
+ VERIFY0(priv_delset(targprivs, PRIV_PROC_EXEC));
+ VERIFY0(priv_addset(targprivs, PRIV_FILE_DAC_READ));
+
+ priv_intersect(curprivs, targprivs);
+
+ if (setppriv(PRIV_SET, PRIV_EFFECTIVE, targprivs) != 0) {
+ err(EXIT_FAILURE, "failed to reduce privileges");
+ }
+
+ priv_freeset(curprivs);
+ priv_freeset(targprivs);
+}
+
+static int
+pcidb_usage(const char *fmt, ...)
+{
+ if (fmt != NULL) {
+ va_list ap;
+
+ (void) fprintf(stderr, "%s: ", pcidb_progname);
+ va_start(ap, fmt);
+ (void) vfprintf(stderr, fmt, ap);
+ va_end(ap);
+ (void) fprintf(stderr, "\n");
+ }
+
+ (void) fprintf(stderr, "usage: %s [-v|-d|-s|-c|-S|-i] [-H]"
+ "[[-p] [-o <field>[,...]] [<filter>]\n\n"
+ "\t-v\t\tshow vendor table\n"
+ "\t-d\t\tshow device table\n"
+ "\t-s\t\tshow subsystem table\n"
+ "\t-c\t\tshow class table\n"
+ "\t-S\t\tshow subclass table\n"
+ "\t-i\t\tshow programming interface table\n"
+ "\t-H\t\tdo not output column headers\n"
+ "\t-p\t\toutput in parsable form\n"
+ "\t-o field\toutput only specified fields\n\n"
+ "filters take the form of PCI aliases, e.g. pci8086,1522, "
+ "pci1028,1f44,s, or\n"
+ "pciex1022,1480.1462,7c37. Classes can be specified in a similar "
+ "way, e.g.\npciclass,010802 or pciclass,0403.\n", pcidb_progname);
+
+ return (EXIT_USAGE);
+}
+
+int
+main(int argc, char *argv[])
+{
+ pcidb_hdl_t *hdl;
+ int c;
+ uint_t tablecnt = 0;
+ pcidb_table_t table = PCIDB_TABLE_NONE;
+ boolean_t parse = B_FALSE, strcase = B_FALSE;
+ const char *fields = NULL;
+ const char *ofmt_fields_str = NULL;
+ const ofmt_field_t *ofmt_fields = NULL;
+ ofmt_handle_t ofmt;
+ ofmt_status_t oferr;
+ uint_t flags = 0;
+ pcidb_walk_t walk;
+
+ bzero(&walk, sizeof (walk));
+ pcidb_progname = basename(argv[0]);
+
+ pcidb_drop_privs();
+
+ while ((c = getopt(argc, argv, ":vdscSipo:hH")) != -1) {
+ switch (c) {
+ case 'v':
+ tablecnt++;
+ table = PCIDB_TABLE_VENDOR;
+ break;
+ case 'd':
+ tablecnt++;
+ table = PCIDB_TABLE_DEVICE;
+ break;
+ case 's':
+ tablecnt++;
+ table = PCIDB_TABLE_SUBSYSTEM;
+ break;
+ case 'c':
+ tablecnt++;
+ table = PCIDB_TABLE_CLASS;
+ break;
+ case 'S':
+ tablecnt++;
+ table = PCIDB_TABLE_SUBCLASS;
+ break;
+ case 'i':
+ tablecnt++;
+ table = PCIDB_TABLE_PROGIF;
+ break;
+ case 'p':
+ parse = B_TRUE;
+ flags |= OFMT_PARSABLE;
+ break;
+ case 'o':
+ fields = optarg;
+ break;
+ case 'h':
+ return (pcidb_usage(NULL));
+ case 'H':
+ flags |= OFMT_NOHEADER;
+ break;
+ case ':':
+ return (pcidb_usage("Option -%c requires an argument",
+ optopt));
+ case '?':
+ return (pcidb_usage("unknown option: -%c", optopt));
+ }
+ }
+
+ if (tablecnt > 1) {
+ errx(EXIT_USAGE, "more than one table specified, only one of "
+ "-v, -d, -s, -c, -S, and -i may be specified");
+ }
+
+ if (parse && fields == NULL) {
+ errx(EXIT_USAGE, "-p requires fields specified with -o");
+ }
+
+ argc -= optind;
+ argv += optind;
+
+ pcidb_process_filters(argc, argv, &walk);
+
+ switch (table) {
+ case PCIDB_TABLE_VENDOR:
+ ofmt_fields = pcidb_vendor_ofmt;
+ ofmt_fields_str = pcidb_vendor_fields;
+ break;
+ case PCIDB_TABLE_NONE:
+ case PCIDB_TABLE_DEVICE:
+ ofmt_fields = pcidb_device_ofmt;
+ ofmt_fields_str = pcidb_device_fields;
+ break;
+ case PCIDB_TABLE_SUBSYSTEM:
+ ofmt_fields = pcidb_subsystem_ofmt;
+ ofmt_fields_str = pcidb_subsystem_fields;
+ break;
+ case PCIDB_TABLE_CLASS:
+ ofmt_fields = pcidb_class_ofmt;
+ ofmt_fields_str = pcidb_class_fields;
+ break;
+ case PCIDB_TABLE_SUBCLASS:
+ ofmt_fields = pcidb_subclass_ofmt;
+ ofmt_fields_str = pcidb_subclass_fields;
+ break;
+ case PCIDB_TABLE_PROGIF:
+ ofmt_fields = pcidb_progif_ofmt;
+ ofmt_fields_str = pcidb_progif_fields;
+ break;
+ }
+
+ if (fields == NULL) {
+ fields = ofmt_fields_str;
+ }
+
+ oferr = ofmt_open(fields, ofmt_fields, flags, 0, &ofmt);
+ ofmt_check(oferr, parse, ofmt, pcidb_ofmt_errx, warnx);
+
+ hdl = pcidb_open(PCIDB_VERSION);
+ if (hdl == NULL) {
+ err(EXIT_FAILURE, "failed to initialize PCI IDs database");
+ }
+
+ walk.pw_hdl = hdl;
+ walk.pw_ofmt = ofmt;
+ walk.pw_strcase = strcase;
+
+ switch (table) {
+ case PCIDB_TABLE_VENDOR:
+ pcidb_walk_vendors(&walk);
+ break;
+ case PCIDB_TABLE_NONE:
+ case PCIDB_TABLE_DEVICE:
+ pcidb_walk_devices(&walk);
+ break;
+ case PCIDB_TABLE_SUBSYSTEM:
+ pcidb_walk_subsystems(&walk);
+ break;
+ case PCIDB_TABLE_CLASS:
+ pcidb_walk_classes(&walk);
+ break;
+ case PCIDB_TABLE_SUBCLASS:
+ pcidb_walk_subclasses(&walk);
+ break;
+ case PCIDB_TABLE_PROGIF:
+ pcidb_walk_progifs(&walk);
+ break;
+ }
+
+ ofmt_close(ofmt);
+ pcidb_close(hdl);
+ return (EXIT_SUCCESS);
+}
diff --git a/usr/src/cmd/tail/tests/sun_solaris_tail.sh b/usr/src/cmd/tail/tests/sun_solaris_tail.sh
index b78e487d26..6f329c1ae2 100755
--- a/usr/src/cmd/tail/tests/sun_solaris_tail.sh
+++ b/usr/src/cmd/tail/tests/sun_solaris_tail.sh
@@ -26,7 +26,7 @@
#
# Additional tests borrowed from ksh93 builtin tail test script
-# (usr/src/lib/libshell/common/tests/sun_solaris_builtin_tail). Modified
+# (usr/src/cmd/ast/libshell/common/tests/sun_solaris_builtin_tail). Modified
# to use /usr/bin/tail rather than the ksh93 builtin.
#
TAIL=/usr/bin/tail
@@ -73,12 +73,12 @@ function waitpidtimeout
float -r STEP=0.5 # const
(( timeout=timeout/STEP ))
-
+
for (( i=0 ; i < timeout ; i+=STEP )) ; do
isvalidpid ${pid} || break
sleep ${STEP}
done
-
+
return 0
}
@@ -110,7 +110,7 @@ function myintseq
return 1
;;
esac
-
+
return 0
}
@@ -168,7 +168,7 @@ compound -a testcases=(
input=$'1\n2\n3\n4'
compound -A tail_args=(
[legacy]=( argv=( "-0" ) )
-# [std_like]=( argv=( "-n" "0" ) )
+# [std_like]=( argv=( "-n" "0" ) )
)
expected_output=$''
)
@@ -311,22 +311,22 @@ for testid in "${!testcases[@]}" ; do
for argv_variants in "${!tc.tail_args[@]}" ; do
nameref argv=tc.tail_args[${argv_variants}].argv
output=$(
- set -o pipefail
- (trap "" PIPE ; print -r -- "${tc.input}") | $TAIL "${argv[@]}"
+ set -o pipefail
+ (trap "" PIPE ; print -r -- "${tc.input}") | $TAIL "${argv[@]}"
) || err_exit "test ${tc.name}/${argv_variants}: command failed with exit code $?"
-
+
[[ "${output}" == "${tc.expected_output}" ]] || err_exit "test ${tc.name}/${argv_variants}: Expected $(doublebackslashquote "${tc.expected_output}"), got $(doublebackslashquote "${output}")"
done
done
# test2: test "tail -r </etc/profile | rev -l" vs. "cat </etc/profile"
-[[ "$($TAIL -r </etc/profile | rev -l)" == "$( cat /etc/profile )" ]] || err_exit "'tail -r </etc/profile | rev -l' output does not match 'cat /etc/profile'"
+[[ "$($TAIL -r </etc/profile | rev -l)" == "$( cat /etc/profile )" ]] || err_exit "'tail -r </etc/profile | rev -l' output does not match 'cat /etc/profile'"
# Test case not applicable to FreeBSD 'tail'
# test 3: ast-ksh.2009-05-05 "tail" builtin may crash if we pass unsupported long options
#$SHELL -o errexit -c 'builtin tail ; print "hello" | tail --attack_of_chicken_monsters' >/dev/null 2>&1
-#(( $? == 2 )) || err_exit "expected exit code 2 for unsupported long option, got $?"
+#(( $? == 2 )) || err_exit "expected exit code 2 for unsupported long option, got $?"
# test 4: FIFO tests
@@ -338,7 +338,7 @@ function test_tail_fifo_1
typeset tail_cmd="$1"
integer i
integer tail_pid=-1
-
+
# cleanup trap
trap "rm -f tailtestfifo tailout" EXIT
@@ -358,7 +358,7 @@ function test_tail_fifo_1
fi
wait || err_exit "tail child returned non-zero exit code=$?"
-
+
[[ "$(cat tailout)" == $'11\n12\n13\n14\n15\n16\n17\n18\n19\n20' ]] || err_exit "test_tail_fifo_1: Expected $(doublebackslashquote '11\n12\n13\n14\n15\n16\n17\n18\n19\n20'), got $(doublebackslashquote "$(cat tailout)")"
return 0
@@ -369,7 +369,7 @@ function test_tail_fifo_2
typeset tail_cmd="$1"
integer i
integer tail_pid=-1
-
+
# cleanup trap
trap "rm -f tailtestfifo tailout" EXIT
@@ -398,7 +398,7 @@ function test_tail_fifo_2
fi
wait || err_exit "tail child returned non-zero exit code=$?"
-
+
[[ "$(cat tailout)" == $'5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15' ]] || err_exit "test_tail_fifo_2: Expected $(doublebackslashquote $'5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15'), got $(doublebackslashquote "$(cat tailout)")"
return 0
@@ -426,7 +426,7 @@ function followtest1
if ${usenewline} ; then
newline=$'\n'
fi
-
+
rm -f "${FOLLOWFILE}" "${OUTFILE}"
print -n "${newline}" > "${FOLLOWFILE}"
@@ -444,14 +444,14 @@ function followtest1
kill -KILL ${tailchild} 2>/dev/null
#kill -TERM ${tailchild} 2>/dev/null
waitpidtimeout ${tailchild} 5
-
+
if isvalidpid ${tailchild} ; then
err_exit "${title}: tail pid=${tailchild} hung."
kill -KILL ${tailchild} 2>/dev/null
fi
-
+
wait ${tailchild} 2>/dev/null
-
+
rm -f "${FOLLOWFILE}" "${OUTFILE}"
return 0
@@ -482,24 +482,24 @@ function followtest2
${testcmd} -n 60000 -f "${FOLLOWFILE}" >"${OUTFILE}" &
(( tailchild=$! ))
-
+
sleep 10
kill -KILL ${tailchild} 2>/dev/null
#kill -TERM ${tailchild} 2>/dev/null
waitpidtimeout ${tailchild} 5
-
+
if isvalidpid ${tailchild} ; then
err_exit "${title}: tail pid=${tailchild} hung."
kill -KILL ${tailchild} 2>/dev/null
fi
-
+
wait ${tailchild} 2>/dev/null
-
+
# this tail should be an external process
outstr=$(/usr/bin/tail "${OUTFILE}") || err_exit "tail returned non-zero exit code $?"
- [[ "${outstr}" == 49991*50000 ]] || err_exit "${title}: Expected match for 49991*50000, got "$(singlebackslashquote "${outstr}")""
-
+ [[ "${outstr}" == 49991*50000 ]] || err_exit "${title}: Expected match for 49991*50000, got "$(singlebackslashquote "${outstr}")""
+
rm -f "${FOLLOWFILE}" "${OUTFILE}"
return 0
diff --git a/usr/src/cmd/xargs/xargs.c b/usr/src/cmd/xargs/xargs.c
index ba582df141..d16ff2fc16 100644
--- a/usr/src/cmd/xargs/xargs.c
+++ b/usr/src/cmd/xargs/xargs.c
@@ -736,12 +736,12 @@ ermsg(char *messages, ...)
}
static int
-echoargs()
+echoargs(void)
{
char **anarg;
char **tanarg; /* tmp ptr */
- int i;
- char reply[LINE_MAX];
+ int i;
+ char reply[LINE_MAX];
tanarg = anarg = arglist-1;
@@ -773,7 +773,10 @@ echoargs()
break;
}
}
- reply[i] = 0;
+ if (i < LINE_MAX)
+ reply[i] = '\0';
+ else
+ reply[LINE_MAX - 1] = '\0';
/* flush remainder of line if necessary */
if (i == LINE_MAX) {
diff --git a/usr/src/contrib/ast/src/cmd/ksh93/bltins/print.c b/usr/src/contrib/ast/src/cmd/ksh93/bltins/print.c
index 93e4ac3ebd..c5121cfb35 100644
--- a/usr/src/contrib/ast/src/cmd/ksh93/bltins/print.c
+++ b/usr/src/contrib/ast/src/cmd/ksh93/bltins/print.c
@@ -21,7 +21,7 @@
/*
* echo [arg...]
* print [-nrps] [-f format] [-u filenum] [arg...]
- * printf format [arg...]
+ * printf [--] format [arg...]
*
* David Korn
* AT&T Labs
@@ -199,6 +199,13 @@ int b_print(int argc, char *argv[], Shbltin_t *context)
goto skip;
}
argv++;
+ /*
+ * POSIX says: Standard utilities that do not accept options,
+ * but that do accept operands, shall recognise "--" as a
+ * first argument to be discarded.
+ */
+ if (argv[0] != NULL && strcmp(argv[0], "--") == 0)
+ argv++;
goto printf;
}
while((n = optget(argv,options))) switch(n)
diff --git a/usr/src/contrib/ast/src/cmd/ksh93/tests/builtins.sh b/usr/src/contrib/ast/src/cmd/ksh93/tests/builtins.sh
index 1d24904e76..33eba61fc0 100755
--- a/usr/src/contrib/ast/src/cmd/ksh93/tests/builtins.sh
+++ b/usr/src/contrib/ast/src/cmd/ksh93/tests/builtins.sh
@@ -213,6 +213,18 @@ do if (( $(( ${base[$i]}$(printf "%$i" $n) )) != n ))
then err_exit "printf %$i not working"
fi
done
+if [[ $(printf -eexist) != -eexist ]]
+then err_exit 'printf -eexist ... not working'
+fi
+if [[ $(printf -- "%s" foo) != foo ]]
+then err_exit 'printf -- not working'
+fi
+if [[ $(printf -- --) != -- ]]
+then err_exit 'printf -- -- ... not working'
+fi
+if [[ $(printf -- -eexist) != -eexist ]]
+then err_exit 'printf -- -eexist. not working'
+fi
if [[ $( trap 'print done' EXIT) != done ]]
then err_exit 'trap on EXIT not working'
fi
diff --git a/usr/src/lib/libpcidb/Makefile.com b/usr/src/lib/libpcidb/Makefile.com
index 43a327423b..96ff944ad5 100644
--- a/usr/src/lib/libpcidb/Makefile.com
+++ b/usr/src/lib/libpcidb/Makefile.com
@@ -24,7 +24,7 @@
LIBRARY = libpcidb.a
VERS = .1
-OBJECTS = pcidb.o
+OBJECTS = pcidb.o list.o
include ../../Makefile.lib
@@ -33,11 +33,16 @@ LIBS = $(DYNLIB)
SRCDIR = ../common
LDLIBS += -lc
+CSTD = $(CSTD_GNU99)
.KEEP_STATE:
all: $(LIBS)
+pics/%.o: $(SRC)/common/list/%.c
+ $(COMPILE.c) -o $@ $<
+ $(POST_PROCESS_O)
+
include ../../Makefile.targ
diff --git a/usr/src/lib/libpcidb/common/mapfile-vers b/usr/src/lib/libpcidb/common/mapfile-vers
index 509778b0e8..8c17896938 100644
--- a/usr/src/lib/libpcidb/common/mapfile-vers
+++ b/usr/src/lib/libpcidb/common/mapfile-vers
@@ -20,6 +20,7 @@
#
#
# Copyright (c) 2012 Joyent, Inc. All rights reserved.
+# Copyright 2021 Oxide Computer Company
#
#
@@ -40,30 +41,47 @@ $mapfile_version 2
SYMBOL_VERSION SUNWprivate {
global:
- pcidb_open;
+ pcidb_class_code;
+ pcidb_class_iter_next;
+ pcidb_class_iter;
+ pcidb_class_name;
pcidb_close;
- pcidb_lookup_vendor;
- pcidb_vendor_iter;
- pcidb_vendor_iter_next;
- pcidb_vendor_name;
- pcidb_vendor_id;
- pcidb_lookup_device;
- pcidb_lookup_device_by_vendor;
- pcidb_device_iter;
+ pcidb_device_id;
pcidb_device_iter_next;
+ pcidb_device_iter;
pcidb_device_name;
- pcidb_device_id;
pcidb_device_vendor;
+ pcidb_lookup_class;
+ pcidb_lookup_device_by_vendor;
+ pcidb_lookup_device;
+ pcidb_lookup_progif_by_subclass;
+ pcidb_lookup_progif;
+ pcidb_lookup_subclass_by_class;
+ pcidb_lookup_subclass;
+ pcidb_lookup_subvd_by_device;
+ pcidb_lookup_subvd_by_vendor;
pcidb_lookup_subvd;
- pcidb_lookup_subvd_by_vendor;
- pcidb_lookup_subvd_by_device;
- pcidb_subvd_iter;
+ pcidb_lookup_vendor;
+ pcidb_open;
+ pcidb_progif_code;
+ pcidb_progif_iter_next;
+ pcidb_progif_iter;
+ pcidb_progif_name;
+ pcidb_subclass_code;
+ pcidb_subclass_iter_next;
+ pcidb_subclass_iter;
+ pcidb_subclass_name;
+ pcidb_subvd_device;
pcidb_subvd_iter_next;
+ pcidb_subvd_iter;
pcidb_subvd_name;
- pcidb_subvd_svid;
pcidb_subvd_sdid;
- pcidb_subvd_device;
+ pcidb_subvd_svid;
pcidb_subvd_vendor;
+ pcidb_vendor_id;
+ pcidb_vendor_iter_next;
+ pcidb_vendor_iter;
+ pcidb_vendor_name;
local:
*;
};
diff --git a/usr/src/lib/libpcidb/common/pcidb.c b/usr/src/lib/libpcidb/common/pcidb.c
index 37bfc75f06..bac836f256 100644
--- a/usr/src/lib/libpcidb/common/pcidb.c
+++ b/usr/src/lib/libpcidb/common/pcidb.c
@@ -20,6 +20,7 @@
*/
/*
* Copyright (c) 2012, Joyent, Inc. All rights reserved.
+ * Copyright 2021 Oxide Computer Company
*/
/*
@@ -57,201 +58,232 @@
#include <string.h>
#include <assert.h>
#include <unistd.h>
+#include <stddef.h>
+#include <sys/list.h>
#include "pcidb.h"
#define PCI_NAME_MAX 256
#define PCI_READLINE 1024
-/* Forward declarations */
-struct pcidb_vendor;
-struct pcidb_device;
-struct pcidb_subvd;
+struct pcidb_progif {
+ char pp_name[PCI_NAME_MAX];
+ list_node_t pp_link;
+ pcidb_subclass_t *pp_subclass;
+ uint8_t pp_code;
+};
+
+struct pcidb_subclass {
+ char psc_name[PCI_NAME_MAX];
+ list_node_t psc_link;
+ list_t psc_progifs;
+ pcidb_class_t *psc_class;
+ uint8_t psc_code;
+};
+
+struct pcidb_class {
+ char pc_name[PCI_NAME_MAX];
+ list_node_t pc_link;
+ list_t pc_subclass;
+ pcidb_hdl_t *pc_hdl;
+ uint8_t pc_code;
+};
struct pcidb_subvd {
- uint16_t ps_vid;
- uint16_t ps_did;
- char ps_name[PCI_NAME_MAX];
- struct pcidb_subvd *ps_prev;
- struct pcidb_subvd *ps_next;
- struct pcidb_device *ps_dev;
- struct pcidb_vendor *ps_vend;
+ uint16_t ps_vid;
+ uint16_t ps_did;
+ char ps_name[PCI_NAME_MAX];
+ list_node_t ps_link;
+ pcidb_device_t *ps_dev;
+ pcidb_vendor_t *ps_vend;
};
struct pcidb_device {
- uint16_t pd_id;
- char pd_name[PCI_NAME_MAX];
- struct pcidb_subvd *pd_sstart;
- struct pcidb_subvd *pd_send;
- struct pcidb_device *pd_next;
- struct pcidb_device *pd_prev;
- struct pcidb_vendor *pd_vend;
+ uint16_t pd_id;
+ char pd_name[PCI_NAME_MAX];
+ list_t pd_subs;
+ list_node_t pd_link;
+ pcidb_vendor_t *pd_vend;
};
struct pcidb_vendor {
- uint16_t pv_id;
- char pv_name[PCI_NAME_MAX];
- struct pcidb_device *pv_dstart;
- struct pcidb_device *pv_dend;
- struct pcidb_vendor *pv_prev;
- struct pcidb_vendor *pv_next;
+ uint16_t pv_id;
+ char pv_name[PCI_NAME_MAX];
+ list_t pv_devs;
+ list_node_t pv_link;
+ pcidb_hdl_t *pv_hdl;
};
struct pcidb_hdl {
- pcidb_vendor_t *ph_vstart;
- pcidb_vendor_t *ph_vend;
+ list_t ph_vendors;
+ list_t ph_classes;
};
typedef enum pcidb_parse {
+ PDB_INIT,
PDB_VENDOR,
PDB_DEVICE,
- PDB_SUBDEV
+ PDB_SUBDEV,
+ PDB_CLASS,
+ PDB_SUBCLASS,
+ PDB_PROGIF
} pcidb_parse_t;
static const char *pci_db = "/usr/share/hwdata/pci.ids";
-static void
-pcihdl_add_vendor(pcidb_hdl_t *hdl, pcidb_vendor_t *v)
-{
- if (hdl->ph_vstart == NULL && hdl->ph_vend == NULL) {
- hdl->ph_vstart = v;
- hdl->ph_vend = v;
- v->pv_prev = NULL;
- v->pv_next = NULL;
- } else {
- v->pv_prev = hdl->ph_vend;
- v->pv_next = NULL;
- hdl->ph_vend->pv_next = v;
- hdl->ph_vend = v;
- }
-}
-
static pcidb_vendor_t *
parse_vendor(char *buf, pcidb_hdl_t *hdl)
{
- pcidb_vendor_t *v;
- size_t len;
+ pcidb_vendor_t *vend;
- v = malloc(sizeof (pcidb_vendor_t));
- if (v == NULL)
+ vend = malloc(sizeof (pcidb_vendor_t));
+ if (vend == NULL)
return (NULL);
- pcihdl_add_vendor(hdl, v);
- v->pv_dstart = NULL;
- v->pv_dend = NULL;
+ list_create(&vend->pv_devs, sizeof (pcidb_device_t),
+ offsetof(pcidb_device_t, pd_link));
+ vend->pv_hdl = hdl;
+ list_insert_tail(&hdl->ph_vendors, vend);
buf[4] = '\0';
- v->pv_id = strtol(buf, NULL, 16);
+ vend->pv_id = strtol(buf, NULL, 16);
buf += 6;
- len = strlen(buf);
- if (buf[len-1] == '\n')
- buf[len-1] = '\0';
- (void) strlcpy(v->pv_name, buf, PCI_NAME_MAX);
+ (void) strlcpy(vend->pv_name, buf, PCI_NAME_MAX);
- return (v);
-}
-
-static void
-insert_device(pcidb_vendor_t *v, pcidb_device_t *d)
-{
- d->pd_vend = v;
- if (v->pv_dstart == NULL && v->pv_dend == NULL) {
- v->pv_dstart = d;
- v->pv_dend = d;
- d->pd_next = NULL;
- d->pd_prev = NULL;
- } else {
- d->pd_prev = v->pv_dend;
- d->pd_next = NULL;
- v->pv_dend->pd_next = d;
- v->pv_dend = d;
- }
+ return (vend);
}
static pcidb_device_t *
-parse_device(char *buf, pcidb_vendor_t *v)
+parse_device(char *buf, pcidb_vendor_t *vend)
{
- pcidb_device_t *d;
- size_t len;
+ pcidb_device_t *dev;
- d = malloc(sizeof (pcidb_device_t));
- if (d == NULL)
- return (d);
+ dev = malloc(sizeof (pcidb_device_t));
+ if (dev == NULL)
+ return (dev);
- d->pd_sstart = NULL;
- d->pd_send = NULL;
- insert_device(v, d);
+ list_create(&dev->pd_subs, sizeof (pcidb_subvd_t),
+ offsetof(pcidb_subvd_t, ps_link));
+ dev->pd_vend = vend;
+ list_insert_tail(&vend->pv_devs, dev);
buf++;
buf[4] = '\0';
- d->pd_id = strtol(buf, NULL, 16);
+ dev->pd_id = strtol(buf, NULL, 16);
buf += 6;
- len = strlen(buf);
- if (buf[len-1] == '\n')
- buf[len-1] = '\0';
-
- (void) strlcpy(d->pd_name, buf, PCI_NAME_MAX);
- return (d);
-}
-
-static void
-insert_subdev(pcidb_device_t *d, pcidb_subvd_t *s)
-{
- s->ps_dev = d;
- s->ps_vend = d->pd_vend;
- if (d->pd_sstart == NULL) {
- d->pd_sstart = s;
- d->pd_send = s;
- s->ps_prev = NULL;
- s->ps_next = NULL;
- } else {
- s->ps_prev = d->pd_send;
- s->ps_next = NULL;
- d->pd_send->ps_next = s;
- d->pd_send = s;
- }
+
+ (void) strlcpy(dev->pd_name, buf, PCI_NAME_MAX);
+ return (dev);
}
static pcidb_subvd_t *
-parse_subdev(char *buf, pcidb_device_t *d)
+parse_subdev(char *buf, pcidb_device_t *dev)
{
- pcidb_subvd_t *s;
- size_t len;
+ pcidb_subvd_t *sub;
- s = malloc(sizeof (pcidb_subvd_t));
- if (s == NULL)
+ sub = malloc(sizeof (pcidb_subvd_t));
+ if (sub == NULL)
return (NULL);
- insert_subdev(d, s);
+
+ sub->ps_dev = dev;
+ sub->ps_vend = dev->pd_vend;
+ list_insert_tail(&dev->pd_subs, sub);
buf += 2;
buf[4] = '\0';
- s->ps_vid = strtol(buf, NULL, 16);
+ sub->ps_vid = strtol(buf, NULL, 16);
buf += 5;
buf[4] = '\0';
- s->ps_did = strtol(buf, NULL, 16);
+ sub->ps_did = strtol(buf, NULL, 16);
buf += 6;
- len = strlen(buf);
- if (buf[len-1] == '\n')
- buf[len-1] = '\0';
+ (void) strlcpy(sub->ps_name, buf, PCI_NAME_MAX);
+
+ return (sub);
+}
+
+static pcidb_class_t *
+pcidb_parse_class(char *buf, pcidb_hdl_t *hdl)
+{
+ pcidb_class_t *class;
+
+ class = malloc(sizeof (pcidb_class_t));
+ if (class == NULL)
+ return (NULL);
+
+ list_create(&class->pc_subclass, sizeof (pcidb_subclass_t),
+ offsetof(pcidb_subclass_t, psc_link));
+ class->pc_hdl = hdl;
+ list_insert_tail(&hdl->ph_classes, class);
+
+ buf += 2;
+ buf[3] = '\0';
+ class->pc_code = strtol(buf, NULL, 16);
+ buf += 4;
+ (void) strlcpy(class->pc_name, buf, PCI_NAME_MAX);
+
+ return (class);
+}
+
+static pcidb_subclass_t *
+pcidb_parse_subclass(char *buf, pcidb_class_t *class)
+{
+ pcidb_subclass_t *sub;
+
+ sub = malloc(sizeof (pcidb_subclass_t));
+ if (sub == NULL)
+ return (NULL);
+
+ list_create(&sub->psc_progifs, sizeof (pcidb_progif_t),
+ offsetof(pcidb_progif_t, pp_link));
+ sub->psc_class = class;
+ list_insert_tail(&class->pc_subclass, sub);
+
+ buf++;
+ buf[3] = '\0';
+ sub->psc_code = strtol(buf, NULL, 16);
+ buf += 4;
+ (void) strlcpy(sub->psc_name, buf, PCI_NAME_MAX);
+
+ return (sub);
+}
+
+static pcidb_progif_t *
+pcidb_parse_progif(char *buf, pcidb_subclass_t *sub)
+{
+ pcidb_progif_t *prog;
+
+ prog = malloc(sizeof (pcidb_progif_t));
+ if (prog == NULL) {
+ return (NULL);
+ }
+
+ prog->pp_subclass = sub;
+ list_insert_tail(&sub->psc_progifs, prog);
- (void) strlcpy(s->ps_name, buf, PCI_NAME_MAX);
+ buf += 2;
+ buf[3] = '\0';
+ prog->pp_code = strtol(buf, NULL, 16);
+ buf += 4;
+ (void) strlcpy(prog->pp_name, buf, PCI_NAME_MAX);
- return (s);
+ return (prog);
}
static int
readline(FILE *f, char *buf, size_t len)
{
for (;;) {
+ char *c;
+
if (fgets(buf, len, f) == NULL)
return (-1);
- if (buf[0] == 'C')
- return (-1);
+ if ((c = strchr(buf, '\n')) != NULL)
+ *c = '\0';
- if (buf[0] != '#' && buf[0] != '\n')
+ if (buf[0] != '#' && buf[0] != '\0')
return (0);
}
}
@@ -259,12 +291,15 @@ readline(FILE *f, char *buf, size_t len)
static int
parse_db(FILE *f, pcidb_hdl_t *hdl)
{
- char buf[1024];
- pcidb_vendor_t *v = NULL;
- pcidb_device_t *d = NULL;
- pcidb_parse_t state = PDB_VENDOR;
+ pcidb_vendor_t *vend = NULL;
+ pcidb_device_t *dev = NULL;
+ pcidb_class_t *class = NULL;
+ pcidb_subclass_t *sub = NULL;
+ pcidb_parse_t state = PDB_INIT;
for (;;) {
+ char buf[1024];
+
errno = 0;
if (readline(f, buf, sizeof (buf)) != 0) {
if (errno != 0)
@@ -275,15 +310,26 @@ parse_db(FILE *f, pcidb_hdl_t *hdl)
newstate:
switch (state) {
+ case PDB_INIT:
+ vend = NULL;
+ dev = NULL;
+ class = NULL;
+ sub = NULL;
+ if (buf[0] == 'C') {
+ state = PDB_CLASS;
+ } else {
+ state = PDB_VENDOR;
+ }
+ goto newstate;
case PDB_VENDOR:
- v = parse_vendor(buf, hdl);
- if (v == NULL)
- return (0);
+ vend = parse_vendor(buf, hdl);
+ if (vend == NULL)
+ return (-1);
state = PDB_DEVICE;
- continue;
+ break;
case PDB_DEVICE:
if (buf[0] != '\t') {
- state = PDB_VENDOR;
+ state = PDB_INIT;
goto newstate;
}
@@ -292,14 +338,14 @@ newstate:
goto newstate;
}
- assert(v != NULL);
- d = parse_device(buf, v);
- if (d == NULL)
+ assert(vend != NULL);
+ dev = parse_device(buf, vend);
+ if (dev == NULL)
return (0);
- continue;
+ break;
case PDB_SUBDEV:
if (buf[0] != '\t') {
- state = PDB_VENDOR;
+ state = PDB_INIT;
goto newstate;
}
@@ -309,8 +355,48 @@ newstate:
}
assert(buf[0] == '\t' && buf[1] == '\t');
- assert(d != NULL);
- (void) parse_subdev(buf, d);
+ assert(dev != NULL);
+ if (parse_subdev(buf, dev) == NULL) {
+ return (-1);
+ }
+ break;
+ case PDB_CLASS:
+ class = pcidb_parse_class(buf, hdl);
+ state = PDB_SUBCLASS;
+ break;
+ case PDB_SUBCLASS:
+ if (buf[0] != '\t') {
+ state = PDB_INIT;
+ goto newstate;
+ }
+
+ if (buf[1] == '\t') {
+ state = PDB_PROGIF;
+ goto newstate;
+ }
+
+ assert(class != NULL);
+ sub = pcidb_parse_subclass(buf, class);
+ if (sub == NULL) {
+ return (-1);
+ }
+ break;
+ case PDB_PROGIF:
+ if (buf[0] != '\t') {
+ state = PDB_INIT;
+ goto newstate;
+ }
+
+ if (buf[0] == '\t' && buf[1] != '\t') {
+ state = PDB_SUBCLASS;
+ goto newstate;
+ }
+
+ assert(sub != NULL);
+ if (pcidb_parse_progif(buf, sub) == NULL) {
+ return (-1);
+ }
+ break;
}
}
}
@@ -330,8 +416,10 @@ pcidb_open(int version)
if (h == NULL)
return (NULL);
- h->ph_vstart = NULL;
- h->ph_vend = NULL;
+ list_create(&h->ph_vendors, sizeof (pcidb_vendor_t),
+ offsetof(pcidb_vendor_t, pv_link));
+ list_create(&h->ph_classes, sizeof (pcidb_class_t),
+ offsetof(pcidb_class_t, pc_link));
f = fopen(pci_db, "rF");
if (f == NULL) {
@@ -342,7 +430,6 @@ pcidb_open(int version)
if (parse_db(f, h) < 0) {
(void) fclose(f);
pcidb_close(h);
- free(h);
return (NULL);
}
@@ -352,36 +439,51 @@ pcidb_open(int version)
}
void
-pcidb_close(pcidb_hdl_t *h)
+pcidb_close(pcidb_hdl_t *hdl)
{
- pcidb_vendor_t *v, *tv;
+ pcidb_vendor_t *vend;
+ pcidb_class_t *class;
- pcidb_device_t *d, *td;
- pcidb_subvd_t *s, *ts;
-
- if (h == NULL)
+ if (hdl == NULL)
return;
- v = h->ph_vstart;
- while (v != NULL) {
- d = v->pv_dstart;
- while (d != NULL) {
- s = d->pd_sstart;
- while (s != NULL) {
- ts = s;
- s = s->ps_next;
- free(ts);
+ while ((vend = list_remove_head(&hdl->ph_vendors)) != NULL) {
+ pcidb_device_t *dev;
+
+ while ((dev = list_remove_head(&vend->pv_devs)) != NULL) {
+ pcidb_subvd_t *sub;
+
+ while ((sub = list_remove_head(&dev->pd_subs)) !=
+ NULL) {
+ free(sub);
+ }
+ list_destroy(&dev->pd_subs);
+ free(dev);
+ }
+ list_destroy(&vend->pv_devs);
+ free(vend);
+ }
+ list_destroy(&hdl->ph_vendors);
+
+ while ((class = list_remove_head(&hdl->ph_classes)) != NULL) {
+ pcidb_subclass_t *sub;
+
+ while ((sub = list_remove_head(&class->pc_subclass)) != NULL) {
+ pcidb_progif_t *prog;
+
+ while ((prog = list_remove_head(&sub->psc_progifs)) !=
+ NULL) {
+ free(prog);
}
- td = d;
- d = d->pd_next;
- free(td);
+ list_destroy(&sub->psc_progifs);
+ free(sub);
}
- tv = v;
- v = v->pv_next;
- free(tv);
+ list_destroy(&class->pc_subclass);
+ free(class);
}
+ list_destroy(&hdl->ph_classes);
- free(h);
+ free(hdl);
}
pcidb_vendor_t *
@@ -389,7 +491,8 @@ pcidb_lookup_vendor(pcidb_hdl_t *hdl, uint16_t id)
{
pcidb_vendor_t *v;
- for (v = hdl->ph_vstart; v != NULL; v = v->pv_next) {
+ for (v = list_head(&hdl->ph_vendors); v != NULL;
+ v = list_next(&hdl->ph_vendors, v)) {
if (v->pv_id == id)
return (v);
}
@@ -398,165 +501,307 @@ pcidb_lookup_vendor(pcidb_hdl_t *hdl, uint16_t id)
}
const char *
-pcidb_vendor_name(pcidb_vendor_t *v)
+pcidb_vendor_name(pcidb_vendor_t *vend)
{
- return (v->pv_name);
+ return (vend->pv_name);
}
uint16_t
-pcidb_vendor_id(pcidb_vendor_t *v)
+pcidb_vendor_id(pcidb_vendor_t *vend)
{
- return (v->pv_id);
+ return (vend->pv_id);
}
pcidb_vendor_t *
-pcidb_vendor_iter(pcidb_hdl_t *h)
+pcidb_vendor_iter(pcidb_hdl_t *hdl)
{
- return (h->ph_vstart);
+ return (list_head(&hdl->ph_vendors));
}
pcidb_vendor_t *
-pcidb_vendor_iter_next(pcidb_vendor_t *v)
+pcidb_vendor_iter_next(pcidb_vendor_t *vend)
{
- assert(v != NULL);
- return (v->pv_next);
+ assert(vend != NULL);
+ return (list_next(&vend->pv_hdl->ph_vendors, vend));
}
pcidb_device_t *
-pcidb_lookup_device_by_vendor(pcidb_vendor_t *v, uint16_t id)
+pcidb_lookup_device_by_vendor(pcidb_vendor_t *vend, uint16_t id)
{
- pcidb_device_t *d;
- assert(v != NULL);
+ assert(vend != NULL);
- for (d = v->pv_dstart; d != NULL; d = d->pd_next)
- if (d->pd_id == id)
- return (d);
+ for (pcidb_device_t *dev = list_head(&vend->pv_devs); dev != NULL;
+ dev = list_next(&vend->pv_devs, dev)) {
+ if (dev->pd_id == id)
+ return (dev);
+ }
return (NULL);
}
pcidb_device_t *
-pcidb_lookup_device(pcidb_hdl_t *h, uint16_t vid, uint16_t did)
+pcidb_lookup_device(pcidb_hdl_t *hdl, uint16_t vid, uint16_t did)
{
- pcidb_vendor_t *v;
+ pcidb_vendor_t *vend;
- v = pcidb_lookup_vendor(h, vid);
- if (v == NULL)
+ vend = pcidb_lookup_vendor(hdl, vid);
+ if (vend == NULL)
return (NULL);
- return (pcidb_lookup_device_by_vendor(v, did));
+ return (pcidb_lookup_device_by_vendor(vend, did));
}
pcidb_device_t *
-pcidb_device_iter(pcidb_vendor_t *v)
+pcidb_device_iter(pcidb_vendor_t *vend)
{
- return (v->pv_dstart);
+ return (list_head(&vend->pv_devs));
}
pcidb_device_t *
-pcidb_device_iter_next(pcidb_device_t *d)
+pcidb_device_iter_next(pcidb_device_t *dev)
{
- return (d->pd_next);
+ return (list_next(&dev->pd_vend->pv_devs, dev));
}
const char *
-pcidb_device_name(pcidb_device_t *d)
+pcidb_device_name(pcidb_device_t *dev)
{
- return (d->pd_name);
+ return (dev->pd_name);
}
uint16_t
-pcidb_device_id(pcidb_device_t *d)
+pcidb_device_id(pcidb_device_t *dev)
{
- return (d->pd_id);
+ return (dev->pd_id);
}
pcidb_vendor_t *
-pcidb_device_vendor(pcidb_device_t *d)
+pcidb_device_vendor(pcidb_device_t *dev)
{
- return (d->pd_vend);
+ return (dev->pd_vend);
}
pcidb_subvd_t *
-pcidb_lookup_subvd_by_device(pcidb_device_t *d, uint16_t svid, uint16_t sdid)
+pcidb_lookup_subvd_by_device(pcidb_device_t *dev, uint16_t svid, uint16_t sdid)
{
- pcidb_subvd_t *s;
+ pcidb_subvd_t *sub;
- assert(d != NULL);
+ assert(dev != NULL);
- for (s = d->pd_sstart; s != NULL; s = s->ps_next)
- if (s->ps_vid == svid && s->ps_did == sdid)
- return (s);
+ for (sub = list_head(&dev->pd_subs); sub != NULL;
+ sub = list_next(&dev->pd_subs, sub)) {
+ if (sub->ps_vid == svid && sub->ps_did == sdid)
+ return (sub);
+ }
return (NULL);
}
pcidb_subvd_t *
-pcidb_lookup_subvd_by_vendor(pcidb_vendor_t *v, uint16_t devid, uint16_t svid,
- uint16_t sdid)
+pcidb_lookup_subvd_by_vendor(pcidb_vendor_t *vend, uint16_t devid,
+ uint16_t svid, uint16_t sdid)
{
- pcidb_device_t *d;
+ pcidb_device_t *dev;
- assert(v != NULL);
- d = pcidb_lookup_device_by_vendor(v, devid);
- if (d == NULL)
+ assert(vend != NULL);
+ dev = pcidb_lookup_device_by_vendor(vend, devid);
+ if (dev == NULL)
return (NULL);
- return (pcidb_lookup_subvd_by_device(d, svid, sdid));
+ return (pcidb_lookup_subvd_by_device(dev, svid, sdid));
}
pcidb_subvd_t *
-pcidb_lookup_subvd(pcidb_hdl_t *h, uint16_t vid, uint16_t did, uint16_t svid,
+pcidb_lookup_subvd(pcidb_hdl_t *hdl, uint16_t vid, uint16_t did, uint16_t svid,
uint16_t sdid)
{
- pcidb_device_t *d;
+ pcidb_device_t *dev;
- assert(h != NULL);
- d = pcidb_lookup_device(h, vid, did);
- if (d == NULL)
+ assert(hdl != NULL);
+ dev = pcidb_lookup_device(hdl, vid, did);
+ if (dev == NULL)
return (NULL);
- return (pcidb_lookup_subvd_by_device(d, svid, sdid));
+ return (pcidb_lookup_subvd_by_device(dev, svid, sdid));
}
pcidb_subvd_t *
-pcidb_subvd_iter(pcidb_device_t *d)
+pcidb_subvd_iter(pcidb_device_t *dev)
{
- return (d->pd_sstart);
+ return (list_head(&dev->pd_subs));
}
pcidb_subvd_t *
-pcidb_subvd_iter_next(pcidb_subvd_t *s)
+pcidb_subvd_iter_next(pcidb_subvd_t *sub)
{
- return (s->ps_next);
+ return (list_next(&sub->ps_dev->pd_subs, sub));
}
const char *
-pcidb_subvd_name(pcidb_subvd_t *s)
+pcidb_subvd_name(pcidb_subvd_t *sub)
{
- return (s->ps_name);
+ return (sub->ps_name);
}
uint16_t
-pcidb_subvd_svid(pcidb_subvd_t *s)
+pcidb_subvd_svid(pcidb_subvd_t *sub)
{
- return (s->ps_vid);
+ return (sub->ps_vid);
}
uint16_t
-pcidb_subvd_sdid(pcidb_subvd_t *s)
+pcidb_subvd_sdid(pcidb_subvd_t *sub)
{
- return (s->ps_did);
+ return (sub->ps_did);
}
pcidb_device_t *
-pcidb_subvd_device(pcidb_subvd_t *s)
+pcidb_subvd_device(pcidb_subvd_t *sub)
{
- return (s->ps_dev);
+ return (sub->ps_dev);
}
pcidb_vendor_t *
-pcidb_subvd_vendor(pcidb_subvd_t *s)
+pcidb_subvd_vendor(pcidb_subvd_t *sub)
+{
+ return (sub->ps_vend);
+}
+
+
+pcidb_class_t *
+pcidb_lookup_class(pcidb_hdl_t *hdl, uint8_t code)
+{
+ for (pcidb_class_t *class = list_head(&hdl->ph_classes); class != NULL;
+ class = list_next(&hdl->ph_classes, class)) {
+ if (class->pc_code == code) {
+ return (class);
+ }
+ }
+
+ return (NULL);
+}
+
+pcidb_class_t *
+pcidb_class_iter(pcidb_hdl_t *hdl)
+{
+ return (list_head(&hdl->ph_classes));
+}
+
+pcidb_class_t *
+pcidb_class_iter_next(pcidb_class_t *class)
+{
+ return (list_next(&class->pc_hdl->ph_classes, class));
+}
+
+const char *
+pcidb_class_name(pcidb_class_t *class)
+{
+ return (class->pc_name);
+}
+
+uint8_t
+pcidb_class_code(pcidb_class_t *class)
+{
+ return (class->pc_code);
+}
+
+pcidb_subclass_t *
+pcidb_lookup_subclass(pcidb_hdl_t *hdl, uint8_t ccode, uint8_t subcode)
+{
+ pcidb_class_t *class;
+
+ class = pcidb_lookup_class(hdl, ccode);
+ if (class == NULL) {
+ return (NULL);
+ }
+
+ return (pcidb_lookup_subclass_by_class(class, subcode));
+}
+
+pcidb_subclass_t *
+pcidb_lookup_subclass_by_class(pcidb_class_t *class, uint8_t code)
+{
+ for (pcidb_subclass_t *sub = list_head(&class->pc_subclass);
+ sub != NULL; sub = list_next(&class->pc_subclass, sub)) {
+ if (sub->psc_code == code) {
+ return (sub);
+ }
+ }
+
+ return (NULL);
+}
+
+pcidb_subclass_t *
+pcidb_subclass_iter(pcidb_class_t *class)
+{
+ return (list_head(&class->pc_subclass));
+}
+
+pcidb_subclass_t *
+pcidb_subclass_iter_next(pcidb_subclass_t *sub)
+{
+ return (list_next(&sub->psc_class->pc_subclass, sub));
+}
+
+const char *
+pcidb_subclass_name(pcidb_subclass_t *sub)
+{
+ return (sub->psc_name);
+}
+
+uint8_t
+pcidb_subclass_code(pcidb_subclass_t *sub)
+{
+ return (sub->psc_code);
+}
+
+pcidb_progif_t *
+pcidb_lookup_progif(pcidb_hdl_t *hdl, uint8_t ccode, uint8_t scode,
+ uint8_t pcode)
+{
+ pcidb_subclass_t *sub;
+
+ sub = pcidb_lookup_subclass(hdl, ccode, scode);
+ if (sub == NULL) {
+ return (NULL);
+ }
+
+ return (pcidb_lookup_progif_by_subclass(sub, pcode));
+}
+
+pcidb_progif_t *
+pcidb_lookup_progif_by_subclass(pcidb_subclass_t *sub, uint8_t code)
+{
+ for (pcidb_progif_t *prog = list_head(&sub->psc_progifs); prog != NULL;
+ prog = list_next(&sub->psc_progifs, prog)) {
+ if (prog->pp_code == code) {
+ return (prog);
+ }
+ }
+
+ return (NULL);
+}
+
+pcidb_progif_t *
+pcidb_progif_iter(pcidb_subclass_t *sub)
+{
+ return (list_head(&sub->psc_progifs));
+}
+
+pcidb_progif_t *
+pcidb_progif_iter_next(pcidb_progif_t *prog)
+{
+ return (list_next(&prog->pp_subclass->psc_progifs, prog));
+}
+
+const char *
+pcidb_progif_name(pcidb_progif_t *prog)
+{
+ return (prog->pp_name);
+}
+
+uint8_t
+pcidb_progif_code(pcidb_progif_t *prog)
{
- return (s->ps_vend);
+ return (prog->pp_code);
}
diff --git a/usr/src/lib/libpcidb/common/pcidb.h b/usr/src/lib/libpcidb/common/pcidb.h
index a11e4d90f1..0cf0047b26 100644
--- a/usr/src/lib/libpcidb/common/pcidb.h
+++ b/usr/src/lib/libpcidb/common/pcidb.h
@@ -20,6 +20,7 @@
*/
/*
* Copyright (c) 2012, Joyent, Inc. All rights reserved.
+ * Copyright 2021 Oxide Computer Company
*/
/*
@@ -41,6 +42,9 @@ typedef struct pcidb_hdl pcidb_hdl_t;
typedef struct pcidb_vendor pcidb_vendor_t;
typedef struct pcidb_device pcidb_device_t;
typedef struct pcidb_subvd pcidb_subvd_t;
+typedef struct pcidb_class pcidb_class_t;
+typedef struct pcidb_subclass pcidb_subclass_t;
+typedef struct pcidb_progif pcidb_progif_t;
extern pcidb_hdl_t *pcidb_open(int);
extern void pcidb_close(pcidb_hdl_t *);
@@ -77,6 +81,32 @@ extern uint16_t pcidb_subvd_sdid(pcidb_subvd_t *);
extern pcidb_device_t *pcidb_subvd_device(pcidb_subvd_t *);
extern pcidb_vendor_t *pcidb_subvd_vendor(pcidb_subvd_t *);
+extern pcidb_class_t *pcidb_lookup_class(pcidb_hdl_t *, uint8_t);
+extern pcidb_class_t *pcidb_class_iter(pcidb_hdl_t *);
+extern pcidb_class_t *pcidb_class_iter_next(pcidb_class_t *);
+
+extern const char *pcidb_class_name(pcidb_class_t *);
+extern uint8_t pcidb_class_code(pcidb_class_t *);
+
+extern pcidb_subclass_t *pcidb_lookup_subclass(pcidb_hdl_t *, uint8_t, uint8_t);
+extern pcidb_subclass_t *pcidb_lookup_subclass_by_class(pcidb_class_t *,
+ uint8_t);
+extern pcidb_subclass_t *pcidb_subclass_iter(pcidb_class_t *);
+extern pcidb_subclass_t *pcidb_subclass_iter_next(pcidb_subclass_t *);
+
+extern const char *pcidb_subclass_name(pcidb_subclass_t *);
+extern uint8_t pcidb_subclass_code(pcidb_subclass_t *);
+
+extern pcidb_progif_t *pcidb_lookup_progif(pcidb_hdl_t *, uint8_t, uint8_t,
+ uint8_t);
+extern pcidb_progif_t *pcidb_lookup_progif_by_subclass(pcidb_subclass_t *,
+ uint8_t);
+extern pcidb_progif_t *pcidb_progif_iter(pcidb_subclass_t *);
+extern pcidb_progif_t *pcidb_progif_iter_next(pcidb_progif_t *);
+
+extern const char *pcidb_progif_name(pcidb_progif_t *);
+extern uint8_t pcidb_progif_code(pcidb_progif_t *);
+
#ifdef __cplusplus
}
#endif
diff --git a/usr/src/man/man1/ksh93.1 b/usr/src/man/man1/ksh93.1
index e4736f5860..2978f7500a 100644
--- a/usr/src/man/man1/ksh93.1
+++ b/usr/src/man/man1/ksh93.1
@@ -3,538 +3,733 @@
.\" To view license terms, see http://www.eclipse.org/org/documents/epl-v10.html
.\" Portions Copyright (c) 2009, Sun Microsystems, Inc.
.\" Portions Copyright 2021 OmniOS Community Edition (OmniOSce) Association.
-.TH KSH93 1 "Feb 17, 2021"
-.SH NAME
-ksh93, rksh93 \- Korn Shell, a standard and restricted command and programming
-language
-.SH SYNOPSIS
-.nf
-\fBksh93\fR [\fB\(+-abcefhikmnoprstuvxBCD\fR] [\fB-R\fR \fIfile\fR] [ \fB\(+-o\fR \fIoption\fR] ...
- [-] [\fIarg\fR ...]
-.fi
-
-.LP
-.nf
-\fBrksh93\fR [\fB\(+-abcefhikmnoprstuvxBCD\fR] [\fB-R\fR \fIfile\fR] [\fB\(+-o\fR \fIoption\fR] ...
- [-] [\fIarg\fR ...]
-.fi
-
-.SH DESCRIPTION
-\fBksh93\fR is a command and programming language that executes commands read
-from a terminal or a file. \fBrksh93\fR is a restricted version of the command
-interpreter \fBksh93\fR. \fBrksh93\fR is used to set up login names and
-execution environments whose capabilities are more controlled than those of the
-standard shell.
-.sp
-.LP
-See \fBInvocation\fR for the meaning of arguments to the shell.
-.SS "Definitions"
-A \fImetacharacter\fR is defined as one of the following characters:
-.sp
-.in +2
-.nf
-; & ( ) | < > NEWLINE SPACE TAB
-.fi
-.in -2
-.sp
-
-.sp
-.LP
-A \fIblank\fR is a \fBTAB\fR or a \fBSPACE\fR.
-.sp
-.LP
-An \fIidentifier\fR is a sequence of letters, digits, or underscores starting
-with a letter or underscore. Identifiers are used as components of \fIvariable
-names\fR.
-.sp
-.LP
-A \fIvname\fR is a sequence of one or more identifiers separated by a period
-(\fB\&.\fR) and optionally preceded by a period (\fB\&.\fR). \fIvnames\fR are
-used as function and variable names.
-.sp
-.LP
-A \fIword\fR is a sequence of \fIcharacters\fR from the character set defined
-by the current locale, excluding non-quoted \fImetacharacters\fR.
-.sp
-.LP
-A \fIcommand\fR is a sequence of characters in the syntax of the shell
-language. The shell reads each command and carries out the desired action
-either directly or by invoking separate utilities. A built-in command is a
-command that is carried out by the shell itself without creating a separate
-process. Some commands are built-in purely for convenience and are not
-documented in this manual page. Built-ins that cause side effects in the shell
-environment and built-ins that are found before performing a path search (see
-\fBExecution\fR) are documented in this manual page. For historical reasons,
-some of these built-ins behave differently than other built-ins and are called
-special built-ins.
-.SS "Commands"
-A \fIsimple-command\fR is a list of variable assignments (see \fBVariable
-Assignments\fR) or a sequence of \fIblank\fR-separated words which can be
-preceded by a list of variable assignments. See the \fBEnvironment\fR section
-of this manual page.
-.sp
-.LP
-The first word specifies the name of the command to be executed. Except as
-specified in this section, the remaining words are passed as arguments to the
-invoked command. The command name is passed as argument 0. See \fBexec\fR(2).
-The \fIvalue\fR of a simple-command is its exit status. If it terminates
-normally, its value is \fB0\fR-\fB255\fR. If it terminates abnormally, its
-value is \fB256+\fR\fIsignum\fR. The name of the signal corresponding to the
-exit status can be obtained by way of the \fB-l\fR option of the kill built-in
-utility.
-.sp
-.LP
-A \fIpipeline\fR is a sequence of one or more commands separated by \fB|\fR.
+.Dd March 8, 2021
+.Dt KSH93 1
+.Os
+.Sh NAME
+.Nm ksh93 ,
+.Nm rksh93
+.Nd Korn Shell, a standard and restricted command and programming language
+.Sh SYNOPSIS
+.Nm ksh93
+.Op Sy \&+ Ns Fl abcefhikmnoprstuvxBCD
+.Op Fl R Ar file
+.Op Sy \&+ Ns Fl o Ar option
+\&...
+.Op Fl
+.Op Ar arg No ...
+.Nm rksh93
+.Op Sy \&+ Ns Fl abcefhikmnoprstuvxBCD
+.Op Fl R Ar file
+.Op Sy \&+ Ns Fl o Ar option
+\&...
+.Op Fl
+.Op Ar arg No ...
+.Sh DESCRIPTION
+.Nm
+is a command and programming language that executes commands read
+from a terminal or a file.
+.Nm rksh93
+is a restricted version of the command interpreter
+.Nm ksh93 .
+.Nm rksh93
+is used to set up login names and execution environments whose capabilities are
+more controlled than those of the standard shell.
+.Pp
+See
+.Sx Invocation
+for the meaning of arguments to the shell.
+.Ss "Definitions"
+A
+.Sy metacharacter
+is defined as one of the following characters:
+.Pp
+.Dl ; & ( \ ) | < > NEWLINE SPACE TAB
+.Pp
+A
+.Sy blank
+is a TAB or a SPACE.
+.Pp
+An
+.Sy identifier
+is a sequence of letters, digits, or underscores starting with a letter or
+underscore.
+Identifiers are used as components of variable names.
+.Pp
+A
+.Sy vname
+is a sequence of one or more identifiers separated by a period
+.Pq Sy \&.
+and optionally preceded by a period
+.Pq Sy \&. .
+.Sy vname Ns s
+are used as function and variable names.
+.Pp
+A
+.Sy word
+is a sequence of characters from the character set defined by the current
+locale, excluding non-quoted
+.Sy metacharacter Ns s .
+.Pp
+A
+.Sy command
+is a sequence of characters in the syntax of the shell language.
+The shell reads each command and carries out the desired action either directly
+or by invoking separate utilities.
+A built-in command is a command that is carried out by the shell itself without
+creating a separate process.
+Some commands are built-in purely for convenience and are not documented in
+this manual page.
+Built-ins that cause side effects in the shell environment and built-ins that
+are found before performing a path search
+.Pq see Sx Execution
+are documented in this manual page.
+For historical reasons, some of these built-ins behave differently than other
+built-ins and are called special built-ins.
+.Ss "Commands"
+A
+.Sy simple-command
+is a list of variable assignments
+.Pq see Sx Variable Assignments
+or a sequence of
+.Sy blank Ns -separated
+words which can be preceded by a list of variable assignments.
+See the
+.Sx Environment
+section of this manual page.
+.Pp
+The first word specifies the name of the command to be executed.
+Except as specified in this section, the remaining words are passed as
+arguments to the invoked command.
+The command name is passed as argument 0.
+See
+.Xr exec 2 .
+The
+.Em value
+of a simple-command is its exit status.
+If it terminates normally, its value is between
+.Sy 0
+and
+.Sy 255 .
+If it terminates abnormally, its value is
+.Sy 256 +
+.Em signum .
+The name of the signal corresponding to the exit status can be obtained by way
+of the
+.Fl l
+option of the
+.Ic kill
+built-in utility.
+.Pp
+A
+.Sy pipeline
+is a sequence of one or more commands separated by
+.Sy \&| .
The standard output of each command but the last is connected by a
-\fBpipe\fR(2) to the standard input of the next command. Each command, except
-possibly the last, is run as a separate process. The shell waits for the last
-command to terminate. The exit status of a pipeline is the exit status of the
-last command unless the \fBpipefail\fR option is enabled. Each pipeline can be
-preceded by the reserved word\fB!\fR. This causes the exit status of the
-pipeline to become \fB0\fR if the exit status of the last command is
-\fBnon-zero\fR, and \fB1\fR if the exit status of the last command is \fB0\fR.
-.sp
-.LP
-A \fIlist\fR is a sequence of one or more pipelines separated by \fB;, &, |&,
-&&, or |\fR, and optionally terminated by \fB;, &,\fR or \fB|&\fR. Of these
-five symbols, \fB;, &\fR, and \fB|&\fR have equal precedence, which is lower
-than that of \fB&&\fR and \fB||\fR. The symbols \fB&&\fR and \fB||\fR also have
-equal precedence.
-.sp
-.LP
-A semicolon (\fB;\fR) causes sequential execution of the preceding pipeline. An
-ampersand (\fB&\fR) causes asynchronous execution of the preceding pipeline,
-that is, the shell does \fInot\fR wait for that pipeline to finish. The symbol
-\fB|&\fR causes asynchronous execution of the preceding pipeline with a two-way
-pipe established to the parent shell. The standard input and output of the
-spawned pipeline can be written to and read from by the parent shell by
-applying the redirection operators \fB<&\fR and \fB>&\fR with \fBarg p\fR to
-commands and by using \fB-p\fR option of the built-in commands \fBread\fR and
-\fBprint\fR. The symbol \fB&&\fR (\fB||\fR) causes the \fIlist\fR following it
-to be executed only if the preceding pipeline returns a zero (\fBnon-zero\fR)
-value. One or more NEWLINEs can appear in a \fIlist\fR instead of a semicolon,
-to delimit a command. The first \fIitem\fR of the first \fIpipeline\fR of a
-\fIlist\fR that is a simple command not beginning with a redirection, and not
-occurring within a \fBwhile\fR, \fBuntil\fR, or \fBif\fR \fIlist\fR , can be
-preceded by a semicolon. This semicolon is ignored unless the \fBshowme\fR
-option is enabled as described with the \fBset\fR built-in.
-.sp
-.LP
-A \fIcommand\fR is either a simple-command or one of commands in the following
-list. Unless otherwise stated, the value returned by a command is that of the
+.Xr pipe 2
+to the standard input of the next command.
+Each command, except possibly the last, is run as a separate process.
+The shell waits for the last command to terminate.
+The exit status of a pipeline is the exit status of the last command unless the
+.Sy pipefail
+option is enabled.
+Each pipeline can be preceded by the reserved word
+.Sy \&! .
+This causes the exit status of the
+pipeline to become
+.Sy 0
+if the exit status of the last command is
+.Sy non-zero ,
+and
+.Sy 1
+if the exit status of the last command is
+.Sy 0 .
+.Pp
+A
+.Sy list
+is a sequence of one or more pipelines separated by
+.Sy \&; ,
+.Sy \&& ,
+.Sy \&|& ,
+.Sy \&&& ,
+or
+.Sy \&| ,
+and optionally terminated by
+.Sy \&; ,
+.Sy \&& ,
+or
+.Sy \&|& .
+Of these
+five symbols,
+.Sy \&; ,
+.Sy \&& ,
+and
+.Sy \&|&
+have equal precedence, which is lower than that of
+.Sy \&&&
+and
+.Sy || .
+The symbols
+.Sy \&&&
+and
+.Sy ||
+have equal precedence.
+.Pp
+A semicolon
+.Pq Sy \&;
+causes sequential execution of the preceding pipeline.
+An ampersand
+.Pq Sy \&&
+causes asynchronous execution of the preceding pipeline, that is, the shell
+does
+.Em not
+wait for that pipeline to finish.
+The symbol
+.Sy \&|&
+causes asynchronous execution of the preceding pipeline with a two-way pipe
+established to the parent shell.
+The standard input and output of the spawned pipeline can be written to and
+read from by the parent shell by applying the redirection operators
+.Sy \&<&
+and
+.Sy \&>&
+with
+.Cm arg p
+to
+commands and by using
+.Fl p
+option of the built-in commands
+.Ic read
+and
+.Ic print .
+The symbol
+.Sy \&&&
+.Pq Sy ||
+causes the
+.Ar list
+following it to be executed only if the preceding pipeline returns a zero
+.Pq non-zero
+value.
+One or more NEWLINEs can appear in a
+.Ar list
+instead of a semicolon, to delimit a command.
+The first
+.Ar item
+of the first
+.Ar pipeline
+of a
+.Ar list
+that is a simple command not beginning with a redirection, and not occurring
+within a
+.Ic while ,
+.Ic until ,
+or
+.Ic if
+.Ar list ,
+can be preceded by a semicolon.
+This semicolon is ignored unless the
+.Sy showme
+option is enabled as described with the
+.Ic set
+built-in.
+.Pp
+A
+.Sy command
+is either a simple-command or one of commands in the following list.
+Unless otherwise stated, the value returned by a command is that of the
last simple-command executed in the command.
-.sp
-.ne 2
-.na
-\fBfor\fR \fIvname\fR \fB[ in\fR \fIword\fR \fB\&... ] ;do\fR \fIlist\fR
-\fB;done\fR
-.ad
-.sp .6
-.RS 4n
-Each time a \fBfor\fR command is executed, \fIvname\fR is set to the next
-\fIword\fR taken from the \fBin\fR \fIword\fR list. If \fBin\fR \fIword ...\fR
-is omitted, the \fBfor\fR command executes the \fBdo\fR \fIlist\fR once for
-each positional parameter that is set starting from 1. Execution ends when
-there are no more words in the list. See \fBParameter Expansion\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBfor (( [\fR\fIexpr1\fR\fB] ; [\fR\fIexpr2\fR] ; [\fIexpr3\fR\fB] )) ;do\fR
-\fIlist\fR \fB;done\fR
-.ad
-.sp .6
-.RS 4n
-The arithmetic expression \fIexpr1\fR is evaluated first. The arithmetic
-expression \fIexpr2\fR is repeatedly evaluated until it evaluates to \fBzero\fR
-and when \fBnon-zero\fR, \fIlist\fR is executed and the arithmetic expression
-\fIexpr3\fR evaluated. If any expression is omitted, then it behaves as if it
-evaluated to \fB1\fR. See \fBArithmetic Evaluation\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBselect\fR \fIvname\fR [ in \fIword\fR \fB\&... ] ;do\fR \fIlist\fR
-\fB;done\fR
-.ad
-.sp .6
-.RS 4n
-A \fBselect\fR command prints on standard error (file descriptor 2) the set of
-\fIwords\fR, each preceded by a number. If \fBin\fR \fIword...\fR is omitted,
-the positional parameters starting from \fB1\fR are used instead. See
-\fBParameter Expansion\fR. The \fBPS3\fR prompt is printed and a line is read
-from the standard input. If this line consists of the number of one of the
-listed \fIword\fRs, then the value of the variable \fIvname\fR is set to the
-\fIword\fR corresponding to this number. If this line is empty, the selection
-list is printed again. Otherwise the value of the variable \fIvname\fR is set
-to \fBnull\fR. The contents of the line read from standard input is saved in
-the variable \fBREPLY\fR. The \fIlist\fR is executed for each selection until a
-break or \fBEOF\fR is encountered. If the \fBREPLY\fR variable is set to
-\fBnull\fR by the execution of \fIlist\fR, the selection list is printed before
-displaying the \fBPS3\fR prompt for the next selection.
-.RE
-
-.sp
-.ne 2
-.na
-\fBcase\fR \fIword\fR \fBin [ [(]\fR \fIpattern\fR \fB[ |\fR \fIpattern\fR
-\fB] ... )\fR \fIlist\fR \fB;; ] ... esac\fR
-.ad
-.sp .6
-.RS 4n
-A \fBcase\fR command executes the \fIlist\fR associated with the first
-\fIpattern\fR that matches \fIword\fR. The form of the patterns is the same as
-that used for file name generation. See \fBFile Name Generation\fR.
-.sp
-The \fB;;\fR operator causes execution of \fBcase\fR to terminate. If \fB;&\fR
-is used in place of \fB;;\fR the next subsequent list, if any, is executed.
-.RE
-
-.sp
-.ne 2
-.na
-\fBif\fR \fIlist\fR \fB;then\fR \fIlist\fR \fB[ ;elif\fR \fIlist\fR
-\fB;then\fR \fIlist\fR ] \fB\&... [ ;else\fR \fIlist\fR \fB]\fR \fB;fi\fR
-.ad
-.sp .6
-.RS 4n
-The \fIlist\fR following \fBif\fR is executed and, if it returns a \fBzero\fR
-exit status, the \fIlist\fR following the first \fBthen\fR is executed.
-Otherwise, the \fIlist\fR following \fBelif\fR is executed, and, if its value
-is \fBzero\fR, the \fIlist\fR following the next \fBthen\fR is executed.
-Failing each successive \fBelif\fR \fIlist\fR, the \fBelse\fR \fIlist\fR is
-executed. If the \fBif\fR \fIlist\fR has \fBnon-zero\fR exit status and there
-is no \fBelse\fR \fIlist\fR, then the \fBif\fR command returns a \fBzero\fR
+.Pp
+.Bl -tag -width Ds -compact
+.It Xo
+.Ic for Ar vname
+.Op Cm in Ar word No ...
+.Ic ;do Ar list Ic ;done
+.Xc
+.Pp
+Each time a
+.Ic for
+command is executed,
+.Ar vname
+is set to the next
+.Ar word
+taken from the
+.Ic in
+.Ar word
+list.
+If
+.Ic in
+.Ar word ...
+is omitted, the
+.Ic for
+command executes the
+.Ic do
+.Ar list
+once for each positional parameter that is set starting from 1.
+Execution ends when there are no more words in the list.
+See
+.Sx Parameter Expansion .
+.Pp
+.It Xo
+.Ic for
+.Sy ((
+.Op Ar expr1
+.Sy \&; Op Ar expr2
+.Sy \&; Op Ar expr3
+.Sy ))
+.Ic ;do Ar list Ic ;done
+.Xc
+.Pp
+The arithmetic expression
+.Ar expr1
+is evaluated first.
+The arithmetic expression
+.Ar expr2
+is repeatedly evaluated until it evaluates to
+.Sy zero
+and when
+.Sy non-zero ,
+.Ar list
+is executed and the arithmetic expression
+.Ar expr3
+is evaluated.
+If any expression is omitted, then it behaves as if it evaluated to
+.Sy 1 .
+See
+.Sx Arithmetic Evaluation .
+.Pp
+.It Xo
+.Ic select Ar vname
+.Op Sy in Ar word No ...
+.Ic ;do Ar list Ic ;done
+.Xc
+.Pp
+A
+.Ic select
+command prints on standard error (file descriptor 2) the set of
+.Ar words ,
+each preceded by a number.
+If
+.Ic in Ar word ...
+is omitted, the positional parameters starting from
+.Sy 1
+are used instead.
+See
+.Sx Parameter Expansion .
+The
+.Ev PS3
+prompt is printed and a line is read from the standard input.
+If this line consists of the number of one of the listed
+.Ar word Ns No s ,
+then the value of the variable
+.Ar vname
+is set to the
+.Ar word
+corresponding to this number.
+If this line is empty, the selection list is printed again.
+Otherwise the value of the variable
+.Ar vname
+is set to
+.Dv NULL .
+The contents of the line read from standard input is saved in the variable
+.Ev REPLY .
+The
+.Ar list
+is executed for each selection until a break or
+.Dv EOF
+is encountered.
+If the
+.Ev REPLY
+variable is set to
+.Dv NULL
+by the execution of
+.Ar list ,
+the selection list is printed before displaying the
+.Ev PS3
+prompt for the next selection.
+.Pp
+.It Xo
+.Ic case Ar word Ic in
+.Oo \&
+.Op Sy \&(
+.Ar pattern Oo \&| Ar pattern Oc No ... Sy \&)
+.Ar list Sy ;;
+.Oc No ...
+.Ic esac
+.Xc
+.Pp
+A
+.Ic case
+command executes the
+.Ar list
+associated with the first
+.Ar pattern
+that matches
+.Ar word .
+The form of the patterns is the same as that used for file name generation.
+See
+.Sx File Name Generation .
+.Pp
+The
+.Sy \&;\&;
+operator causes execution of
+.Ic case
+to terminate.
+If
+.Sy \&;&
+is used in place of
+.Sy \&;\&;
+the next subsequent list, if any, is executed.
+.Pp
+.It Xo
+.Ic if Ar list Ic ;then Ar list
+.Op Ic ;elif Ar list Ic ;then Ar list
+.No ...
+.Op Ic ;else Ar list
+.Ic ;fi
+.Xc
+.Pp
+The
+.Ar list
+following
+.Ic if
+is executed and, if it returns a
+.Sy zero
+exit status, the
+.Ar list
+following the first
+.Ic then
+is executed.
+Otherwise, the
+.Ar list
+following
+.Ic elif
+is executed, and, if its value is
+.Sy zero ,
+the
+.Ar list
+following the next
+.Ic then
+is executed.
+Failing each successive
+.Ic elif
+.Ar list ,
+the
+.Ic else
+.Ar list
+is executed.
+If the
+.Ic if
+.Ar list
+has
+.Sy non-zero
+exit status and there is no
+.Ic else
+.Ar list ,
+then the
+.Ic if
+command returns a
+.Sy zero
exit status.
-.RE
-
-.sp
-.ne 2
-.na
-\fBwhile\fR \fIlist\fR \fB;do\fR \fIlist\fR \fB;done\fR
-.ad
-.br
-.na
-\fBuntil \fIlist\fR \fB;do\fR \fIlist\fR \fB;done\fR
-.ad
-.sp .6
-.RS 4n
-A \fBwhile\fR command repeatedly executes the while \fIlist\fR and, if the exit
-status of the last command in the list is zero, executes the \fBdo\fR
-\fIlist\fR, otherwise the loop terminates. If no commands in the \fBdo\fR
-\fIlist\fR are executed, then the \fBwhile\fR command returns a \fBzero\fR exit
-status, \fBuntil\fR can be used in place of \fBwhile\fR to negate the loop
-termination test.
-.RE
-
-.sp
-.ne 2
-.na
-\fB((\fR\fIexpression\fR\fB))\fR
-.ad
-.sp .6
-.RS 4n
-The \fIexpression\fR is evaluated using the rules for arithmetic evaluation
-described in this manual page. If the value of the arithmetic expression is
-\fBnon-zero\fR, the exit status is \fB0\fR. Otherwise the exit status is
-\fB1\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fB(\fR\fIlist\fR\fB)\fR
-.ad
-.sp .6
-.RS 4n
-Execute \fIlist\fR in a separate environment. If two adjacent open parentheses
-are needed for nesting, a SPACE must be inserted to avoid evaluation as an
-arithmetic command as described in this section.
-.RE
-
-.sp
-.ne 2
-.na
-\fB{\fR \fIlist\fR\fB;}
-.sp
-.RS 4n
-\fIlist\fR is simply executed. Unlike the metacharacters, \fB(\fR and \fB)\fR,
-\fB{\fR and \fB}\fR are \fIreserved words\fR and must occur at the beginning of
-a line or after a \fB;\fR to be recognized.
-.RE
-
-.sp
-.ne 2
-.na
-\fB[[\fR \fIexpression\fR \fB]]\fR
-.ad
-.sp .6
-.RS 4n
-Evaluates \fIexpression\fR and returns a \fBzero\fR exit status when
-\fIexpression\fR is true. See \fBConditional Expressions\fR for a description
-of \fIexpression\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBfunction\fR \fIvarname\fR \fB{\fR \fIlist\fR \fB;}\fR
-.ad
-.br
-.na
-\fB\fIvarname\fR \fB() {\fR \fIlist\fR \fB;}\fR
-.ad
-.sp .6
-.RS 4n
-Define a function which is referenced by \fIvarname\fR. A function whose
-\fIvarname\fR contains a dot (\fB\&.\fR) is called a discipline function and the
-portion of the \fIvarname\fR preceding the last \fB\&.\fR must refer to an
-existing variable.
-.sp
-The body of the function is the \fIlist\fR of commands between \fB{\fR and
-\fB}\fR. A function defined with the function \fIvarname\fR syntax can also be
-used as an argument to the \fB\&.\fR special built-in command to get the
-equivalent behavior as if the \fIvarname\fR\fB()\fR syntax were used to define
-it. See \fBFunctions\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBnamespace\fR \fIidentifier\fR \fB{\fR \fIlist\fR \fB};\fR
-.ad
-.sp .6
-.RS 4n
-Defines or uses the name space \fIidentifier\fR and runs the commands in
-\fIlist\fR in this name space.
-See \fBName Spaces\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBtime [\fR \fIpipeline\fR \fB]\fR
-.ad
-.sp .6
-.RS 4n
-If \fIpipeline\fR is omitted, the user and system time for the current shell
-and completed child processes is printed on standard error. Otherwise,
-\fIpipeline\fR is executed and the elapsed time as well as the user and system
-time are printed on standard error. The \fBTIMEFORMAT\fR variable can be set to
-a format string that specifies how the timing information should be displayed.
-See \fBShell Variables\fR for a description of the \fBTIMEFORMAT\fR variable.
-.RE
-
-.sp
-.LP
+.Pp
+.It Ic while Ar list Ic ;do Ar list Ic ;done
+.It Ic until Ar list Ic ;do Ar list Ic ;done
+.Pp
+A
+.Ic while
+command repeatedly executes the while
+.Ar list
+and, if the exit status of the last command in the list is zero, executes the
+.Ic do
+.Ar list ,
+otherwise the loop terminates.
+If no commands in the
+.Ic do
+.Ar list
+are executed, then the
+.Ic while
+command returns a
+.Sy zero
+exit status.
+.Ic until
+can be used in place of
+.Ic while
+to negate the loop termination test.
+.Pp
+.It Sy (( Ns Ar expression Ns Sy ))
+.Pp
+The
+.Ar expression is evaluated using the rules for arithmetic evaluation described
+in this manual page.
+If the value of the arithmetic expression is
+.Sy non-zero ,
+the exit status is
+.Sy 0 .
+Otherwise the exit status is
+.Sy 1 .
+.Pp
+.It Sy \&( Ns Ar list Ns Sy \&)
+.Pp
+Execute
+.Ar list
+in a separate environment.
+If two adjacent open parentheses are needed for nesting, a SPACE must be
+inserted to avoid evaluation as an arithmetic command as described in this
+section.
+.Pp
+.It Sy { Ar list Ns Sy ;}
+.Pp
+.Ar list
+is simply executed.
+Unlike the metacharacters,
+.Sy \&(
+and
+.Sy \&) ,
+.Sy \&{
+and
+.Sy \&}
+are
+.Sy reserved words
+and must occur at the beginning of a line or after a
+.Sy \&;
+to be recognized.
+.Pp
+.It Sy [[ Ar expression Sy ]]
+.Pp
+Evaluates
+.Ar expression
+and returns a
+.Sy zero
+exit status when
+.Ar expression
+is true.
+See
+.Sx Conditional Expressions
+for a description of
+.Ar expression .
+.Pp
+.It Ic function Ar varname Sy { Ar list Sy ;}
+.It Ar varname Sy \&() Sy { Ar list Sy ;}
+.Pp
+Define a function which is referenced by
+.Ar varname .
+A function whose
+.Ar varname
+contains a dot
+.Pq Sy \&.
+is called a discipline function and the portion of the
+.Ar varname
+preceding the last
+.Sy \&.
+must refer to an existing variable.
+.Pp
+The body of the function is the
+.Ar list
+of commands between
+.Sy {
+and
+.Sy } .
+A function defined with the
+.Ic function
+.Ar varname
+syntax can also be used as an argument to the
+.Sy \&.
+special built-in command to get the equivalent behavior as if the
+.Ar varname
+.Sy ()
+syntax were used to define it.
+See
+.Sx Functions .
+.Pp
+.It Ic namespace Ar identifier Sy { Ar list Sy };
+.Pp
+Defines or uses the name space
+.Ar identifier
+and runs the commands in
+.Ar list
+in this name space.
+See
+.Sx Name Spaces .
+.Pp
+.It Ic time Op Ar pipeline
+.Pp
+If
+.Ar pipeline
+is omitted, the user and system time for the current shell and completed child
+processes is printed on standard error.
+Otherwise,
+.Ar pipeline
+is executed and the elapsed time as well as the user and system time are
+printed on standard error.
+The
+.Ev TIMEFORMAT
+variable can be set to a format string that specifies how the timing
+information should be displayed.
+See
+.Sx Shell Variables
+for a description of the
+.Ev TIMEFORMAT
+variable.
+.El
+.Pp
The following reserved words are recognized as reserved only when they are the
first word of a command and are not quoted:
-.sp
-.in +2
-\fBcase\fR
-.in -2
-.br
-.in +2
-\fBdo\fR
-.in -2
-.br
-.in +2
-\fBdone\fR
-.in -2
-.br
-.in +2
-\fBelse\fR
-.in -2
-.br
-.in +2
-\fBelif\fR
-.in -2
-.br
-.in +2
-\fBesac\fR
-.in -2
-.br
-.in +2
-\fBfor\fR
-.in -2
-.br
-.in +2
-\fBfi\fR
-.in -2
-.br
-.in +2
-\fBfunction\fR
-.in -2
-.br
-.in +2
-\fBif\fR
-.in -2
-.br
-.in +2
-\fBselect\fR
-.in -2
-.br
-.in +2
-\fBthen\fR
-.in -2
-.br
-.in +2
-\fBtime\fR
-.in -2
-.br
-.in +2
-\fBuntil\fR
-.in -2
-.br
-.in +2
-\fBwhile\fR
-.in -2
-.br
-.in +2
-\fB{ }\fR
-.in -2
-.br
-.in +2
-\fB[[ ]]\fR
-.in -2
-.br
-.in +2
-\fB!\fR
-.in -2
-.SS "Variable Assignments"
+.Bl -column -offset Ds xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx
+.It Cm case Ta Cm do Ta Cm done Ta Cm else
+.It Cm elif Ta Cm esac Ta Cm for Ta Cm fi
+.It Cm function Ta Cm if Ta Cm select Ta Cm then
+.It Cm time Ta Cm until Ta Cm while Ta Sy { }
+.It Sy [[ ]] Ta Sy \&! Ta Ta
+.El
+.Ss "Variable Assignments"
One or more variable assignments can start a simple command or can be arguments
-to the \fBtypeset\fR, \fBenum\fR, \fBexport\fR, or \fBreadonly\fR special
-built-in commands. The syntax for an \fIassignment\fR is of the form:
-.sp
-.ne 2
-.na
-\fB\fIvarname\fR\fB=\fR\fIword\fR
-.ad
-.br
-.na
-\fB\fIvarname\fR\fB[\fR\fIword\fR\fB]=\fR\fIword\fR
-.ad
-.sp .6
-.RS 4n
-No space is permitted between \fIvarname\fR and the \fB=\fR or between \fB=\fR
-and \fIword\fR.
-The variable \fIvarname\fR is unset before the assignment.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fIvarname\fR\fB=(\fR\fIassignlist\fR\fB)\fR
-.ad
-.sp .6
-.RS 4n
-No space is permitted between \fIvarname\fR and the \fB=\fR. An
-\fIassignlist\fR can be one of the following:
-.sp
-.ne 2
-.na
-\fB\fIword ...\fR
-.ad
-.sp .6
-.RS 4n
+to the
+.Ic typeset ,
+.Ic enum ,
+.Ic export , or
+.Ic readonly
+special built-in commands.
+The syntax for an
+.Ar assignment
+is of the form:
+.Pp
+.Bl -tag -width Ds -compact
+.Sm off
+.It Ar varname Sy = Ar word
+.It Ar varname Oo Ar word Oc Sy = Ar word
+.Sm on
+.Pp
+No space is permitted between
+.Ar varname
+and the
+.Sy \&=
+or between
+.Sy \&=
+and
+.Ar word .
+The variable
+.Ar varname
+is unset before the assignment.
+.Pp
+.Sm off
+.It Ar varname Sy =( Ar assignlist Sy \&)
+.Sm on
+.Pp
+No space is permitted between
+.Ar varname
+and the
+.Sy = .
+An
+.Ar assignlist
+can be one of the following:
+.Bl -tag -width Ds
+.It Ar word No ...
+.Pp
Indexed array assignment.
-.RE
-
-.sp
-.ne 2
-.na
-\fB[\fR\fIword\fR\fB]=\fR\fIword ...\fR
-.ad
-.sp .6
-.RS 4n
-Associative array assignment. If prefixed by \fBtypeset\fR \fB-a\fR, creates an
-indexed array instead.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fIassignment ...\fR
-.ad
-.sp .6
-.RS 4n
-Compound variable assignment. This creates a compound variable \fIvarname\fR
-with sub-variables of the form \fIvarname.name\fR, where \fIname\fR is the name
-portion of assignment. The value of \fIvarname\fR contains all the assignment
-elements. Additional assignments made to sub-variables of \fIvarname\fR are
-also displayed as part of the value of \fIvarname\fR. If no \fIassignment\fRs
-are specified, \fIvarname\fR is a compound variable allowing subsequence child
-elements to be defined.
-.RE
-
-.sp
-.ne 2
-.na
-\fBtypeset [\fR\fIoptions\fR] \fIassignment\fR \fB\&...\fR
-.ad
-.sp .6
-.RS 4n
-Nested variable assignment. Multiple assignments can be specified by separating
-each of them with a \fB;\fR. The previous value is unset before the assignment.
-.RE
-
-.sp
-.ne 2
-.na
-\fB.\fR \fIfilename\fR
-.ad
-.sp .6
-.RS 4n
-Include the assignment commands contained in \fIfilename\fR.
-.RE
-
-In addition, a \fB+=\fR can be used in place of the \fB=\fR to signify adding
-to or appending to the previous value. When \fB+=\fR is applied to an
-arithmetic type, \fIword\fR is evaluated as an arithmetic expression and added
-to the current value. When applied to a string variable, the value defined by
-\fIword\fR is appended to the value. For compound assignments, the previous
-value is not unset and the new values are appended to the current ones provided
-that the types are compatible.
-
-The right hand side of a variable assignment undergoes all the expansion
-listed below except word splitting, brace expansion, and file name generation.
-When the left hand side is an assignment is a compound variable and
-the right hand is the name of a compound variable, the compound variable
-on the right will be copied or appended to the compound variable on the left.
-
-.RE
-
-.SS "Comments"
-A word beginning with \fB#\fR causes that word and all the following characters
-up to a NEWLINE to be commented, or ignored.
-.SS "Aliasing"
+.Sm off
+.It Oo Ar word Oc Sy = Ar word \ No ...
+.Sm on
+.Pp
+Associative array assignment.
+If prefixed by
+.Ic typeset Fl a ,
+creates an indexed array instead.
+.It Ar assignment No ...
+.Pp
+Compound variable assignment.
+This creates a compound variable
+.Ar varname
+with sub-variables of the form
+.Ar varname.name ,
+where
+.Ar name
+is the name
+portion of assignment.
+The value of
+.Ar varname
+contains all the assignment elements.
+Additional assignments made to sub-variables of
+.Ar varname
+are also displayed as part of the value of
+.Ar varname .
+If no
+.Ar assignment Ns No s
+are specified,
+.Ar varname
+is a compound variable allowing subsequence child elements to be defined.
+.It Ic typeset Oo Ar options Oc Ar assignment No ...
+.Pp
+Nested variable assignment.
+Multiple assignments can be specified by separating each of them with a
+.Sy \&; .
+The previous value is unset before the assignment.
+.It Ic \&. Ar filename
+.Pp
+Include the assignment commands contained in
+.Ar filename .
+.El
+.Pp
+In addition, a
+.Sy +=
+can be used in place of the
+.Sy \&=
+to signify adding to or appending to the previous value.
+When
+.Sy +=
+is applied to an arithmetic type,
+.Ar word
+is evaluated as an arithmetic expression and added to the current value.
+When applied to a string variable, the value defined by
+.Ar word
+is appended to the value.
+For compound assignments, the previous value is not unset and the new values
+are appended to the current ones provided that the types are compatible.
+The right hand side of a variable assignment undergoes all the expansion listed
+below except word splitting, brace expansion, and file name generation.
+When the left hand side is an assignment is a compound variable and the right
+hand is the name of a compound variable, the compound variable on the right
+will be copied or appended to the compound variable on the left.
+.El
+.Ss "Comments"
+A word beginning with
+.Ic #
+causes that word and all the following characters up to a NEWLINE to be
+commented, or ignored.
+.Ss "Aliasing"
The first word of each command is replaced by the text of an alias if an alias
-for this word has been defined. An alias name consists of any number of
-characters excluding metacharacters, quoting characters, file expansion
-characters, parameter expansion characters, command substitution characters,
-the characters \fB/\fR and \fB=\fR. The replacement string can contain any
-valid shell script including the metacharacters listed in the \fBCommands\fR
-section. The first word of each command in the replaced text, other than any
-that are in the process of being replaced, are tested for aliases. If the last
-character of the alias value is a BLANK then the word following the alias is
-also checked for alias substitution.
-.sp
-.LP
+for this word has been defined.
+An alias name consists of any number of characters excluding metacharacters,
+quoting characters, file expansion characters, parameter expansion characters,
+command substitution characters, the characters
+.Sy /
+and
+.Sy = .
+The replacement string can contain any valid shell script including the
+metacharacters listed in the
+.Sx Commands
+section.
+The first word of each command in the replaced text, other than any that are in
+the process of being replaced, are tested for aliases.
+If the last character of the alias value is a BLANK then the word following the
+alias is also checked for alias substitution.
+.Pp
Aliases can be used to redefine built-in commands but cannot be used to
-redefine the reserved words listed in the \fBCommands\fR section. Aliases can
-be created and listed with the alias command and can be removed with the
-\fBunalias\fR command.
-.sp
-.LP
-Aliasing is performed when scripts are read, not while they are executed. For
-an alias to take effect, the \fBalias\fR definition command has to be executed
-before the command which references the alias is read. The following aliases
-are compiled into the shell but can be unset or redefined:
-.sp
-.in +2
-.nf
+redefine the reserved words listed in the
+.Sx Commands
+section.
+Aliases can be created and listed with the
+.Ic alias
+command and can be removed with the
+.Ic unalias
+command.
+.Pp
+Aliasing is performed when scripts are read, not while they are executed.
+For an alias to take effect, the
+.Ic alias
+definition command has to be executed before the command which references the
+alias is read.
+The following aliases are compiled into the shell but can be unset or
+redefined:
+.Bd -literal -offset Ds
autoload='typeset -fu'
command='command '
compound='typeset -C'
@@ -553,6939 +748,6475 @@ stop='kill -s STOP'
suspend='kill -s STOP $$'
times='{ { time;} 2>&1;}'
type='whence -v'
-.fi
-.in -2
-.sp
-
-.SS "Tilde Substitution"
+.Ed
+.Ss "Tilde Substitution"
After alias substitution is performed, each word is checked to see if it begins
-with an unquoted tilde (\fB~\fR). For tilde substitution, \fIword\fR also
-refers to the \fIword\fR portion of parameter expansion. See \fBParameter
-Expansion\fR.
-.sp
-.LP
-If it does, the word up to a \fB/\fR is checked to see if it matches a user
-name in the password database. If a match is found, the \fB~\fR and the matched
-login name are replaced by the login directory of the matched user. If no match
-is found, the original text is left unchanged. A \fB~\fR by itself, or in front
-of a \fB/\fR, is replaced by \fB$HOME\fR. A \fB~\fR followed by a \fB+\fR or
-\fB-\fR is replaced by the value of \fB$PWD\fR and \fB$OLDPWD\fR respectively.
-.sp
-.LP
-In addition, when expanding a \fIvariable assignment\fR, tilde substitution is
-attempted when the value of the assignment begins with a \fB~\fR, and when a
-\fB~\fR appears after a colon (\fB:\fR). The \fB:\fR also terminates a \fB~\fR
+with an unquoted tilde
+.Pq Sy \&~ .
+For tilde substitution,
+.Ar word
+also refers to the
+.Ar word
+portion of parameter expansion.
+See
+.Sx Parameter Expansion .
+.Pp
+If it does, the word up to a
+.Sy /
+is checked to see if it matches a user name in the password database.
+If a match is found, the
+.Sy ~
+and the matched login name are replaced by the login directory of the matched
+user.
+If no match is found, the original text is left unchanged.
+A
+.Sy ~
+by itself, or in front of a
+.Sy / ,
+is replaced by
+.Ev $HOME .
+A
+.Sy ~
+followed by a
+.Sy +
+or
+.Sy -
+is replaced by the value of
+.Ev $PWD
+and
+.Ev $OLDPWD
+respectively.
+.Pp
+In addition, when expanding a
+.Ar variable assignment ,
+tilde substitution is attempted when the value of the assignment begins with a
+.Sy ~ ,
+and when a
+.Sy ~
+appears after a colon
+.Pq Sy \&: .
+The
+.Sy \&:
+also terminates a
+.Sy ~
login name.
-.SS "Command Substitution"
+.Ss "Command Substitution"
The standard output from a command enclosed in parentheses preceded by a dollar
-sign ( \fB$(\fR\fIlist\fR\fB)\fR ), or in a brace group preceded by a dollar
-sign ( \fB${\fR \fIlist\fR\fB;}\fR ), or in a pair of grave accents (\fB``\fR)
-can be used as part or all of a word. Trailing NEWLINEs are removed. In the
-second case, the \fB{\fR and \fB}\fR are treated as a reserved words so that
-\fB{\fR must be followed by a blank and \fB}\fR must appear at the beginning of
-the line or follow a \fB;\fR. In the third (obsolete) form, the string between
-the quotes is processed for special quoting characters before the command is
-executed. See \fBQuoting\fR.
-.sp
-.LP
-The command substitution \fB$(cat file)\fR can be replaced by the equivalent
-but faster \fB$(<file)\fR. The command substitution \fB$(\fR\fIn\fR\fB<#)\fR
-expands to the current byte offset for file descriptor \fIn\fR. Except for the
-second form, the command list is run in a subshell so that no side effects are
-possible. For the second form, the final \fB}\fR will be recognized as a
-reserved word after any token.
-.SS "Arithmetic Substitution"
+sign -
+.Sy \&$ Ns Po Ar list Pc -
+or in a brace group preceded by a dollar
+sign -
+.Sy \&${ Ar list Ns Sy ;} ,
+- or in a pair of grave accents -
+.Sy ``
+- can be used as part or all of a word.
+Trailing NEWLINEs are removed.
+In the second case, the
+.Sy {
+and
+.Sy }
+are treated as a reserved words so that
+.Sy {
+must be followed by a blank and
+.Sy }
+must appear at the beginning of
+the line or follow a
+.Sy \&; .
+In the third (obsolete) form, the string between the quotes is processed for
+special quoting characters before the command is executed.
+See
+.Sx Quoting .
+.Pp
+The command substitution
+.Sy $(cat file)
+can be replaced by the equivalent
+but faster
+.Sy $(<file) .
+The command substitution
+.Sy $( Ns Ar n Sy \&<\&#\&)
+expands to the current byte offset for file descriptor
+.Ar n .
+Except for the second form, the command list is run in a subshell so that no
+side effects are possible.
+For the second form, the final
+.Sy }
+will be recognized as a reserved word after any token.
+.Ss "Arithmetic Substitution"
An arithmetic expression enclosed in double parentheses preceded by a dollar
-sign ( \fB$((\fR\fIarithmetic_expression\fR\fB))\fR) is replaced by the value
-of the arithmetic expression within the double parentheses.
-.SS "Process Substitution"
-Each command argument of the form \fB<(\fR\fIlist\fR\fB)\fR or
-\fB>(\fR\fIlist\fR\fB)\fR runs process \fIlist\fR asynchronously connected to
-some file in \fB/dev/fd\fR. The name of this file becomes the argument to the
-command. If the form with \fB>\fR is selected then writing on this file
-provides input for \fIlist\fR. If \fB<\fR is used, then the file passed as an
-argument contains the output of the \fIlist\fR process.
-.sp
-.LP
+sign -
+.Sy $(( Ns Ar arithmetic_expression Ns Sy ))
+- is replaced by the value of the arithmetic expression within the double
+parentheses.
+.Ss "Process Substitution"
+Each command argument of the form
+.Sy <( Ns Ar list Ns Sy \&)
+or
+.Sy >( Ns Ar list Ns Sy \&)
+runs process
+.Ar list
+asynchronously connected to some file in
+.Pa /dev/fd .
+The name of this file becomes the argument to the command.
+If the form with
+.Sy >
+is selected then writing on this file provides input for
+.Ar list .
+If
+.Sy <
+is used, then the file passed as an argument contains the output of the
+.Ar list
+process.
+.Pp
For example,
-.sp
-.in +2
-.nf
-paste <(cut -f1 \fIfile1\fR) <(cut -f3 \fIfile2\fR) | tee \e
- >(\fIprocess1\fR) >(\fIprocess2\fR)
-.fi
-.in -2
-.sp
-
-.sp
-.LP
-\fBcut\fRs fields 1 and 3 from the files \fIfile1\fR and \fIfile2\fR
-respectively, \fBpaste\fRs the results together, and sends it to the processes
-\fIprocess1\fR and \fIprocess2\fR. It also displays the results to the standard
-output. The file, which is passed as an argument to the command, is a UNIX
-\fBpipe\fR(2). Programs that expect to \fBlseek\fR(2) on the file do not work.
-.sp
-Process substitution of the form \fB<\fR(\fIlist\fR\fB)\fR can also be used
-with the \fB<\fR redirection operator which causes the output of list to be
-standard input or the input for whatever file descriptor is specified.
-.SS "Parameter Expansion"
+.Bd -literal -offset Ds
+paste <(cut -f1 file1) <(cut -f3 file2) | tee \e
+ >(process1) >(process2)
+.Ed
+.Pp
+.Sy cut Ns No s
+fields 1 and 3 from the files
+.Ar file1
+and
+.Ar file2
+respectively,
+.Sy paste Ns No s
+the results together, and sends it to the processes
+.Ar process1
+and
+.Ar process2 .
+It also displays the results to the standard output.
+The file, which is passed as an argument to the command, is a UNIX
+.Xr pipe 2 .
+Programs that expect to
+.Xr lseek 2
+on the file do not work.
+.Pp
+Process substitution of the form
+.Sy <( Ns Ar list Ns Sy \&)
+can also be used
+with the
+.Sy <
+redirection operator which causes the output of list to be standard input or
+the input for whatever file descriptor is specified.
+.Ss "Parameter Expansion"
A parameter is a variable, one or more digits, or any of the characters
-\fB*\fR, \fB@\fR, \fB#\fR, \fB?\fR, \fB-\fR, \fB$\fR, and \fB!\fR. A variable
-is denoted by a \fIvname\fR. To create a variable whose \fIvname\fR contains a
-\fB\&.\fR, a variable whose \fBvname\fR consists of everything before the
-last . must already exist. A variable has a value and zero or more attributes.
-Variables can be assigned values and attributes by using the \fBtypeset\fR
-special built-in command. The attributes supported by the shell are described
-later with the \fBtypeset\fR special built-in command. Exported variables pass
-values and attributes to the environment.
-.sp
-.LP
-The shell supports both indexed and associative arrays. An element of an array
-variable is referenced by a subscript. A subscript for an indexed array is
-denoted by an arithmetic expression, (see \fBArithmetic Evaluation\fR), between
-a \fB[\fR and a \fB]\fR.
-To assign values to an indexed array, use \fIvname\fR\fB=(\fR\fIvalue\fR
-\&...\fB)\fR or \fBset -A\fR \fIvname value ...\fR .
+.Sy \&* ,
+.Sy \&@ ,
+.Sy \&# ,
+.Sy \&? ,
+.Sy \&- ,
+.Sy \&$ ,
+and
+.Sy \&! .
+A variable is denoted by a
+.Ar vname .
+To create a variable whose
+.Ar vname
+contains a
+.Sy \&. ,
+a variable whose
+.Ar vname
+consists of everything before the last
+.Sy \&.
+must already exist.
+A variable has a value and zero or more attributes.
+Variables can be assigned values and attributes by using the
+.Ic typeset
+special built-in command.
+The attributes supported by the shell are described later with the
+.Ic typeset
+special built-in command.
+Exported variables pass values and attributes to the environment.
+.Pp
+The shell supports both indexed and associative arrays.
+An element of an array variable is referenced by a subscript.
+A subscript for an indexed array is denoted by an arithmetic expression,
+.Pq see Sx Arithmetic Evaluation ,
+between a
+.Sy \&[
+and a
+.Sy \&] .
+To assign values to an indexed array, use
+.Ar vname Ns Sy =( Ns Ar value No ... Ns Sy \&)
+or
+.Sy set Fl A Ar vname value No ... .
The value of all subscripts must be in the range of
-\fB0\fR through \fB4,194,303\fR. A negative subscript is treated as an offset
-from the maximum current index +1 so that -1 refers to the last element.
-Indexed arrays can be declared with the \fB-a\fR option to typeset. Indexed
-arrays need not be declared. Any reference to a variable with a valid
-subscript is legal and an array will be created if necessary.
-.sp
-.LP
-An associative array is created with the \fB-A\fR option to \fBtypeset\fR. A
-subscript for an associative array is denoted by a string enclosed between
-\fB[\fR and \fB]\fR.
-.sp
-.LP
+.Sy 0
+to
+.Sy 4,194,303 .
+A negative subscript is treated as an offset from the maximum current index +1
+so that -1 refers to the last element.
+Indexed arrays can be declared with the
+.Fl a
+option to
+.Ic typeset .
+Indexed arrays need not be declared.
+Any reference to a variable with a valid subscript is legal and an array will
+be created if necessary.
+.Pp
+An associative array is created with the
+.Fl A
+option to
+.Ic typeset .
+A subscript for an associative array is denoted by a string enclosed between
+.Sy \&[
+and
+.Sy \&] .
+.Pp
Referencing any array without a subscript is equivalent to referencing the
-array with subscript \fB0\fR.
-.sp
-.LP
+array with subscript
+.Sy 0 .
+.Pp
The value of a variable can be assigned by:
-.sp
-.in +2
-.nf
-\fIvname\fR=\fIvalue\fR [\fIvname\fR=\fIvalue\fR] ...
-.fi
-.in -2
-.sp
-
-.sp
-.LP
+.Bd -ragged -offset Ds
+.Ar vname Ns Sy = Ns Ar value
+.Op Ar vname Ns Sy = Ns Ar value
+.No \&...
+.Ed
+.Pp
or
-.sp
-.in +2
-.nf
-\fIvname\fR[\fIsubscript\fR]=\fIvalue\fR [\fIvname\fR[\fIsubscript\fR]=\fIvalue\fR] ...
-.fi
-.in -2
-.sp
-Note that no space is allowed before or after the \fB=\fR.
-.sp
-Attributes assigned by the \fItypeset\fR special built-in command apply to all
-elements of the array.
+.Bd -ragged -offset Ds
+.Ar vname Ns [ Ns Ar subscript Ns ]= Ns Ar value
+.Op Ar vname Ns [ Ns Ar subscript Ns ]= Ns Ar value
+.No ...
+.Ed
+.Pp
+Note that no space is allowed before or after the
+.Sy = .
+.Pp
+Attributes assigned by the
+.Ic typeset
+special built-in command apply to all elements of the array.
An array element can be a simple variable, a compound variable or an array
variable.
An element of an indexed array can be either an indexed array or an associative
array.
An element of an associative array can also be either.
-To refer to an array element that is part of an array
-element, concatenate the subscript in brackets. For example, to refer
-to the \fIfoobar\fR element of an associative array that is defined as the
-third element of the indexed array, use
-\fB${\fIvname\fR\fB[\fR\fI3\fR\fB][\fR\fIfoobar\fR\fB]}\fR
-.sp
-.LP
-A \fInameref\fR is a variable that is a reference to another variable. A
-\fInameref\fR is created with the \fB-n\fR attribute of \fBtypeset\fR. The
-value of the variable at the time of the \fBtypeset\fR command becomes the
-variable that is referenced whenever the \fInameref\fR variable is used. The
-name of a \fInameref\fR cannot contain a dot (\fI\&.\fR). When a variable or
-function name contains a dot (\fB\&.\fR) and the portion of the name up to the
-first \fB\&.\fR matches the name of a \fInameref\fR, the variable referred to
-is obtained by replacing the \fInameref\fR portion with the name of the
-variable referenced by the \fInameref\fR. If a \fInameref\fR is used as the
-index of a \fBfor\fR loop, a name reference is established for each item in the
-list. A \fInameref\fR provides a convenient way to refer to the variable inside
-a function whose name is passed as an argument to a function. For example, if
-the name of a variable is passed as the first argument to a function, the
-command
-.sp
-.in +2
-.nf
- typeset -n var=$1
-.fi
-.in -2
-.sp
-
-.sp
-.LP
-inside the function causes references and assignments to \fIvar\fR to be
-references and assignments to the variable whose name has been passed to the
-function. If any of the floating point attributes, \fB-E\fR,\fB-F\fR or
-\fB-X\fR, or the integer attribute, \fB-i\fR, is set for \fIvname\fR, then the
-\fIvalue\fR is subject to arithmetic evaluation as described in this manual
-page. Positional parameters, parameters denoted by a number, can be assigned
-values with the \fBset\fR special built-in command. Parameter \fB$0\fR is set
-from argument zero when the shell is invoked.
-.sp
-The character \fB$\fR is used to introduce substitutable parameters.
-.sp
-.ne 2
-.na
-\fB${\fR\fIparameter\fR\fB}\fR
-.ad
-.sp .6
-.RS 4n
-The shell reads all the characters from \fB${\fR to the matching \fB}\fR as
-part of the same word even if it contains braces or metacharacters. The value,
-if any, of the parameter is substituted. The braces are required when
-\fIparameter\fR is followed by a letter, digit, or underscore that is not to be
-interpreted as part of its name or when the variable name contains a dot
-(\fB\&.\fR). The braces are also required when a variable is subscripted unless
-it is part of an Arithmetic Expression or a Conditional Expression. If
-\fIparameter\fR is one or more digits then it is a positional parameter. A
-positional parameter of more than one digit must be enclosed in braces. If
-\fIparameter\fR is \fB*\fR or \fB@\fR, then all the positional parameters,
-starting with \fB$1\fR, are substituted and separated by a field separator
-character. If an array \fIvname\fR with last subscript \fB*\fR or \fB@\fR is
-used, or for index arrays of the form \fIsub1\fR \fB\&..\fR \fIsub2\fR is used,
-then the value for each of the elements between \fIsub1\fR and \fIsub2\fR
-inclusive (or all elements for \fB*\fR and \fB@\fR) is substituted, separated
-by the first character of the value of \fBIFS\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fB${#\fR\fIparameter\fR\fB}\fR
-.ad
-.sp .6
-.RS 4n
-If \fIparameter\fR is \fB*\fR or \fB@\fR, the number of positional parameters
-is substituted. Otherwise, the length of the value of the \fIparameter\fR is
-substituted.
-.RE
-
-.sp
-.ne 2
-.na
-\fB${#\fR\fIvname\fR\fB[*]}\fR
-.ad
-.br
-.na
-\fB${#\fR\fIvname\fR\fB[@]}\fR
-.ad
-.sp .6
-.RS 4n
-The number of elements in the array \fIvname\fR is substituted.
-.RE
-
-.ne 2
-.na
-\fB${@\fR\fIvname\fR\fB}\fR
-.ad
-.sp .6
-.RS 4n
+To refer to an array element that is part of an array element, concatenate the
+subscript in brackets.
+For example, to refer to the
+.Ar foobar
+element of an associative array that is defined as the third element of the
+indexed array, use
+.Sm off
+.Sy ${ Ar vname Sy \&[ Ar 3 Sy ][ Ar foobar Sy ]} .
+.Sm on
+.Pp
+A
+.Ar nameref
+is a variable that is a reference to another variable.
+A
+.Ar nameref
+is created with the
+.Fl n
+attribute of
+.Ic typeset .
+The value of the variable at the time of the
+.Ic typeset
+command becomes the variable that is referenced whenever the
+.Ar nameref
+variable is used.
+The name of a
+.Ar nameref
+cannot contain a dot
+.Pq \&. .
+When a variable or
+function name contains a dot
+.Pq \&.
+and the portion of the name up to the first \&. matches the name of a
+.Ar nameref ,
+the variable referred to is obtained by replacing the
+.Ar nameref
+portion with the name of the variable referenced by the
+.Ar nameref .
+If a
+.Ar nameref
+is used as the index of a
+.Cm for
+loop, a name reference is established for each item in the list.
+A
+.Ar nameref
+provides a convenient way to refer to the variable inside a function whose name
+is passed as an argument to a function.
+For example, if the name of a variable is passed as the first argument to a
+function, the command
+.Bd -literal -offset Ds
+typeset -n var=$1
+.Ed
+.Pp
+inside the function causes references and assignments to
+.Ar var
+to be references and assignments to the variable whose name has been passed to
+the function.
+If any of the floating point attributes,
+.Fl E ,
+.Fl F
+or
+.Fl X ,
+or the integer attribute,
+.Fl i ,
+is set for
+.Ar vname ,
+then the
+.Ar value
+is subject to arithmetic evaluation as described in this manual page.
+Positional parameters, parameters denoted by a number, can be assigned values
+with the
+.Cm set
+special built-in command.
+Parameter
+.Sy $0
+is set from argument zero when the shell is invoked.
+.Pp
+The character
+.Sy $
+is used to introduce substitutable parameters.
+.Pp
+.Bl -tag -width Ds -compact
+.It Sy ${ Ns Ar parameter Ns Sy }
+The shell reads all the characters from
+.Sy ${
+to the matching
+.Sy }
+as part of the same word even if it contains braces or metacharacters.
+The value, if any, of the parameter is substituted.
+The braces are required when
+.Ar parameter
+is followed by a letter, digit, or underscore that is not to be interpreted as
+part of its name or when the variable name contains a dot
+.Pq Sy \&. .
+The braces are also required when a variable is subscripted unless it is part
+of an Arithmetic Expression or a Conditional Expression.
+If
+.Ar parameter
+is one or more digits then it is a positional parameter.
+A positional parameter of more than one digit must be enclosed in braces.
+If
+.Ar parameter
+is
+.Sy \&*
+or
+.Sy \&@ ,
+then all the positional parameters, starting with
+.Sy $1 ,
+are substituted and separated by a field separator character.
+If an array
+.Ar vname
+with last subscript
+.Sy \&*
+or
+.Sy \&@
+is used, or for index arrays of the form
+.Ar sub1 Ns Sy \&.. Ns Ar sub2
+is used, then the value for each of the elements between
+.Ar sub1
+and
+.Ar sub2
+inclusive
+.Pq or all elements for Sy \&* and Sy \&@
+is substituted, separated by the first character of the value of
+.Ev IFS .
+.Pp
+.It Sy ${# Ns Ar parameter Ns Sy }
+If
+.Ar parameter
+is
+.Sy \&*
+or
+.Sy \&@ ,
+the number of positional parameters is substituted.
+Otherwise, the length of the value of the
+.Ar parameter
+is substituted.
+.Pp
+.It Sy ${# Ns Ar vname Ns Sy [*]}
+.It Sy ${# Ns Ar vname Ns Sy [@]}
+The number of elements in the array
+.Ar vname
+is substituted.
+.Pp
+.It Sy ${@ Ns Ar vname Ns Sy }
Expands to the type name or attributes of the variable referred to by
-\fIvname\fR. See \fIType Variables\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fB${!\fR\fIvname\fR\fB}\fR
-.ad
-.sp .6
-.RS 4n
-Expands to the name of the variable referred to by \fIvname\fR. This is
-\fIvname\fR except when \fIvname\fR is a name reference.
-.RE
-
-.sp
-.ne 2
-.na
-\fB${!\fR\fIvname\fR\fB[\fR\fIsubscript\fR\fB]}\fR
-.ad
-.sp .6
-.RS 4n
-Expands to name of the subscript unless \fIsubscript\fR is \fB*\fR or \fB@\fR,
-or of the form \fIsub1\fR \fB..\fR \fIsub2\fR.
-When \fIsubscript\fR is \fB*\fR, the list of array subscripts for \fIvname\fR
-is generated. For a variable that is not an array, the value is \fB0\fR if the
-variable is set, otherwise it is \fBnull\fR. When \fIsubscript\fR is \fB@\fR,
-it is the same as \fB$ {\fR\fIvname\fR\fB[\fR\fI*\fR\fB]}\fR, except that when
-used in double quotes, each array subscript yields a separate argument.
-When subscript is of the form \fIsub1\fR \fB..\fR \fIsub2\fR it expands to the
-list of subscripts between \fIsub1\fR and \fIsub2\fR inclusive using the same
-quoting rules as \fB@\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fB${!\fR\fIprefix\fR\fB*}\fR
-.ad
-.sp .6
-.RS 4n
-Expands to the names of the variables whose names begin with \fIprefix\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fB${\fR\fIparameter\fR\fB:-\fR\fIword\fR\fB}\fR
-.ad
-.sp .6
-.RS 4n
-If \fIparameter\fR is set and is non-null then substitute its value. Otherwise
-substitute \fIword\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fB${\fR\fIparameter\fR\fB:=\fR\fIword\fR\fB}\fR
-.ad
-.sp .6
-.RS 4n
-If \fIparameter\fR is not set or is \fBnull\fR, set it to \fIword\fR. The value
-of the parameter is then substituted. Positional parameters cannot be assigned
-to in this way.
-.RE
-
-.sp
-.ne 2
-.na
-\fB${\fR\fIparameter\fR\fB:?\fR\fIword\fR\fB}\fR
-.ad
-.sp .6
-.RS 4n
-If \fIparameter\fR is set and is non-null, substitute its value. Otherwise,
-print \fIword\fR and exit from the shell , if the shell is not interactive. If
-\fIword\fR is omitted then a standard message is printed.
-.RE
-
-.sp
-.ne 2
-.na
-\fB${\fR\fIparameter\fR\fB:+\fR\fIword\fR\fB}\fR
-.ad
-.sp .6
-.RS 4n
-If \fIparameter\fR is set and is non-null, substitute \fIword\fR. Otherwise
-substitute nothing.
-.RE
-
-In the above, \fIword\fR is not evaluated unless it is to be used as the
-substituted string. In the following example, \fBpwd\fR is executed only if
-\fBd\fR is not set or is NULL:
-.sp
-.in +2
-.nf
+.Ar vname .
+See
+.Sx Type Variables .
+.Pp
+.It Sy \&$\&{\&! Ns Ar vname Ns Sy }
+Expands to the name of the variable referred to by
+.Ar vname .
+This is
+.Ar vname
+except when
+.Ar vname
+is a name reference.
+.Pp
+.It Sy \&$\&{\&! Ns Ar vname Ns Oo Ar subscript Oc Ns Sy }
+Expands to name of the subscript unless
+.Ar subscript
+is
+.Sy \&*
+or
+.Sy \&@ ,
+or of the form
+.Ar sub1 Ns Sy \&.. Ns Ar sub2 .
+When
+.Ar subscript
+is
+.Sy \&* ,
+the list of array subscripts for
+.Ar vname
+is generated.
+For a variable that is not an array, the value is
+.Sy 0
+if the variable is set, otherwise it is
+.Sy null .
+When
+.Ar subscript
+is
+.Sy \&@ ,
+it is the same as
+.Sy ${ Ar vname Ns Oo * Oc Ns Sy } ,
+except that when used in double quotes, each array subscript yields a separate
+argument.
+When subscript is of the form
+.Ar sub1 Ns Sy \&.. Ns Ar sub2
+it expands to the list of subscripts between
+.Ar sub1
+and
+.Ar sub2
+inclusive using the same quoting rules as
+.Sy @ .
+.Pp
+.It Sy \&$\&{\&! Ns Ar prefix Ns Sy *}
+Expands to the names of the variables whose names begin with
+.Ar prefix .
+.Pp
+.It Sy ${ Ns Ar parameter Ns Sy \&:- Ns Ar word Ns Sy }
+If
+.Ar parameter
+is set and is non-null then substitute its value.
+Otherwise substitute
+.Ar word .
+.Pp
+.It Sy ${ Ns Ar parameter Ns Sy \&:= Ns Ar word Ns Sy }
+If
+.Ar parameter
+is not set or is
+.Sy null ,
+set it to
+.Ar word .
+The value of the parameter is then substituted.
+Positional parameters cannot be assigned to in this way.
+.Pp
+.It Sy ${ Ns Ar parameter Ns Sy \&:\&? Ns Ar word Ns Sy }
+If
+.Ar parameter
+is set and is non-null, substitute its value.
+Otherwise, print
+.Ar word
+and exit from the shell, if the shell is not interactive.
+If
+.Ar word
+is omitted then a standard message is printed.
+.Pp
+.It Sy ${ Ns Ar parameter Ns Sy \&:+ Ns Ar word Ns Sy }
+If
+.Ar parameter
+is set and is non-null, substitute
+.Ar word .
+Otherwise substitute nothing.
+.El
+.Pp
+In the above,
+.Ar word
+is not evaluated unless it is to be used as the substituted string.
+In the following example,
+.Ic pwd
+is executed only if
+.Sy d
+is not set or is
+.Dv NULL :
+.Bd -literal -offset Ds
print ${d:-$(pwd)}
-.fi
-.in -2
-.sp
-
-If the colon (\fB:\fR) is omitted from the expression, the shell only checks
-whether \fIparameter\fR is set or not.
-
-.sp
-.ne 2
-.na
-\fB${\fR\fIparameter\fR\fB:\fR\fIoffset\fR:\fIlength\fR}\fR
-.ad
-.br
-.na
-\fB${\fR\fIparameter\fR\fB:\fR\fIoffset\fR\fB}\fR
-.ad
-.sp .6
-.RS 4n
-Expands to the portion of the value of \fIparameter\fR starting at the
-character (counting from \fB0\fR) determined by expanding offset as an
-arithmetic expression and consisting of the number of characters determined by
-the arithmetic expression defined by \fIlength\fR.
-.sp
-In the second form, the remainder of the value is used. A negative offset
-counts backwards from the end of \fIparameter\fR.
-.sp
+.Ed
+.Pp
+If the colon
+.Pq Sy \&:
+is omitted from the expression, the shell only checks whether
+.Ar parameter
+is set or not.
+.Pp
+.Bl -tag -width Ds -compact
+.Sm off
+.It Sy ${ Ns Ar parameter Sy \&: Ar offset Sy \&: Ar length Sy }
+.It Sy ${ Ns Ar parameter Sy \&: Ar offset Sy }
+.Sm on
+Expands to the portion of the value of
+.Ar parameter
+starting at the
+character
+.Pq counting from 0
+determined by expanding
+.Ar offset
+as an arithmetic expression and consisting of the number of characters
+determined by the arithmetic expression defined by
+.Ar length .
+.Pp
+In the second form, the remainder of the value is used.
+A negative offset counts backwards from the end of
+.Ar parameter .
+.Pp
One or more BLANKs is required in front of a minus sign to prevent the shell
-from interpreting the operator as \fB:-\fR. If parameter is \fB*\fR or \fB@\fR,
-or is an array name indexed by \fB*\fR or \fB@\fR, then \fIoffset\fR and
-\fIlength\fR refer to the array index and number of elements respectively. A
-negative \fIoffset\fR is taken relative to one greater than the highest
-subscript for indexed arrays. The order for associative arrays is unspecified.
-.RE
-
-.sp
-.ne 2
-.na
-\fB${\fR\fIparameter\fR\fB#\fR\fIpattern\fR\fB}\fR
-.ad
-.br
-.na
-\fB${\fR\fIparameter\fR\fB##\fR\fIpattern\fR\fB}\fR
-.ad
-.sp .6
-.RS 4n
-If the shell \fIpattern\fR matches the beginning of the value of
-\fIparameter\fR, then the value of this expansion is the value of the
-\fIparameter\fR with the matched portion deleted. Otherwise the value of this
-\fIparameter\fR is substituted. In the first form the smallest matching
-\fIpattern\fR is deleted and in the second form the largest matching
-\fIpattern\fR is deleted. When \fIparameter\fR is \fB@\fR, \fB*\fR, or an array
-variable with subscript \fB@\fR or \fB*\fR, the substring operation is applied
-to each element in turn.
-.RE
-
-.sp
-.ne 2
-.na
-\fB${\fR\fIparameter\fR\fB%\fR\fIpattern\fR\fB}\fR
-.ad
-.br
-.na
-\fB${\fR\fIparameter\fR\fB%%\fR\fIpattern\fR\fB}\fR
-.ad
-.sp .6
-.RS 4n
-If the shell \fIpattern\fR matches the end of the value of \fIparameter\fR,
+from interpreting the operator as
+.Sy \&:- .
+If parameter is
+.Sy \&*
+or
+.Sy \&@ ,
+or is an array name indexed by
+.Sy \&*
+or
+.Sy \&@ ,
+then
+.Ar offset
+and
+.Ar length
+refer to the array index and number of elements respectively.
+A negative
+.Ar offset
+is taken relative to one greater than the highest subscript for indexed arrays.
+The order for associative arrays is unspecified.
+.Pp
+.Sm off
+.It Sy ${ Ns Ar parameter Sy # Ar pattern Sy }
+.It Sy ${ Ns Ar parameter Sy ## Ar pattern Sy }
+.Sm on
+If the shell
+.Ar pattern
+matches the beginning of the value of
+.Ar parameter ,
+then the value of this expansion is the value of the
+.Ar parameter
+with the matched portion deleted.
+Otherwise the value of this
+.Ar parameter
+is substituted.
+In the first form the smallest matching
+.Ar pattern
+is deleted and in the second form the largest matching
+.Ar pattern
+is deleted.
+When
+.Ar parameter
+is
+.Sy \&@ ,
+.Sy \&* ,
+or an array variable with subscript
+.Sy \&@
+or
+.Sy \&* ,
+the substring operation is applied to each element in turn.
+.Pp
+.Sm off
+.It Sy ${ Ns Ar parameter Sy % Ar pattern Sy }
+.It Sy ${ Ns Ar parameter Sy %% Ar pattern Sy }
+.Sm on
+If the shell
+.Ar pattern
+matches the end of the value of
+.Ar parameter ,
then the value of this expansion is the value of the parameter with the matched
-part deleted. Otherwise substitute the value of \fIparameter\fR. In the first
-form the smallest matching pattern is deleted, and in the second form the
-largest matching pattern is deleted. When parameter is \fB@\fR, \fB*\fR, or an
-array variable with subscript \fB@\fR or \fB*\fR, the substring operation is
-applied to each element in turn.
-.RE
-
-.sp
-.ne 2
-.na
-\fB${\fR\fIparameter\fR\fB/\fR\fIpattern\fR\fB/\fR\fIstring\fR\fB}\fR
-.ad
-.br
-.na
-\fB${\fR\fIparameter\fR\fB//\fR\fIpattern\fR\fB/\fR\fIstring\fR\fB}\fR
-.ad
-.br
-.na
-\fB${\fR\fIparameter\fR\fB/#\fR\fIpattern\fR\fB/\fR\fIstring\fR\fB}\fR
-.ad
-.br
-.na
-\fB${\fR\fIparameter\fR\fB/%\fR\fIpattern\fR\fB/\fR\fIstring\fR\fB}\fR
-.ad
-.sp .6
-.RS 4n
-Expands \fIparameter\fR and replaces the longest match of \fIpattern\fR with
-the specified \fIstring\fR. Each occurrence of \fB\e\fR\fIn\fR in \fIstring\fR
-is replaced by the portion of \fIparameter\fR that matches the \fIn\fR\fBth\fR
+part deleted.
+Otherwise substitute the value of
+.Ar parameter .
+In the first form the smallest matching pattern is deleted, and in the second
+form the largest matching pattern is deleted.
+When parameter is
+.Sy \&@ ,
+.Sy \&* ,
+or an array variable with subscript
+.Sy \&@
+or
+.Sy \&* ,
+the substring operation is applied to each element in turn.
+.Pp
+.Sm off
+.It Sy ${ Ns Ar parameter Sy / Ar pattern Sy / Ar string Sy }
+.It Sy ${ Ns Ar parameter Sy // Ar pattern Sy / Ar string Sy }
+.It Sy ${ Ns Ar parameter Sy /# Ar pattern Sy / Ar string Sy }
+.It Sy ${ Ns Ar parameter Sy /% Ar pattern Sy / Ar string Sy }
+.Sm on
+Expands
+.Ar parameter
+and replaces the longest match of
+.Ar pattern
+with the specified
+.Ar string .
+Each occurrence of
+.Sy \e Ns Ar n
+in
+.Ar string
+is replaced by the portion of
+.Ar parameter
+that matches the
+.Ar n Ns No th
sub-pattern.
-.sp
-When \fIstring\fR is null, the \fIpattern\fR is deleted and the \fB/\fR in
-front of string can be omitted. When \fIparameter\fR is \fB@\fR, \fB*\fR, or an
-array variable with subscript \fB@\fR or \fB*\fR, the substitution operation is
-applied to each element in turn. In this case, the \fIstring\fR portion of
-\fIword\fR is re-evaluated for each element.
-.sp
-In the first form, only the first occurrence of \fIpattern\fR is replaced.
-.sp
-In the second form, each match for \fIpattern\fR is replaced by the specified
-\fIstring\fR.
-.sp
+.Pp
+When
+.Ar string
+is null, the
+.Ar pattern
+is deleted and the
+.Sy /
+in front of string can be omitted.
+When
+.Ar parameter
+is
+.Sy \&@ ,
+.Sy \&* ,
+or an
+array variable with subscript
+.Sy \&@
+or
+.Sy \&* ,
+the substitution operation is applied to each element in turn.
+In this case, the
+.Ar string
+portion of
+.Ar word
+is re-evaluated for each element.
+.Pp
+In the first form, only the first occurrence of
+.Ar pattern
+is replaced.
+.Pp
+In the second form, each match for
+.Ar pattern
+is replaced by the specified
+.Ar string .
+.Pp
The third form restricts the pattern match to the beginning of the
-\fIstring\fR.
-.sp
-The fourth form restricts the pattern match to the end of the \fIstring\fR.
-.RE
-
-.sp
-.LP
+.Ar string .
+.Pp
+The fourth form restricts the pattern match to the end of the
+.Ar string .
+.El
+.Pp
The following parameters are automatically set by the shell:
-.sp
-.ne 2
-.na
-\fB#\fR
-.ad
-.RS 19n
+.Bl -tag -width Ds
+.It Sy #
The number of positional parameters in decimal.
-.RE
-
-.sp
-.ne 2
-.na
-\fB-\fR
-.ad
-.RS 19n
-Options supplied to the shell on invocation or by the \fBset\fR command.
-.RE
-
-.sp
-.ne 2
-.na
-\fB?\fR
-.ad
-.RS 19n
+.It Sy -
+Options supplied to the shell on invocation or by the
+.Ic set
+command.
+.It Sy \&?
The decimal value returned by the last executed command.
-.RE
-
-.sp
-.ne 2
-.na
-\fB$\fR
-.ad
-.RS 19n
+.It Sy $
The process number of this shell.
-.RE
-
-.sp
-.ne 2
-.na
-\fB_\fR
-.ad
-.RS 19n
-Initially, the value of \fB_\fR is the absolute pathname of the shell or script
-being executed as passed in the environment. It is subsequently assigned the
-last argument of the previous command.
-.sp
-This parameter is not set for commands which are asynchronous. This parameter
-is also used to hold the name of the matching \fBMAIL\fR file when checking for
-mail.
-.RE
-
-.sp
-.ne 2
-.na
-\fB!\fR
-.ad
-.RS 19n
+.It Sy _
+Initially, the value of
+.Sy _
+is the absolute pathname of the shell or script being executed as passed in the
+environment.
+It is subsequently assigned the last argument of the previous command.
+.Pp
+This parameter is not set for commands which are asynchronous.
+This parameter is also used to hold the name of the matching
+.Ev MAIL
+file when checking for mail.
+.It Sy \&!
The process id or the pool name and job number of the last background command
invoked or the most recent job put in the background with the
-\fBbg\fR built-in command. Background jobs started in a named pool with be
-in the form \fIpool\fR.\fInumber\fR where \fIpool\fR is the pool name and
-\fInumber\fR is the job number within that pool.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\&.sh.command\fR
-.ad
-.RS 19n
-When processing a \fBDEBUG\fR trap, this variable contains the current command
-line that is about to run.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\&.sh.edchar\fR
-.ad
-.RS 19n
+.Ic bg
+built-in command.
+Background jobs started in a named pool with be in the form
+.Ar pool Ns \&. Ns Ar number
+where
+.Ar pool
+is the pool name and
+.Ar number
+is the job number within that pool.
+.It Sy \&.sh.command
+When processing a
+.Dv DEBUG
+trap, this variable contains the current command line that is about to run.
+.It Sy \&.sh.edchar
This variable contains the value of the keyboard character (or sequence of
-characters if the first character is an ESC, \fBASCII 033\fR) that has been
-entered when processing a \fBKEYBD\fR trap. If the value is changed as part of
-the trap action, then the new value replaces the key (or key sequence) that
-caused the trap. See the \fBKey Bindings\fR section of this manual page.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\&.sh.edcol\fR
-.ad
-.RS 19n
-The character position of the cursor at the time of the most recent \fBKEYBD\fR
+characters if the first character is an ESC,
+.Pq ASCII 033
+that has been entered when processing a
+.Dv KEYBD
trap.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\&.sh.edmode\fR
-.ad
-.RS 19n
-The value is set to ESC when processing a \fBKEYBD\fR trap while in \fBvi\fR
-insert mode. Otherwise, \fB\&.sh.edmode\fR is null when processing a
-\fBKEYBD\fR trap. See the \fBvi Editing Mode\fR section of this manual page.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\&.sh.edtext\fR
-.ad
-.RS 19n
-The characters in the input buffer at the time of the most recent \fBKEYBD\fR
-trap. The value is null when not processing a \fBKEYBD\fR trap.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\&.sh.file\fR
-.ad
-.RS 19n
+If the value is changed as part of the trap action, then the new value replaces
+the key (or key sequence) that caused the trap.
+See the
+.Sx Key Bindings
+section of this manual page.
+.It Sy \&.sh.edcol
+The character position of the cursor at the time of the most recent
+.Dv KEYBD
+trap.
+.It Sy \&.sh.edmode
+The value is set to ESC when processing a
+.Dv KEYBD
+trap while in
+.Sy vi
+insert mode.
+Otherwise,
+.Sy \&.sh.edmode
+is null when processing a
+.Dv KEYBD
+trap.
+See the
+.Sx vi Editing Mode
+section of this manual page.
+.It Sy \&.sh.edtext
+The characters in the input buffer at the time of the most recent
+.Dv KEYBD
+trap.
+The value is null when not processing a
+.Dv KEYBD
+trap.
+.It Sy \&.sh.file
The pathname of the file than contains the current command.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\&.sh.fun\fR
-.ad
-.RS 19n
+.It Sy \&.sh.fun
The name of the current function that is being executed.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\&.sh.match\fR
-.ad
-.RS 19n
+.It Sy \&.sh.match
An indexed array which stores the most recent match and sub-pattern matches
after conditional pattern matches that match and after variables expansions
-using the operators \fB#\fR, \fB%\fR, or \fB/\fR. The \fB0\fRth element stores
-the complete match and the \fIi\fRth element stores the \fIi\fRth sub-match.
-The \fB\&.sh.match\fR variable is unset when the variable that has expanded is
-assigned a new value.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\&.sh.math\fR
-.ad
-.RS 19n
-Used for defining arithmetic functions (see \fIArithmetic evaluation\fR) and
-stores the list of user-defined arithmetic functions.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\&.sh.name\fR
-.ad
-.RS 19n
+using the operators
+.Sy \&# ,
+.Sy \&% , or
+.Sy \&/ .
+The
+.Sy 0 Ns No th
+element stores the complete match and the
+.Ar i Ns No th
+element stores the
+.Ar i Ns No th
+sub-match.
+The
+.Sy \&.sh.match
+variable is unset when the variable that has expanded is assigned a new value.
+.It Sy \&.sh.math
+Used for defining arithmetic functions
+.Pq see Sx Arithmetic evaluation
+and stores the list of user-defined arithmetic functions.
+.It Sy \&.sh.name
Set to the name of the variable at the time that a discipline function is
invoked.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\&.sh.subscript\fR
-.ad
-.RS 19n
+.It Sy \&.sh.subscript
Set to the name subscript of the variable at the time that a discipline
function is invoked.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\&.sh.subshell\fR
-.ad
-.RS 19n
+.It Sy \&.sh.subshell
The current depth for sub-shells and command substitution.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\&.sh.value\fR
-.ad
-.RS 19n
+.It Sy \&.sh.value
Set to the value of the variable at the time that the set or append discipline
-function is invoked. When a user-defined arithmetic function is invoked, the
-value of \fB.sh.value\fR is saved and \fB.sh.value\fR is set to long double
-precision floating point. \fB.sh.value\fR is restored when the function
-returns.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\&.sh.version\fR
-.ad
-.RS 19n
+function is invoked.
+When a user-defined arithmetic function is invoked, the value of
+.Sy .sh.value
+is saved and
+.Sy .sh.value
+is set to long double precision floating point.
+.Sy .sh.value
+is restored when the function returns.
+.It Sy \&.sh.version
Set to a value that identifies the version of this shell.
-.RE
-
-.sp
-.ne 2
-.na
-\fBLINENO\fR
-.ad
-.RS 19n
+.It Sy LINENO
The current line number within the script or function being executed.
-.RE
-
-.sp
-.ne 2
-.na
-\fBOLDPWD\fR
-.ad
-.RS 19n
-The previous working directory set by the \fBcd\fR command.
-.RE
-
-.sp
-.ne 2
-.na
-\fBOPTARG\fR
-.ad
-.RS 19n
-The value of the last option argument processed by the \fBgetopts\fR built-in
-command.
-.RE
-
-.sp
-.ne 2
-.na
-\fBOPTIND\fR
-.ad
-.RS 19n
-The index of the last option argument processed by the \fBgetopts\fR built-in
+.It Sy OLDPWD
+The previous working directory set by the
+.Ic cd
command.
-.RE
-
-.sp
-.ne 2
-.na
-\fBPPID\fR
-.ad
-.RS 19n
+.It Sy OPTARG
+The value of the last option argument processed by the
+.Ic getopts
+built-in command.
+.It Sy OPTIND
+The index of the last option argument processed by the
+.Ic getopts
+built-in command.
+.It Sy PPID
The process number of the parent of the shell.
-.RE
-
-.sp
-.ne 2
-.na
-\fBPWD\fR
-.ad
-.RS 19n
-The present working directory set by the \fBcd\fR command.
-.RE
-
-.sp
-.ne 2
-.na
-\fBRANDOM\fR
-.ad
-.RS 19n
+.It Sy PWD
+The present working directory set by the
+.Ic cd
+command.
+.It Sy RANDOM
Each time this variable is referenced, a random integer, uniformly distributed
-between \fB0\fR and \fB32767\fR, is generated. The sequence of random numbers
-can be initialized by assigning a numeric value to \fBRANDOM\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBREPLY\fR
-.ad
-.RS 19n
-This variable is set by the \fBselect\fR statement and by the \fBread\fR
+between
+.Sy 0
+and
+.Sy 32767 ,
+is generated.
+The sequence of random numbers can be initialized by assigning a numeric value
+to
+.Ev RANDOM .
+.It Sy REPLY
+This variable is set by the
+.Ic select
+statement and by the
+.Ic read
built-in command when no arguments are supplied.
-.RE
-
-.sp
-.ne 2
-.na
-\fBSECONDS\fR
-.ad
-.RS 19n
+.It Sy SECONDS
Each time this variable is referenced, the number of seconds since shell
-invocation is returned. If this variable is assigned a value, then the value
-returned upon reference is the value that was assigned plus the number of
-seconds since the assignment.
-.RE
-
-.sp
-.ne 2
-.na
-\fBSHLVL\fR
-.ad
-.RS 19n
+invocation is returned.
+If this variable is assigned a value, then the value returned upon reference is
+the value that was assigned plus the number of seconds since the assignment.
+.It Sy SHLVL
An integer variable the is incremented each time the shell is invoked and is
-exported. If \fBSHLVL\fR is not in the environment when the shell is invoked,
-it is set to 1.
-.RE
-
-.sp
-.LP
+exported.
+If
+.Ev SHLVL
+is not in the environment when the shell is invoked, it is set to 1.
+.El
+.Pp
The following variables are used by the shell:
-.sp
-.ne 2
-.na
-\fBCDPATH\fR
-.ad
-.RS 14n
-Defines the search path for the \fBcd\fR command.
-.RE
-
-.sp
-.ne 2
-.na
-\fBCOLUMNS\fR
-.ad
-.RS 14n
+.Bl -tag -width Ds
+.It Sy CDPATH
+Defines the search path for the
+.Ic cd
+command.
+.It Sy COLUMNS
Defines the width of the edit window for the shell edit modes and for printing
select lists.
-.RE
-
-.sp
-.ne 2
-.na
-\fBEDITOR\fR
-.ad
-.RS 14n
-If the \fBVISUAL\fR variable is not set, the value of this variable is checked
-for the patterns as described with \fBVISUAL\fR and the corresponding editing
-option is turned on.
-.sp
-See the \fBset\fR command in the \fBSpecial Command\fR section of this manual
-page.
-.RE
-
-.sp
-.ne 2
-.na
-\fBENV\fR
-.ad
-.RS 14n
+.It Sy EDITOR
+If the
+.Ev VISUAL
+variable is not set, the value of this variable is checked for the patterns as
+described with
+.Ev VISUAL
+and the corresponding editing option is turned on.
+.Pp
+See the
+.Ic set
+command in the
+.Sx Special Commands
+section of this manual page.
+.It Sy ENV
Performs parameter expansion, command substitution, and arithmetic substitution
on the value to generate the pathname of the script that is executed when the
-shell is invoked. This file is typically used for alias and function
-definitions. The default value is \fB$HOME/.kshrc\fR.
-.sp
-See the \fBInvocation\fR section of this manual page.
-.sp
-\fBENV\fR is not set by the shell.
-.RE
-
-.sp
-.ne 2
-.na
-\fBFCEDIT\fR
-.ad
-.RS 14n
-Obsolete name for the default editor name for the \fBhist\fR command.
-\fBFCEDIT\fR is not used when \fBHISTEDIT\fR is set.
-.sp
-The shell specifies a default value to \fBFCEDIT\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBFIGNORE\fR
-.ad
-.RS 14n
+shell is invoked.
+This file is typically used for alias and function definitions.
+The default value is
+.Sy $HOME/.kshrc .
+.Pp
+See the
+.Sx Invocation
+section of this manual page.
+.Pp
+.Ev ENV
+is not set by the shell.
+.It Sy FCEDIT
+Obsolete name for the default editor name for the
+.Ic hist
+command.
+.Ev FCEDIT
+is not used when
+.Ev HISTEDIT
+is set.
+.Pp
+The shell specifies a default value to
+.Ev FCEDIT .
+.It Sy FIGNORE
A pattern that defines the set of file names that is ignored when performing
file name matching.
-.RE
-
-.sp
-.ne 2
-.na
-\fBFPATH\fR
-.ad
-.RS 14n
-The search path for function definitions. The directories in this path are
-searched for a file with the same name as the function or command when a
-function with the \fB-u\fR attribute is referenced and when a command is not
-found. If an executable file with the name of that command is found, then it is
-read and executed in the current environment. Unlike \fBPATH\fR, the current
-directory must be represented explicitly by dot (\fB\&.\fR) rather than by
-adjacent colon (\fB:\fR) characters or a beginning or ending colon (\fB:\fR).
-.RE
-
-.sp
-.ne 2
-.na
-\fBHISTCMD\fR
-.ad
-.RS 14n
+.It Sy FPATH
+The search path for function definitions.
+The directories in this path are searched for a file with the same name as the
+function or command when a function with the
+.Fl u
+attribute is referenced and when a command is not found.
+If an executable file with the name of that command is found, then it is read
+and executed in the current environment.
+Unlike
+.Ev PATH ,
+the current directory must be represented explicitly by dot
+.Pq Sy \&.
+rather than by adjacent colon
+.Pq Sy \&:
+characters or a beginning or ending colon
+.Pq Sy \&: .
+.It Sy HISTCMD
The number of the current command in the history file.
-.RE
-
-.sp
-.ne 2
-.na
-\fBHISTEDIT\fR
-.ad
-.RS 14n
-The name for the default editor name for the \fBhist\fR command.
-.RE
-
-.sp
-.ne 2
-.na
-\fBHISTFILE\fR
-.ad
-.RS 14n
+.It Sy HISTEDIT
+The name for the default editor name for the
+.Ic hist
+command.
+.It Sy HISTFILE
If this variable is set when the shell is invoked, the value is the pathname of
-the file that is used to store the command history. See the \fBCommand
-Re-entry\fR section of this manual page.
-.RE
-
-.sp
-.ne 2
-.na
-\fBHISTSIZE\fR
-.ad
-.RS 14n
+the file that is used to store the command history.
+See the
+.Sx Command Re-entry
+section of this manual page.
+.It Sy HISTSIZE
If this variable is set when the shell is invoked, then the number of
previously entered commands that are accessible by this shell is greater than
-or equal to this number. The default is \fB512\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBHOME\fR
-.ad
-.RS 14n
-The default argument (home directory) for the \fBcd\fR command.
-.sp
-\fBHOME\fR is not set by the shell. \fBHOME\fR is set by \fBlogin\fR(1).
-.RE
-
-.sp
-.ne 2
-.na
-\fBIFS\fR
-.ad
-.RS 14n
+or equal to this number.
+The default is
+.Sy 512 .
+.It Sy HOME
+The default argument (home directory) for the
+.Ic cd
+command.
+.Pp
+.Ev HOME
+is not set by the shell.
+.Ev HOME
+is set by
+.Xr login 1 .
+.It Sy IFS
Internal field separators, normally SPACE, TAB, and NEWLINE that are used to
separate the results of command substitution or parameter expansion and to
-separate fields with the built-in command read. The first character of the
-\fBIFS\fR variable is used to separate arguments for the \fB"$*"\fR
-substitution. See the \fBQuoting\fR section of this manual page.
-.sp
-Each single occurrence of an \fBIFS\fR character in the string to be split,
-that is not in the \fBissspace\fR character class, and any adjacent characters
-in \fBIFS\fR that are in the \fBissspace\fR character class, delimit a field.
-One or more characters in IFS that belong to the \fBissspace\fR character
-class, delimit a field. In addition, if the same \fBissspace\fR character
-appears consecutively inside \fBIFS\fR, this character is treated as if it were
-not in the \fBissspace\fR class, so that if \fBIFS\fR consists of two tab
-characters, then two adjacent tab characters delimit a null field.
-.sp
-The shell specifies a default value to \fBIFS\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBJOBMAX\fR
-.ad
-.RS 14n
+separate fields with the built-in command read.
+The first character of the
+.Ev IFS
+variable is used to separate arguments for the
+.Dq Sy \&$*
+substitution.
+See the
+.Sx Quoting
+section of this manual page.
+.Pp
+Each single occurrence of an
+.Ev IFS
+character in the string to be split, that is not in the
+.Sy issspace
+character class, and any adjacent characters in
+.Ev IFS
+that are in the
+.Sy issspace
+character class, delimit a field.
+One or more characters in
+.Ev IFS
+that belong to the
+.Sy issspace
+character class, delimit a field.
+In addition, if the same
+.Sy issspace
+character appears consecutively inside
+.Ev IFS ,
+this character is treated as if it were not in the
+.Sy issspace
+class, so that if
+.Ev IFS
+consists of two tab characters, then two adjacent tab characters delimit a null
+field.
+.Pp
+The shell specifies a default value to
+.Ev IFS .
+.It Sy JOBMAX
This variable defines the maximum number running background jobs that can run
-at a time. When this limit is reached, the shell will wait for a job to
-complete before staring a new job.
-.RE
-
-.sp
-.ne 2
-.na
-\fBLANG\fR
-.ad
-.RS 14n
+at a time.
+When this limit is reached, the shell will wait for a job to complete before
+starting a new job.
+.It Sy LANG
This variable determines the locale category for any category not specifically
-selected with a variable starting with \fBLC_\fR or \fBLANG\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBLC_ALL\fR
-.ad
-.RS 14n
-This variable overrides the value of the \fBLANG\fR variable and any other
-\fBLC_\fR variable.
-.RE
-
-.sp
-.ne 2
-.na
-\fBLC_COLLATE\fR
-.ad
-.RS 14n
+selected with a variable starting with
+.Ev LC_
+or
+.Ev LANG .
+.It Sy LC_ALL
+This variable overrides the value of the
+.Ev LANG
+variable and any other
+.Ev LC_
+variable.
+.It Sy LC_COLLATE
This variable determines the locale category for character collation
information.
-.RE
-
-.sp
-.ne 2
-.na
-\fBLC_CTYPE\fR
-.ad
-.RS 14n
+.It Sy LC_CTYPE
This variable determines the locale category for character handling functions.
-It determines the character classes for pattern matching. See the \fBFile Name
-Generation\fR section of this manual page.
-.RE
-
-.sp
-.ne 2
-.na
-\fBLC_NUMERIC\fR
-.ad
-.RS 14n
+It determines the character classes for pattern matching.
+See the
+.Sx File Name Generation
+section of this manual page.
+.It Sy LC_NUMERIC
This variable determines the locale category for the decimal point character.
-.RE
-
-.sp
-.ne 2
-.na
-\fBLINES\fR
-.ad
-.RS 14n
+.It Sy LINES
If this variable is set, the value is used to determine the column length for
-printing select lists. Select lists prints vertically until about two-thirds of
-\fBLINES\fR lines are filled.
-.RE
-
-.sp
-.ne 2
-.na
-\fBMAIL\fR
-.ad
-.RS 14n
-If this variable is set to the name of a mail file \fBand\fR the \fBMAILPATH\fR
+printing select lists.
+Select lists prints vertically until about two-thirds of
+.Ev LINES
+lines are filled.
+.It Sy MAIL
+If this variable is set to the name of a mail file
+.Em and
+the
+.Ev MAILPATH
variable is not set, then the shell informs the user of arrival of mail in the
specified file.
-.sp
-\fBMAIL\fR is not set by the shell. On some systems, \fBMAIL\fR is set by
-\fBlogin\fR(1).
-.RE
-
-.sp
-.ne 2
-.na
-\fBMAILCHECK\fR
-.ad
-.RS 14n
+.Pp
+.Ev MAIL
+is not set by the shell.
+On some systems,
+.Ev MAIL
+is set by
+.Xr login 1 .
+.It Sy MAILCHECK
Specifies how often in seconds the shell checks for changes in the modification
-time of any of the files specified by the \fBMAILPATH\fR or \fBMAIL\fR
-variables. The default value is \fB600\fR seconds. When the time has elapsed
-the shell checks before issuing the next prompt.
-.sp
-The shell specifies a default value to \fBMAILCHECK\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBMAILPATH\fR
-.ad
-.RS 14n
-A colon ( \fB:\fR ) separated list of file names. If this variable is set, then
-the shell informs the user of any modifications to the specified files that
-have occurred within the last \fBMAILCHECK\fR seconds. Each file name can be
-followed by a \fB?\fR and a message that is printed. The message undergoes
-parameter expansion, command substitution, and arithmetic substitution with the
-variable \fB$_\fR defined as the name of the file that has changed. The default
-message is \fByou have mail in $_\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBPATH\fR
-.ad
-.RS 14n
-The search path for commands. Except in \fB\&.profile\fR, users cannot change
-\fBPATH\fR if executing under \fBrksh93\fR. See the \fBExecution\fR section of
-this manual page.
-.sp
-The shell specifies a default value to \fBPATH\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBPS1\fR
-.ad
-.RS 14n
+time of any of the files specified by the
+.Ev MAILPATH
+or
+.Ev MAIL
+variables.
+The default value is
+.Sy 600
+seconds.
+When the time has elapsed the shell checks before issuing the next prompt.
+.Pp
+The shell specifies a default value to
+.Ev MAILCHECK .
+.It Sy MAILPATH
+A colon
+.Pq Sy \&:
+separated list of file names.
+If this variable is set, then the shell informs the user of any modifications
+to the specified files that have occurred within the last
+.Ev MAILCHECK
+seconds.
+Each file name can be followed by a
+.Sy \&?
+and a message that is printed.
+The message undergoes parameter expansion, command substitution, and arithmetic
+substitution with the variable
+.Sy $_
+defined as the name of the file that has changed.
+The default message is
+.Ql you have mail in $_ .
+.It Sy PATH
+The search path for commands.
+Except in
+.Pa .profile ,
+users cannot change
+.Ev PATH
+if executing under
+.Nm rksh93 .
+See the
+.Sx Execution section
+of this manual page.
+.Pp
+The shell specifies a default value to
+.Ev PATH .
+.It Sy PS1
The value of this variable is expanded for parameter expansion, command
substitution, and arithmetic substitution to define the primary prompt string
-which by default is \fB$\fR. The character \fB!\fR in the primary prompt string
-is replaced by the command number. Two successive occurrences of \fB!\fR
-produces a single \fB!\fR when the prompt string is printed. See the \fBCommand
-Re-entry\fR section of this manual page.
-.sp
-The shell specifies a default value to \fBPS1\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBPS2\fR
-.ad
-.RS 14n
-Secondary prompt string, by default, \fB>\fR.
-.sp
-The shell specifies a default value to \fBPS2\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBPS3\fR
-.ad
-.RS 14n
-Selection prompt string used within a select loop, by default \fB#?\fR.
-.sp
-The shell specifies a default value to \fBPS3\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBPS4\fR
-.ad
-.RS 14n
+which by default is
+.Sy $ .
+The character
+.Sy \&!
+in the primary prompt string is replaced by the command number.
+Two successive occurrences of
+.Sy \&!
+produces a single
+.Sy \&!
+when the prompt string is printed.
+See the
+.Sx Command Re-entry
+section of this manual page.
+.Pp
+The shell specifies a default value to
+.Ev PS1 .
+.It Sy PS2
+Secondary prompt string, by default,
+.Sy \&> .
+.Pp
+The shell specifies a default value to
+.Ev PS2 .
+.It Sy PS3
+Selection prompt string used within a select loop, by default
+.Sy \&\&#\&? .
+.Pp
+The shell specifies a default value to
+.Ev PS3 .
+.It Sy PS4
The value of this variable is expanded for parameter evaluation, command
substitution, and arithmetic substitution and precedes each line of an
-execution trace. By default, \fBPS4\fR is \fB+\fR. When \fBPS4\fR is unset, the
-execution trace prompt is also \fB+\fR .
-.sp
-The shell specifies a default value to \fBPS4\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBSHELL\fR
-.ad
-.RS 14n
-The pathname of the shell is kept in the environment. At invocation, if the
-basename of this variable is \fBrsh\fR, \fBrksh\fR, \fBrksh93\fR, or
-\fBkrsh\fR, the shell becomes restricted.
-.sp
-\fBSHELL\fR is not set by the shell. On some systems, \fBSHELL\fR is set by
-\fBlogin\fR(1).
-.RE
-
-.sp
-.ne 2
-.na
-\fBTIMEFORMAT\fR
-.ad
-.RS 14n
+execution trace.
+By default,
+.Ev PS4
+is
+.Sy \&+ .
+When
+.Ev PS4
+is unset, the execution trace prompt is also
+.Sy \&+ .
+.Pp
+The shell specifies a default value to
+.Ev PS4 .
+.It Sy SHELL
+The pathname of the shell is kept in the environment.
+At invocation, if the basename of this variable is
+.Sy rsh ,
+.Sy rksh ,
+.Sy rksh93 ,
+or
+.Sy krsh ,
+the shell becomes restricted.
+.Pp
+.Ev SHELL
+is not set by the shell.
+On some systems,
+.Ev SHELL
+is set by
+.Xr login 1 .
+.It Sy TIMEFORMAT
The value of this parameter is used as a format string specifying how the
-timing information for pipelines prefixed with the \fBtime\fR reserved word
-should be displayed. The \fB%\fR character introduces a format sequence that is
-expanded to a time value or other information.
-.sp
+timing information for pipelines prefixed with the
+.Ic time
+reserved word should be displayed.
+The
+.Sy \&%
+character introduces a format sequence that is expanded to a time value or
+other information.
+.Pp
The format sequences and their meanings are as follows.
-.sp
-.ne 2
-.na
-\fB%%\fR
-.ad
-.sp .6
-.RS 4n
-A literal \fB%\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fB%[\fIp\fR][l]R\fR
-.ad
-.sp .6
-.RS 4n
+.Bl -tag -width Ar
+.It Sy %%
+A literal
+.Sy % .
+.Sm off
+.It Sy % Oo Ar p Oc Oo Cm l Oc Cm R
The elapsed time in seconds.
-.RE
-
-.sp
-.ne 2
-.na
-\fB%[\fIp\fR][l]U\fR
-.ad
-.sp .6
-.RS 4n
+.It Sy % Oo Ar p Oc Oo Cm l Oc Cm U
The number of CPU seconds spent in user mode.
-.RE
-
-.sp
-.ne 2
-.na
-\fB%[\fIp\fR][l]S\fR
-.ad
-.sp .6
-.RS 4n
+.It Sy % Oo Ar p Oc Oo Cm l Oc Cm S
The number of CPU seconds spent in system mode.
-.RE
-
-.sp
-.ne 2
-.na
-\fB%P\fR
-.ad
-.sp .6
-.RS 4n
-The CPU percentage, computed as \fB(U + S) / R\fR.
-.RE
-
-The braces denote optional portions. The optional \fIp\fR is a digit specifying
-the \fIprecision\fR, the number of fractional digits after a decimal point. A
-value of \fB0\fR causes no decimal point or fraction to be output. At most
-three places after the decimal point can be displayed. Values of \fIp\fR
-greater than \fB3\fR are treated as \fB3\fR. If \fIp\fR is not specified, the
-value \fB3\fR is used.
-.sp
-The optional \fBl\fR specifies a longer format, including hours if greater than
-zero, minutes, and seconds of the form \fIHHhMMmSS.FFs\fR. The value of \fIp\fR
+.It Sy % Ns Cm P
+The CPU percentage, computed as
+.Sy (U + S) / R .
+.Sm on
+.El
+.Pp
+The braces denote optional portions.
+The optional
+.Ar p
+is a digit specifying
+the
+.Ar precision ,
+the number of fractional digits after a decimal point.
+A value of
+.Sy 0
+causes no decimal point or fraction to be output.
+At most three places after the decimal point can be displayed.
+Values of
+.Ar p
+greater than
+.Sy 3
+are treated as
+.Sy 3 .
+If
+.Ar p
+is not specified, the value
+.Sy 3
+is used.
+.Pp
+The optional
+.Cm l
+specifies a longer format, including hours if greater than zero, minutes, and
+seconds of the form
+.Em HHhMMmSS.FFs .
+The value of
+.Ar p
determines whether or not the fraction is included.
-.sp
+.Pp
All other characters are output without change and a trailing NEWLINE is added.
-If unset, the default value, \fB$'\enreal\et%2lR\enuser\et%2lU\ensys%2lS'\fR,
-is used. If the value is null, no timing information is displayed.
-.RE
-
-.sp
-.ne 2
-.na
-\fBTMOUT\fR
-.ad
-.RS 14n
-If set to a value greater than zero, \fBTMOUT\fR is the default time-out value
-for the \fBread\fR built-in command. The \fBselect\fR compound command
-terminates after \fBTMOUT\fR seconds when input is from a terminal. Otherwise,
-the shell terminates if a line is not entered within the prescribed number of
-seconds while reading from a terminal. The shell can be compiled with a maximum
-bound for this value which cannot be exceeded.
-.sp
-The shell specifies a default value to \fBTMOUT\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBVISUAL\fR
-.ad
-.RS 14n
-If the value of this variable matches the pattern \fB*[Vv][Ii]*\fR, then the
-\fBvi\fR option is turned on. See \fBSpecial Commands\fR. If the value matches
-the pattern \fB*gmacs*\fR , the \fBgmacs\fR option is turned on. If the value
-matches the pattern \fB*macs*\fR, then the \fBemacs\fR option is turned on. The
-value of \fBVISUAL\fR overrides the value of \fBEDITOR\fR.
-.RE
-
-.SS "Field Splitting"
+If unset, the default value:
+.Pp
+.Dl $'\enreal\et%2lR\enuser\et%2lU\ensys%2lS'
+.Pp
+is used.
+If the value is null, no timing information is displayed.
+.It Sy TMOUT
+If set to a value greater than zero,
+.Ev TMOUT
+is the default time-out value for the
+.Ic read
+built-in command.
+The
+.Ic select
+compound command terminates after
+.Ev TMOUT
+seconds when input is from a terminal.
+Otherwise, the shell terminates if a line is not entered within the prescribed
+number of seconds while reading from a terminal.
+The shell can be compiled with a maximum bound for this value which cannot be
+exceeded.
+.Pp
+The shell specifies a default value to
+.Ev TMOUT .
+.It Sy VISUAL
+If the value of this variable matches the pattern
+.Sy *[Vv][Ii]* ,
+then the
+.Sy vi
+option is turned on.
+See
+.Sx Special Commands .
+If the value matches the pattern
+.Sy *gmacs* ,
+the
+.Sy gmacs
+option is turned on.
+If the value matches the pattern
+.Sy *macs* ,
+then the
+.Sy emacs
+option is turned on.
+The value of
+.Ev VISUAL
+overrides the value of
+.Ev EDITOR .
+.El
+.Ss "Field Splitting"
After parameter expansion and command substitution, the results of
-substitutions are scanned for the field separator characters (those found in
-\fBIFS\fR) and split into distinct fields where such characters are found.
-Explicit null fields (\fB""\fR or \fB\&''\fR) are retained. Implicit null
-fields, those resulting from parameters that have no values or command
-substitutions with no output, are removed.
-.sp
-.LP
-If the \fBbraceexpand\fR (\fB-B\fR) option is set, each of the fields resulting
-from \fBIFS\fR are checked to see if they contain one or more of the brace
-patterns. Valid brace patterns: \fB{*\fR,\fB*}\fR,
-\fB{\fR\fIl1\fR\fB\&..\fR\fIl2\fR\fB}\fR ,
-\fB{\fR\fIn1\fR\fB\&..\fR\fIn2\fR\fB}\fR,
-\fB{\fR\fIn1\fR\fB\&..\fR\fIn2\fR\fB%\fR\fIfmt\fR\fB}
-{\fR\fIn1\fR\fB\&..\fR\fIn2\fR \fB\&..\fR\fIn3\fR\fB}\fR, or
-\fB{\fR\fIn1\fR\fB\&..\fR\fIn2\fR \fB\&..\fR\fIn3\fR\fB%\fR\fIfmt\fR\fB}\fR ,
-where \fB*\fR represents any character, \fIl1\fR,\fIl2\fR are letters and
-\fIn1\fR,\fIn2\fR,\fIn3\fR are signed numbers and \fIfmt\fR is a format
-specified as used by \fBprintf\fR. In each case, fields are created by
-prepending the characters before the \fB{\fR and appending the characters after
-the } to each of the strings generated by the characters between the \fB{\fR
-and \fB}\fR. The resulting fields are checked to see if they have any brace
-patterns.
-.sp
-.LP
-In the first form, a field is created for each string between \fB{\fR and
-\fB,,\fR between \fB,\fR and \fB,,\fR and between , and \fB}\fR. The string
-represented by \fB*\fR can contain embedded matching { and } without quoting.
-Otherwise, each \fB{\fR and \fB}\fR with \fB*\fR must be quoted.
-.sp
-.LP
-In the second form, \fIl1\fR and \fIl2\fR must both be either upper case or
-both be lower case characters in the C locale. In this case a field is created
-for each character from \fIl1\fR through \fIl2\fR.
-.sp
-.LP
+substitutions are scanned for the field separator characters
+.Pq those found in Ev IFS
+and split into distinct fields where such characters are found.
+Explicit null fields
+.Pq Sy "" or Sy \&''
+are retained.
+Implicit null fields, those resulting from parameters that have no values or
+command substitutions with no output, are removed.
+.Pp
+If the
+.Sy braceexpand
+.Pq Fl B
+option is set, each of the fields resulting from
+.Ev IFS
+are checked to see if they contain one or more of the brace patterns.
+Valid brace patterns are:
+.Pp
+.Bl -item -offset Ds -compact
+.Sm off
+.It
+.Brq Sy \&*,* Ns Oo Sy ,* Oc Ns No ...
+.It
+.Brq Ar l1 Sy \&.. Ar l2
+.It
+.Brq Ar n1 Sy \&.. Ar n2
+.It
+.Brq Ar n1 Sy \&.. Ar n2 Sy % Ar fmt
+.It
+.Brq Ar n1 Sy \&.. Ar n2 Sy \&.. Ar n3
+.It
+.Brq Ar n1 Sy \&.. Ar n2 Sy \&.. Ar n3 Sy % Ar fmt
+.Sm on
+.El
+.Pp
+where
+.Sy *
+represents any character,
+.Ar l1 ,
+.Ar l2
+are letters and
+.Ar n1 ,
+.Ar n2 ,
+.Ar n3
+are signed numbers and
+.Ar fmt
+is a format specified as used by
+.Ic printf .
+In each case, fields are created by prepending the characters before the
+.Sy {
+and appending the characters after
+the
+.Sy }
+to each of the strings generated by the characters between the
+.Sy {
+and
+.Sy } .
+The resulting fields are checked to see if they have any brace patterns.
+.Pp
+In the first form, a field is created for each string between
+.Sy {
+and the first comma
+.Pq Sq \&, ,
+between a pair of commas
+.Pq Sq \&,
+and between
+the last comma
+.Pq Sq \&,
+and the terminating
+.Sy } .
+The string
+represented by
+.Sy *
+can contain embedded matching { and } without quoting.
+Otherwise, each
+.Sy {
+and
+.Sy }
+within
+.Sy *
+must be quoted.
+.Pp
+In the second form,
+.Ar l1
+and
+.Ar l2
+must both be either upper case or both be lower case characters in the C
+locale.
+In this case a field is created for each character from
+.Ar l1
+to
+.Ar l2
+inclusive.
+.Pp
In the remaining forms, a field is created for each number starting at
-\fIn1\fR. This continues until it reaches \fIn2\fR and increments \fIn1\fR by
-\fIn3\fR. The cases where \fIn3\fR is not specified behave as if \fIn3\fR were
-1 if \fIn1\fR\fB<=\fR\fIn2\fR, and \fB-1\fR otherwise. In forms which specify
-\fB%\fR\fIfmt\fR, any format flags, widths and precisions can be specified and
-\fIfmt\fR can end in any of the specifiers \fBcdiouxX\fR. For example,
-\fB{a,z}{1..5..3%02d}{b..c}x\fR expands to the 8 fields, \fBa01bx, a01cx,
-a04bx, a04cx, z01bx, z01cx, z04bx,\fR and \fBz04cx\fR.
-.SS "File Name Generation"
-Following splitting, each field is scanned for the characters \fB*\fR, \fB?\fR,
-\fB(\fR, and \fB[\fR, unless the \fB-f\fR option has been set. If one of these
-characters appears, then the word is regarded as a pattern.
-.sp
-.LP
+.Ar n1 .
+This continues until it reaches
+.Ar n2
+and increments
+.Ar n1
+by
+.Ar n3 .
+The cases where
+.Ar n3
+is not specified behave as if
+.Ar n3
+were 1 if
+.Ar n1
+<=
+.Ar n2 ,
+and -1 otherwise.
+.Pp
+In forms which specify
+.Sy % Ns Ar fmt ,
+any format flags, widths and precisions can be specified and
+.Ar fmt
+can end in any of the specifiers
+.Sy cdiouxX .
+For example,
+.Sy {a,z}{1..5..3%02d}{b..c}x
+expands to the 8 fields,
+.Sy a01bx ,
+.Sy a01cx ,
+.Sy a04bx ,
+.Sy a04cx ,
+.Sy z01bx ,
+.Sy z01cx ,
+.Sy z04bx ,
+and
+.Sy z04cx .
+.Ss "File Name Generation"
+Following splitting, each field is scanned for the characters
+.Sy \&* ,
+.Sy \&? ,
+.Sy \&( ,
+and
+.Sy \&[ ,
+unless the
+.Fl f
+option has been set.
+If one of these characters appears, then the word is regarded as a pattern.
+.Pp
Each file name component that contains any pattern character is replaced with a
lexicographically sorted set of names that matches the pattern from that
-directory. If no file name is found that matches the pattern, then that
-component of the file name is left unchanged unless the pattern is prefixed
-with \fB~(N)\fR in which case it is removed. If \fBFIGNORE\fR is set, then each
-file name component that matches the pattern defined by the value of
-\fBFIGNORE\fR is ignored when generating the matching file names. The names
-\fB\&.\fR and \fB\&..\fR are also ignored. If \fBFIGNORE\fR is not set, the
-character \fB\&.\fR at the start of each file name component is ignored unless
-the first character of the pattern corresponding to this component is the
-character \fB\&.\fR itself. For other uses of pattern matching the \fB/\fR and
-\fB\&.\fR are not specially treated.
-.sp
-.ne 2
-.na
-\fB*\fR
-.ad
-.RS 11n
-Match any string, including the null string. When used for file name expansion,
-if the \fBglobstar\fR option is on, two adjacent \fB*\fRs by themselves match
-all files and zero or more directories and subdirectories. If the two adjacent
-\fB*\fRs are followed by a \fB/\fR, only directories and subdirectories match.
-.RE
-
-.sp
-.ne 2
-.na
-\fB?\fR
-.ad
-.RS 11n
+directory.
+If no file name is found that matches the pattern, then that component of the
+file name is left unchanged unless the pattern is prefixed with
+.Sy ~(N)
+in which case it is removed.
+If
+.Ev FIGNORE
+is set, then each file name component that matches the pattern defined by the
+value of
+.Ev FIGNORE
+is ignored when generating the matching file names.
+The names
+.Sy \&.
+and
+.Sy \&..
+are also ignored.
+If
+.Ev FIGNORE
+is not set, the character
+.Sy \&.
+at the start of each file name component is ignored unless the first character
+of the pattern corresponding to this component is the character
+.Sy \&.
+itself.
+For other uses of pattern matching the
+.Sy /
+and
+.Sy \&.
+are not specially treated.
+.Bl -tag -width Ds
+.It Sy *
+Match any string, including the null string.
+When used for file name expansion, if the
+.Sy globstar
+option is on, two adjacent
+.Sy * Ns No s
+by themselves match all files and zero or more directories and subdirectories.
+If the two adjacent
+.Sy * Ns No s
+are followed by a
+.Sy / ,
+only directories and subdirectories match.
+.It Sy \&?
Matches any single character.
-.RE
-
-.sp
-.ne 2
-.na
-\fB[\fB\&...\fR]\fR
-.ad
-.RS 11n
-Match any one of the enclosed characters. A pair of characters separated by
-\fB-\fR matches any character lexically between the pair, inclusive. If the
-first character following the opening \fB[\fR is a \fB!\fR or \fB^\fR, any
-character not enclosed is matched. A \fB-\fR can be included in the character
-set by putting it as the first or last character. Within \fB[\fR and \fB]\fR,
-character classes can be specified with the syntax \fB[:\fR\fIclass\fR\fB:]\fR
-where \fIclass\fR is one of the following classes defined in the \fBANSI-C\fR
+.It Sy [...]
+Match any one of the enclosed characters.
+A pair of characters separated by
+.Sy -
+matches any character lexically between the pair, inclusive.
+If the first character following the opening
+.Sy \&[
+is a
+.Sy \&!
+or
+.Sy ^ ,
+any character not enclosed is matched.
+A
+.Sy -
+can be included in the character set by putting it as the first or last
+character.
+Within
+.Sy \&[
+and
+.Sy \&] ,
+character classes can be specified with the syntax
+.Sy [: Ns Ar class Ns Sy \&:\&]
+where
+.Ar class
+is one of the following classes defined in the
+.Sy ANSI-C
standard:
-.sp
-.in +2
-.nf
-\fIalnum alpha blank cntrl digit graph
-lower print punct space upper
-word xdigit\fR
-.fi
-.in -2
-.sp
-
-\fIword\fR is equivalent to \fIalnum\fR plus the character \fB_\fR. Within
-\fB[\fR and \fB]\fR, an equivalence class can be specified with the syntax
-\fB[=\fR\fIc\fR\fB=]\fR which matches all characters with the same primary
-collation weight (as defined by the current locale) as the character \fIc\fR.
-Within \fB[\fR and \fB]\fR, [\fI\&.symbol.\fR] matches the collating symbol
-\fIsymbol\fR.
-.RE
-
-.sp
-.LP
-A \fIpattern-list\fR is a list of one or more patterns separated from each
-other with an \fB&\fR or \fB|\fR. An \fB&\fR signifies that all patterns must
-be matched whereas \fB|\fR requires that only one pattern be matched. Composite
-patterns can be formed with one or more of the following sub-patterns:
-.sp
-.ne 2
-.na
-\fB?(\fR\fIpattern-list\fR\fB)\fR
-.ad
-.RS 22n
+.Bl -column -offset indent xxxxxx xxxxxx xxxxxx xxxxxx xxxxxx xxxxxx
+.It alnum Ta alpha Ta blank Ta cntrl Ta digit Ta graph
+.It lower Ta print Ta punct Ta space Ta upper Ta word
+.It xdigit Ta Ta Ta Ta Ta
+.El
+.Pp
+.Ar word
+is equivalent to
+.Ar alnum
+plus the character
+.Sy _ .
+Within
+.Sy \&[
+and
+.Sy \&] ,
+an equivalence class can be specified with the syntax
+.Sy [= Ns Ar c Ns Sy =]
+which matches all characters with the same primary collation weight (as defined
+by the current locale) as the character
+.Ar c .
+Within
+.Sy \&[
+and
+.Sy \&] ,
+.Sm off
+.Sy \&[ \&. Ar symbol Ns \&. Sy \&]
+.Sm on
+matches the collating symbol
+.Ar symbol .
+.El
+.Pp
+A
+.Sy pattern-list
+is a list of one or more patterns separated from each other with an
+.Sy \&&
+or
+.Sy \&| .
+An
+.Sy \&&
+signifies that all patterns must be matched whereas
+.Sy \&|
+requires that only one pattern be matched.
+Composite patterns can be formed with one or more of the following
+sub-patterns:
+.Bl -tag -width xxxxxxxxxxxxxxxxxxxxx
+.Sm off
+.It Sy \&?( Ar pattern-list Sy \&)
Optionally matches any one of the specified patterns.
-.RE
-
-.sp
-.ne 2
-.na
-\fB*(\fR\fIpattern-list\fR\fB)\fR
-.ad
-.RS 22n
+.It Sy \&*( Ar pattern-list Sy \&)
Matches zero or more occurrences of the specified patterns.
-.RE
-
-.sp
-.ne 2
-.na
-\fB+(\fR\fIpattern-list\fR\fB)\fR
-.ad
-.RS 22n
+.It Sy \&+( Ar pattern-list Sy \&)
Matches one or more occurrences of the specified patterns.
-.RE
-
-.sp
-.ne 2
-.na
-\fB{\fR\fIn\fR\fB(\fR\fIpattern-list\fR\fB)\fR
-.ad
-.RS 22n
-Matches \fIn\fR occurrences of the specified patterns.
-.RE
-
-.sp
-.ne 2
-.na
-\fB{\fR\fIm\fR\fB,\fR\fIn\fR\fB(\fR\fIpattern-list\fR\fB)\fR
-.ad
-.RS 22n
-Matches from \fIm\fR to \fIn\fR occurrences of the specified patterns. If
-\fIm\fR is omitted, \fB0\fR is used. If \fIn\fR is omitted at least \fIm\fR
+.It Sy \&{ Ar n Sy \&} Sy \&( Ar pattern-list Sy \&)
+.Sm on
+Matches
+.Ar n
+occurrences of the specified patterns.
+.Sm off
+.It Sy \&{ Ar m Sy \&, Ar n Sy \&} Sy \&( Ar pattern-list Sy \&)
+.Sm on
+Matches from
+.Ar m
+to
+.Ar n
+occurrences of the specified patterns.
+If
+.Ar m
+is omitted,
+.Sy 0
+is used.
+If
+.Ar n
+is omitted at least
+.Ar m
occurrences are matched.
-.RE
-
-.sp
-.ne 2
-.na
-\fB@(\fR\fIpattern-list\fR\fB)\fR
-.ad
-.RS 22n
+.Sm off
+.It Sy \&@( Ar pattern-list Sy \&)
Matches exactly one of the specified patterns.
-.RE
-
-.sp
-.ne 2
-.na
-\fB!(\fR\fIpattern-list\fR\fB)\fR
-.ad
-.RS 22n
+.It Sy \&!( Ar pattern-list Sy \&)
Matches anything except one of the specified patterns.
-.RE
-
-.sp
-.LP
+.Sm on
+.El
+.Pp
By default, each pattern, or sub-pattern matches the longest string possible
-consistent with generating the longest overall match. If more than one match is
-possible, the one starting closest to the beginning of the string is chosen.
-However, for each of the compound patterns a \fB-\fR can be inserted in front
-of the \fB(\fR to cause the shortest match to the specified \fIpattern-list\fR
+consistent with generating the longest overall match.
+If more than one match is possible, the one starting closest to the beginning
+of the string is chosen.
+However, for each of the compound patterns a
+.Sy -
+can be inserted in front
+of the
+.Sy \&(
+to cause the shortest match to the specified
+.Ar pattern-list
to be used.
-.sp
-.LP
-When \fIpattern-list\fR is contained within parentheses, the backslash
-character \fB\e\fR is treated specially even when inside a character class. All
-\fBANSI-C\fR character escapes are recognized and match the specified
-character. In addition the following escape sequences are recognized:
-.sp
-.ne 2
-.na
-\fB\ed\fR
-.ad
-.RS 7n
+.Pp
+When
+.Sy pattern-list
+is contained within parentheses, the backslash
+character
+.Pq Sy \e
+is treated specially even when inside a character class.
+All
+.Sy ANSI-C
+character escapes are recognized and match the specified character.
+In addition the following escape sequences are recognized:
+.Bl -tag -width Ds
+.It Sy \ed
Matches any character in the digit class.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\eD\fR
-.ad
-.RS 7n
+.It Sy \eD
Matches any character not in the digit class.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\es\fR
-.ad
-.RS 7n
+.It Sy \es
Matches any character in the space class.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\eS\fR
-.ad
-.RS 7n
+.It Sy \eS
Matches any character not in the space class.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\ew\fR
-.ad
-.RS 7n
+.It Sy \ew
Matches any character in the word class.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\eW\fR
-.ad
-.RS 7n
+.It Sy \eW
Matches any character not in the word class.
-.RE
-
-.sp
-.LP
-A pattern of the form \fB%(\fR\fIpattern-pairs\fR\fB)\fR is a sub-pattern that
-can be used to match nested character expressions. Each \fIpattern-pair\fR is a
-two character sequence which cannot contain \fB&\fR or \fB|\fR. The first
-\fIpattern-pair\fR specifies the starting and ending characters for the match.
-Each subsequent \fIpattern-pair\fR represents the beginning and ending
-characters of a nested group that is skipped over when counting starting and
-ending character matches. The behavior is unspecified when the first character
-of a \fIpattern-pair\fR is alphanumeric except for the following:
-.sp
-.ne 2
-.na
-\fBD\fR
-.ad
-.RS 5n
+.El
+.Pp
+A pattern of the form
+.Sy %( Ns Ar pattern-pairs Ns Sy \&)
+is a sub-pattern that can be used to match nested character expressions.
+Each
+.Ar pattern-pair
+is a two character sequence which cannot contain
+.Sy \&&
+or
+.Sy \&| .
+The first
+.Ar pattern-pair
+specifies the starting and ending characters for the match.
+Each subsequent
+.Ar pattern-pair
+represents the beginning and ending characters of a nested group that is
+skipped over when counting starting and ending character matches.
+The behavior is unspecified when the first character of a
+.Ar pattern-pair
+is alphanumeric except for the following:
+.Bl -tag -width Ds
+.It Sy D
Causes the ending character to terminate the search for this pattern without
finding a match.
-.RE
-
-.sp
-.ne 2
-.na
-\fBE\fR
-.ad
-.RS 5n
+.It Sy E
Causes the ending character to be interpreted as an escape character.
-.RE
-
-.sp
-.ne 2
-.na
-\fBL\fR
-.ad
-.RS 5n
+.It Sy L
Causes the ending character to be interpreted as a quote character causing all
characters to be ignored when looking for a match.
-.RE
-
-.sp
-.ne 2
-.na
-\fBQ\fR
-.ad
-.RS 5n
+.It Sy Q
Causes the ending character to be interpreted as a quote character causing all
characters other than any escape character to be ignored when looking for a
match.
-.RE
-
-.sp
-.LP
-\fB%({}Q"E\e)\fR, matches characters starting at \fB{\fR until the matching
-\fB}\fR is found not counting any \fB{\fR or \fB}\fR that is inside a double
-quoted string or preceded by the escape character \fB\e\fR\&. Without the
-\fB{}\fR this pattern matches any C language string.
-.sp
-.LP
-Each sub-pattern in a composite pattern is numbered, starting at \fB1\fR, by
-the location of the \fB(\fR within the pattern. The sequence \fB\e\fR\fIn\fR,
-where \fIn\fR is a single digit and \fB\e\fR\fIn\fR comes after the \fIn\fRth.
+.El
+.Pp
+.Sy %({}Q"E\e) ,
+matches characters starting at
+.Sy {
+until the matching
+.Sy }
+is found not counting any
+.Sy {
+or
+.Sy }
+that is inside a double quoted string or preceded by the escape character
+.Pq Sy \e .
+Without the
+.Sy {}
+this pattern matches any C language string.
+.Pp
+Each sub-pattern in a composite pattern is numbered, starting at
+.Sy 1 ,
+by the location of the
+.Sy \&(
+within the pattern.
+The sequence
+.Sy \e Ns Ar n ,
+where
+.Ar n
+is a single digit and
+.Sy \e Ns Ar n ,
+comes after the
+.Ar n Ns No th
sub-pattern, matches the same string as the sub-pattern itself.
-.sp
-.LP
+.Pp
A pattern can contain sub-patterns of the form
-\fB~(\fR\fIoptions\fR\fB:\fR\fIpattern-list\fR\fB)\fR, where either
-\fIoptions\fR or \fB:\fR\fIpattern-list\fR can be omitted. Unlike the other
-compound patterns, these sub-patterns are not counted in the numbered
-sub-patterns. \fB:\fR\fIpattern-list\fR must be omitted for options
-\fBF, G, N\fR and \fBV\fR below.
-If \fIoptions\fR is present, it can consist of one or more of the
-following:
-.sp
-.ne 2
-.na
-\fB+\fR
-.ad
-.RS 5n
-Enable the following options. This is the default.
-.RE
-
-.sp
-.ne 2
-.na
-\fB-\fR
-.ad
-.RS 5n
+.Sm off
+.Sy ~( Ar options Sy \&: Ar pattern-list Sy \&) ,
+.Sm on
+where either
+.Ar options
+or
+.Sy \&: Ns Ar pattern-list
+can be omitted.
+Unlike the other compound patterns, these sub-patterns are not counted in the
+numbered sub-patterns.
+.Sy \&: Ns Ar pattern-list
+must be omitted for options
+.Sy F ,
+.Sy G ,
+.Sy N
+and
+.Sy V
+below.
+If
+.Ar options
+is present, it can consist of one or more of the following:
+.Bl -tag -width Ds
+.It Sy +
+Enable the following options.
+This is the default.
+.It Sy -
Disable the following options.
-.RE
-
-.sp
-.ne 2
-.na
-\fBE\fR
-.ad
-.RS 5n
+.It Sy E
The remainder of the pattern uses extended regular expression syntax like the
-\fBegrep\fR(1) command.
-.RE
-
-.sp
-.ne 2
-.na
-\fBF\fR
-.ad
-.RS 5n
-The remainder of the pattern uses \fBfgrep\fR(1) expression syntax.
-.RE
-
-.sp
-.ne 2
-.na
-\fBg\fR
-.ad
-.RS 5n
+.Xr egrep 1
+command.
+.It Sy F
+The remainder of the pattern uses
+.Xr fgrep 1
+expression syntax.
+.It Sy g
File the longest match (greedy).
-.sp
This is the default.
-.RE
-
-.sp
-.ne 2
-.na
-\fBG\fR
-.ad
-.RS 5n
+.It Sy G
The remainder of the pattern uses basic regular expression syntax like the
-\fBgrep\fR(1) command.
-.RE
-
-.sp
-.ne 2
-.na
-\fBi\fR
-.ad
-.RS 5n
+.Xr grep 1
+command.
+.It Sy i
Treat the match as case insensitive.
-.RE
-
-.sp
-.ne 2
-.na
-\fBK\fR
-.ad
-.RS 5n
+.It Sy K
The remainder of the pattern uses shell pattern syntax.
-.sp
This is the default.
-.RE
-
-.sp
-.ne 2
-.na
-\fBl\fR
-.ad
-.RS 5n
+.It Sy l
Left anchor the pattern.
-.sp
-This is the default for \fBK\fR style patterns.
-.RE
-
-.sp
-.ne 2
-.na
-\fBN\fR
-.ad
-.RS 5n
-This is ignored. However, when it is the first letter and is used with file
-name generation, and no matches occur, the file pattern expands to the empty
-string.
-.RE
-
-.sp
-.ne 2
-.na
-\fBr\fR
-.ad
-.RS 5n
+.Pp
+This is the default for
+.Sy K
+style patterns.
+.It Sy N
+This is ignored.
+However, when it is the first letter and is used with file name generation, and
+no matches occur, the file pattern expands to the empty string.
+.It Sy r
Right anchor the pattern.
-.sp
-This is the default for \fBK\fR style patterns.
-.RE
-
-.sp
-.ne 2
-.na
-\fBX\fR
-.ad
-.RS 5n
+.Pp
+This is the default for
+.Sy K
+style patterns.
+.It Sy X
The remainder of the pattern uses augmented regular expression syntax.
-.RE
-
-.sp
-.ne 2
-.na
-\fBP\fR
-.ad
-.RS 5n
-The remainder of the pattern uses \fIperl\fR(1) regular expression syntax. Not
-all perl regular expression syntax is currently implemented.
-.RE
-
-.sp
-.ne 2
-.na
-\fBV\fR
-.ad
-.RS 5n
+.It Sy P
+The remainder of the pattern uses
+.Xr perl 1
+regular expression syntax.
+Not all perl regular expression syntax is currently implemented.
+.It Sy V
The remainder of the pattern uses System V regular expression syntax.
-.RE
-
-.sp
-.LP
-If both \fIoptions\fR and \fB:\fR\fIpattern-list\fR are specified, then the
-options apply only to \fIpattern-list\fR. Otherwise, these options remain in
-effect until they are disabled by a subsequent \fB~(...)\fR or at the end of
-the sub-pattern containing \fB~(...)\fR.
-.SS "Quoting"
-Each of the metacharacters listed in the \fBDefinitions\fR section of this
-manual page has a special meaning to the shell and causes termination of a word
-unless quoted. A character can be quoted, that is, made to stand for itself, by
-preceding it with a backslash (\fB\e\fR). The pair \fB\e\fRNEWLINE is removed.
-All characters enclosed between a pair of single quote marks (\fB\&''\fR) that
-is not preceded by a \fB$\fR are quoted. A single quote cannot appear within
-the single quotes. A single quoted string preceded by an unquoted \fB$\fR is
-processed as an \fBANSI-C\fR string except for the following:
-.sp
-.ne 2
-.na
-\fB\e0\fR
-.ad
-.RS 19n
+.El
+.Pp
+If both
+.Ar options
+and
+.Sy \&: Ns Ar pattern-list
+are specified, then the options apply only to
+.Ar pattern-list .
+Otherwise, these options remain in effect until they are disabled by a
+subsequent
+.Sy ~(...)
+or at the end of
+the sub-pattern containing
+.Sy ~(...) .
+.Ss "Quoting"
+Each of the metacharacters listed in the
+.Sx Definitions
+section of this manual page has a special meaning to the shell and causes
+termination of a word unless quoted.
+A character can be quoted, that is, made to stand for itself, by preceding it
+with a backslash
+.Pq Sy \e .
+The pair
+.Sy \eNEWLINE
+is removed.
+All characters enclosed between a pair of single quote marks
+.Pq Sy ''
+that is not preceded by a
+.Sy $
+are quoted.
+A single quote cannot appear within the single quotes.
+A single quoted string preceded by an unquoted
+.Sy $
+is processed as an
+.Sy ANSI-C
+string except for the following:
+.Bl -tag -width Ar
+.It Sy \e0
Causes the remainder of the string to be ignored.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\ec\fR\fIx\fR
-.ad
-.RS 19n
-Expands to the character CTRL-x.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\eC\fR[\fB\&.\fR\fIname\fR\fB\&.\fR]\fR
-.ad
-.RS 19n
-Expands to the collating element \fIname\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\ee\fR
-.ad
-.RS 19n
-Equivalent to the escape character (\fBASCII\fR 033),
-.RE
-
-.sp
-.ne 2
-.na
-\fB\eE\fR
-.ad
-.RS 19n
-Equivalent to the escape character (\fBASCII\fR 033),
-.RE
-
-.sp
-.LP
-Inside double quote marks (\fB""\fR), parameter and command substitution occur
-and \fB\e\fR quotes the characters \fB\e\fR, \fB`\fR, \fB"\fR, and \fB$\fR. A
-\fB$\fR in front of a double quoted string is ignored in the \fBC\fR or
-\fBPOSIX\fR locale, and might cause the string to be replaced by a locale
-specific string otherwise. The meaning of \fB$*\fR and \fB$@\fR is identical
-when not quoted or when used as a variable assignment value or as a file name.
-However, when used as a command argument, \fB"$*"\fR is equivalent to
-\fB"$1\fId\fR$2\fId\fR..."\fR, where \fId\fR is the first character of the IFS
-variable, whereas \fB"$@"\fR is equivalent to \fB"$1" "$2" ....\fR Inside grave
-quote marks (\fB``\fR), \fB\\\fR quotes the characters \fB\e\fR, \fB`\fR, and
-\fB$\fR. If the grave quotes occur within double quotes, then \fB\e\fR also
-quotes the character \fB"\fR.
-.sp
-.LP
+.It Sy \ec Ns Ar x
+Expands to the character
+.No CTRL- Ns Ar x .
+.It Sy \eC[\&. Ns Ar name Ns Sy \&.\&]
+Expands to the collating element
+.Ar name .
+.It Sy \ee
+Equivalent to the escape character
+.Pq ASCII 033 .
+.It Sy \eE
+Equivalent to the escape character
+.Pq ASCII 033 .
+.El
+.Pp
+Inside double quote marks
+.Pq Sy \&"" ,
+parameter and command substitution occur and
+.Sy \e
+quotes the characters
+.Sy \e ,
+.Sy \&` ,
+.Sy \&" ,
+and
+.Sy \&$ .
+A
+.Sy \&$
+in front of a double quoted string is ignored in the
+.Dv C
+or
+.Dv POSIX
+locale, and might cause the string to be replaced by a locale specific string
+otherwise.
+The meaning of
+.Sy $*
+and
+.Sy $@
+is identical when not quoted or when used as a variable assignment value or as
+a file name.
+However, when used as a command argument,
+.Sy \&"$*"
+is equivalent to
+.Sm off
+.Sy \&"$1 Ar d Sy $2 Ar d No ..." ,
+.Sm on
+where
+.Ar d
+is the first character of the
+.Ev IFS
+variable, whereas
+.Sy \&"$@"
+is equivalent to
+.Sy \&"$1" \&"$2" No ...
+Inside grave quote marks
+.Pq Sy `` ,
+.Sy \e
+quotes the characters
+.Sy \e ,
+.Sy ` ,
+and
+.Sy $ .
+If the grave quotes occur within double quotes, then
+.Sy \e
+also quotes the character
+.Sy \&" .
+.Pp
The special meaning of reserved words or aliases can be removed by quoting any
-character of the reserved word. The recognition of function names or built-in
-command names cannot be altered by quoting them.
-.SS "Arithmetic Evaluation"
+character of the reserved word.
+The recognition of function names or built-in command names cannot be altered
+by quoting them.
+.Ss "Arithmetic Evaluation"
The shell performs arithmetic evaluation for arithmetic substitution, to
evaluate an arithmetic command, to evaluate an indexed array subscript, and to
-evaluate arguments to the built-in commands \fBshift\fR and \fBlet\fR.
+evaluate arguments to the built-in commands
+.Ic shift
+and
+.Ic let .
Arithmetic evaluation is also performed on argument operands of the built-in
-command printf that correspond to numeric format specifiers in the format
-operand. See \fBprintf\fR(1). Evaluations are performed using double precision
-floating point arithmetic or long double precision floating point for systems
-that provide this data type. Floating point constants follow the \fBANSI-C\fR
-programming language floating point conventions. The floating point constants
-\fBNan\fR and \fBInf\fR can be used to represent "not a number" and
-infinity respectively. Integer constants follow the \fBANSI-C\fR programming
-language integer constant conventions although only single byte character
-constants are recognized and character casts are not recognized. Constants can
-be of the form \fB[\fR\fIbase#\fR\fB]\fR\fIn\fR where \fIbase\fR is a decimal
-number between two and sixty-four representing the arithmetic base and \fIn\fR
-is a number in that base. The digits greater than \fB9\fR are represented by
-the lower case letters, the upper case letters, \fB@\fR, and \fB_\fR
-respectively. For bases less than or equal to \fB36\fR, upper and lower case
-characters can be used interchangeably.
-.sp
-.LP
+command
+.Ic printf
+that correspond to numeric format specifiers in the format operand.
+See
+.Xr printf 1 .
+Evaluations are performed using double precision floating point arithmetic or
+long double precision floating point for systems that provide this data type.
+Floating point constants follow the
+.Sy ANSI-C
+programming language floating point conventions.
+The floating point constants
+.Dv Nan
+and
+.Dv Inf
+can be used to represent "not a number" and infinity respectively.
+Integer constants follow the
+.Sy ANSI-C
+programming language integer constant conventions although only single byte
+character constants are recognized and character casts are not recognized.
+Constants can be of the form
+.Oo Ar base Ns No \&# Oc Ns Ar n
+where
+.Ar base
+is a decimal number between two and sixty-four representing the arithmetic base
+and
+.Ar n
+is a number in that base.
+The digits greater than
+.Sy 9
+are represented by the lower case letters, the upper case letters,
+.Sy @ ,
+and
+.Sy _
+respectively.
+For bases less than or equal to
+.Sy 36 ,
+upper and lower case characters can be used interchangeably.
+.Pp
An arithmetic expression uses the same syntax, precedence, and associativity of
-expression as the C language. All the C language operators that apply to
-floating point quantities can be used. In addition, the operator \fB**\fR can
-be used for exponentiation. It has higher precedence than multiplication and is
-left associative. When the value of an arithmetic variable or subexpression can
-be represented as a long integer, all C language integer arithmetic operations
-can be performed. Variables can be referenced by name within an arithmetic
-expression without using the parameter expansion syntax. When a variable is
-referenced, its value is evaluated as an arithmetic expression.
-.sp
-.LP
+expression as the C language.
+All the C language operators that apply to floating point quantities can be
+used.
+In addition, the operator
+.Sy **
+can be used for exponentiation.
+It has higher precedence than multiplication and is left associative.
+When the value of an arithmetic variable or subexpression can be represented as
+a long integer, all C language integer arithmetic operations can be performed.
+Variables can be referenced by name within an arithmetic expression without
+using the parameter expansion syntax.
+When a variable is referenced, its value is evaluated as an arithmetic
+expression.
+.Pp
Any of the following math library functions that are in the C math library can
be used within an arithmetic expression:
-.sp
-.in +2
-.nf
-rint round sin sinh sqrt tan tanh tgamma trunc abs acos
-acosh asin asinh atan atan2 atanh cbrt ceil copysign cos
-cosh erf erfc exp exp2 expm1 fabs fpclassify fdim finite
-floor fma fmax fmin fmod hypot ilogb int isfinite sinf isnan
-isnormal issubnormal issubor- dered iszero j0 j1 jn lgamma
-log log10 log2 logb nearbyint nextafter nexttoward pow
-remainder rint round scanb signbit sin sinh sqrt tan tanh
-tgamma trunc y0 y1 yn
-.fi
-.in -2
-.sp
-
-.sp
-.LP
+.Pp
+.Bl -inset -offset Ds -compact
+.It rint round sin sinh sqrt tan tanh tgamma trunc abs
+.It acos acosh asin asinh atan atan2 atanh cbrt ceil copysign
+.It cos cosh erf erfc exp exp2 expm1 fabs fpclassify fdim
+.It finite floor fma fmax fmin fmod hypot ilogb int isfinite
+.It sinf isnan isnormal issubnormal issubordered iszero j0
+.It j1 jn lgamma log log10 log2 logb nearbyint nextafter
+.It nexttoward pow remainder rint round scanb signbit sin sinh
+.It sqrt tan tanh tgamma trunc y0 y1 yn
+.El
+.Pp
In addition, arithmetic functions can be defined as shell functions with a
-variant of the \fBfunction\fR \fIname\fR syntax:
-
-\fBfunction .sh.math.\fR\fIname\fR \fIident\fR ... \fB{\fR \fIlist\fR \fB;}\fR
-.RS 5
-where \fIname\fR is the function name used in the arithmetic expression and
-each identified \fIident\fR is a name reference to the long double precision
-floating point argument. The value of \fB.sh.value\fR when the function returns
-is the value of this function. User defined functions can take up to 3
-arguments and override C math library functions.
-.RE
-
-.sp
-.LP
-An internal representation of a \fIvariable\fR as a double precision floating
-point can be specified with the \fB-E [\fR\fIn\fR\fB]\fR, \fB-F
-[\fR\fIn\fR\fB]\fR, or \fB-X [\fR\fIn\fR\fB]\fR options of the \fBtypeset\fR
-special built-in command. The
-\fB-E\fR option causes the expansion of the value to be represented using
-scientific notation when it is expanded. The optional option argument \fIn\fR
-defines the number of significant figures. The \fB-F\fR option causes the
-expansion to be represented as a floating decimal number when it is expanded.
-The optional option argument \fIn\fR defines the number of places after the
-decimal point in this case. The \fB-X\fR option causes the expansion to be
-represented using the \fB%a\fR format defined by ISO C-99. The optional option
-argument n defines the number of places after the decimal (or radix) point in
-this case.
-
-.sp
-.LP
-An internal integer representation of a \fIvariable\fR can be specified with
-the \fB-i\fR \fB[\fR\fIn\fR\fB]\fR option of the \fBtypeset\fR special built-in
-command. The optional option argument \fIn\fR specifies an arithmetic base to
-be used when expanding the variable. If you do not specify an arithmetic base,
-base 10 is used.
-.sp
-.LP
+variant of the
+.Ic function Ar name
+syntax:
+.Bd -ragged -offset Ds
+.Sy function .sh.math\&. Ns Ar name Ar ident Sy { Ar list Sy ;}
+.Ed
+.Pp
+where
+.Ar name
+is the function name used in the arithmetic expression and each identified
+.Ar ident
+is a name reference to the long double precision floating point argument.
+The value of
+.Sy .sh.value
+when the function returns is the value of this function.
+User defined functions can take up to 3 arguments and override C math library
+functions.
+.Pp
+An internal representation of a
+.Ar variable
+as a double precision floating point can be specified with the
+.Fl E Ns Op Ar n ,
+.Fl F Ns Op Ar n ,
+or
+.Fl X Ns Op Ar n
+options of the
+.Ic typeset
+special built-in command.
+The
+.Fl E
+option causes the expansion of the value to be represented using scientific
+notation when it is expanded.
+The optional option argument
+.Ar n
+defines the number of significant figures.
+The
+.Fl F
+option causes the expansion to be represented as a floating decimal number when
+it is expanded.
+The optional option argument
+.Ar n
+defines the number of places after the decimal point in this case.
+The
+.Fl X
+option causes the expansion to be represented using the
+.Sy %a
+format defined by ISO C-99.
+The optional option argument n defines the number of places after the decimal
+(or radix) point in this case.
+.Pp
+An internal integer representation of a
+.Ar variable
+can be specified with
+the
+.Fl i Ns Op Ar n
+option of the
+.Ic typeset
+special built-in command.
+The optional option argument
+.Ar n
+specifies an arithmetic base to be used when expanding the variable.
+If you do not specify an arithmetic base, base 10 is used.
+.Pp
Arithmetic evaluation is performed on the value of each assignment to a
-variable with the \fB-E\fR, \fB-F\fR, \fB-X\fR or \fB-i\fR option. Assigning a
-floating point number to a variable whose type is an integer causes the
-fractional part to be truncated.
-.SS "Prompting"
-When used interactively, the shell prompts with the value of \fBPS1\fR after
-expanding it for parameter expansion, command substitution, and arithmetic
-substitution, before reading a command. In addition, each single \fB!\fR in the
-prompt is replaced by the command number. A \fB!!\fR is required to place
-\fB!\fR in the prompt. If at any time a NEWLINE is typed and further input is
-needed to complete a command, then the secondary prompt, that is, the value of
-\fBPS2\fR, is issued.
-.SS "Conditional Expressions"
-A \fBconditional expression\fR is used with the \fB[[\fR compound command to
-test attributes of files and to compare strings. Field splitting and file name
-generation are not performed on the words between \fB[[\fR and \fB]]\fR.
-.sp
-.LP
+variable with the
+.Fl E ,
+.Fl F ,
+.Fl X
+or
+.Fl i
+option.
+Assigning a floating point number to a variable whose type is an integer causes
+the fractional part to be truncated.
+.Ss "Prompting"
+When used interactively, the shell prompts with the value of
+.Ev PS1
+after expanding it for parameter expansion, command substitution, and
+arithmetic substitution, before reading a command.
+In addition, each single
+.Sy \&!
+in the prompt is replaced by the command number.
+A
+.Sy \&!\&!
+is required to place a literal
+.Sy \&!
+in the prompt.
+If at any time a NEWLINE is typed and further input is needed to complete a
+command, then the secondary prompt, that is, the value of
+.Ev PS2 ,
+is issued.
+.Ss "Conditional Expressions"
+A
+.Sy conditional expression
+is used with the
+.Sy [[
+compound command to test attributes of files and to compare strings.
+Field splitting and file name generation are not performed on the words between
+.Sy [[
+and
+.Sy ]] .
+.Pp
Each expression can be constructed from one or more of the following unary or
binary expressions:
-.sp
-.ne 2
-.na
-\fB-a\fR \fIfile\fR
-.ad
-.RS 21n
-True, if \fIfile\fR exists.
-.sp
-This option is the same as \fB-e\fR. This option is obsolete.
-.RE
-
-.sp
-.ne 2
-.na
-\fB-b\fR \fIfile\fR
-.ad
-.RS 21n
-True, if \fIfile\fR exists and is a block special file.
-.RE
-
-.sp
-.ne 2
-.na
-\fB-c\fR \fIfile\fR
-.ad
-.RS 21n
-True, if \fIfile\fR exists and is a character special file.
-.RE
-
-.sp
-.ne 2
-.na
-\fB-d\fR \fIfile\fR
-.ad
-.RS 21n
-True, if \fIfile\fR exists and is a directory.
-.RE
-
-.sp
-.ne 2
-.na
-\fB-e\fR \fIfile\fR
-.ad
-.RS 21n
-True, if \fIfile\fR exists.
-.RE
-
-.sp
-.ne 2
-.na
-\fB-f\fR \fIfile\fR
-.ad
-.RS 21n
-True, if \fIfile\fR exists and is an ordinary file.
-.RE
-
-.sp
-.ne 2
-.na
-\fB-g\fR \fIfile\fR
-.ad
-.RS 21n
-True, if \fIfile\fR exists and it has its \fBsetgid\fR bit set.
-.RE
-
-.sp
-.ne 2
-.na
-\fB-G\fR \fIfile\fR
-.ad
-.RS 21n
-True, if \fIfile\fR exists and its group matches the effective group id of this
-process.
-.RE
-
-.sp
-.ne 2
-.na
-\fB-h\fR \fIfile\fR
-.ad
-.RS 21n
-True, if \fIfile\fR exists and is a symbolic link.
-.RE
-
-.sp
-.ne 2
-.na
-\fB-k\fR \fIfile\fR
-.ad
-.RS 21n
-True, if \fIfile\fR exists and it has its sticky bit set.
-.RE
-
-.sp
-.ne 2
-.na
-\fB-L\fR \fIfile\fR
-.ad
-.RS 21n
-True, if \fIfile\fR exists and is a symbolic link.
-.RE
-
-.sp
-.ne 2
-.na
-\fB-n\fR \fIstring\fR
-.ad
-.RS 21n
-True, if length of \fIstring\fR is \fBnon-zero\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fB-N\fR \fIfile\fR
-.ad
-.RS 21n
-True, if \fIfile\fR exists and the modification time is greater than the last
+.Bl -tag -width Ar
+.It Fl a Ar file
+True, if
+.Ar file
+exists.
+.Pp
+This option is the same as
+.Fl e .
+This option is obsolete.
+.It Fl b Ar file
+True, if
+.Ar file
+exists and is a block special file.
+.It Fl c Ar file
+True, if
+.Ar file
+exists and is a character special file.
+.It Fl d Ar file
+True, if
+.Ar file
+exists and is a directory.
+.It Fl e Ar file
+True, if
+.Ar file
+exists.
+.It Fl f Ar file
+True, if
+.Ar file
+exists and is an ordinary file.
+.It Fl g Ar file
+True, if
+.Ar file
+exists and it has its
+.Sy setgid
+bit set.
+.It Fl G Ar file
+True, if
+.Ar file
+exists and its group matches the effective group id of this process.
+.It Fl h Ar file
+True, if
+.Ar file
+exists and is a symbolic link.
+.It Fl k Ar file
+True, if
+.Ar file
+exists and it has its sticky bit set.
+.It Fl L Ar file
+True, if
+.Ar file
+exists and is a symbolic link.
+.It Fl n Ar string
+True, if length of
+.Ar string
+is
+.Sy non-zero .
+.It Fl N Ar file
+True, if
+.Ar file
+exists and the modification time is greater than the last
access time.
-.RE
-
-.sp
-.ne 2
-.na
-\fB-o\fR \fIoption\fR
-.ad
-.RS 21n
-True, if option named \fIoption\fR is on.
-.RE
-
-.sp
-.ne 2
-.na
-\fB-o\fR \fI?option\fR
-.ad
-.RS 21n
-True, if option named \fIoption\fR is a valid option name.
-.RE
-
-.sp
-.ne 2
-.na
-\fB-O\fR \fIfile\fR
-.ad
-.RS 21n
-True, if \fIfile\fR exists and is owned by the effective user id of this
-process.
-.RE
-
-.sp
-.ne 2
-.na
-\fB-p\fR \fIfile\fR
-.ad
-.RS 21n
-True, if \fIfile\fR exists and is a \fBFIFO\fR special file or a pipe.
-.RE
-
-.sp
-.ne 2
-.na
-\fB-r\fR \fIfile\fR
-.ad
-.RS 21n
-True, if \fIfile\fR exists and is readable by current process.
-.RE
-
-.sp
-.ne 2
-.na
-\fB-R\fR \fIname\fR
-.ad
-.RS 21n
-True if variable \fIname\fR is a name reference.
-.RE
-
-.sp
-.ne 2
-.na
-\fB-s\fR \fIfile\fR
-.ad
-.RS 21n
-True, if \fIfile\fR exists and has size greater than zero.
-.RE
-
-.sp
-.ne 2
-.na
-\fB-S\fR \fIfile\fR
-.ad
-.RS 21n
-True, if \fIfile\fR exists and is a socket.
-.RE
-
-.sp
-.ne 2
-.na
-\fB-t\fR \fIfildes\fR
-.ad
-.RS 21n
-True, if file descriptor number \fIfildes\fR is open and associated with a
-terminal device.
-.RE
-
-.sp
-.ne 2
-.na
-\fB-u\fR \fIfile\fR
-.ad
-.RS 21n
-True, if \fIfile\fR exists and it has its \fBsetuid\fR bit set.
-.RE
-
-.sp
-.ne 2
-.na
-\fB-v\fR \fIname\fR
-.ad
-.RS 21n
-True, if variable \fIname\fR is a valid variable name and is set.
-.RE
-
-.sp
-.ne 2
-.na
-\fB-w\fR \fIfile\fR
-.ad
-.RS 21n
-True, if \fIfile\fR exists and is writable by current process.
-.RE
-
-.sp
-.ne 2
-.na
-\fB-x\fR \fIfile\fR
-.ad
-.RS 21n
-True, if \fIfile\fR exists and is executable by current process. If \fIfile\fR
+.It Fl o Ar option
+True, if option named
+.Ar option
+is on.
+.It Fl o Sy \&? Ns Ar option
+True, if option named
+.Ar option
+is a valid option name.
+.It Fl O Ar file
+True, if
+.Ar file
+exists and is owned by the effective user id of this process.
+.It Fl p Ar file
+True, if
+.Ar file
+exists and is a
+.Sy FIFO
+special file or a pipe.
+.It Fl r Ar file
+True, if
+.Ar file
+exists and is readable by current process.
+.It Fl R Ar name
+True if variable
+.Ar name
+is a name reference.
+.It Fl s Ar file
+True, if
+.Ar file
+exists and has size greater than zero.
+.It Fl S Ar file
+True, if
+.Ar file
+exists and is a socket.
+.It Fl t Ar fildes
+True, if file descriptor number
+.Ar fildes
+is open and associated with a terminal device.
+.It Fl u Ar file
+True, if
+.Ar file
+exists and it has its
+.Sy setuid
+bit set.
+.It Fl v Ar name
+True, if variable
+.Ar name
+is a valid variable name and is set.
+.It Fl w Ar file
+True, if
+.Ar file
+exists and is writable by current process.
+.It Fl x Ar file
+True, if
+.Ar file
+exists and is executable by current process.
+If
+.Ar file
exists and is a directory, then true if the current process has permission to
search in the directory.
-.RE
-
-.sp
-.ne 2
-.na
-\fB-z\fR \fIstring\fR
-.ad
-.RS 21n
-True, if length of \fIstring\fR is zero.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fIfile1\fR \fB-ef\fR \fIfile2\fR
-.ad
-.RS 21n
-True, if \fIfile1\fR and \fIfile2\fR exist and refer to the same file.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fIfile1\fR \fB-nt\fR \fIfile2\fR
-.ad
-.RS 21n
-True, if \fIfile1\fR exists and \fIfile2\fR does not, or \fIfile1\fR is newer
-than \fIfile2\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fIfile1\fR \fB-ot\fR \fIfile2\fR
-.ad
-.RS 21n
-True, if \fIfile2\fR exists and \fIfile1\fR does not, or \fIfile1\fR is older
-than \fIfile2\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fIstring\fR
-.ad
-.RS 21n
-True, if \fIstring\fR is not null.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fIstring\fR \fB==\fR \fIpattern\fR
-.ad
-.RS 21n
-True, if \fIstring\fR matches \fIpattern\fR. Any part of \fIpattern\fR can be
-quoted to cause it to be matched as a string. With a successful match to
-\fIpattern\fR, the \fB\&.sh.match\fR array variable contains the match and
-sub-pattern matches.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fIstring\fR \fB=\fR \fIpattern\fR
-.ad
-.RS 21n
-Same as \fB==\fR, but is obsolete.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fIstring\fR \fB!=\fR \fIpattern\fR
-.ad
-.RS 21n
-True, if \fIstring\fR does not match \fIpattern\fR. When the \fIstring\fR
-matches the \fIpattern\fR the \fB\&.sh.match\fR array variable contains the
-match and sub-pattern matches.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fIstring\fR \fB=~\fR \fIere\fR
-.ad
-.RS 21n
-True if \fIstring\fR matches the pattern \fB~(E)\fR\fIere\fR where \fIere\fR is
-an extended regular expression.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fIstring1\fR \fB<\fR \fIstring2\fR
-.ad
-.RS 21n
-True, if \fIstring1\fR comes before \fIstring2\fR based on \fBASCII\fR value of
-their characters.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fIstring1\fR \fB>\fR \fIstring2\fR
-.ad
-.RS 21n
-True, if \fIstring1\fR comes after \fIstring2\fR based on \fBASCII\fR value of
+.It Fl z Ar string
+True, if length of
+.Ar string
+is zero.
+.It Ar file1 Fl ef Ar file2
+True, if
+.Ar file1
+and
+.Ar file2
+exist and refer to the same file.
+.It Ar file1 Fl nt Ar file2
+True, if
+.Ar file1
+exists and
+.Ar file2
+does not, or
+.Ar file1
+is newer
+than
+.Ar file2 .
+.It Ar file1 Fl ot Ar file2
+True, if
+.Ar file2
+exists and
+.Ar file1
+does not, or
+.Ar file1
+is older
+than
+.Ar file2 .
+.It Ar string
+True, if
+.Ar string
+is not null.
+.It Ar string Sy == Ar pattern
+True, if
+.Ar string
+matches
+.Ar pattern .
+Any part of
+.Ar pattern
+can be quoted to cause it to be matched as a string.
+With a successful match to
+.Ar pattern , the
+.Ev \&.sh.match
+array variable contains the match and sub-pattern matches.
+.It Ar string Sy = Ar pattern
+Same as
+.Sy == ,
+but is obsolete.
+.It Ar string Sy != Ar pattern
+True, if
+.Ar string
+does not match
+.Ar pattern .
+When the
+.Ar string
+matches the
+.Ar pattern
+the
+.Ev \&.sh.match
+array variable contains the match and sub-pattern matches.
+.It Ar string Sy =~ Ar ere
+True if
+.Ar string
+matches the pattern
+.Sy ~(E) Ns Ar ere
+where
+.Ar ere
+is an extended regular expression.
+.It Ar string1 Sy \&< Ar string2
+True, if
+.Ar string1
+comes before
+.Ar string2
+based on
+.Sy ASCII
+value of their characters.
+.It Ar string1 Sy \&> Ar string2
+True, if
+.Ar string1
+comes after
+.Ar string2
+based on
+.Sy ASCII
+value of
their characters.
-.RE
-
-.sp
-In each of the above expressions, if \fIfile\fR is of the form
-\fB/dev/fd/\fR\fIn\fR, where \fIn\fR is an integer, the test is applied to the
-open file whose descriptor number is \fIn\fR.
-.sp
-.LP
+.El
+.Pp
+In each of the above expressions, if
+.Ar file
+is of the form
+.Pa /dev/fd/ Ns Ar n ,
+where
+.Ar n
+is an integer, the test is applied to the open file whose descriptor number is
+.Ar n .
+.Pp
The following obsolete arithmetic comparisons are also supported:
-.sp
-.ne 2
-.na
-\fB\fIexp1\fR \fB-eq\fR \fIexp2\fR
-.ad
-.RS 17n
-True, if \fIexp1\fR is equal to \fIexp2\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fIexp1\fR \fB-ge\fR \fIexp2\fR
-.ad
-.RS 17n
-True, if \fIexp1\fR is greater than or equal to \fIexp2\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fIexp1\fR \fB-gt\fR \fIexp2\fR
-.ad
-.RS 17n
-True, if \fIexp1\fR is greater than \fIexp2\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fIexp1\fR \fB-le\fR \fIexp2\fR
-.ad
-.RS 17n
-True, if \fIexp1\fR is less than or equal to \fIexp2\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fIexp1\fR \fB-lt\fR \fIexp2\fR
-.ad
-.RS 17n
-True, if \fIexp1\fR is less than \fIexp2\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fIexp1\fR \fB-ne\fR \fIexp2\fR
-.ad
-.RS 17n
-True, if \fIexp1\fR is not equal to \fIexp2\fR.
-.RE
-
-.sp
-.LP
+.Bl -tag -width 18n
+.It Ar exp1 Fl eq Ar exp2
+True, if
+.Ar exp1
+is equal to
+.Ar exp2 .
+.It Ar exp1 Fl ge Ar exp2
+True, if
+.Ar exp1
+is greater than or equal to
+.Ar exp2 .
+.It Ar exp1 Fl gt Ar exp2
+True, if
+.Ar exp1
+is greater than
+.Ar exp2 .
+.It Ar exp1 Fl le Ar exp2
+True, if
+.Ar exp1
+is less than or equal to
+.Ar exp2 .
+.It Ar exp1 Fl lt Ar exp2
+True, if
+.Ar exp1
+is less than
+.Ar exp2 .
+.It Ar exp1 Fl ne Ar exp2
+True, if
+.Ar exp1
+is not equal to
+.Ar exp2 .
+.El
+.Pp
A compound expression can be constructed from these primitives by using any of
the following, listed in decreasing order of precedence:
-.sp
-.ne 2
-.na
-\fB(\fR\fIexpression\fR\fB)\fR
-.ad
-.RS 30n
-True, if \fIexpression\fR is true. Used to group expressions.
-.RE
-
-.sp
-.ne 2
-.na
-\fB!\fR \fIexpression\fR
-.ad
-.RS 30n
-True, if \fIexpression\fR is false.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fIexpression1\fR \fB&&\fR \fIexpression2\fR
-.ad
-.RS 30n
-True, if \fIexpression1\fR and \fIexpression2\fR are both true.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fIexpression1\fR \fB||\fR \fIexpression2\fR
-.ad
-.RS 30n
-True, if either \fIexpression1\fR or \fIexpression2\fR is true.
-.RE
-
-.SS "Input and Output"
+.Bl -tag -width Ds
+.It Sy \&( Ns Ar expression Ns Sy \&)
+True, if
+.Ar expression
+is true.
+Used to group expressions.
+.It Sy \&! Ar expression
+True, if
+.Ar expression
+is false.
+.It Ar expression1 Sy \&&& Ar expression2
+True, if
+.Ar expression1
+and
+.Ar expression2
+are both true.
+.It Ar expression1 Sy \&|\&| Ar expression2
+True, if either
+.Ar expression1
+or
+.Ar expression2
+is true.
+.El
+.Ss "Input and Output"
Before a command is executed, its input and output can be redirected using a
-special notation interpreted by the shell. The following can appear anywhere in
-a simple command or can precede or follow a command and are \fBnot\fR passed on
-to the invoked command. Command substitution, parameter expansion, and
-arithmetic substitution occur before \fIword\fR or \fIdigit\fR is used except
-as noted in this section. File name generation occurs only if the shell is
-interactive and the pattern matches a single file. Field splitting is not
-performed.
-.sp
-.LP
-In each of the following redirections, if \fIfile\fR is of the form
-\fB/dev/sctp/\fR\fIhost\fR\fB/\fR\fIport\fR,
-\fB/dev/tcp/\fR\fIhost\fR\fB/\fR\fIport\fR, or
-\fB/dev/udp/\fR\fIhost\fR\fB/\fR\fIport\fR, where \fIhost\fR is a hostname or
-host address, and \fIport\fR is a service specified by name or an integer port
-number, then the redirection attempts to make a \fBtcp\fR, \fBsctp\fR or
-\fBudp\fR connection to the corresponding socket.
-.sp
-.LP
+special notation interpreted by the shell.
+The following can appear anywhere in
+a simple command or can precede or follow a command and are
+.Em not
+passed on to the invoked command.
+Command substitution, parameter expansion, and arithmetic substitution occur
+before
+.Ar word
+or
+.Ar digit
+is used except as noted in this section.
+File name generation occurs only if the shell is interactive and the pattern
+matches a single file.
+Field splitting is not performed.
+.Pp
+In each of the following redirections, if
+.Ar file
+is of the form
+.Pa /dev/sctp/ Ar host Ns Sy / Ns Ar port ,
+.Pa /dev/tcp/ Ar host Ns Sy / Ns Ar port ,
+or
+.Pa /dev/udp/ Ar host Ns Sy / Ns Ar port ,
+where
+.Ar host
+is a hostname or host address, and
+.Ar port
+is a service specified by name or an integer port number, then the redirection
+attempts to make a
+.Sy tcp ,
+.Sy sctp
+or
+.Sy udp
+connection to the corresponding socket.
+.Pp
No intervening space is allowed between the characters of redirection
operators.
-.sp
-.ne 2
-.na
-\fB<\fR\fIword\fR
-.ad
-.RS 14n
-Use file \fIword\fR as standard input (file descriptor 0).
-.RE
-
-.sp
-.ne 2
-.na
-\fB>\fR\fIword\fR
-.ad
-.RS 14n
-Use file \fIword\fR as standard output (file descriptor 1). If the file does
-not exist then it is created. If the file exists, and the \fBnoclobber\fR
-option is on, this causes an error. Otherwise, it is truncated to zero length.
-.RE
-
-.sp
-.ne 2
-.na
-\fB>|\fR\fIword\fR
-.ad
-.RS 14n
-Same as \fB>\fR, except that it overrides the \fBnoclobber\fR option.
-.RE
-
-.sp
-.ne 2
-.na
-\fB>;\fR\fIword\fR
-.ad
-.RS 14n
-Write output to a temporary file. If the command completes successfully rename
-it to word, otherwise, delete the temporary file. >;word cannot be used with
-the \fBexec\fR(2) built-in.
-.RE
-
-.sp
-.ne 2
-.na
-\fB>>\fR\fIword\fR
-.ad
-.RS 14n
-Use file \fIword\fR as standard output. If the file exists, then output is
-appended to it (by first seeking to the end-of-file). Otherwise, the file is
-created.
-.RE
-
-.sp
-.ne 2
-.na
-\fB<>\fR\fIword\fR
-.ad
-.RS 14n
-Open file \fIword\fR for reading and writing as standard input.
-.RE
-
-.sp
-.ne 2
-.na
-\fB<<\fR\fB[-]\fR\fIword\fR
-.ad
-.RS 14n
-The shell input is read up to a line that is the same as \fIword\fR after any
-quoting has been removed, or to an end-of-file. No parameter substitution,
-command substitution, arithmetic substitution or file name generation is
-performed on \fIword\fR. The resulting document, called a \fBhere-document\fR,
-becomes the standard input. If any character of \fIword\fR is quoted, then no
-interpretation is placed upon the characters of the document. Otherwise,
-parameter expansion, command substitution, and arithmetic substitution occur,
-\fB\e\fRNEWLINE is ignored, and \fB\e\fR must be used to quote the characters
-\fB\e\fR, \fB$\fR, \fB`\fR\&. If \fB-\fR is appended to \fB<<\fR, then all
-leading tabs are stripped from \fIword\fR and from the document. If \fB#\fR is
-appended to \fB<<\fR, then leading SPACEs and TABs are stripped off the first
-line of the document and up to an equivalent indentation is stripped from the
-remaining lines and from \fIword\fR. A tab stop is assumed to occur at every 8
-columns for the purposes of determining the indentation.
-.RE
-
-.sp
-.ne 2
-.na
-\fB<<<\fR\fIword\fR
-.ad
-.RS 14n
-A short form of here document in which \fIword\fR becomes the contents of the
-here-document after any parameter expansion, command substitution, and
-arithmetic substitution occur.
-.RE
-
-.sp
-.ne 2
-.na
-\fB<&\fR\fIdigit\fR
-.ad
-.RS 14n
-The standard input is duplicated from file descriptor \fIdigit\fR, and
-similarly for the standard output using \fB>&\fR\fIdigit\fR. See \fBdup\fR(2).
-.RE
-
-.sp
-.ne 2
-.na
-\fB<&\fR\fIdigit\fR\fB-\fR
-.ad
-.RS 14n
-The file descriptor specified by \fIdigit\fR is moved to standard input.
-Similarly for the standard output using \fB>&\fR\fIdigit\fR\fB-\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fB<&-\fR
-.ad
-.RS 14n
-The standard input is closed. Similarly for the standard output using
-\fB>&-\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fB<&p\fR
-.ad
-.RS 14n
+.Bl -tag -width Ar
+.It Sy \&< Ns Ar word
+Use file
+.Ar word
+as standard input (file descriptor 0).
+.It Sy \&> Ns Ar word
+Use file
+.Ar word
+as standard output (file descriptor 1).
+If the file does not exist then it is created.
+If the file exists, and the
+.Sy noclobber
+option is on, this causes an error, otherwise, it is truncated to zero length.
+.It Sy \&>\&| Ns Ar word
+Same as
+.Sy > ,
+except that it overrides the
+.Sy noclobber
+option.
+.It Sy \&>\&; Ns Ar word
+Write output to a temporary file.
+If the command completes successfully rename it to word, otherwise, delete the
+temporary file.
+>;word cannot be used with the
+.Xr exec 2
+built-in.
+.It Sy \&>> Ns Ar word
+Use file
+.Ar word
+as standard output.
+If the file exists, then output is appended to it (by first seeking to the
+end-of-file), otherwise, the file is created.
+.It Sy \&<> Ns Ar word
+Open file
+.Ar word
+for reading and writing as standard input.
+.It Sy \&<< Ns Oo Fl Oc Ns Ar word
+The shell input is read up to a line that is the same as
+.Ar word
+after any quoting has been removed, or to an end-of-file.
+No parameter substitution, command substitution, arithmetic substitution or
+file name generation is performed on
+.Ar word .
+The resulting document, called a
+.Sy here-document ,
+becomes the standard input.
+If any character of
+.Ar word
+is quoted, then no interpretation is placed upon the characters of the
+document.
+Otherwise, parameter expansion, command substitution, and arithmetic
+substitution occur,
+\eNEWLINE is ignored, and \e must be used to quote the characters
+.Sy \e ,
+.Sy $
+and
+.Sy \&` .
+If
+.Sy -
+is appended to
+.Sy << ,
+then all
+leading tabs are stripped from
+.Ar word
+and from the document.
+If
+.Sy #
+is
+appended to
+.Sy << ,
+then leading SPACEs and TABs are stripped off the first line of the document
+and up to an equivalent indentation is stripped from the remaining lines and
+from
+.Ar word .
+A tab stop is assumed to occur at every 8 columns for the purposes of
+determining the indentation.
+.It Sy \&<<< Ns Ar word
+A short form of here document in which
+.Ar word
+becomes the contents of the here-document after any parameter expansion,
+command substitution, and arithmetic substitution occur.
+.It Sy \&<& Ns Ar digit
+The standard input is duplicated from file descriptor
+.Ar digit ,
+and similarly for the standard output using
+.Sy >&
+.Ar digit .
+See
+.Xr dup 2 .
+.It Sy \&<& Ns Ar digit Ns Sy -
+The file descriptor specified by
+.Ar digit
+is moved to standard input.
+Similarly for the standard output using
+.Sy >& Ns Ar digit Ns Sy - .
+.It Sy <&-
+The standard input is closed.
+Similarly for the standard output using
+.Sy >&- .
+.It Sy <&p
The input from the co-process is moved to standard input.
-.RE
-
-.sp
-.ne 2
-.na
-\fB>&p\fR
-.ad
-.RS 14n
+.It Sy >&p
The output to the co-process is moved to standard output.
-.RE
-
-.sp
-.ne 2
-.na
-\fB<#((\fR\fIexpr\fR\fB))\fR
-.ad
-.RS 14n
-Evaluate arithmetic expression \fIexpr\fR and position file descriptor 0 to the
-resulting value bytes from the start of the file. The variables \fBCUR\fR and
-\fBEOF\fR evaluate to the current offset and end-of-file offset respectively
-when evaluating \fIexpr\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fB>#((\fR\fIexpr\fR\fB))\fR
-.ad
-.RS 14n
-The same as \fB<#\fR except applies to file descriptor 1.
-.RE
-
-.sp
-.ne 2
-.na
-\fB<#\fR\fIpattern\fR
-.ad
-.RS 14n
+.It Sy <#(( Ns Ar expr Ns Sy ))
+Evaluate arithmetic expression
+.Ar expr
+and position file descriptor 0 to the resulting value bytes from the start of
+the file.
+The variables
+.Ev CUR
+and
+.Ev EOF
+evaluate to the current offset and end-of-file offset respectively when
+evaluating
+.Ar expr .
+.It Sy >#(( Ns Ar expr Ns Sy ))
+The same as
+.Sy <#
+except applies to file descriptor 1.
+.It Sy <# Ns Ar pattern
Seek forward to the beginning of the next line containing pattern.
-.RE
-
-.sp
-.ne 2
-.na
-\fB<##\fR\fIpattern\fR
-.ad
-.RS 14n
-The same as \fB<#\fR, except that the portion of the file that is skipped is
-copied to standard output.
-.RE
-
-.sp
-.LP
+.It Sy <## Ns Ar pattern
+The same as
+.Sy <# ,
+except that the portion of the file that is skipped is copied to standard
+output.
+.El
+.Pp
If one of the redirection operators is preceded by a digit, with no intervening
space, then the file descriptor number referred to is that specified by the
-digit (instead of the default 0 or 1). If one of the redirection operators
-other than \fB>&-\fR and the \fB>#\fR and \fB<#\fR forms, is preceded by
-\fB{\fR\fIvarname\fR\fB}\fR with no intervening space, then a file descriptor
-number \fB> 10\fR is selected by the shell and stored in the variable
-\fIvarname\fR. If \fB>&-\fR or the any of the \fB>#\fR and \fB<#\fR forms is
-preceded by \fB{\fR\fIvarname\fR\fB}\fR the value of \fIvarname\fR defines the
-file descriptor to close or position. For example:
-.sp
-.in +2
-.nf
-\&... 2>&1
-.fi
-.in -2
-.sp
-
-.sp
-.LP
+digit (instead of the default 0 or 1).
+If one of the redirection operators
+other than
+.Sy >&-
+and the
+.Sy >#
+and
+.Sy <#
+forms, is preceded by
+.Sy \&{ Ns Ar varname Ns Sy \&}
+with no intervening space, then a file descriptor
+number
+.Sy > 10
+is selected by the shell and stored in the variable
+.Ar varname .
+If
+.Sy >&-
+or the any of the
+.Sy >#
+and
+.Sy <#
+forms is preceded by
+.Sy \&{ Ns Ar varname Ns Sy \&}
+the value of
+.Ar varname
+defines the file descriptor to close or position.
+For example:
+.Pp
+.Dl ... 2>&1
+.Pp
means file descriptor 2 is to be opened for writing as a duplicate of file
descriptor 1 and
-.sp
-.in +2
-.nf
-exec [\fIn\fR]<\fIfile\fR
-.fi
-.in -2
-.sp
-
-.sp
-.LP
-means open \fIfile\fR for reading and store the file descriptor number in
-variable \fIn\fR. The order in which redirections are specified is significant.
-The shell evaluates each redirection in terms of the (\fIfile_descriptor\fR,
-\fIfile\fR) association at the time of evaluation. For example:
-.sp
-.in +2
-.nf
-\&... 1>\fIfname\fR 2>&1
-.fi
-.in -2
-.sp
-
-.sp
-.LP
-first associates file descriptor 1 with file \fIfname\fR. It then associates
-file descriptor 2 with the file associated with file descriptor 1, that is,
-\fIfname\fR. If the order of redirections were reversed, file descriptor 2
-would be associated with the terminal (assuming file descriptor 1 had been) and
-then file descriptor 1 would be associated with file \fIfname\fR. If a command
-is followed by \fB&\fR and job control is not active, the default standard
-input for the command is the empty file \fB/dev/null\fR. Otherwise, the
-environment for the execution of a command contains the file descriptors of the
-invoking shell as modified by input and output specifications.
-.SS "Environment"
-The \fIenvironment\fR is a list of name-value pairs that is passed to an
-executed program in the same way as a normal argument list. See
-\fBenviron\fR(5).
-.sp
-.LP
-The names must be \fIidentifiers\fR and the values are character strings. The
-shell interacts with the environment in several ways. On invocation, the shell
-scans the environment and creates a variable for each name found, giving it the
-corresponding value and attributes and marking it \fBexport\fR. Executed
-commands inherit the environment. If the user modifies the values of these
-variables or creates new ones, using the \fBexport\fR or \fBtypeset\fR \fB-x\fR
-commands, they become part of the environment. The environment seen by any
-executed command is thus composed of any name-value pairs originally inherited
-by the shell, whose values can be modified by the current shell, plus any
-additions which must be noted in \fBexport\fR or \fBtypeset\fR \fB-x\fR
-commands. The environment for any simple-command or function can be augmented
-by prefixing it with one or more variable assignments. A variable assignment
-argument is a word of the form \fIidentifier\fR\fB=\fR\fIvalue\fR. Thus:
-.sp
-.in +2
-.nf
-TERM=450 cmd args
-.fi
-.in -2
-.sp
-
-.sp
-.LP
+.Pp
+.Dl exec [n]<file
+.Pp
+means open
+.Ar file
+for reading and store the file descriptor number in variable
+.Ar n .
+The order in which redirections are specified is significant.
+The shell evaluates each redirection in terms of the
+.Pq Ar file_descriptor , Ar file
+association at the time of evaluation.
+For example:
+.Pp
+.Dl ... 1>fname 2>&1
+.Pp
+first associates file descriptor 1 with file
+.Ar fname .
+It then associates file descriptor 2 with the file associated with file
+descriptor 1, that is,
+.Ar fname .
+If the order of redirections were reversed, file descriptor 2 would be
+associated with the terminal (assuming file descriptor 1 had been) and then
+file descriptor 1 would be associated with file
+.Ar fname .
+If a command is followed by
+.Sy \&&
+and job control is not active, the default standard input for the command is
+the empty file
+.Pa /dev/null .
+Otherwise, the environment for the execution of a command contains the file
+descriptors of the invoking shell as modified by input and output
+specifications.
+.Ss "Environment"
+The
+.Sy environment
+is a list of name-value pairs that is passed to an executed program in the same
+way as a normal argument list.
+See
+.Xr environ 5 .
+.Pp
+The names must be
+.Ar identifiers
+and the values are character strings.
+The shell interacts with the environment in several ways.
+On invocation, the shell scans the environment and creates a variable for each
+name found, giving it the corresponding value and attributes and marking it
+.Ic export .
+Executed commands inherit the environment.
+If the user modifies the values of these variables or creates new ones, using
+the
+.Ic export
+or
+.Ic typeset Fl x
+commands, they become part of the environment.
+The environment seen by any executed command is thus composed of any name-value
+pairs originally inherited by the shell, whose values can be modified by the
+current shell, plus any additions which must be noted in
+.Ic export
+or
+.Ic typeset Fl x
+commands.
+The environment for any simple-command or function can be augmented by
+prefixing it with one or more variable assignments.
+A variable assignment argument is a word of the form
+.Ar identifier Ns Sy = Ns Ar value .
+Thus:
+.Pp
+.Dl TERM=450 cmd args
+.Pp
and
-.sp
-.in +2
-.nf
-(export TERM; TERM=450; cmd args)
-.fi
-.in -2
-.sp
-
-.sp
-.LP
-are equivalent (as far as the execution of \fIcmd\fR is concerned except for
-special built-in commands listed in the \fBBuilt-Ins\fR section, those that are
-preceded with a dagger. If the obsolete \fB-k\fR option is set, all variable
-assignment arguments are placed in the environment, even if they occur after
-the command name.
-.sp
-.LP
-The following example first prints \fBa=b c\fR and then \fBc\fR:
-.sp
-.in +2
-.nf
+.Pp
+.Dl (export TERM; TERM=450; cmd args)
+.Pp
+are equivalent
+.Pq as far as the execution of Ar cmd No is concerned
+except for special built-in commands listed in the
+.Sx Built-Ins
+section, those that are preceded with a dagger.
+If the obsolete
+.Fl k
+option is set, all variable assignment arguments are placed in the environment,
+even if they occur after the command name.
+.Pp
+The following example first prints
+.Sy a=b c
+and then
+.Sy c :
+.Bd -literal -offset indent
echo a=b c
set -k
echo a=b c
-.fi
-.in -2
-.sp
-
-.sp
-.LP
+.Ed
+.Pp
This feature is intended for use with scripts written for early versions of the
shell and its use in new scripts is strongly discouraged.
-.SS "Functions"
+.Ss "Functions"
For historical reasons, there are two ways to define functions, the
-\fBname()\fR syntax and the \fBfunction\fR \fBname\fR syntax. These are
-described in the \fBCommands\fR section of this manual page.
-.sp
-.LP
-Shell functions are read in and stored internally. Alias names are resolved
-when the function is read. Functions are executed like commands with the
-arguments passed as positional parameters. See the \fBExecution\fR section of
-this manual page for details.
-.sp
-.LP
-Functions defined by the \fBfunction\fR \fBname\fR syntax and called by name
-execute in the same process as the caller and share all files and present
-working directory with the caller. Traps caught by the caller are reset to
-their default action inside the function. A trap condition that is not caught
-or ignored by the function causes the function to terminate and the condition
-to be passed on to the caller. A trap on \fBEXIT\fR set inside a function is
-executed in the environment of the caller after the function completes.
+.Ar name Ns Sy ()
+syntax and the
+.Ic function Ar name
+syntax.
+These are
+described in the
+.Sx Commands
+section of this manual page.
+.Pp
+Shell functions are read in and stored internally.
+Alias names are resolved when the function is read.
+Functions are executed like commands with the arguments passed as positional
+parameters.
+See the
+.Sx Execution
+section of this manual page for details.
+.Pp
+Functions defined by the
+.Ic function Ar name
+syntax and called by name execute in the same process as the caller and share
+all files and present working directory with the caller.
+Traps caught by the caller are reset to their default action inside the
+function.
+A trap condition that is not caught or ignored by the function causes the
+function to terminate and the condition to be passed on to the caller.
+A trap on
+.Sy EXIT
+set inside a function is executed in the environment of the caller after the
+function completes.
Ordinarily, variables are shared between the calling program and the function.
-However, the \fBtypeset\fR special built-in command used within a function
-defines local variables whose scope includes the current function. They can be
-passed to functions that they call in the variable assignment list that
-precedes the call or as arguments passed as name references. Errors within
-functions return control to the caller.
-.sp
-.LP
-Functions defined with the \fBname()\fR syntax and functions defined with the
-\fBfunction\fR \fBname\fR syntax that are invoked with the \fB\&.\fR special
-built-in are executed in the caller's environment and share all variables and
-traps with the caller. Errors within these function executions cause the script
-that contains them to abort.
-.sp
-.LP
-The special built-in command \fBreturn\fR is used to return from function
-calls.
-.sp
-.LP
-Function names can be listed with the \fB-f\fR or \fB+f\fR option of the
-\fBtypeset\fR special built-in command. The text of functions, when available,
-is also listed with \fB-f\fR. Functions can be undefined with the \fB-f\fR
-option of the \fBunset\fR special built-in command.
-.sp
-.LP
+However, the
+.Ic typeset
+special built-in command used within a function defines local variables whose
+scope includes the current function.
+They can be passed to functions that they call in the variable assignment list
+that precedes the call or as arguments passed as name references.
+Errors within functions return control to the caller.
+.Pp
+Functions defined with the
+.Ar name Ns Sy ()
+syntax and functions defined with the
+.Ic function Ar name
+syntax that are invoked with the
+.Ic \&.
+special built-in are executed in the caller's environment and share all
+variables and traps with the caller.
+Errors within these function executions cause the script that contains them to
+abort.
+.Pp
+The special built-in command
+.Ic return
+is used to return from function calls.
+.Pp
+Function names can be listed with the
+.Fl f
+or
+.Sy +f
+option of the
+.Ic typeset
+special built-in command.
+The text of functions, when available, is also listed with
+.Fl f .
+Functions can be undefined with the
+.Fl f
+option of the
+.Ic unset
+special built-in command.
+.Pp
Ordinarily, functions are unset when the shell executes a shell script.
Functions that need to be defined across separate invocations of the shell
-should be placed in a directory and the \fBFPATH\fR variable should contain the
-name of this directory. They can also be specified in the \fBENV\fR file.
-.SS "Discipline Functions"
+should be placed in a directory and the
+.Ev FPATH
+variable should contain the
+name of this directory.
+They can also be specified in the
+.Ev ENV
+file.
+.Ss "Discipline Functions"
Each variable can have zero or more discipline functions associated with it.
-The shell initially understands the discipline names \fBget\fR, \fBset\fR,
-\fBappend\fR, and \fBunset\fR but on most systems others can be added at run
-time via the C programming interface extension provided by the \fBbuiltin\fR
-built-in utility. If the \fBget\fR discipline is defined for a variable, it is
-invoked whenever the specified variable is referenced. If the variable
-\fB\&.sh.value\fR is assigned a value inside the discipline function, the
-referenced variable is evaluated to this value instead. If the \fBset\fR
+The shell initially understands the discipline names
+.Ic get ,
+.Ic set ,
+.Ic append ,
+and
+.Ic unset
+but on most systems others can be added at run time via the C programming
+interface extension provided by the
+.Ic builtin
+built-in utility.
+If the
+.Ic get
discipline is defined for a variable, it is invoked whenever the specified
-variable is assigned a value. If the \fBappend\fR discipline is defined for a
-variable, it is invoked whenever a value is appended to the specified variable.
-The variable \fB\&.sh.value\fR is specified the value of the variable before
-invoking the discipline, and the variable is assigned the value of
-\fB\&.sh.value\fR after the discipline completes. If .\fBsh.value\fR is
-\fBunset\fR inside the discipline, then that value is unchanged. If the
-\fBunset\fR discipline is defined for a variable, it is invoked whenever the
-specified variable is unset. The variable is not unset unless it is unset
-explicitly from within this discipline function.
-.sp
-.LP
-The variable \fB\&.sh.name\fR contains the name of the variable for which the
-discipline function is called, \fB\&.sh.subscript\fR is the subscript of the
-variable, and \fB\&.sh.value\fR contains the value being assigned inside the
-\fBset\fR discipline function. For the \fBset\fR discipline, changing
-\fB\&.sh.value\fR changes the value that gets assigned.
-The variable \fB_\fR is a reference to the variable including the subscript if
-any. For the set discipline, changing \fB\&.sh.value\fR will change the value
-that gets assigned. Finally, the expansion \fB${\fR \fIvar.name\fR\fB}\fR,
+variable is referenced.
+If the variable
+.Sy \&.sh.value
+is assigned a value inside the discipline function, the referenced variable is
+evaluated to this value instead.
+If the
+.Ic set
+discipline is defined for a variable, it is invoked whenever the specified
+variable is assigned a value.
+If the
+.Ic append
+discipline is defined for a variable, it is invoked whenever a value is
+appended to the specified variable.
+The variable
+.Sy \&.sh.value
+is specified the value of the variable before invoking the discipline, and the
+variable is assigned the value of
+.Sy \&.sh.value
+after the discipline completes.
+If
+.Sy .sh.value
+is
+.Ic unset
+inside the discipline, then that value is unchanged.
+If the
+.Ic unset
+discipline is defined for a variable, it is invoked whenever the specified
+variable is unset.
+The variable is not unset unless it is unset explicitly from within this
+discipline function.
+.Pp
+The variable
+.Sy \&.sh.name
+contains the name of the variable for which the discipline function is called,
+.Sy \&.sh.subscript
+is the subscript of the variable, and
+.Sy \&.sh.value
+contains the value being assigned inside the
+.Ic set
+discipline function.
+For the
+.Sy set
+discipline, changing
+.Sy \&.sh.value
+changes the value that gets assigned.
+The variable
+.Sy _
+is a reference to the variable including the subscript if any.
+For the
+.Ic set
+discipline, changing
+.Sy \&.sh.value
+will change the value that gets assigned.
+Finally, the expansion
+.Sy ${ Ns Ar var.name Ns Sy } ,
when name is the name of a discipline, and there is no variable of this name,
-is equivalent to the command substitution \fB${\fR\fIvar.name\fR\fB;}\fR.
-
-.SS "Name Spaces"
-Commands and functions that are executed as part of the \fIlist\fR
-of a \fBnamespace\fR command that modify variables or create new ones, create
-a new variable whose name is the name of the name space as given by
-\fIidentifier\fR preceded by two dots (\fB\&..\fR).
-When a variable whose name is \fIname\fR is referenced, it is first searched
-for using \fB.\fR\fIidentifier\fR\fB.\fR\fIname\fR\fB.\fR
-Similarly, a function defined by a command in the \fBnamespace\fR \fIlist\fR
-is created using the name space name preceded by two dots (\fB\&..\fR).
-.PP
-When the \fIlist\fR of a \fBnamespace\fR command contains a \fBnamespace\fR
+is equivalent to the command substitution
+.Sy ${ Ns Ar var.name Ns Sy ;} .
+.Ss "Name Spaces"
+Commands and functions that are executed as part of the
+.Ar list
+of a
+.Ic namespace
+command that modify variables or create new ones, create a new variable whose
+name is the name of the name space as given by
+.Ar identifier
+preceded by two dots
+.Pq Sy \&.. .
+When a variable whose name is
+.Ar name
+is referenced, it is first searched for using
+.Sy \&. Ns Ar identifier Ns Sy \&. Ns Ar name Ns Sy \&.
+Similarly, a function defined by a command in the
+.Ic namespace Ar list
+is created using the name space name preceded by two dots
+.Pq Sy \&.. .
+.Pp
+When the
+.Ar list
+of a
+.Ic namespace
+command contains a
+.Ic namespace
command, the names of variables and functions that are created consist
-of the variable or function name preceded by the list of \fIidentifier\fRs
-each preceded by two dots (\fB\&..\fR).
-.PP
-Outside of a name space, a variable or function created inside a
-name space can be referenced by preceding it with the name space name.
-.PP
-By default, variables staring with \fB.sh\fR are in the \fBsh\fR name space.
-
-.SS "Typed Variables"
-Typed variables provide a way to create data structure and objects. A type can
-be defined either by a shared library, by the \fBenum\fR built-in command
-described below, or by using the new \fB-T\fR option of the \fBtypeset\fR
-built-in command. With the \fB-T\fR option of \fBtypeset\fR, the type name,
-specified as an option argument to \fB-T\fR, is set with a compound variable
-assignment that defines the type. Function definitions can appear inside the
-compound variable assignment and these become discipline functions for this
-type and can be invoked or redefined by each instance of the type. The function
-name \fBcreate\fR is treated specially. It is invoked for each instance of the
-type that is created but is not inherited and cannot be redefined for each
-instance.
-
-When a type is defined a special built-in command of that name is added. These
-built-ins are declaration commands and follow the same expansion rules as all
-the special built-in commands defined below that are preceded by a dot
-(\fB\&.\fR). These commands can subsequently be used inside further type
-definitions. The man page for these commands can be generated by using the
-\fB--man\fR option or any of the other \fB--\fR options described with
-\fBgetopts\fR. The \fB-r, -a, -A, -h\fR and \fB-S\fR options of \fBtypeset\fR
+of the variable or function name preceded by the list of
+.Ar identifier Ns No s ,
+each preceded by two dots
+.Pq Sy \&.. .
+.Pp
+Outside of a name space, a variable or function created inside a name space can
+be referenced by preceding it with the name space name.
+.Pp
+By default, variables staring with
+.Sy \&.sh
+are in the
+.Sy sh
+name space.
+.Ss "Typed Variables"
+Typed variables provide a way to create data structure and objects.
+A type can be defined either by a shared library, by the
+.Ic enum
+built-in command described below, or by using the
+.Fl T
+option of the
+.Ic typeset
+built-in command.
+With the
+.Fl T
+option of
+.Ic typeset ,
+the type name, specified as an option argument to
+.Fl T ,
+is set with a compound variable assignment that defines the type.
+Function definitions can appear inside the compound variable assignment and
+these become discipline functions for this type and can be invoked or redefined
+by each instance of the type.
+The function name
+.Sy create
+is treated specially.
+It is invoked for each instance of the type that is created but is not
+inherited and cannot be redefined for each instance.
+.Pp
+When a type is defined a special built-in command of that name is added.
+These built-ins are declaration commands and follow the same expansion rules as
+all the special built-in commands defined below that are preceded by a dot
+.Pq Sy \&. .
+These commands can subsequently be used inside further type definitions.
+The man page for these commands can be generated by using the
+.Fl -man
+option or any of the other
+.Fl -
+options described with
+.Ic getopts .
+The
+.Fl r ,
+.Fl a ,
+.Fl A ,
+.Fl h
+and
+.Fl S
+options of
+.Ic typeset
are permitted with each of these new built-ins.
-
-An instance of a type is created by invoking the type name
-followed by one or more instance names.
+.Pp
+An instance of a type is created by invoking the type name followed by one or
+more instance names.
Each instance of the type is initialized with a copy of the sub-variables
-except for sub-variables that are defined with the \fB-s\fR
-option. Variables defined with \fB-S\fR are shared by all instances of the
-type. Each instance can change the value of any sub-variable and can also
-define new discipline functions of the same names as those defined by the type
-definition as well as any standard discipline names. No additional
-sub-variables can be defined for any instance.
-
+except for sub-variables that are defined with the
+.Fl s
+option.
+Variables defined with
+.Fl S
+are shared by all instances of the type.
+Each instance can change the value of any sub-variable and can also define new
+discipline functions of the same names as those defined by the type definition
+as well as any standard discipline names.
+No additional sub-variables can be defined for any instance.
+.Pp
When defining a type, if the value of a sub-variable is not set and the
-\fB-r\fR attribute is specified, it causes the sub-variable to be a required
-sub-variable. Whenever an instance of a type is created, all required
-sub-variables must be specified. These sub-variables become readonly in each
-instance.
-
-When \fBunset\fR is invoked on a sub-variable within a type, and the \fB-r\fR
+.Fl r
+attribute is specified, it causes the sub-variable to be a required
+sub-variable.
+Whenever an instance of a type is created, all required sub-variables must be
+specified.
+These sub-variables become readonly in each instance.
+.Pp
+When
+.Ic unset
+is invoked on a sub-variable within a type, and the
+.Fl r
attribute has not been specified for this field, the value is reset to the
-default value associative with the type. Invoking \fBunset\fR on a type
-instance not contained within another type deletes all sub-variables and the
-variable itself.
-
+default value associative with the type.
+Invoking
+.Ic unset
+on a type instance not contained within another type deletes all sub-variables
+and the variable itself.
A type definition can be derived from another type definition by defining the
-first sub-variable name as \fB_\fR and defining its type as the base type. Any
-remaining definitions will be additions and modifications that apply to the new
-type. If the new type name is the same is that of the base type, the type will
-be replaced and the original type will no longer be accessible.
-
-The \fBtypeset\fR command with \fB-T\fR and no option argument or operands will
-write all the type definitions to standard output in a form that that can be
-read in to create all the types.
-
-.SS "Jobs"
-If the monitor option of the \fBset\fR command is turned on, an interactive
-shell associates a job with each pipeline. It keeps a table of current jobs,
-printed by the \fBjobs\fR command, and assigns them small integer numbers. When
-a job is started asynchronously with \fB&\fR, the shell prints a line which
-looks like:
-.sp
-.in +2
-.nf
-[1] 1234
-.fi
-.in -2
-.sp
-
-.sp
-.LP
+first sub-variable name as
+.Sy _
+and defining its type as the base type.
+Any remaining definitions will be additions and modifications that apply to the
+new type.
+If the new type name is the same is that of the base type, the type will be
+replaced and the original type will no longer be accessible.
+.Pp
+The
+.Ic typeset
+command with
+.Fl T
+and no option argument or operands will write all the type definitions to
+standard output in a form that that can be read in to create all the types.
+.Ss "Jobs"
+If the monitor option of the
+.Ic set
+command is turned on, an interactive shell associates a job with each pipeline.
+It keeps a table of current jobs, printed by the
+.Ic jobs
+command, and assigns them small integer numbers.
+When a job is started asynchronously with
+.Sy \&& ,
+the shell prints a line which looks like:
+.Pp
+.Dl [1] 1234
+.Pp
indicating that the job which was started asynchronously was job number 1 and
-had one (top-level) process, whose process id was \fB1234\fR.
-.sp
-.LP
-If you are running a job and wish to stop it, CTRL-z sends a \fBSTOP\fR signal
-to the current job. The shell normally displays a message that the job has been
-stopped, and displays another prompt. You can then manipulate the state of this
-job, putting it in the background with the \fBbg\fR command, or run some other
-commands and then eventually bring the job back into the foreground with the
-foreground command \fBfg\fR. A CTRL-z takes effect immediately and is like an
-interrupt in that pending output and unread input are discarded when it is
-typed.
-.sp
-.LP
+had one (top-level) process, whose process id was
+.Sy 1234 .
+.Pp
+If you are running a job and wish to stop it, CTRL-z sends a
+.Sy STOP
+signal to the current job.
+The shell normally displays a message that the job has been stopped, and
+displays another prompt.
+You can then manipulate the state of this job, putting it in the background
+with the
+.Ic bg
+command, or run some other commands and then eventually bring the job back into
+the foreground with the foreground command
+.Ic fg .
+A CTRL-z takes effect immediately and is like an interrupt in that pending
+output and unread input are discarded when it is typed.
+.Pp
A job being run in the background stops if it tries to read from the terminal.
Background jobs are normally allowed to produce output, but this can be
-disabled by giving the command \fBsttytostop\fR. If you set this \fBtty\fR
+disabled by giving the command
+.Sy stty tostop .
+If you set this
+.Sy tty
option, then background jobs stop when they try to produce output like they do
when they try to read input.
-.sp
-.LP
-A job pool is a collection of jobs started with \fIlist\fR \fB&\fR associated
-with a name.
-.sp
-.LP
-There are several ways to refer to jobs in the shell. A job can be referred to
+.Pp
+A job pool is a collection of jobs started with
+.Ar list Sy &
+associated with a name.
+.Pp
+There are several ways to refer to jobs in the shell.
+A job can be referred to
by the process id of any process of the job or by one of the following:
-.sp
-.ne 2
-.na
-\fB%\fR\fInumber\fR
-.ad
-.RS 12n
+.Bl -tag -width Ar
+.It Sy % Ns Ar number
The job with the specified number.
-.RE
-
-.sp
-.ne 2
-.na
-\fIpool\fR
-.ad
-.RS 12n
-All the jobs in the job pool named by \fIpool\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fIpool\fR\fB.\fR\fInumber\fR
-.ad
-.RS 12n
-The job number \fInumber\fR in the pool named by \fIpool\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fB%\fR\fIstring\fR
-.ad
-.RS 12n
-Any job whose command line begins with \fIstring\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fB%?\fR\fIstring\fR
-.ad
-.RS 12n
-Any job whose command line contains \fIstring\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fB%%\fR
-.ad
-.RS 12n
+.It Ar pool
+All the jobs in the job pool named by
+.Ar pool .
+.It Ar pool Ns Sy \&. Ns Ar number
+The job number
+.Ar number
+in the pool named by
+.Ar pool .
+.It Sy % Ns Ar string
+Any job whose command line begins with
+.Ar string .
+.It Sy %? Ns Ar string
+Any job whose command line contains
+.Ar string .
+.It Sy %%
Current job.
-.RE
-
-.sp
-.ne 2
-.na
-\fB%+\fR
-.ad
-.RS 12n
-Equivalent to \fB%%\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fB%-\fR
-.ad
-.RS 12n
+.It Sy %+
+Equivalent to
+.Sy %% .
+.It Sy %-
Previous job.
-.RE
-
-.sp
-.ne 2
-In addition, unless noted otherwise, wherever a job can be specified,
-the name of a background job pool can be used to represent all the
-jobs in that pool.
-.na
-.ad
-
-.sp
-.LP
-The shell learns immediately whenever a process changes state. It normally
-informs you whenever a job becomes blocked so that no further progress is
-possible, but only just before it prints a prompt. This is done so that it does
-not otherwise disturb your work. The notify option of the \fBset\fR command
-causes the shell to print these job change messages as soon as they occur.
-.sp
-.LP
-When the \fBmonitor\fR option is on, each background job that completes
-triggers any trap set for \fBCHLD\fR.
-.sp
-.LP
+.El
+.Pp
+In addition, unless noted otherwise, wherever a job can be specified, the name
+of a background job pool can be used to represent all the jobs in that pool.
+.Pp
+The shell learns immediately whenever a process changes state.
+It normally informs you whenever a job becomes blocked so that no further
+progress is possible, but only just before it prints a prompt.
+This is done so that it does not otherwise disturb your work.
+The notify option of the
+.Ic set
+command causes the shell to print these job change messages as soon as they
+occur.
+.Pp
+When the
+.Sy monitor
+option is on, each background job that completes triggers any trap set for
+.Dv CHLD .
+.Pp
When you try to leave the shell while jobs are running or stopped, you are
-warned that \fBYou have stopped(running) jobs.\fR You can use the \fBjobs\fR
-command to see what they are. If you immediately try to exit again, the shell
-does not warn you a second time, and the stopped jobs are terminated. When a
-login shell receives a \fBHUP\fR signal, it sends a \fBHUP\fR signal to each
-job that has not been disowned with the \fBdisown\fR built-in command.
-.SS "Signals"
-The \fBINT\fR and \fBQUIT\fR signals for an invoked command are ignored if the
-command is followed by \fB&\fR and the \fBmonitor\fR option is not active.
-Otherwise, signals have the values inherited by the shell from its parent. See
-the \fBtrap\fR built-in command.
-.SS "Execution"
-Each time a command is read, the substitutions are carried out. If the command
-name matches one of the ones in the \fBSpecial Built-in Commands\fR section of
-this manual page, it is executed within the current shell process. Next, the
-command name is checked to see if it matches a user defined function. If it
-does, the positional parameters are saved and then reset to the arguments of
-the function call. A function is also executed in the current shell process.
+warned that
+.Pp
+.D1 You have stopped(running) jobs.
+.Pp
+You can use the
+.Ic jobs
+command to see what they are.
+If you immediately try to exit again, the shell does not warn you a second
+time, and the stopped jobs are terminated.
+When a login shell receives a
+.Sy HUP
+signal, it sends a
+.Sy HUP
+signal to each job that has not been disowned with the
+.Ic disown
+built-in command.
+.Ss "Signals"
+The
+.Sy INT
+and
+.Sy QUIT
+signals for an invoked command are ignored if the command is followed by
+.Sy \&&
+and the
+.Sy monitor
+option is not active.
+Otherwise, signals have the values inherited by the shell from its parent.
+See the
+.Ic trap
+built-in command.
+.Ss "Execution"
+Each time a command is read, the substitutions are carried out.
+If the command name matches one of the ones in the
+.Sx Special Built-in Commands
+section of this manual page, it is executed within the current shell process.
+Next, the command name is checked to see if it matches a user defined function.
+If it does, the positional parameters are saved and then reset to the arguments
+of the function call.
+A function is also executed in the current shell process.
When the function completes or issues a return, the positional parameter list
-is restored. For functions defined with the \fBfunction\fR \fBname\fR syntax,
-any trap set on \fBEXIT\fR within the function is executed. The exit value of a
-function is the value of the last command executed. If a command name is not a
-special built-in command or a user defined function, but it is one of the
-built-in commands, it is executed in the current shell process.
-.sp
-.LP
-The shell variables \fBPATH\fR and \fBFPATH\fR define the search path for the
-directory containing the command. Alternative directory names are separated by
-a colon (\fB:\fR). The default path is \fB/bin:/usr/bin:\fR, specifying
-\fB/bin\fR, \fB/usr/bin\fR, and the current directory in that order. The
-current directory can be specified by two or more adjacent colons, or by a
-colon at the beginning or end of the path list. If the command name contains a
-slash (\fB/\fR), the search path is not used. Otherwise, each directory in the
-list of directories defined by \fBPATH\fR and \fBFPATH\fR is checked in order.
-If the directory being searched is contained in the value of the \fBFPATH\fR
+is restored.
+For functions defined with the
+.Ic function Ar name
+syntax, any trap set on
+.Dv EXIT
+within the function is executed.
+The exit value of a function is the value of the last command executed.
+If a command name is not a special built-in command or a user defined function,
+but it is one of the built-in commands, it is executed in the current shell
+process.
+.Pp
+The shell variables
+.Ev PATH
+and
+.Ev FPATH
+define the search path for the directory containing the command.
+Alternative directory names are separated by a colon
+.Pq Sy \&: .
+The default path is
+.Pa /bin Ns Sy \&: Ns Pa /usr/bin Ns Sy \&: ,
+specifying
+.Pa /bin ,
+.Pa /usr/bin ,
+and the current directory in that order.
+The current directory can be specified by two or more adjacent colons, or by a
+colon at the beginning or end of the path list.
+If the command name contains a slash
+.Pq Sy \&/ ,
+the search path is not used.
+Otherwise, each directory in the list of directories defined by
+.Ev PATH
+and
+.Ev FPATH
+is checked in order.
+If the directory being searched is contained in the value of the
+.Ev FPATH
variable and contains a file whose name matches the command being searched,
then this file is loaded into the current shell environment as if it were the
-argument to the . command except that only preset aliases are expanded, and a
-function of the specified name is executed as described in this manual page.
-.sp
-.LP
-If this directory is not in \fBFPATH\fR, the shell first determines whether
-there is a built-in version of a command corresponding to a given pathname and,
-if so, it is invoked in the current process. If no built-in is found, the shell
-checks for a file named \fB\&.paths\fR in this directory. If found and there is
-a line of the form:
-.sp
-.in +2
-\fBFPATH=\fR\fIpath\fR
-.in -2
-.sp
-where \fIpath\fR is an existing directory, then that directory is searched
-immediately after the current directory as if it were found in the \fBFPATH\fR
-variable. If \fIpath\fR does not begin with \fB/\fR, it is checked for relative
-to the directory being searched.
-.sp
-.LP
-The \fB\&.paths\fR file is then checked for a line of the form:
-.sp
-.in +2
-\fBPLUGIN_LIB=\fR\fIlibname\fR [ \fB:\fR \fIlibname\fR \fB]\fR ...
-.in -2
-.sp
-Each library named by \fIlibname\fR will be searched for as if it were an
-option argument to \fBbuiltin -f\fR and, if it contains a built-in of the
-specified name, this is executed instead of a command by this name.
-.sp
-.LP
+argument to the
+.Ic \&.
+command except that only preset aliases are expanded, and a function of the
+specified name is executed as described in this manual page.
+.Pp
+If this directory is not in
+.Ev FPATH ,
+the shell first determines whether there is a built-in version of a command
+corresponding to a given pathname and, if so, it is invoked in the current
+process.
+If no built-in is found, the shell checks for a file named
+.Pa \&.paths
+in this directory.
+If found and there is a line of the form:
+.Pp
+.D1 Ev FPATH Ns = Ns Ar path
+.Pp
+where
+.Ar path
+is an existing directory, then that directory is searched immediately after the
+current directory as if it were found in the
+.Ev FPATH
+variable.
+If
+.Ar path
+does not begin with
+.Sy / ,
+it is checked for relative to the directory being searched.
+.Pp
+The
+.Pa \&.paths
+file is then checked for a line of the form:
+.Pp
+.D1 Ev PLUGIN_LIB Ns = Ns Ar libname Ns Oo Sy \&: Ns Ar libname Oc Ns No ...
+.Pp
+Each library named by
+.Ar libname
+will be searched for as if it were an option argument to
+.Ic builtin Fl f
+and, if it contains a built-in of the specified name, this is executed instead
+of a command by this name.
+.Pp
Any built-in loaded from a library found this way will be associated with the
-directory containing the \fB.paths\fR file so it will only execute if not found
-in an earlier directory.
-.sp
-.LP
+directory containing the
+.Pa \&.paths
+file so it will only execute if not found in an earlier directory.
+.Pp
Finally, the directory will be checked for a file of the given name.
-If the file has execute permission but is not an \fBa.out\fR file, it is
-assumed to be a file containing shell commands. A separate shell is spawned to
-read it. All non-exported variables are removed in this case. If the shell
-command file doesn't have read permission, and/or if the \fBsetuid\fR and
-\fBsetgid\fR bits are set on the file, then the shell executes an agent whose
-job it is to set up the permissions and execute the shell with the shell
-command file passed down as an open file.
-
-If the \fB.paths\fR contains a line of the form:
-.sp
-.in +2
-\fBname=\fR\fIvalue\fR
-.in -2
-.sp
+If the file has execute permission but is not an
+.Pa a.out
+file, it is assumed to be a file containing shell commands.
+A separate shell is spawned to read it.
+All non-exported variables are removed in this case.
+If the shell command file doesn't have read permission, and/or if the
+.Sy setuid
+and
+.Sy setgid
+bits are set on the file, then the shell executes an agent whose job it is to
+set up the permissions and execute the shell with the shell command file passed
+down as an open file.
+If the
+.Pa \&.paths
+contains a line of the form:
+.Pp
+.D1 Sy name= Ns Ar value
+.Pp
in the
-first or second line, then the environment variable \fIname\fR is modified by
-prepending the directory specified by \fIvalue\fR to the directory list. If
-\fIvalue\fR is not an absolute directory, then it specifies a directory
-relative to the directory in which the executable was found. If the environment
-variable \fIname\fR does not already exist it will be added to the environment
-list for the specified command.
-
+first or second line, then the environment variable
+.Ar name
+is modified by prepending the directory specified by
+.Ar value
+to the directory list.
+If
+.Ar value
+is not an absolute directory, then it specifies a directory relative to the
+directory in which the executable was found.
+If the environment variable
+.Ev name
+does not already exist it will be added to the environment list for the
+specified command.
A parenthesized command is executed in a sub-shell without removing
non-exported variables.
-
-.SS "Command Re-entry"
-The text of the last \fBHISTSIZE\fR (default 512) commands entered from a
-terminal device is saved in a history file. The file \fB$HOME/.sh_history\fR is
-used if the \fBHISTFILE\fR variable is not set or if the file it names is not
-writable. A shell can access the commands of all interactive shells which use
-the same named \fBHISTFILE\fR. The built-in command \fBhist\fR is used to list
-or edit a portion of this file. The portion of the file to be edited or listed
-can be selected by number or by giving the first character or characters of the
-command. A single command or range of commands can be specified. If you do not
-specify an editor program as an argument to \fBhist\fR then the value of the
-variable \fBHISTEDIT\fR is used. If \fBHISTEDIT\fR is unset, the obsolete
-variable \fBFCEDIT\fR is used. If \fBFCEDIT\fR is not defined, then
-\fB/bin/ed\fR is used. The edited commands are printed and executed again upon
-leaving the editor unless you quit without writing. The \fB-s\fR option (and in
-obsolete versions, the editor name \fB-\fR) is used to skip the editing phase
-and to re-execute the command. In this case a substitution parameter of the
-form \fIold\fR\fB=\fR\fInew\fRcan be used to modify the command before
-execution. For example, with the preset alias \fBr\fR, which is aliased to
-\fB\&'hist -s'\fR, typing \fB`r bad=good c'\fR re-executes the most recent
-command which starts with the letter \fBc\fR, replacing the first occurrence of
-the string bad with the string good.
-.SS "Inline Editing Options"
+.Ss "Command Re-entry"
+The text of the last
+.Ev HISTSIZE
+.Pq default 512
+commands entered from a terminal device is saved in a history file.
+The file
+.Pa $HOME/.sh_history
+is used if the
+.Ev HISTFILE
+variable is not set or if the file it names is not writable.
+A shell can access the commands of all interactive shells which use the same
+named
+.Ev HISTFILE .
+The built-in command
+.Ic hist
+is used to list or edit a portion of this file.
+The portion of the file to be edited or listed can be selected by number or by
+giving the first character or characters of the command.
+A single command or range of commands can be specified.
+If you do not specify an editor program as an argument to
+.Ic hist
+then the value of the variable
+.Ev HISTEDIT
+is used.
+If
+.Ev HISTEDIT
+is unset, the obsolete variable
+.Ev FCEDIT
+is used.
+If
+.Ev FCEDIT
+is not defined, then
+.Pa /bin/ed
+is used.
+The edited commands are printed and executed again upon leaving the editor
+unless you quit without writing.
+The
+.Fl s
+option
+.Pq and in obsolete versions, the editor name Sy \&-
+is used to skip the editing phase and to re-execute the command.
+In this case a substitution parameter of the form
+.Ar old Ns Sy = Ns Ar new
+can be used to modify the command before execution.
+For example, with the preset alias
+.Ic r ,
+which is aliased to
+.Ic hist -s ,
+typing
+.Sq r bad=good c
+re-executes the most recent
+command which starts with the letter
+.Sy c ,
+replacing the first occurrence of the string
+.Sq bad
+with the string
+.Sq good .
+.Ss "Inline Editing Options"
Normally, each command line entered from a terminal device is simply typed
-followed by a NEWLINE (RETURN or LINE FEED). If either the \fBemacs\fR,
-\fBgmacs\fR, or \fBvi\fR option is active, the user can edit the command line.
-To be in either of these edit modes set the corresponding option. An editing
-option is automatically selected each time the \fBVISUAL\fR or \fBEDITOR\fR
+followed by a NEWLINE (RETURN or LINE FEED).
+If either the
+.Sy emacs ,
+.Sy gmacs ,
+or
+.Sy vi
+option is active, the user can edit the command line.
+To be in either of these edit modes set the corresponding option.
+An editing option is automatically selected each time the
+.Ev VISUAL
+or
+.Ev EDITOR
variable is assigned a value ending in either of these option names.
-.sp
-.LP
+.Pp
The editing features require that the user's terminal accept RETURN as carriage
return without line feed and that a SPACE must overwrite the current character
on the screen.
-.sp
-.LP
-Unless the \fBmultiline\fR option is on, the editing modes implement a concept
-where the user is looking through a window at the current line. The window
-width is the value of \fBCOLUMNS\fR if it is defined, otherwise \fB80\fR. If
-the window width is too small to display the prompt and leave at least 8
-columns to enter input, the prompt is truncated from the left. If the line is
-longer than the window width minus two, a mark is displayed at the end of the
-window to notify the user. As the cursor moves and reaches the window
-boundaries the window is centered about the cursor. The mark is a \fB>\fR
-(\fB<, *\fR) if the line extends on the right , left, or both sides of the
-window.
-.sp
-.LP
-The search commands in each edit mode provide access to the history file. Only
-strings are matched, not patterns, although a leading \fB^\fR in the string
-restricts the match to begin at the first character in the line.
-.sp
-.LP
+.Pp
+Unless the
+.Sy multiline
+option is on, the editing modes implement a concept where the user is looking
+through a window at the current line.
+The window width is the value of
+.Ev COLUMNS
+if it is defined, otherwise
+.Sy 80 .
+If the window width is too small to display the prompt and leave at least 8
+columns to enter input, the prompt is truncated from the left.
+If the line is longer than the window width minus two, a mark is displayed at
+the end of the window to notify the user.
+As the cursor moves and reaches the window boundaries the window is centered
+about the cursor.
+The mark is a
+.Sy >
+.Pq Sy \&< Ns \&, Sy \&*
+if the line extends on the right, left, or both sides of the window.
+.Pp
+The search commands in each edit mode provide access to the history file.
+Only strings are matched, not patterns, although a leading
+.Sy ^
+in the string restricts the match to begin at the first character in the line.
+.Pp
Each of the edit modes has an operation to list the files or commands that
-match a partially entered word. When applied to the first word on the line, or
-the first word after a \fB;\fR, \fB|\fR, \fB&\fR, or \fB(\fR, and the word does
-not begin with \fB~\fR or contain a \fB/\fR, the list of aliases, functions,
-and executable commands defined by the \fBPATH\fR variable that could match the
-partial word is displayed. Otherwise, the list of files that match the
-specified word is displayed. If the partially entered word does not contain any
-file expansion characters, a \fB*\fR is appended before generating these lists.
-After displaying the generated list, the input line is redrawn. These
-operations are called command name listing and file name listing, respectively.
+match a partially entered word.
+When applied to the first word on the line, or the first word after a
+.Sy \&; ,
+.Sy \&| ,
+.Sy \&& ,
+or
+.Sy \&( ,
+and the word does not begin with
+.Sy \&~
+or contain a
+.Sy \&/ ,
+the list of aliases, functions, and executable commands defined by the
+.Ev PATH
+variable that could match the partial word is displayed.
+Otherwise, the list of files that match the specified word is displayed.
+If the partially entered word does not contain any file expansion characters, a
+.Sy *
+is appended before generating these lists.
+After displaying the generated list, the input line is redrawn.
+These operations are called command name listing and file name listing,
+respectively.
There are additional operations, referred to as command name completion and
file name completion, which compute the list of matching commands or files, but
instead of printing the list, replace the current word with a complete or
-partial match. For file name completion, if the match is unique, a \fB/\fR is
-appended if the file is a directory and a space is appended if the file is not
-a directory. Otherwise, the longest common prefix for all the matching files
-replaces the word. For command name completion, only the portion of the file
-names after the last \fB/\fR are used to find the longest command prefix. If
-only a single name matches this prefix, then the word is replaced with the
-command name followed by a space. When using a \fBTAB\fR for completion that
-does not yield a unique match, a subsequent TAB provides a numbered list of
-matching alternatives. A specific selection can be made by entering the
-selection number followed by a TAB.
-.SS "Key Bindings"
-The \fBKEYBD\fR trap can be used to intercept keys as they are typed and change
-the characters that are actually seen by the shell. This trap is executed after
-each character (or sequence of characters when the first character is ESC) is
-entered while reading from a terminal.
-.sp
-.LP
-The variable \fB\&.sh.edchar\fR contains the character or character sequence
-which generated the trap. Changing the value of \fB\&.sh.edchar\fR in the trap
-action causes the shell to behave as if the new value were entered from the
-keyboard rather than the original value. The variable \fB\&.sh.edcol\fR is set
-to the input column number of the cursor at the time of the input. The variable
-\fB\&.sh.edmode\fR is set to \fBESC\fR when in \fBvi\fR insert mode and is null
-otherwise. By prepending \fB${.sh.editmode}\fR to a value assigned to
-\fB\&.sh.edchar\fR it causes the shell to change to control mode if it is not
-already in this mode.
-.sp
-.LP
+partial match.
+For file name completion, if the match is unique, a
+.Sy /
+is appended if the file is a directory and a space is appended if the file is
+not a directory.
+Otherwise, the longest common prefix for all the matching files replaces the
+word.
+For command name completion, only the portion of the file names after the last
+.Sy /
+are used to find the longest command prefix.
+If only a single name matches this prefix, then the word is replaced with the
+command name followed by a space.
+When using a
+.Dv TAB
+for completion that does not yield a unique match, a subsequent
+.Dv TAB
+provides a numbered list of matching alternatives.
+A specific selection can be made by entering the selection number followed by a
+.Dv TAB .
+.Ss "Key Bindings"
+The
+.Sy KEYBD
+trap can be used to intercept keys as they are typed and change the characters
+that are actually seen by the shell.
+This trap is executed after each character (or sequence of characters when the
+first character is ESC) is entered while reading from a terminal.
+.Pp
+The variable
+.Sy \&.sh.edchar
+contains the character or character sequence which generated the trap.
+Changing the value of
+.Sy \&.sh.edchar
+in the trap action causes the shell to behave as if the new value were entered
+from the keyboard rather than the original value.
+The variable
+.Sy \&.sh.edcol
+is set to the input column number of the cursor at the time of the input.
+The variable
+.Sy \&.sh.edmode
+is set to
+.Sy ESC
+when in
+.Sy vi
+insert mode and is null otherwise.
+By prepending
+.Sy ${.sh.editmode}
+to a value assigned to
+.Sy \&.sh.edchar
+it causes the shell to change to control mode if it is not already in this
+mode.
+.Pp
This trap is not invoked for characters entered as arguments to editing
directives, or while reading input for a character search.
-.SS "\fBemacs\fR Editing Mode"
-This mode is entered by enabling either the \fBemacs\fR or \fBgmacs\fR option.
-The only difference between these two modes is the way they handle \fB^T\fR. To
-edit, the user moves the cursor to the point needing correction and then
-inserts or deletes characters or words as needed. All the editing commands are
-control characters or escape sequences. The notation for control characters is
-caret (\fB^\fR) followed by the character.
-.sp
-.LP
-For example, \fB^F\fR is the notation for CTRL/F. This is entered by depressing
-\fBf\fR while holding down the CTRL (control) key. The SHIFT key is not
-depressed. (The notation \fB^?\fR indicates the DEL (delete) key.)
-.sp
-.LP
-The notation for escape sequences is \fBM-\fR followed by a character. For
-example, \fBM-f\fR (pronounced \fBMeta f\fR) is entered by depressing ESC
-(\fBASCII 033\fR) followed by \fBf\fR. \fBM-F\fR is the notation for ESC
-followed by \fBF\fR.
-.sp
-.LP
+.Ss "emacs Editing Mode"
+This mode is entered by enabling either the
+.Sy emacs
+or
+.Sy gmacs
+option.
+The only difference between these two modes is the way they handle
+.Sy ^T .
+To edit, the user moves the cursor to the point needing correction and then
+inserts or deletes characters or words as needed.
+All the editing commands are control characters or escape sequences.
+.Pp
+The notation for control characters is caret
+.Pq Sy ^
+followed by the character.
+.Pp
+For example,
+.Sy ^F
+is the notation for CTRL/F.
+This is entered by depressing
+.Sy f
+while holding down the CTRL (control) key.
+The SHIFT key is not depressed.
+(The notation
+.Sy ^?
+indicates the DEL (delete) key).
+.Pp
+The notation for escape sequences is
+.Sy M-
+followed by a character.
+For example,
+.Sy M-f
+.Pq pronounced Sy Meta f
+is entered by depressing ESC
+.Pq Sy ASCII 033
+followed by
+.Ql f .
+.Sy M-F
+is the notation for ESC followed by
+.Ql F .
+.Pp
All edit commands operate from any place on the line, not just at the
-beginning. The RETURN or the LINE FEED key is not entered after edit commands
-except when noted.
-.sp
-.ne 2
-.na
-\fB^F\fR
-.ad
-.RS 13n
+beginning.
+The RETURN or the LINE FEED key is not entered after edit commands except when
+noted.
+.Bl -tag -width Ar
+.It Sy ^F
Move the cursor forward (right) one character.
-.RE
-
-.sp
-.ne 2
-.na
-\fBM-[C\fR
-.ad
-.RS 13n
+.It Sy M-[C
Move the cursor forward (right) one character.
-.RE
-
-.sp
-.ne 2
-.na
-\fBM-f\fR
-.ad
-.RS 13n
-Move the cursor forward one word. The \fBemacs\fR editor's idea of a word is a
-string of characters consisting of only letters, digits and underscores.
-.RE
-
-.sp
-.ne 2
-.na
-\fB^B\fR
-.ad
-.RS 13n
+.It Sy M-f
+Move the cursor forward one word.
+The
+.Sy emacs
+editor's idea of a word is a string of characters consisting of only letters,
+digits and underscores.
+.It Sy ^B
Move the cursor backward (left) one character.
-.RE
-
-.sp
-.ne 2
-.na
-\fBM-[D\fR
-.ad
-.RS 13n
+.It Sy M-[D
Move the cursor backward (left) one character.
-.RE
-
-.sp
-.ne 2
-.na
-\fBM-b\fR
-.ad
-.RS 13n
+.It Sy M-b
Move the cursor backward one word.
-.RE
-
-.sp
-.ne 2
-.na
-\fB^A\fR
-.ad
-.RS 13n
+.It Sy ^A
Move the cursor to the beginning of the line.
-.RE
-
-.sp
-.ne 2
-.na
-\fBM-[H\fR
-.ad
-.RS 13n
+.It Sy M-[H
Move the cursor to the beginning of the line.
-.RE
-
-.sp
-.ne 2
-.na
-\fB^E\fR
-.ad
-.RS 13n
+.It Sy ^E
Move the cursor to the end of the line.
-.RE
-
-.sp
-.ne 2
-.na
-\fBM-[Y\fR
-.ad
-.RS 13n
+.It Sy M-[Y
Move the cursor to the end of line.
-.RE
-
-.sp
-.ne 2
-.na
-\fB^]\fR\fIchar\fR
-.ad
-.RS 13n
-Move the cursor forward to the character \fIchar\fR on the current line.
-.RE
-
-.sp
-.ne 2
-.na
-\fBM-^]\fR\fIchar\fR
-.ad
-.RS 13n
-Move the cursor backwards to the character \fIchar\fR on the current line.
-.RE
-
-.sp
-.ne 2
-.na
-\fB^X^X\fR
-.ad
-.RS 13n
+.It Sy ^] Ns Ar char
+Move the cursor forward to the character
+.Ar char
+on the current line.
+.It Sy M-^\&] Ns Ar char
+Move the cursor backwards to the character
+.Ar char
+on the current line.
+.It Sy ^X^X
Interchange the cursor and the mark.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fIerase\fR
-.ad
-.RS 13n
-Delete the previous character. The user-defined erase character is defined by
-the \fBstty\fR(1) command, and is usually \fB^H\fR or \fB#\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fIlnext\fR
-.ad
-.RS 13n
-Removes the next character's editing features. The user-defined literal next
-character is defined by the \fBstty\fR(1) command, or is \fB^V\fR if not
-defined.
-.RE
-
-.sp
-.ne 2
-.na
-\fB^D\fR
-.ad
-.RS 13n
+.It Ar erase
+Delete the previous character.
+The user-defined erase character is defined by the
+.Xr stty 1
+command, and is usually
+.Sy ^H
+or
+.Sy # .
+.It Ar lnext
+Removes the next character's editing features.
+The user-defined literal next character is defined by the
+.Xr stty 1
+command, or is
+.Sy ^V
+if not defined.
+.It Sy ^D
Delete the current character.
-.RE
-
-.sp
-.ne 2
-.na
-\fBM-d\fR
-.ad
-.RS 13n
+.It Sy M-d
Delete the current word.
-.RE
-
-.sp
-.ne 2
-.na
-\fBM-^H\fR
-.ad
-.RS 13n
-MetaBACKSPACE. Delete the previous word.
-.RE
-
-.sp
-.ne 2
-.na
-\fBM-h\fR
-.ad
-.RS 13n
+.It Sy M-^H
+MetaBACKSPACE.
Delete the previous word.
-.RE
-
-.sp
-.ne 2
-.na
-\fBM-^?\fR
-.ad
-.RS 13n
-MetaDEL. Delete the previous word. If your interrupt character is \fB^?\fR
+.It Sy M-h
+Delete the previous word.
+.It Sy M-^\&?
+MetaDEL.
+Delete the previous word.
+If your interrupt character is
+.Sy ^?
(DEL, the default), this command does not work.
-.RE
-
-.sp
-.ne 2
-.na
-\fB^T\fR
-.ad
-.RS 13n
+.It Sy ^T
Transpose the current character with the previous character, and advance the
-cursor in \fBemacs\fR mode. Transpose two previous characters in \fBgmacs\fR
+cursor in
+.Sy emacs
mode.
-.RE
-
-.sp
-.ne 2
-.na
-\fB^C\fR
-.ad
-.RS 13n
+Transpose two previous characters in
+.Sy gmacs
+mode.
+.It Sy ^C
Capitalize the current character.
-.RE
-
-.sp
-.ne 2
-.na
-\fBM-c\fR
-.ad
-.RS 13n
+.It Sy M-c
Capitalize the current word.
-.RE
-
-.sp
-.ne 2
-.na
-\fBM-l\fR
-.ad
-.RS 13n
+.It Sy M-l
Change the current word to lower case.
-.RE
-
-.sp
-.ne 2
-.na
-\fB^K\fR
-.ad
-.RS 13n
-Delete from the cursor to the end of the line. If preceded by a numerical
-parameter whose value is less than the current cursor position, delete from
-specified position up to the cursor. If preceded by a numerical parameter whose
-value is greater than the current cursor position, then delete from cursor up
-to specified cursor position.
-.RE
-
-.sp
-.ne 2
-.na
-\fB^W\fR
-.ad
-.RS 13n
+.It Sy ^K
+Delete from the cursor to the end of the line.
+If preceded by a numerical parameter whose value is less than the current
+cursor position, delete from specified position up to the cursor.
+If preceded by a numerical parameter whose value is greater than the current
+cursor position, then delete from cursor up to specified cursor position.
+.It Sy ^W
Kill from the cursor to the mark.
-.RE
-
-.sp
-.ne 2
-.na
-\fBM-p\fR
-.ad
-.RS 13n
+.It Sy M-p
Push the region from the cursor to the mark on the stack.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fIkill\fR
-.ad
-.RS 13n
-Kill the entire current line. The user-defined kill character is defined by the
-\fBstty\fR(1) command, usually a \fB^G\fR or \fB@\fR. If two kill characters
-are entered in succession, all kill characters from then on cause a line feed.
+.It Ar kill
+Kill the entire current line.
+The user-defined kill character is defined by the
+.Xr stty 1
+command, usually a
+.Sy ^G
+or
+.Sy @ .
+If two kill characters are entered in succession, all kill characters from then
+on cause a line feed.
This is useful when using paper terminals.
-.RE
-
-.sp
-.ne 2
-.na
-\fB^Y\fR
-.ad
-.RS 13n
-Restore the last item removed from line. Yank the item back to the line.
-.RE
-
-.sp
-.ne 2
-.na
-\fB^L\fR
-.ad
-.RS 13n
+.It Sy ^Y
+Restore the last item removed from line.
+Yank the item back to the line.
+.It Sy ^L
Line feed and print the current line.
-.RE
-
-.sp
-.ne 2
-.na
-\fBM-^L\fR
-.ad
-.RS 13n
+.It Sy M-^L
Clear the screen.
-.RE
-
-.sp
-.ne 2
-.na
-\fB^@\fR
-.ad
-.RS 13n
-Null character. Set mark.
-.RE
-
-.sp
-.ne 2
-.na
-\fBM-\fR\fIspace\fR
-.ad
-.RS 13n
-MetaSPACE. Set the mark.
-.RE
-
-.sp
-.ne 2
-.na
-\fB^J\fR
-.ad
-.RS 13n
-New line. Execute the current line.
-.RE
-
-.sp
-.ne 2
-.na
-\fB^M\fR
-.ad
-.RS 13n
-Return. Execute the current line.
-.RE
-
-.sp
-.ne 2
-.na
-\fBEOF\fR
-.ad
-.RS 13n
-End-of-file character, normally \fB^D\fR, is processed as an \fBend-of-file\fR
+.It Sy ^@
+Null character.
+Set mark.
+.It Sy M- Ns Ar space
+MetaSPACE.
+Set the mark.
+.It Sy ^J
+New line.
+Execute the current line.
+.It Sy ^M
+Return.
+Execute the current line.
+.It Sy EOF
+End-of-file character, normally
+.Sy ^D ,
+is processed as an
+.Sy end-of-file
only if the current line is null.
-.RE
-
-.sp
-.ne 2
-.na
-\fB^P\fR
-.ad
-.RS 13n
-Fetch the previous command. Each time \fB^P\fR is entered the previous command
-back in time is accessed. Moves back one line when it is not on the first line
-of a multi-line command.
-.RE
-
-.sp
-.ne 2
-.na
-\fBM-[A\fR
-.ad
-.RS 13n
-Equivalent to \fB^P\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBM-<\fR
-.ad
-.RS 13n
+.It Sy ^P
+Fetch the previous command.
+Each time
+.Sy ^P
+is entered the previous command back in time is accessed.
+Moves back one line when it is not on the first line of a multi-line command.
+.It Sy M-[A
+.ad
+Equivalent to
+.Sy ^P .
+.It Sy M-<
Fetch the least recent (oldest) history line.
-.RE
-
-.sp
-.ne 2
-.na
-\fBM->\fR
-.ad
-.RS 13n
+.It Sy M->
Fetch the most recent (youngest) history line.
-.RE
-
-.sp
-.ne 2
-.na
-\fB^N\fR
-.ad
-.RS 13n
-Fetch the next command line. Each time \fB^N\fR is entered the next command
-line forward in time is accessed.
-.RE
-
-.sp
-.ne 2
-.na
-\fBM-[B\fR
-.ad
-.RS 13n
-Equivalent to \fB^N\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fB^R\fR\fIstring\fR
-.ad
-.RS 13n
-Reverse search history for a previous command line containing \fIstring\fR. If
-a parameter of zero is specified, the search is forward. \fIstring\fR is
-terminated by a RETURN or NEWLINE. If string is preceded by a \fB^\fR, the
-matched line must begin with \fIstring\fR. If \fIstring\fR is omitted, then the
-next command line containing the most recent \fIstring\fR is accessed. In this
-case a parameter of zero reverses the direction of the search.
-.RE
-
-.sp
-.ne 2
-.na
-\fB^O\fR
-.ad
-.RS 13n
-Operate. Execute the current line and fetch the next line relative to current
-line from the history file.
-.RE
-
-.sp
-.ne 2
-.na
-\fBM-\fR\fIdigits\fR
-.ad
-.RS 13n
-Escape. Define numeric parameter. The digits are taken as a parameter to the
-next command. The commands that accept a parameter are: \fB^F\fR, \fB^B\fR,
-\fBERASE\fR, \fB^C\fR, \fB^D\fR, \fB^K\fR, \fB^R\fR, \fB^P\fR, \fB^N\fR,
-\fB^]\fR, \fBM-.\fR, \fBM-\fR, \fBM-^]\fR, \fBM-_\fR, \fBM-=\fR, \fBM-b\fR,
-\fBM-c\fR, \fBM-d\fR, \fBM-f\fR, \fBM-h\fR, \fBM-l\fR, and \fBM-^H\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBM-\fR\fIletter\fR
-.ad
-.RS 13n
-Soft-key. Search the alias list for an alias by the name \fIletter\fR. If an
-alias of \fIletter\fR is defined, insert its value on the input queue.
-\fIletter\fR must not be one of the metafunctions in this section.
-.RE
-
-.sp
-.ne 2
-.na
-\fBM-[\fR\fIletter\fR
-.ad
-.RS 13n
-Soft key. Search the alias list for an alias by the name \fIletter\fR. If an
-alias of this name is defined, insert its value on the input queue. This can be
-used to program function keys on many terminals.
-.RE
-
-.sp
-.ne 2
-.na
-\fBM-.\fR
-.ad
-.RS 13n
-The last word of the previous command is inserted on the line. If preceded by a
-numeric parameter, the value of this parameter determines which word to insert
-rather than the last word.
-.RE
-
-.sp
-.ne 2
-.na
-\fBM-_\fR
-.ad
-.RS 13n
-Same as \fBM-.\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBM-*\fR
-.ad
-.RS 13n
-Attempt filename generation on the current word. As asterisk is appended if the
-word does not match any file or contain any special pattern characters.
-.RE
-
-.sp
-.ne 2
-.na
-\fBM-\fRESC\fR
-.ad
-.RS 13n
+.It Sy ^N
+Fetch the next command line.
+Each time
+.Sy ^N
+is entered the next command line forward in time is accessed.
+.It Sy M-[B
+Equivalent to
+.Sy ^N .
+.It Sy ^R Ns Ar string
+Reverse search history for a previous command line containing
+.Ar string .
+If a parameter of zero is specified, the search is forward.
+.Ar string
+is terminated by a RETURN or NEWLINE.
+If string is preceded by a
+.Sy ^ ,
+the matched line must begin with
+.Ar string .
+If
+.Ar string
+is omitted, then the next command line containing the most recent
+.Ar string
+is accessed.
+In this case a parameter of zero reverses the direction of the search.
+.It Sy ^O
+Operate.
+Execute the current line and fetch the next line relative to current line from
+the history file.
+.It Sy M- Ns Ar digits
+Escape.
+Define numeric parameter.
+The digits are taken as a parameter to the next command.
+The commands that accept a parameter are:
+.Sy ^F ,
+.Sy ^B ,
+.Sy ERASE ,
+.Sy ^C ,
+.Sy ^D ,
+.Sy ^K ,
+.Sy ^R ,
+.Sy ^P ,
+.Sy ^N ,
+.Sy ^] ,
+.Sy M-\&. ,
+.Sy M- ,
+.Sy M-^\&] ,
+.Sy M-_ ,
+.Sy M-= ,
+.Sy M-b ,
+.Sy M-c ,
+.Sy M-d ,
+.Sy M-f ,
+.Sy M-h ,
+.Sy M-l ,
+and
+.Sy M-^H .
+.It Sy M- Ns Ar letter
+Soft-key.
+Search the alias list for an alias by the name
+.Ar letter .
+If an alias of
+.Ar letter
+is defined, insert its value on the input queue.
+.Ar letter
+must not be one of the metafunctions in this section.
+.It Sy M-[ Ns Ar letter
+Soft key.
+Search the alias list for an alias by the name
+.Ar letter .
+If an alias of this name is defined, insert its value on the input queue.
+This can be used to program function keys on many terminals.
+.It Sy M-\&.
+The last word of the previous command is inserted on the line.
+If preceded by a numeric parameter, the value of this parameter determines
+which word to insert rather than the last word.
+.It Sy M-_
+Same as
+.Sy M-\&. .
+.It Sy M-*
+Attempt filename generation on the current word.
+As asterisk is appended if the word does not match any file or contain any
+special pattern characters.
+.It Sy M-ESC
Command or file name completion as described in this manual page.
-.RE
-
-.sp
-.ne 2
-.na
-\fB^I\fRTAB\fR
-.ad
-.RS 13n
-Attempts command or file name completion as described in this manual page. If a
-partial completion occurs, repeating this behaves as if \fBM-=\fR were entered.
+.It Sy ^I Pq TAB
+Attempts command or file name completion as described in this manual page.
+If a partial completion occurs, repeating this behaves as if
+.Sy M-=
+were entered.
If no match is found or entered after SPACE, a TAB is inserted.
-.RE
-
-.sp
-.ne 2
-.na
-\fBM-=\fR
-.ad
-.RS 13n
+.It Sy M-=
If not preceded by a numeric parameter, generates the list of matching commands
-or file names as described in this manual page. Otherwise, the word under the
-cursor is replaced by the item corresponding to the value of the numeric
-parameter from the most recently generated command or file list. If the cursor
-is not on a word, the word is inserted instead.
-.RE
-
-.sp
-.ne 2
-.na
-\fB^U\fR
-.ad
-.RS 13n
-Multiply parameter of next command by \fB4\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\e\fR
-.ad
-.RS 13n
-Escape the next character. Editing characters, the user's erase, kill and
-interrupt (normally \fB^?\fR) characters can be entered in a command line or in
-a search string if preceded by a \fB\e\fR\&. The \fB\e\fR removes the next
-character's editing features, if any.
-.RE
-
-.sp
-.ne 2
-.na
-\fBM-^V\fR
-.ad
-.RS 13n
+or file names as described in this manual page.
+Otherwise, the word under the cursor is replaced by the item corresponding to
+the value of the numeric parameter from the most recently generated command or
+file list.
+If the cursor is not on a word, the word is inserted instead.
+.It Sy ^U
+Multiply parameter of next command by
+.Sy 4 .
+.It Sy \e
+Escape the next character.
+Editing characters, the user's erase, kill and interrupt
+.Pq normally Sy ^?
+characters can be entered in a command line or in a search string if preceded
+by a
+.Sy \e .
+The
+.Sy \e
+removes the next character's editing features, if any.
+.It Sy M-^V
Display the version of the shell.
-.RE
-
-.sp
-.ne 2
-.na
-\fBM-#\fR
-.ad
-.RS 13n
-If the line does not begin with a \fB#\fR, a \fB#\fR is inserted at the
-beginning of the line and after each NEWLINE, and the line is entered. This
-causes a comment to be inserted in the history file. If the line begins with a
-\fB#\fR, the \fB#\fR is deleted and one \fB#\fR after each NEWLINE is also
-deleted.
-.RE
-
-.SS "\fBvi\fR Editing Mode"
-There are two typing modes. Initially, when you enter a command you are in the
-input mode. To edit, the user enters control mode by typing ESC (033) and moves
-the cursor to the point needing correction and then inserts or deletes
-characters or words as needed. Most control commands accept an optional repeat
-\fIcount\fR prior to the command.
-.sp
-.LP
+.It Sy M-#
+If the line does not begin with a
+.Sy # ,
+a
+.Sy #
+is inserted at the beginning of the line and after each NEWLINE, and the line
+is entered.
+This causes a comment to be inserted in the history file.
+If the line begins with a
+.Sy # ,
+the
+.Sy #
+is deleted and one
+.Sy #
+after each NEWLINE is also deleted.
+.El
+.Ss vi Editing Mode
+There are two typing modes.
+Initially, when you enter a command you are in the input mode.
+To edit, the user enters control mode by typing ESC (033) and moves the cursor
+to the point needing correction and then inserts or deletes characters or words
+as needed.
+Most control commands accept an optional repeat
+.Ar count
+prior to the command.
+.Pp
When in vi mode on most systems, canonical processing is initially enabled and
the command is echoed again if the speed is 1200 baud or greater and it
contains any control characters or less than one second has elapsed since the
-prompt was printed. The ESC character terminates canonical processing for the
-remainder of the command and the user can then modify the command line. This
-scheme has the advantages of canonical processing with the type-ahead echoing
-of raw mode.
-.sp
-.LP
-If the option \fBviraw\fR is also set, the terminal is always have canonical
-processing disabled. This mode is implicit for systems that do not support two
-alternate end of line delimiters, and might be helpful for certain terminals.
-.SS "Input Edit Commands"
+prompt was printed.
+The ESC character terminates canonical processing for the remainder of the
+command and the user can then modify the command line.
+This scheme has the advantages of canonical processing with the type-ahead
+echoing of raw mode.
+.Pp
+If the option
+.Sy viraw
+is also set, the terminal is always have canonical processing disabled.
+This mode is implicit for systems that do not support two alternate end of line
+delimiters, and might be helpful for certain terminals.
+.Ss "Input Edit Commands"
By default the editor is in input mode.
-.sp
-.LP
+.Pp
The following input edit commands are supported:
-.sp
-.ne 2
-.na
-\fBERASE\fR
-.ad
-.RS 10n
-User defined erase character as defined by the \fBstty\fR command, usually
-\fB^H\fR or \fB#\fR. Delete previous character.
-.RE
-
-.sp
-.ne 2
-.na
-\fB^W\fR
-.ad
-.RS 10n
-Delete the previous blank separated word. On some systems the \fBviraw\fR
+.Bl -tag -width Ds
+.It Sy ERASE
+User defined erase character as defined by the
+.Xr stty 1
+command, usually
+.Sy ^H
+or
+.Sy # .
+Delete previous character.
+.It Sy ^W
+Delete the previous blank separated word.
+On some systems the
+.Sy viraw
option might be required for this to work.
-.RE
-
-.sp
-.ne 2
-.na
-\fBEOF\fR
-.ad
-.RS 10n
+.It Sy EOF
As the first character of the line causes the shell to terminate unless the
-\fBignoreeof\fR option is set. Otherwise this character is ignored.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fIlnext\fR
-.ad
-.RS 10n
-User defined literal next character as defined by the \fBstty\fR(1) or \fB^V\fR
-if not defined. Removes the next character's editing features, if any. On some
-systems the \fBviraw\fR option might be required for this to work.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\e\fR
-.ad
-.RS 10n
+.Sy ignoreeof
+option is set.
+Otherwise this character is ignored.
+.It Ar lnext
+User defined literal next character as defined by
+.Xr stty 1
+or
+.Sy ^V
+if not defined.
+Removes the next character's editing features, if any.
+On some systems the
+.Sy viraw
+option might be required for this to work.
+.It Sy \e
Escape the next ERASE or KILL character.
-.RE
-
-.sp
-.ne 2
-.na
-\fB^I\fR TAB\fR
-.ad
-.RS 10n
+.It Sy ^I Pq TAB
Attempts command or file name completion as described in this manual page and
-returns to input mode. If a partial completion occurs, repeating this behaves
-as if \fB=\fR were entered from control mode. If no match is found or entered
-after SPACE, a TAB is inserted.
-.RE
-
-.SS "Motion Edit Commands"
+returns to input mode.
+If a partial completion occurs, repeating this behaves as if
+.Sy \&=
+were entered from control mode.
+If no match is found or entered after SPACE, a TAB is inserted.
+.El
+.Ss "Motion Edit Commands"
The motion edit commands move the cursor.
-.sp
-.LP
+.Pp
The following motion edit commands are supported:
-.sp
-.ne 2
-.na
-\fB[\fR\fIcount\fR\fB]l\fR
-.ad
-.RS 13n
+.Bl -tag -width Ar
+.It Oo Ar count Oc Ns Sy l
Move the cursor forward (right) one character.
-.RE
-
-.sp
-.ne 2
-.na
-\fB[\fR\fIcount\fR\fB][C\fR
-.ad
-.RS 13n
+.It Oo Ar count Oc Ns Sy [C
Move the cursor forward (right) one character.
-.RE
-
-.sp
-.ne 2
-.na
-\fB[\fR\fIcount\fR\fB]w\fR
-.ad
-.RS 13n
+.It Oo Ar count Oc Ns Sy w
Move the cursor forward one alphanumeric word.
-.RE
-
-.sp
-.ne 2
-.na
-\fB[\fR\fIcount\fR\fB]W\fR
-.ad
-.RS 13n
+.It Oo Ar count Oc Ns Sy W
Move the cursor to the beginning of the next word that follows a blank.
-.RE
-
-.sp
-.ne 2
-.na
-\fB[\fR\fIcount\fR\fB]e\fR
-.ad
-.RS 13n
+.It Oo Ar count Oc Ns Sy e
Move the cursor to the end of the word.
-.RE
-
-.sp
-.ne 2
-.na
-\fB[\fR\fIcount\fR\fB]E\fR
-.ad
-.RS 13n
+.It Oo Ar count Oc Ns Sy E
Move the cursor to the end of the current blank delimited word.
-.RE
-
-.sp
-.ne 2
-.na
-\fB[\fR\fIcount\fR\fB]h\fR
-.ad
-.RS 13n
+.It Oo Ar count Oc Ns Sy h
Move the cursor backward (left) one character.
-.RE
-
-.sp
-.ne 2
-.na
-\fB[\fR\fIcount\fR\fB][D\fR
-.ad
-.RS 13n
+.It Oo Ar count Oc Ns Sy [D
Move the cursor backward (left) one character.
-.RE
-
-.sp
-.ne 2
-.na
-\fB[\fR\fIcount\fR\fB]b\fR
-.ad
-.RS 13n
+.It Oo Ar count Oc Ns Sy b
Move the cursor backward one word.
-.RE
-
-.sp
-.ne 2
-.na
-\fB[\fR\fIcount\fR\fB]B\fR
-.ad
-.RS 13n
+.It Oo Ar count Oc Ns Sy B
Move the cursor to the preceding blank separated word.
-.RE
-
-.sp
-.ne 2
-.na
-\fB[\fR\fIcount\fR\fB]|\fR
-.ad
-.RS 13n
-Move the cursor to column \fIcount\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fB[\fR\fIcount\fR\fB]f\fR\fIc\fR
-.ad
-.RS 13n
-Find the next character \fIc\fR in the current line.
-.RE
-
-.sp
-.ne 2
-.na
-\fB[\fR\fIcount\fR\fB]F\fR\fIc\fR
-.ad
-.RS 13n
-Find the previous character \fIc\fR in the current line.
-.RE
-
-.sp
-.ne 2
-.na
-\fB[\fR\fIcount\fR\fB]t\fR\fIC\fR
-.ad
-.RS 13n
-Equivalent to \fBf\fR followed by \fBh\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fB[\fR\fIcount\fR\fB]T\fR\fIc\fR
-.ad
-.RS 13n
-Equivalent to \fBF\fR followed by \fBl\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fB[\fR\fIcount\fR\fB];\fR
-.ad
-.RS 13n
-Repeat \fIcount\fR times the last single character find command: \fBf\fR,
-\fBF\fR, \fBt,\fR or \fBT\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fB[\fR\fIcount\fR\fB],\fR
-.ad
-.RS 13n
-Reverse the last single character find command \fIcount\fR times.
-.RE
-
-.sp
-.ne 2
-.na
-\fB0\fR
-.ad
-.RS 13n
+.It Oo Ar count Oc Ns Sy \&|
+Move the cursor to column
+.Ar count .
+.It Oo Ar count Oc Ns Sy f Ns Ar c
+Find the next character
+.Ar c
+in the current line.
+.It Oo Ar count Oc Ns Sy F Ns Ar c
+Find the previous character
+.Ar c
+in the current line.
+.It Oo Ar count Oc Ns Sy f Ns Ar c
+Equivalent to
+.Sy f
+followed by
+.Sy h .
+.It Oo Ar count Oc Ns Sy T Ns Ar c
+Equivalent to
+.Sy F
+followed by
+.Sy l .
+.It Oo Ar count Oc Ns Sy \&;
+Repeat
+.Ar count
+times the last single character find command:
+.Sy f ,
+.Sy F ,
+.Sy t ,
+or
+.Sy T .
+.It Oo Ar count Oc Ns Sy \&,
+Reverse the last single character find command
+.Ar count
+times.
+.It Sy 0 Pq No zero
Move the cursor to the start of line.
-.RE
-
-.sp
-.ne 2
-.na
-\fB^\fR
-.ad
-.RS 13n
-Move the cursor to start of line.
-.RE
-
-.sp
-.ne 2
-.na
-\fB[H\fR
-.ad
-.RS 13n
+.It Sy \&^
Move the cursor to the first non-blank character in the line.
-.RE
-
-.sp
-.ne 2
-.na
-\fB$\fR
-.ad
-.RS 13n
+.It Sy [H
+Move the cursor to the first non-blank character in the line.
+.It Sy \&$
Move the cursor to the end of the line.
-.RE
-
-.sp
-.ne 2
-.na
-\fB[Y\fR
-.ad
-.RS 13n
+.It Sy [Y
Move the cursor to the end of the line.
-.RE
-
-.sp
-.ne 2
-.na
-\fB%\fR
-.ad
-.RS 13n
-Moves to balancing \fB(\fR, \fB)\fR, \fB{\fR, \fB}\fR, \fB[\fR, or \fB]\fR. If
-cursor is not on one of the characters described in this section, the remainder
-of the line is searched for the first occurrence of one of the characters
-first.
-.RE
-
-.SS "Search Edit Commands"
+.It Sy \&%
+Moves to the balancing
+.Sy \&( ,
+.Sy \&) ,
+.Sy \&{ ,
+.Sy \&} ,
+.Sy \&[ ,
+or
+.Sy \&] .
+If cursor is not on one of the characters described in this section, the
+remainder of the line is searched for the first occurrence of one of the
+characters first.
+.El
+.Ss "Search Edit Commands"
The search edit commands access your command history.
-.sp
-.LP
+.Pp
The following search edit commands are supported:
-.sp
-.ne 2
-.na
-\fB[\fR\fIcount\fR\fB]k\fR
-.ad
-.RS 13n
-Fetch the previous command. Each time \fBk\fR is entered, the previous command
-back in time is accessed.
-.RE
-
-.sp
-.ne 2
-.na
-\fB[\fR\fIcount\fR\fB]-\fR
-.ad
-.RS 13n
-Fetch the previous command. Each time \fBk\fR is entered, the previous command
-back in time is accessed.
-.sp
-Equivalent to \fBk\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fB[\fR\fIcount\fR\fB][A\fR
-.ad
-.RS 13n
-Fetch the previous command. Each time \fBk\fR is entered, the previous command
-back in time is accessed.
-.sp
-Equivalent to \fBk\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fB[\fR\fIcount\fR\fB]j\fR
-.ad
-.RS 13n
-Fetch the next command. Each time \fBj\fR is entered, the next command forward
-in time is accessed.
-.RE
-
-.sp
-.ne 2
-.na
-\fB[\fR\fIcount\fR\fB]+\fR
-.ad
-.RS 13n
-Fetch the next command. Each time \fBj\fR is entered, the next command forward
+.Bl -tag -width Ar
+.It Oo Ar count Oc Ns Sy k
+Fetch the previous command.
+Each time
+.Sy k
+is entered, the previous command back in time is accessed.
+.It Oo Ar count Oc Ns Sy \&-
+Fetch the previous command.
+Each time
+.Sy \&-
+is entered, the previous command back in time is accessed.
+Equivalent to
+.Sy k .
+.It Oo Ar count Oc Ns Sy [A
+Fetch the previous command.
+Each time
+.Sy [A
+is entered, the previous command back in time is accessed.
+Equivalent to
+.Sy k .
+.It Oo Ar count Oc Ns Sy j
+Fetch the next command.
+Each time
+.Sy j
+is entered, the next command forward
in time is accessed.
-.sp
-Equivalent to \fBj\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fB[\fR\fIcount\fR\fB][B\fR
-.ad
-.RS 13n
-Fetch the next command. Each time \fBj\fR is entered, the next command forward
-in time is accessed.
-.sp
-Equivalent to \fBj\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fB[\fR\fIcount\fR\fB]G\fR
-.ad
-.RS 13n
-Fetch command number \fIcount\fR. The default is the least recent history
-command.
-.RE
-
-.sp
-.ne 2
-.na
-\fB/\fR\fIstring\fR
-.ad
-.RS 13n
-Search backward through history for a previous command containing \fIstring\fR.
-\fIstring\fR is terminated by a RETURN or NEWLINE. If string is preceded by a
-\fB^\fR, the matched line must begin with \fIstring\fR. If \fIstring\fR is
-null, the previous string is used.
-.RE
-
-.sp
-.ne 2
-.na
-\fB?\fR\fIstring\fR
-.ad
-.RS 13n
-Search forward through history for a previous command containing \fIstring\fR.
-\fIstring\fR is terminated by a RETURN or NEWLINE. If string is preceded by a
-\fB^\fR, the matched line must begin with \fIstring\fR. If \fIstring\fR is
-null, the previous string is used.
-.sp
-Same as \fI/\fR except that search is in the forward direction.
-.RE
-
-.sp
-.ne 2
-.na
-\fBn\fR
-.ad
-.RS 13n
+.It Oo Ar count Oc Ns Sy \&+
+Fetch the next command.
+Each time
+.Sy \&+
+is entered, the next command forward in time is accessed.
+Equivalent to
+.Sy j .
+.It Oo Ar count Oc Ns Sy [B
+Fetch the next command.
+Each time
+.Sy [B
+is entered, the next command forward in time is accessed.
+Equivalent to
+.Sy j .
+.It Oo Ar count Oc Ns Sy G
+Fetch command number
+.Ar count .
+The default is the least recent history command.
+.It Sy / Ns Ar string
+Search backward through history for a previous command containing
+.Ar string .
+.Ar string
+is terminated by a RETURN or NEWLINE.
+If string is preceded by a
+.Sy ^ ,
+the matched line must begin with
+.Ar string .
+If
+.Ar string
+is null, the previous string is used.
+.It Sy \&? Ns Ar string
+Search forward through history for a previous command containing
+.Ar string .
+.Ar string
+is terminated by a RETURN or NEWLINE.
+If string is preceded by a
+.Sy ^ ,
+the matched line must begin with
+.Ar string .
+If
+.Ar string
+is null, the previous string is used.
+.Pp
+Same as
+.Sy /
+except that search is in the forward direction.
+.It Sy n
Search in the backwards direction for the next match of the last pattern to
-\fI/\fR or \fI?\fR commands.
-.RE
-
-.sp
-.ne 2
-.na
-\fBN\fR
-.ad
-.RS 13n
-Search in the forward direction for next match of the last pattern to \fI/\fR
-or \fI?\fR.
-.RE
-
-.SS "Text Modification Edit Commands"
+.Sy /
+or
+.Sy \&?
+commands.
+.It Sy N
+Search in the forward direction for next match of the last pattern to
+.Sy /
+or
+.Sy \&?
+commands.
+.El
+.Ss "Text Modification Edit Commands"
The following commands modify the line:
-.sp
-.ne 2
-.na
-\fBa\fR
-.ad
-.RS 19n
+.Pp
+.Bl -tag -width Ar -compact
+.It Sy a
Enter input mode and enter text after the current character.
-.RE
-
-.sp
-.ne 2
-.na
-\fBA\fR
-.ad
-.RS 19n
-Append text to the end of the line. Equivalent to \fB$a\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fB[\fR\fIcount\fR\fB]c\fR\fImotion\fR
-.ad
-.br
-.na
-\fBc[\fR\fIcount\fR\fB]\fR\fImotion\fR
-.ad
-.RS 19n
-Delete current character through the character that \fImotion\fR would move the
-cursor to and enter input mode. If \fImotion\fR is \fBc\fR, the entire line is
-deleted and input mode entered.
-.RE
-
-.sp
-.ne 2
-.na
-\fBC\fR
-.ad
-.RS 19n
-Delete the current character through the end of line and enter input mode.
-Equivalent to \fBc$\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBS\fR
-.ad
-.RS 19n
-Equivalent to \fBcc\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fB[\fR\fIcount\fR\fB]s\fR
-.ad
-.RS 19n
+.Pp
+.It Sy A
+Append text to the end of the line.
+Equivalent to
+.Sy $a .
+.Pp
+.It Oo Ar count Oc Ns Sy c Ns Ar motion
+.It Sy c Ns Oo Ar count Oc Ns Ar motion
+Delete current character through to the character that
+.Ar motion
+would move the cursor to, and enter input mode.
+If
+.Ar motion
+is
+.Sy c ,
+the entire line is deleted and input mode is entered.
+.Pp
+.It Sy C
+Delete the current character through to the end of line and enter input mode.
+Equivalent to
+.Sy c$ .
+.Pp
+.It Sy S
+Equivalent to
+.Sy cc .
+.Pp
+.It Oo Ar count Oc Ns Sy s
Replace characters under the cursor in input mode.
-.RE
-
-.sp
-.ne 2
-.na
-\fBD[\fR\fIcount\fR\fB]d\fR\fImotion\fR
-.ad
-.RS 19n
-Delete the current character through the end of line. Equivalent to d$.
-.RE
-
-.sp
-.ne 2
-.na
-\fBd[\fR\fIcount\fR\fB]\fR\fImotion\fR
-.ad
-.RS 19n
-Delete current character through the character that \fImotion\fR would move to.
-If \fImotion\fR is d , the entire line is deleted.
-.RE
-
-.sp
-.ne 2
-.na
-\fBi\fR
-.ad
-.RS 19n
+.Pp
+.It Sy D Ns Oo Ar count Oc Ns Sy d Ns Ar motion
+Delete the current character through to the end of line.
+Equivalent to
+.Sy d$ .
+.Pp
+.It Sy d Oo Ar count Oc Ns Ar motion
+Delete current character through to the character that
+.Ar motion
+would move to.
+If
+.Ar motion
+is
+.Sy d ,
+the entire line is deleted.
+.Pp
+.It Sy i
Enter input mode and insert text before the current character.
-.RE
-
-.sp
-.ne 2
-.na
-\fBI\fR
-.ad
-.RS 19n
-Insert text before the beginning of the line. Equivalent to \fB0i\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fB[\fR\fIcount\fR\fB]P\fR
-.ad
-.RS 19n
+.Pp
+.It Sy I
+Insert text before the beginning of the line.
+Equivalent to
+.Sy 0i .
+.Pp
+.It Oo Ar count Oc Ns Sy P
Place the previous text modification before the cursor.
-.RE
-
-.sp
-.ne 2
-.na
-\fB[\fR\fIcount\fR\fB]p\fR
-.ad
-.RS 19n
+.Pp
+.It Oo Ar count Oc Ns Sy p
Place the previous text modification after the cursor.
-.RE
-
-.sp
-.ne 2
-.na
-\fBR\fR
-.ad
-.RS 19n
+.Pp
+.It Sy R
Enter input mode and replace characters on the screen with characters you type
overlay fashion.
-.RE
-
-.sp
-.ne 2
-.na
-\fB[\fR\fIcount\fR\fB]r\fR\fIc\fR
-.ad
-.RS 19n
-Replace the \fIcount\fR characters starting at the current cursor position with
-\fIc\fR, and advance the cursor.
-.RE
-
-.sp
-.ne 2
-.na
-\fB[\fR\fIcount\fR\fB]x\fR
-.ad
-.RS 19n
+.Pp
+.It Oo Ar count Oc Ns Sy r Ns Ar c
+Replace the
+.Ar count
+characters starting at the current cursor position with
+.Ar c ,
+and advance the cursor.
+.Pp
+.It Oo Ar count Oc Ns Sy x
Delete current character.
-.RE
-
-.sp
-.ne 2
-.na
-\fB[\fIcount\fR]X\fR
-.ad
-.RS 19n
+.Pp
+.It Oo Ar count Oc Ns Sy X
Delete preceding character.
-.RE
-
-.sp
-.ne 2
-.na
-\fB[\fIcount\fR].\fR
-.ad
-.RS 19n
+.Pp
+.It Oo Ar count Oc Ns Sy \&.
Repeat the previous text modification command.
-.RE
-
-.sp
-.ne 2
-.na
-\fB[\fIcount\fR]~\fR
-.ad
-.RS 19n
-Invert the case of the \fIcount\fR characters starting at the current cursor
+.Pp
+.It Oo Ar count Oc Ns Sy \&~
+Invert the case of the
+.Ar count
+characters starting at the current cursor
position and advance the cursor.
-.RE
-
-.sp
-.ne 2
-.na
-\fB[\fIcount\fR]_\fR
-.ad
-.RS 19n
-Causes the \fIcount\fR word of the previous command to be appended and input
-mode entered. The last word is used if \fIcount\fR is omitted.
-.RE
-
-.sp
-.ne 2
-.na
-\fB*\fR
-.ad
-.RS 19n
-Causes an \fB*\fR to be appended to the current word and file name generation
-attempted. If no match is found, it rings the bell. Otherwise, the word is
-replaced by the matching pattern and input mode is entered.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\e\fR
-.ad
-.RS 19n
+.Pp
+.It Oo Ar count Oc Ns Sy \&_
+Causes the
+.Ar count
+word of the previous command to be appended and input mode entered.
+The last word is used if
+.Ar count
+is omitted.
+.Pp
+.It Sy \&*
+Causes an
+.Sy \&*
+to be appended to the current word and file name generation attempted.
+If no match is found, it rings the bell.
+Otherwise, the word is replaced by the matching pattern and input mode is
+entered.
+.Pp
+.It Sy \e
Command or file name completion as described in this manual page.
-.RE
-
-.SS "Other Edit Commands"
+.El
+.Ss "Other Edit Commands"
The following miscellaneous edit commands are supported:
-.sp
-.ne 2
-.na
-\fB[\fR\fIcount\fR\fB]y\fR\fImotion\fR
-.ad
-.br
-.na
-\fBy[\fR\fIcount\fR\fB]\fR\fImotion\fR
-.ad
-.RS 18n
-Yank the current character through the character to which \fImotion\fR would
-move the cursor. Put the yanked characters in the delete buffer. The text and
-cursor position are unchanged.
-.RE
-
-.sp
-.ne 2
-.na
-\fByy\fR
-.ad
-.RS 18n
+.Pp
+.Bl -tag -width Ar -compact
+.It Oo Ar count Oc Ns Sy y Ns Ar motion
+.It Sy y Ns Oo Ar count Oc Ns Ar motion
+Yank the current character through to the character to which
+.Ar motion
+would move the cursor.
+Put the yanked characters in the delete buffer.
+The text and cursor position are unchanged.
+.Pp
+.It Sy yy
Yank the current line.
-.RE
-
-.sp
-.ne 2
-.na
-\fBY\fR
-.ad
-.RS 18n
+.Pp
+.It Sy Y
Yank the current line from the current cursor location to the end of the line.
-Equivalent to \fBy$\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBu\fR
-.ad
-.RS 18n
+Equivalent to
+.Sy y$ .
+.Pp
+.It Sy u
Undo the last text modifying command.
-.RE
-
-.sp
-.ne 2
-.na
-\fBU\fR
-.ad
-.RS 18n
+.Pp
+.It Sy U
Undo all the text modifying commands performed on current line.
-.RE
-
-.sp
-.ne 2
-.na
-\fB[\fR\fIcount\fR\fB]V\fR
-.ad
-.RS 18n
-Return the command :
-.sp
-.in +2
-.nf
-hist -e ${VISUAL:-${EDITOR:-vi}} \fIcount\fR
-.fi
-.in -2
-.sp
-
-in the input buffer. If \fIcount\fR is omitted, the current line is used.
-.RE
-
-.sp
-.ne 2
-.na
-\fB^L\fR
-.ad
-.RS 18n
-Line feed and print the current line. This command only works in control mode.
-.RE
-
-.sp
-.ne 2
-.na
-\fB^J\fR
-.ad
-.RS 18n
-New line. Execute the current line, regardless of mode.
-.RE
-
-.sp
-.ne 2
-.na
-\fB^M\fR
-.ad
-.RS 18n
-Return. Execute the current line, regardless of mode.
-.RE
-
-.sp
-.ne 2
-.na
-\fB#\fR
-.ad
-.RS 18n
-If the first character of the command is a \fB#\fR , delete this \fB#\fR and
-each \fB#\fR that follows a NEWLINE.
-.sp
-Otherwise, send the line after inserting a \fB#\fR in front of each line in the
-command.
-.sp
+.Pp
+.It Oo Ar count Oc Ns Sy V
+Return the command:
+.Pp
+.D1 Ic hist Fl e No ${ Ns Ev VISUAL Ns :-${ Ns Ev EDITOR Ns :-vi}} Ar count
+.Pp
+in the input buffer.
+If
+.Ar count
+is omitted, the current line is used.
+.Pp
+.It Sy ^L
+Line feed and print the current line.
+This command only works in control mode.
+.Pp
+.It Sy ^J
+New line.
+Execute the current line, regardless of mode.
+.Pp
+.It Sy ^M
+Return.
+Execute the current line, regardless of mode.
+.Pp
+.It Sy #
+If the first character of the command is a
+.Sy # ,
+delete this
+.Sy #
+and each
+.Sy #
+that follows a NEWLINE.
+.Pp
+Otherwise, send the line after inserting a
+.Sy #
+in front of each line in the command.
+.Pp
This is command is useful for causing the current line to be inserted in the
history as a comment and un-commenting previously commented commands in the
history file.
-.RE
-
-.sp
-.ne 2
-.na
-\fB[\fR\fIcount\fR\fB]=\fR
-.ad
-.RS 18n
-If \fIcount\fR is not specified, generate the list of matching commands or file
-names as described in this manual page.
-.sp
-Otherwise, replace the word at the current cursor location with the \fIcount\fR
-item from the most recently generated command or file list. If the cursor is
-not on a word, it is inserted after the current cursor location.
-.RE
-
-.sp
-.ne 2
-.na
-\fB@\fR\fIletter\fR
-.ad
-.RS 18n
-Search your alias list for an alias by the name \fIletter\fR. If an alias of
-this name is defined, insert its value on the input queue for processing.
-.RE
-
-.sp
-.ne 2
-.na
-\fB^V\fR
-.ad
-.RS 18n
+.Pp
+.It Oo Ar count Oc Ns Sy \&=
+If
+.Ar count
+is not specified, generate the list of matching commands or file names as
+described in this manual page.
+.Pp
+Otherwise, replace the word at the current cursor location with the
+.Ar count
+item from the most recently generated command or file list.
+If the cursor is not on a word, it is inserted after the current cursor
+location.
+.Pp
+.It Sy @ Ns Ar letter
+Search your alias list for an alias by the name
+.Ar letter .
+If an alias of this name is defined, insert its value on the input queue for
+processing.
+.Pp
+.It Sy ^V
Display version of the shell.
-.RE
-
-.SS "Built-in Commands"
-The following simple-commands are executed in the shell process. Input and
-output redirection is permitted. Unless otherwise indicated, the output is
-written on file descriptor \fB1\fR and the exit status, when there is no syntax
-error, is \fB0\fR. Except for \fB:\fR, \fBtrue\fR, \fBfalse\fR, \fBecho\fR,
-\fBnewgrp\fR, and \fBlogin\fR, all built-in commands accept \fB--\fR to
-indicate the end of options. They also interpret the option \fB--man\fR as a
-request to display the manual page onto standard error and \fB-?\fR as a help
-request which prints a usage message on standard error.
-.sp
-.LP
-Commands that are preceded by one or two \fB++\fR symbols are special built-in
-commands and are treated specially in the following ways:
-.RS +4
-.TP
-1.
+.El
+.Ss "Built-in Commands"
+The following simple-commands are executed in the shell process.
+Input and output redirection is permitted.
+Unless otherwise indicated, the output is written on file descriptor
+.Sy 1
+and the exit status, when there is no syntax error, is
+.Sy 0 .
+Except for
+.Sy \&: ,
+.Sy true ,
+.Sy false ,
+.Sy echo ,
+.Sy newgrp ,
+and
+.Sy login ,
+all built-in commands accept
+.Fl -
+to indicate the end of options.
+They also interpret the option
+.Fl -man
+as a request to display the manual page onto standard error and
+.Fl \&?
+as a help request which prints a usage message on standard error.
+.Pp
+In the list below, commands that are preceded by one or two
+.Sy \&+
+symbols are special built-in commands and are treated specially in the
+following ways:
+.Bl -enum -offset Ds
+.It
Variable assignment lists preceding the command remain in effect when the
command completes.
-.RE
-.RS +4
-.TP
-2.
+.It
I/O redirections are processed after variable assignments.
-.RE
-.RS +4
-.TP
-3.
+.It
Errors cause a script that contains them to abort.
-.RE
-.RS +4
-.TP
-4.
+.It
They are not valid function names.
-.RE
-.RS +4
-.TP
-5.
-Words following a command preceded by \fB++\fR that are in the format of a
-variable assignment are expanded with the same rules as a variable assignment.
-This means that tilde substitution is performed after the \fB=\fR sign and
-field splitting and file name generation are not performed.
-.RE
-.sp
-.ne 2
-.na
-\fB+ : [\fR\fIarg ...\fR\fB]\fR
-.ad
-.sp .6
-.RS 4n
+.It
+Words following a command preceded by
+.Sy ++
+that are in the format of a variable assignment are expanded with the same
+rules as a variable assignment.
+This means that tilde substitution is performed after the
+.Sy \&=
+sign and field splitting and file name generation are not performed.
+.El
+.Pp
+.Bl -tag -width Ds -compact
+.It Sy + Ic \&: Op Ar arg No ...
The command only expands parameters.
-.RE
-
-.sp
-.ne 2
-.na
-\fB+ .\fR \fIname\fR \fB[\fR\fIarg ...\fR\fB]\fR
-.ad
-.sp .6
-.RS 4n
-If \fIname\fR is a function defined with the \fBfunction\fR \fBname\fR reserved
-word syntax, the function is executed in the current environment (as if it had
-been defined with the \fIname()\fR syntax.) Otherwise if \fIname\fR refers to a
-file, the file is read in its entirety and the commands are executed in the
-current shell environment. The search path specified by PATH is used to find
-the directory containing the file. If any arguments \fIarg\fR are specified,
-they become the positional parameters while processing the . command and the
-original positional parameters are restored upon completion. Otherwise the
-positional parameters are unchanged. The exit status is the exit status of the
-last command executed.
-.RE
-
-.sp
-.ne 2
-.na
-\fB++ alias [\fR\fB-ptx\fR\fB] [\fR\fIname\fR\fB[
-=\fR\fIvalue\fR\fB]] ...\fR
-.ad
-.sp .6
-.RS 4n
-\fBalias\fR with no arguments prints the list of aliases in the form
-\fIname\fR\fB=\fR\fIvalue\fR on standard output. The \fB-p\fR option causes the
-word alias to be inserted before each one. When one or more arguments are
-specified, an \fIalias\fR is defined for each \fIname\fR whose \fIvalue\fR is
-specified. A trailing space in \fIvalue\fR causes the next word to be checked
-for alias substitution. The obsolete \fB-t\fR option is used to set and list
-tracked aliases. The value of a tracked alias is the full pathname
-corresponding to the specified \fIname\fR. The value becomes undefined when the
-value of \fBPATH\fR is reset but the alias remains tracked. Without the
-\fB-t\fR option, for each \fIname\fR in the argument list for which no
-\fIvalue\fR is specified, the name and value of the alias is printed. The
-obsolete -x option has no effect. The exit status is \fBnon-zero\fR if a
-\fIname\fR is specified, but no value, and no alias has been defined for the
-\fIname\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBbg [\fR \fIjob\fR\fB\&...]\fR
-.ad
-.sp .6
-.RS 4n
-This command is only on systems that support job control. Puts each specified
-\fIjob\fR into the background. The current job is put in the background if
-\fIjob\fR is not specified. See the \fBJobs\fR section of this manual page for
-a description of the format of \fIjob\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fB+ break [\fR\fIn\fR\fB]\fR
-.ad
-.sp .6
-.RS 4n
-Exit from the enclosing \fBfor\fR, \fBwhile\fR, \fBuntil\fR, or \fBselect\fR
-loop, if any. If \fIn\fR is specified, then break \fIn\fR levels.
-.RE
-
-.sp
-.ne 2
-.na
-\fBbuiltin [\fR\fB-ds\fR \fB] [\fR\fB-f\fR \fIfile\fR\fB]
-[\fR\fIname ...\fR\fB]\fR
-.ad
-.sp .6
-.RS 4n
-If \fIname\fR is not specified, and no \fB-f\fR option is specified, the
-built-ins are printed on standard output. The \fB-s\fR option prints only the
-special built-ins. Otherwise, each \fIname\fR represents the pathname whose
-basename is the name of the built-in. The entry point function name is
-determined by prepending \fIb_\fR to the built-in name. A built-in specified by
-a pathname will only be executed when that pathname would be found during the
-path search. Built-ins found in libraries loaded via the \fB.paths\fR file will
-be associate with the pathname of the directory containing the \fB.paths\fR
+.Pp
+.It Sy + Ic \&. Ar name Op Ar arg No ...
+If
+.Ar name
+is a function defined with the
+.Ic function Ar name
+reserved word syntax, the function is executed in the current environment
+.Pq as if it had been defined with the Ar name Ns Sy () No syntax .
+Otherwise if
+.Ar name
+refers to a file, the file is read in its entirety and the commands are
+executed in the current shell environment.
+The search path specified by
+.Ev PATH
+is used to find the directory containing the file.
+If any arguments
+.Ar arg
+are specified, they become the positional parameters while processing the
+.Ic \&.
+command and the original positional parameters are restored upon completion.
+Otherwise the positional parameters are unchanged.
+The exit status is the exit status of the last command executed.
+.Pp
+.It Sy ++ Ic alias Oo Fl ptx Oc Oo Ar name Ns Oo Sy = Ns Ar value Oc Oc No ...
+.Ic alias
+with no arguments prints the list of aliases in the form
+.Ar name Ns Sy = Ns Ar value
+on standard output.
+The
+.Fl p
+option causes the word alias to be inserted before each one.
+When one or more arguments are specified, an alias is defined for each
+.Ar name
+whose
+.Ar value
+is specified.
+A trailing space in
+.Ar value
+causes the next word to be checked for alias substitution.
+The obsolete
+.Fl t
+option is used to set and list tracked aliases.
+The value of a tracked alias is the full pathname corresponding to the
+specified
+.Ar name .
+The value becomes undefined when the value of
+.Ev PATH
+is reset but the alias remains tracked.
+Without the
+.Fl t
+option, for each
+.Ar name
+in the argument list for which no
+.Ar value
+is specified, the name and value of the alias is printed.
+The obsolete
+.Fl x
+option has no effect.
+The exit status is
+.Sy non-zero
+if a
+.Ar name
+is specified, but no value, and no alias has been defined for the
+.Ar name .
+.Pp
+.It Ic bg Op Ar job No ...
+This command is only on systems that support job control.
+Puts each specified
+.Ar job
+into the background.
+The current job is put in the background if
+.Ar job
+is not specified.
+See the
+.Sx Jobs
+section of this manual page for a description of the format of
+.Ar job .
+.Pp
+.It Sy + Ic break Op Ar n
+Exit from the enclosing
+.Ic for ,
+.Ic while ,
+.Ic until ,
+or
+.Ic select
+loop, if any.
+If
+.Ar n
+is specified, then break
+.Ar n
+levels.
+.Pp
+.It Ic builtin Oo Fl ds Oc Oo Fl f Ar file Oc Oo Ar name No ... Oc
+If
+.Ar name
+is not specified, and no
+.Fl f
+option is specified, the built-ins are printed on standard output.
+The
+.Fl s
+option prints only the special built-ins.
+Otherwise, each
+.Ar name
+represents the pathname whose basename is the name of the built-in.
+The entry point function name is determined by prepending
+.Ar b_
+to the built-in name.
+A built-in specified by a pathname will only be executed when that pathname
+would be found during the path search.
+Built-ins found in libraries loaded via the
+.Pa \&.paths
+file will be associated with the pathname of the directory containing the
+.Pa \&.paths
file.
-.sp
-The ISO C/C++ prototype
-is \fBb\fR\fImycommand(int argc, char *argv[], void *context)\fR for the
-built-in command \fImycommand\fR where \fIargv\fR is an array of \fIargc\fR
-elements and \fIcontext\fR is an optional pointer to a \fBShell_t\fR structure
-as described in \fB<ast/shell.h>\fR Special built-ins cannot be bound to a
-pathname or deleted. The \fB-d\fR option deletes each of the specified
-built-ins. On systems that support dynamic loading, the \fB-f\fR option names a
-shared library containing the code for built-ins. The shared library prefix
-and/or suffix, which depend on the system, can be omitted. Once a library is
-loaded, its symbols become available for subsequent invocations of
-\fBbuiltin\fR. Multiple libraries can be specified with separate invocations of
-the \fBbuiltin\fR command. Libraries are searched in the reverse order in which
-they are specified. When a library is loaded, it looks for a function in the
-library whose name is \fBlib_init()\fR and invokes this function with an
-argument of \fB0\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBcd\fR \fB[\fR\fB-LP\fR\fB] [\fR\fIarg\fR\fB]\fR
-.ad
-.br
-.na
-\fBcd\fR \fB[\fR\fB-LP\fR\fB]\fR \fIold\fR \fInew\fR
-.ad
-.sp .6
-.RS 4n
+.Pp
+The ISO C/C++ prototype is
+.Ft int
+.Fo b_mycommand
+.Fa "int argc"
+.Fa "char **argv"
+.Fa "Shbltin_t *context"
+.Fc
+for the built-in command
+.Ic mycommand
+where
+.Fa argv
+is an array of
+.Fa argc
+elements and
+.Fa context
+is an optional pointer to a
+.Vt Shbltin_t
+structure as described in
+.In ast/shell.h
+Special built-ins cannot be bound to a pathname or deleted.
+The
+.Fl d
+option deletes each of the specified built-ins.
+On systems that support dynamic loading, the
+.Fl f
+option names a shared library containing the code for built-ins.
+The shared library prefix and/or suffix, which depend on the system, can be
+omitted.
+Once a library is loaded, its symbols become available for subsequent
+invocations of
+.Ic builtin .
+Multiple libraries can be specified with separate invocations of the
+.Ic builtin
+command.
+Libraries are searched in the reverse order in which they are specified.
+When a library is loaded, it looks for a function in the library whose name is
+.Fn lib_init
+and invokes this function with an argument of
+.Sy 0 .
+.Pp
+.It Ic cd Oo Fl LP Oc Op Ar arg
+.It Ic cd Oo Fl LP Oc Ar old Ar new
This command has two forms.
-.sp
-In the first form it changes the current directory to \fIarg\fR. If \fIarg\fR
-is a \fB-\fR, the directory is changed to the previous directory. The shell
-variable \fBHOME\fR is the default \fIarg\fR. The variable \fBPWD\fR is set to
-the current directory. The shell variable \fBCDPATH\fR defines the search path
-for the directory containing \fIarg\fR. Alternative directory names are
-separated by a colon (\fB:\fR). The default path is \fBNULL\fR (specifying the
-current directory). The current directory is specified by a null path name,
-which can appear immediately after the equal sign or between the colon
-delimiters anywhere else in the path list. If \fIarg\fR begins with a \fB/\fR,
-the search path is not used. Otherwise, each directory in the path is searched
-for \fIarg\fR.
-.sp
-The second form of \fBcd\fR substitutes the string \fInew\fR for the string
-\fIold\fR in the current directory name, \fBPWD\fR, and tries to change to this
-new directory. By default, symbolic link names are treated literally when
-finding the directory name. This is equivalent to the \fB-L\fR option. The
-\fB-P\fR option causes symbolic links to be resolved when determining the
-directory. The last instance of \fB-L\fR or \fB-P\fR on the command line
-determines which method is used. The \fBcd\fR command cannot be executed by
-\fBrksh93\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBcommand\fR \fB[\fR\fB-pvVx\fR\fB]\fR \fIname\fR
-\fB[\fR\fIarg ...\fR\fB]\fR
-.ad
-.sp .6
-.RS 4n
-Without the \fB-v\fR or \fB-V\fR options, executes \fIname\fR with the
-arguments specified by \fIarg\fR.
-.sp
-The \fB-p\fR option causes a default path to be searched rather than the one
-defined by the value of \fBPATH\fR. Functions are not searched when finding
-\fIname\fR. In addition, if \fIname\fR refers to a special built-in, none of
-the special properties associated with the leading daggers are honored. For
-example, the predefined alias \fBredirect='command exec'\fR prevents a script
-from terminating when an invalid redirection is specified.
-.sp
-With the \fB-x\fR option, if command execution would result in a failure
-because there are too many arguments, \fBerrno E2BIG\fR, the shell invokes
-command \fIname\fR multiple times with a subset of the arguments on each
-invocation. Arguments that occur prior to the first word that expands to
-multiple arguments and after the last word that expands to multiple arguments
-are passed on each invocation. The exit status is the maximum invocation exit
-status.
-.sp
-With the \fB-v\fR option, \fBcommand\fR is equivalent to the built-in
-\fBwhence\fR command described in this section. The \fB-V\fR option causes
-\fBcommand\fR to act like \fBwhence -v\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fB+continue\fR \fB[\fR\fIn\fR\fB]\fR
-.ad
-.sp .6
-.RS 4n
-Resumes the next iteration of the enclosing \fBfor\fR, \fBwhile\fR,
-\fBuntil\fR, or \fBselect\fR loop. If \fIn\fR is specified, then resume at the
-\fIn\fRth enclosing loop.
-.RE
-
-.sp
-.ne 2
-.na
-\fBdisown\fR \fB[\fR\fIjob...\fR\fB]\fR
-.ad
-.sp .6
-.RS 4n
-Causes the shell not to send a \fBHUP\fR signal to each specified \fIjob\fR, or
-all active jobs if \fIjob\fR is omitted, when a login shell terminates.
-.RE
-
-.sp
-.ne 2
-.na
-\fBecho\fR \fB[\fR\fIarg ...\fR\fB]\fR
-.ad
-.sp .6
-.RS 4n
-When the first \fIarg\fR does not begin with a \fB-\fR, and none of the
-arguments contain a backslash (\fB\e\fR), prints each of its arguments
-separated by a SPACE and terminated by a NEWLINE. Otherwise, the behavior of
-\fBecho\fR is system dependent and \fBprint\fR or \fBprintf\fR described in
-this section should be used. See \fBecho\fR(1) for usage and description.
-.RE
-
-.sp
-.ne 2
-.na
-\fB++enum [ -i ]\fR \fItype\fR\fB[\fR=(\fIvalue\fR ...) \fB]\fR
-.ad
-.sp .6
-.RS 4n
+.Pp
+In the first form it changes the current directory to
+.Ar arg .
+If
+.Ar arg
+is a literal
+.Sy \&- ,
+the directory is changed to the previous directory.
+The shell variable
+.Ev HOME
+is the default
+.Ar arg .
+The variable
+.Ev PWD
+is set to the current directory.
+The shell variable
+.Ev CDPATH
+defines the search path for the directory containing
+.Ar arg .
+Alternative directory names are
+separated by a colon
+.Pq Sy \&: .
+The default path is
+.Dv NULL
+(specifying the current directory).
+The current directory is specified by a null path name, which can appear
+immediately after the equal sign or between the colon delimiters anywhere else
+in the path list.
+If
+.Ar arg
+begins with a
+.Sy / ,
+the search path is not used.
+Otherwise, each directory in the path is searched for
+.Ar arg .
+.Pp
+The second form of
+.Ic cd
+substitutes the string
+.Ar new
+for the string
+.Ar old
+in the current directory name,
+.Ev PWD ,
+and tries to change to this new directory.
+.Pp
+By default, symbolic link names are treated literally when finding the
+directory name.
+This is equivalent to the
+.Fl L
+option.
+The
+.Fl P
+option causes symbolic links to be resolved when determining the directory.
+The last instance of
+.Fl L
+or
+.Fl P
+on the command line determines which method is used.
+The
+.Ic cd
+command cannot be executed by
+.Nm rksh93 .
+.Pp
+.It Ic command Oo Fl pvVx Oc Ar name Op Ar arg No ...
+Without the
+.Fl v
+or
+.Fl V
+options, executes
+.Ar name
+with the arguments specified by
+.Ar arg .
+.Pp
+The
+.Fl p
+option causes a default path to be searched rather than the one defined by the
+value of
+.Ev PATH .
+Functions are not searched when finding
+.Ar name .
+In addition, if
+.Ar name
+refers to a special built-in, none of the special properties associated with
+the leading daggers are honored.
+For example, the predefined alias
+.Sy redirect='command exec'
+prevents a script from terminating when an invalid redirection is specified.
+.Pp
+With the
+.Fl x
+option, if command execution would result in a failure because there are too
+many arguments,
+.Er E2BIG ,
+the shell invokes command
+.Ar name
+multiple times with a subset of the arguments on each invocation.
+Arguments that occur prior to the first word that expands to multiple arguments
+and after the last word that expands to multiple arguments are passed on each
+invocation.
+The exit status is the maximum invocation exit status.
+.Pp
+With the
+.Fl v
+option,
+.Ic command
+is equivalent to the built-in
+.Ic whence
+command described in this section.
+The
+.Fl V
+option causes
+.Ic command
+to act like
+.Ic whence -v .
+.Pp
+.It Sy + Ic continue Op Ar n
+Resumes the next iteration of the enclosing
+.Ic for ,
+.Ic while ,
+.Ic until ,
+or
+.Ic select
+loop.
+If
+.Ar n
+is specified, then resume at the
+.Ar n Ns No th
+enclosing loop.
+.Pp
+.It Ic disown Op Ar job No ...
+Causes the shell not to send a
+.Sy HUP
+signal to each specified
+.Ar job ,
+or all active jobs if
+.Ar job
+is omitted, when a login shell terminates.
+.Pp
+.It Ic echo Op arg No ...
+When the first
+.Ar arg
+does not begin with a
+.Sy - ,
+and none of the arguments contain a backslash
+.Pq Sy \e ,
+prints each of its arguments separated by a SPACE and terminated by a NEWLINE.
+Otherwise, the behavior of
+.Ic echo
+is system dependent and
+.Ic print
+or
+.Ic printf
+described in this section should be used.
+See
+.Xr echo 1
+for usage and description.
+.Pp
+.It Sy ++ Ic enum Oo Fl i Oc Ar type Ns Op Sy =( Ns Ar value No ... Ns Sy \&)
Creates a declaration command named type that is an integer type that allows
-one of the specified values as enumeration names. If \fI=(value ...)\fR is
-omitted, then type must be an indexed array variable with at least two elements
-and the values are taken from this array variable. If \fB-i\fR is specified
-the values are case insensitive.
-.RE
-
-.sp
-.ne 2
-.na
-\fB+eval\fR \fB[\fR\fIarg ...\fR\fB]\fR
-.ad
-.sp .6
-.RS 4n
+one of the specified values as enumeration names.
+If
+.Sy =( Ns Ar value No ... Ns Sy \&)
+is omitted, then type must be an indexed array variable with at least two
+elements and the values are taken from this array variable.
+If
+.Fl i
+is specified the values are case insensitive.
+.Pp
+.It Sy + Ic eval Op arg No ...
The arguments are read as input to the shell and the resulting commands are
executed.
-.RE
-
-.sp
-.ne 2
-.na
-\fB+exec\fR [\fB-c\fR] [\fB-a\fR \fIname ...\fR]
-\fB[\fR\fIarg ...\fR\fB]\fR
-.ad
-.sp .6
-.RS 4n
-If \fIarg\fR is specified, the command specified by the arguments is executed
-in place of this shell without creating a new process. The \fB-c\fR option
-causes the environment to be cleared before applying variable assignments
-associated with the exec invocation. The \fB-a\fR option causes \fIname\fR
-rather than the first \fIarg\fR, to become \fBargv[0]\fR for the new process.
-Input and output arguments can appear and affect the current process. If
-\fIarg\fR is not specified, the effect of this command is to modify file
-descriptors as prescribed by the input/output redirection list. In this case,
-any file descriptor numbers greater than \fB2\fR that are opened with this
-mechanism are closed when invoking another program.
-.RE
-
-.sp
-.ne 2
-.na
-\fB+exit\fR \fB[\fR\fIn\fR\fB]\fR
-.ad
-.sp .6
-.RS 4n
-Causes the shell to exit with the exit status specified by \fIn\fR. The value
-is the least significant 8 bits of the specified status. If \fIn\fR is omitted,
-then the exit status is that of the last command executed. An end-of-file also
-causes the shell to exit except for a shell which has the \fBignoreeof\fR
-option turned on. See \fBset\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fB++export\fR \fB[\fR\fB-p\fR\fB]\fR
-\fB[\fR\fIname\fR\fB[=\fR\fIvalue\fR\fB]] ...\fR
-.ad
-.sp .6
-.RS 4n
-If \fIname\fR is not specified, the names and values of each variable with the
-export attribute are printed with the values quoted in a manner that allows
-them to be re-entered. The \fBexport\fR command is the same as \fBtypeset -x\fR
-except that if you use \fBexport\fR within a function, no local variable is
-created. The \fB-p\fR option causes the word export to be inserted before each
-one. Otherwise, the specified \fIname\fRs are marked for automatic export to
-the environment of subsequently-executed commands.
-.RE
-
-.sp
-.ne 2
-.na
-\fBfalse\fR
-.ad
-.sp .6
-.RS 4n
-Does nothing, and exits \fB1\fR. Used with \fBuntil\fR for infinite loops.
-.RE
-
-.sp
-.ne 2
-.na
-\fBfg\fR \fB[\fR\fIjob ...\fR\fB]\fR
-.ad
-.sp .6
-.RS 4n
-This command is only on systems that support job control. Each \fIjob\fR
+.Pp
+.It Sy + Ic exec Oo Fl c Oc Oo Fl a Ar name No ... Oc Op Ar arg No ...
+If
+.Ar arg
+is specified, the command specified by the arguments is executed in place of
+this shell without creating a new process.
+The
+.Fl c
+option causes the environment to be cleared before applying variable
+assignments associated with the exec invocation.
+The
+.Fl a
+option causes
+.Ar name
+rather than the first
+.Ar arg ,
+to become
+.Fa argv[0]
+for the new process.
+Input and output arguments can appear and affect the current process.
+If
+.Ar arg
+is not specified, the effect of this command is to modify file descriptors as
+prescribed by the input/output redirection list.
+In this case, any file descriptor numbers greater than
+.Sy 2
+that are opened with this mechanism are closed when invoking another program.
+.Pp
+.It Sy + Ic exit Op Ar n
+Causes the shell to exit with the exit status specified by
+.Ar n .
+The value is the least significant 8 bits of the specified status.
+If
+.Ar n
+is omitted, then the exit status is that of the last command executed.
+An end-of-file also causes the shell to exit except for a shell which has the
+.Sy ignoreeof
+option turned on.
+See
+.Ic set .
+.Pp
+.It Sy ++ Ic export Oo Fl p Oc Oo Ar name Ns Oo Sy = Ns Ar value Oc Oc No ...
+If
+.Ar name
+is not specified, the names and values of each variable with the export
+attribute are printed with the values quoted in a manner that allows them to be
+re-entered.
+The
+.Ic export
+command is the same as
+.Ic typeset -x
+except that if you use
+.Ic export
+within a function, no local variable is created.
+The
+.Fl p
+option causes the word export to be inserted before each one.
+Otherwise, the specified
+.Ar name
+s are marked for automatic export to the environment of subsequently-executed
+commands.
+.Pp
+.It Ic false
+Does nothing, and exits
+.Sy 1 .
+Used with
+.Ic until
+for infinite loops.
+.Pp
+.It Ic fg Op Ar job No ...
+This command is only on systems that support job control.
+Each
+.Ar job
specified is brought to the foreground and waited for in the specified order.
-Otherwise, the current job is brought into the foreground. See \fBJobs\fR for a
-description of the format of \fIjob\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBgetconf\fR \fB[\fR\fIname\fR \fB[\fR\fIpathname\fR\fB]]\fR
-.ad
-.sp .6
-.RS 4n
+Otherwise, the current job is brought into the foreground.
+See
+.Sx Jobs
+for a description of the format of
+.Ar job .
+.Pp
+.It Ic getconf Oo Ar name Oo Ar pathname Oc Oc
Prints the current value of the configuration parameter specified by
-\fIname\fR. The configuration parameters are defined by the IEEE POSIX 1003.1
-and IEEE POSIX 1003.2 standards. See \fBpathconf\fR(2) and \fBsysconf\fR(3C).
-.sp
-The \fIpathname\fR argument is required for parameters whose value depends on
-the location in the file system. If no arguments are specified, \fBgetconf\fR
-prints the names and values of the current configuration parameters. The
-pathname \fB/\fR is used for each of the parameters that requires
-\fIpathname\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBgetopts\fR \fB[\fR \fB-a\fR \fIname\fR\fB]\fR \fIoptstring\fR \fIvname\fR
-\fB[\fR\fIarg ...\fR\fB]\fR
-.ad
-.sp .6
-.RS 4n
-Checks \fIarg\fR for legal options. If \fIarg\fR is omitted, the positional
-parameters are used. An option argument begins with a \fB+\fR or a \fB-\fR. An
-option that does not begin with \fB+\fR or \fB-\fR or the argument \fB--\fR
-ends the options. Options beginning with \fB+\fR are only recognized when
-\fIoptstring\fR begins with a \fB+\fR. \fIoptstring\fR contains the letters
-that \fBgetopts\fR recognizes. If a letter is followed by a \fB:\fR, that
-option is expected to have an argument. The options can be separated from the
-argument by blanks. The option \fB-?\fRcauses \fBgetopts\fR to generate a usage
-message on standard error. The \fB-a\fR option can be used to specify the name
-to use for the usage message, which defaults to $0. \fBgetopts\fR places the
-next option letter it finds inside variable \fIvname\fR each time it is
-invoked. The option letter is prepended with a \fB+\fR when \fIarg\fR begins
-with a \fB+\fR. The index of the next \fIarg\fR is stored in \fBOPTIND\fR. The
-option argument, if any, gets stored in \fBOPTARG\fR. A leading : in
-\fIoptstring\fR causes \fBgetopts\fR to store the letter of an invalid option
-in \fBOPTARG\fR, and to set \fIvname\fR to \fB?\fR for an unknown option and
-to: when a required option argument is missing. Otherwise, \fBgetopts\fR prints
-an error message. The exit status is \fBnon-zero\fR when there are no more
-options. There is no way to specify any of the options \fB:\fR, \fB+\fR,
-\fB-\fR, \fB?\fR, \fB[\fR, and \fB]\fR. The option \fB#\fR can only be
-specified as the first option.
-.RE
-
-.sp
-.ne 2
-.na
-\fBhist\fR \fB[\fR \fB-e\fR \fIename\fR\fB]\fR\fB[\fR\fB-nlr\fR\fB]\fR
-\fB[\fR \fIfirst\fR\fB[\fR\fIlast\fR \fB] ]\fR
-.ad
-.br
-.na
-\fB\fR
-.ad
-.br
-.na
-\fBhist\fR \fB-s\fR \fB[\fR \fIold\fR\fB=\fR\fInew\fR \fB] [\fR
-\fIcommand\fR\fB]\fR
-.ad
-.sp .6
-.RS 4n
-In the first form, a range of commands from \fIfirst\fR to \fIlast\fR is
-selected from the last \fBHISTSIZE\fR commands that were typed at the terminal.
-The arguments \fIfirst\fR and \fIlast\fR can be specified as a number or as a
-string. A string is used to locate the most recent command starting with the
-specified string. A negative number is used as an offset to the current command
-number. If the -l option is selected, the commands are listed on standard
-output. Otherwise, the editor program \fIename\fR is invoked on a file
-containing these keyboard commands. If \fIename\fR is not supplied, then the
-value of the variable \fBHISTEDIT\fR is used. If \fBHISTEDIT\fR is not set,
-then \fBFCEDIT\fR (default \fB/bin/ed\fR) is used as the editor. When editing
-is complete, the edited command(s) is executed if the changes have been saved.
-If \fIlast\fR is not specified, then it is set to \fIfirst\fR. If \fIfirst\fR
-is not specified, the default is the previous command for editing and \fB-16\fR
-for listing. The option \fB-r\fR reverses the order of the commands and the
-option \fB-n\fR suppresses command numbers when listing. In the second form,
-\fIcommand\fR is interpreted as \fIfirst\fR described in this section and
-defaults to the last command executed. The resulting command is executed after
-the optional substitution \fIold\fR\fB=\fR\fInew\fR is performed.
-.RE
-
-.sp
-.ne 2
-.na
-\fBjobs\fR \fB-lnp\fR \fB[\fR\fIjob ...\fR\fB]\fR
-.ad
-.sp .6
-.RS 4n
-Lists information about each specified job, or all active jobs if \fIjob\fR is
-omitted. The \fB-l\fR option lists process ids in addition to the normal
-information. The \fB-n\fR option only displays jobs that have stopped or exited
-since last notified. The \fB-p\fR option causes only the process group to be
-listed. See \fBJobs\fR for a description of the format of \fIjob\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBkill\fR \fB[\fR\fB-s\fR \fIsigname\fR\fB]\fR \fIjob ...\fR
-.ad
-.br
-.na
-\fBkill\fR \fB[\fR\fB-n\fR \fIsignum\fR\fB]\fR \fIjob ...\fR
-.ad
-.br
-.na
-\fBkill\fR \fB-Ll\fR \fB[\fR\fIsig ...\fR\fB]\fR
-.ad
-.sp .6
-.RS 4n
-Sends either the \fBTERM\fR (terminate) signal or the specified signal to the
-specified jobs or processes. Signals are either specified by number with the
-\fB-n\fR option or by name with the \fB-s\fR option (as specified in
-\fB<signal.h\fR>, stripped of the prefix `\fBSIG\fR with the exception that
-\fBSIGCLD\fR is named \fBCHLD\fR). For backward compatibility, the \fBn\fR and
-\fBs\fR can be omitted and the number or name placed immediately after the
-\fB-\fR. If the signal being sent is \fBTERM\fR (terminate) or \fBHUP\fR (hang
-up), then the job or process is sent a \fBCONT\fR (continue) signal if it is
-stopped. The argument \fIjob\fR can be the process id of a process that is not
-a member of one of the active jobs. See \fBJobs\fR for a description of the
-format of \fIjob\fR. In the third form, \fBkill -l\fR or \fBkill -L\fR, if
-\fIsig\fR is not specified, the signal names are listed. The \fB-l\fR option
-lists only the signal names whereas \fB-L\fR lists each signal name and
-corresponding number. Otherwise, for each \fIsig\fR that is a name, the
-corresponding signal number is listed. For each \fIsig\fR that is a number, the
-signal name corresponding to the least significant 8 bits of \fIsig\fR is
-listed.
-.RE
-
-.sp
-.ne 2
-.na
-\fBlet\fR \fB[\fR\fIarg ...\fR\fB]\fR
-.ad
-.sp .6
-.RS 4n
-Each \fIarg\fR is a separate arithmetic expression to be evaluated.
-\fBlet\fR only recognizes octal constants starting with \fB0\fR when the
-\fBset\fR option \fBletoctal\fR is on. See the \fBArithmetic Evaluation\fR
+.Ar name .
+The configuration parameters are defined by the IEEE POSIX 1003.1
+and IEEE POSIX 1003.2 standards.
+See
+.Xr pathconf 2
+and
+.Xr sysconf 3C .
+.Pp
+The
+.Ar pathname
+argument is required for parameters whose value depends on the location in the
+file system.
+If no arguments are specified,
+.Ic getconf
+prints the names and values of the current configuration parameters.
+The pathname
+.Pa /
+is used for each of the parameters that requires
+.Ar pathname .
+.Pp
+.It Ic getopts Oo Fl a Ar name Oc Ar optstring Ar vname Op Ar arg No ...
+Checks
+.Ar arg
+for legal options.
+If
+.Ar arg
+is omitted, the positional parameters are used.
+An option argument begins with a
+.Sy \&+
+or a
+.Sy \&- .
+An option that does not begin with
+.Sy \&+
+or
+.Sy \&-
+or the argument
+.Fl \-
+ends the options.
+Options beginning with
+.Sy \&+
+are only recognized when
+.Ar optstring
+begins with a
+.Sy \&+ .
+.Ar optstring
+contains the letters that
+.Sy getopts
+recognizes.
+If a letter is followed by a
+.Sy \&: ,
+that option is expected to have an argument.
+The options can be separated from the argument by blanks.
+The option
+.Fl \&?
+causes
+.Ic getopts
+to generate a usage message on standard error.
+The
+.Fl a
+option can be used to specify the name to use for the usage message, which
+defaults to
+.Sy $0 .
+.Ic getopts
+places the next option letter it finds inside variable
+.Ar vname
+each time it is invoked.
+The option letter is prepended with a
+.Sy \&+
+when
+.Ar arg
+begins with a
+.Sy \&+ .
+The index of the next
+.Ar arg
+is stored in
+.Ev OPTIND .
+The option argument, if any, gets stored in
+.Ev OPTARG .
+A leading \&: in
+.Ar optstring
+causes
+.Ic getopts
+to store the letter of an invalid option in
+.Ev OPTARG ,
+and to set
+.Ar vname
+to
+.Sy \&?
+for an unknown option and to
+.Sy \&:
+when a required option argument is missing.
+Otherwise,
+.Ic getopts
+prints an error message.
+The exit status is
+.Sy non-zero
+when there are no more options.
+There is no way to specify any of the options
+.Sy \&: ,
+.Sy \&+ ,
+.Sy \&- ,
+.Sy \&? ,
+.Sy \&[ ,
+and
+.Sy \&] .
+The option
+.Sy \&#
+can only be specified as the first option.
+.Pp
+.It Ic hist Oo Fl e Ar ename Oc Oo Fl nlr Oc Oo Ar first Oo Ar last Oc Oc
+.It Ic hist Fl s Oo Ar old Ns Sy = Ns Ar new Oc Oo Ar command Oc
+In the first form, a range of commands from
+.Ar first
+to
+.Ar last
+is selected from the last
+.Ev HISTSIZE
+commands that were typed at the terminal.
+The arguments
+.Ar first
+and
+.Ar last
+can be specified as a number or as a string.
+A string is used to locate the most recent command starting with the
+specified string.
+A negative number is used as an offset to the current command number.
+If the
+.Fl l
+option is selected, the commands are listed on standard output.
+Otherwise, the editor program
+.Ar ename
+is invoked on a file containing these keyboard commands.
+If
+.Ar ename
+is not supplied, then the value of the variable
+.Ev HISTEDIT
+is used.
+If
+.Ev HISTEDIT
+is not set, then
+.Ev FCEDIT
+.Pq default Pa /bin/ed
+is used as the editor.
+When editing is complete, the edited command(s) is executed if the changes have
+been saved.
+If
+.Ar last
+is not specified, then it is set to
+.Ar first .
+If
+.Ar first
+is not specified, the default is the previous command for editing and
+.Fl 16
+for listing.
+The option
+.Fl r
+reverses the order of the commands and the option
+.Fl n
+suppresses command numbers when listing.
+In the second form,
+.Ar command
+is interpreted as
+.Ar first
+described in this section and defaults to the last command executed.
+The resulting command is executed after the optional substitution
+.Ar old Ns Sy = Ns Ar new
+is performed.
+.Pp
+.It Ic jobs Fl lnp Op Ar job No ...
+Lists information about each specified job, or all active jobs if
+.Ar job
+is omitted.
+The
+.Fl l
+option lists process ids in addition to the normal information.
+The
+.Fl n
+option only displays jobs that have stopped or exited since last notified.
+The
+.Fl p
+option causes only the process group to be listed.
+See
+.Sx Jobs
+for a description of the format of
+.Ar job .
+.Pp
+.It Ic kill Oo Fl s Ar signame Oc Ar job No ...
+.It Ic kill Oo Fl n Ar signum Oc Ar job No ...
+.It Ic kill Fl Ll Op Ar sig No ...
+Sends either the
+.Sy TERM
+(terminate) signal or the specified signal to the specified jobs or processes.
+Signals are either specified by number with the
+.Fl n
+option or by name with the
+.Fl s
+option
+.Po
+as specified in
+.In signal.h ,
+stripped of the prefix
+.Ql SIG
+with the exception that
+.Sy SIGCLD
+is named
+.Sy CHLD
+.Pc .
+For backwards compatibility, the
+.Sy n
+and
+.Sy s
+can be omitted and the number or name placed immediately after the
+.Fl .
+If the signal being sent is
+.Sy TERM
+(terminate) or
+.Sy HUP
+(hang up), then the job or process is sent a
+.Sy CONT
+(continue) signal if it is stopped.
+The argument
+.Ar job
+can be the process id of a process that is not a member of one of the active
+jobs.
+See
+.Sx Jobs
+for a description of the format of
+.Ar job .
+In the third form,
+.Ic kill Fl l
+or
+.Ic kill Fl L ,
+if
+.Ar sig
+is not specified, the signal names are listed.
+The
+.Fl l
+option
+lists only the signal names whereas
+.Fl L
+lists each signal name and corresponding number.
+Otherwise, for each
+.Ar sig
+that is a name, the corresponding signal number is listed.
+For each
+.Ar sig
+that is a number, the signal name corresponding to the least significant 8 bits
+of
+.Ar sig
+is listed.
+.Pp
+.It Ic let Op Ar arg No ...
+Each
+.Ar arg
+is a separate arithmetic expression to be evaluated.
+.Ic let
+only recognizes octal constants starting with
+.Sy 0
+when the
+.Ic set
+option
+.Sy letoctal
+is on.
+See the
+.Sx Arithmetic Evaluation
section of this manual page for a description of arithmetic expression
-evaluation. The exit status is \fB0\fR if the value of the last expression is
-\fBnon-zero\fR, and \fB1\fR otherwise.
-.RE
-
-.sp
-.ne 2
-.na
-\fB+newgrp\fR \fB[\fR\fIarg ...\fR\fB]\fR
-.ad
-.sp .6
-.RS 4n
-Equivalent to \fBexec\fR \fB/bin/newgrp\fR \fIarg ...\fR
-.RE
-
-.sp
-.ne 2
-.na
-\fBprint\fR [\fB-CRenprsv\fR] \fB[\fR \fB-u\fR \fIunit\fR\fB] [\fR \fB-f\fR
-\fIformat\fR \fB] [\fR \fIarg ...\fR\fB]\fR
-.ad
-.sp .6
-.RS 4n
-With no options or with option \fB-\fR or \fB--\fR, each \fIarg\fR is printed
-on standard output. The \fB-f\fR option causes the arguments to be printed as
-described by \fBprintf\fR. In this case, any \fBe\fR, \fBn\fR, \fBr\fR, or
-\fBR\fR options are ignored. Otherwise, unless the \fB-R\fR or \fB-r,\fR are
-specified, the following escape conventions are applied:
-.sp
-.ne 2
-.na
-\fB\ea\fR
-.ad
-.RS 8n
-Alert character (\fBASCII\fR 07)
-.RE
-
-.sp
-.ne 2
-.na
-\fB\eb\fR
-.ad
-.RS 8n
-Backspace character (\fBASCII\fR 010)
-.RE
-
-.sp
-.ne 2
-.na
-\fB\ec\fR
-.ad
-.RS 8n
+evaluation.
+The exit status is
+.Sy 0
+if the value of the last expression is
+.Sy non-zero ,
+and
+.Sy 1
+otherwise.
+.Pp
+.It Sy + Ic newgrp Op arg No ...
+Equivalent to
+.Ic exec Pa /bin/newgrp Ar arg No ...
+.Pp
+.It Xo
+.Ic print
+.Op Fl CRenprsv
+.Op Fl u Ar unit
+.Op Fl f Ar format
+.Op Ar arg No ...
+.Xc
+With no options or with option
+.Sy -
+or
+.Fl \- ,
+each
+.Ar arg
+is printed on standard output.
+The
+.Fl f
+option causes the arguments to be printed as described by
+.Ic printf .
+In this case, any
+.Fl e ,
+.Fl n ,
+.Fl r ,
+or
+.Fl R
+options are ignored.
+Otherwise, unless the
+.Fl R
+or
+.Fl r
+options are specified, the following escape conventions are applied:
+.Bl -tag -width Ds
+.It Sy \ea
+Alert character
+.Pq Sy ASCII 007
+.It Sy \eb
+Backspace character
+.Pq Sy ASCII 010
+.It Sy \ec
Causes print to end without processing more arguments and not adding a NEWLINE
-.RE
-
-.sp
-.ne 2
-.na
-\fB\ef\fR
-.ad
-.RS 8n
-Form-feed character (\fBASCII\fR 014)
-.RE
-
-.sp
-.ne 2
-.na
-\fB\en\fR
-.ad
-.RS 8n
-NEWLINE character (\fBASCII\fR 012)
-.RE
-
-.sp
-.ne 2
-.na
-\fB\er\fR
-.ad
-.RS 8n
-RETURN character (\fBASCII\fR 015)
-.RE
-
-.sp
-.ne 2
-.na
-\fB\et\fR
-.ad
-.RS 8n
-TAB character (\fBASCII\fR 011)
-.RE
-
-.sp
-.ne 2
-.na
-\fB\ev\fR
-.ad
-.RS 8n
-Vertical TAB character (\fBASCII\fR 013)
-.RE
-
-.sp
-.ne 2
-.na
-\fB\eE\fR
-.ad
-.RS 8n
-Escape character (\fBASCII\fR 033)
-.RE
-
-.sp
-.ne 2
-.na
-\fB\e\e\fR
-.ad
-.RS 8n
-Backslash character \fB\e\fR
-.RE
-
-.sp
-.ne 2
-.na
-\fB\e0\fR\fIx\fR
-.ad
-.RS 8n
-Character defined by the 1, 2, or 3-digit octal string specified by \fIx\fR
-.RE
-
-The \fB-R\fR option prints all subsequent arguments and options other than
-\fB-n\fR. The \fB-e\fR causes the escape conventions to be applied This is the
-default behavior. It reverses the effect of an earlier \fB-r\fR. The \fB-p\fR
+.It Sy \ef
+Form-feed character
+.Pq Sy ASCII 014
+.It Sy \en
+NEWLINE character
+.Pq Sy ASCII 012
+.It Sy \er
+RETURN character
+.Pq Sy ASCII 015
+.It Sy \et
+TAB character
+.Pq Sy ASCII 011
+.It Sy \ev
+Vertical TAB character
+.Pq Sy ASCII 013
+.It Sy \eE
+Escape character
+.Pq Sy ASCII 033
+.It Sy \e\e
+Backslash character
+.Sy \e
+.It Sy \e0 Ns Ar x
+Character defined by the 1, 2, or 3-digit octal string specified by
+.Ar x
+.El
+.Pp
+The
+.Fl R
+option prints all subsequent arguments and options other than
+.Fl n .
+The
+.Fl e
+causes the escape conventions to be applied.
+This is the default behavior.
+It reverses the effect of an earlier
+.Fl r .
+The
+.Fl p
option causes the arguments to be written onto the pipe of the process spawned
-with \fB|&\fR instead of standard output. The \fB-v\fR option treats each
-\fIarg\fR as a variable name and writes the value in the \fBprintf %B\fR
-format. The \fB-C\fR option treats each \fIarg\fR as a variable name and
-writes the values in the \fBprintf %#B\fR format.
-The \fB-s\fR option causes the arguments to be written onto the history file
-instead of standard output. The \fB-u\fR option can be used to specify a one
-digit file descriptor unit number \fIunit\fR on which the output is placed. The
-default is \fB1\fR. If the option \fB-n\fR is used, no NEWLINE is added to the
-output.
-.RE
-
-.sp
-.ne 2
-.na
-\fBprintf\fR \fIformat\fR\fB [\fR\fIarg ...\fR\fB]\fR
-.ad
-.sp .6
-.RS 4n
-The arguments \fIarg\fR are printed on standard output in accordance with the
-\fBANSI-C\fR formatting rules associated with the format string \fIformat\fR.
+with
+.Sy |&
+instead of standard output.
+The
+.Fl v
+option treats each
+.Ar arg
+as a variable name and writes the value in the
+.Ic printf Cm \&%B
+format.
+The
+.Fl C
+option treats each
+.Ar arg
+as a variable name and writes the values in the
+.Ic printf Cm \&%#B
+format.
+The
+.Fl s
+option causes the arguments to be written onto the history file instead of
+standard output.
+The
+.Fl u
+option can be used to specify a one digit file descriptor unit number
+.Ar unit
+on which the output is placed.
+The default is
+.Sy 1 .
+If the option
+.Fl n
+is used, no NEWLINE is added to the output.
+.Pp
+.It Ic printf Ar format Op Ar arg No ...
+The arguments
+.Ar arg
+are printed on standard output in accordance with the
+.Sy ANSI-C
+formatting rules associated with the format string
+.Ar format .
If the number of arguments exceeds the number of format specifications, the
-format string is reused to format remaining arguments. The following extensions
-can also be used:
-
-.sp
-.ne 2
-.na
-\fB%b\fR
-.ad
-.sp .6
-.RS 4n
-A \fB%b\fR format can be used instead of \fB%s\fR to cause
-escape sequences in the corresponding \fIarg\fR to be expanded as described in
-\fBprint\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fB%B\fR
-.ad
-.sp .6
-.RS 4n
-A \fB%B\fR option causes each of the arguments to be treated as
-variable names and the binary value of the variables is printed. This is most
-useful for variables with an attribute of b.
-.RE
-
-.sp
-.ne 2
-.na
-\fB%H\fR
-.ad
-.sp .6
-.RS 4n
-A \fB%H\fR format can be used
-instead of \fB%s\fR to cause characters in \fIarg\fR that are special in
-\fBHTML\fR and \fBXML\fR to be output as their entity name. The alternate
-flag \fB#\fR formats the output for use as a URI.
-.RE
-
-.sp
-.ne 2
-.na
-\fB%P\fR
-.ad
-.sp .6
-.RS 4n
-A \fB%P\fR format can be used instead of \fB%s\fR to cause \fIarg\fR to be
-interpreted as an extended regular expression and be printed as a shell
+format string is reused to format remaining arguments.
+The following extensions can also be used:
+.Bl -tag -width Ds
+.It Sy %b
+A
+.Sy %b
+format can be used instead of
+.Sy %s
+to cause escape sequences in the corresponding
+.Ar arg
+to be expanded as described in
+.Ic print .
+.It Sy \&%B
+A
+.Sy \&%B
+option causes each of the arguments to be treated as variable names and the
+binary value of the variables is printed.
+This is most useful for variables with an attribute of b.
+.It Sy \&%H
+A
+.Sy \&%H
+format can be used instead of
+.Sy %s
+to cause characters in
+.Ar arg
+that are special in
+.Sy HTML
+and
+.Sy XML
+to be output as their entity name.
+The alternate flag
+.Sy #
+formats the output for use as a URI.
+.It Sy \&%P
+A
+.Sy \&%P
+format can be used instead of
+.Sy \&%s
+to cause
+.Ar arg
+to be interpreted as an extended regular expression and be printed as a shell
pattern.
-.RE
-
-
-.sp
-.ne 2
-.na
-\fB%R\fR
-.ad
-.sp .6
-.RS 4n
-A \fB%R\fR
-format can be used instead of \fB%s\fR to cause \fIarg\fR to be interpreted as
-a shell pattern and to be printed as an extended regular expression.
-.RE
-
-.sp
-.ne 2
-.na
-\fB%q\fR
-.ad
-.sp .6
-.RS 4n
-A \fB%q\fR format can be used instead of \fB%\fRs to cause the resulting string
-to be quoted in a manner than can be input again to the shell. When \fBq\fR is
-preceded by the alternative format specifier, \fB#\fR, the string is quoted in
-manner suitable as a field in a \fB.csv\fR format file.
-.RE
-
-.sp
-.ne 2
-.na
-\fB%(\fIdate-format\fR\fB)\fR
-.ad
-.sp .6
-.RS 4n
-A \fB%(\fR\fIdate-format\fR\fB)T\fR format can be use to treat an argument as a
-date/time string and to format the date/time according to the \fIdate-format\fR
-as defined for the \fBdate\fR(1) command.
-.RE
-
-
-.sp
-.ne 2
-.na
-\fB%Z\fR
-.ad
-.sp .6
-.RS 4n
-A \fB%Z\fR format outputs a byte whose value is 0.
-.RE
-
-.sp
-.ne 2
-.na
-\fB%d\fR
-.ad
-.sp .6
-.RS 4n
-The precision field of the %d format can be followed by a . and the output
-base. In this case, the \fB#\fR flag character causes \fBbase\fR\fI#\fR to be
-prepended.
-.RE
-
-.sp
-.ne 2
-.na
-\fB#\fR
-.ad
-.sp .6
-.RS 4n
-The \fB#\fR flag, when used with the \fB%d\fR format without an output base,
-displays the output in powers of 1000 indicated by one of the following
-suffixes: \fBk M G T P E\fR, and when used with the \fB%i\fR format displays
-the output in powers of 1024 indicated by one of the following suffixes:
-\fBKi Mi Gi Ti Pi Ei\fR.
-
-.RE
-
-.sp
-.ne 2
-.na
-\fB=\fR
-.ad
-.sp .6
-.RS 4n
-The \fB=\fR flag centers the output within the specified field width.
-.RE
-
-.sp
-.ne 2
-.na
-\fBL\fR
-.ad
-.sp .6
-.RS 4n
-The \fBL\fR flag, when used with the \fB%c\fR or \fB%s\fR
+.It Sy \&%R
+A
+.Sy \&%R
+format can be used instead of
+.Sy \&%s
+to cause
+.Ar arg
+to be interpreted as a shell pattern and to be printed as an extended regular
+expression.
+.It Sy \&%q
+A
+.Sy \&%q
+format can be used instead of
+.Sy \&%
+s to cause the resulting string to be quoted in a manner than can be input
+again to the shell.
+When
+.Sy q
+is preceded by the alternative format specifier,
+.Sy # ,
+the string is quoted in manner suitable for a field in a
+.Sy .csv
+format file.
+.It Sy \&% Ns Oo Sy \&( Ns Ar date-format Ns Sy \&) Oc Ns Sy T
+A
+.Sy \&% Ns Oo Sy \&( Ns Ar date-format Ns Sy \&) Oc Ns Sy T
+format can be used to treat an argument as a date/time string and to format the
+date/time according to the
+.Ar date-format
+as defined for the
+.Xr date 1
+command.
+For example,
+.Sq printf '%(%s)T' now
+would print the current time in UNIX timestamp format
+.Pq seconds since 00:00:00 UTC, January 1, 1970 .
+.It Sy %Z
+A
+.Sy %Z
+format outputs a byte whose value is 0.
+.It Sy %d
+The precision field of the %d format can be followed by a \&. and the output
+base.
+In this case, the
+.Sy #
+flag character causes
+.Sy base Ar #
+to be prepended.
+.It Sy #
+The
+.Sy #
+flag, when used with the
+.Sy %d
+format without an output base, displays the output in powers of 1000 indicated
+by one of the following suffixes:
+.Sy k M G T P E ,
+and when used with the
+.Sy %i
+format displays the output in powers of 1024 indicated by one of the following
+suffixes:
+.Sy Ki Mi Gi Ti Pi Ei .
+.It Sy =
+The
+.Sy =
+flag centers the output within the specified field width.
+.It Sy L
+The
+.Sy L
+flag, when used with the
+.Sy %c
+or
+.Sy %s
formats, treats precision as character width instead of byte count.
-.RE
-
-.sp
-.ne 2
-.na
-\fB,\fR
-.ad
-.sp .6
-.RS 4n
-The \fB,\fR flag, when used with the \fB%d\fR or \fB%f\fR
+.It Sy \&,
+The
+.Sy \&,
+flag, when used with the
+.Sy %d
+or
+.Sy %f
formats, separates groups of digits with the grouping delimiter
-(, in groups of 3 in the C locale).
-.RE
-
-
-.RE
-
-.sp
-.ne 2
-.na
-\fBpwd\fR [\fB-LP\fR]\fR
-.ad
-.sp .6
-.RS 4n
-Outputs the value of the current working directory. The \fB-L\fR option is the
-default. It prints the logical name of the current directory. If the \fB-P\fR
-option is specified, all symbolic links are resolved from the name. The last
-instance of \fB-L\fR or \fB-P\fR on the command line determines which method is
-used.
-.RE
-
-.sp
-.ne 2
-.na
-\fBread\fR \fB[\fR\fB-ACSprsv\fR\fB] [\fR\fB-d\fR \fIdelim\fR\fB] [\fR \fB-n\fR
-\fIn\fR\fB] [[\fR \fB-N\fR \fIn\fR\fB] [[\fR\fB-t\fR \fItimeout\fR\fB]
-[\fR\fB-u\fR \fIunit\fR\fB] [\fR\fIvname\fR\fB?\fR\fIprompt\fR\fB] [\fR
-\fIvname ...\fR \fB]\fR
-.ad
-.sp .6
-.RS 4n
-The shell input mechanism. One line is read and is broken up into fields using
-the characters in IFS as separators. The escape character, \fB\e\fR, is used to
-remove any special meaning for the next character and for line continuation.
-The \fB-d\fR option causes the read to continue to the first character of
-\fIdelim\fR rather than \fBNEWLINE\fR. The \fB-n\fR option causes at most
-\fIn\fR bytes to read rather a full line but returns when reading from a slow
-device as soon as any characters have been read. The \fB-N\fR option causes
-exactly \fIn\fR to be read unless an end-of-file has been encountered or the
-read times out because of the \fB-t\fR option. In raw mode, \fB-r\fR, the
-\fB\e\fR character is not treated specially. The first field is assigned to the
-first \fIvname\fR, the second field to the second \fIvname\fR, etc., with
-leftover fields assigned to the last \fIvname\fR. When \fIvname\fR has the
-binary attribute and \fB-n\fR or \fB-N\fR is specified, the bytes that are read
-are stored directly into the variable. If the -v is specified, then the value
-of the first \fIvname\fR is used as a default value when reading from a
-terminal device. The \fB-A\fR option causes the variable \fIvname\fR to be
-unset and each field that is read to be stored in successive elements of the
-indexed array \fIvname\fR. The \fB-C\fR option causes the variable vname to be
-read as a compound variable. Blanks will be ignored when finding the beginning
-open parenthesis. The \fB-S\fR option causes the line to be treated like a
-record in a .csv format file so that double quotes can be used to allow the
-delimiter character and the new-line character to appear within a field.
-The \fB-p\fR option causes the input line to be
-taken from the input pipe of a process spawned by the shell using \fB|&\fR. If
-the \fB-s\fR option is present, the input is saved as a command in the history
-file. The option \fB-u\fR can be used to specify a one digit file descriptor
-unit \fIunit\fR to read from. The file descriptor can be opened with the
-\fBexec\fR special built-in command. The default value of unit \fIn\fR is
-\fB0\fR. The option \fB-t\fR is used to specify a time out in seconds when
-reading from a terminal or pipe. If \fIvname\fR is omitted, then REPLY is used
-as the default \fIvname\fR. An end-of-file with the \fB-p\fR option causes
-cleanup for this process so that another can be spawned. If the first argument
-contains a \fB?\fR, the remainder of this word is used as a prompt on standard
-error when the shell is interactive. The exit status is \fB0\fR unless an
-end-of-file is encountered or read has timed out.
-.RE
-
-.sp
-.ne 2
-.na
-\fB++readonly\fR \fB[\fR\fB-p\fR\fB] [\fR
-\fIvname\fR\fB[=\fR\fIvalue\fR\fB]] ...\fR
-.ad
-.sp .6
-.RS 4n
-If \fIvname\fR is not specified, the names and values of each variable with the
-read-only attribute is printed with the values quoted in a manner that allows
-them to be input again. The \fB-p\fR option causes the word \fBreadonly\fR to
-be inserted before each one. Otherwise, the specified \fIvname\fRs are marked
-\fBreadonly\fR and these names cannot be changed by subsequent assignment.
-.RE
-
-.sp
-.ne 2
-.na
-\fB+return\fR \fB[\fR\fIn\fR\fB]\fR
-.ad
-.sp .6
-.RS 4n
+.Po Sq Sy \&,
+in groups of 3 in the C locale
+.Pc .
+.El
+.Pp
+.It Ic pwd Op Fl LP
+Outputs the value of the current working directory.
+The
+.Fl L
+option is the default.
+It prints the logical name of the current directory.
+If the
+.Fl P
+option is specified, all symbolic links are resolved from the name.
+The last instance of
+.Fl L
+or
+.Fl P
+on the command line determines which method is used.
+.Pp
+.It Xo
+.Bk -words
+.Ic read Op Fl ACSprsv
+.Op Fl d Ar delim
+.Op Fl n Ar n | Fl N Ar n
+.Op Fl t Ar timeout
+.Op Fl u Ar unit
+.Op Ar vname Ns Sy \&? Ns Ar prompt
+.Op Ar name No ...
+.Ek
+.Xc
+.Pp
+The shell input mechanism.
+One line is read and is broken up into fields using the characters in
+.Ev IFS
+as separators.
+The escape character,
+.Sy \e ,
+is used to remove any special meaning for the next character and for line
+continuation.
+The
+.Fl d
+option causes the read to continue to the first character of
+.Ar delim
+rather than NEWLINE.
+The
+.Fl n
+option causes at most
+.Ar n
+bytes to read rather a full line but returns when reading from a slow device as
+soon as any characters have been read.
+The
+.Fl N
+option causes exactly
+.Ar n
+to be read unless an end-of-file has been encountered or the read times out
+because of the
+.Fl t
+option.
+In raw mode,
+.Fl r ,
+the
+.Sy \e
+character is not treated specially.
+The first field is assigned to the first
+.Ar vname ,
+the second field to the second
+.Ar vname ,
+etc., with leftover fields assigned to the last
+.Ar vname .
+When
+.Ar vname
+has the binary attribute and
+.Fl n
+or
+.Fl N
+is specified, the bytes that are read are stored directly into the variable.
+If
+.Fl v
+is specified, then the value of the first
+.Ar vname
+is used as a default value when reading from a terminal device.
+The
+.Fl A
+option causes the variable
+.Ar vname
+to be unset and each field that is read to be stored in successive elements of
+the indexed array
+.Ar vname .
+The
+.Fl C
+option causes the variable vname to be read as a compound variable.
+Blanks will be ignored when finding the beginning open parenthesis.
+The
+.Fl S
+option causes the line to be treated like a record in a .csv format file so
+that double quotes can be used to allow the delimiter character and the
+new-line character to appear within a field.
+The
+.Fl p
+option causes the input line to be taken from the input pipe of a process
+spawned by the shell using
+.Sy |& .
+If the
+.Fl s
+option is present, the input is saved as a command in the history file.
+The option
+.Fl u
+can be used to specify a one digit file descriptor unit
+.Ar unit
+to read from.
+The file descriptor can be opened with the
+.Ic exec
+special built-in command.
+The default value of unit
+.Ar n
+is
+.Sy 0 .
+The option
+.Fl t
+is used to specify a time out in seconds when reading from a terminal or pipe.
+If
+.Ar vname
+is omitted, then
+.Ev REPLY
+is used as the default
+.Ar vname .
+An end-of-file with the
+.Fl p
+option causes cleanup for this process so that another can be spawned.
+If the first argument contains a
+.Sy \&? ,
+the remainder of this word is used as a prompt on standard error when the shell
+is interactive.
+The exit status is
+.Sy 0
+unless an end-of-file is encountered or read has timed out.
+.Pp
+.It Xo
+.Sy ++ Ic readonly
+.Op Fl p
+.Oo Ar vname Ns Oo Sy = Ns Ar value Oc Oc ...
+.Xc
+If
+.Ar vname
+is not specified, the names and values of each variable with the read-only
+attribute is printed with the values quoted in a manner that allows them to be
+input again.
+The
+.Fl p
+option causes the word
+.Ic readonly
+to be inserted before each one.
+Otherwise, the specified
+.Ar vname Ns No s
+are marked
+.Ic readonly
+and these names cannot be changed by subsequent assignment.
+.Pp
+.It Sy + Ic return Op Ar n
Causes a shell function or script to return to the invoking script with the
-exit status specified by \fIn\fR. The value is the least significant 8 bits of
-the specified status. If \fBn\fR is omitted, then the return status is that of
-the last command executed. If return is invoked while not in a function or a
-script, then it behaves the same as exit.
-.RE
-
-.sp
-.ne 2
-.na
-\fB+set [ \(+-BCGabefhkmnoprstuvx] [\(+-o [\fR \fIoption\fR \fB] ] ... [
-\(+-A\fR \fIvname\fR\fB]\fR \fB[\fR\fIarg...\fR\fB]\fR
-.ad
-.sp .6
-.RS 4n
-The \fBset\fR command supports the following options:
-.sp
-.ne 2
-.na
-\fB-a\fR
-.ad
-.sp .6
-.RS 4n
+exit status specified by
+.Ar n .
+The value is the least significant 8 bits of the specified status.
+If
+.Sy n
+is omitted, then the return status is that of the last command executed.
+If return is invoked while not in a function or a script, then it behaves the
+same as exit.
+.Pp
+.It Xo
+.Sy + Ic set
+.Op Sy + Ns Fl BCGabefhkmnoprstuvx
+.Oo Sy + Ns Fl o Oo Ar option Oc Oc ...
+.Op Sy + Ns Fl A Ar vname
+.Op Ar arg No ...
+.Xc
+The
+.Ic set
+command supports the following options:
+.Bl -tag -width Ds
+.It Fl a
All subsequent variables that are defined are automatically exported.
-.RE
-
-.sp
-.ne 2
-.na
-\fB-A\fR
-.ad
-.sp .6
-.RS 4n
-Array assignment. Unset the variable \fIvname\fR and assign values sequentially
-from the \fIarg\fR list. If \fB+A\fR is used, the variable \fIvname\fR is not
-unset first.
-.RE
-
-.sp
-.ne 2
-.na
-\fB-b\fR
-.ad
-.sp .6
-.RS 4n
+.It Fl A
+Array assignment.
+Unset the variable
+.Ar vname
+and assign values sequentially from the
+.Ar arg
+list.
+If
+.Sy +A
+is used, the variable
+.Ar vname
+is not unset first.
+.It Fl b
Prints job completion messages as soon as a background job changes state rather
than waiting for the next prompt.
-.RE
-
-.sp
-.ne 2
-.na
-\fB-B\fR
-.ad
-.sp .6
-.RS 4n
-Enable brace pattern field generation. This is the default behavior.
-.RE
-
-.sp
-.ne 2
-.na
-\fB-C\fR
-.ad
-.sp .6
-.RS 4n
-Prevents redirection (\fB>\fR) from truncating existing files. Files that are
-created are opened with the \fBO_EXCL\fR mode. Requires \fB>|\fR to truncate a
-file when turned on.
-.RE
-
-.sp
-.ne 2
-.na
-\fB-e\fR
-.ad
-.sp .6
-.RS 4n
-Unless contained in a \fB||\fR or \fB&&\fR command, or the command following an
-\fBif\fR, \fBwhile\fR or \fBuntil\fR command or in the pipeline following
-\fB!\fR, if a command has a non-zero exit status, execute the \fBERR\fR trap,
-if set, and exit. This mode is disabled while reading profiles.
-.RE
-
-.sp
-.ne 2
-.na
-\fB-f\fR
-.ad
-.sp .6
-.RS 4n
+.It Fl B
+Enable brace pattern field generation.
+This is the default behavior.
+.It Fl C
+Prevents redirection
+.Pq Sy \&>
+from truncating existing files.
+Files that are created are opened with the
+.Sy O_EXCL
+mode.
+Requires
+.Sy >|
+to truncate a file when turned on.
+.It Fl e
+Unless contained in a
+.Sy ||
+or
+.Sy &&
+command, or the command following an
+.Ic if ,
+.Ic while
+or
+.Ic until
+command or in the pipeline following
+.Sy \&! ,
+if a command has a non-zero exit status, execute the
+.Sy ERR
+trap, if set, and exit.
+This mode is disabled while reading profiles.
+.It Fl f
Disables file name generation.
-.RE
-
-.sp
-.ne 2
-.na
-\fB-G\fR
-.ad
-.sp .6
-.RS 4n
-Causes the pattern \fB**\fR by itself to match files and zero or more
-directories and subdirectories when used for file name generation. If followed
-by a \fB/\fR only directories and subdirectories are matched.
-.RE
-
-.sp
-.ne 2
-.na
-\fB-h\fR
-.ad
-.sp .6
-.RS 4n
+.It Fl G
+Causes the pattern
+.Sy \&**
+by itself to match files and zero or more directories and subdirectories when
+used for file name generation.
+If followed by a
+.Sy /
+only directories and subdirectories are matched.
+.It Fl h
Each command becomes a tracked alias when first encountered.
-.RE
-
-.sp
-.ne 2
-.na
-\fB-k\fR
-.ad
-.sp .6
-.RS 4n
-Obsolete. All variable assignment arguments are placed in the environment for a
-command, not just those that precede the command name.
-.RE
-
-.sp
-.ne 2
-.na
-\fB-m\fR
-.ad
-.sp .6
-.RS 4n
+.It Fl k
+Obsolete.
+All variable assignment arguments are placed in the environment for a command,
+not just those that precede the command name.
+.It Fl m
Background jobs run in a separate process group and a line prints upon
-completion. The exit status of background jobs is reported in a completion
-message. On systems with job control, this option is turned on automatically
-for interactive shells.
-.RE
-
-.sp
-.ne 2
-.na
-\fB-n\fR
-.ad
-.sp .6
-.RS 4n
+completion.
+The exit status of background jobs is reported in a completion message.
+On systems with job control, this option is turned on automatically for
+interactive shells.
+.It Fl n
Read commands and check them for syntax errors, but do not execute them.
Ignored for interactive shells.
-.RE
-
-.sp
-.ne 2
-.na
-\fB-o\fR
-.ad
-.sp .6
-.RS 4n
+.It Fl o
If no option name is supplied, the list of options and their current settings
-are written to standard output. When invoked with a \fB+\fR, the options are
-written in a format that can be input again to the shell to restore the
-settings. This option can be repeated to enable or disable multiple options.
-.sp
+are written to standard output.
+When invoked with a
+.Sy \&+ ,
+the options are written in a format that can be input again to the shell to
+restore the settings.
+This option can be repeated to enable or disable multiple options.
+.Pp
The following argument can be one of the following option names:
-.sp
-.ne 2
-.na
-\fBallexport\fR
-.ad
-.sp .6
-.RS 4n
-Same as \fB-a\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBbgnice\fR
-.ad
-.sp .6
-.RS 4n
-All background jobs are run at a lower priority. This is the default mode.
-.RE
-
-.sp
-.ne 2
-.na
-\fBbraceexpand\fR
-.ad
-.sp .6
-.RS 4n
-Same as \fB-\fRB.
-.RE
-
-.sp
-.ne 2
-.na
-\fBemacs\fR
-.ad
-.sp .6
-.RS 4n
-Puts you in an \fBemacs\fR style inline editor for command entry.
-.RE
-
-.sp
-.ne 2
-.na
-\fBerrexit\fR
-.ad
-.sp .6
-.RS 4n
-Same as \fB-e\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBglobstar\fR
-.ad
-.sp .6
-.RS 4n
-Same as \fB-G\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBgmacs\fR
-.ad
-.sp .6
-.RS 4n
-Puts you in a \fBgmacs\fR style inline editor for command entry.
-.RE
-
-.sp
-.ne 2
-.na
-\fBignoreeof\fR
-.ad
-.sp .6
-.RS 4n
-The shell does not exit on end-of-file. The command \fBexit\fR must be used.
-.RE
-
-.sp
-.ne 2
-.na
-\fBkeyword\fR
-.ad
-.sp .6
-.RS 4n
-Same as \fB-k\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBletoctal\fR
-.ad
-.sp .6
-.RS 4n
-The \fBlet\fR command allows octal constants starting with \fB0\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBmarkdirs\fR
-.ad
-.sp .6
-.RS 4n
+.Bl -tag -width Ar
+.It Cm allexport
+Same as
+.Fl a .
+.It Cm bgnice
+All background jobs are run at a lower priority.
+This is the default mode.
+.It Cm braceexpand
+Same as
+.Fl B .
+.It Cm emacs
+Puts you in an
+.Sy emacs
+style inline editor for command entry.
+.It Cm errexit
+Same as
+.Fl e .
+.It Cm globstar
+Same as
+.Fl G .
+.It Cm gmacs
+Puts you in a
+.Sy gmacs
+style inline editor for command entry.
+.It Cm ignoreeof
+The shell does not exit on end-of-file.
+The command
+.Ic exit
+must be used.
+.It Cm keyword
+Same as
+.Fl k .
+.It Cm letoctal
+The
+.Ic let
+command allows octal constants starting with
+.Sy 0 .
+.It Cm markdirs
All directory names resulting from file name generation have a trailing /
appended.
-.RE
-
-.sp
-.ne 2
-.na
-\fBmonitor\fR
-.ad
-.sp .6
-.RS 4n
-Same as \fB-m\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBmultiline\fR
-.ad
-.sp .6
-.RS 4n
+.It Cm monitor
+Same as
+.Fl m .
+.It Cm multiline
The built-in editors use multiple lines on the screen for lines that are longer
-than the width of the screen. This might not work for all terminals.
-.RE
-
-.sp
-.ne 2
-.na
-\fBnoclobber\fR
-.ad
-.sp .6
-.RS 4n
-Same as \fB-C\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBnoexec\fR
-.ad
-.sp .6
-.RS 4n
-Same as \fB-n\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBnoglob\fR
-.ad
-.sp .6
-.RS 4n
-Same as \fB-f\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBnolog\fR
-.ad
-.sp .6
-.RS 4n
+than the width of the screen.
+This might not work for all terminals.
+.It Cm noclobber
+Same as
+.Fl C .
+.It Cm noexec
+Same as
+.Fl n .
+.It Cm noglob
+Same as
+.Fl f .
+.It Cm nolog
Do not save function definitions in the history file.
-.RE
-
-.sp
-.ne 2
-.na
-\fBnotify\fR
-.ad
-.sp .6
-.RS 4n
-Same as \fB-b\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBnounset\fR
-.ad
-.sp .6
-.RS 4n
-Same as \fB-u\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBpipefail\fR
-.ad
-.sp .6
-.RS 4n
+.It Cm notify
+Same as
+.Fl b .
+.It Cm nounset
+Same as
+.Fl u .
+.It Cm pipefail
A pipeline does not complete until all components of the pipeline have
-completed, and the return value is the value of the last \fBnon-zero\fR command
-to fail or zero if no command has failed.
-.RE
-
-.sp
-.ne 2
-.na
-\fBprivileged\fR
-.ad
-.sp .6
-.RS 4n
-Same as \fB-p\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBshowme\fR
-.ad
-.sp .6
-.RS 4n
-When enabled, simple commands or pipelines preceded by a a semicolon (\fB;\fR)
-is displayed as if the \fBxtrace\fR option were enabled but is not executed.
-Otherwise, the leading \fB;\fR is ignored.
-.RE
-
-.sp
-.ne 2
-.na
-\fBtrackall\fR
-.ad
-.sp .6
-.RS 4n
-Same as \fB-h\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBverbose\fR
-.ad
-.sp .6
-.RS 4n
-Same as \fB-v\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBvi\fR
-.ad
-.sp .6
-.RS 4n
-Puts you in insert mode of a \fBvi\fR style inline editor until you hit the
-escape character 033. This puts you in control mode. A return sends the line.
-.RE
-
-.sp
-.ne 2
-.na
-\fBviraw\fR
-.ad
-.sp .6
-.RS 4n
-Each character is processed as it is typed in \fBvi\fR mode.
-.RE
-
-.sp
-.ne 2
-.na
-\fBxtrace\fR
-.ad
-.sp .6
-.RS 4n
-Same as \fB-x\fR.
-.sp
+completed, and the return value is the value of the last
+.Sy non-zero
+command to fail or zero if no command has failed.
+.It Cm privileged
+Same as
+.Fl p .
+.It Cm showme
+When enabled, simple commands or pipelines preceded by a a semicolon
+.Pq \&;
+is displayed as if the
+.Cm xtrace
+option were enabled but is not executed.
+Otherwise, the leading
+.Sy \&;
+is ignored.
+.It Cm trackall
+Same as
+.Fl h .
+.It Cm verbose
+Same as
+.Fl v .
+.It Cm vi
+Puts you in insert mode of a
+.Sy vi
+style inline editor until you hit the escape character 033.
+This puts you in control mode.
+A return sends the line.
+.It Cm viraw
+Each character is processed as it is typed in
+.Sy vi
+mode.
+.It Cm xtrace
+Same as
+.Fl x .
+.El
+.Pp
If no option name is supplied, the current options settings are printed.
-.RE
-
-.RE
-
-.sp
-.ne 2
-.na
-\fB-p\fR
-.ad
-.sp .6
-.RS 4n
-Disables processing of the \fB$HOME/.profile\fR file and uses the file
-\fB/etc/suid_profile\fR instead of the \fBENV\fR file. This mode is on whenever
-the effective \fBuid\fR (\fBgid\fR) is not equal to the real \fBuid\fR
-(\fBgid\fR). Turning this off causes the effective \fBuid\fR and \fBgid\fR to
-be set to the real \fBuid\fR and \fBgid\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fB-r\fR
-.ad
-.sp .6
-.RS 4n
-Enables the restricted shell. This option cannot be unset once set.
-.RE
-
-.sp
-.ne 2
-.na
-\fB-s\fR
-.ad
-.sp .6
-.RS 4n
+.It Fl p
+Disables processing of the
+.Pa $HOME/.profile
+file and uses the file
+.Pa /etc/suid_profile
+instead of the
+.Ev ENV
+file.
+This mode is on whenever the effective
+.Sy uid Pq Sy gid
+is not equal to the real
+.Sy uid Pq Sy gid .
+Turning this off causes the effective
+.Sy uid
+and
+.Sy gid
+to be set to the real
+.Sy uid
+and
+.Sy gid .
+.It Fl r
+Enables the restricted shell.
+This option cannot be unset once set.
+.It Fl s
Sort the positional parameters lexicographically.
-.RE
-
-.sp
-.ne 2
-.na
-\fB-t\fR
-.ad
-.sp .6
-.RS 4n
-Obsolete. Exit after reading and executing one command.
-.RE
-
-.sp
-.ne 2
-.na
-\fB-u\fR
-.ad
-.sp .6
-.RS 4n
-Treat \fBunset\fR parameters as an error when substituting.
-.RE
-
-.sp
-.ne 2
-.na
-\fB-v\fR
-.ad
-.sp .6
-.RS 4n
+.It Fl t
+Obsolete.
+Exit after reading and executing one command.
+.It Fl u
+Treat
+.Sy unset
+parameters as an error when substituting.
+.It Fl v
Print shell input lines as they are read.
-.RE
-
-.sp
-.ne 2
-.na
-\fB-x\fR
-.ad
-.sp .6
-.RS 4n
+.It Fl x
Print commands and their arguments as they are executed.
-.RE
-
-.sp
-.ne 2
-.na
-\fB--\fR
-.ad
-.sp .6
-.RS 4n
-Do not change any of the options. This is useful in setting \fB$1\fR to a value
-beginning with \fB-\fR. If no arguments follow this option then the positional
-parameters are unset.
-.RE
-
-As an obsolete feature, if the first \fIarg\fR is - then the \fB-x\fR and
-\fB-v\fR options are turned off and the next \fIarg\fR is treated as the first
-argument. Using \fB+\fR rather than \fB-\fR causes these options to be turned
-off. These options can also be used upon invocation of the shell. The current
-set of options can be found in \fB$-\fR. Unless \fB-A\fR is specified, the
-remaining arguments are positional parameters and are assigned, in order, to
-\fB$1 $2 \&....\fR If no arguments are specified, then the names and values of
-all variables are printed on the standard output.
-.RE
-
-.sp
-.ne 2
-.na
-\fB+shift\fR \fB[\fR\fIn\fR\fB]\fR
-.ad
-.sp .6
-.RS 4n
-The positional parameters from \fB$\fR\fIn\fR\fB+1 ...\fR are renamed
-\fB$1 ...\fR, the default \fIn\fR is \fB1\fR. The parameter \fIn\fR can be any
-arithmetic expression that evaluates to a non-negative number less than or
-equal to \fB$#\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBsleep\fR \fIseconds\fR
-.ad
-.sp .6
-.RS 4n
+.It Fl \-
+Do not change any of the options.
+This is useful in setting
+.Sy $1
+to a value
+beginning with
+.Sy \- .
+If no arguments follow this option then the positional parameters are unset.
+.El
+.Pp
+As an obsolete feature, if the first
+.Ar arg
+is
+.Sy \-
+then the
+.Fl x
+and
+.Fl v
+options are turned off and the next
+.Ar arg
+is treated as the first argument.
+Using
+.Sy \&+
+rather than
+.Fl
+causes these options to be turned off.
+These options can also be used upon invocation of the shell.
+The current set of options can be found in
+.Sy $- .
+Unless
+.Fl A
+is specified, the remaining arguments are positional parameters and are
+assigned, in order, to
+.Sy $1 $2 \&... .
+If no arguments are specified, then
+the names and values of all variables are printed on the standard output.
+.Pp
+.It Sy + Ic shift Op Ar n
+The positional parameters from
+.Sy $ Ns Ar n Ns Sy +1
+are renamed
+.Sy $1 \&... ,
+the default
+.Ar n
+is
+.Sy 1 .
+The parameter
+.Ar n
+can be any arithmetic expression that evaluates to a non-negative number less
+than or equal to
+.Sy $# .
+.Pp
+.It Ic sleep Ar seconds
Suspends execution for the number of decimal seconds or fractions of a second
-specified by \fIseconds\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fB+trap\fR \fB-p\fR \fB[\fR\fIaction\fR\fB]\fR
-\fB[\fR\fIsig\fR\fB] ...\fR
-.ad
-.sp .6
-.RS 4n
-The \fB-p\fR option causes the trap action associated with each trap as
-specified by the arguments to be printed with appropriate quoting. Otherwise,
-\fIaction\fR is processed as if it were an argument to \fBeval\fR when the
-shell receives signal(s) \fIsig\fR. Each \fIsig\fR can be specified as a number
-or as the name of the signal. Trap commands are executed in order of signal
-number. Any attempt to set a trap on a signal that was ignored on entry to the
-current shell is ineffective. If \fIaction\fR is omitted and the first
-\fIsig\fR is a number, or if \fIaction\fR is \fB-\fR, then the trap(s) for each
-\fIsig\fR are reset to their original values. If \fIaction\fR is the null
-string then this signal is ignored by the shell and by the commands it invokes.
-If \fIsig\fR is \fBERR\fR then \fIaction\fR is executed whenever a command has
-a \fBnon-zero\fR exit status. If \fIsig\fR is \fBDEBUG\fR then \fIaction\fR is
-executed before each command. The variable \fB\&.sh.command\fR contains the
-contents of the current command line when \fIaction\fR is running. If \fIsig\fR
-is \fB0\fR or \fBEXIT\fR and the trap statement is executed inside the body of
-a function defined with the \fBfunction\fR \fIname\fR syntax, then the command
-\fIaction\fR is executed after the function completes. If \fIsig\fR is \fB0\fR
-or \fBEXIT\fR for a trap set outside any function then the command \fIaction\fR
-is executed on exit from the shell. If \fIsig\fR is \fBKEYBD\fR, then
-\fIaction\fR is executed whenever a key is read while in \fBemacs\fR,
-\fBgmacs\fR, or \fBvi\fR mode. The \fBtrap\fR command with no arguments prints
-a list of commands associated with each signal number.
-.RE
-
-.sp
-.ne 2
-.na
-\fBtrue\fR
-.ad
-.sp .6
-.RS 4n
-Does nothing, and exits \fB0\fR. Used with while for infinite loops.
-.RE
-
-.sp
-.ne 2
-.na
-\fB++typeset [\(+-ACHSfblmnprtux ] [ \(+-EFLRXZi[\fR\fIn\fR\fB] ]
-[ \(+-M \fB[ \fImapname\fR \fB] ]
-[ -T [ \fR\fItname\fR\fB=(\fR\fIassign_list\fR\fB) ] ]
-[ -h \fR\fIstr\fR\fB ]
-[ -a [\fR\fItype\fR\fB] ]
-[ \fR\fIvname\fR\fB[=\fR\fIvalue\fR \fB] ]\fR
-.ad
-.sp .6
-.RS 4n
-Sets attributes and values for shell variables and functions. When invoked
-inside a function defined with the \fBfunction\fR \fIname\fR syntax, a new
-instance of the variable \fIvname\fR is created, and the variable's value and
-type are restored when the function completes.
-.sp
-Using \fB+\fR rather than \fB-\fR causes these options to be turned off. If no
-\fIvname\fR arguments are specified, a list of \fIvname\fRs (and optionally the
-\fIvalue\fRs) of the variables is printed. Using \fB+\fR rather than \fB-\fR
-keeps the values from being printed.) The \fB-p\fR option causes \fBtypeset\fR
+specified by
+.Ar seconds .
+.Pp
+.It Sy + Ic trap Oo Fl p Oc Oo Ar action Oc Oo Ar sig Oc ...
+The
+.Fl p
+option causes the trap action associated with each trap as specified by the
+arguments to be printed with appropriate quoting.
+Otherwise,
+.Ar action
+is processed as if it were an argument to
+.Ic eval
+when the shell receives signal(s)
+.Ar sig .
+Each
+.Ar sig
+can be specified as a number or as the name of the signal.
+Trap commands are executed in order of signal number.
+Any attempt to set a trap on a signal that was ignored on entry to the current
+shell is ineffective.
+If
+.Ar action
+is omitted and the first
+.Ar sig
+is a number, or if
+.Ar action
+is
+.Sy - ,
+then the trap(s) for each
+.Ar sig
+are reset to their original values.
+If
+.Ar action
+is the null string then this signal is ignored by the shell and by the commands
+it invokes.
+If
+.Ar sig
+is
+.Sy ERR
+then
+.Ar action
+is executed whenever a command has a
+.Sy non-zero
+exit status.
+If
+.Ar sig
+is
+.Sy DEBUG
+then
+.Ar action
+is executed before each command.
+The variable
+.Sy \&.sh.command
+contains the contents of the current command line when
+.Ar action
+is running.
+If
+.Ar sig
+is
+.Sy 0
+or
+.Sy EXIT
+and the trap statement is executed inside the body of a function defined with
+the
+.Ic function Ar name
+syntax, then the command
+.Ar action
+is executed after the function completes.
+If
+.Ar sig
+is
+.Sy 0
+or
+.Sy EXIT
+for a trap set outside any function then the command
+.Ar action
+is executed on exit from the shell.
+If
+.Ar sig
+is
+.Sy KEYBD ,
+then
+.Ar action
+is executed whenever a key is read while in
+.Sy emacs ,
+.Sy gmacs ,
+or
+.Sy vi
+mode.
+The
+.Sy trap
+command with no arguments prints a list of commands associated with each signal
+number.
+.Pp
+.It Ic true
+Does nothing, and exits
+.Sy 0 .
+Used with while for infinite loops.
+.Pp
+.It Xo
+.Bk -words
+.Sy ++ Ic typeset
+.Op Sy + Ns Fl ACHSfblmnprtux
+.Op Sy + Ns Fl EFLRXZi Ns Op Ar n
+.Op Sy + Ns Fl M Op Ar mapname
+.Op Fl T Op Ar tname Ns Sy =( Ns Ar assign_list Ns Sy \&)
+.Op Fl h Ar str
+.Op Fl a Op Ar type
+.Op Ar vname Ns Op Sy = Ns Ar value
+.Ek
+.Xc
+.Pp
+Sets attributes and values for shell variables and functions.
+When invoked inside a function defined with the
+.Sy function Ar name
+syntax, a new instance of the variable
+.Ar vname
+is created, and the variable's value and type are restored when the function
+completes.
+.Pp
+Using
+.Sy +
+rather than
+.Fl
+causes these options to be turned off.
+If no
+.Ar vname
+arguments are specified, a list of
+.Ar vname Ns No s
+.Po and optionally the
+.Ar value Ns No s
+.Pc
+of the variables is printed.
+Using
+.Sy +
+rather than
+.Fl -
+keeps the values from being printed.
+The
+.Fl p
+option causes
+.Ic typeset
followed by the option letters to be printed before each name rather than the
-names of the options. If any option other than \fB-p\fR is specified, only
-those variables which have all of the specified options are printed. Otherwise,
-the \fIvname\fRs and \fIattributes\fR of all variables that have attributes are
+names of the options.
+If any option other than
+.Fl p
+is specified, only those variables which have all of the specified options are
printed.
-.sp
+Otherwise, the
+.Ar vname Ns No s
+and
+.Ar attribute Ns No s
+of all variables that have attributes are printed.
+.Pp
The following list of attributes can be specified:
-.sp
-.ne 2
-.na
-\fB-a\fR
-.ad
-.RS 6n
-Declares \fIvname\fR to be an indexed array. This is optional unless except for
-compound variable assignments.
-.RE
-
-.sp
-.ne 2
-.na
-\fB-A\fR
-.ad
-.RS 6n
-Declares \fIvname\fR to be an associative array. Sub-scripts are strings rather
-than arithmetic expressions.
-.RE
-
-.sp
-.ne 2
-.na
-\fB-b\fR
-.ad
-.RS 6n
-The variable can hold any number of bytes of data. The data can be text or
-binary. The value is represented by the \fBbase64\fR encoding of the data. If
-\fB-Z\fR is also specified, the size in bytes of the data in the buffer is
-determined by the size associated with the \fB-Z\fR. If the \fBbase64\fR string
-assigned results in more data, it is truncated. Otherwise, it is filled with
-bytes whose value is zero. The \fBprintf\fR format \fB%B\fR can be used to
-output the actual data in this buffer instead of the \fBbase64\fR encoding of
-the data.
-.RE
-
-.sp
-.ne 2
-.na
-\fB-C\fR
-.ad
-.RS 6n
-Causes each \fIvname\fR to be a compound variable. If \fIvalue\fR names
-a compound variable it is copied into \fIvname\fR. Otherwise, it unsets each
-vname.
-.RE
-
-.sp
-.ne 2
-.na
-\fB-E\fR
-.ad
-.RS 6n
-Declares \fIvname\fR to be a double precision floating point number. If \fIn\fR
-is \fBnon-zero\fR, it defines the number of significant figures that are used
-when expanding \fIvname\fR. Otherwise, ten significant figures is used.
-.RE
-
-.sp
-.ne 2
-.na
-\fB-f\fR
-.ad
-.RS 6n
-The names refer to function names rather than variable names. No assignments
-can be made and the only other valid options are \fB-t\fR, \fB-u\fR, and
-\fB-x.\fR The \fB-t\fR option turns on execution tracing for this function. The
-\fB-u\fR option causes this function to be marked undefined. The \fBFPATH\fR
+.Bl -tag -width Ds
+.It Fl a
+Declares
+.Ar vname
+to be an indexed array.
+This is optional unless except for compound variable assignments.
+.It Fl A
+Declares
+.Ar vname
+to be an associative array.
+Sub-scripts are strings rather than arithmetic expressions.
+.It Fl b
+The variable can hold any number of bytes of data.
+The data can be text or binary.
+The value is represented by the
+.Sy base64
+encoding of the data.
+If
+.Fl Z
+is also specified, the size in bytes of the data in the buffer is determined by
+the size associated with the
+.Fl Z .
+If the
+.Sy base64
+string assigned results in more data, it is truncated.
+Otherwise, it is filled with bytes whose value is zero.
+The
+.Ic printf
+format
+.Cm \&%B
+can be used to output the actual data in this buffer instead of the
+.Sy base64
+encoding of the data.
+.It Fl C
+Causes each
+.Ar vname
+to be a compound variable.
+If
+.Ar value
+names a compound variable it is copied into
+.Ar vname .
+Otherwise, it unsets each
+.Ar vname .
+.It Fl E
+Declares
+.Ar vname
+to be a double precision floating point number.
+If
+.Ar n
+is
+.Sy non-zero ,
+it defines the number of significant figures that are used when expanding
+.Ar vname .
+Otherwise, ten significant figures is used.
+.It Fl f
+The names refer to function names rather than variable names.
+No assignments can be made and the only other valid options are
+.Fl t ,
+.Fl u ,
+and
+.Fl x .
+The
+.Fl t
+option turns on execution tracing for this function.
+The
+.Fl u
+option causes this function to be marked undefined.
+The
+.Ev FPATH
variable is searched to find the function definition when the function is
-referenced. If no options other than \fB-f\fR is specified, then the function
-definition is displayed on standard output. If \fB+f\fR is specified, then a
-line containing the function name followed by a shell comment containing the
-line number and path name of the file where this function was defined, if any,
-is displayed.
+referenced.
+If no options other than
+.Fl f
+are specified, then the function definition is displayed on standard output.
+If
+.Sy +f
+is specified, then a line containing the function name followed by a shell
+comment containing the line number and path name of the file where this
+function was defined, if any, is displayed.
The names refer to function names rather than variable names.
No assignments can be made and the only other valid options are
-\fB-S, -t, -u\fR and \fB-x\fR.
-The \fB-S\fR can be used with discipline functions defined in a type to
-indicate that the function is static. For a static function, the same method
-will be used by all instances of that type no matter which instance references
-it. In addition, it can only use value of variables from the original type
-definition. These discipline functions cannot be redefined in any type
-instance.
-The \fB-t\fR option turns on execution tracing for this function.
-The \fB-u\fR option causes this function to be marked undefined.
-The \fBFPATH\fR variable will be searched to find the function definition
-when the function is referenced.
-If no options other than \fB-f\fR is specified, then the function definition
-will be displayed on standard output. If \fB+f\fR is specified, then a line
-containing the function name followed by a shell comment containing the line
-number and path name of the file where this function was defined, if any, is
-displayed. The exit status can be used to determine whether the function is
-defined so that \fBtypeset -f .sh.math.\fR \fIname\fR will return 0 when math
-function \fIname\fR is defined and non-zero otherwise.
-.sp
-The \fB-i\fR attribute cannot be specified with \fB-f\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fB-F\fR
-.ad
-.RS 6n
-Declares \fIvname\fR to be a double precision floating point number. If \fIn\fR
-is \fBnon-zero\fR, it defines the number of places after the decimal point that
-are used when expanding \fIvname\fR. Otherwise ten places after the decimal
-point is used.
-.RE
-
-.sp
-.ne 2
-.na
-\fB-h\fR
-.ad
-.RS 6n
+.Fl S ,
+.Fl t ,
+.Fl u
+and
+.Fl x .
+The
+.Fl S
+option can be used with discipline functions defined in a type to indicate that
+the function is static.
+For a static function, the same method will be used by all instances of that
+type no matter which instance references it.
+In addition, it can only use value of variables from the original type
+definition.
+These discipline functions cannot be redefined in any type instance.
+The
+.Fl t
+option turns on execution tracing for this function.
+The
+.Fl u
+option causes this function to be marked undefined.
+The
+.Ev FPATH
+variable will be searched to find the function definition when the function is
+referenced.
+If no options other than
+.Fl f
+are specified, then the function definition will be displayed on standard
+output.
+If
+.Sy +f
+is specified, then a line containing the function name followed by a shell
+comment containing the line number and path name of the file where this
+function was defined, if any, is displayed.
+The exit status can be used to determine whether the function is defined so
+that
+.Ic typeset Fl f Sy .sh.math\&. Ns Ar name
+will return
+.Sy 0
+when math function
+.Ar name
+is defined and non-zero otherwise.
+.Pp
+The
+.Fl i
+attribute cannot be specified with
+.Fl f .
+.It Fl F
+Declares
+.Ar vname
+to be a double precision floating point number.
+If
+.Ar n
+is
+.Sy non-zero ,
+it defines the number of places after the decimal point that are used when
+expanding
+.Ar vname .
+Otherwise ten places after the decimal point is used.
+.It Fl h
Used within type definitions to add information when generating information
-about the sub-variable on the man page. It is ignored when used outside of a
-type definition. When used with \fB-f\fR the information is associated with the
-corresponding discipline function.
-.RE
-
-.sp
-.ne 2
-.na
-\fB-H\fR
-.ad
-.RS 6n
+about the sub-variable on the man page.
+It is ignored when used outside of a type definition.
+When used with
+.Fl f
+the information is associated with the corresponding discipline function.
+.It Fl H
This option provides UNIX to hostname file mapping on non-UNIX machines.
-.RE
-
-.sp
-.ne 2
-.na
-\fB-i\fR
-.ad
-.RS 6n
-Declares \fIvname\fR to be represented internally as integer. The right hand
-side of an assignment is evaluated as an arithmetic expression when assigning
-to an integer. If \fIn\fR is \fBnon-zero\fR, it defines the output arithmetic
-base, otherwise the output base is ten.
-.sp
-The \fB-i\fR attribute cannot be specified along with \fB-R\fR, \fB-L\fR,
-\fB-Z\fR, or \fB-f\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fB-l\fR
-.ad
-.RS 6n
-Used with \fB-i, -E\fR or \fB-F\fR to indicate long integer, or long float.
+.It Fl i
+Declares
+.Ar vname
+to be represented internally as integer.
+The right hand side of an assignment is evaluated as an arithmetic expression
+when assigning to an integer.
+If
+.Ar n
+is
+.Sy non-zero ,
+it defines the output arithmetic base, otherwise the output base is ten.
+.Pp
+The
+.Fl i
+attribute cannot be specified along with
+.Fl R ,
+.Fl L ,
+.Fl Z ,
+or
+.Fl f .
+.It Fl l
+Used with
+.Fl i ,
+.Fl E
+or
+.Fl F
+to indicate long integer, or long float.
Otherwise, all upper-case characters are converted to lower-case.
-The upper-case option, \fB-u\fR, is turned off.
-Equivalent to \fB-M tolower\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fB-L\fR
-.ad
-.RS 6n
-Left justify and remove leading blanks from \fIvalue\fR. If \fIn\fR is
-\fBnon-zero\fR, it defines the width of the field, otherwise it is determined
-by the width of the value of first assignment. When the variable is assigned
-to, it is filled on the right with blanks or truncated, if necessary, to fit
-into the field. The \fB-R\fR option is turned off.
-.sp
-The \fB-i\fR attribute cannot be specified with \fB-L\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fB-m\fR
-.ad
-.RS 6n
-moves or renames the variable. The value is the name of a variable whose value
-will be moved to \fIvname\fR. The original variable will be unset. Cannot be
-used with any other options.
-.RE
-
-.sp
-.ne 2
-.na
-\fB-M\fR
-.ad
-.RS 6n
-Use the character mapping \fImapping\fR such as \fBtolower\fR
-and \fBtoupper\fR when assigning a value to each of the specified operands.
-When \fImapping\fR is specified and there are not operands, all variables
-that use this mapping are written to standard output.
-When \fImapping\fR is omitted and there are no operands, all mapped
-variables are written to standard output.
-.RE
-
-.sp
-.ne 2
-.na
-\fB-n\fR
-.ad
-.RS 6n
-Declares \fIvname\fR to be a reference to the variable whose name is defined by
-the value of variable \fIvname\fR. This is usually used to reference a variable
-inside a function whose name has been passed as an argument.
-.RE
-
-.sp
-.ne 2
-.na
-\fB-p\fR
-.ad
-.RS 6n
-The name, attributes and values for the given \fIvname\fR
+The upper-case option,
+.Fl u ,
+is turned off.
+Equivalent to
+.Fl M Cm tolower .
+.It Fl L
+Left justify and remove leading blanks from
+.Ar value .
+If
+.Ar n
+is
+.Sy non-zero ,
+it defines the width of the field, otherwise it is determined by the width of
+the value of first assignment.
+When the variable is assigned to, it is filled on the right with blanks or
+truncated, if necessary, to fit into the field.
+The
+.Fl R
+option is turned off.
+.Pp
+The
+.Fl i
+attribute cannot be specified with
+.Fl L .
+.It Fl m
+moves or renames the variable.
+The value is the name of a variable whose value will be moved to
+.Ar vname .
+The original variable will be unset.
+Cannot be used with any other options.
+.It Fl M
+Use the character mapping
+.Ar mapping
+such as
+.Sy tolower
+and
+.Sy toupper
+when assigning a value to each of the specified operands.
+When
+.Ar mapping
+is specified and there are not operands, all variables that use this mapping
+are written to standard output.
+When
+.Ar mapping
+is omitted and there are no operands, all mapped variables are written to
+standard output.
+.It Fl n
+Declares
+.Ar vname
+to be a reference to the variable whose name is defined by the value of
+variable
+.Ar vname .
+This is usually used to reference a variable inside a function whose name has
+been passed as an argument.
+.It Fl p
+The name, attributes and values for the given
+.Ar vname
are written on standard output in a form that can be used as shell input.
-If \fB+p\fR is specified, then the values are not displayed.
-.RE
-
-.sp
-.ne 2
-.na
-\fB-R\fR
-.ad
-.RS 6n
-Right justify and fill with leading blanks. If \fIn\fR is \fBnon-zero\fR, it
-defines the width of the field, otherwise it is determined by the width of the
-value of first assignment. The field is left filled with blanks or truncated
-from the end if the variable is reassigned. The \fB-L\fR option is turned off.
-.sp
-The \fB-i\fR attribute cannot be specified with \fB-R\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fB-r\fR
-.ad
-.RS 6n
-The specified \fIvname\fRs are marked read-only and these names cannot be
-changed by subsequent assignment.
-.RE
-
-.sp
-.ne 2
-.na
-\fB-S\fR
-.ad
-.RS 6n
-When used within the \fIassign_list\fR of a type definition, it causes the
-specified sub-variable to be shared by all instances of the type. When used
-inside a function defined with the \fBfunction\fR reserved word, the specified
-variables will have \fIfunction static\fR scope. Otherwise, the variable is
-unset prior to processing the assignment list.
-.RE
-
-.sp
-.ne 2
-.na
-\fB-t\fR
-.ad
-.RS 6n
-Tags the variables. Tags are user definable and have no special meaning to the
-shell.
-.RE
-
-.sp
-.ne 2
-.na
-\fB-T\fR
-.ad
-.RS 6n
-If followed by \fItname\fR, it creates a type named by \fItname\fR using the
-compound assignment \fIassign_list\fR to \fItname\fR. Otherwise, it writes all
+If
+.Sy +p
+is specified, then the values are not displayed.
+.It Fl R
+Right justify and fill with leading blanks.
+If
+.Ar n
+is
+.Sy non-zero ,
+it defines the width of the field, otherwise it is determined by the width of
+the value of first assignment.
+The field is left filled with blanks or truncated from the end if the variable
+is reassigned.
+The
+.Fl L
+option is turned off.
+.Pp
+The
+.Fl i
+attribute cannot be specified with
+.Fl R .
+.It Fl r
+The specified
+.Ar vname Ns No s
+are marked read-only and these names cannot be changed by subsequent
+assignment.
+.It Fl S
+When used within the
+.Ar assign_list
+of a type definition, it causes the specified sub-variable to be shared by all
+instances of the type.
+When used inside a function defined with the
+.Ic function
+reserved word, the specified variables will have
+.Em function static
+scope.
+Otherwise, the variable is unset prior to processing the assignment list.
+.It Fl t
+Tags the variables.
+Tags are user definable and have no special meaning to the shell.
+.It Fl T
+If followed by
+.Ar tname ,
+it creates a type named by
+.Ar tname
+using the compound assignment
+.Ar assign_list
+to
+.Ar tname .
+Otherwise, it writes all
the type definitions to standard output.
-.RE
-
-.sp
-.ne 2
-.na
-\fB-u\fR
-.ad
-.RS 6n
-When given along with \fB-i\fR specifies unsigned integer.
+.It Fl u
+When given along with
+.Fl i
+specifies unsigned integer.
Otherwise, all lower-case characters are converted to upper-case.
-The lower-case option, \fB-l\fR, is turned off.
-Equivalent to \fB-M toupper\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fB-x\fR
-.ad
-.RS 6n
-The specified \fIvname\fRs are marked for automatic export to the environment
-of subsequently-executed commands. Variables whose names contain a \fB.\fR
+The lower-case option,
+.Fl l ,
+is turned off.
+Equivalent to
+.Fl M Cm toupper .
+.It Fl x
+The specified
+.Ar vname Ns No s
+are marked for automatic export to the environment of subsequently-executed
+commands.
+Variables whose names contain a
+.Sy \&.
cannot be exported.
-.RE
-
-.sp
-.ne 2
-.na
-\fB-X\fR
-.ad
-.RS 6n
-Declares \fIvname\fR to be a double precision floating point number
-and expands using the \fB%a\fR format of ISO-C99.
-If \fIn\fR is non-zero, it defines the number of hex digits after
-the radix point that is used when expanding \fIvname\fR.
+.It Fl X
+Declares
+.Ar vname
+to be a double precision floating point number and expands using the
+.Cm %a
+format of ISO-C99.
+If
+.Ar n
+is non-zero, it defines the number of hex digits after the radix point that is
+used when expanding
+.Ar vname .
The default is 10.
-.RE
-
-.sp
-.ne 2
-.na
-\fB-Z\fR
-.ad
-.RS 6n
+.It Fl Z
Right justify and fill with leading zeros if the first non-blank character is a
-digit and the \fB-L\fR option has not been set. Remove leading zeros if the
-\fB-L\fR option is also set. If \fIn\fR is \fBnon-zero\fR, it defines the width
-of the field, otherwise it is determined by the width of the value of first
-assignment.
-.sp
-The \fB-i\fR attribute cannot be specified with \fB-Z\fR.
-.RE
-
-.RE
-
-.sp
-.ne 2
-.na
-\fBulimit [\fR\fB-HSacdfmnpstv\fR\fB] [\fR \fIlimit\fR\fB]\fR
-.ad
-.sp .6
-.RS 4n
-Set or display a resource limit. Many systems do not support one or more of
-these limits. The limit for a specified resource is set when \fIlimit\fR is
-specified. The value of \fIlimit\fR can be a number in the unit specified with
-each resource, or the value unlimited. When more than one resource is
-specified, then the limit name and unit is printed before the value.
-.sp
-If no option is specified, \fB-f\fR is assumed.
-.sp
+digit and the
+.Fl L
+option has not been set.
+Remove leading zeros if the
+.Fl L
+option is also set.
+If
+.Ar n
+is
+.Sy non-zero ,
+it defines the width of the field, otherwise it is determined by the width of
+the value of first assignment.
+.Pp
+The
+.Fl i
+attribute cannot be specified with
+.Fl Z .
+.El
+.Pp
+.It Ic ulimit Oo Fl HSacdfmnpstv Oc Op Ar limit
+Set or display a resource limit.
+Many systems do not support one or more of these limits.
+The limit for a specified resource is set when
+.Ar limit
+is specified.
+The value of
+.Ar limit
+can be a number in the unit specified with each resource, or the value
+unlimited.
+When more than one resource is specified, then the limit name and unit is
+printed before the value.
+.Pp
+If no option is specified,
+.Fl f
+is assumed.
+.Pp
The following are the available resource limits:
-.sp
-.ne 2
-.na
-\fB-a\fR
-.ad
-.RS 6n
+.Bl -tag -width Ds
+.It Fl a
Lists all of the current resource limits.
-.RE
-
-.sp
-.ne 2
-.na
-\fB-c\fR
-.ad
-.RS 6n
+.It Fl c
The number of 512-byte blocks on the size of core dumps.
-.RE
-
-.sp
-.ne 2
-.na
-\fB-d\fR
-.ad
-.RS 6n
+.It Fl d
The number of Kbytes on the size of the data area.
-.RE
-
-.sp
-.ne 2
-.na
-\fB-f\fR
-.ad
-.RS 6n
+.It Fl f
The number of 512-byte blocks on files that can be written by the current
process or by child processes (files of any size can be read).
-.RE
-
-.sp
-.ne 2
-.na
-\fB-H\fR
-.ad
-.RS 6n
+.It Fl H
Specifies a hard limit for the specified resource.
-.sp
+.Pp
A hard limit cannot be increased once it is set.
-.sp
-If neither the \fB-H\fR nor \fB-S\fR option is specified, the limit applies to
-both. The current resource limit is printed when \fIlimit\fR is omitted. In
-this case, the soft limit is printed unless \fB-H\fR is specified.
-.RE
-
-.sp
-.ne 2
-.na
-\fB-m\fR
-.ad
-.RS 6n
+.Pp
+If neither the
+.Fl H
+nor
+.Fl S
+option is specified, the limit applies to
+both.
+The current resource limit is printed when
+.Ar limit
+is omitted.
+In this case, the soft limit is printed unless
+.Fl H
+is specified.
+.It Fl m
The number of Kbytes on the size of physical memory.
-.RE
-
-.sp
-.ne 2
-.na
-\fB-n\fR
-.ad
-.RS 6n
+.It Fl n
The number of file descriptors plus 1.
-.RE
-
-.sp
-.ne 2
-.na
-\fB-p\fR
-.ad
-.RS 6n
+.It Fl p
The number of 512-byte blocks for pipe buffering.
-.RE
-
-.sp
-.ne 2
-.na
-\fB-s\fR
-.ad
-.RS 6n
+.It Fl s
The number of Kbytes on the size of the stack area.
-.RE
-
-.sp
-.ne 2
-.na
-\fB-S\fR
-.ad
-.RS 6n
+.It Fl S
Specifies a soft limit for the specified resource.
-.sp
+.Pp
A soft limit can be increased up to the value of the hard limit.
-.sp
-If neither the \fB-H\fR nor \fB-S\fR option is specified, the limit applies to
-both. The current resource limit is printed when \fIlimit\fR is omitted. In
-this case, the soft limit is printed unless \fB-H\fR is specified.
-.RE
-
-.sp
-.ne 2
-.na
-\fB-t\fR
-.ad
-.RS 6n
+.Pp
+If neither the
+.Fl H
+nor
+.Fl S
+option is specified, the limit applies to both.
+The current resource limit is printed when
+.Ar limit
+is omitted.
+In this case, the soft limit is printed unless
+.Fl H
+is specified.
+.It Fl t
The number of CPU seconds to be used by each process.
-.RE
-
-.sp
-.ne 2
-.na
-\fB-v\fR
-.ad
-.RS 6n
+.It Fl v
The number of Kbytes for virtual memory.
-.RE
-
-.RE
-
-.sp
-.ne 2
-.na
-\fBumask\fR \fB[\fR\fB-S\fR\fB]\fR\fB[\fR\fImask\fR\fB]\fR
-.ad
-.sp .6
-.RS 4n
-The user file-creation mask is set to \fImask\fR. \fImask\fR can either be an
-octal number or a symbolic value as described in \fBchmod\fR(1).
-.sp
-If a symbolic value is specified, the new \fBumask\fR value is the complement
-of the result of applying \fImask\fR to the complement of the previous
-\fBumask\fR value. If \fImask\fR is omitted, the current value of the mask is
-printed. The \fB-S\fR option causes the mode to be printed as a symbolic value.
+.El
+.Pp
+.It Ic umask Oo Fl S Oc Op Ar mask
+The user file-creation mask is set to
+.Ar mask .
+.Ar mask
+can either be an octal number or a symbolic value as described in
+.Xr chmod 1 .
+.Pp
+If a symbolic value is specified, the new
+.Sy umask
+value is the complement of the result of applying
+.Ar mask
+to the complement of the previous
+.Sy umask
+value.
+If
+.Ar mask
+is omitted, the current value of the mask is printed.
+The
+.Fl S
+option causes the mode to be printed as a symbolic value.
Otherwise, the mask is printed in octal.
-.sp
-See \fBumask\fR(2)
-.RE
-
-.sp
-.ne 2
-.na
-\fB+unalias\fR \fB[\fR\fB-a\fR\fB]\fR \fIname\fR
-.ad
-.sp .6
-.RS 4n
-The aliases specified by the list of \fIname\fRs are removed from the alias
-list. The \fB-a\fR option causes all the aliases to be unset.
-.RE
-
-.sp
-.ne 2
-.na
-\fB+unset\fR \fB[\fR\fB-fnv\fR\fB]\fR \fIvname\fR
-.ad
-.sp .6
-.RS 4n
-The variables specified by the list of \fIvname\fRs are unassigned, i.e., their
-values and attributes are erased. Read-only variables cannot be unset. If the
-\fB-f\fR option is set, then the names refer to function names. If the \fB-v\fR
-option is set, then the names refer to variable names. The \fB-f\fR option
-overrides \fB-v\fR. If \fB-n\fR is set and \fIname\fR is a name reference, then
-\fIname\fR is unset rather than the variable that it references. The default is
-equivalent to \fB-v\fR. Unsetting \fBLINENO\fR, \fBMAILCHECK\fR, \fBOPTARG\fR,
-\fBOPTIND\fR, \fBRANDOM\fR, \fBSECONDS\fR, \fBTMOUT\fR, and \fB_\fR removes
-their special meaning even if they are subsequently assigned to.
-.RE
-
-.sp
-.ne 2
-.na
-\fBwait\fR \fB[\fR\fIjob\fR\fB]\fR
-.ad
-.sp .6
-.RS 4n
-Wait for the specified job and report its termination status. If \fIjob\fR is
-not specified, then all currently active child processes are waited for. The
-exit status from this command is that of the last process waited for if
-\fIjob\fR is specified; otherwise it is zero. See \fBJobs\fR for a description
-of the format of \fIjob\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBwhence\fR \fB[\fR\fB-afpv\fR\fB]\fR \fIname ...\fR
-.ad
-.sp .6
-.RS 4n
-For each \fIname\fR, indicate how it would be interpreted if used as a command
-name. The \fB-v\fR option produces a more verbose report. The \fB-f\fR option
-skips the search for functions. The \fB-p\fR option does a path search for
-\fIname\fR even if name is an alias, a function, or a reserved word. The
-\fB-a\fR option is similar to the -v option but causes all interpretations of
-the specified name to be reported.
-.RE
-
-.SS "Invocation"
-If the shell is invoked by \fBexec\fR(2), and the first character of argument
-zero (\fB$0\fR) is \fB-\fR, then the shell is assumed to be a login shell and
-commands are read from \fB/etc/profile\fR and then from either .\fBprofile\fR
-in the current directory or \fB$HOME/.profile\fR, if either file exists. Next,
-for interactive shells, commands are read first from \fB/etc/ksh.kshrc\fR, and
-then from the file named by performing parameter expansion, command
+.Pp
+See
+.Xr umask 2
+.Pp
+.It Sy + Ic unalias Oo Fl a Oc Ar name No ...
+The aliases specified by the list of
+.Ar name Ns No s
+are removed from the alias list.
+The
+.Fl a
+option causes all the aliases to be unset.
+.Pp
+.It Sy + Ic unset Oo Fl fnv Oc Ar vname No ...
+The variables specified by the list of
+.Ar vname Ns No s
+are unassigned, i.e., their values and attributes are erased.
+Read-only variables cannot be unset.
+If the
+.Fl f
+option is set, then the names refer to function names.
+If the
+.Fl v
+option is set, then the names refer to variable names.
+The
+.Fl f
+option overrides
+.Fl v .
+If
+.Fl n
+is set and
+.Ar name
+is a name reference, then
+.Ar name
+is unset rather than the variable that it references.
+The default is equivalent to
+.Fl v .
+Unsetting
+.Ev LINENO ,
+.Ev MAILCHECK ,
+.Ev OPTARG ,
+.Ev OPTIND ,
+.Ev RANDOM ,
+.Ev SECONDS ,
+.Ev TMOUT ,
+and
+.Ev _
+removes their special meaning even if they are subsequently assigned to.
+.Pp
+.It Ic wait Op Ar job
+Wait for the specified job and report its termination status.
+If
+.Ar job
+is not specified, then all currently active child processes are waited for.
+The exit status from this command is that of the last process waited for if
+.Ar job
+is specified; otherwise it is zero.
+See
+.Sx Jobs
+for a description of the format of
+.Ar job .
+.Pp
+.It Ic whence Oo Fl afpv Oc Ar name No ...
+For each
+.Ar name ,
+indicate how it would be interpreted if used as a command name.
+The
+.Fl v
+option produces a more verbose report.
+The
+.Fl f
+option skips the search for functions.
+The
+.Fl p
+option does a path search for
+.Ar name
+even if name is an alias, a function, or a reserved word.
+The
+.Fl a
+option is similar to the
+.Fl v
+option but causes all interpretations of the specified name to be reported.
+.El
+.Ss "Invocation"
+If the shell is invoked by
+.Xr exec 2 ,
+and the first character of argument zero
+.Pq Sy $0
+is
+.Sy - ,
+then the shell is assumed to be a login shell and commands are read from
+.Pa /etc/profile
+and then from either
+.Pa .profile
+in the current directory or
+.Pa $HOME/.profile ,
+if either file exists.
+Next, for interactive shells, commands are read first from
+.Pa /etc/ksh.kshrc ,
+and then from the file named by performing parameter expansion, command
substitution, and arithmetic substitution on the value of the environment
-variable \fBENV\fR if the file exists. If the \fB-s\fR option is not present
-and \fIarg\fR and a file by the name of \fIarg\fR exists, then it reads and
-executes this script. Otherwise, if the first \fIarg\fR does not contain a
-\fB/\fR, a path search is performed on the first \fIarg\fR to determine the
-name of the script to execute. The script \fIarg\fR must have execute
-permission and any \fBsetuid\fR and \fBsetgid\fR settings are ignored. If the
-script is not found on the path, \fIarg\fR is processed as if it named a
-built-in command or function.
-.sp
-.LP
+variable
+.Ev ENV ,
+if the file exists.
+If the
+.Fl s
+option is not present and
+.Ar arg
+is specified and a file by the name of
+.Ar arg
+exists, then it reads and executes this script.
+Otherwise, if the first
+.Ar arg
+does not contain a
+.Sy / ,
+a path search is performed on the first
+.Ar arg
+to determine the name of the script to execute.
+The script
+.Ar arg
+must have execute permission and any
+.Sy setuid
+and
+.Sy setgid
+settings are ignored.
+If the script is not found on the path,
+.Ar arg
+is processed as if it named a built-in command or function.
+.Pp
Commands are then read as described, and the following options are interpreted
by the shell when it is invoked:
-.sp
-.ne 2
-.na
-\fB-c\fR
-.ad
-.RS 15n
-If the \fB-c\fR option is present, then commands are read from the first
-\fIarg\fR. Any remaining arguments become positional parameters starting at
-\fB0\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fB-D\fR
-.ad
-.RS 15n
-A list of all double quoted strings that are preceded by a \fB$\fR is printed
-on standard output and the shell exits. This set of strings is subject to
-language translation when the locale is not C or POSIX. No commands are
-executed.
-.RE
-
-.sp
-.ne 2
-.na
-\fB-E\fR
-.ad
-.RS 15n
-Reads the file named by the \fBENV\fR variable or by \fB$HOME/.kshrc\fR if
-not defined after the profiles.
-.RE
-
-.sp
-.ne 2
-.na
-\fB-i\fR
-.ad
-.RS 15n
-If the \fB-i\fR option is present or if the shell input and output are attached
-to a terminal (as told by \fBtcgetattr\fR(3C), this shell is interactive. In
-this case \fBTERM\fR is ignored (so that \fBkill 0\fR does not kill an
-interactive shell) and \fBINTR\fR is caught and ignored (so that wait is
-interruptible). In all cases, \fBQUIT\fR is ignored by the shell.
-.RE
-
-.sp
-.ne 2
-.na
-\fB-R\fR \fIfilename\fR
-.ad
-.RS 15n
-The \fB-R\fR \fIfilename\fR option is used to generate a cross reference
-database that can be used by a separate utility to find definitions and
-references for variables and commands.
-.RE
-
-.sp
-.ne 2
-.na
-\fB-r\fR
-.ad
-.RS 15n
-If the \fB-r\fR option is present, the shell is a restricted shell.
-.RE
-
-.sp
-.ne 2
-.na
-\fB-s\fR
-.ad
-.RS 15n
-If the \fB-s\fR option is present or if no arguments remain, then commands are
-read from the standard input. Shell output, except for the output of the
-\fBSpecial Commands\fR listed, is written to file descriptor 2.
-.RE
-
-.sp
-.LP
-The remaining options and arguments are described under the \fBset\fR command.
-An optional \fB-\fR as the first argument is ignored.
-.SS "\fBrksh93\fR Only"
-\fBrksh93\fR is used to set up login names and execution environments whose
-capabilities are more controlled than those of the standard shell.
-.sp
-.LP
-The actions of \fBrksh93\fR are identical to those of \fBksh93\fR, except that
-the following are disallowed:
-.RS +4
-.TP
-.ie t \(bu
-.el o
+.Bl -tag -width Ds
+.It Fl c
+If the
+.Fl c
+option is present, then commands are read from the first
+.Ar arg .
+Any remaining arguments become positional parameters starting at
+.Sy 0 .
+.It Fl D
+A list of all double quoted strings that are preceded by a
+.Sy $
+is printed on standard output and the shell exits.
+This set of strings is subject to language translation when the locale is not C
+or POSIX.
+No commands are executed.
+.It Fl E
+Reads the file named by the
+.Ev ENV
+variable or by
+.Pa $HOME/.kshrc
+if not defined after the profiles.
+.It Fl i
+If the
+.Fl i
+option is present or if the shell input and output are attached to a terminal
+.Pq as told by Xr tcgetattr 3C ) ,
+this shell is interactive.
+In this case
+.Sy TERM
+is ignored
+.Po so that
+.Ic kill Ar 0
+does not kill an
+interactive shell
+.Pc
+and
+.Sy INTR
+is caught and ignored
+.Pq so that wait is interruptible .
+In all cases,
+.Sy QUIT
+is ignored by the shell.
+.It Fl R Ar filename
+The
+.Fl R Ar filename
+option is used to generate a cross reference database that can be used by a
+separate utility to find definitions and references for variables and commands.
+.It Fl r
+If the
+.Fl r
+option is present, the shell is a restricted shell.
+.It Fl s
+If the
+.Fl s
+option is present or if no arguments remain, then commands are read from the
+standard input.
+Shell output, except for the output of the
+.Sx Special Commands
+listed, is written to file descriptor 2.
+.El
+.Pp
+The remaining options and arguments are described under the
+.Ic set
+command.
+An optional
+.Fl
+as the first argument is ignored.
+.Ss rksh93 Only
+.Sy rksh93
+is used to set up login names and execution environments whose capabilities are
+more controlled than those of the standard shell.
+.Pp
+The actions of
+.Nm rksh93
+are identical to those of
+.Nm ksh93 ,
+except that the following are disallowed:
+.Bl -bullet -width Ds
+.It
Unsetting the restricted option
-.RE
-.RS +4
-.TP
-.ie t \(bu
-.el o
-Changing directory. See \fBcd\fR(1).
-.RE
-.RS +4
-.TP
-.ie t \(bu
-.el o
-Setting or unsetting the value or attributes of \fBSHELL\fR, \fBENV\fR,
-\fBFPATH\fR, or \fBPATH\fR
-.RE
-.RS +4
-.TP
-.ie t \(bu
-.el o
-Specifying path or command names containing \fB/\fR,
-.RE
-.RS +4
-.TP
-.ie t \(bu
-.el o
-Redirecting output (\fB>\fR, \fB>\fR\fB|\fR, \fB<>\fR, and \fB>>\fR).
-.RE
-.RS +4
-.TP
-.ie t \(bu
-.el o
+.It
+Changing directory.
+See
+.Xr cd 1 .
+.It
+Setting or unsetting the value or attributes of
+.Ev SHELL ,
+.Ev ENV ,
+.Ev FPATH ,
+or
+.Ev PATH
+.It
+Specifying path or command names containing
+.Sy /
+.It
+Redirecting output
+.Po
+.Sy \&> ,
+.Sy \&> ,
+.Sy \&| ,
+.Sy \&>\&; ,
+.Sy \&<> ,
+and
+.Sy \&>>
+.Pc .
+.It
Adding or deleting built-in commands.
-.RE
-.RS +4
-.TP
-.ie t \(bu
-.el o
-Using \fBcommand\fR \fB-p\fR to invoke a command.
-.RE
-.sp
-.LP
-These restrictions are enforced after .\fBprofile\fR and the \fBENV\fR files
-are interpreted.
-.sp
-.LP
-When a command to be executed is found to be a shell procedure, \fBrksh93\fR
-invokes \fBksh93\fR to execute it. Thus, it is possible to provide to the
-end-user shell procedures that have access to the full power of the standard
-shell, while imposing a limited menu of commands. This scheme assumes that the
-end-user does not have write and execute permissions in the same directory. The
-net effect of these rules is that the writer of the .\fBprofile\fR has complete
-control over user actions, by performing guaranteed setup actions and leaving
-the user in an appropriate directory (probably not the login directory). The
-system administrator often sets up a directory of commands, for example,
-\fB/usr/rbin\fR, that can be safely invoked by \fBrksh\fR.
-.SH USAGE
-See \fBlargefile\fR(5) for the description of the behavior of \fBksh93\fR and
-\fBrksh93\fR when encountering files greater than or equal to 2 Gbyte ( 2^31
-bytes).
-.SH EXIT STATUS
-The following exit values are returned:
-.sp
-.ne 2
-.na
-\fBnon-zero\fR
-.ad
-.sp .6
-.RS 4n
-Returns \fBnon-zero\fR when errors, such as syntax errors, are detected by the
-shell.
-.sp
-If the shell is being used non-interactively, then execution of the shell file
-is abandoned unless the error occurs inside a sub-shell in which case the
-sub-shell is abandoned.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fIexit status of last command executed\fR
-.ad
-.sp .6
-.RS 4n
-Returns the exit status of the last command executed.
-.sp
-Run time errors detected by the shell are reported by printing the command or
-function name and the error condition. If the line number that the error
-occurred on is greater than one, then the line number is also printed in square
-brackets (\fB[]\fR) after the command or function name.
-.sp
-See the \fBksh93 exit\fR command for additional details.
-.RE
-
-.SH FILES
-.ne 2
-.na
-\fB/etc/profile\fR
-.ad
-.sp .6
-.RS 4n
+.It
+Using
+.Ic command Fl p
+to invoke a command.
+.El
+.Pp
+These restrictions are enforced after
+.Pa .profile
+and the
+.Ev ENV
+files are interpreted.
+.Pp
+When a command to be executed is found to be a shell procedure,
+.Nm rksh93
+invokes
+.Nm ksh93
+to execute it.
+Thus, it is possible to provide to the end-user shell procedures that have
+access to the full power of the standard shell, while imposing a limited menu
+of commands.
+This scheme assumes that the end-user does not have write and execute
+permissions in the same directory.
+The net effect of these rules is that the writer of the
+.Pa .profile
+has complete control over user actions, by performing guaranteed setup actions
+and leaving the user in an appropriate directory (probably not the login
+directory).
+The system administrator often sets up a directory of commands, for example,
+.Pa /usr/rbin ,
+that can be safely invoked by
+.Nm rksh93 .
+.Sh USAGE
+See
+.Xr largefile 5
+for the description of the behavior of
+.Nm ksh93
+and
+.Nm rksh93
+when encountering files greater than or equal to 2 Gbyte ( 2^31 bytes).
+.Sh FILES
+.Bl -tag -width Ds
+.It Pa /etc/profile
The system initialization file, executed for login shells.
-.RE
-
-.sp
-.ne 2
-.na
-\fB/etc/ksh.kshrc\fR
-.ad
-.sp .6
-.RS 4n
+.It Pa /etc/ksh.kshrc
The system wide startup file, executed for interactive shells.
-.RE
-
-.sp
-.ne 2
-.na
-\fB$HOME/.profile\fR
-.ad
-.sp .6
-.RS 4n
+.It Pa $HOME/.profile
The personal initialization file, executed for login shells after
-\fB/etc/profile\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fB$HOME/.kshrc\fR
-.ad
-.sp .6
-.RS 4n
-Default personal initialization file, executed after \fB/etc/ksh.kshrc\fR, for
-interactive shells when \fBENV\fR is not set.
-.RE
-
-.sp
-.ne 2
-.na
-\fB/etc/suid-profile\fR
-.ad
-.sp .6
-.RS 4n
+.Pa /etc/profile .
+.It Pa $HOME/.kshrc
+Default personal initialization file, executed after
+.Pa /etc/ksh.kshrc ,
+for interactive shells when
+.Ev ENV
+is not set.
+.It Pa /etc/suid-profile
Alternative initialization file, executed instead of the personal
initialization file when the real and effective user or group id do not match.
-.RE
-
-.sp
-.ne 2
-.na
-\fB/dev/null\fR
-.ad
-.sp .6
-.RS 4n
+.It Pa /dev/null
NULL device.
-.RE
-
-.SH AUTHORS
-David Korn, \fBdgk@research.att.com\fR
-.SH ATTRIBUTES
-See \fBattributes\fR(5) for descriptions of the following attributes:
-.sp
-
-.sp
-.TS
-box;
-c | c
-l | l .
-ATTRIBUTE TYPE ATTRIBUTE VALUE
-_
-Interface Stability See below.
-.TE
-
-.sp
-.LP
-The scripting interface is Uncommitted. The environment variables,
-\fB\&.paths\fR feature, and editing modes are Volatile.
-.SH SEE ALSO
-\fBcat\fR(1), \fBcd\fR(1), \fBchmod\fR(1), \fBcut\fR(1), \fBdate\fR(1),
-\fBegrep\fR(1), \fBecho\fR(1), \fBegrep\fR(1), \fBenv\fR(1), \fBfgrep\fR(1),
-\fBgrep\fR(1), \fBlogin\fR(1), \fBnewgrp\fR(1), \fBpaste\fR(1),
-\fBprintf\fR(1), \fBstty\fR(1), \fBtest\fR(1), \fBumask\fR(1), \fBvi\fR(1),
-\fBdup\fR(2), \fBexec\fR(2), \fBfork\fR(2), \fBioctl\fR(2), \fBlseek\fR(2),
-\fBpathconf\fR(2), \fBpipe\fR(2), \fBsysconf\fR(3C), \fBulimit\fR(2),
-\fBumask\fR(2), \fBrand\fR(3C), \fBtcgetattr\fR(3C), \fBwait\fR(3C),
-\fBa.out\fR(4), \fBprofile\fR(4), \fBattributes\fR(5), \fBenviron\fR(5),
-\fBlargefile\fR(5), \fBstandards\fR(5)
-.sp
-.LP
-Bolsky, Morris I. and Korn, David G., \fIThe New KornShell Command and
-Programming Language\fR, Prentice Hall, 1995.
-.sp
-.LP
-\fIPOSIX-Part 2: Shell and Utilities, IEEE Std 1003.2-1992, ISO/IEC 9945-2\fR,
-IEEE, 1993.
-.SH NOTES
-\fBksh93\fR scripts should choose shell function names outside the namespace
-used by reserved keywords of the ISO C99, C++ and JAVA languages to avoid
-collisions with future enhancements to \fBksh93\fR.
-.sp
-.LP
+.El
+.Sh EXIT STATUS
+The following exit values are returned:
+.Bl -tag -width Ds
+.It Sy non-zero
+Returns
+.Sy non-zero
+when errors, such as syntax errors, are detected by the shell.
+.Pp
+If the shell is being used non-interactively, then execution of the shell file
+is abandoned unless the error occurs inside a sub-shell in which case the
+sub-shell is abandoned.
+.It Em exit-status-of-last-command-executed
+Returns the exit status of the last command executed.
+.Pp
+Run time errors detected by the shell are reported by printing the command or
+function name and the error condition.
+If the line number that the error occurred on is greater than one, then the
+line number is also printed in square brackets
+.Pq Sy []
+after the command or function name.
+.Pp
+See the
+.Nm ksh93 Ic exit
+command for additional details.
+.El
+.Sh INTERFACE STABILITY
+The scripting interface is
+.Sy Uncommitted .
+The environment variables,
+.Pa \&.paths
+feature, and editing modes are
+.Sy Volatile .
+.Sh SEE ALSO
+.Xr cat 1 ,
+.Xr cd 1 ,
+.Xr chmod 1 ,
+.Xr cut 1 ,
+.Xr date 1 ,
+.Xr echo 1 ,
+.Xr egrep 1 ,
+.Xr env 1 ,
+.Xr fgrep 1 ,
+.Xr grep 1 ,
+.Xr login 1 ,
+.Xr newgrp 1 ,
+.Xr paste 1 ,
+.Xr perl 1 ,
+.Xr printf 1 ,
+.Xr stty 1 ,
+.Xr test 1 ,
+.Xr umask 1 ,
+.Xr vi 1 ,
+.Xr dup 2 ,
+.Xr exec 2 ,
+.Xr fork 2 ,
+.Xr ioctl 2 ,
+.Xr lseek 2 ,
+.Xr pathconf 2 ,
+.Xr pipe 2 ,
+.Xr ulimit 2 ,
+.Xr umask 2 ,
+.Xr rand 3C ,
+.Xr sysconf 3C ,
+.Xr tcgetattr 3C ,
+.Xr wait 3C ,
+.Xr a.out 4 ,
+.Xr profile 4 ,
+.Xr attributes 5 ,
+.Xr environ 5 ,
+.Xr largefile 5 ,
+.Xr standards 5
+.Pp
+.Rs
+.%A Bolsky, Morris I.
+.%A Korn, David G.
+.%B The New KornShell Command and Programming Language
+.%I Prentice Hall
+.%D 1995 .
+.Re
+.Rs
+.%B POSIX-Part 2: Shell and Utilities, IEEE Std 1003.2-1992, ISO/IEC 9945-2
+.%I IEEE
+.%D 1993 .
+.Re
+.Sh NOTES
+.Nm ksh93
+scripts should choose shell function names outside the namespace used by
+reserved keywords of the ISO C99, C++ and JAVA languages to avoid collisions
+with future enhancements to
+.Nm ksh93 .
+.Pp
If a command is executed, and then a command with the same name is installed in
a directory in the search path before the directory where the original command
-was found, the shell continues to \fBexec\fR the original command. Use the
-\fB-t\fR option of the alias command to correct this situation.
-.sp
-.LP
-Some very old shell scripts contain a caret (\fB^\fR) as a synonym for the pipe
-character (\fB|\fR).
-.sp
-.LP
-Using the \fBhist\fR built-in command within a compound command causes the
-whole command to disappear from the history file.
-.sp
-.LP
-The built-in command \fB\&.\fR \fIfile\fR reads the whole file before any
-commands are executed. \fBalias\fR and \fBunalias\fR commands in the file do
-not apply to any commands defined in the file.
-.sp
-.LP
-Traps are not processed while a job is waiting for a foreground process. Thus,
-a trap on \fBCHLD\fR is not executed until the foreground job terminates.
-.sp
-.LP
+was found, the shell continues to
+.Ic exec
+the original command.
+Use the
+.Fl t
+option of the alias command to correct this situation.
+.Pp
+Some very old shell scripts contain a caret
+.Pq Sy ^
+as a synonym for the pipe character
+.Pq Sy \&| .
+.Pp
+Using the
+.Ic hist
+built-in command within a compound command causes the whole command to
+disappear from the history file.
+.Pp
+The built-in command
+.Ic \&. Ar file
+reads the whole file before any commands are executed.
+.Ic alias
+and
+.Ic unalias
+commands in the file do not apply to any commands defined in the file.
+.Pp
+Traps are not processed while a job is waiting for a foreground process.
+Thus, a trap on
+.Sy CHLD
+is not executed until the foreground job terminates.
+.Pp
It is a good idea to leave a space after the comma operator in arithmetic
expressions to prevent the comma from being interpreted as the decimal point
character in certain locales.
-.sp
-.LP
-There might be some restrictions on creating a \fB\&.paths\fR file which is
-portable across other operating systems.
-.sp
-.LP
-If the system supports the 64-bit instruction set, \fB/bin/ksh93\fR executes
-the 64-bit version of \fBksh93\fR.
+.Pp
+There might be some restrictions on creating a
+.Pa \&.paths
+file which is portable across other operating systems.
+.Pp
+If the system supports the 64-bit instruction set,
+.Pa /bin/ksh93
+executes the 64-bit version of
+.Nm ksh93 .
diff --git a/usr/src/man/man1m/snoop.1m b/usr/src/man/man1m/snoop.1m
index f85f71089e..d2ea8088c6 100644
--- a/usr/src/man/man1m/snoop.1m
+++ b/usr/src/man/man1m/snoop.1m
@@ -1,23 +1,22 @@
'\" te
+.\" Copyright 2021 Joyent, Inc.
.\" Copyright (C) 2009, Sun Microsystems, Inc. All Rights Reserved
.\" Copyright (c) 2014, Joyent, Inc. All rights reserved.
.\" 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]
-.TH SNOOP 1M "Feb 25, 2017"
+.TH SNOOP 1M "Mar 22, 2021"
.SH NAME
snoop \- capture and inspect network packets
.SH SYNOPSIS
-.LP
.nf
-\fBsnoop\fR [\fB-aqrCDINPSvV\fR] [\fB-t\fR [r | a | d]] [\fB-c\fR \fImaxcount\fR]
+\fBsnoop\fR [\fB-afqrCDINPSvV\fR] [\fB-t\fR [r | a | d]] [\fB-c\fR \fImaxcount\fR]
[\fB-d\fR \fIdevice\fR] [\fB-i\fR \fIfilename\fR] [\fB-n\fR \fIfilename\fR] [\fB-o\fR \fIfilename\fR]
[\fB-p\fR \fIfirst\fR [, \fIlast\fR]] [\fB-s\fR \fIsnaplen\fR] [\fB-x\fR \fIoffset\fR [, \fIlength\fR]]
[\fB-z\fR \fIzonename\fR] [\fIexpression\fR]
.fi
.SH DESCRIPTION
-.LP
From a datalink or IP interface, \fBsnoop\fR captures packets and displays
their contents. If the datalink or IP interface is not specified, \fBsnoop\fR
will pick a datalink to use, giving priority to datalinks that have been
@@ -169,6 +168,18 @@ by \fIdatalink\fR, for example, \fBbge0\fR or \fBnet0\fR. The \fBdladm\fR(1M)
.sp
.ne 2
.na
+\fB\fB-f\fR\fR
+.ad
+.sp .6
+.RS 4n
+Ignore any errors when enabling promiscuous mode. Normally any error when
+enabling promiscuous mode on a datalink or IP interface is fatal and causes
+\fBsnoop\fR to exit.
+.RE
+
+.sp
+.ne 2
+.na
\fB\fB-i\fR \fIfilename\fR\fR
.ad
.sp .6
@@ -849,7 +860,6 @@ True if the packet is an \fBOSPF\fR packet.
.RE
.SH EXAMPLES
-.LP
\fBExample 1 \fRUsing the \fBsnoop\fR Command
.sp
.LP
@@ -1143,7 +1153,6 @@ Internet services and aliases.
.RE
.SH SEE ALSO
-.LP
\fBdladm\fR(1M), \fBifconfig\fR(1M), \fBnetstat\fR(1M), \fBhosts\fR(4),
\fBrpc\fR(4), \fBservices\fR(4), \fBattributes\fR(5), \fBaudio\fR(7I),
\fBipnet\fR(7D), \fBbufmod\fR(7M), \fBdlpi\fR(7P), \fBpfmod\fR(7M)
@@ -1152,7 +1161,6 @@ Internet services and aliases.
Callaghan, B. and Gilligan, R. \fIRFC 1761, Snoop Version 2 Packet Capture File
Format\fR. Network Working Group. February 1995.
.SH WARNINGS
-.LP
The processing overhead is much higher for real-time packet interpretation.
Consequently, the packet drop count may be higher. For more reliable capture,
output raw packets to a file using the \fB-o\fR option and analyze the packets
diff --git a/usr/src/pkg/manifests/SUNWcs.man1.inc b/usr/src/pkg/manifests/SUNWcs.man1.inc
index 381f383b88..023b7e6153 100644
--- a/usr/src/pkg/manifests/SUNWcs.man1.inc
+++ b/usr/src/pkg/manifests/SUNWcs.man1.inc
@@ -12,6 +12,7 @@
#
# Copyright 2011, Richard Lowe
# Copyright 2018 Nexenta Systems, Inc.
+# Copyright 2021 OmniOS Community Edition (OmniOSce) Association.
#
file path=usr/share/man/man1/Intro.1
@@ -39,14 +40,10 @@ file path=usr/share/man/man1/ckkeywd.1
file path=usr/share/man/man1/ckpath.1
file path=usr/share/man/man1/ckrange.1
file path=usr/share/man/man1/ckstr.1
-file path=usr/share/man/man1/cksum.1
file path=usr/share/man/man1/cktime.1
file path=usr/share/man/man1/ckuid.1
file path=usr/share/man/man1/ckyorn.1
file path=usr/share/man/man1/clear.1
-file path=usr/share/man/man1/cmp.1
-file path=usr/share/man/man1/comm.1
-file path=usr/share/man/man1/command.1
file path=usr/share/man/man1/cp.1
file path=usr/share/man/man1/cpio.1
file path=usr/share/man/man1/crle.1
@@ -56,7 +53,6 @@ file path=usr/share/man/man1/csh.1
file path=usr/share/man/man1/ctrun.1
file path=usr/share/man/man1/ctstat.1
file path=usr/share/man/man1/ctwatch.1
-file path=usr/share/man/man1/cut.1
file path=usr/share/man/man1/date.1
file path=usr/share/man/man1/deallocate.1
file path=usr/share/man/man1/dhcpinfo.1
@@ -85,7 +81,6 @@ file path=usr/share/man/man1/getconf.1
file path=usr/share/man/man1/getfacl.1
file path=usr/share/man/man1/getopt.1
file path=usr/share/man/man1/getoptcvt.1
-file path=usr/share/man/man1/getopts.1
file path=usr/share/man/man1/gettext.1
file path=usr/share/man/man1/glob.1
file path=usr/share/man/man1/grep.1
@@ -99,13 +94,10 @@ file path=usr/share/man/man1/iconv.1
file path=usr/share/man/man1/isainfo.1
file path=usr/share/man/man1/isalist.1
file path=usr/share/man/man1/jobs.1
-file path=usr/share/man/man1/join.1
file path=usr/share/man/man1/kbd.1
file path=usr/share/man/man1/keylogin.1
file path=usr/share/man/man1/keylogout.1
-file path=usr/share/man/man1/kill.1
file path=usr/share/man/man1/kmfcfg.1
-file path=usr/share/man/man1/ksh93.1
file path=usr/share/man/man1/kvmstat.1
file path=usr/share/man/man1/ld.so.1.1
file path=usr/share/man/man1/let.1
@@ -141,7 +133,6 @@ file path=usr/share/man/man1/nohup.1
file path=usr/share/man/man1/optisa.1
file path=usr/share/man/man1/pagesize.1
file path=usr/share/man/man1/passwd.1
-file path=usr/share/man/man1/paste.1
file path=usr/share/man/man1/pathchk.1
file path=usr/share/man/man1/pax.1
file path=usr/share/man/man1/pfexec.1
@@ -150,7 +141,6 @@ file path=usr/share/man/man1/pgrep.1
file path=usr/share/man/man1/pktool.1
file path=usr/share/man/man1/pr.1
file path=usr/share/man/man1/prctl.1
-file path=usr/share/man/man1/print.1
file path=usr/share/man/man1/priocntl.1
file path=usr/share/man/man1/proc.1
file path=usr/share/man/man1/profiles.1
@@ -160,7 +150,6 @@ file path=usr/share/man/man1/pwd.1
file path=usr/share/man/man1/read.1
file path=usr/share/man/man1/readonly.1
file path=usr/share/man/man1/renice.1
-file path=usr/share/man/man1/rev.1
file path=usr/share/man/man1/rm.1
file path=usr/share/man/man1/roles.1
file path=usr/share/man/man1/runat.1
@@ -169,21 +158,17 @@ file path=usr/share/man/man1/sed.1
file path=usr/share/man/man1/set.1
file path=usr/share/man/man1/setfacl.1
file path=usr/share/man/man1/setpgrp.1
-file path=usr/share/man/man1/shcomp.1
file path=usr/share/man/man1/shell_builtins.1
file path=usr/share/man/man1/shift.1
file path=usr/share/man/man1/sleep.1
file path=usr/share/man/man1/strchg.1
file path=usr/share/man/man1/stty.1
-file path=usr/share/man/man1/sum.1
file path=usr/share/man/man1/suspend.1
file path=usr/share/man/man1/svcprop.1
file path=usr/share/man/man1/svcs.1
file path=usr/share/man/man1/tabs.1
file path=usr/share/man/man1/tail.1
file path=usr/share/man/man1/tar.1
-file path=usr/share/man/man1/tee.1
-file path=usr/share/man/man1/test.1
file path=usr/share/man/man1/time.1
file path=usr/share/man/man1/times.1
file path=usr/share/man/man1/tip.1
@@ -193,17 +178,12 @@ file path=usr/share/man/man1/tr.1
file path=usr/share/man/man1/trap.1
file path=usr/share/man/man1/true.1
file path=usr/share/man/man1/tty.1
-file path=usr/share/man/man1/type.1
file path=usr/share/man/man1/typeset.1
-file path=usr/share/man/man1/umask.1
file path=usr/share/man/man1/uname.1
-file path=usr/share/man/man1/uniq.1
file path=usr/share/man/man1/uptime.1
file path=usr/share/man/man1/uuidgen.1
file path=usr/share/man/man1/vtfontcvt.1
file path=usr/share/man/man1/w.1
-file path=usr/share/man/man1/wait.1
-file path=usr/share/man/man1/wc.1
file path=usr/share/man/man1/which.1
file path=usr/share/man/man1/who.1
file path=usr/share/man/man1/write.1
@@ -255,8 +235,6 @@ link path=usr/share/man/man1/helpyorn.1 target=ckyorn.1
link path=usr/share/man/man1/hist.1 target=history.1
link path=usr/share/man/man1/if.1 target=shell_builtins.1
link path=usr/share/man/man1/intro.1 target=Intro.1
-link path=usr/share/man/man1/jsh.1 target=ksh93.1
-link path=usr/share/man/man1/ksh.1 target=ksh93.1
link path=usr/share/man/man1/notify.1 target=jobs.1
link path=usr/share/man/man1/onintr.1 target=trap.1
link path=usr/share/man/man1/page.1 target=more.1
@@ -281,14 +259,11 @@ link path=usr/share/man/man1/red.1 target=ed.1
link path=usr/share/man/man1/rehash.1 target=hash.1
link path=usr/share/man/man1/repeat.1 target=shell_builtins.1
link path=usr/share/man/man1/return.1 target=exit.1
-link path=usr/share/man/man1/rksh.1 target=ksh93.1
-link path=usr/share/man/man1/rksh93.1 target=ksh93.1
link path=usr/share/man/man1/rmail.1 target=mail.1
link path=usr/share/man/man1/rmdir.1 target=rm.1
link path=usr/share/man/man1/select.1 target=shell_builtins.1
link path=usr/share/man/man1/setenv.1 target=set.1
link path=usr/share/man/man1/settime.1 target=touch.1
-link path=usr/share/man/man1/sh.1 target=ksh93.1
link path=usr/share/man/man1/source.1 target=exec.1
link path=usr/share/man/man1/stop.1 target=jobs.1
link path=usr/share/man/man1/strconf.1 target=strchg.1
diff --git a/usr/src/pkg/manifests/SUNWcs.mf b/usr/src/pkg/manifests/SUNWcs.mf
index b67c1defbd..7cd67ac2d4 100644
--- a/usr/src/pkg/manifests/SUNWcs.mf
+++ b/usr/src/pkg/manifests/SUNWcs.mf
@@ -385,7 +385,6 @@ file path=etc/init.d/README group=sys preserve=true
file path=etc/init.d/sysetup group=sys mode=0744 preserve=true
file path=etc/inittab group=sys preserve=true
file path=etc/ioctl.syscon group=sys preserve=true
-file path=etc/ksh.kshrc group=sys preserve=renameold
file path=etc/logadm.conf group=sys preserve=true timestamp=19700101T000000Z
file path=etc/logindevperm group=sys preserve=true
file path=etc/magic mode=0444
@@ -445,7 +444,6 @@ file path=etc/security/prof_attr group=sys preserve=true \
timestamp=19700101T000000Z
file path=etc/security/prof_attr.d/SUNWcs group=sys
file path=etc/shadow group=sys mode=0400 preserve=true
-file path=etc/skel/.kshrc group=other preserve=true
file path=etc/skel/.profile group=other preserve=true
file path=etc/svc/profile/generic_limited_net.xml group=sys mode=0444
file path=etc/svc/profile/generic_open.xml group=sys mode=0444
@@ -668,7 +666,6 @@ file path=sbin/zonename mode=0555
$(i386_ONLY)file path=usr/bin/$(ARCH32)/amt mode=0555
file path=usr/bin/$(ARCH32)/decrypt mode=0555
file path=usr/bin/$(ARCH32)/digest mode=0555
-file path=usr/bin/$(ARCH32)/ksh93 mode=0555
$(i386_ONLY)file path=usr/bin/$(ARCH32)/newtask group=sys mode=4555
$(i386_ONLY)file path=usr/bin/$(ARCH32)/nohup mode=0555
$(i386_ONLY)file path=usr/bin/$(ARCH32)/prctl mode=0555
@@ -681,7 +678,6 @@ file path=usr/bin/$(ARCH64)/amt mode=0555
file path=usr/bin/$(ARCH64)/crle mode=0555
file path=usr/bin/$(ARCH64)/decrypt mode=0555
file path=usr/bin/$(ARCH64)/digest mode=0555
-file path=usr/bin/$(ARCH64)/ksh93 mode=0555
file path=usr/bin/$(ARCH64)/ls mode=0555
file path=usr/bin/$(ARCH64)/moe mode=0555
file path=usr/bin/$(ARCH64)/newtask group=sys mode=4555
@@ -693,7 +689,6 @@ file path=usr/bin/$(ARCH64)/savecore mode=0555
file path=usr/bin/$(ARCH64)/setuname mode=0555
file path=usr/bin/$(ARCH64)/uptime mode=4555
$(i386_ONLY)file path=usr/bin/addbadsec mode=0555
-file path=usr/bin/alias mode=0555
file path=usr/bin/amt mode=0555
file path=usr/bin/arch mode=0555
file path=usr/bin/at group=sys mode=4755
@@ -833,7 +828,6 @@ file path=usr/bin/sed mode=0555
file path=usr/bin/setfacl mode=0555
file path=usr/bin/setpgrp group=sys mode=0555
file path=usr/bin/settime mode=0555
-file path=usr/bin/shcomp mode=0555
file path=usr/bin/sleep mode=0555
file path=usr/bin/strchg group=root mode=0555
file path=usr/bin/strconf group=root mode=0555
@@ -1415,24 +1409,11 @@ $(sparc_ONLY)hardlink path=etc/svc/profile/platform_SUNW,Sun-Fire-V890.xml \
hardlink path=sbin/rc5 target=../sbin/rc0
hardlink path=sbin/rc6 target=../sbin/rc0
hardlink path=usr/bin/$(ARCH32)/encrypt target=decrypt
-hardlink path=usr/bin/$(ARCH32)/ksh target=ksh93
hardlink path=usr/bin/$(ARCH32)/mac target=digest
-hardlink path=usr/bin/$(ARCH32)/rksh target=ksh93
-hardlink path=usr/bin/$(ARCH32)/rksh93 target=ksh93
$(i386_ONLY)hardlink path=usr/bin/$(ARCH32)/w target=uptime
hardlink path=usr/bin/$(ARCH64)/encrypt target=decrypt
-hardlink path=usr/bin/$(ARCH64)/ksh target=ksh93
hardlink path=usr/bin/$(ARCH64)/mac target=digest
-hardlink path=usr/bin/$(ARCH64)/rksh target=ksh93
-hardlink path=usr/bin/$(ARCH64)/rksh93 target=ksh93
hardlink path=usr/bin/$(ARCH64)/w target=uptime
-hardlink path=usr/bin/bg target=../../usr/bin/alias
-hardlink path=usr/bin/cd target=../../usr/bin/alias
-hardlink path=usr/bin/cksum target=../../usr/bin/alias
-hardlink path=usr/bin/cmp target=../../usr/bin/alias
-hardlink path=usr/bin/comm target=../../usr/bin/alias
-hardlink path=usr/bin/command target=../../usr/bin/alias
-hardlink path=usr/bin/cut target=../../usr/bin/alias
hardlink path=usr/bin/decrypt target=../../usr/lib/isaexec
hardlink path=usr/bin/digest target=../../usr/lib/isaexec
hardlink path=usr/bin/dispgid target=../../usr/bin/ckgid
@@ -1440,58 +1421,28 @@ hardlink path=usr/bin/dispuid target=../../usr/bin/ckuid
hardlink path=usr/bin/edit target=../has/bin/edit
hardlink path=usr/bin/egrep target=../../usr/bin/grep
hardlink path=usr/bin/encrypt target=../../usr/lib/isaexec
-hardlink path=usr/bin/fc target=../../usr/bin/alias
-hardlink path=usr/bin/fg target=../../usr/bin/alias
hardlink path=usr/bin/fgrep target=../../usr/bin/grep
-hardlink path=usr/bin/getopts target=../../usr/bin/alias
-hardlink path=usr/bin/hash target=../../usr/bin/alias
-hardlink path=usr/bin/jobs target=../../usr/bin/alias
-hardlink path=usr/bin/join target=../../usr/bin/alias
-hardlink path=usr/bin/kill target=../../usr/bin/alias
-hardlink path=usr/bin/ksh target=../../usr/lib/isaexec
-hardlink path=usr/bin/ksh93 target=../../usr/lib/isaexec
hardlink path=usr/bin/ln target=../../usr/bin/cp
hardlink path=usr/bin/mac target=../../usr/lib/isaexec
hardlink path=usr/bin/mv target=../../usr/bin/cp
hardlink path=usr/bin/newtask target=../../usr/lib/isaexec
hardlink path=usr/bin/nohup target=../../usr/lib/isaexec
hardlink path=usr/bin/page target=../../usr/bin/more
-hardlink path=usr/bin/paste target=../../usr/bin/alias
hardlink path=usr/bin/pfbash target=../../usr/bin/pfexec
hardlink path=usr/bin/pfcsh target=../../usr/bin/pfexec
-hardlink path=usr/bin/pfksh target=../../usr/bin/pfexec
-hardlink path=usr/bin/pfksh93 target=../../usr/bin/pfexec
-hardlink path=usr/bin/pfrksh target=../../usr/bin/pfexec
-hardlink path=usr/bin/pfrksh93 target=../../usr/bin/pfexec
-hardlink path=usr/bin/pfsh target=../../usr/bin/pfexec
hardlink path=usr/bin/pftcsh target=../../usr/bin/pfexec
hardlink path=usr/bin/pfzsh target=../../usr/bin/pfexec
hardlink path=usr/bin/pkill target=../../usr/bin/pgrep
hardlink path=usr/bin/prctl target=../../usr/lib/isaexec
-hardlink path=usr/bin/print target=../../usr/bin/alias
hardlink path=usr/bin/prstat target=../../usr/lib/isaexec
hardlink path=usr/bin/ps target=../../usr/lib/isaexec
-hardlink path=usr/bin/read target=../../usr/bin/alias
hardlink path=usr/bin/red target=../../usr/bin/ed
-hardlink path=usr/bin/rev target=../../usr/bin/alias
-hardlink path=usr/bin/rksh target=../../usr/lib/isaexec
-hardlink path=usr/bin/rksh93 target=../../usr/lib/isaexec
hardlink path=usr/bin/savecore target=../../usr/lib/isaexec
hardlink path=usr/bin/setuname target=../../usr/lib/isaexec
-hardlink path=usr/bin/sum target=../../usr/bin/alias
-hardlink path=usr/bin/tee target=../../usr/bin/alias
-hardlink path=usr/bin/test target=../../usr/bin/alias
hardlink path=usr/bin/touch target=../../usr/bin/settime
-hardlink path=usr/bin/type target=../../usr/bin/alias
-hardlink path=usr/bin/ulimit target=../../usr/bin/alias
-hardlink path=usr/bin/umask target=../../usr/bin/alias
-hardlink path=usr/bin/unalias target=../../usr/bin/alias
-hardlink path=usr/bin/uniq target=../../usr/bin/alias
hardlink path=usr/bin/uptime target=../../usr/lib/isaexec
hardlink path=usr/bin/vedit target=../has/bin/edit
hardlink path=usr/bin/w target=../../usr/lib/isaexec
-hardlink path=usr/bin/wait target=../../usr/bin/alias
-hardlink path=usr/bin/wc target=../../usr/bin/alias
hardlink path=usr/has/bin/ex target=edit
hardlink path=usr/has/bin/pfsh target=../../bin/pfexec
hardlink path=usr/has/bin/vedit target=edit
@@ -1605,7 +1556,6 @@ license usr/src/cmd/which/THIRDPARTYLICENSE \
license usr/src/cmd/xstr/THIRDPARTYLICENSE \
license=usr/src/cmd/xstr/THIRDPARTYLICENSE
license usr/src/common/bzip2/LICENSE license=usr/src/common/bzip2/LICENSE
-license usr/src/contrib/ast/LICENSE license=usr/src/contrib/ast/LICENSE
link path=bin target=./usr/bin
link path=etc/TIMEZONE target=./default/init
link path=etc/autopush target=../sbin/autopush
@@ -1671,16 +1621,12 @@ link path=etc/wall target=../usr/sbin/wall
link path=etc/whodo target=../usr/sbin/whodo
link path=etc/wtmpx target=../var/adm/wtmpx
link path=sbin/in.mpathd target=../lib/inet/in.mpathd
-link path=sbin/jsh target=../usr/bin/ksh93
link path=sbin/pfsh target=../usr/bin/pfexec
-link path=sbin/sh target=../usr/bin/$(ARCH32)/ksh93
link path=sbin/su target=../usr/bin/su
link path=usr/adm target=../var/adm
link path=usr/bin/df target=../sbin/df
-link path=usr/bin/jsh target=ksh93
link path=usr/bin/pwconv target=../sbin/pwconv
link path=usr/bin/rmail target=./mail
-link path=usr/bin/sh target=$(ARCH32)/ksh93
link path=usr/bin/strclean target=../sbin/strclean
link path=usr/bin/strerr target=../sbin/strerr
link path=usr/bin/sync target=../../sbin/sync
@@ -1699,7 +1645,6 @@ link path=usr/lib/fs/ufs/mount target=../../../../etc/fs/ufs/mount
link path=usr/lib/inet/in.mpathd target=../../../lib/inet/in.mpathd
link path=usr/lib/ld.so.1 target=../../lib/ld.so.1
link path=usr/lib/locale/POSIX target=./C
-link path=usr/lib/rsh target=../bin/ksh93
link path=usr/lib/secure/32 target=.
link path=usr/lib/secure/64 target=$(ARCH64)
link path=usr/mail target=../var/mail
@@ -1769,6 +1714,9 @@ depend fmri=runtime/perl$(PERL_PKGVERS) type=require
#
depend fmri=runtime/perl$(PERL_PKGVERS)/module/sun-solaris type=require
#
+# shell/ksh93 provides the system /bin/sh
+depend fmri=shell/ksh93 type=require
+#
# The boot loader package
#
depend fmri=system/boot/loader type=require
diff --git a/usr/src/pkg/manifests/diagnostic-pci.mf b/usr/src/pkg/manifests/diagnostic-pci.mf
new file mode 100644
index 0000000000..c666862ebd
--- /dev/null
+++ b/usr/src/pkg/manifests/diagnostic-pci.mf
@@ -0,0 +1,26 @@
+#
+# This file and its contents are supplied under the terms of the
+# Common Development and Distribution License ("CDDL"), version 1.0.
+# You may only use this file in accordance with the terms of version
+# 1.0 of the CDDL.
+#
+# A full copy of the text of the CDDL should have accompanied this
+# source. A copy of the CDDL is also available via the Internet at
+# http://www.illumos.org/license/CDDL.
+#
+
+#
+# Copyright 2021 Oxide Computer Company
+#
+
+set name=pkg.fmri value=pkg:/diagnostic/pci@$(PKGVERS)
+set name=pkg.description value="PCI Utilities"
+set name=pkg.summary value="PCI Utilities"
+set name=info.classification \
+ value="org.opensolaris.category.2008:Applications/System Utilities"
+set name=variant.arch value=$(ARCH)
+dir path=usr group=sys
+dir path=usr/lib
+dir path=usr/lib/pci
+file path=usr/lib/pci/pcidb mode=0555
+license lic_CDDL license=lic_CDDL
diff --git a/usr/src/pkg/manifests/shell-ksh93.mf b/usr/src/pkg/manifests/shell-ksh93.mf
new file mode 100644
index 0000000000..073a1acbed
--- /dev/null
+++ b/usr/src/pkg/manifests/shell-ksh93.mf
@@ -0,0 +1,149 @@
+#
+# This file and its contents are supplied under the terms of the
+# Common Development and Distribution License ("CDDL"), version 1.0.
+# You may only use this file in accordance with the terms of version
+# 1.0 of the CDDL.
+#
+# A full copy of the text of the CDDL should have accompanied this
+# source. A copy of the CDDL is also available via the Internet at
+# http://www.illumos.org/license/CDDL.
+#
+
+#
+# Copyright 2021 OmniOS Community Edition (OmniOSce) Association.
+#
+
+# sh (AT&T Research) 93u+ 2012-08-01
+set name=pkg.fmri \
+ value=pkg:/shell/ksh93@93.21.1.20120801,$(PKGVERS_BUILTON)-$(PKGVERS_BRANCH)
+set name=pkg.description value="ksh93 - the AT&T Korn Shell"
+set name=pkg.summary \
+ value="ksh - Shell, the standard command language interpreter"
+set name=info.classification value=org.opensolaris.category.2008:System/Shells
+set name=org.opensolaris.incorp-facet value=true
+dir path=sbin group=sys
+dir path=usr/bin
+dir path=usr/bin/$(ARCH32)
+dir path=usr/bin/$(ARCH64)
+dir path=usr/lib
+dir path=usr/lib/$(ARCH64)
+dir path=usr/share/doc/ksh
+dir path=usr/share/doc/ksh/images
+dir path=usr/share/doc/ksh/images/callouts
+file path=etc/ksh.kshrc group=sys original_name=SUNWcs:etc/ksh.kshrc \
+ preserve=renameold
+file path=etc/skel/.kshrc group=other original_name=SUNWcs:etc/skel/.kshrc \
+ preserve=true
+file path=usr/bin/$(ARCH32)/ksh93 mode=0555
+file path=usr/bin/$(ARCH64)/ksh93 mode=0555
+file path=usr/bin/alias mode=0555
+file path=usr/bin/shcomp mode=0555
+file path=usr/lib/$(ARCH64)/libast.so.1
+file path=usr/lib/$(ARCH64)/libcmd.so.1
+file path=usr/lib/$(ARCH64)/libdll.so.1
+file path=usr/lib/$(ARCH64)/libshell.so.1
+file path=usr/lib/$(ARCH64)/libsum.so.1
+file path=usr/lib/libast.so.1
+file path=usr/lib/libcmd.so.1
+file path=usr/lib/libdll.so.1
+file path=usr/lib/libshell.so.1
+file path=usr/lib/libsum.so.1
+file path=usr/share/doc/ksh/COMPATIBILITY
+file path=usr/share/doc/ksh/DESIGN
+file path=usr/share/doc/ksh/OBSOLETE
+file path=usr/share/doc/ksh/README
+file path=usr/share/doc/ksh/RELEASE
+file path=usr/share/doc/ksh/TYPES
+file path=usr/share/doc/ksh/images/callouts/1.png
+file path=usr/share/doc/ksh/images/callouts/10.png
+file path=usr/share/doc/ksh/images/callouts/2.png
+file path=usr/share/doc/ksh/images/callouts/3.png
+file path=usr/share/doc/ksh/images/callouts/4.png
+file path=usr/share/doc/ksh/images/callouts/5.png
+file path=usr/share/doc/ksh/images/callouts/6.png
+file path=usr/share/doc/ksh/images/callouts/7.png
+file path=usr/share/doc/ksh/images/callouts/8.png
+file path=usr/share/doc/ksh/images/callouts/9.png
+file path=usr/share/doc/ksh/images/tag_bourne.png
+file path=usr/share/doc/ksh/images/tag_i18n.png
+file path=usr/share/doc/ksh/images/tag_ksh.png
+file path=usr/share/doc/ksh/images/tag_ksh88.png
+file path=usr/share/doc/ksh/images/tag_ksh93.png
+file path=usr/share/doc/ksh/images/tag_l10n.png
+file path=usr/share/doc/ksh/images/tag_perf.png
+file path=usr/share/doc/ksh/shell_styleguide.docbook
+file path=usr/share/man/man1/cksum.1
+file path=usr/share/man/man1/cmp.1
+file path=usr/share/man/man1/comm.1
+file path=usr/share/man/man1/command.1
+file path=usr/share/man/man1/cut.1
+file path=usr/share/man/man1/getopts.1
+file path=usr/share/man/man1/join.1
+file path=usr/share/man/man1/kill.1
+file path=usr/share/man/man1/ksh93.1
+file path=usr/share/man/man1/paste.1
+file path=usr/share/man/man1/print.1
+file path=usr/share/man/man1/rev.1
+file path=usr/share/man/man1/shcomp.1
+file path=usr/share/man/man1/sum.1
+file path=usr/share/man/man1/tee.1
+file path=usr/share/man/man1/test.1
+file path=usr/share/man/man1/type.1
+file path=usr/share/man/man1/umask.1
+file path=usr/share/man/man1/uniq.1
+file path=usr/share/man/man1/wait.1
+file path=usr/share/man/man1/wc.1
+hardlink path=usr/bin/$(ARCH32)/ksh target=ksh93
+hardlink path=usr/bin/$(ARCH32)/rksh target=ksh93
+hardlink path=usr/bin/$(ARCH32)/rksh93 target=ksh93
+hardlink path=usr/bin/$(ARCH64)/ksh target=ksh93
+hardlink path=usr/bin/$(ARCH64)/rksh target=ksh93
+hardlink path=usr/bin/$(ARCH64)/rksh93 target=ksh93
+hardlink path=usr/bin/bg target=alias
+hardlink path=usr/bin/cd target=alias
+hardlink path=usr/bin/cksum target=alias
+hardlink path=usr/bin/cmp target=alias
+hardlink path=usr/bin/comm target=alias
+hardlink path=usr/bin/command target=alias
+hardlink path=usr/bin/cut target=alias
+hardlink path=usr/bin/fc target=alias
+hardlink path=usr/bin/fg target=alias
+hardlink path=usr/bin/getopts target=alias
+hardlink path=usr/bin/hash target=alias
+hardlink path=usr/bin/jobs target=alias
+hardlink path=usr/bin/join target=alias
+hardlink path=usr/bin/kill target=alias
+hardlink path=usr/bin/ksh target=../lib/isaexec
+hardlink path=usr/bin/ksh93 target=../lib/isaexec
+hardlink path=usr/bin/paste target=alias
+hardlink path=usr/bin/pfksh target=pfexec
+hardlink path=usr/bin/pfksh93 target=pfexec
+hardlink path=usr/bin/pfrksh target=pfexec
+hardlink path=usr/bin/pfrksh93 target=pfexec
+hardlink path=usr/bin/pfsh target=pfexec
+hardlink path=usr/bin/print target=alias
+hardlink path=usr/bin/read target=alias
+hardlink path=usr/bin/rev target=alias
+hardlink path=usr/bin/rksh target=../lib/isaexec
+hardlink path=usr/bin/rksh93 target=../lib/isaexec
+hardlink path=usr/bin/sum target=alias
+hardlink path=usr/bin/tee target=alias
+hardlink path=usr/bin/test target=alias
+hardlink path=usr/bin/type target=alias
+hardlink path=usr/bin/ulimit target=alias
+hardlink path=usr/bin/umask target=alias
+hardlink path=usr/bin/unalias target=alias
+hardlink path=usr/bin/uniq target=alias
+hardlink path=usr/bin/wait target=alias
+hardlink path=usr/bin/wc target=alias
+license usr/src/contrib/ast/LICENSE license=usr/src/contrib/ast/LICENSE
+link path=sbin/jsh target=../usr/bin/ksh93
+link path=sbin/sh target=../usr/bin/$(ARCH32)/ksh93
+link path=usr/bin/jsh target=ksh93
+link path=usr/bin/sh target=$(ARCH32)/ksh93
+link path=usr/lib/rsh target=../bin/ksh93
+link path=usr/share/man/man1/jsh.1 target=ksh93.1
+link path=usr/share/man/man1/ksh.1 target=ksh93.1
+link path=usr/share/man/man1/rksh.1 target=ksh93.1
+link path=usr/share/man/man1/rksh93.1 target=ksh93.1
+link path=usr/share/man/man1/sh.1 target=ksh93.1
diff --git a/usr/src/pkg/manifests/source-demo-system.mf b/usr/src/pkg/manifests/source-demo-system.mf
index e3415901dc..21d895f0b2 100644
--- a/usr/src/pkg/manifests/source-demo-system.mf
+++ b/usr/src/pkg/manifests/source-demo-system.mf
@@ -37,7 +37,6 @@ dir path=usr/demo/ksh
dir path=usr/demo/ksh/bin
dir path=usr/demo/ksh/fun
dir path=usr/demo/ksh/src
-dir path=usr/demo/ksh/tests
dir path=usr/demo/libexacct
dir path=usr/demo/librtld_db
dir path=usr/demo/librtld_db/amd64
@@ -107,121 +106,6 @@ file path=usr/demo/ksh/src/svcproptree1.sh
file path=usr/demo/ksh/src/termclock.sh
file path=usr/demo/ksh/src/test_net_sctp.sh
file path=usr/demo/ksh/src/xmldocumenttree1.sh
-file path=usr/demo/ksh/tests/README.tests
-file path=usr/demo/ksh/tests/alias.sh
-file path=usr/demo/ksh/tests/append.sh
-file path=usr/demo/ksh/tests/arith.sh
-file path=usr/demo/ksh/tests/arrays.sh
-file path=usr/demo/ksh/tests/arrays2.sh
-file path=usr/demo/ksh/tests/attributes.sh
-file path=usr/demo/ksh/tests/basic.sh
-file path=usr/demo/ksh/tests/bracket.sh
-file path=usr/demo/ksh/tests/builtins.sh
-file path=usr/demo/ksh/tests/case.sh
-file path=usr/demo/ksh/tests/comvar.sh
-file path=usr/demo/ksh/tests/comvario.sh
-file path=usr/demo/ksh/tests/coprocess.sh
-file path=usr/demo/ksh/tests/cubetype.sh
-file path=usr/demo/ksh/tests/enum.sh
-file path=usr/demo/ksh/tests/exit.sh
-file path=usr/demo/ksh/tests/expand.sh
-file path=usr/demo/ksh/tests/functions.sh
-file path=usr/demo/ksh/tests/glob.sh
-file path=usr/demo/ksh/tests/grep.sh
-file path=usr/demo/ksh/tests/heredoc.sh
-file path=usr/demo/ksh/tests/illumos_13434_chunked_heredoc.sh
-file path=usr/demo/ksh/tests/illumos_4149_builtin_head.sh
-file path=usr/demo/ksh/tests/io.sh
-file path=usr/demo/ksh/tests/leaks.sh
-file path=usr/demo/ksh/tests/locale.sh
-file path=usr/demo/ksh/tests/math.sh
-file path=usr/demo/ksh/tests/nameref.sh
-file path=usr/demo/ksh/tests/namespace.sh
-file path=usr/demo/ksh/tests/options.sh
-file path=usr/demo/ksh/tests/path.sh
-file path=usr/demo/ksh/tests/pointtype.sh
-file path=usr/demo/ksh/tests/pty.sh
-file path=usr/demo/ksh/tests/quoting.sh
-file path=usr/demo/ksh/tests/quoting2.sh
-file path=usr/demo/ksh/tests/readcsv.sh
-file path=usr/demo/ksh/tests/recttype.sh
-file path=usr/demo/ksh/tests/restricted.sh
-file path=usr/demo/ksh/tests/return.sh
-file path=usr/demo/ksh/tests/select.sh
-file path=usr/demo/ksh/tests/shtests mode=0755
-file path=usr/demo/ksh/tests/sigchld.sh
-file path=usr/demo/ksh/tests/signal.sh
-file path=usr/demo/ksh/tests/statics.sh
-file path=usr/demo/ksh/tests/subshell.sh
-file path=usr/demo/ksh/tests/substring.sh
-file path=usr/demo/ksh/tests/sun_solaris_array_default_datatype.sh
-file path=usr/demo/ksh/tests/sun_solaris_builtin_poll.sh
-file path=usr/demo/ksh/tests/sun_solaris_builtin_sum.sh
-file path=usr/demo/ksh/tests/sun_solaris_builtin_tail.sh
-file path=usr/demo/ksh/tests/sun_solaris_command_substitution.sh
-file path=usr/demo/ksh/tests/sun_solaris_compound_misc.sh
-file path=usr/demo/ksh/tests/sun_solaris_compound_nameref.sh
-file path=usr/demo/ksh/tests/sun_solaris_compoundvario.sh
-file \
- path=usr/demo/ksh/tests/sun_solaris_cr_6687139_command_substitution_exec_redirection_allocation_loop.sh
-file \
- path=usr/demo/ksh/tests/sun_solaris_cr_6713682_compound_var_bleeds_through_subshell.sh
-file path=usr/demo/ksh/tests/sun_solaris_cr_6722134_background_CHLD_trap.sh
-file path=usr/demo/ksh/tests/sun_solaris_cr_6753538_subshell_leaks_umask.sh
-file \
- path=usr/demo/ksh/tests/sun_solaris_cr_6754020_weird_square_bracket_expansion.sh
-file \
- path=usr/demo/ksh/tests/sun_solaris_cr_6763594_command_failure_execs_twice.sh
-file path=usr/demo/ksh/tests/sun_solaris_cr_6766246_pattern_matching_bug.sh
-file \
- path=usr/demo/ksh/tests/sun_solaris_cr_6769332_substitutions_terminate_shell_after_257_iterations.sh
-file \
- path=usr/demo/ksh/tests/sun_solaris_cr_6777491_lacks_arithmetric_function_iszero.sh
-file path=usr/demo/ksh/tests/sun_solaris_cr_6778077_sigthaw_trap.sh
-file \
- path=usr/demo/ksh/tests/sun_solaris_cr_6789247_printf_hexfloat_rounding.sh
-file \
- path=usr/demo/ksh/tests/sun_solaris_cr_6800929_large_command_substitution_hang.sh
-file path=usr/demo/ksh/tests/sun_solaris_cr_6805792_varmovetest1.sh
-file \
- path=usr/demo/ksh/tests/sun_solaris_cr_6805794_character_to_wchar_not_working.sh
-file path=usr/demo/ksh/tests/sun_solaris_cr_6805795_negative_zero.sh
-file \
- path=usr/demo/ksh/tests/sun_solaris_cr_6807179_shellpattern_uses_getpwnam.sh
-file path=usr/demo/ksh/tests/sun_solaris_cr_6835835_builtin_cat_n_broken.sh
-file \
- path=usr/demo/ksh/tests/sun_solaris_cr_6848486_echo_test_with_test_undefined_executes_test_builtin.sh
-file \
- path=usr/demo/ksh/tests/sun_solaris_cr_6855875_typeset_hexfloat_has_too_few_digits.sh
-file \
- path=usr/demo/ksh/tests/sun_solaris_cr_6862121_shbinexec_kernel_module_defunct.sh
-file \
- path=usr/demo/ksh/tests/sun_solaris_cr_6881017_background_process_in_subshell_hangs_caller.sh
-file \
- path=usr/demo/ksh/tests/sun_solaris_cr_6887363_shell_sometimes_mishandles_return_value_of_its_child_process.sh
-file \
- path=usr/demo/ksh/tests/sun_solaris_cr_6904557_wc_no_longer_counts_number_of_bytes_correctly.sh
-file \
- path=usr/demo/ksh/tests/sun_solaris_cr_6904575_cut_-d_with_multibyte_character_no_longer_works.sh
-file \
- path=usr/demo/ksh/tests/sun_solaris_cr_6904878_join_-t_no_longer_works_with_multibyte_char_separator.sh
-file \
- path=usr/demo/ksh/tests/sun_solaris_cr_6907460_EXIT_trap_handlers_are_sometimes_executed_twice.sh
-file path=usr/demo/ksh/tests/sun_solaris_cr_xxxxxxxx_template.sh
-file path=usr/demo/ksh/tests/sun_solaris_getconf.sh
-file path=usr/demo/ksh/tests/sun_solaris_local_compound_nameref001.sh
-file path=usr/demo/ksh/tests/sun_solaris_locale_misc.sh
-file path=usr/demo/ksh/tests/sun_solaris_staticvariables.sh
-file path=usr/demo/ksh/tests/sun_solaris_vartree001.sh
-file path=usr/demo/ksh/tests/sun_solaris_vartree002.sh
-file path=usr/demo/ksh/tests/sun_solaris_vartree003.sh
-file path=usr/demo/ksh/tests/tilde.sh
-file path=usr/demo/ksh/tests/timetype.sh
-file path=usr/demo/ksh/tests/treemove.sh
-file path=usr/demo/ksh/tests/types.sh
-file path=usr/demo/ksh/tests/variables.sh
-file path=usr/demo/ksh/tests/vartree1.sh
-file path=usr/demo/ksh/tests/vartree2.sh
file path=usr/demo/libexacct/Makefile
file path=usr/demo/libexacct/README
file path=usr/demo/libexacct/exdump.c
diff --git a/usr/src/pkg/manifests/system-library.mf b/usr/src/pkg/manifests/system-library.mf
index 529e110714..5d84de5864 100644
--- a/usr/src/pkg/manifests/system-library.mf
+++ b/usr/src/pkg/manifests/system-library.mf
@@ -26,7 +26,7 @@
# Copyright 2017 Nexenta Systems, Inc.
# Copyright 2017 RackTop Systems.
# Copyright 2018, Joyent, Inc.
-# Copyright 2019 OmniOS Community Edition (OmniOSce) Association.
+# Copyright 2021 OmniOS Community Edition (OmniOSce) Association.
#
<include system-library.man3.inc>
@@ -344,15 +344,12 @@ file path=usr/lib/$(ARCH64)/0@0.so.1
file path=usr/lib/$(ARCH64)/getloginx.so.1
file path=usr/lib/$(ARCH64)/libads.so.1
file path=usr/lib/$(ARCH64)/libadutils.so.1
-file path=usr/lib/$(ARCH64)/libast.so.1
file path=usr/lib/$(ARCH64)/libbsdmalloc.so.1
file path=usr/lib/$(ARCH64)/libcfgadm.so.1
-file path=usr/lib/$(ARCH64)/libcmd.so.1
file path=usr/lib/$(ARCH64)/libcommputil.so.1
file path=usr/lib/$(ARCH64)/libcrle.so.1
file path=usr/lib/$(ARCH64)/libcrypt.so.1
file path=usr/lib/$(ARCH64)/libdisasm.so.1
-file path=usr/lib/$(ARCH64)/libdll.so.1
file path=usr/lib/$(ARCH64)/libexacct.so.1
file path=usr/lib/$(ARCH64)/libform.so.1
file path=usr/lib/$(ARCH64)/libfstyp.so.1
@@ -384,12 +381,10 @@ $(i386_ONLY)file path=usr/lib/$(ARCH64)/libsaveargs.so.1
file path=usr/lib/$(ARCH64)/libsched.so.1
file path=usr/lib/$(ARCH64)/libsctp.so.1
file path=usr/lib/$(ARCH64)/libsff.so.1
-file path=usr/lib/$(ARCH64)/libshell.so.1
file path=usr/lib/$(ARCH64)/libsip.so.1
file path=usr/lib/$(ARCH64)/libsldap.so.1
file path=usr/lib/$(ARCH64)/libsmbios.so.1
file path=usr/lib/$(ARCH64)/libsoftcrypto.so.1
-file path=usr/lib/$(ARCH64)/libsum.so.1
$(sparc_ONLY)file path=usr/lib/$(ARCH64)/libv12n.so.1
file path=usr/lib/$(ARCH64)/libvolmgt.so.1
file path=usr/lib/$(ARCH64)/libwrap.so.1.0
@@ -418,18 +413,15 @@ file path=usr/lib/getloginx.so.1
file path=usr/lib/lib.b mode=0444
file path=usr/lib/libads.so.1
file path=usr/lib/libadutils.so.1
-file path=usr/lib/libast.so.1
file path=usr/lib/libbsdmalloc.so.1
$(i386_ONLY)file path=usr/lib/libc/libc_hwcap1.so.1 reboot-needed=true
$(i386_ONLY)file path=usr/lib/libc/libc_hwcap2.so.1 reboot-needed=true
$(i386_ONLY)file path=usr/lib/libc/libc_hwcap3.so.1 reboot-needed=true
file path=usr/lib/libcfgadm.so.1
-file path=usr/lib/libcmd.so.1
file path=usr/lib/libcommputil.so.1
file path=usr/lib/libcrle.so.1
file path=usr/lib/libcrypt.so.1
file path=usr/lib/libdisasm.so.1
-file path=usr/lib/libdll.so.1
file path=usr/lib/libexacct.so.1
file path=usr/lib/libform.so.1
file path=usr/lib/libfstyp.so.1
@@ -461,12 +453,10 @@ file path=usr/lib/libreparse.so.1
file path=usr/lib/libsched.so.1
file path=usr/lib/libsctp.so.1
file path=usr/lib/libsff.so.1
-file path=usr/lib/libshell.so.1
file path=usr/lib/libsip.so.1
file path=usr/lib/libsldap.so.1
file path=usr/lib/libsmbios.so.1
file path=usr/lib/libsoftcrypto.so.1
-file path=usr/lib/libsum.so.1
$(sparc_ONLY)file path=usr/lib/libv12n.so.1
file path=usr/lib/libvolmgt.so.1
file path=usr/lib/libwrap.so.1.0
@@ -588,7 +578,6 @@ license usr/src/common/mpi/THIRDPARTYLICENSE \
license=usr/src/common/mpi/THIRDPARTYLICENSE
license usr/src/common/util/THIRDPARTYLICENSE.multi3 \
license=usr/src/common/util/THIRDPARTYLICENSE.multi3
-license usr/src/contrib/ast/LICENSE license=usr/src/contrib/ast/LICENSE
license usr/src/lib/libbsdmalloc/THIRDPARTYLICENSE \
license=usr/src/lib/libbsdmalloc/THIRDPARTYLICENSE
license usr/src/lib/libc/THIRDPARTYLICENSE \
@@ -803,7 +792,6 @@ link path=usr/lib/$(ARCH64)/libc_db.so \
link path=usr/lib/$(ARCH64)/libc_db.so.1 \
target=../../../lib/$(ARCH64)/libc_db.so.1
link path=usr/lib/$(ARCH64)/libcfgadm.so target=libcfgadm.so.1
-link path=usr/lib/$(ARCH64)/libcmd.so target=libcmd.so.1
link path=usr/lib/$(ARCH64)/libcmdutils.so.1 \
target=../../../lib/$(ARCH64)/libcmdutils.so.1
link path=usr/lib/$(ARCH64)/libcommputil.so target=libcommputil.so.1
@@ -1084,7 +1072,6 @@ link path=usr/lib/libc.so.1 target=../../lib/libc.so.1
link path=usr/lib/libc_db.so target=../../lib/libc_db.so.1
link path=usr/lib/libc_db.so.1 target=../../lib/libc_db.so.1
link path=usr/lib/libcfgadm.so target=./libcfgadm.so.1
-link path=usr/lib/libcmd.so target=libcmd.so.1
link path=usr/lib/libcmdutils.so.1 target=../../lib/libcmdutils.so.1
link path=usr/lib/libcommputil.so target=./libcommputil.so.1
link path=usr/lib/libcontract.so target=../../lib/libcontract.so.1
diff --git a/usr/src/pkg/manifests/system-test-ksh93.mf b/usr/src/pkg/manifests/system-test-ksh93.mf
new file mode 100644
index 0000000000..ed9bd073a0
--- /dev/null
+++ b/usr/src/pkg/manifests/system-test-ksh93.mf
@@ -0,0 +1,139 @@
+#
+# This file and its contents are supplied under the terms of the
+# Common Development and Distribution License ("CDDL"), version 1.0.
+# You may only use this file in accordance with the terms of version
+# 1.0 of the CDDL.
+#
+# A full copy of the text of the CDDL should have accompanied this
+# source. A copy of the CDDL is also available via the Internet at
+# http://www.illumos.org/license/CDDL.
+#
+
+#
+# Copyright 2021 OmniOS Community Edition (OmniOSce) Association.
+#
+
+set name=pkg.fmri value=pkg:/system/test/ksh93@$(PKGVERS)
+set name=pkg.description value="ksh93 unit tests"
+set name=pkg.summary value="AT&T ksh93 test suite"
+set name=info.classification \
+ value=org.opensolaris.category.2008:Development/System
+dir path=opt/ksh93-tests
+dir path=opt/ksh93-tests/tests
+file path=opt/ksh93-tests/README.tests
+file path=opt/ksh93-tests/shtests mode=0755
+file path=opt/ksh93-tests/tests/alias.sh
+file path=opt/ksh93-tests/tests/append.sh
+file path=opt/ksh93-tests/tests/arith.sh
+file path=opt/ksh93-tests/tests/arrays.sh
+file path=opt/ksh93-tests/tests/arrays2.sh
+file path=opt/ksh93-tests/tests/attributes.sh
+file path=opt/ksh93-tests/tests/basic.sh
+file path=opt/ksh93-tests/tests/bracket.sh
+file path=opt/ksh93-tests/tests/builtins.sh
+file path=opt/ksh93-tests/tests/case.sh
+file path=opt/ksh93-tests/tests/comvar.sh
+file path=opt/ksh93-tests/tests/comvario.sh
+file path=opt/ksh93-tests/tests/coprocess.sh
+file path=opt/ksh93-tests/tests/cubetype.sh
+file path=opt/ksh93-tests/tests/enum.sh
+file path=opt/ksh93-tests/tests/exit.sh
+file path=opt/ksh93-tests/tests/expand.sh
+file path=opt/ksh93-tests/tests/functions.sh
+file path=opt/ksh93-tests/tests/glob.sh
+file path=opt/ksh93-tests/tests/grep.sh
+file path=opt/ksh93-tests/tests/heredoc.sh
+file path=opt/ksh93-tests/tests/illumos_13434_chunked_heredoc.sh
+file path=opt/ksh93-tests/tests/illumos_4149_builtin_head.sh
+file path=opt/ksh93-tests/tests/io.sh
+file path=opt/ksh93-tests/tests/leaks.sh
+file path=opt/ksh93-tests/tests/locale.sh
+file path=opt/ksh93-tests/tests/math.sh
+file path=opt/ksh93-tests/tests/nameref.sh
+file path=opt/ksh93-tests/tests/namespace.sh
+file path=opt/ksh93-tests/tests/options.sh
+file path=opt/ksh93-tests/tests/path.sh
+file path=opt/ksh93-tests/tests/pointtype.sh
+file path=opt/ksh93-tests/tests/pty.sh
+file path=opt/ksh93-tests/tests/quoting.sh
+file path=opt/ksh93-tests/tests/quoting2.sh
+file path=opt/ksh93-tests/tests/readcsv.sh
+file path=opt/ksh93-tests/tests/recttype.sh
+file path=opt/ksh93-tests/tests/restricted.sh
+file path=opt/ksh93-tests/tests/return.sh
+file path=opt/ksh93-tests/tests/select.sh
+file path=opt/ksh93-tests/tests/sigchld.sh
+file path=opt/ksh93-tests/tests/signal.sh
+file path=opt/ksh93-tests/tests/statics.sh
+file path=opt/ksh93-tests/tests/subshell.sh
+file path=opt/ksh93-tests/tests/substring.sh
+file path=opt/ksh93-tests/tests/sun_solaris_array_default_datatype.sh
+file path=opt/ksh93-tests/tests/sun_solaris_builtin_poll.sh
+file path=opt/ksh93-tests/tests/sun_solaris_builtin_sum.sh
+file path=opt/ksh93-tests/tests/sun_solaris_builtin_tail.sh
+file path=opt/ksh93-tests/tests/sun_solaris_command_substitution.sh
+file path=opt/ksh93-tests/tests/sun_solaris_compound_misc.sh
+file path=opt/ksh93-tests/tests/sun_solaris_compound_nameref.sh
+file path=opt/ksh93-tests/tests/sun_solaris_compoundvario.sh
+file \
+ path=opt/ksh93-tests/tests/sun_solaris_cr_6687139_command_substitution_exec_redirection_allocation_loop.sh
+file \
+ path=opt/ksh93-tests/tests/sun_solaris_cr_6713682_compound_var_bleeds_through_subshell.sh
+file path=opt/ksh93-tests/tests/sun_solaris_cr_6722134_background_CHLD_trap.sh
+file path=opt/ksh93-tests/tests/sun_solaris_cr_6753538_subshell_leaks_umask.sh
+file \
+ path=opt/ksh93-tests/tests/sun_solaris_cr_6754020_weird_square_bracket_expansion.sh
+file \
+ path=opt/ksh93-tests/tests/sun_solaris_cr_6763594_command_failure_execs_twice.sh
+file path=opt/ksh93-tests/tests/sun_solaris_cr_6766246_pattern_matching_bug.sh
+file \
+ path=opt/ksh93-tests/tests/sun_solaris_cr_6769332_substitutions_terminate_shell_after_257_iterations.sh
+file \
+ path=opt/ksh93-tests/tests/sun_solaris_cr_6777491_lacks_arithmetric_function_iszero.sh
+file path=opt/ksh93-tests/tests/sun_solaris_cr_6778077_sigthaw_trap.sh
+file \
+ path=opt/ksh93-tests/tests/sun_solaris_cr_6789247_printf_hexfloat_rounding.sh
+file \
+ path=opt/ksh93-tests/tests/sun_solaris_cr_6800929_large_command_substitution_hang.sh
+file path=opt/ksh93-tests/tests/sun_solaris_cr_6805792_varmovetest1.sh
+file \
+ path=opt/ksh93-tests/tests/sun_solaris_cr_6805794_character_to_wchar_not_working.sh
+file path=opt/ksh93-tests/tests/sun_solaris_cr_6805795_negative_zero.sh
+file \
+ path=opt/ksh93-tests/tests/sun_solaris_cr_6807179_shellpattern_uses_getpwnam.sh
+file path=opt/ksh93-tests/tests/sun_solaris_cr_6835835_builtin_cat_n_broken.sh
+file \
+ path=opt/ksh93-tests/tests/sun_solaris_cr_6848486_echo_test_with_test_undefined_executes_test_builtin.sh
+file \
+ path=opt/ksh93-tests/tests/sun_solaris_cr_6855875_typeset_hexfloat_has_too_few_digits.sh
+file \
+ path=opt/ksh93-tests/tests/sun_solaris_cr_6862121_shbinexec_kernel_module_defunct.sh
+file \
+ path=opt/ksh93-tests/tests/sun_solaris_cr_6881017_background_process_in_subshell_hangs_caller.sh
+file \
+ path=opt/ksh93-tests/tests/sun_solaris_cr_6887363_shell_sometimes_mishandles_return_value_of_its_child_process.sh
+file \
+ path=opt/ksh93-tests/tests/sun_solaris_cr_6904557_wc_no_longer_counts_number_of_bytes_correctly.sh
+file \
+ path=opt/ksh93-tests/tests/sun_solaris_cr_6904575_cut_-d_with_multibyte_character_no_longer_works.sh
+file \
+ path=opt/ksh93-tests/tests/sun_solaris_cr_6904878_join_-t_no_longer_works_with_multibyte_char_separator.sh
+file \
+ path=opt/ksh93-tests/tests/sun_solaris_cr_6907460_EXIT_trap_handlers_are_sometimes_executed_twice.sh
+file path=opt/ksh93-tests/tests/sun_solaris_cr_xxxxxxxx_template.sh
+file path=opt/ksh93-tests/tests/sun_solaris_getconf.sh
+file path=opt/ksh93-tests/tests/sun_solaris_local_compound_nameref001.sh
+file path=opt/ksh93-tests/tests/sun_solaris_locale_misc.sh
+file path=opt/ksh93-tests/tests/sun_solaris_staticvariables.sh
+file path=opt/ksh93-tests/tests/sun_solaris_vartree001.sh
+file path=opt/ksh93-tests/tests/sun_solaris_vartree002.sh
+file path=opt/ksh93-tests/tests/sun_solaris_vartree003.sh
+file path=opt/ksh93-tests/tests/tilde.sh
+file path=opt/ksh93-tests/tests/timetype.sh
+file path=opt/ksh93-tests/tests/treemove.sh
+file path=opt/ksh93-tests/tests/types.sh
+file path=opt/ksh93-tests/tests/variables.sh
+file path=opt/ksh93-tests/tests/vartree1.sh
+file path=opt/ksh93-tests/tests/vartree2.sh
+license lic_CDDL license=lic_CDDL
+license usr/src/contrib/ast/LICENSE license=usr/src/contrib/ast/LICENSE
diff --git a/usr/src/pkg/manifests/system-test-utiltest.mf b/usr/src/pkg/manifests/system-test-utiltest.mf
index 70645aa647..963821dff2 100644
--- a/usr/src/pkg/manifests/system-test-utiltest.mf
+++ b/usr/src/pkg/manifests/system-test-utiltest.mf
@@ -1686,6 +1686,7 @@ file path=opt/util-tests/tests/mdb/typedef/tst.union.mdb mode=0444
file path=opt/util-tests/tests/mdb/typedef/tst.union.mdb.out mode=0444
file path=opt/util-tests/tests/mergeq/mqt mode=0555
file path=opt/util-tests/tests/mergeq/wqt mode=0555
+file path=opt/util-tests/tests/pcidbtest mode=0555
file path=opt/util-tests/tests/printf_test mode=0555
file path=opt/util-tests/tests/sed/multi_test mode=0555
file path=opt/util-tests/tests/sed/regress.multitest.out/1.1 mode=0444
@@ -1836,6 +1837,7 @@ license usr/src/test/util-tests/tests/demangle/THIRDPARTYLICENSE.rust \
license=usr/src/test/util-tests/tests/demangle/THIRDPARTYLICENSE.rust
license usr/src/test/util-tests/tests/sed/bsd/THIRDPARTYLICENSE \
license=usr/src/test/util-tests/tests/sed/bsd/THIRDPARTYLICENSE
+depend fmri=diagnostic/pci type=require
depend fmri=locale/de type=require
depend fmri=system/library/iconv/utf-8 type=require
depend fmri=system/test/testrunner type=require
diff --git a/usr/src/test/os-tests/tests/stackalign/Makefile b/usr/src/test/os-tests/tests/stackalign/Makefile
index 4af7cb7352..50d0d2e028 100644
--- a/usr/src/test/os-tests/tests/stackalign/Makefile
+++ b/usr/src/test/os-tests/tests/stackalign/Makefile
@@ -21,6 +21,7 @@ PROGS64 = $(PROGS:%=%.64)
OBJS = $(PROGS32:%=%.o) $(PROGS64:%=%.o)
$(INTEL_BLD)OBJS += stack_i386.o stack_amd64.o
+$(SPARC_BLD)OBJS += stack_sparc.o stack_sparcv9.o
ROOTOPTDIR = $(ROOT)/opt/os-tests/tests
ROOTOPTSTACK = $(ROOTOPTDIR)/stackalign
@@ -31,6 +32,7 @@ include $(SRC)/cmd/Makefile.cmd
ASFLAGS += -P -D_ASM
CFLAGS += -D_REENTRANT
$(INTEL_BLD)LDFLAGS += -Wl,-zinitarray=get_stack_at_init
+$(SPARC_BLD)LDFLAGS += -Wl,-zinitarray=get_stack_at_init
.KEEP_STATE:
@@ -64,11 +66,11 @@ stack_$(MACH).o: stack_$(MACH).s
stack_$(MACH64).o: stack_$(MACH64).s
$(COMPILE64.s) $< -o $@
-%.64: %.64.o $(INTEL_BLD)stack_$(MACH64).o
+%.64: %.64.o stack_$(MACH64).o
$(LINK64.c) -o $@ $^ $(LDLIBS64)
$(POST_PROCESS)
-%.32: %.32.o $(INTEL_BLD)stack_$(MACH).o
+%.32: %.32.o stack_$(MACH).o
$(LINK.c) -o $@ $^ $(LDLIBS)
$(POST_PROCESS)
diff --git a/usr/src/test/os-tests/tests/stackalign/stack_sparc.s b/usr/src/test/os-tests/tests/stackalign/stack_sparc.s
new file mode 100644
index 0000000000..729c655ccc
--- /dev/null
+++ b/usr/src/test/os-tests/tests/stackalign/stack_sparc.s
@@ -0,0 +1,71 @@
+/*
+ * This file and its contents are supplied under the terms of the
+ * Common Development and Distribution License ("CDDL"), version 1.0.
+ * You may only use this file in accordance with the terms of version
+ * 1.0 of the CDDL.
+ *
+ * A full copy of the text of the CDDL should have accompanied this
+ * source. A copy of the CDDL is also available via the Internet at
+ * http://www.illumos.org/license/CDDL.
+ */
+
+/*
+ * Copyright 2021 Tintri by DDN, Inc. All rights reserved.
+ * Copyright 2021 Toomas Soome <tsoome@me.com>
+ */
+
+/*
+ * Get the stack at entry and call a function with it as an argument.
+ */
+
+ .file "stack_sparc.s"
+
+#include <sys/asm_linkage.h>
+
+/*
+ * void
+ * get_stack_at_entry(test_ctx_t *ctx)
+ *
+ * ctx+0 is void (*)(uintptr_t stack, char *text),
+ * and ctx+4 is the 'text' argument.
+ *
+ * Passes the stack pointer prior to the invoking call instruction
+ * to the specified function.
+ */
+ ENTRY(get_stack_at_entry)
+ save %sp, -SA(MINFRAME), %sp
+ st %i0, [%fp + STACK_BIAS + ARGPUSHSIZE]
+ ld [%fp + STACK_BIAS + ARGPUSHSIZE], %g1
+ ld [%g1], %g1 /* func */
+ ld [%fp + STACK_BIAS + ARGPUSHSIZE], %g2
+ ld [%g2 + 4], %g2 /* text */
+ mov %g2, %o1
+ call %g1, 0
+ add %sp, STACK_BIAS, %o0
+ ret
+ restore
+ SET_SIZE(get_stack_at_entry)
+
+/*
+ * void
+ * get_stack_at_init(void)
+ *
+ * Passes the stack pointer prior to the invoking call instruction
+ * to initarray() (defined elsewhere).
+ * Tests alignment in section .init_array.
+ */
+ ENTRY(get_stack_at_init)
+ save %sp, -SA(MINFRAME), %sp
+ call initarray, 0
+ add %sp, STACK_BIAS, %o0
+ ret
+ restore
+ SET_SIZE(get_stack_at_init)
+
+/*
+ * Passes the stack pointer during init to initmain() (defined elsewhere).
+ * Tests alignment in section .init.
+ */
+ .section ".init"
+ call initmain, 0
+ add %sp, STACK_BIAS, %o0
diff --git a/usr/src/test/os-tests/tests/stackalign/stack_sparcv9.s b/usr/src/test/os-tests/tests/stackalign/stack_sparcv9.s
new file mode 100644
index 0000000000..91d71f8289
--- /dev/null
+++ b/usr/src/test/os-tests/tests/stackalign/stack_sparcv9.s
@@ -0,0 +1,73 @@
+/*
+ * This file and its contents are supplied under the terms of the
+ * Common Development and Distribution License ("CDDL"), version 1.0.
+ * You may only use this file in accordance with the terms of version
+ * 1.0 of the CDDL.
+ *
+ * A full copy of the text of the CDDL should have accompanied this
+ * source. A copy of the CDDL is also available via the Internet at
+ * http://www.illumos.org/license/CDDL.
+ */
+
+/*
+ * Copyright 2021 Tintri by DDN, Inc. All rights reserved.
+ * Copyright 2021 Toomas Soome <tsoome@me.com>
+ */
+
+/*
+ * Get the stack at entry and call a function with it as an argument.
+ */
+
+ .file "stack_sparcv9.s"
+
+#include <sys/asm_linkage.h>
+
+/*
+ * void
+ * get_stack_at_entry(test_ctx_t *ctx)
+ *
+ * ctx+0 is void (*)(uintptr_t stack, char *text),
+ * and ctx+8 is the 'text' argument.
+ *
+ * Passes the stack pointer prior to the invoking call instruction
+ * to the specified function.
+ */
+ ENTRY(get_stack_at_entry)
+ .register %g2, #scratch
+ save %sp, -SA(MINFRAME), %sp
+ stx %i0, [%fp + STACK_BIAS + ARGPUSHSIZE]
+ ldx [%fp + STACK_BIAS + ARGPUSHSIZE], %g1
+ ldx [%g1], %g1 /* func */
+ ldx [%fp + STACK_BIAS + ARGPUSHSIZE], %g2
+ ldx [%g2 + 8], %g2 /* text */
+ mov %g2, %o1
+ call %g1, 2
+ add %sp, STACK_BIAS, %o0
+ ret
+ restore
+ SET_SIZE(get_stack_at_entry)
+
+/*
+ * void
+ * get_stack_at_init(void)
+ *
+ * Passes the stack pointer prior to the invoking call instruction
+ * to initarray() (defined elsewhere).
+ * Tests alignment in section .init_array.
+ */
+ ENTRY(get_stack_at_init)
+ save %sp, -SA(MINFRAME), %sp
+ call initarray, 0
+ add %sp, STACK_BIAS, %o0
+ ret
+ restore
+ SET_SIZE(get_stack_at_init)
+
+/*
+ * Passes the stack pointer during init to initmain() (defined elsewhere).
+ * Tests alignment in section .init.
+ */
+ .section ".init"
+ call initmain, 0
+ add %sp, STACK_BIAS, %o0
+
diff --git a/usr/src/test/os-tests/tests/stackalign/stackalign.c b/usr/src/test/os-tests/tests/stackalign/stackalign.c
index 558f19c664..9597ce0601 100644
--- a/usr/src/test/os-tests/tests/stackalign/stackalign.c
+++ b/usr/src/test/os-tests/tests/stackalign/stackalign.c
@@ -83,13 +83,6 @@ char door_arg[] = "DOOR ARG";
int
main(int argc, char *argv[])
{
-#if defined(__sparc)
- /*
- * This hasn't been implemented for SPARC, so skip.
- */
- fprintf(stderr, "No SPARC implementation of get_stack_at_entry\n");
- return (3);
-#else
door_arg_t da = {
.data_ptr = (void *)door_arg,
.data_size = sizeof (door_arg)
@@ -103,7 +96,7 @@ main(int argc, char *argv[])
int door_fd, rc;
if (pthread_create(&tid, NULL,
- (void *(*)(void *))get_stack_at_entry, &arg) != 0) {
+ (void *(*)(void *))(uintptr_t)get_stack_at_entry, &arg) != 0) {
perror("pthread_create() failed:");
exit(-2);
}
@@ -111,7 +104,8 @@ main(int argc, char *argv[])
arg.text = "thr_create()";
- if (thr_create(NULL, 0, (void *(*)(void *))get_stack_at_entry,
+ if (thr_create(NULL, 0,
+ (void *(*)(void *))(uintptr_t)get_stack_at_entry,
&arg, 0, &tid) != 0) {
perror("thr_create() failed:");
exit(-3);
@@ -142,7 +136,7 @@ main(int argc, char *argv[])
arg.text = "door_call()";
if ((door_fd = door_create(
- (door_server_procedure_t *)get_stack_at_entry,
+ (door_server_procedure_t *)(uintptr_t)get_stack_at_entry,
&arg, 0)) < 0) {
perror("failed to create door");
exit(-7);
@@ -166,5 +160,4 @@ main(int argc, char *argv[])
(void) close(door_fd);
return (0);
-#endif
}
diff --git a/usr/src/test/util-tests/runfiles/default.run b/usr/src/test/util-tests/runfiles/default.run
index 0c116671cc..c4ea9ed8e1 100644
--- a/usr/src/test/util-tests/runfiles/default.run
+++ b/usr/src/test/util-tests/runfiles/default.run
@@ -86,3 +86,5 @@ tests = ['custr_remove', 'custr_trunc']
[/opt/util-tests/tests/sed]
tests = ['sed_addr', 'multi_test']
+
+[/opt/util-tests/tests/pcidbtest]
diff --git a/usr/src/test/util-tests/tests/Makefile b/usr/src/test/util-tests/tests/Makefile
index 0d924d958b..77a20d6059 100644
--- a/usr/src/test/util-tests/tests/Makefile
+++ b/usr/src/test/util-tests/tests/Makefile
@@ -20,6 +20,6 @@
SUBDIRS = date dis dladm iconv libnvpair_json libsff printf xargs grep_xpg4
SUBDIRS += demangle mergeq workq chown ctf smbios libjedec awk make sleep
-SUBDIRS += bunyan libcustr find mdb sed head
+SUBDIRS += bunyan libcustr find mdb sed head pcidb
include $(SRC)/test/Makefile.com
diff --git a/usr/src/test/util-tests/tests/pcidb/Makefile b/usr/src/test/util-tests/tests/pcidb/Makefile
new file mode 100644
index 0000000000..362f26a277
--- /dev/null
+++ b/usr/src/test/util-tests/tests/pcidb/Makefile
@@ -0,0 +1,36 @@
+#
+# This file and its contents are supplied under the terms of the
+# Common Development and Distribution License ("CDDL"), version 1.0.
+# You may only use this file in accordance with the terms of version
+# 1.0 of the CDDL.
+#
+# A full copy of the text of the CDDL should have accompanied this
+# source. A copy of the CDDL is also available via the Internet at
+# http://www.illumos.org/license/CDDL.
+#
+
+#
+# Copyright 2021 Oxide Computer Company
+#
+
+include $(SRC)/cmd/Makefile.cmd
+include $(SRC)/test/Makefile.com
+
+ROOTOPTPKG = $(ROOT)/opt/util-tests/tests
+PROG = pcidbtest
+
+ROOTPROG = $(PROG:%=$(ROOTOPTPKG)/%)
+
+all:
+
+install: $(ROOTPROG)
+
+clobber: clean
+
+clean:
+
+$(ROOTOPTPKG):
+ $(INS.dir)
+
+$(ROOTOPTPKG)/%: %.ksh $(ROOTOPTPKG)
+ $(INS.rename)
diff --git a/usr/src/test/util-tests/tests/pcidb/pcidbtest.ksh b/usr/src/test/util-tests/tests/pcidb/pcidbtest.ksh
new file mode 100644
index 0000000000..6a3cfb2edd
--- /dev/null
+++ b/usr/src/test/util-tests/tests/pcidb/pcidbtest.ksh
@@ -0,0 +1,223 @@
+#!/usr/bin/ksh
+#
+#
+# This file and its contents are supplied under the terms of the
+# Common Development and Distribution License ("CDDL"), version 1.0.
+# You may only use this file in accordance with the terms of version
+# 1.0 of the CDDL.
+#
+# A full copy of the text of the CDDL should have accompanied this
+# source. A copy of the CDDL is also available via the Internet at
+# http://www.illumos.org/license/CDDL.
+#
+
+#
+# Copyright 2021 Oxide Computer Company
+#
+
+unalias -a
+set -o pipefail
+
+pcidb_arg0="$(basename $0)"
+pcidb_prog="/usr/lib/pci/pcidb"
+pcidb_exit=0
+
+warn()
+{
+ typeset msg="$*"
+ [[ -z "$msg" ]] && msg="failed"
+ echo "TEST FAILED: $pcidb_arg0: $msg" >&2
+}
+
+#
+# The following is intended to catch bad filters.
+#
+pcidb_bad_filter()
+{
+ typeset filt="$1"
+
+ if $pcidb_prog $filt 2>/dev/null; then
+ warn "invalid filter $filt erroneously worked"
+ pcidb_exit=1
+ return
+ fi
+
+ printf "TEST PASSED: invalid filter %s\n" "$filt"
+
+}
+
+pcidb_bad_args()
+{
+ if $pcidb_prog $@ 2>/dev/null 1>/dev/null; then
+ warn "should have failed with args "$@", but passed"
+ pcidb_exit=1
+ return
+ fi
+
+ printf "TEST PASSED: invalid arguments %s\n" "$*"
+}
+
+pcidb_match()
+{
+ typeset output
+ typeset match="$1"
+ shift
+
+ output=$($pcidb_prog $@)
+ if (( $? != 0)); then
+ warn "failed to run pcidb with args: $@"
+ pcidb_exit=1
+ return
+ fi
+
+ if [[ "$output" != "$match" ]]; then
+ warn "output mismatch with args: $@\n found: $output\n" \
+ "expected: $match"
+ pcidb_exit=1
+ return
+ fi
+
+ printf "TEST PASSED: successfully matched against %s\n" "$*"
+}
+
+if [[ -n $PCIDB ]]; then
+ pcidb_prog=$PCIDB
+fi
+
+#
+# Before we begin execution, set up the environment such that we have a
+# standard locale and that umem will help us catch mistakes.
+#
+export LC_ALL=C.UTF-8
+export LD_PRELOAD=libumem.so
+export UMEM_DEBUG=default
+
+#
+# Validate that filters match either exactly one or at least one line of
+# output using parsable mode. When we match more than one entry, we
+# don't try to assert the count because we expect that it will actually
+# change over time.
+#
+exp="1de
+8086"
+pcidb_match "$exp" -v -p -o vid pci8086 pci1de
+pcidb_match "Advanced Micro Devices, Inc. [AMD]" -v -p -o vendor pci1022
+pcidb_match "1af4:1044:Virtio RNG" -p -o vid,did,device pci1af4,1044
+pcidb_match "Dell:HBA330 Adapter" -s -p -o subvendor,subsystem \
+ pci1000,97.1028,1f45
+pcidb_match "c:3:30:XHCI" -i -p -o bcc,scc,pi,interface pciclass,0c0330
+pcidb_match "I2O" -S -p -o subclass pciexclass,0e
+pcidb_match "Ethernet 1Gb 2-port 368i Adapter" -s -p -o subsystem pci1590,216,s
+
+#
+# We should get no output when we specify a class or device filter and
+# use a different table or we have an over specified filter.
+#
+pcidb_match "" -d pciclass,03
+pcidb_match "" -S pci1000
+pcidb_match "" -v pci8086,1234
+pcidb_match "" -c pciclass,010802
+
+#
+# Run through filter parsing
+#
+pcidb_bad_filter "foo"
+pcidb_bad_filter ";ffvi"
+pcidb_bad_filter "12345"
+pcidb_bad_filter "pc8086"
+pcidb_bad_filter "pciqwer"
+pcidb_bad_filter "pci12345"
+pcidb_bad_filter "pci8086,"
+pcidb_bad_filter "pci8086,locke"
+pcidb_bad_filter "pci8086sigh"
+pcidb_bad_filter "pci8086,p"
+pcidb_bad_filter "pci8086,12345"
+pcidb_bad_filter "pci8086,1234zz"
+pcidb_bad_filter "pci8086,1234."
+pcidb_bad_filter "pci8086,1234,"
+pcidb_bad_filter "pci8086,1234,b"
+pcidb_bad_filter "pci8086,1234,8"
+pcidb_bad_filter "pci8086,1234,wat"
+pcidb_bad_filter "pci8086,1234.terra"
+pcidb_bad_filter "pci8086,1234.terra,celes"
+pcidb_bad_filter "pci8086,1234.fffff"
+pcidb_bad_filter "pci8086,1234.abcd,"
+pcidb_bad_filter "pci8086,1234.abcd."
+pcidb_bad_filter "pci8086,1234.abcdqr"
+pcidb_bad_filter "pci8086,1234.abcd,2,p"
+pcidb_bad_filter "pci8086,1234.abcd,2000000000"
+pcidb_bad_filter "pci8086,1234.abcd,kefka"
+pcidb_bad_filter "pci8086,1234.abcd,34ultros"
+pcidb_bad_filter "pciexqwer"
+pcidb_bad_filter "pciex12345"
+pcidb_bad_filter "pciex8086,"
+pcidb_bad_filter "pciex8086,locke"
+pcidb_bad_filter "pciex8086sigh"
+pcidb_bad_filter "pciex8086,p"
+pcidb_bad_filter "pciex8086,12345"
+pcidb_bad_filter "pciex8086,1234zz"
+pcidb_bad_filter "pciex8086,1234."
+pcidb_bad_filter "pciex8086,1234,"
+pcidb_bad_filter "pciex8086,1234,b"
+pcidb_bad_filter "pciex8086,1234,8"
+pcidb_bad_filter "pciex8086,1234,wat"
+pcidb_bad_filter "pciex8086,1234.terra"
+pcidb_bad_filter "pciex8086,1234.terra,celes"
+pcidb_bad_filter "pciex8086,1234.fffff"
+pcidb_bad_filter "pciex8086,1234.abcd,"
+pcidb_bad_filter "pciex8086,1234.abcd."
+pcidb_bad_filter "pciex8086,1234.abcdqr"
+pcidb_bad_filter "pciex8086,1234.abcd,2,p"
+pcidb_bad_filter "pciex8086,1234.abcd,2000000000"
+pcidb_bad_filter "pciex8086,1234.abcd,kefka"
+pcidb_bad_filter "pciex8086,1234.abcd,34ultros"
+pcidb_bad_filter "pciclas"
+pcidb_bad_filter "pciclassedgar"
+pcidb_bad_filter "pciclass,sabin"
+pcidb_bad_filter "pciclass,0"
+pcidb_bad_filter "pciclass,013"
+pcidb_bad_filter "pciclass,01345"
+pcidb_bad_filter "pciclass,0134567"
+pcidb_bad_filter "pciclass,01,"
+pcidb_bad_filter "pciclass,010,"
+pcidb_bad_filter "pciclass,010aa,"
+pcidb_bad_filter "pciclass,0102as"
+pcidb_bad_filter "pciclass,0102.as"
+pcidb_bad_filter "pciclass,0102@as"
+pcidb_bad_filter "pciclass,010298aa"
+pcidb_bad_filter "pciclass,010298,"
+pcidb_bad_filter "pciclass,010298!"
+pcidb_bad_filter "pciclass,010298!shadow"
+pcidb_bad_filter "pciexclas"
+pcidb_bad_filter "pciexclassedgar"
+pcidb_bad_filter "pciexclass,sabin"
+pcidb_bad_filter "pciexclass,0"
+pcidb_bad_filter "pciexclass,013"
+pcidb_bad_filter "pciexclass,01345"
+pcidb_bad_filter "pciexclass,0134567"
+pcidb_bad_filter "pciexclass,01,"
+pcidb_bad_filter "pciexclass,010,"
+pcidb_bad_filter "pciexclass,010aa,"
+pcidb_bad_filter "pciexclass,0102as"
+pcidb_bad_filter "pciexclass,0102.as"
+pcidb_bad_filter "pciexclass,0102@as"
+pcidb_bad_filter "pciexclass,010298aa"
+pcidb_bad_filter "pciexclass,010298,"
+pcidb_bad_filter "pciexclass,010298!"
+pcidb_bad_filter "pciexclass,010298!shadow"
+
+#
+# Verify that if we ask for bad columns we error
+#
+pcidb_bad_args -p
+pcidb_bad_args -o
+pcidb_bad_args -o -p
+pcidb_bad_args -p -o terra
+pcidb_bad_args -p -o subclass -v
+pcidb_bad_args -v -d -c
+
+if (( pcidb_exit == 0 )); then
+ printf "All tests passed successfully!\n"
+fi
+
+exit $pcidb_exit
diff --git a/usr/src/tools/onbld/Checks/DbLookups.py b/usr/src/tools/onbld/Checks/DbLookups.py
index 955206750f..83a60a64dc 100644
--- a/usr/src/tools/onbld/Checks/DbLookups.py
+++ b/usr/src/tools/onbld/Checks/DbLookups.py
@@ -106,7 +106,7 @@ class BugDB(object):
try:
data = urlopen(req)
except HTTPError as e:
- if e.code == 404:
+ if e.code == 401 or e.code == 404:
raise NonExistentBug(cr)
else:
raise