aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Eßer <se@FreeBSD.org>2024-01-02 13:05:20 +0000
committerStefan Eßer <se@FreeBSD.org>2024-01-10 16:35:14 +0000
commite6857bd4d7b4bf39ea32b9dcd34f8371164c356e (patch)
tree713454b4335cbf89efedd329b7f7785432682e90
parentaa339f1d5df9e38f36a34eb522355c4eebcae6c4 (diff)
downloadsrc-e6857bd4d7b4bf39ea32b9dcd34f8371164c356e.tar.gz
src-e6857bd4d7b4bf39ea32b9dcd34f8371164c356e.zip
vendor/bc: upgrade to version 6.7.4
Documentation updates only, no functional changes to the software. (cherry picked from commit a3f3a7b4dc80d577e4c8fc64dfbbb359d2e24228)
-rw-r--r--contrib/bc/NEWS.md14
-rwxr-xr-xcontrib/bc/configure.sh18
-rw-r--r--contrib/bc/include/version.h2
-rw-r--r--contrib/bc/manuals/bc/A.1139
-rw-r--r--contrib/bc/manuals/bc/A.1.md20
-rw-r--r--contrib/bc/manuals/bc/E.1112
-rw-r--r--contrib/bc/manuals/bc/EH.1110
-rw-r--r--contrib/bc/manuals/bc/EHN.1109
-rw-r--r--contrib/bc/manuals/bc/EN.1111
-rw-r--r--contrib/bc/manuals/bc/H.1137
-rw-r--r--contrib/bc/manuals/bc/H.1.md20
-rw-r--r--contrib/bc/manuals/bc/HN.1136
-rw-r--r--contrib/bc/manuals/bc/HN.1.md20
-rw-r--r--contrib/bc/manuals/bc/N.1138
-rw-r--r--contrib/bc/manuals/bc/N.1.md20
-rw-r--r--contrib/bc/manuals/bcl.343
-rw-r--r--contrib/bc/manuals/dc/A.149
-rw-r--r--contrib/bc/manuals/dc/E.148
-rw-r--r--contrib/bc/manuals/dc/EH.146
-rw-r--r--contrib/bc/manuals/dc/EHN.145
-rw-r--r--contrib/bc/manuals/dc/EN.147
-rw-r--r--contrib/bc/manuals/dc/H.147
-rw-r--r--contrib/bc/manuals/dc/HN.146
-rw-r--r--contrib/bc/manuals/dc/N.148
24 files changed, 392 insertions, 1133 deletions
diff --git a/contrib/bc/NEWS.md b/contrib/bc/NEWS.md
index d4b160d74d35..240e02f11388 100644
--- a/contrib/bc/NEWS.md
+++ b/contrib/bc/NEWS.md
@@ -1,5 +1,17 @@
# News
+## 6.7.4
+
+This is a production release to fix problems in the `bc` manual.
+
+Users only need to update if desired.
+
+## 6.7.3
+
+This is a production release to fix the library build on Mac OSX.
+
+Users on other platforms do *not* need to update.
+
## 6.7.2
This is a production release to remove some debugging code that I accidentally
@@ -773,7 +785,7 @@ function, `strdup()`, which is not in POSIX 2001, and it is in the X/Open System
Interfaces group 2001. It is, however, in POSIX 2008, and since POSIX 2008 is
old enough to be supported anywhere that I care, that should be the requirement.
-Second, the BcVm global variable was put into `bss`. This actually slightly
+Second, the `BcVm` global variable was put into `bss`. This actually slightly
reduces the size of the executable from a massive code shrink, and it will stop
`bc` from allocating a large set of memory when `bc` starts.
diff --git a/contrib/bc/configure.sh b/contrib/bc/configure.sh
index 35d55058f8f1..9292f094bb17 100755
--- a/contrib/bc/configure.sh
+++ b/contrib/bc/configure.sh
@@ -461,7 +461,7 @@ find_src_files() {
fi
- _find_src_files_files=$(find "$scriptdir/src/" -depth -name "*.c" -print | LC_ALL=C sort)
+ _find_src_files_files=$(find "$scriptdir/src" -depth -name "*.c" -print | LC_ALL=C sort)
_find_src_files_result=""
@@ -772,7 +772,7 @@ predefined_build() {
dc_default_digit_clamp=0;;
GDH)
- CFLAGS="-flto -Weverything -Wno-padded -Wno-unsafe-buffer-usage -Werror -pedantic -std=c11"
+ CFLAGS="-flto -Weverything -Wno-padded -Wno-unsafe-buffer-usage -Wno-poison-system-directories -Werror -pedantic -std=c11"
bc_only=0
dc_only=0
coverage=0
@@ -806,7 +806,7 @@ predefined_build() {
dc_default_digit_clamp=1;;
DBG)
- CFLAGS="-Weverything -Wno-padded -Wno-unsafe-buffer-usage -Werror -pedantic -std=c11"
+ CFLAGS="-Weverything -Wno-padded -Wno-unsafe-buffer-usage -Wno-poison-system-directories -Werror -pedantic -std=c11"
bc_only=0
dc_only=0
coverage=0
@@ -1367,12 +1367,7 @@ if [ "$debug" -eq 1 ]; then
CFLAGS="-g $CFLAGS"
else
-
CPPFLAGS="-DNDEBUG $CPPFLAGS"
-
- if [ "$strip_bin" -ne 0 ]; then
- LDFLAGS="-s $LDFLAGS"
- fi
fi
# Set optimization CFLAGS.
@@ -1694,6 +1689,11 @@ else
apple=""
fi
+# We can't use the linker's strip flag on Mac OSX.
+if [ "$debug" -eq 0 ] && [ "$apple" == "" ] && [ "$strip_bin" -ne 0 ]; then
+ LDFLAGS="-s $LDFLAGS"
+fi
+
# Test OpenBSD. This is not in an if statement because regardless of whatever
# the user says, we need to know if we are on OpenBSD to activate _BSD_SOURCE.
# No, I cannot `#define _BSD_SOURCE` in a header because OpenBSD's patched GCC
@@ -1866,6 +1866,8 @@ dc_tests=$(gen_std_test_targets dc)
dc_script_tests=$(gen_script_test_targets dc)
dc_err_tests=$(gen_err_test_targets dc)
+printf 'unneeded: %s\n' "$unneeded"
+
# Print out the values; this is for debugging.
printf 'Version: %s\n' "$version"
diff --git a/contrib/bc/include/version.h b/contrib/bc/include/version.h
index 1cd13e9878c1..d481cb10abf1 100644
--- a/contrib/bc/include/version.h
+++ b/contrib/bc/include/version.h
@@ -37,6 +37,6 @@
#define BC_VERSION_H
/// The current version.
-#define VERSION 6.7.2
+#define VERSION 6.7.4
#endif // BC_VERSION_H
diff --git a/contrib/bc/manuals/bc/A.1 b/contrib/bc/manuals/bc/A.1
index fc75b5c70ac3..1810beaf9291 100644
--- a/contrib/bc/manuals/bc/A.1
+++ b/contrib/bc/manuals/bc/A.1
@@ -25,14 +25,12 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.TH "BC" "1" "February 2023" "Gavin D. Howard" "General Commands Manual"
+.TH "BC" "1" "November 2023" "Gavin D. Howard" "General Commands Manual"
.nh
.ad l
.SH NAME
-.PP
bc - arbitrary-precision decimal arithmetic language and calculator
.SH SYNOPSIS
-.PP
\f[B]bc\f[R] [\f[B]-cCghilPqRsvVw\f[R]] [\f[B]--digit-clamp\f[R]]
[\f[B]--no-digit-clamp\f[R]] [\f[B]--global-stacks\f[R]]
[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--mathlib\f[R]]
@@ -48,7 +46,6 @@ bc - arbitrary-precision decimal arithmetic language and calculator
[\f[B]-S\f[R] \f[I]scale\f[R]] [\f[B]--scale\f[R]=\f[I]scale\f[R]]
[\f[B]-E\f[R] \f[I]seed\f[R]] [\f[B]--seed\f[R]=\f[I]seed\f[R]]
.SH DESCRIPTION
-.PP
bc(1) is an interactive processor for a language first standardized in
1991 by POSIX.
(See the \f[B]STANDARDS\f[R] section.)
@@ -77,7 +74,6 @@ If parsing scripts meant for other bc(1) implementations still does not
work, that is a bug and should be reported.
See the \f[B]BUGS\f[R] section.
.SH OPTIONS
-.PP
The following are the options that bc(1) accepts.
.TP
\f[B]-C\f[R], \f[B]--no-digit-clamp\f[R]
@@ -189,19 +185,16 @@ without worrying that the change will affect other functions.
Thus, a hypothetical function named \f[B]output(x,b)\f[R] that simply
printed \f[B]x\f[R] in base \f[B]b\f[R] could be written like this:
.IP
-.nf
-\f[C]
+.EX
define void output(x, b) {
obase=b
x
}
-\f[R]
-.fi
+.EE
.PP
instead of like this:
.IP
-.nf
-\f[C]
+.EX
define void output(x, b) {
auto c
c=obase
@@ -209,8 +202,7 @@ define void output(x, b) {
x
obase=c
}
-\f[R]
-.fi
+.EE
.PP
This makes writing functions much easier.
.PP
@@ -228,12 +220,10 @@ converter, it is possible to replace that capability with various shell
aliases.
Examples:
.IP
-.nf
-\f[C]
+.EX
alias d2o=\[dq]bc -e ibase=A -e obase=8\[dq]
alias h2b=\[dq]bc -e ibase=G -e obase=2\[dq]
-\f[R]
-.fi
+.EE
.PP
Second, if the purpose of a function is to set \f[B]ibase\f[R],
\f[B]obase\f[R], \f[B]scale\f[R], or \f[B]seed\f[R] globally for any
@@ -251,11 +241,9 @@ If a function desires to not affect the sequence of pseudo-random
numbers of its parents, but wants to use the same \f[B]seed\f[R], it can
use the following line:
.IP
-.nf
-\f[C]
+.EX
seed = seed
-\f[R]
-.fi
+.EE
.PP
If the behavior of this option is desired for every run of bc(1), then
users could make sure to define \f[B]BC_ENV_ARGS\f[R] and include this
@@ -485,7 +473,6 @@ This is a \f[B]non-portable extension\f[R].
.PP
All long options are \f[B]non-portable extensions\f[R].
.SH STDIN
-.PP
If no files or expressions are given by the \f[B]-f\f[R],
\f[B]--file\f[R], \f[B]-e\f[R], or \f[B]--expression\f[R] options, then
bc(1) reads from \f[B]stdin\f[R].
@@ -502,7 +489,6 @@ Second, after an \f[B]if\f[R] statement, bc(1) doesn\[cq]t know if an
\f[B]else\f[R] statement will follow, so it will not execute until it
knows there will not be an \f[B]else\f[R] statement.
.SH STDOUT
-.PP
Any non-error output is written to \f[B]stdout\f[R].
In addition, if history (see the \f[B]HISTORY\f[R] section) and the
prompt (see the \f[B]TTY MODE\f[R] section) are enabled, both are output
@@ -511,7 +497,7 @@ to \f[B]stdout\f[R].
\f[B]Note\f[R]: Unlike other bc(1) implementations, this bc(1) will
issue a fatal error (see the \f[B]EXIT STATUS\f[R] section) if it cannot
write to \f[B]stdout\f[R], so if \f[B]stdout\f[R] is closed, as in
-\f[B]bc >&-\f[R], it will quit with an error.
+\f[B]bc >&-\f[R], it will quit with an error.
This is done so that bc(1) can report problems when \f[B]stdout\f[R] is
redirected to a file.
.PP
@@ -519,13 +505,12 @@ If there are scripts that depend on the behavior of other bc(1)
implementations, it is recommended that those scripts be changed to
redirect \f[B]stdout\f[R] to \f[B]/dev/null\f[R].
.SH STDERR
-.PP
Any error output is written to \f[B]stderr\f[R].
.PP
\f[B]Note\f[R]: Unlike other bc(1) implementations, this bc(1) will
issue a fatal error (see the \f[B]EXIT STATUS\f[R] section) if it cannot
write to \f[B]stderr\f[R], so if \f[B]stderr\f[R] is closed, as in
-\f[B]bc 2>&-\f[R], it will quit with an error.
+\f[B]bc 2>&-\f[R], it will quit with an error.
This is done so that bc(1) can exit with an error code when
\f[B]stderr\f[R] is redirected to a file.
.PP
@@ -533,7 +518,6 @@ If there are scripts that depend on the behavior of other bc(1)
implementations, it is recommended that those scripts be changed to
redirect \f[B]stderr\f[R] to \f[B]/dev/null\f[R].
.SH SYNTAX
-.PP
The syntax for bc(1) programs is mostly C-like, with some differences.
This bc(1) follows the POSIX standard (see the \f[B]STANDARDS\f[R]
section), which is a much more thorough resource for the language this
@@ -618,7 +602,6 @@ These are \f[B]non-portable extensions\f[R].
.PP
Either semicolons or newlines may separate statements.
.SS Comments
-.PP
There are two kinds of comments:
.IP "1." 3
Block comments are enclosed in \f[B]/*\f[R] and \f[B]*/\f[R].
@@ -627,7 +610,6 @@ Line comments go from \f[B]#\f[R] until, and not including, the next
newline.
This is a \f[B]non-portable extension\f[R].
.SS Named Expressions
-.PP
The following are named expressions in bc(1):
.IP "1." 3
Variables: \f[B]I\f[R]
@@ -684,7 +666,6 @@ Named expressions are required as the operand of
of \f[B]assignment\f[R] operators (see the \f[I]Operators\f[R]
subsection).
.SS Operands
-.PP
The following are valid operands in bc(1):
.IP " 1." 4
Numbers (see the \f[I]Numbers\f[R] subsection below).
@@ -829,7 +810,6 @@ where a reproducible stream of pseudo-random numbers is
\f[I]ESSENTIAL\f[R].
In any other case, use a non-seeded pseudo-random number generator.
.SS Numbers
-.PP
Numbers are strings made up of digits, uppercase letters, and at most
\f[B]1\f[R] period for a radix.
Numbers can have up to \f[B]BC_NUM_MAX\f[R] digits.
@@ -901,7 +881,6 @@ number string \f[B]FFeA\f[R], the resulting decimal number will be
Accepting input as scientific notation is a \f[B]non-portable
extension\f[R].
.SS Operators
-.PP
The following arithmetic and logical operators can be used.
They are listed in order of decreasing precedence.
Operators in the same group have the same precedence.
@@ -1018,9 +997,9 @@ The operators will be described in more detail below.
.TP
\f[B]++\f[R] \f[B]--\f[R]
The prefix and postfix \f[B]increment\f[R] and \f[B]decrement\f[R]
-operators behave exactly like they would in C.
-They require a named expression (see the \f[I]Named Expressions\f[R]
-subsection) as an operand.
+operators behave exactly like they would in C. They require a named
+expression (see the \f[I]Named Expressions\f[R] subsection) as an
+operand.
.RS
.PP
The prefix versions of these operators are more efficient; use them
@@ -1192,7 +1171,6 @@ This is \f[I]not\f[R] a short-circuit operator.
This is a \f[B]non-portable extension\f[R].
.RE
.SS Statements
-.PP
The following items are statements:
.IP " 1." 4
\f[B]E\f[R]
@@ -1270,11 +1248,9 @@ occur before the \f[B]quit\f[R] statement before exiting.
.PP
In other words, for the bc(1) code below:
.IP
-.nf
-\f[C]
+.EX
for (i = 0; i < 3; ++i) i; quit
-\f[R]
-.fi
+.EE
.PP
Other bc(1) implementations will print nothing, and this bc(1) will
print \f[B]0\f[R], \f[B]1\f[R], and \f[B]2\f[R] on successive lines
@@ -1305,7 +1281,6 @@ run with either the \f[B]-s\f[R] or \f[B]-w\f[R] command-line options
Printing numbers in scientific notation and/or engineering notation is a
\f[B]non-portable extension\f[R].
.SS Strings
-.PP
If strings appear as a statement by themselves, they are printed without
a trailing newline.
.PP
@@ -1324,7 +1299,6 @@ resets (see the \f[B]RESET\f[R] section).
Assigning strings to variables and array elements and passing them to
functions are \f[B]non-portable extensions\f[R].
.SS Print Statement
-.PP
The \[lq]expressions\[rq] in a \f[B]print\f[R] statement may also be
strings.
If they are, there are backslash escape sequences that are interpreted
@@ -1356,7 +1330,6 @@ character to be printed as-is.
Any non-string expression in a print statement shall be assigned to
\f[B]last\f[R], like any other expression that is printed.
.SS Stream Statement
-.PP
The expressions in a \f[B]stream\f[R] statement may also be strings.
.PP
If a \f[B]stream\f[R] statement is given a string, it prints the string
@@ -1370,17 +1343,14 @@ The result is then printed as though \f[B]obase\f[R] is \f[B]256\f[R]
and each digit is interpreted as an 8-bit ASCII character, making it a
byte stream.
.SS Order of Evaluation
-.PP
All expressions in a statment are evaluated left to right, except as
necessary to maintain order of operations.
This means, for example, assuming that \f[B]i\f[R] is equal to
\f[B]0\f[R], in the expression
.IP
-.nf
-\f[C]
+.EX
a[i++] = i++
-\f[R]
-.fi
+.EE
.PP
the first (or 0th) element of \f[B]a\f[R] is set to \f[B]1\f[R], and
\f[B]i\f[R] is equal to \f[B]2\f[R] at the end of the expression.
@@ -1389,28 +1359,23 @@ This includes function arguments.
Thus, assuming \f[B]i\f[R] is equal to \f[B]0\f[R], this means that in
the expression
.IP
-.nf
-\f[C]
+.EX
x(i++, i++)
-\f[R]
-.fi
+.EE
.PP
the first argument passed to \f[B]x()\f[R] is \f[B]0\f[R], and the
second argument is \f[B]1\f[R], while \f[B]i\f[R] is equal to
\f[B]2\f[R] before the function starts executing.
.SH FUNCTIONS
-.PP
Function definitions are as follows:
.IP
-.nf
-\f[C]
+.EX
define I(I,...,I){
auto I,...,I
S;...;S
return(E)
}
-\f[R]
-.fi
+.EE
.PP
Any \f[B]I\f[R] in the parameter list or \f[B]auto\f[R] list may be
replaced with \f[B]I[]\f[R] to make a parameter or \f[B]auto\f[R] var an
@@ -1438,18 +1403,15 @@ equivalent to \f[B]return (0)\f[R], unless the function is a
\f[B]void\f[R] function (see the \f[I]Void Functions\f[R] subsection
below).
.SS Void Functions
-.PP
Functions can also be \f[B]void\f[R] functions, defined as follows:
.IP
-.nf
-\f[C]
+.EX
define void I(I,...,I){
auto I,...,I
S;...;S
return
}
-\f[R]
-.fi
+.EE
.PP
They can only be used as standalone expressions, where such an
expression would be printed alone, except in a print statement.
@@ -1465,15 +1427,12 @@ The word \[lq]void\[rq] is only treated specially right after the
.PP
This is a \f[B]non-portable extension\f[R].
.SS Array References
-.PP
For any array in the parameter list, if the array is declared in the
form
.IP
-.nf
-\f[C]
+.EX
*I[]
-\f[R]
-.fi
+.EE
.PP
it is a \f[B]reference\f[R].
Any changes to the array in the function are reflected, when the
@@ -1483,7 +1442,6 @@ Other than this, all function arguments are passed by value.
.PP
This is a \f[B]non-portable extension\f[R].
.SH LIBRARY
-.PP
All of the functions below, including the functions in the extended math
library (see the \f[I]Extended Library\f[R] subsection below), are
available when the \f[B]-l\f[R] or \f[B]--mathlib\f[R] command-line
@@ -1491,7 +1449,6 @@ flags are given, except that the extended math library is not available
when the \f[B]-s\f[R] option, the \f[B]-w\f[R] option, or equivalents
are given.
.SS Standard Library
-.PP
The standard (see the \f[B]STANDARDS\f[R] section) defines the following
functions for the math library:
.TP
@@ -1544,7 +1501,6 @@ This is a transcendental function (see the \f[I]Transcendental
Functions\f[R] subsection below).
.RE
.SS Extended Library
-.PP
The extended library is \f[I]not\f[R] loaded when the
\f[B]-s\f[R]/\f[B]--standard\f[R] or \f[B]-w\f[R]/\f[B]--warn\f[R]
options are given since they are not part of the library defined by the
@@ -1866,7 +1822,7 @@ If you want to a use signed two\[cq]s complement argument, use
.TP
\f[B]bnot8(x)\f[R]
Does a bitwise not of the truncated absolute value of \f[B]x\f[R] as
-though it has \f[B]8\f[R] binary digits (1 unsigned byte).
+though it has \f[B]8\f[R] binary digits (\f[B]1\f[R] unsigned byte).
.RS
.PP
If you want to a use signed two\[cq]s complement argument, use
@@ -1875,7 +1831,7 @@ If you want to a use signed two\[cq]s complement argument, use
.TP
\f[B]bnot16(x)\f[R]
Does a bitwise not of the truncated absolute value of \f[B]x\f[R] as
-though it has \f[B]16\f[R] binary digits (2 unsigned bytes).
+though it has \f[B]16\f[R] binary digits (\f[B]2\f[R] unsigned bytes).
.RS
.PP
If you want to a use signed two\[cq]s complement argument, use
@@ -1884,7 +1840,7 @@ If you want to a use signed two\[cq]s complement argument, use
.TP
\f[B]bnot32(x)\f[R]
Does a bitwise not of the truncated absolute value of \f[B]x\f[R] as
-though it has \f[B]32\f[R] binary digits (4 unsigned bytes).
+though it has \f[B]32\f[R] binary digits (\f[B]4\f[R] unsigned bytes).
.RS
.PP
If you want to a use signed two\[cq]s complement argument, use
@@ -1893,7 +1849,7 @@ If you want to a use signed two\[cq]s complement argument, use
.TP
\f[B]bnot64(x)\f[R]
Does a bitwise not of the truncated absolute value of \f[B]x\f[R] as
-though it has \f[B]64\f[R] binary digits (8 unsigned bytes).
+though it has \f[B]64\f[R] binary digits (\f[B]8\f[R] unsigned bytes).
.RS
.PP
If you want to a use signed two\[cq]s complement argument, use
@@ -1921,7 +1877,7 @@ If you want to a use signed two\[cq]s complement argument, use
.TP
\f[B]brev8(x)\f[R]
Runs a bit reversal on the truncated absolute value of \f[B]x\f[R] as
-though it has 8 binary digits (1 unsigned byte).
+though it has 8 binary digits (\f[B]1\f[R] unsigned byte).
.RS
.PP
If you want to a use signed two\[cq]s complement argument, use
@@ -1930,7 +1886,7 @@ If you want to a use signed two\[cq]s complement argument, use
.TP
\f[B]brev16(x)\f[R]
Runs a bit reversal on the truncated absolute value of \f[B]x\f[R] as
-though it has 16 binary digits (2 unsigned bytes).
+though it has 16 binary digits (\f[B]2\f[R] unsigned bytes).
.RS
.PP
If you want to a use signed two\[cq]s complement argument, use
@@ -1939,7 +1895,7 @@ If you want to a use signed two\[cq]s complement argument, use
.TP
\f[B]brev32(x)\f[R]
Runs a bit reversal on the truncated absolute value of \f[B]x\f[R] as
-though it has 32 binary digits (4 unsigned bytes).
+though it has 32 binary digits (\f[B]4\f[R] unsigned bytes).
.RS
.PP
If you want to a use signed two\[cq]s complement argument, use
@@ -1948,7 +1904,7 @@ If you want to a use signed two\[cq]s complement argument, use
.TP
\f[B]brev64(x)\f[R]
Runs a bit reversal on the truncated absolute value of \f[B]x\f[R] as
-though it has 64 binary digits (8 unsigned bytes).
+though it has 64 binary digits (\f[B]8\f[R] unsigned bytes).
.RS
.PP
If you want to a use signed two\[cq]s complement argument, use
@@ -2001,7 +1957,7 @@ If you want to a use signed two\[cq]s complement argument, use
.TP
\f[B]brol32(x, p)\f[R]
Does a left bitwise rotatation of the truncated absolute value of
-\f[B]x\f[R], as though it has \f[B]32\f[R] binary digits (\f[B]2\f[R]
+\f[B]x\f[R], as though it has \f[B]32\f[R] binary digits (\f[B]4\f[R]
unsigned bytes), by the number of places equal to the truncated absolute
value of \f[B]p\f[R] modded by \f[B]2\f[R] to the power of \f[B]32\f[R].
.RS
@@ -2012,7 +1968,7 @@ If you want to a use signed two\[cq]s complement argument, use
.TP
\f[B]brol64(x, p)\f[R]
Does a left bitwise rotatation of the truncated absolute value of
-\f[B]x\f[R], as though it has \f[B]64\f[R] binary digits (\f[B]2\f[R]
+\f[B]x\f[R], as though it has \f[B]64\f[R] binary digits (\f[B]8\f[R]
unsigned bytes), by the number of places equal to the truncated absolute
value of \f[B]p\f[R] modded by \f[B]2\f[R] to the power of \f[B]64\f[R].
.RS
@@ -2457,7 +2413,6 @@ This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
subsection of the \f[B]FUNCTIONS\f[R] section).
.RE
.SS Transcendental Functions
-.PP
All transcendental functions can return slightly inaccurate results, up
to 1 ULP (https://en.wikipedia.org/wiki/Unit_in_the_last_place).
This is unavoidable, and the article at
@@ -2513,7 +2468,6 @@ The transcendental functions in the extended math library are:
.IP \[bu] 2
\f[B]d2r(x)\f[R]
.SH RESET
-.PP
When bc(1) encounters an error or a signal that it has a non-default
handler for, it resets.
This means that several things happen.
@@ -2534,7 +2488,6 @@ Note that this reset behavior is different from the GNU bc(1), which
attempts to start executing the statement right after the one that
caused an error.
.SH PERFORMANCE
-.PP
Most bc(1) implementations use \f[B]char\f[R] types to calculate the
value of \f[B]1\f[R] decimal digit at a time, but that can be slow.
This bc(1) does something different.
@@ -2557,7 +2510,6 @@ checking.
This integer type depends on the value of \f[B]BC_LONG_BIT\f[R], but is
always at least twice as large as the integer type used to store digits.
.SH LIMITS
-.PP
The following are the limits on bc(1):
.TP
\f[B]BC_LONG_BIT\f[R]
@@ -2626,7 +2578,6 @@ large (at least on 64-bit machines) that there should not be any point
at which they become a problem.
In fact, memory should be exhausted before these limits should be hit.
.SH ENVIRONMENT VARIABLES
-.PP
As \f[B]non-portable extensions\f[R], bc(1) recognizes the following
environment variables:
.TP
@@ -2765,7 +2716,6 @@ This environment variable overrides the default, which can be queried
with the \f[B]-h\f[R] or \f[B]--help\f[R] options.
.RE
.SH EXIT STATUS
-.PP
bc(1) returns the following exit statuses:
.TP
\f[B]0\f[R]
@@ -2844,7 +2794,6 @@ These exit statuses allow bc(1) to be used in shell scripting with error
checking, and its normal behavior can be forced by using the
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.SH INTERACTIVE MODE
-.PP
Per the standard (see the \f[B]STANDARDS\f[R] section), bc(1) has an
interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both \f[B]stdin\f[R]
@@ -2858,7 +2807,6 @@ bc(1) may also reset on \f[B]SIGINT\f[R] instead of exit, depending on
the contents of, or default for, the \f[B]BC_SIGINT_RESET\f[R]
environment variable (see the \f[B]ENVIRONMENT VARIABLES\f[R] section).
.SH TTY MODE
-.PP
If \f[B]stdin\f[R], \f[B]stdout\f[R], and \f[B]stderr\f[R] are all
connected to a TTY, then \[lq]TTY mode\[rq] is considered to be
available, and thus, bc(1) can turn on TTY mode, subject to some
@@ -2882,7 +2830,6 @@ required in the bc(1) standard (see the \f[B]STANDARDS\f[R] section),
and interactive mode requires only \f[B]stdin\f[R] and \f[B]stdout\f[R]
to be connected to a terminal.
.SS Command-Line History
-.PP
Command-line history is only enabled if TTY mode is, i.e., that
\f[B]stdin\f[R], \f[B]stdout\f[R], and \f[B]stderr\f[R] are connected to
a TTY and the \f[B]BC_TTY_MODE\f[R] environment variable (see the
@@ -2890,7 +2837,6 @@ a TTY and the \f[B]BC_TTY_MODE\f[R] environment variable (see the
TTY mode.
See the \f[B]COMMAND LINE HISTORY\f[R] section for more information.
.SS Prompt
-.PP
If TTY mode is available, then a prompt can be enabled.
Like TTY mode itself, it can be turned on or off with an environment
variable: \f[B]BC_PROMPT\f[R] (see the \f[B]ENVIRONMENT VARIABLES\f[R]
@@ -2911,7 +2857,6 @@ and \f[B]--no-read-prompt\f[R] options.
See the \f[B]ENVIRONMENT VARIABLES\f[R] and \f[B]OPTIONS\f[R] sections
for more details.
.SH SIGNAL HANDLING
-.PP
Sending a \f[B]SIGINT\f[R] will cause bc(1) to do one of two things.
.PP
If bc(1) is not in interactive mode (see the \f[B]INTERACTIVE MODE\f[R]
@@ -2946,7 +2891,6 @@ The one exception is \f[B]SIGHUP\f[R]; in that case, and only when bc(1)
is in TTY mode (see the \f[B]TTY MODE\f[R] section), a \f[B]SIGHUP\f[R]
will cause bc(1) to clean up and exit.
.SH COMMAND LINE HISTORY
-.PP
bc(1) supports interactive command-line editing.
.PP
If bc(1) can be in TTY mode (see the \f[B]TTY MODE\f[R] section),
@@ -2964,14 +2908,11 @@ the arrow keys.
.PP
\f[B]Note\f[R]: tabs are converted to 8 spaces.
.SH LOCALES
-.PP
This bc(1) ships with support for adding error messages for different
locales and thus, supports \f[B]LC_MESSAGES\f[R].
.SH SEE ALSO
-.PP
dc(1)
.SH STANDARDS
-.PP
bc(1) is compliant with the IEEE Std 1003.1-2017
(\[lq]POSIX.1-2017\[rq]) specification at
https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html .
@@ -2991,13 +2932,13 @@ the value of \f[B]LC_NUMERIC\f[R].
This bc(1) supports error messages for different locales, and thus, it
supports \f[B]LC_MESSAGES\f[R].
.SH BUGS
-.PP
Before version \f[B]6.1.0\f[R], this bc(1) had incorrect behavior for
the \f[B]quit\f[R] statement.
.PP
No other bugs are known.
Report bugs at https://git.gavinhoward.com/gavin/bc .
.SH AUTHORS
-.PP
-Gavin D.
-Howard <gavin@gavinhoward.com> and contributors.
+Gavin D. Howard \c
+.MT gavin@gavinhoward.com
+.ME \c
+\ and contributors.
diff --git a/contrib/bc/manuals/bc/A.1.md b/contrib/bc/manuals/bc/A.1.md
index 3e593e16b481..77004822f73d 100644
--- a/contrib/bc/manuals/bc/A.1.md
+++ b/contrib/bc/manuals/bc/A.1.md
@@ -1513,7 +1513,7 @@ The extended library is a **non-portable extension**.
**bnot8(x)**
: Does a bitwise not of the truncated absolute value of **x** as though it has
- **8** binary digits (1 unsigned byte).
+ **8** binary digits (**1** unsigned byte).
If you want to a use signed two's complement argument, use **s2u(x)** to
convert.
@@ -1521,7 +1521,7 @@ The extended library is a **non-portable extension**.
**bnot16(x)**
: Does a bitwise not of the truncated absolute value of **x** as though it has
- **16** binary digits (2 unsigned bytes).
+ **16** binary digits (**2** unsigned bytes).
If you want to a use signed two's complement argument, use **s2u(x)** to
convert.
@@ -1529,7 +1529,7 @@ The extended library is a **non-portable extension**.
**bnot32(x)**
: Does a bitwise not of the truncated absolute value of **x** as though it has
- **32** binary digits (4 unsigned bytes).
+ **32** binary digits (**4** unsigned bytes).
If you want to a use signed two's complement argument, use **s2u(x)** to
convert.
@@ -1537,7 +1537,7 @@ The extended library is a **non-portable extension**.
**bnot64(x)**
: Does a bitwise not of the truncated absolute value of **x** as though it has
- **64** binary digits (8 unsigned bytes).
+ **64** binary digits (**8** unsigned bytes).
If you want to a use signed two's complement argument, use **s2u(x)** to
convert.
@@ -1561,7 +1561,7 @@ The extended library is a **non-portable extension**.
**brev8(x)**
: Runs a bit reversal on the truncated absolute value of **x** as though it
- has 8 binary digits (1 unsigned byte).
+ has 8 binary digits (**1** unsigned byte).
If you want to a use signed two's complement argument, use **s2u(x)** to
convert.
@@ -1569,7 +1569,7 @@ The extended library is a **non-portable extension**.
**brev16(x)**
: Runs a bit reversal on the truncated absolute value of **x** as though it
- has 16 binary digits (2 unsigned bytes).
+ has 16 binary digits (**2** unsigned bytes).
If you want to a use signed two's complement argument, use **s2u(x)** to
convert.
@@ -1577,7 +1577,7 @@ The extended library is a **non-portable extension**.
**brev32(x)**
: Runs a bit reversal on the truncated absolute value of **x** as though it
- has 32 binary digits (4 unsigned bytes).
+ has 32 binary digits (**4** unsigned bytes).
If you want to a use signed two's complement argument, use **s2u(x)** to
convert.
@@ -1585,7 +1585,7 @@ The extended library is a **non-portable extension**.
**brev64(x)**
: Runs a bit reversal on the truncated absolute value of **x** as though it
- has 64 binary digits (8 unsigned bytes).
+ has 64 binary digits (**8** unsigned bytes).
If you want to a use signed two's complement argument, use **s2u(x)** to
convert.
@@ -1632,7 +1632,7 @@ The extended library is a **non-portable extension**.
**brol32(x, p)**
: Does a left bitwise rotatation of the truncated absolute value of **x**, as
- though it has **32** binary digits (**2** unsigned bytes), by the number of
+ though it has **32** binary digits (**4** unsigned bytes), by the number of
places equal to the truncated absolute value of **p** modded by **2** to the
power of **32**.
@@ -1642,7 +1642,7 @@ The extended library is a **non-portable extension**.
**brol64(x, p)**
: Does a left bitwise rotatation of the truncated absolute value of **x**, as
- though it has **64** binary digits (**2** unsigned bytes), by the number of
+ though it has **64** binary digits (**8** unsigned bytes), by the number of
places equal to the truncated absolute value of **p** modded by **2** to the
power of **64**.
diff --git a/contrib/bc/manuals/bc/E.1 b/contrib/bc/manuals/bc/E.1
index 24f49c701b46..549c1adae8a1 100644
--- a/contrib/bc/manuals/bc/E.1
+++ b/contrib/bc/manuals/bc/E.1
@@ -25,14 +25,12 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.TH "BC" "1" "February 2023" "Gavin D. Howard" "General Commands Manual"
+.TH "BC" "1" "November 2023" "Gavin D. Howard" "General Commands Manual"
.nh
.ad l
.SH NAME
-.PP
bc - arbitrary-precision decimal arithmetic language and calculator
.SH SYNOPSIS
-.PP
\f[B]bc\f[R] [\f[B]-cCghilPqRsvVw\f[R]] [\f[B]--digit-clamp\f[R]]
[\f[B]--no-digit-clamp\f[R]] [\f[B]--global-stacks\f[R]]
[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--mathlib\f[R]]
@@ -44,7 +42,6 @@ bc - arbitrary-precision decimal arithmetic language and calculator
[\f[B]--file\f[R]=\f[I]file\f[R]\&...]
[\f[I]file\f[R]\&...]
.SH DESCRIPTION
-.PP
bc(1) is an interactive processor for a language first standardized in
1991 by POSIX.
(See the \f[B]STANDARDS\f[R] section.)
@@ -73,7 +70,6 @@ If parsing scripts meant for other bc(1) implementations still does not
work, that is a bug and should be reported.
See the \f[B]BUGS\f[R] section.
.SH OPTIONS
-.PP
The following are the options that bc(1) accepts.
.TP
\f[B]-C\f[R], \f[B]--no-digit-clamp\f[R]
@@ -174,19 +170,16 @@ without worrying that the change will affect other functions.
Thus, a hypothetical function named \f[B]output(x,b)\f[R] that simply
printed \f[B]x\f[R] in base \f[B]b\f[R] could be written like this:
.IP
-.nf
-\f[C]
+.EX
define void output(x, b) {
obase=b
x
}
-\f[R]
-.fi
+.EE
.PP
instead of like this:
.IP
-.nf
-\f[C]
+.EX
define void output(x, b) {
auto c
c=obase
@@ -194,8 +187,7 @@ define void output(x, b) {
x
obase=c
}
-\f[R]
-.fi
+.EE
.PP
This makes writing functions much easier.
.PP
@@ -209,12 +201,10 @@ converter, it is possible to replace that capability with various shell
aliases.
Examples:
.IP
-.nf
-\f[C]
+.EX
alias d2o=\[dq]bc -e ibase=A -e obase=8\[dq]
alias h2b=\[dq]bc -e ibase=G -e obase=2\[dq]
-\f[R]
-.fi
+.EE
.PP
Second, if the purpose of a function is to set \f[B]ibase\f[R],
\f[B]obase\f[R], or \f[B]scale\f[R] globally for any other purpose, it
@@ -441,7 +431,6 @@ This is a \f[B]non-portable extension\f[R].
.PP
All long options are \f[B]non-portable extensions\f[R].
.SH STDIN
-.PP
If no files or expressions are given by the \f[B]-f\f[R],
\f[B]--file\f[R], \f[B]-e\f[R], or \f[B]--expression\f[R] options, then
bc(1) reads from \f[B]stdin\f[R].
@@ -458,7 +447,6 @@ Second, after an \f[B]if\f[R] statement, bc(1) doesn\[cq]t know if an
\f[B]else\f[R] statement will follow, so it will not execute until it
knows there will not be an \f[B]else\f[R] statement.
.SH STDOUT
-.PP
Any non-error output is written to \f[B]stdout\f[R].
In addition, if history (see the \f[B]HISTORY\f[R] section) and the
prompt (see the \f[B]TTY MODE\f[R] section) are enabled, both are output
@@ -467,7 +455,7 @@ to \f[B]stdout\f[R].
\f[B]Note\f[R]: Unlike other bc(1) implementations, this bc(1) will
issue a fatal error (see the \f[B]EXIT STATUS\f[R] section) if it cannot
write to \f[B]stdout\f[R], so if \f[B]stdout\f[R] is closed, as in
-\f[B]bc >&-\f[R], it will quit with an error.
+\f[B]bc >&-\f[R], it will quit with an error.
This is done so that bc(1) can report problems when \f[B]stdout\f[R] is
redirected to a file.
.PP
@@ -475,13 +463,12 @@ If there are scripts that depend on the behavior of other bc(1)
implementations, it is recommended that those scripts be changed to
redirect \f[B]stdout\f[R] to \f[B]/dev/null\f[R].
.SH STDERR
-.PP
Any error output is written to \f[B]stderr\f[R].
.PP
\f[B]Note\f[R]: Unlike other bc(1) implementations, this bc(1) will
issue a fatal error (see the \f[B]EXIT STATUS\f[R] section) if it cannot
write to \f[B]stderr\f[R], so if \f[B]stderr\f[R] is closed, as in
-\f[B]bc 2>&-\f[R], it will quit with an error.
+\f[B]bc 2>&-\f[R], it will quit with an error.
This is done so that bc(1) can exit with an error code when
\f[B]stderr\f[R] is redirected to a file.
.PP
@@ -489,7 +476,6 @@ If there are scripts that depend on the behavior of other bc(1)
implementations, it is recommended that those scripts be changed to
redirect \f[B]stderr\f[R] to \f[B]/dev/null\f[R].
.SH SYNTAX
-.PP
The syntax for bc(1) programs is mostly C-like, with some differences.
This bc(1) follows the POSIX standard (see the \f[B]STANDARDS\f[R]
section), which is a much more thorough resource for the language this
@@ -568,7 +554,6 @@ These are \f[B]non-portable extensions\f[R].
.PP
Either semicolons or newlines may separate statements.
.SS Comments
-.PP
There are two kinds of comments:
.IP "1." 3
Block comments are enclosed in \f[B]/*\f[R] and \f[B]*/\f[R].
@@ -577,7 +562,6 @@ Line comments go from \f[B]#\f[R] until, and not including, the next
newline.
This is a \f[B]non-portable extension\f[R].
.SS Named Expressions
-.PP
The following are named expressions in bc(1):
.IP "1." 3
Variables: \f[B]I\f[R]
@@ -606,7 +590,6 @@ Named expressions are required as the operand of
of \f[B]assignment\f[R] operators (see the \f[I]Operators\f[R]
subsection).
.SS Operands
-.PP
The following are valid operands in bc(1):
.IP " 1." 4
Numbers (see the \f[I]Numbers\f[R] subsection below).
@@ -710,7 +693,6 @@ otherwise.
See the \f[B]OPTIONS\f[R] section.
This is a \f[B]non-portable extension\f[R].
.SS Numbers
-.PP
Numbers are strings made up of digits, uppercase letters, and at most
\f[B]1\f[R] period for a radix.
Numbers can have up to \f[B]BC_NUM_MAX\f[R] digits.
@@ -758,7 +740,6 @@ and is meant to provide an easy way to set the current \f[B]ibase\f[R]
If clamping is on, and the clamped value of a character is needed, use a
leading zero, i.e., for \f[B]A\f[R], use \f[B]0A\f[R].
.SS Operators
-.PP
The following arithmetic and logical operators can be used.
They are listed in order of decreasing precedence.
Operators in the same group have the same precedence.
@@ -848,9 +829,9 @@ The operators will be described in more detail below.
.TP
\f[B]++\f[R] \f[B]--\f[R]
The prefix and postfix \f[B]increment\f[R] and \f[B]decrement\f[R]
-operators behave exactly like they would in C.
-They require a named expression (see the \f[I]Named Expressions\f[R]
-subsection) as an operand.
+operators behave exactly like they would in C. They require a named
+expression (see the \f[I]Named Expressions\f[R] subsection) as an
+operand.
.RS
.PP
The prefix versions of these operators are more efficient; use them
@@ -971,7 +952,6 @@ This is \f[I]not\f[R] a short-circuit operator.
This is a \f[B]non-portable extension\f[R].
.RE
.SS Statements
-.PP
The following items are statements:
.IP " 1." 4
\f[B]E\f[R]
@@ -1049,11 +1029,9 @@ occur before the \f[B]quit\f[R] statement before exiting.
.PP
In other words, for the bc(1) code below:
.IP
-.nf
-\f[C]
+.EX
for (i = 0; i < 3; ++i) i; quit
-\f[R]
-.fi
+.EE
.PP
Other bc(1) implementations will print nothing, and this bc(1) will
print \f[B]0\f[R], \f[B]1\f[R], and \f[B]2\f[R] on successive lines
@@ -1070,7 +1048,6 @@ command.
.PP
An expression by itself is evaluated and printed, followed by a newline.
.SS Strings
-.PP
If strings appear as a statement by themselves, they are printed without
a trailing newline.
.PP
@@ -1089,7 +1066,6 @@ resets (see the \f[B]RESET\f[R] section).
Assigning strings to variables and array elements and passing them to
functions are \f[B]non-portable extensions\f[R].
.SS Print Statement
-.PP
The \[lq]expressions\[rq] in a \f[B]print\f[R] statement may also be
strings.
If they are, there are backslash escape sequences that are interpreted
@@ -1121,7 +1097,6 @@ character to be printed as-is.
Any non-string expression in a print statement shall be assigned to
\f[B]last\f[R], like any other expression that is printed.
.SS Stream Statement
-.PP
The expressions in a \f[B]stream\f[R] statement may also be strings.
.PP
If a \f[B]stream\f[R] statement is given a string, it prints the string
@@ -1135,17 +1110,14 @@ The result is then printed as though \f[B]obase\f[R] is \f[B]256\f[R]
and each digit is interpreted as an 8-bit ASCII character, making it a
byte stream.
.SS Order of Evaluation
-.PP
All expressions in a statment are evaluated left to right, except as
necessary to maintain order of operations.
This means, for example, assuming that \f[B]i\f[R] is equal to
\f[B]0\f[R], in the expression
.IP
-.nf
-\f[C]
+.EX
a[i++] = i++
-\f[R]
-.fi
+.EE
.PP
the first (or 0th) element of \f[B]a\f[R] is set to \f[B]1\f[R], and
\f[B]i\f[R] is equal to \f[B]2\f[R] at the end of the expression.
@@ -1154,28 +1126,23 @@ This includes function arguments.
Thus, assuming \f[B]i\f[R] is equal to \f[B]0\f[R], this means that in
the expression
.IP
-.nf
-\f[C]
+.EX
x(i++, i++)
-\f[R]
-.fi
+.EE
.PP
the first argument passed to \f[B]x()\f[R] is \f[B]0\f[R], and the
second argument is \f[B]1\f[R], while \f[B]i\f[R] is equal to
\f[B]2\f[R] before the function starts executing.
.SH FUNCTIONS
-.PP
Function definitions are as follows:
.IP
-.nf
-\f[C]
+.EX
define I(I,...,I){
auto I,...,I
S;...;S
return(E)
}
-\f[R]
-.fi
+.EE
.PP
Any \f[B]I\f[R] in the parameter list or \f[B]auto\f[R] list may be
replaced with \f[B]I[]\f[R] to make a parameter or \f[B]auto\f[R] var an
@@ -1203,18 +1170,15 @@ equivalent to \f[B]return (0)\f[R], unless the function is a
\f[B]void\f[R] function (see the \f[I]Void Functions\f[R] subsection
below).
.SS Void Functions
-.PP
Functions can also be \f[B]void\f[R] functions, defined as follows:
.IP
-.nf
-\f[C]
+.EX
define void I(I,...,I){
auto I,...,I
S;...;S
return
}
-\f[R]
-.fi
+.EE
.PP
They can only be used as standalone expressions, where such an
expression would be printed alone, except in a print statement.
@@ -1230,15 +1194,12 @@ The word \[lq]void\[rq] is only treated specially right after the
.PP
This is a \f[B]non-portable extension\f[R].
.SS Array References
-.PP
For any array in the parameter list, if the array is declared in the
form
.IP
-.nf
-\f[C]
+.EX
*I[]
-\f[R]
-.fi
+.EE
.PP
it is a \f[B]reference\f[R].
Any changes to the array in the function are reflected, when the
@@ -1248,11 +1209,9 @@ Other than this, all function arguments are passed by value.
.PP
This is a \f[B]non-portable extension\f[R].
.SH LIBRARY
-.PP
All of the functions below are available when the \f[B]-l\f[R] or
\f[B]--mathlib\f[R] command-line flags are given.
.SS Standard Library
-.PP
The standard (see the \f[B]STANDARDS\f[R] section) defines the following
functions for the math library:
.TP
@@ -1305,7 +1264,6 @@ This is a transcendental function (see the \f[I]Transcendental
Functions\f[R] subsection below).
.RE
.SS Transcendental Functions
-.PP
All transcendental functions can return slightly inaccurate results, up
to 1 ULP (https://en.wikipedia.org/wiki/Unit_in_the_last_place).
This is unavoidable, and the article at
@@ -1333,7 +1291,6 @@ The transcendental functions in the standard math library are:
.IP \[bu] 2
\f[B]j(x, n)\f[R]
.SH RESET
-.PP
When bc(1) encounters an error or a signal that it has a non-default
handler for, it resets.
This means that several things happen.
@@ -1354,7 +1311,6 @@ Note that this reset behavior is different from the GNU bc(1), which
attempts to start executing the statement right after the one that
caused an error.
.SH PERFORMANCE
-.PP
Most bc(1) implementations use \f[B]char\f[R] types to calculate the
value of \f[B]1\f[R] decimal digit at a time, but that can be slow.
This bc(1) does something different.
@@ -1377,7 +1333,6 @@ checking.
This integer type depends on the value of \f[B]BC_LONG_BIT\f[R], but is
always at least twice as large as the integer type used to store digits.
.SH LIMITS
-.PP
The following are the limits on bc(1):
.TP
\f[B]BC_LONG_BIT\f[R]
@@ -1441,7 +1396,6 @@ large (at least on 64-bit machines) that there should not be any point
at which they become a problem.
In fact, memory should be exhausted before these limits should be hit.
.SH ENVIRONMENT VARIABLES
-.PP
As \f[B]non-portable extensions\f[R], bc(1) recognizes the following
environment variables:
.TP
@@ -1580,7 +1534,6 @@ This environment variable overrides the default, which can be queried
with the \f[B]-h\f[R] or \f[B]--help\f[R] options.
.RE
.SH EXIT STATUS
-.PP
bc(1) returns the following exit statuses:
.TP
\f[B]0\f[R]
@@ -1657,7 +1610,6 @@ These exit statuses allow bc(1) to be used in shell scripting with error
checking, and its normal behavior can be forced by using the
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.SH INTERACTIVE MODE
-.PP
Per the standard (see the \f[B]STANDARDS\f[R] section), bc(1) has an
interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both \f[B]stdin\f[R]
@@ -1671,7 +1623,6 @@ bc(1) may also reset on \f[B]SIGINT\f[R] instead of exit, depending on
the contents of, or default for, the \f[B]BC_SIGINT_RESET\f[R]
environment variable (see the \f[B]ENVIRONMENT VARIABLES\f[R] section).
.SH TTY MODE
-.PP
If \f[B]stdin\f[R], \f[B]stdout\f[R], and \f[B]stderr\f[R] are all
connected to a TTY, then \[lq]TTY mode\[rq] is considered to be
available, and thus, bc(1) can turn on TTY mode, subject to some
@@ -1695,7 +1646,6 @@ required in the bc(1) standard (see the \f[B]STANDARDS\f[R] section),
and interactive mode requires only \f[B]stdin\f[R] and \f[B]stdout\f[R]
to be connected to a terminal.
.SS Command-Line History
-.PP
Command-line history is only enabled if TTY mode is, i.e., that
\f[B]stdin\f[R], \f[B]stdout\f[R], and \f[B]stderr\f[R] are connected to
a TTY and the \f[B]BC_TTY_MODE\f[R] environment variable (see the
@@ -1703,7 +1653,6 @@ a TTY and the \f[B]BC_TTY_MODE\f[R] environment variable (see the
TTY mode.
See the \f[B]COMMAND LINE HISTORY\f[R] section for more information.
.SS Prompt
-.PP
If TTY mode is available, then a prompt can be enabled.
Like TTY mode itself, it can be turned on or off with an environment
variable: \f[B]BC_PROMPT\f[R] (see the \f[B]ENVIRONMENT VARIABLES\f[R]
@@ -1724,7 +1673,6 @@ and \f[B]--no-read-prompt\f[R] options.
See the \f[B]ENVIRONMENT VARIABLES\f[R] and \f[B]OPTIONS\f[R] sections
for more details.
.SH SIGNAL HANDLING
-.PP
Sending a \f[B]SIGINT\f[R] will cause bc(1) to do one of two things.
.PP
If bc(1) is not in interactive mode (see the \f[B]INTERACTIVE MODE\f[R]
@@ -1759,7 +1707,6 @@ The one exception is \f[B]SIGHUP\f[R]; in that case, and only when bc(1)
is in TTY mode (see the \f[B]TTY MODE\f[R] section), a \f[B]SIGHUP\f[R]
will cause bc(1) to clean up and exit.
.SH COMMAND LINE HISTORY
-.PP
bc(1) supports interactive command-line editing.
.PP
If bc(1) can be in TTY mode (see the \f[B]TTY MODE\f[R] section),
@@ -1777,14 +1724,11 @@ the arrow keys.
.PP
\f[B]Note\f[R]: tabs are converted to 8 spaces.
.SH LOCALES
-.PP
This bc(1) ships with support for adding error messages for different
locales and thus, supports \f[B]LC_MESSAGES\f[R].
.SH SEE ALSO
-.PP
dc(1)
.SH STANDARDS
-.PP
bc(1) is compliant with the IEEE Std 1003.1-2017
(\[lq]POSIX.1-2017\[rq]) specification at
https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html .
@@ -1804,13 +1748,13 @@ the value of \f[B]LC_NUMERIC\f[R].
This bc(1) supports error messages for different locales, and thus, it
supports \f[B]LC_MESSAGES\f[R].
.SH BUGS
-.PP
Before version \f[B]6.1.0\f[R], this bc(1) had incorrect behavior for
the \f[B]quit\f[R] statement.
.PP
No other bugs are known.
Report bugs at https://git.gavinhoward.com/gavin/bc .
.SH AUTHORS
-.PP
-Gavin D.
-Howard <gavin@gavinhoward.com> and contributors.
+Gavin D. Howard \c
+.MT gavin@gavinhoward.com
+.ME \c
+\ and contributors.
diff --git a/contrib/bc/manuals/bc/EH.1 b/contrib/bc/manuals/bc/EH.1
index 35672fe5c4e6..e939df81cffd 100644
--- a/contrib/bc/manuals/bc/EH.1
+++ b/contrib/bc/manuals/bc/EH.1
@@ -25,14 +25,12 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.TH "BC" "1" "February 2023" "Gavin D. Howard" "General Commands Manual"
+.TH "BC" "1" "November 2023" "Gavin D. Howard" "General Commands Manual"
.nh
.ad l
.SH NAME
-.PP
bc - arbitrary-precision decimal arithmetic language and calculator
.SH SYNOPSIS
-.PP
\f[B]bc\f[R] [\f[B]-cCghilPqRsvVw\f[R]] [\f[B]--digit-clamp\f[R]]
[\f[B]--no-digit-clamp\f[R]] [\f[B]--global-stacks\f[R]]
[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--mathlib\f[R]]
@@ -44,7 +42,6 @@ bc - arbitrary-precision decimal arithmetic language and calculator
[\f[B]--file\f[R]=\f[I]file\f[R]\&...]
[\f[I]file\f[R]\&...]
.SH DESCRIPTION
-.PP
bc(1) is an interactive processor for a language first standardized in
1991 by POSIX.
(See the \f[B]STANDARDS\f[R] section.)
@@ -73,7 +70,6 @@ If parsing scripts meant for other bc(1) implementations still does not
work, that is a bug and should be reported.
See the \f[B]BUGS\f[R] section.
.SH OPTIONS
-.PP
The following are the options that bc(1) accepts.
.TP
\f[B]-C\f[R], \f[B]--no-digit-clamp\f[R]
@@ -174,19 +170,16 @@ without worrying that the change will affect other functions.
Thus, a hypothetical function named \f[B]output(x,b)\f[R] that simply
printed \f[B]x\f[R] in base \f[B]b\f[R] could be written like this:
.IP
-.nf
-\f[C]
+.EX
define void output(x, b) {
obase=b
x
}
-\f[R]
-.fi
+.EE
.PP
instead of like this:
.IP
-.nf
-\f[C]
+.EX
define void output(x, b) {
auto c
c=obase
@@ -194,8 +187,7 @@ define void output(x, b) {
x
obase=c
}
-\f[R]
-.fi
+.EE
.PP
This makes writing functions much easier.
.PP
@@ -209,12 +201,10 @@ converter, it is possible to replace that capability with various shell
aliases.
Examples:
.IP
-.nf
-\f[C]
+.EX
alias d2o=\[dq]bc -e ibase=A -e obase=8\[dq]
alias h2b=\[dq]bc -e ibase=G -e obase=2\[dq]
-\f[R]
-.fi
+.EE
.PP
Second, if the purpose of a function is to set \f[B]ibase\f[R],
\f[B]obase\f[R], or \f[B]scale\f[R] globally for any other purpose, it
@@ -441,7 +431,6 @@ This is a \f[B]non-portable extension\f[R].
.PP
All long options are \f[B]non-portable extensions\f[R].
.SH STDIN
-.PP
If no files or expressions are given by the \f[B]-f\f[R],
\f[B]--file\f[R], \f[B]-e\f[R], or \f[B]--expression\f[R] options, then
bc(1) reads from \f[B]stdin\f[R].
@@ -458,7 +447,6 @@ Second, after an \f[B]if\f[R] statement, bc(1) doesn\[cq]t know if an
\f[B]else\f[R] statement will follow, so it will not execute until it
knows there will not be an \f[B]else\f[R] statement.
.SH STDOUT
-.PP
Any non-error output is written to \f[B]stdout\f[R].
In addition, if history (see the \f[B]HISTORY\f[R] section) and the
prompt (see the \f[B]TTY MODE\f[R] section) are enabled, both are output
@@ -467,7 +455,7 @@ to \f[B]stdout\f[R].
\f[B]Note\f[R]: Unlike other bc(1) implementations, this bc(1) will
issue a fatal error (see the \f[B]EXIT STATUS\f[R] section) if it cannot
write to \f[B]stdout\f[R], so if \f[B]stdout\f[R] is closed, as in
-\f[B]bc >&-\f[R], it will quit with an error.
+\f[B]bc >&-\f[R], it will quit with an error.
This is done so that bc(1) can report problems when \f[B]stdout\f[R] is
redirected to a file.
.PP
@@ -475,13 +463,12 @@ If there are scripts that depend on the behavior of other bc(1)
implementations, it is recommended that those scripts be changed to
redirect \f[B]stdout\f[R] to \f[B]/dev/null\f[R].
.SH STDERR
-.PP
Any error output is written to \f[B]stderr\f[R].
.PP
\f[B]Note\f[R]: Unlike other bc(1) implementations, this bc(1) will
issue a fatal error (see the \f[B]EXIT STATUS\f[R] section) if it cannot
write to \f[B]stderr\f[R], so if \f[B]stderr\f[R] is closed, as in
-\f[B]bc 2>&-\f[R], it will quit with an error.
+\f[B]bc 2>&-\f[R], it will quit with an error.
This is done so that bc(1) can exit with an error code when
\f[B]stderr\f[R] is redirected to a file.
.PP
@@ -489,7 +476,6 @@ If there are scripts that depend on the behavior of other bc(1)
implementations, it is recommended that those scripts be changed to
redirect \f[B]stderr\f[R] to \f[B]/dev/null\f[R].
.SH SYNTAX
-.PP
The syntax for bc(1) programs is mostly C-like, with some differences.
This bc(1) follows the POSIX standard (see the \f[B]STANDARDS\f[R]
section), which is a much more thorough resource for the language this
@@ -568,7 +554,6 @@ These are \f[B]non-portable extensions\f[R].
.PP
Either semicolons or newlines may separate statements.
.SS Comments
-.PP
There are two kinds of comments:
.IP "1." 3
Block comments are enclosed in \f[B]/*\f[R] and \f[B]*/\f[R].
@@ -577,7 +562,6 @@ Line comments go from \f[B]#\f[R] until, and not including, the next
newline.
This is a \f[B]non-portable extension\f[R].
.SS Named Expressions
-.PP
The following are named expressions in bc(1):
.IP "1." 3
Variables: \f[B]I\f[R]
@@ -606,7 +590,6 @@ Named expressions are required as the operand of
of \f[B]assignment\f[R] operators (see the \f[I]Operators\f[R]
subsection).
.SS Operands
-.PP
The following are valid operands in bc(1):
.IP " 1." 4
Numbers (see the \f[I]Numbers\f[R] subsection below).
@@ -710,7 +693,6 @@ otherwise.
See the \f[B]OPTIONS\f[R] section.
This is a \f[B]non-portable extension\f[R].
.SS Numbers
-.PP
Numbers are strings made up of digits, uppercase letters, and at most
\f[B]1\f[R] period for a radix.
Numbers can have up to \f[B]BC_NUM_MAX\f[R] digits.
@@ -758,7 +740,6 @@ and is meant to provide an easy way to set the current \f[B]ibase\f[R]
If clamping is on, and the clamped value of a character is needed, use a
leading zero, i.e., for \f[B]A\f[R], use \f[B]0A\f[R].
.SS Operators
-.PP
The following arithmetic and logical operators can be used.
They are listed in order of decreasing precedence.
Operators in the same group have the same precedence.
@@ -848,9 +829,9 @@ The operators will be described in more detail below.
.TP
\f[B]++\f[R] \f[B]--\f[R]
The prefix and postfix \f[B]increment\f[R] and \f[B]decrement\f[R]
-operators behave exactly like they would in C.
-They require a named expression (see the \f[I]Named Expressions\f[R]
-subsection) as an operand.
+operators behave exactly like they would in C. They require a named
+expression (see the \f[I]Named Expressions\f[R] subsection) as an
+operand.
.RS
.PP
The prefix versions of these operators are more efficient; use them
@@ -971,7 +952,6 @@ This is \f[I]not\f[R] a short-circuit operator.
This is a \f[B]non-portable extension\f[R].
.RE
.SS Statements
-.PP
The following items are statements:
.IP " 1." 4
\f[B]E\f[R]
@@ -1049,11 +1029,9 @@ occur before the \f[B]quit\f[R] statement before exiting.
.PP
In other words, for the bc(1) code below:
.IP
-.nf
-\f[C]
+.EX
for (i = 0; i < 3; ++i) i; quit
-\f[R]
-.fi
+.EE
.PP
Other bc(1) implementations will print nothing, and this bc(1) will
print \f[B]0\f[R], \f[B]1\f[R], and \f[B]2\f[R] on successive lines
@@ -1070,7 +1048,6 @@ command.
.PP
An expression by itself is evaluated and printed, followed by a newline.
.SS Strings
-.PP
If strings appear as a statement by themselves, they are printed without
a trailing newline.
.PP
@@ -1089,7 +1066,6 @@ resets (see the \f[B]RESET\f[R] section).
Assigning strings to variables and array elements and passing them to
functions are \f[B]non-portable extensions\f[R].
.SS Print Statement
-.PP
The \[lq]expressions\[rq] in a \f[B]print\f[R] statement may also be
strings.
If they are, there are backslash escape sequences that are interpreted
@@ -1121,7 +1097,6 @@ character to be printed as-is.
Any non-string expression in a print statement shall be assigned to
\f[B]last\f[R], like any other expression that is printed.
.SS Stream Statement
-.PP
The expressions in a \f[B]stream\f[R] statement may also be strings.
.PP
If a \f[B]stream\f[R] statement is given a string, it prints the string
@@ -1135,17 +1110,14 @@ The result is then printed as though \f[B]obase\f[R] is \f[B]256\f[R]
and each digit is interpreted as an 8-bit ASCII character, making it a
byte stream.
.SS Order of Evaluation
-.PP
All expressions in a statment are evaluated left to right, except as
necessary to maintain order of operations.
This means, for example, assuming that \f[B]i\f[R] is equal to
\f[B]0\f[R], in the expression
.IP
-.nf
-\f[C]
+.EX
a[i++] = i++
-\f[R]
-.fi
+.EE
.PP
the first (or 0th) element of \f[B]a\f[R] is set to \f[B]1\f[R], and
\f[B]i\f[R] is equal to \f[B]2\f[R] at the end of the expression.
@@ -1154,28 +1126,23 @@ This includes function arguments.
Thus, assuming \f[B]i\f[R] is equal to \f[B]0\f[R], this means that in
the expression
.IP
-.nf
-\f[C]
+.EX
x(i++, i++)
-\f[R]
-.fi
+.EE
.PP
the first argument passed to \f[B]x()\f[R] is \f[B]0\f[R], and the
second argument is \f[B]1\f[R], while \f[B]i\f[R] is equal to
\f[B]2\f[R] before the function starts executing.
.SH FUNCTIONS
-.PP
Function definitions are as follows:
.IP
-.nf
-\f[C]
+.EX
define I(I,...,I){
auto I,...,I
S;...;S
return(E)
}
-\f[R]
-.fi
+.EE
.PP
Any \f[B]I\f[R] in the parameter list or \f[B]auto\f[R] list may be
replaced with \f[B]I[]\f[R] to make a parameter or \f[B]auto\f[R] var an
@@ -1203,18 +1170,15 @@ equivalent to \f[B]return (0)\f[R], unless the function is a
\f[B]void\f[R] function (see the \f[I]Void Functions\f[R] subsection
below).
.SS Void Functions
-.PP
Functions can also be \f[B]void\f[R] functions, defined as follows:
.IP
-.nf
-\f[C]
+.EX
define void I(I,...,I){
auto I,...,I
S;...;S
return
}
-\f[R]
-.fi
+.EE
.PP
They can only be used as standalone expressions, where such an
expression would be printed alone, except in a print statement.
@@ -1230,15 +1194,12 @@ The word \[lq]void\[rq] is only treated specially right after the
.PP
This is a \f[B]non-portable extension\f[R].
.SS Array References
-.PP
For any array in the parameter list, if the array is declared in the
form
.IP
-.nf
-\f[C]
+.EX
*I[]
-\f[R]
-.fi
+.EE
.PP
it is a \f[B]reference\f[R].
Any changes to the array in the function are reflected, when the
@@ -1248,11 +1209,9 @@ Other than this, all function arguments are passed by value.
.PP
This is a \f[B]non-portable extension\f[R].
.SH LIBRARY
-.PP
All of the functions below are available when the \f[B]-l\f[R] or
\f[B]--mathlib\f[R] command-line flags are given.
.SS Standard Library
-.PP
The standard (see the \f[B]STANDARDS\f[R] section) defines the following
functions for the math library:
.TP
@@ -1305,7 +1264,6 @@ This is a transcendental function (see the \f[I]Transcendental
Functions\f[R] subsection below).
.RE
.SS Transcendental Functions
-.PP
All transcendental functions can return slightly inaccurate results, up
to 1 ULP (https://en.wikipedia.org/wiki/Unit_in_the_last_place).
This is unavoidable, and the article at
@@ -1333,7 +1291,6 @@ The transcendental functions in the standard math library are:
.IP \[bu] 2
\f[B]j(x, n)\f[R]
.SH RESET
-.PP
When bc(1) encounters an error or a signal that it has a non-default
handler for, it resets.
This means that several things happen.
@@ -1354,7 +1311,6 @@ Note that this reset behavior is different from the GNU bc(1), which
attempts to start executing the statement right after the one that
caused an error.
.SH PERFORMANCE
-.PP
Most bc(1) implementations use \f[B]char\f[R] types to calculate the
value of \f[B]1\f[R] decimal digit at a time, but that can be slow.
This bc(1) does something different.
@@ -1377,7 +1333,6 @@ checking.
This integer type depends on the value of \f[B]BC_LONG_BIT\f[R], but is
always at least twice as large as the integer type used to store digits.
.SH LIMITS
-.PP
The following are the limits on bc(1):
.TP
\f[B]BC_LONG_BIT\f[R]
@@ -1441,7 +1396,6 @@ large (at least on 64-bit machines) that there should not be any point
at which they become a problem.
In fact, memory should be exhausted before these limits should be hit.
.SH ENVIRONMENT VARIABLES
-.PP
As \f[B]non-portable extensions\f[R], bc(1) recognizes the following
environment variables:
.TP
@@ -1580,7 +1534,6 @@ This environment variable overrides the default, which can be queried
with the \f[B]-h\f[R] or \f[B]--help\f[R] options.
.RE
.SH EXIT STATUS
-.PP
bc(1) returns the following exit statuses:
.TP
\f[B]0\f[R]
@@ -1657,7 +1610,6 @@ These exit statuses allow bc(1) to be used in shell scripting with error
checking, and its normal behavior can be forced by using the
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.SH INTERACTIVE MODE
-.PP
Per the standard (see the \f[B]STANDARDS\f[R] section), bc(1) has an
interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both \f[B]stdin\f[R]
@@ -1671,7 +1623,6 @@ bc(1) may also reset on \f[B]SIGINT\f[R] instead of exit, depending on
the contents of, or default for, the \f[B]BC_SIGINT_RESET\f[R]
environment variable (see the \f[B]ENVIRONMENT VARIABLES\f[R] section).
.SH TTY MODE
-.PP
If \f[B]stdin\f[R], \f[B]stdout\f[R], and \f[B]stderr\f[R] are all
connected to a TTY, then \[lq]TTY mode\[rq] is considered to be
available, and thus, bc(1) can turn on TTY mode, subject to some
@@ -1695,7 +1646,6 @@ required in the bc(1) standard (see the \f[B]STANDARDS\f[R] section),
and interactive mode requires only \f[B]stdin\f[R] and \f[B]stdout\f[R]
to be connected to a terminal.
.SS Prompt
-.PP
If TTY mode is available, then a prompt can be enabled.
Like TTY mode itself, it can be turned on or off with an environment
variable: \f[B]BC_PROMPT\f[R] (see the \f[B]ENVIRONMENT VARIABLES\f[R]
@@ -1716,7 +1666,6 @@ and \f[B]--no-read-prompt\f[R] options.
See the \f[B]ENVIRONMENT VARIABLES\f[R] and \f[B]OPTIONS\f[R] sections
for more details.
.SH SIGNAL HANDLING
-.PP
Sending a \f[B]SIGINT\f[R] will cause bc(1) to do one of two things.
.PP
If bc(1) is not in interactive mode (see the \f[B]INTERACTIVE MODE\f[R]
@@ -1748,14 +1697,11 @@ the user to continue.
\f[B]SIGTERM\f[R] and \f[B]SIGQUIT\f[R] cause bc(1) to clean up and
exit, and it uses the default handler for all other signals.
.SH LOCALES
-.PP
This bc(1) ships with support for adding error messages for different
locales and thus, supports \f[B]LC_MESSAGES\f[R].
.SH SEE ALSO
-.PP
dc(1)
.SH STANDARDS
-.PP
bc(1) is compliant with the IEEE Std 1003.1-2017
(\[lq]POSIX.1-2017\[rq]) specification at
https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html .
@@ -1775,13 +1721,13 @@ the value of \f[B]LC_NUMERIC\f[R].
This bc(1) supports error messages for different locales, and thus, it
supports \f[B]LC_MESSAGES\f[R].
.SH BUGS
-.PP
Before version \f[B]6.1.0\f[R], this bc(1) had incorrect behavior for
the \f[B]quit\f[R] statement.
.PP
No other bugs are known.
Report bugs at https://git.gavinhoward.com/gavin/bc .
.SH AUTHORS
-.PP
-Gavin D.
-Howard <gavin@gavinhoward.com> and contributors.
+Gavin D. Howard \c
+.MT gavin@gavinhoward.com
+.ME \c
+\ and contributors.
diff --git a/contrib/bc/manuals/bc/EHN.1 b/contrib/bc/manuals/bc/EHN.1
index 72790726a4f4..290aec48a6e9 100644
--- a/contrib/bc/manuals/bc/EHN.1
+++ b/contrib/bc/manuals/bc/EHN.1
@@ -25,14 +25,12 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.TH "BC" "1" "February 2023" "Gavin D. Howard" "General Commands Manual"
+.TH "BC" "1" "November 2023" "Gavin D. Howard" "General Commands Manual"
.nh
.ad l
.SH NAME
-.PP
bc - arbitrary-precision decimal arithmetic language and calculator
.SH SYNOPSIS
-.PP
\f[B]bc\f[R] [\f[B]-cCghilPqRsvVw\f[R]] [\f[B]--digit-clamp\f[R]]
[\f[B]--no-digit-clamp\f[R]] [\f[B]--global-stacks\f[R]]
[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--mathlib\f[R]]
@@ -44,7 +42,6 @@ bc - arbitrary-precision decimal arithmetic language and calculator
[\f[B]--file\f[R]=\f[I]file\f[R]\&...]
[\f[I]file\f[R]\&...]
.SH DESCRIPTION
-.PP
bc(1) is an interactive processor for a language first standardized in
1991 by POSIX.
(See the \f[B]STANDARDS\f[R] section.)
@@ -73,7 +70,6 @@ If parsing scripts meant for other bc(1) implementations still does not
work, that is a bug and should be reported.
See the \f[B]BUGS\f[R] section.
.SH OPTIONS
-.PP
The following are the options that bc(1) accepts.
.TP
\f[B]-C\f[R], \f[B]--no-digit-clamp\f[R]
@@ -174,19 +170,16 @@ without worrying that the change will affect other functions.
Thus, a hypothetical function named \f[B]output(x,b)\f[R] that simply
printed \f[B]x\f[R] in base \f[B]b\f[R] could be written like this:
.IP
-.nf
-\f[C]
+.EX
define void output(x, b) {
obase=b
x
}
-\f[R]
-.fi
+.EE
.PP
instead of like this:
.IP
-.nf
-\f[C]
+.EX
define void output(x, b) {
auto c
c=obase
@@ -194,8 +187,7 @@ define void output(x, b) {
x
obase=c
}
-\f[R]
-.fi
+.EE
.PP
This makes writing functions much easier.
.PP
@@ -209,12 +201,10 @@ converter, it is possible to replace that capability with various shell
aliases.
Examples:
.IP
-.nf
-\f[C]
+.EX
alias d2o=\[dq]bc -e ibase=A -e obase=8\[dq]
alias h2b=\[dq]bc -e ibase=G -e obase=2\[dq]
-\f[R]
-.fi
+.EE
.PP
Second, if the purpose of a function is to set \f[B]ibase\f[R],
\f[B]obase\f[R], or \f[B]scale\f[R] globally for any other purpose, it
@@ -441,7 +431,6 @@ This is a \f[B]non-portable extension\f[R].
.PP
All long options are \f[B]non-portable extensions\f[R].
.SH STDIN
-.PP
If no files or expressions are given by the \f[B]-f\f[R],
\f[B]--file\f[R], \f[B]-e\f[R], or \f[B]--expression\f[R] options, then
bc(1) reads from \f[B]stdin\f[R].
@@ -458,7 +447,6 @@ Second, after an \f[B]if\f[R] statement, bc(1) doesn\[cq]t know if an
\f[B]else\f[R] statement will follow, so it will not execute until it
knows there will not be an \f[B]else\f[R] statement.
.SH STDOUT
-.PP
Any non-error output is written to \f[B]stdout\f[R].
In addition, if history (see the \f[B]HISTORY\f[R] section) and the
prompt (see the \f[B]TTY MODE\f[R] section) are enabled, both are output
@@ -467,7 +455,7 @@ to \f[B]stdout\f[R].
\f[B]Note\f[R]: Unlike other bc(1) implementations, this bc(1) will
issue a fatal error (see the \f[B]EXIT STATUS\f[R] section) if it cannot
write to \f[B]stdout\f[R], so if \f[B]stdout\f[R] is closed, as in
-\f[B]bc >&-\f[R], it will quit with an error.
+\f[B]bc >&-\f[R], it will quit with an error.
This is done so that bc(1) can report problems when \f[B]stdout\f[R] is
redirected to a file.
.PP
@@ -475,13 +463,12 @@ If there are scripts that depend on the behavior of other bc(1)
implementations, it is recommended that those scripts be changed to
redirect \f[B]stdout\f[R] to \f[B]/dev/null\f[R].
.SH STDERR
-.PP
Any error output is written to \f[B]stderr\f[R].
.PP
\f[B]Note\f[R]: Unlike other bc(1) implementations, this bc(1) will
issue a fatal error (see the \f[B]EXIT STATUS\f[R] section) if it cannot
write to \f[B]stderr\f[R], so if \f[B]stderr\f[R] is closed, as in
-\f[B]bc 2>&-\f[R], it will quit with an error.
+\f[B]bc 2>&-\f[R], it will quit with an error.
This is done so that bc(1) can exit with an error code when
\f[B]stderr\f[R] is redirected to a file.
.PP
@@ -489,7 +476,6 @@ If there are scripts that depend on the behavior of other bc(1)
implementations, it is recommended that those scripts be changed to
redirect \f[B]stderr\f[R] to \f[B]/dev/null\f[R].
.SH SYNTAX
-.PP
The syntax for bc(1) programs is mostly C-like, with some differences.
This bc(1) follows the POSIX standard (see the \f[B]STANDARDS\f[R]
section), which is a much more thorough resource for the language this
@@ -568,7 +554,6 @@ These are \f[B]non-portable extensions\f[R].
.PP
Either semicolons or newlines may separate statements.
.SS Comments
-.PP
There are two kinds of comments:
.IP "1." 3
Block comments are enclosed in \f[B]/*\f[R] and \f[B]*/\f[R].
@@ -577,7 +562,6 @@ Line comments go from \f[B]#\f[R] until, and not including, the next
newline.
This is a \f[B]non-portable extension\f[R].
.SS Named Expressions
-.PP
The following are named expressions in bc(1):
.IP "1." 3
Variables: \f[B]I\f[R]
@@ -606,7 +590,6 @@ Named expressions are required as the operand of
of \f[B]assignment\f[R] operators (see the \f[I]Operators\f[R]
subsection).
.SS Operands
-.PP
The following are valid operands in bc(1):
.IP " 1." 4
Numbers (see the \f[I]Numbers\f[R] subsection below).
@@ -710,7 +693,6 @@ otherwise.
See the \f[B]OPTIONS\f[R] section.
This is a \f[B]non-portable extension\f[R].
.SS Numbers
-.PP
Numbers are strings made up of digits, uppercase letters, and at most
\f[B]1\f[R] period for a radix.
Numbers can have up to \f[B]BC_NUM_MAX\f[R] digits.
@@ -758,7 +740,6 @@ and is meant to provide an easy way to set the current \f[B]ibase\f[R]
If clamping is on, and the clamped value of a character is needed, use a
leading zero, i.e., for \f[B]A\f[R], use \f[B]0A\f[R].
.SS Operators
-.PP
The following arithmetic and logical operators can be used.
They are listed in order of decreasing precedence.
Operators in the same group have the same precedence.
@@ -848,9 +829,9 @@ The operators will be described in more detail below.
.TP
\f[B]++\f[R] \f[B]--\f[R]
The prefix and postfix \f[B]increment\f[R] and \f[B]decrement\f[R]
-operators behave exactly like they would in C.
-They require a named expression (see the \f[I]Named Expressions\f[R]
-subsection) as an operand.
+operators behave exactly like they would in C. They require a named
+expression (see the \f[I]Named Expressions\f[R] subsection) as an
+operand.
.RS
.PP
The prefix versions of these operators are more efficient; use them
@@ -971,7 +952,6 @@ This is \f[I]not\f[R] a short-circuit operator.
This is a \f[B]non-portable extension\f[R].
.RE
.SS Statements
-.PP
The following items are statements:
.IP " 1." 4
\f[B]E\f[R]
@@ -1049,11 +1029,9 @@ occur before the \f[B]quit\f[R] statement before exiting.
.PP
In other words, for the bc(1) code below:
.IP
-.nf
-\f[C]
+.EX
for (i = 0; i < 3; ++i) i; quit
-\f[R]
-.fi
+.EE
.PP
Other bc(1) implementations will print nothing, and this bc(1) will
print \f[B]0\f[R], \f[B]1\f[R], and \f[B]2\f[R] on successive lines
@@ -1070,7 +1048,6 @@ command.
.PP
An expression by itself is evaluated and printed, followed by a newline.
.SS Strings
-.PP
If strings appear as a statement by themselves, they are printed without
a trailing newline.
.PP
@@ -1089,7 +1066,6 @@ resets (see the \f[B]RESET\f[R] section).
Assigning strings to variables and array elements and passing them to
functions are \f[B]non-portable extensions\f[R].
.SS Print Statement
-.PP
The \[lq]expressions\[rq] in a \f[B]print\f[R] statement may also be
strings.
If they are, there are backslash escape sequences that are interpreted
@@ -1121,7 +1097,6 @@ character to be printed as-is.
Any non-string expression in a print statement shall be assigned to
\f[B]last\f[R], like any other expression that is printed.
.SS Stream Statement
-.PP
The expressions in a \f[B]stream\f[R] statement may also be strings.
.PP
If a \f[B]stream\f[R] statement is given a string, it prints the string
@@ -1135,17 +1110,14 @@ The result is then printed as though \f[B]obase\f[R] is \f[B]256\f[R]
and each digit is interpreted as an 8-bit ASCII character, making it a
byte stream.
.SS Order of Evaluation
-.PP
All expressions in a statment are evaluated left to right, except as
necessary to maintain order of operations.
This means, for example, assuming that \f[B]i\f[R] is equal to
\f[B]0\f[R], in the expression
.IP
-.nf
-\f[C]
+.EX
a[i++] = i++
-\f[R]
-.fi
+.EE
.PP
the first (or 0th) element of \f[B]a\f[R] is set to \f[B]1\f[R], and
\f[B]i\f[R] is equal to \f[B]2\f[R] at the end of the expression.
@@ -1154,28 +1126,23 @@ This includes function arguments.
Thus, assuming \f[B]i\f[R] is equal to \f[B]0\f[R], this means that in
the expression
.IP
-.nf
-\f[C]
+.EX
x(i++, i++)
-\f[R]
-.fi
+.EE
.PP
the first argument passed to \f[B]x()\f[R] is \f[B]0\f[R], and the
second argument is \f[B]1\f[R], while \f[B]i\f[R] is equal to
\f[B]2\f[R] before the function starts executing.
.SH FUNCTIONS
-.PP
Function definitions are as follows:
.IP
-.nf
-\f[C]
+.EX
define I(I,...,I){
auto I,...,I
S;...;S
return(E)
}
-\f[R]
-.fi
+.EE
.PP
Any \f[B]I\f[R] in the parameter list or \f[B]auto\f[R] list may be
replaced with \f[B]I[]\f[R] to make a parameter or \f[B]auto\f[R] var an
@@ -1203,18 +1170,15 @@ equivalent to \f[B]return (0)\f[R], unless the function is a
\f[B]void\f[R] function (see the \f[I]Void Functions\f[R] subsection
below).
.SS Void Functions
-.PP
Functions can also be \f[B]void\f[R] functions, defined as follows:
.IP
-.nf
-\f[C]
+.EX
define void I(I,...,I){
auto I,...,I
S;...;S
return
}
-\f[R]
-.fi
+.EE
.PP
They can only be used as standalone expressions, where such an
expression would be printed alone, except in a print statement.
@@ -1230,15 +1194,12 @@ The word \[lq]void\[rq] is only treated specially right after the
.PP
This is a \f[B]non-portable extension\f[R].
.SS Array References
-.PP
For any array in the parameter list, if the array is declared in the
form
.IP
-.nf
-\f[C]
+.EX
*I[]
-\f[R]
-.fi
+.EE
.PP
it is a \f[B]reference\f[R].
Any changes to the array in the function are reflected, when the
@@ -1248,11 +1209,9 @@ Other than this, all function arguments are passed by value.
.PP
This is a \f[B]non-portable extension\f[R].
.SH LIBRARY
-.PP
All of the functions below are available when the \f[B]-l\f[R] or
\f[B]--mathlib\f[R] command-line flags are given.
.SS Standard Library
-.PP
The standard (see the \f[B]STANDARDS\f[R] section) defines the following
functions for the math library:
.TP
@@ -1305,7 +1264,6 @@ This is a transcendental function (see the \f[I]Transcendental
Functions\f[R] subsection below).
.RE
.SS Transcendental Functions
-.PP
All transcendental functions can return slightly inaccurate results, up
to 1 ULP (https://en.wikipedia.org/wiki/Unit_in_the_last_place).
This is unavoidable, and the article at
@@ -1333,7 +1291,6 @@ The transcendental functions in the standard math library are:
.IP \[bu] 2
\f[B]j(x, n)\f[R]
.SH RESET
-.PP
When bc(1) encounters an error or a signal that it has a non-default
handler for, it resets.
This means that several things happen.
@@ -1354,7 +1311,6 @@ Note that this reset behavior is different from the GNU bc(1), which
attempts to start executing the statement right after the one that
caused an error.
.SH PERFORMANCE
-.PP
Most bc(1) implementations use \f[B]char\f[R] types to calculate the
value of \f[B]1\f[R] decimal digit at a time, but that can be slow.
This bc(1) does something different.
@@ -1377,7 +1333,6 @@ checking.
This integer type depends on the value of \f[B]BC_LONG_BIT\f[R], but is
always at least twice as large as the integer type used to store digits.
.SH LIMITS
-.PP
The following are the limits on bc(1):
.TP
\f[B]BC_LONG_BIT\f[R]
@@ -1441,7 +1396,6 @@ large (at least on 64-bit machines) that there should not be any point
at which they become a problem.
In fact, memory should be exhausted before these limits should be hit.
.SH ENVIRONMENT VARIABLES
-.PP
As \f[B]non-portable extensions\f[R], bc(1) recognizes the following
environment variables:
.TP
@@ -1580,7 +1534,6 @@ This environment variable overrides the default, which can be queried
with the \f[B]-h\f[R] or \f[B]--help\f[R] options.
.RE
.SH EXIT STATUS
-.PP
bc(1) returns the following exit statuses:
.TP
\f[B]0\f[R]
@@ -1657,7 +1610,6 @@ These exit statuses allow bc(1) to be used in shell scripting with error
checking, and its normal behavior can be forced by using the
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.SH INTERACTIVE MODE
-.PP
Per the standard (see the \f[B]STANDARDS\f[R] section), bc(1) has an
interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both \f[B]stdin\f[R]
@@ -1671,7 +1623,6 @@ bc(1) may also reset on \f[B]SIGINT\f[R] instead of exit, depending on
the contents of, or default for, the \f[B]BC_SIGINT_RESET\f[R]
environment variable (see the \f[B]ENVIRONMENT VARIABLES\f[R] section).
.SH TTY MODE
-.PP
If \f[B]stdin\f[R], \f[B]stdout\f[R], and \f[B]stderr\f[R] are all
connected to a TTY, then \[lq]TTY mode\[rq] is considered to be
available, and thus, bc(1) can turn on TTY mode, subject to some
@@ -1695,7 +1646,6 @@ required in the bc(1) standard (see the \f[B]STANDARDS\f[R] section),
and interactive mode requires only \f[B]stdin\f[R] and \f[B]stdout\f[R]
to be connected to a terminal.
.SS Prompt
-.PP
If TTY mode is available, then a prompt can be enabled.
Like TTY mode itself, it can be turned on or off with an environment
variable: \f[B]BC_PROMPT\f[R] (see the \f[B]ENVIRONMENT VARIABLES\f[R]
@@ -1716,7 +1666,6 @@ and \f[B]--no-read-prompt\f[R] options.
See the \f[B]ENVIRONMENT VARIABLES\f[R] and \f[B]OPTIONS\f[R] sections
for more details.
.SH SIGNAL HANDLING
-.PP
Sending a \f[B]SIGINT\f[R] will cause bc(1) to do one of two things.
.PP
If bc(1) is not in interactive mode (see the \f[B]INTERACTIVE MODE\f[R]
@@ -1748,10 +1697,8 @@ the user to continue.
\f[B]SIGTERM\f[R] and \f[B]SIGQUIT\f[R] cause bc(1) to clean up and
exit, and it uses the default handler for all other signals.
.SH SEE ALSO
-.PP
dc(1)
.SH STANDARDS
-.PP
bc(1) is compliant with the IEEE Std 1003.1-2017
(\[lq]POSIX.1-2017\[rq]) specification at
https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html .
@@ -1768,13 +1715,13 @@ Note that the specification explicitly says that bc(1) only accepts
numbers that use a period (\f[B].\f[R]) as a radix point, regardless of
the value of \f[B]LC_NUMERIC\f[R].
.SH BUGS
-.PP
Before version \f[B]6.1.0\f[R], this bc(1) had incorrect behavior for
the \f[B]quit\f[R] statement.
.PP
No other bugs are known.
Report bugs at https://git.gavinhoward.com/gavin/bc .
.SH AUTHORS
-.PP
-Gavin D.
-Howard <gavin@gavinhoward.com> and contributors.
+Gavin D. Howard \c
+.MT gavin@gavinhoward.com
+.ME \c
+\ and contributors.
diff --git a/contrib/bc/manuals/bc/EN.1 b/contrib/bc/manuals/bc/EN.1
index a972005515a6..99ccb822ea78 100644
--- a/contrib/bc/manuals/bc/EN.1
+++ b/contrib/bc/manuals/bc/EN.1
@@ -25,14 +25,12 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.TH "BC" "1" "February 2023" "Gavin D. Howard" "General Commands Manual"
+.TH "BC" "1" "November 2023" "Gavin D. Howard" "General Commands Manual"
.nh
.ad l
.SH NAME
-.PP
bc - arbitrary-precision decimal arithmetic language and calculator
.SH SYNOPSIS
-.PP
\f[B]bc\f[R] [\f[B]-cCghilPqRsvVw\f[R]] [\f[B]--digit-clamp\f[R]]
[\f[B]--no-digit-clamp\f[R]] [\f[B]--global-stacks\f[R]]
[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--mathlib\f[R]]
@@ -44,7 +42,6 @@ bc - arbitrary-precision decimal arithmetic language and calculator
[\f[B]--file\f[R]=\f[I]file\f[R]\&...]
[\f[I]file\f[R]\&...]
.SH DESCRIPTION
-.PP
bc(1) is an interactive processor for a language first standardized in
1991 by POSIX.
(See the \f[B]STANDARDS\f[R] section.)
@@ -73,7 +70,6 @@ If parsing scripts meant for other bc(1) implementations still does not
work, that is a bug and should be reported.
See the \f[B]BUGS\f[R] section.
.SH OPTIONS
-.PP
The following are the options that bc(1) accepts.
.TP
\f[B]-C\f[R], \f[B]--no-digit-clamp\f[R]
@@ -174,19 +170,16 @@ without worrying that the change will affect other functions.
Thus, a hypothetical function named \f[B]output(x,b)\f[R] that simply
printed \f[B]x\f[R] in base \f[B]b\f[R] could be written like this:
.IP
-.nf
-\f[C]
+.EX
define void output(x, b) {
obase=b
x
}
-\f[R]
-.fi
+.EE
.PP
instead of like this:
.IP
-.nf
-\f[C]
+.EX
define void output(x, b) {
auto c
c=obase
@@ -194,8 +187,7 @@ define void output(x, b) {
x
obase=c
}
-\f[R]
-.fi
+.EE
.PP
This makes writing functions much easier.
.PP
@@ -209,12 +201,10 @@ converter, it is possible to replace that capability with various shell
aliases.
Examples:
.IP
-.nf
-\f[C]
+.EX
alias d2o=\[dq]bc -e ibase=A -e obase=8\[dq]
alias h2b=\[dq]bc -e ibase=G -e obase=2\[dq]
-\f[R]
-.fi
+.EE
.PP
Second, if the purpose of a function is to set \f[B]ibase\f[R],
\f[B]obase\f[R], or \f[B]scale\f[R] globally for any other purpose, it
@@ -441,7 +431,6 @@ This is a \f[B]non-portable extension\f[R].
.PP
All long options are \f[B]non-portable extensions\f[R].
.SH STDIN
-.PP
If no files or expressions are given by the \f[B]-f\f[R],
\f[B]--file\f[R], \f[B]-e\f[R], or \f[B]--expression\f[R] options, then
bc(1) reads from \f[B]stdin\f[R].
@@ -458,7 +447,6 @@ Second, after an \f[B]if\f[R] statement, bc(1) doesn\[cq]t know if an
\f[B]else\f[R] statement will follow, so it will not execute until it
knows there will not be an \f[B]else\f[R] statement.
.SH STDOUT
-.PP
Any non-error output is written to \f[B]stdout\f[R].
In addition, if history (see the \f[B]HISTORY\f[R] section) and the
prompt (see the \f[B]TTY MODE\f[R] section) are enabled, both are output
@@ -467,7 +455,7 @@ to \f[B]stdout\f[R].
\f[B]Note\f[R]: Unlike other bc(1) implementations, this bc(1) will
issue a fatal error (see the \f[B]EXIT STATUS\f[R] section) if it cannot
write to \f[B]stdout\f[R], so if \f[B]stdout\f[R] is closed, as in
-\f[B]bc >&-\f[R], it will quit with an error.
+\f[B]bc >&-\f[R], it will quit with an error.
This is done so that bc(1) can report problems when \f[B]stdout\f[R] is
redirected to a file.
.PP
@@ -475,13 +463,12 @@ If there are scripts that depend on the behavior of other bc(1)
implementations, it is recommended that those scripts be changed to
redirect \f[B]stdout\f[R] to \f[B]/dev/null\f[R].
.SH STDERR
-.PP
Any error output is written to \f[B]stderr\f[R].
.PP
\f[B]Note\f[R]: Unlike other bc(1) implementations, this bc(1) will
issue a fatal error (see the \f[B]EXIT STATUS\f[R] section) if it cannot
write to \f[B]stderr\f[R], so if \f[B]stderr\f[R] is closed, as in
-\f[B]bc 2>&-\f[R], it will quit with an error.
+\f[B]bc 2>&-\f[R], it will quit with an error.
This is done so that bc(1) can exit with an error code when
\f[B]stderr\f[R] is redirected to a file.
.PP
@@ -489,7 +476,6 @@ If there are scripts that depend on the behavior of other bc(1)
implementations, it is recommended that those scripts be changed to
redirect \f[B]stderr\f[R] to \f[B]/dev/null\f[R].
.SH SYNTAX
-.PP
The syntax for bc(1) programs is mostly C-like, with some differences.
This bc(1) follows the POSIX standard (see the \f[B]STANDARDS\f[R]
section), which is a much more thorough resource for the language this
@@ -568,7 +554,6 @@ These are \f[B]non-portable extensions\f[R].
.PP
Either semicolons or newlines may separate statements.
.SS Comments
-.PP
There are two kinds of comments:
.IP "1." 3
Block comments are enclosed in \f[B]/*\f[R] and \f[B]*/\f[R].
@@ -577,7 +562,6 @@ Line comments go from \f[B]#\f[R] until, and not including, the next
newline.
This is a \f[B]non-portable extension\f[R].
.SS Named Expressions
-.PP
The following are named expressions in bc(1):
.IP "1." 3
Variables: \f[B]I\f[R]
@@ -606,7 +590,6 @@ Named expressions are required as the operand of
of \f[B]assignment\f[R] operators (see the \f[I]Operators\f[R]
subsection).
.SS Operands
-.PP
The following are valid operands in bc(1):
.IP " 1." 4
Numbers (see the \f[I]Numbers\f[R] subsection below).
@@ -710,7 +693,6 @@ otherwise.
See the \f[B]OPTIONS\f[R] section.
This is a \f[B]non-portable extension\f[R].
.SS Numbers
-.PP
Numbers are strings made up of digits, uppercase letters, and at most
\f[B]1\f[R] period for a radix.
Numbers can have up to \f[B]BC_NUM_MAX\f[R] digits.
@@ -758,7 +740,6 @@ and is meant to provide an easy way to set the current \f[B]ibase\f[R]
If clamping is on, and the clamped value of a character is needed, use a
leading zero, i.e., for \f[B]A\f[R], use \f[B]0A\f[R].
.SS Operators
-.PP
The following arithmetic and logical operators can be used.
They are listed in order of decreasing precedence.
Operators in the same group have the same precedence.
@@ -848,9 +829,9 @@ The operators will be described in more detail below.
.TP
\f[B]++\f[R] \f[B]--\f[R]
The prefix and postfix \f[B]increment\f[R] and \f[B]decrement\f[R]
-operators behave exactly like they would in C.
-They require a named expression (see the \f[I]Named Expressions\f[R]
-subsection) as an operand.
+operators behave exactly like they would in C. They require a named
+expression (see the \f[I]Named Expressions\f[R] subsection) as an
+operand.
.RS
.PP
The prefix versions of these operators are more efficient; use them
@@ -971,7 +952,6 @@ This is \f[I]not\f[R] a short-circuit operator.
This is a \f[B]non-portable extension\f[R].
.RE
.SS Statements
-.PP
The following items are statements:
.IP " 1." 4
\f[B]E\f[R]
@@ -1049,11 +1029,9 @@ occur before the \f[B]quit\f[R] statement before exiting.
.PP
In other words, for the bc(1) code below:
.IP
-.nf
-\f[C]
+.EX
for (i = 0; i < 3; ++i) i; quit
-\f[R]
-.fi
+.EE
.PP
Other bc(1) implementations will print nothing, and this bc(1) will
print \f[B]0\f[R], \f[B]1\f[R], and \f[B]2\f[R] on successive lines
@@ -1070,7 +1048,6 @@ command.
.PP
An expression by itself is evaluated and printed, followed by a newline.
.SS Strings
-.PP
If strings appear as a statement by themselves, they are printed without
a trailing newline.
.PP
@@ -1089,7 +1066,6 @@ resets (see the \f[B]RESET\f[R] section).
Assigning strings to variables and array elements and passing them to
functions are \f[B]non-portable extensions\f[R].
.SS Print Statement
-.PP
The \[lq]expressions\[rq] in a \f[B]print\f[R] statement may also be
strings.
If they are, there are backslash escape sequences that are interpreted
@@ -1121,7 +1097,6 @@ character to be printed as-is.
Any non-string expression in a print statement shall be assigned to
\f[B]last\f[R], like any other expression that is printed.
.SS Stream Statement
-.PP
The expressions in a \f[B]stream\f[R] statement may also be strings.
.PP
If a \f[B]stream\f[R] statement is given a string, it prints the string
@@ -1135,17 +1110,14 @@ The result is then printed as though \f[B]obase\f[R] is \f[B]256\f[R]
and each digit is interpreted as an 8-bit ASCII character, making it a
byte stream.
.SS Order of Evaluation
-.PP
All expressions in a statment are evaluated left to right, except as
necessary to maintain order of operations.
This means, for example, assuming that \f[B]i\f[R] is equal to
\f[B]0\f[R], in the expression
.IP
-.nf
-\f[C]
+.EX
a[i++] = i++
-\f[R]
-.fi
+.EE
.PP
the first (or 0th) element of \f[B]a\f[R] is set to \f[B]1\f[R], and
\f[B]i\f[R] is equal to \f[B]2\f[R] at the end of the expression.
@@ -1154,28 +1126,23 @@ This includes function arguments.
Thus, assuming \f[B]i\f[R] is equal to \f[B]0\f[R], this means that in
the expression
.IP
-.nf
-\f[C]
+.EX
x(i++, i++)
-\f[R]
-.fi
+.EE
.PP
the first argument passed to \f[B]x()\f[R] is \f[B]0\f[R], and the
second argument is \f[B]1\f[R], while \f[B]i\f[R] is equal to
\f[B]2\f[R] before the function starts executing.
.SH FUNCTIONS
-.PP
Function definitions are as follows:
.IP
-.nf
-\f[C]
+.EX
define I(I,...,I){
auto I,...,I
S;...;S
return(E)
}
-\f[R]
-.fi
+.EE
.PP
Any \f[B]I\f[R] in the parameter list or \f[B]auto\f[R] list may be
replaced with \f[B]I[]\f[R] to make a parameter or \f[B]auto\f[R] var an
@@ -1203,18 +1170,15 @@ equivalent to \f[B]return (0)\f[R], unless the function is a
\f[B]void\f[R] function (see the \f[I]Void Functions\f[R] subsection
below).
.SS Void Functions
-.PP
Functions can also be \f[B]void\f[R] functions, defined as follows:
.IP
-.nf
-\f[C]
+.EX
define void I(I,...,I){
auto I,...,I
S;...;S
return
}
-\f[R]
-.fi
+.EE
.PP
They can only be used as standalone expressions, where such an
expression would be printed alone, except in a print statement.
@@ -1230,15 +1194,12 @@ The word \[lq]void\[rq] is only treated specially right after the
.PP
This is a \f[B]non-portable extension\f[R].
.SS Array References
-.PP
For any array in the parameter list, if the array is declared in the
form
.IP
-.nf
-\f[C]
+.EX
*I[]
-\f[R]
-.fi
+.EE
.PP
it is a \f[B]reference\f[R].
Any changes to the array in the function are reflected, when the
@@ -1248,11 +1209,9 @@ Other than this, all function arguments are passed by value.
.PP
This is a \f[B]non-portable extension\f[R].
.SH LIBRARY
-.PP
All of the functions below are available when the \f[B]-l\f[R] or
\f[B]--mathlib\f[R] command-line flags are given.
.SS Standard Library
-.PP
The standard (see the \f[B]STANDARDS\f[R] section) defines the following
functions for the math library:
.TP
@@ -1305,7 +1264,6 @@ This is a transcendental function (see the \f[I]Transcendental
Functions\f[R] subsection below).
.RE
.SS Transcendental Functions
-.PP
All transcendental functions can return slightly inaccurate results, up
to 1 ULP (https://en.wikipedia.org/wiki/Unit_in_the_last_place).
This is unavoidable, and the article at
@@ -1333,7 +1291,6 @@ The transcendental functions in the standard math library are:
.IP \[bu] 2
\f[B]j(x, n)\f[R]
.SH RESET
-.PP
When bc(1) encounters an error or a signal that it has a non-default
handler for, it resets.
This means that several things happen.
@@ -1354,7 +1311,6 @@ Note that this reset behavior is different from the GNU bc(1), which
attempts to start executing the statement right after the one that
caused an error.
.SH PERFORMANCE
-.PP
Most bc(1) implementations use \f[B]char\f[R] types to calculate the
value of \f[B]1\f[R] decimal digit at a time, but that can be slow.
This bc(1) does something different.
@@ -1377,7 +1333,6 @@ checking.
This integer type depends on the value of \f[B]BC_LONG_BIT\f[R], but is
always at least twice as large as the integer type used to store digits.
.SH LIMITS
-.PP
The following are the limits on bc(1):
.TP
\f[B]BC_LONG_BIT\f[R]
@@ -1441,7 +1396,6 @@ large (at least on 64-bit machines) that there should not be any point
at which they become a problem.
In fact, memory should be exhausted before these limits should be hit.
.SH ENVIRONMENT VARIABLES
-.PP
As \f[B]non-portable extensions\f[R], bc(1) recognizes the following
environment variables:
.TP
@@ -1580,7 +1534,6 @@ This environment variable overrides the default, which can be queried
with the \f[B]-h\f[R] or \f[B]--help\f[R] options.
.RE
.SH EXIT STATUS
-.PP
bc(1) returns the following exit statuses:
.TP
\f[B]0\f[R]
@@ -1657,7 +1610,6 @@ These exit statuses allow bc(1) to be used in shell scripting with error
checking, and its normal behavior can be forced by using the
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.SH INTERACTIVE MODE
-.PP
Per the standard (see the \f[B]STANDARDS\f[R] section), bc(1) has an
interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both \f[B]stdin\f[R]
@@ -1671,7 +1623,6 @@ bc(1) may also reset on \f[B]SIGINT\f[R] instead of exit, depending on
the contents of, or default for, the \f[B]BC_SIGINT_RESET\f[R]
environment variable (see the \f[B]ENVIRONMENT VARIABLES\f[R] section).
.SH TTY MODE
-.PP
If \f[B]stdin\f[R], \f[B]stdout\f[R], and \f[B]stderr\f[R] are all
connected to a TTY, then \[lq]TTY mode\[rq] is considered to be
available, and thus, bc(1) can turn on TTY mode, subject to some
@@ -1695,7 +1646,6 @@ required in the bc(1) standard (see the \f[B]STANDARDS\f[R] section),
and interactive mode requires only \f[B]stdin\f[R] and \f[B]stdout\f[R]
to be connected to a terminal.
.SS Command-Line History
-.PP
Command-line history is only enabled if TTY mode is, i.e., that
\f[B]stdin\f[R], \f[B]stdout\f[R], and \f[B]stderr\f[R] are connected to
a TTY and the \f[B]BC_TTY_MODE\f[R] environment variable (see the
@@ -1703,7 +1653,6 @@ a TTY and the \f[B]BC_TTY_MODE\f[R] environment variable (see the
TTY mode.
See the \f[B]COMMAND LINE HISTORY\f[R] section for more information.
.SS Prompt
-.PP
If TTY mode is available, then a prompt can be enabled.
Like TTY mode itself, it can be turned on or off with an environment
variable: \f[B]BC_PROMPT\f[R] (see the \f[B]ENVIRONMENT VARIABLES\f[R]
@@ -1724,7 +1673,6 @@ and \f[B]--no-read-prompt\f[R] options.
See the \f[B]ENVIRONMENT VARIABLES\f[R] and \f[B]OPTIONS\f[R] sections
for more details.
.SH SIGNAL HANDLING
-.PP
Sending a \f[B]SIGINT\f[R] will cause bc(1) to do one of two things.
.PP
If bc(1) is not in interactive mode (see the \f[B]INTERACTIVE MODE\f[R]
@@ -1759,7 +1707,6 @@ The one exception is \f[B]SIGHUP\f[R]; in that case, and only when bc(1)
is in TTY mode (see the \f[B]TTY MODE\f[R] section), a \f[B]SIGHUP\f[R]
will cause bc(1) to clean up and exit.
.SH COMMAND LINE HISTORY
-.PP
bc(1) supports interactive command-line editing.
.PP
If bc(1) can be in TTY mode (see the \f[B]TTY MODE\f[R] section),
@@ -1777,10 +1724,8 @@ the arrow keys.
.PP
\f[B]Note\f[R]: tabs are converted to 8 spaces.
.SH SEE ALSO
-.PP
dc(1)
.SH STANDARDS
-.PP
bc(1) is compliant with the IEEE Std 1003.1-2017
(\[lq]POSIX.1-2017\[rq]) specification at
https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html .
@@ -1797,13 +1742,13 @@ Note that the specification explicitly says that bc(1) only accepts
numbers that use a period (\f[B].\f[R]) as a radix point, regardless of
the value of \f[B]LC_NUMERIC\f[R].
.SH BUGS
-.PP
Before version \f[B]6.1.0\f[R], this bc(1) had incorrect behavior for
the \f[B]quit\f[R] statement.
.PP
No other bugs are known.
Report bugs at https://git.gavinhoward.com/gavin/bc .
.SH AUTHORS
-.PP
-Gavin D.
-Howard <gavin@gavinhoward.com> and contributors.
+Gavin D. Howard \c
+.MT gavin@gavinhoward.com
+.ME \c
+\ and contributors.
diff --git a/contrib/bc/manuals/bc/H.1 b/contrib/bc/manuals/bc/H.1
index a26aee4f2d11..13b2caf84e16 100644
--- a/contrib/bc/manuals/bc/H.1
+++ b/contrib/bc/manuals/bc/H.1
@@ -25,14 +25,12 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.TH "BC" "1" "February 2023" "Gavin D. Howard" "General Commands Manual"
+.TH "BC" "1" "November 2023" "Gavin D. Howard" "General Commands Manual"
.nh
.ad l
.SH NAME
-.PP
bc - arbitrary-precision decimal arithmetic language and calculator
.SH SYNOPSIS
-.PP
\f[B]bc\f[R] [\f[B]-cCghilPqRsvVw\f[R]] [\f[B]--digit-clamp\f[R]]
[\f[B]--no-digit-clamp\f[R]] [\f[B]--global-stacks\f[R]]
[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--mathlib\f[R]]
@@ -48,7 +46,6 @@ bc - arbitrary-precision decimal arithmetic language and calculator
[\f[B]-S\f[R] \f[I]scale\f[R]] [\f[B]--scale\f[R]=\f[I]scale\f[R]]
[\f[B]-E\f[R] \f[I]seed\f[R]] [\f[B]--seed\f[R]=\f[I]seed\f[R]]
.SH DESCRIPTION
-.PP
bc(1) is an interactive processor for a language first standardized in
1991 by POSIX.
(See the \f[B]STANDARDS\f[R] section.)
@@ -77,7 +74,6 @@ If parsing scripts meant for other bc(1) implementations still does not
work, that is a bug and should be reported.
See the \f[B]BUGS\f[R] section.
.SH OPTIONS
-.PP
The following are the options that bc(1) accepts.
.TP
\f[B]-C\f[R], \f[B]--no-digit-clamp\f[R]
@@ -189,19 +185,16 @@ without worrying that the change will affect other functions.
Thus, a hypothetical function named \f[B]output(x,b)\f[R] that simply
printed \f[B]x\f[R] in base \f[B]b\f[R] could be written like this:
.IP
-.nf
-\f[C]
+.EX
define void output(x, b) {
obase=b
x
}
-\f[R]
-.fi
+.EE
.PP
instead of like this:
.IP
-.nf
-\f[C]
+.EX
define void output(x, b) {
auto c
c=obase
@@ -209,8 +202,7 @@ define void output(x, b) {
x
obase=c
}
-\f[R]
-.fi
+.EE
.PP
This makes writing functions much easier.
.PP
@@ -228,12 +220,10 @@ converter, it is possible to replace that capability with various shell
aliases.
Examples:
.IP
-.nf
-\f[C]
+.EX
alias d2o=\[dq]bc -e ibase=A -e obase=8\[dq]
alias h2b=\[dq]bc -e ibase=G -e obase=2\[dq]
-\f[R]
-.fi
+.EE
.PP
Second, if the purpose of a function is to set \f[B]ibase\f[R],
\f[B]obase\f[R], \f[B]scale\f[R], or \f[B]seed\f[R] globally for any
@@ -251,11 +241,9 @@ If a function desires to not affect the sequence of pseudo-random
numbers of its parents, but wants to use the same \f[B]seed\f[R], it can
use the following line:
.IP
-.nf
-\f[C]
+.EX
seed = seed
-\f[R]
-.fi
+.EE
.PP
If the behavior of this option is desired for every run of bc(1), then
users could make sure to define \f[B]BC_ENV_ARGS\f[R] and include this
@@ -485,7 +473,6 @@ This is a \f[B]non-portable extension\f[R].
.PP
All long options are \f[B]non-portable extensions\f[R].
.SH STDIN
-.PP
If no files or expressions are given by the \f[B]-f\f[R],
\f[B]--file\f[R], \f[B]-e\f[R], or \f[B]--expression\f[R] options, then
bc(1) reads from \f[B]stdin\f[R].
@@ -502,7 +489,6 @@ Second, after an \f[B]if\f[R] statement, bc(1) doesn\[cq]t know if an
\f[B]else\f[R] statement will follow, so it will not execute until it
knows there will not be an \f[B]else\f[R] statement.
.SH STDOUT
-.PP
Any non-error output is written to \f[B]stdout\f[R].
In addition, if history (see the \f[B]HISTORY\f[R] section) and the
prompt (see the \f[B]TTY MODE\f[R] section) are enabled, both are output
@@ -511,7 +497,7 @@ to \f[B]stdout\f[R].
\f[B]Note\f[R]: Unlike other bc(1) implementations, this bc(1) will
issue a fatal error (see the \f[B]EXIT STATUS\f[R] section) if it cannot
write to \f[B]stdout\f[R], so if \f[B]stdout\f[R] is closed, as in
-\f[B]bc >&-\f[R], it will quit with an error.
+\f[B]bc >&-\f[R], it will quit with an error.
This is done so that bc(1) can report problems when \f[B]stdout\f[R] is
redirected to a file.
.PP
@@ -519,13 +505,12 @@ If there are scripts that depend on the behavior of other bc(1)
implementations, it is recommended that those scripts be changed to
redirect \f[B]stdout\f[R] to \f[B]/dev/null\f[R].
.SH STDERR
-.PP
Any error output is written to \f[B]stderr\f[R].
.PP
\f[B]Note\f[R]: Unlike other bc(1) implementations, this bc(1) will
issue a fatal error (see the \f[B]EXIT STATUS\f[R] section) if it cannot
write to \f[B]stderr\f[R], so if \f[B]stderr\f[R] is closed, as in
-\f[B]bc 2>&-\f[R], it will quit with an error.
+\f[B]bc 2>&-\f[R], it will quit with an error.
This is done so that bc(1) can exit with an error code when
\f[B]stderr\f[R] is redirected to a file.
.PP
@@ -533,7 +518,6 @@ If there are scripts that depend on the behavior of other bc(1)
implementations, it is recommended that those scripts be changed to
redirect \f[B]stderr\f[R] to \f[B]/dev/null\f[R].
.SH SYNTAX
-.PP
The syntax for bc(1) programs is mostly C-like, with some differences.
This bc(1) follows the POSIX standard (see the \f[B]STANDARDS\f[R]
section), which is a much more thorough resource for the language this
@@ -618,7 +602,6 @@ These are \f[B]non-portable extensions\f[R].
.PP
Either semicolons or newlines may separate statements.
.SS Comments
-.PP
There are two kinds of comments:
.IP "1." 3
Block comments are enclosed in \f[B]/*\f[R] and \f[B]*/\f[R].
@@ -627,7 +610,6 @@ Line comments go from \f[B]#\f[R] until, and not including, the next
newline.
This is a \f[B]non-portable extension\f[R].
.SS Named Expressions
-.PP
The following are named expressions in bc(1):
.IP "1." 3
Variables: \f[B]I\f[R]
@@ -684,7 +666,6 @@ Named expressions are required as the operand of
of \f[B]assignment\f[R] operators (see the \f[I]Operators\f[R]
subsection).
.SS Operands
-.PP
The following are valid operands in bc(1):
.IP " 1." 4
Numbers (see the \f[I]Numbers\f[R] subsection below).
@@ -829,7 +810,6 @@ where a reproducible stream of pseudo-random numbers is
\f[I]ESSENTIAL\f[R].
In any other case, use a non-seeded pseudo-random number generator.
.SS Numbers
-.PP
Numbers are strings made up of digits, uppercase letters, and at most
\f[B]1\f[R] period for a radix.
Numbers can have up to \f[B]BC_NUM_MAX\f[R] digits.
@@ -901,7 +881,6 @@ number string \f[B]FFeA\f[R], the resulting decimal number will be
Accepting input as scientific notation is a \f[B]non-portable
extension\f[R].
.SS Operators
-.PP
The following arithmetic and logical operators can be used.
They are listed in order of decreasing precedence.
Operators in the same group have the same precedence.
@@ -1018,9 +997,9 @@ The operators will be described in more detail below.
.TP
\f[B]++\f[R] \f[B]--\f[R]
The prefix and postfix \f[B]increment\f[R] and \f[B]decrement\f[R]
-operators behave exactly like they would in C.
-They require a named expression (see the \f[I]Named Expressions\f[R]
-subsection) as an operand.
+operators behave exactly like they would in C. They require a named
+expression (see the \f[I]Named Expressions\f[R] subsection) as an
+operand.
.RS
.PP
The prefix versions of these operators are more efficient; use them
@@ -1192,7 +1171,6 @@ This is \f[I]not\f[R] a short-circuit operator.
This is a \f[B]non-portable extension\f[R].
.RE
.SS Statements
-.PP
The following items are statements:
.IP " 1." 4
\f[B]E\f[R]
@@ -1270,11 +1248,9 @@ occur before the \f[B]quit\f[R] statement before exiting.
.PP
In other words, for the bc(1) code below:
.IP
-.nf
-\f[C]
+.EX
for (i = 0; i < 3; ++i) i; quit
-\f[R]
-.fi
+.EE
.PP
Other bc(1) implementations will print nothing, and this bc(1) will
print \f[B]0\f[R], \f[B]1\f[R], and \f[B]2\f[R] on successive lines
@@ -1305,7 +1281,6 @@ run with either the \f[B]-s\f[R] or \f[B]-w\f[R] command-line options
Printing numbers in scientific notation and/or engineering notation is a
\f[B]non-portable extension\f[R].
.SS Strings
-.PP
If strings appear as a statement by themselves, they are printed without
a trailing newline.
.PP
@@ -1324,7 +1299,6 @@ resets (see the \f[B]RESET\f[R] section).
Assigning strings to variables and array elements and passing them to
functions are \f[B]non-portable extensions\f[R].
.SS Print Statement
-.PP
The \[lq]expressions\[rq] in a \f[B]print\f[R] statement may also be
strings.
If they are, there are backslash escape sequences that are interpreted
@@ -1356,7 +1330,6 @@ character to be printed as-is.
Any non-string expression in a print statement shall be assigned to
\f[B]last\f[R], like any other expression that is printed.
.SS Stream Statement
-.PP
The expressions in a \f[B]stream\f[R] statement may also be strings.
.PP
If a \f[B]stream\f[R] statement is given a string, it prints the string
@@ -1370,17 +1343,14 @@ The result is then printed as though \f[B]obase\f[R] is \f[B]256\f[R]
and each digit is interpreted as an 8-bit ASCII character, making it a
byte stream.
.SS Order of Evaluation
-.PP
All expressions in a statment are evaluated left to right, except as
necessary to maintain order of operations.
This means, for example, assuming that \f[B]i\f[R] is equal to
\f[B]0\f[R], in the expression
.IP
-.nf
-\f[C]
+.EX
a[i++] = i++
-\f[R]
-.fi
+.EE
.PP
the first (or 0th) element of \f[B]a\f[R] is set to \f[B]1\f[R], and
\f[B]i\f[R] is equal to \f[B]2\f[R] at the end of the expression.
@@ -1389,28 +1359,23 @@ This includes function arguments.
Thus, assuming \f[B]i\f[R] is equal to \f[B]0\f[R], this means that in
the expression
.IP
-.nf
-\f[C]
+.EX
x(i++, i++)
-\f[R]
-.fi
+.EE
.PP
the first argument passed to \f[B]x()\f[R] is \f[B]0\f[R], and the
second argument is \f[B]1\f[R], while \f[B]i\f[R] is equal to
\f[B]2\f[R] before the function starts executing.
.SH FUNCTIONS
-.PP
Function definitions are as follows:
.IP
-.nf
-\f[C]
+.EX
define I(I,...,I){
auto I,...,I
S;...;S
return(E)
}
-\f[R]
-.fi
+.EE
.PP
Any \f[B]I\f[R] in the parameter list or \f[B]auto\f[R] list may be
replaced with \f[B]I[]\f[R] to make a parameter or \f[B]auto\f[R] var an
@@ -1438,18 +1403,15 @@ equivalent to \f[B]return (0)\f[R], unless the function is a
\f[B]void\f[R] function (see the \f[I]Void Functions\f[R] subsection
below).
.SS Void Functions
-.PP
Functions can also be \f[B]void\f[R] functions, defined as follows:
.IP
-.nf
-\f[C]
+.EX
define void I(I,...,I){
auto I,...,I
S;...;S
return
}
-\f[R]
-.fi
+.EE
.PP
They can only be used as standalone expressions, where such an
expression would be printed alone, except in a print statement.
@@ -1465,15 +1427,12 @@ The word \[lq]void\[rq] is only treated specially right after the
.PP
This is a \f[B]non-portable extension\f[R].
.SS Array References
-.PP
For any array in the parameter list, if the array is declared in the
form
.IP
-.nf
-\f[C]
+.EX
*I[]
-\f[R]
-.fi
+.EE
.PP
it is a \f[B]reference\f[R].
Any changes to the array in the function are reflected, when the
@@ -1483,7 +1442,6 @@ Other than this, all function arguments are passed by value.
.PP
This is a \f[B]non-portable extension\f[R].
.SH LIBRARY
-.PP
All of the functions below, including the functions in the extended math
library (see the \f[I]Extended Library\f[R] subsection below), are
available when the \f[B]-l\f[R] or \f[B]--mathlib\f[R] command-line
@@ -1491,7 +1449,6 @@ flags are given, except that the extended math library is not available
when the \f[B]-s\f[R] option, the \f[B]-w\f[R] option, or equivalents
are given.
.SS Standard Library
-.PP
The standard (see the \f[B]STANDARDS\f[R] section) defines the following
functions for the math library:
.TP
@@ -1544,7 +1501,6 @@ This is a transcendental function (see the \f[I]Transcendental
Functions\f[R] subsection below).
.RE
.SS Extended Library
-.PP
The extended library is \f[I]not\f[R] loaded when the
\f[B]-s\f[R]/\f[B]--standard\f[R] or \f[B]-w\f[R]/\f[B]--warn\f[R]
options are given since they are not part of the library defined by the
@@ -1866,7 +1822,7 @@ If you want to a use signed two\[cq]s complement argument, use
.TP
\f[B]bnot8(x)\f[R]
Does a bitwise not of the truncated absolute value of \f[B]x\f[R] as
-though it has \f[B]8\f[R] binary digits (1 unsigned byte).
+though it has \f[B]8\f[R] binary digits (\f[B]1\f[R] unsigned byte).
.RS
.PP
If you want to a use signed two\[cq]s complement argument, use
@@ -1875,7 +1831,7 @@ If you want to a use signed two\[cq]s complement argument, use
.TP
\f[B]bnot16(x)\f[R]
Does a bitwise not of the truncated absolute value of \f[B]x\f[R] as
-though it has \f[B]16\f[R] binary digits (2 unsigned bytes).
+though it has \f[B]16\f[R] binary digits (\f[B]2\f[R] unsigned bytes).
.RS
.PP
If you want to a use signed two\[cq]s complement argument, use
@@ -1884,7 +1840,7 @@ If you want to a use signed two\[cq]s complement argument, use
.TP
\f[B]bnot32(x)\f[R]
Does a bitwise not of the truncated absolute value of \f[B]x\f[R] as
-though it has \f[B]32\f[R] binary digits (4 unsigned bytes).
+though it has \f[B]32\f[R] binary digits (\f[B]4\f[R] unsigned bytes).
.RS
.PP
If you want to a use signed two\[cq]s complement argument, use
@@ -1893,7 +1849,7 @@ If you want to a use signed two\[cq]s complement argument, use
.TP
\f[B]bnot64(x)\f[R]
Does a bitwise not of the truncated absolute value of \f[B]x\f[R] as
-though it has \f[B]64\f[R] binary digits (8 unsigned bytes).
+though it has \f[B]64\f[R] binary digits (\f[B]8\f[R] unsigned bytes).
.RS
.PP
If you want to a use signed two\[cq]s complement argument, use
@@ -1921,7 +1877,7 @@ If you want to a use signed two\[cq]s complement argument, use
.TP
\f[B]brev8(x)\f[R]
Runs a bit reversal on the truncated absolute value of \f[B]x\f[R] as
-though it has 8 binary digits (1 unsigned byte).
+though it has 8 binary digits (\f[B]1\f[R] unsigned byte).
.RS
.PP
If you want to a use signed two\[cq]s complement argument, use
@@ -1930,7 +1886,7 @@ If you want to a use signed two\[cq]s complement argument, use
.TP
\f[B]brev16(x)\f[R]
Runs a bit reversal on the truncated absolute value of \f[B]x\f[R] as
-though it has 16 binary digits (2 unsigned bytes).
+though it has 16 binary digits (\f[B]2\f[R] unsigned bytes).
.RS
.PP
If you want to a use signed two\[cq]s complement argument, use
@@ -1939,7 +1895,7 @@ If you want to a use signed two\[cq]s complement argument, use
.TP
\f[B]brev32(x)\f[R]
Runs a bit reversal on the truncated absolute value of \f[B]x\f[R] as
-though it has 32 binary digits (4 unsigned bytes).
+though it has 32 binary digits (\f[B]4\f[R] unsigned bytes).
.RS
.PP
If you want to a use signed two\[cq]s complement argument, use
@@ -1948,7 +1904,7 @@ If you want to a use signed two\[cq]s complement argument, use
.TP
\f[B]brev64(x)\f[R]
Runs a bit reversal on the truncated absolute value of \f[B]x\f[R] as
-though it has 64 binary digits (8 unsigned bytes).
+though it has 64 binary digits (\f[B]8\f[R] unsigned bytes).
.RS
.PP
If you want to a use signed two\[cq]s complement argument, use
@@ -2001,7 +1957,7 @@ If you want to a use signed two\[cq]s complement argument, use
.TP
\f[B]brol32(x, p)\f[R]
Does a left bitwise rotatation of the truncated absolute value of
-\f[B]x\f[R], as though it has \f[B]32\f[R] binary digits (\f[B]2\f[R]
+\f[B]x\f[R], as though it has \f[B]32\f[R] binary digits (\f[B]4\f[R]
unsigned bytes), by the number of places equal to the truncated absolute
value of \f[B]p\f[R] modded by \f[B]2\f[R] to the power of \f[B]32\f[R].
.RS
@@ -2012,7 +1968,7 @@ If you want to a use signed two\[cq]s complement argument, use
.TP
\f[B]brol64(x, p)\f[R]
Does a left bitwise rotatation of the truncated absolute value of
-\f[B]x\f[R], as though it has \f[B]64\f[R] binary digits (\f[B]2\f[R]
+\f[B]x\f[R], as though it has \f[B]64\f[R] binary digits (\f[B]8\f[R]
unsigned bytes), by the number of places equal to the truncated absolute
value of \f[B]p\f[R] modded by \f[B]2\f[R] to the power of \f[B]64\f[R].
.RS
@@ -2457,7 +2413,6 @@ This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
subsection of the \f[B]FUNCTIONS\f[R] section).
.RE
.SS Transcendental Functions
-.PP
All transcendental functions can return slightly inaccurate results, up
to 1 ULP (https://en.wikipedia.org/wiki/Unit_in_the_last_place).
This is unavoidable, and the article at
@@ -2513,7 +2468,6 @@ The transcendental functions in the extended math library are:
.IP \[bu] 2
\f[B]d2r(x)\f[R]
.SH RESET
-.PP
When bc(1) encounters an error or a signal that it has a non-default
handler for, it resets.
This means that several things happen.
@@ -2534,7 +2488,6 @@ Note that this reset behavior is different from the GNU bc(1), which
attempts to start executing the statement right after the one that
caused an error.
.SH PERFORMANCE
-.PP
Most bc(1) implementations use \f[B]char\f[R] types to calculate the
value of \f[B]1\f[R] decimal digit at a time, but that can be slow.
This bc(1) does something different.
@@ -2557,7 +2510,6 @@ checking.
This integer type depends on the value of \f[B]BC_LONG_BIT\f[R], but is
always at least twice as large as the integer type used to store digits.
.SH LIMITS
-.PP
The following are the limits on bc(1):
.TP
\f[B]BC_LONG_BIT\f[R]
@@ -2626,7 +2578,6 @@ large (at least on 64-bit machines) that there should not be any point
at which they become a problem.
In fact, memory should be exhausted before these limits should be hit.
.SH ENVIRONMENT VARIABLES
-.PP
As \f[B]non-portable extensions\f[R], bc(1) recognizes the following
environment variables:
.TP
@@ -2765,7 +2716,6 @@ This environment variable overrides the default, which can be queried
with the \f[B]-h\f[R] or \f[B]--help\f[R] options.
.RE
.SH EXIT STATUS
-.PP
bc(1) returns the following exit statuses:
.TP
\f[B]0\f[R]
@@ -2844,7 +2794,6 @@ These exit statuses allow bc(1) to be used in shell scripting with error
checking, and its normal behavior can be forced by using the
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.SH INTERACTIVE MODE
-.PP
Per the standard (see the \f[B]STANDARDS\f[R] section), bc(1) has an
interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both \f[B]stdin\f[R]
@@ -2858,7 +2807,6 @@ bc(1) may also reset on \f[B]SIGINT\f[R] instead of exit, depending on
the contents of, or default for, the \f[B]BC_SIGINT_RESET\f[R]
environment variable (see the \f[B]ENVIRONMENT VARIABLES\f[R] section).
.SH TTY MODE
-.PP
If \f[B]stdin\f[R], \f[B]stdout\f[R], and \f[B]stderr\f[R] are all
connected to a TTY, then \[lq]TTY mode\[rq] is considered to be
available, and thus, bc(1) can turn on TTY mode, subject to some
@@ -2882,7 +2830,6 @@ required in the bc(1) standard (see the \f[B]STANDARDS\f[R] section),
and interactive mode requires only \f[B]stdin\f[R] and \f[B]stdout\f[R]
to be connected to a terminal.
.SS Prompt
-.PP
If TTY mode is available, then a prompt can be enabled.
Like TTY mode itself, it can be turned on or off with an environment
variable: \f[B]BC_PROMPT\f[R] (see the \f[B]ENVIRONMENT VARIABLES\f[R]
@@ -2903,7 +2850,6 @@ and \f[B]--no-read-prompt\f[R] options.
See the \f[B]ENVIRONMENT VARIABLES\f[R] and \f[B]OPTIONS\f[R] sections
for more details.
.SH SIGNAL HANDLING
-.PP
Sending a \f[B]SIGINT\f[R] will cause bc(1) to do one of two things.
.PP
If bc(1) is not in interactive mode (see the \f[B]INTERACTIVE MODE\f[R]
@@ -2935,14 +2881,11 @@ the user to continue.
\f[B]SIGTERM\f[R] and \f[B]SIGQUIT\f[R] cause bc(1) to clean up and
exit, and it uses the default handler for all other signals.
.SH LOCALES
-.PP
This bc(1) ships with support for adding error messages for different
locales and thus, supports \f[B]LC_MESSAGES\f[R].
.SH SEE ALSO
-.PP
dc(1)
.SH STANDARDS
-.PP
bc(1) is compliant with the IEEE Std 1003.1-2017
(\[lq]POSIX.1-2017\[rq]) specification at
https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html .
@@ -2962,13 +2905,13 @@ the value of \f[B]LC_NUMERIC\f[R].
This bc(1) supports error messages for different locales, and thus, it
supports \f[B]LC_MESSAGES\f[R].
.SH BUGS
-.PP
Before version \f[B]6.1.0\f[R], this bc(1) had incorrect behavior for
the \f[B]quit\f[R] statement.
.PP
No other bugs are known.
Report bugs at https://git.gavinhoward.com/gavin/bc .
.SH AUTHORS
-.PP
-Gavin D.
-Howard <gavin@gavinhoward.com> and contributors.
+Gavin D. Howard \c
+.MT gavin@gavinhoward.com
+.ME \c
+\ and contributors.
diff --git a/contrib/bc/manuals/bc/H.1.md b/contrib/bc/manuals/bc/H.1.md
index 24cae156d4c2..970fc5e584a4 100644
--- a/contrib/bc/manuals/bc/H.1.md
+++ b/contrib/bc/manuals/bc/H.1.md
@@ -1513,7 +1513,7 @@ The extended library is a **non-portable extension**.
**bnot8(x)**
: Does a bitwise not of the truncated absolute value of **x** as though it has
- **8** binary digits (1 unsigned byte).
+ **8** binary digits (**1** unsigned byte).
If you want to a use signed two's complement argument, use **s2u(x)** to
convert.
@@ -1521,7 +1521,7 @@ The extended library is a **non-portable extension**.
**bnot16(x)**
: Does a bitwise not of the truncated absolute value of **x** as though it has
- **16** binary digits (2 unsigned bytes).
+ **16** binary digits (**2** unsigned bytes).
If you want to a use signed two's complement argument, use **s2u(x)** to
convert.
@@ -1529,7 +1529,7 @@ The extended library is a **non-portable extension**.
**bnot32(x)**
: Does a bitwise not of the truncated absolute value of **x** as though it has
- **32** binary digits (4 unsigned bytes).
+ **32** binary digits (**4** unsigned bytes).
If you want to a use signed two's complement argument, use **s2u(x)** to
convert.
@@ -1537,7 +1537,7 @@ The extended library is a **non-portable extension**.
**bnot64(x)**
: Does a bitwise not of the truncated absolute value of **x** as though it has
- **64** binary digits (8 unsigned bytes).
+ **64** binary digits (**8** unsigned bytes).
If you want to a use signed two's complement argument, use **s2u(x)** to
convert.
@@ -1561,7 +1561,7 @@ The extended library is a **non-portable extension**.
**brev8(x)**
: Runs a bit reversal on the truncated absolute value of **x** as though it
- has 8 binary digits (1 unsigned byte).
+ has 8 binary digits (**1** unsigned byte).
If you want to a use signed two's complement argument, use **s2u(x)** to
convert.
@@ -1569,7 +1569,7 @@ The extended library is a **non-portable extension**.
**brev16(x)**
: Runs a bit reversal on the truncated absolute value of **x** as though it
- has 16 binary digits (2 unsigned bytes).
+ has 16 binary digits (**2** unsigned bytes).
If you want to a use signed two's complement argument, use **s2u(x)** to
convert.
@@ -1577,7 +1577,7 @@ The extended library is a **non-portable extension**.
**brev32(x)**
: Runs a bit reversal on the truncated absolute value of **x** as though it
- has 32 binary digits (4 unsigned bytes).
+ has 32 binary digits (**4** unsigned bytes).
If you want to a use signed two's complement argument, use **s2u(x)** to
convert.
@@ -1585,7 +1585,7 @@ The extended library is a **non-portable extension**.
**brev64(x)**
: Runs a bit reversal on the truncated absolute value of **x** as though it
- has 64 binary digits (8 unsigned bytes).
+ has 64 binary digits (**8** unsigned bytes).
If you want to a use signed two's complement argument, use **s2u(x)** to
convert.
@@ -1632,7 +1632,7 @@ The extended library is a **non-portable extension**.
**brol32(x, p)**
: Does a left bitwise rotatation of the truncated absolute value of **x**, as
- though it has **32** binary digits (**2** unsigned bytes), by the number of
+ though it has **32** binary digits (**4** unsigned bytes), by the number of
places equal to the truncated absolute value of **p** modded by **2** to the
power of **32**.
@@ -1642,7 +1642,7 @@ The extended library is a **non-portable extension**.
**brol64(x, p)**
: Does a left bitwise rotatation of the truncated absolute value of **x**, as
- though it has **64** binary digits (**2** unsigned bytes), by the number of
+ though it has **64** binary digits (**8** unsigned bytes), by the number of
places equal to the truncated absolute value of **p** modded by **2** to the
power of **64**.
diff --git a/contrib/bc/manuals/bc/HN.1 b/contrib/bc/manuals/bc/HN.1
index 3f567180a168..3373fd9ac8c6 100644
--- a/contrib/bc/manuals/bc/HN.1
+++ b/contrib/bc/manuals/bc/HN.1
@@ -25,14 +25,12 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.TH "BC" "1" "February 2023" "Gavin D. Howard" "General Commands Manual"
+.TH "BC" "1" "November 2023" "Gavin D. Howard" "General Commands Manual"
.nh
.ad l
.SH NAME
-.PP
bc - arbitrary-precision decimal arithmetic language and calculator
.SH SYNOPSIS
-.PP
\f[B]bc\f[R] [\f[B]-cCghilPqRsvVw\f[R]] [\f[B]--digit-clamp\f[R]]
[\f[B]--no-digit-clamp\f[R]] [\f[B]--global-stacks\f[R]]
[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--mathlib\f[R]]
@@ -48,7 +46,6 @@ bc - arbitrary-precision decimal arithmetic language and calculator
[\f[B]-S\f[R] \f[I]scale\f[R]] [\f[B]--scale\f[R]=\f[I]scale\f[R]]
[\f[B]-E\f[R] \f[I]seed\f[R]] [\f[B]--seed\f[R]=\f[I]seed\f[R]]
.SH DESCRIPTION
-.PP
bc(1) is an interactive processor for a language first standardized in
1991 by POSIX.
(See the \f[B]STANDARDS\f[R] section.)
@@ -77,7 +74,6 @@ If parsing scripts meant for other bc(1) implementations still does not
work, that is a bug and should be reported.
See the \f[B]BUGS\f[R] section.
.SH OPTIONS
-.PP
The following are the options that bc(1) accepts.
.TP
\f[B]-C\f[R], \f[B]--no-digit-clamp\f[R]
@@ -189,19 +185,16 @@ without worrying that the change will affect other functions.
Thus, a hypothetical function named \f[B]output(x,b)\f[R] that simply
printed \f[B]x\f[R] in base \f[B]b\f[R] could be written like this:
.IP
-.nf
-\f[C]
+.EX
define void output(x, b) {
obase=b
x
}
-\f[R]
-.fi
+.EE
.PP
instead of like this:
.IP
-.nf
-\f[C]
+.EX
define void output(x, b) {
auto c
c=obase
@@ -209,8 +202,7 @@ define void output(x, b) {
x
obase=c
}
-\f[R]
-.fi
+.EE
.PP
This makes writing functions much easier.
.PP
@@ -228,12 +220,10 @@ converter, it is possible to replace that capability with various shell
aliases.
Examples:
.IP
-.nf
-\f[C]
+.EX
alias d2o=\[dq]bc -e ibase=A -e obase=8\[dq]
alias h2b=\[dq]bc -e ibase=G -e obase=2\[dq]
-\f[R]
-.fi
+.EE
.PP
Second, if the purpose of a function is to set \f[B]ibase\f[R],
\f[B]obase\f[R], \f[B]scale\f[R], or \f[B]seed\f[R] globally for any
@@ -251,11 +241,9 @@ If a function desires to not affect the sequence of pseudo-random
numbers of its parents, but wants to use the same \f[B]seed\f[R], it can
use the following line:
.IP
-.nf
-\f[C]
+.EX
seed = seed
-\f[R]
-.fi
+.EE
.PP
If the behavior of this option is desired for every run of bc(1), then
users could make sure to define \f[B]BC_ENV_ARGS\f[R] and include this
@@ -485,7 +473,6 @@ This is a \f[B]non-portable extension\f[R].
.PP
All long options are \f[B]non-portable extensions\f[R].
.SH STDIN
-.PP
If no files or expressions are given by the \f[B]-f\f[R],
\f[B]--file\f[R], \f[B]-e\f[R], or \f[B]--expression\f[R] options, then
bc(1) reads from \f[B]stdin\f[R].
@@ -502,7 +489,6 @@ Second, after an \f[B]if\f[R] statement, bc(1) doesn\[cq]t know if an
\f[B]else\f[R] statement will follow, so it will not execute until it
knows there will not be an \f[B]else\f[R] statement.
.SH STDOUT
-.PP
Any non-error output is written to \f[B]stdout\f[R].
In addition, if history (see the \f[B]HISTORY\f[R] section) and the
prompt (see the \f[B]TTY MODE\f[R] section) are enabled, both are output
@@ -511,7 +497,7 @@ to \f[B]stdout\f[R].
\f[B]Note\f[R]: Unlike other bc(1) implementations, this bc(1) will
issue a fatal error (see the \f[B]EXIT STATUS\f[R] section) if it cannot
write to \f[B]stdout\f[R], so if \f[B]stdout\f[R] is closed, as in
-\f[B]bc >&-\f[R], it will quit with an error.
+\f[B]bc >&-\f[R], it will quit with an error.
This is done so that bc(1) can report problems when \f[B]stdout\f[R] is
redirected to a file.
.PP
@@ -519,13 +505,12 @@ If there are scripts that depend on the behavior of other bc(1)
implementations, it is recommended that those scripts be changed to
redirect \f[B]stdout\f[R] to \f[B]/dev/null\f[R].
.SH STDERR
-.PP
Any error output is written to \f[B]stderr\f[R].
.PP
\f[B]Note\f[R]: Unlike other bc(1) implementations, this bc(1) will
issue a fatal error (see the \f[B]EXIT STATUS\f[R] section) if it cannot
write to \f[B]stderr\f[R], so if \f[B]stderr\f[R] is closed, as in
-\f[B]bc 2>&-\f[R], it will quit with an error.
+\f[B]bc 2>&-\f[R], it will quit with an error.
This is done so that bc(1) can exit with an error code when
\f[B]stderr\f[R] is redirected to a file.
.PP
@@ -533,7 +518,6 @@ If there are scripts that depend on the behavior of other bc(1)
implementations, it is recommended that those scripts be changed to
redirect \f[B]stderr\f[R] to \f[B]/dev/null\f[R].
.SH SYNTAX
-.PP
The syntax for bc(1) programs is mostly C-like, with some differences.
This bc(1) follows the POSIX standard (see the \f[B]STANDARDS\f[R]
section), which is a much more thorough resource for the language this
@@ -618,7 +602,6 @@ These are \f[B]non-portable extensions\f[R].
.PP
Either semicolons or newlines may separate statements.
.SS Comments
-.PP
There are two kinds of comments:
.IP "1." 3
Block comments are enclosed in \f[B]/*\f[R] and \f[B]*/\f[R].
@@ -627,7 +610,6 @@ Line comments go from \f[B]#\f[R] until, and not including, the next
newline.
This is a \f[B]non-portable extension\f[R].
.SS Named Expressions
-.PP
The following are named expressions in bc(1):
.IP "1." 3
Variables: \f[B]I\f[R]
@@ -684,7 +666,6 @@ Named expressions are required as the operand of
of \f[B]assignment\f[R] operators (see the \f[I]Operators\f[R]
subsection).
.SS Operands
-.PP
The following are valid operands in bc(1):
.IP " 1." 4
Numbers (see the \f[I]Numbers\f[R] subsection below).
@@ -829,7 +810,6 @@ where a reproducible stream of pseudo-random numbers is
\f[I]ESSENTIAL\f[R].
In any other case, use a non-seeded pseudo-random number generator.
.SS Numbers
-.PP
Numbers are strings made up of digits, uppercase letters, and at most
\f[B]1\f[R] period for a radix.
Numbers can have up to \f[B]BC_NUM_MAX\f[R] digits.
@@ -901,7 +881,6 @@ number string \f[B]FFeA\f[R], the resulting decimal number will be
Accepting input as scientific notation is a \f[B]non-portable
extension\f[R].
.SS Operators
-.PP
The following arithmetic and logical operators can be used.
They are listed in order of decreasing precedence.
Operators in the same group have the same precedence.
@@ -1018,9 +997,9 @@ The operators will be described in more detail below.
.TP
\f[B]++\f[R] \f[B]--\f[R]
The prefix and postfix \f[B]increment\f[R] and \f[B]decrement\f[R]
-operators behave exactly like they would in C.
-They require a named expression (see the \f[I]Named Expressions\f[R]
-subsection) as an operand.
+operators behave exactly like they would in C. They require a named
+expression (see the \f[I]Named Expressions\f[R] subsection) as an
+operand.
.RS
.PP
The prefix versions of these operators are more efficient; use them
@@ -1192,7 +1171,6 @@ This is \f[I]not\f[R] a short-circuit operator.
This is a \f[B]non-portable extension\f[R].
.RE
.SS Statements
-.PP
The following items are statements:
.IP " 1." 4
\f[B]E\f[R]
@@ -1270,11 +1248,9 @@ occur before the \f[B]quit\f[R] statement before exiting.
.PP
In other words, for the bc(1) code below:
.IP
-.nf
-\f[C]
+.EX
for (i = 0; i < 3; ++i) i; quit
-\f[R]
-.fi
+.EE
.PP
Other bc(1) implementations will print nothing, and this bc(1) will
print \f[B]0\f[R], \f[B]1\f[R], and \f[B]2\f[R] on successive lines
@@ -1305,7 +1281,6 @@ run with either the \f[B]-s\f[R] or \f[B]-w\f[R] command-line options
Printing numbers in scientific notation and/or engineering notation is a
\f[B]non-portable extension\f[R].
.SS Strings
-.PP
If strings appear as a statement by themselves, they are printed without
a trailing newline.
.PP
@@ -1324,7 +1299,6 @@ resets (see the \f[B]RESET\f[R] section).
Assigning strings to variables and array elements and passing them to
functions are \f[B]non-portable extensions\f[R].
.SS Print Statement
-.PP
The \[lq]expressions\[rq] in a \f[B]print\f[R] statement may also be
strings.
If they are, there are backslash escape sequences that are interpreted
@@ -1356,7 +1330,6 @@ character to be printed as-is.
Any non-string expression in a print statement shall be assigned to
\f[B]last\f[R], like any other expression that is printed.
.SS Stream Statement
-.PP
The expressions in a \f[B]stream\f[R] statement may also be strings.
.PP
If a \f[B]stream\f[R] statement is given a string, it prints the string
@@ -1370,17 +1343,14 @@ The result is then printed as though \f[B]obase\f[R] is \f[B]256\f[R]
and each digit is interpreted as an 8-bit ASCII character, making it a
byte stream.
.SS Order of Evaluation
-.PP
All expressions in a statment are evaluated left to right, except as
necessary to maintain order of operations.
This means, for example, assuming that \f[B]i\f[R] is equal to
\f[B]0\f[R], in the expression
.IP
-.nf
-\f[C]
+.EX
a[i++] = i++
-\f[R]
-.fi
+.EE
.PP
the first (or 0th) element of \f[B]a\f[R] is set to \f[B]1\f[R], and
\f[B]i\f[R] is equal to \f[B]2\f[R] at the end of the expression.
@@ -1389,28 +1359,23 @@ This includes function arguments.
Thus, assuming \f[B]i\f[R] is equal to \f[B]0\f[R], this means that in
the expression
.IP
-.nf
-\f[C]
+.EX
x(i++, i++)
-\f[R]
-.fi
+.EE
.PP
the first argument passed to \f[B]x()\f[R] is \f[B]0\f[R], and the
second argument is \f[B]1\f[R], while \f[B]i\f[R] is equal to
\f[B]2\f[R] before the function starts executing.
.SH FUNCTIONS
-.PP
Function definitions are as follows:
.IP
-.nf
-\f[C]
+.EX
define I(I,...,I){
auto I,...,I
S;...;S
return(E)
}
-\f[R]
-.fi
+.EE
.PP
Any \f[B]I\f[R] in the parameter list or \f[B]auto\f[R] list may be
replaced with \f[B]I[]\f[R] to make a parameter or \f[B]auto\f[R] var an
@@ -1438,18 +1403,15 @@ equivalent to \f[B]return (0)\f[R], unless the function is a
\f[B]void\f[R] function (see the \f[I]Void Functions\f[R] subsection
below).
.SS Void Functions
-.PP
Functions can also be \f[B]void\f[R] functions, defined as follows:
.IP
-.nf
-\f[C]
+.EX
define void I(I,...,I){
auto I,...,I
S;...;S
return
}
-\f[R]
-.fi
+.EE
.PP
They can only be used as standalone expressions, where such an
expression would be printed alone, except in a print statement.
@@ -1465,15 +1427,12 @@ The word \[lq]void\[rq] is only treated specially right after the
.PP
This is a \f[B]non-portable extension\f[R].
.SS Array References
-.PP
For any array in the parameter list, if the array is declared in the
form
.IP
-.nf
-\f[C]
+.EX
*I[]
-\f[R]
-.fi
+.EE
.PP
it is a \f[B]reference\f[R].
Any changes to the array in the function are reflected, when the
@@ -1483,7 +1442,6 @@ Other than this, all function arguments are passed by value.
.PP
This is a \f[B]non-portable extension\f[R].
.SH LIBRARY
-.PP
All of the functions below, including the functions in the extended math
library (see the \f[I]Extended Library\f[R] subsection below), are
available when the \f[B]-l\f[R] or \f[B]--mathlib\f[R] command-line
@@ -1491,7 +1449,6 @@ flags are given, except that the extended math library is not available
when the \f[B]-s\f[R] option, the \f[B]-w\f[R] option, or equivalents
are given.
.SS Standard Library
-.PP
The standard (see the \f[B]STANDARDS\f[R] section) defines the following
functions for the math library:
.TP
@@ -1544,7 +1501,6 @@ This is a transcendental function (see the \f[I]Transcendental
Functions\f[R] subsection below).
.RE
.SS Extended Library
-.PP
The extended library is \f[I]not\f[R] loaded when the
\f[B]-s\f[R]/\f[B]--standard\f[R] or \f[B]-w\f[R]/\f[B]--warn\f[R]
options are given since they are not part of the library defined by the
@@ -1866,7 +1822,7 @@ If you want to a use signed two\[cq]s complement argument, use
.TP
\f[B]bnot8(x)\f[R]
Does a bitwise not of the truncated absolute value of \f[B]x\f[R] as
-though it has \f[B]8\f[R] binary digits (1 unsigned byte).
+though it has \f[B]8\f[R] binary digits (\f[B]1\f[R] unsigned byte).
.RS
.PP
If you want to a use signed two\[cq]s complement argument, use
@@ -1875,7 +1831,7 @@ If you want to a use signed two\[cq]s complement argument, use
.TP
\f[B]bnot16(x)\f[R]
Does a bitwise not of the truncated absolute value of \f[B]x\f[R] as
-though it has \f[B]16\f[R] binary digits (2 unsigned bytes).
+though it has \f[B]16\f[R] binary digits (\f[B]2\f[R] unsigned bytes).
.RS
.PP
If you want to a use signed two\[cq]s complement argument, use
@@ -1884,7 +1840,7 @@ If you want to a use signed two\[cq]s complement argument, use
.TP
\f[B]bnot32(x)\f[R]
Does a bitwise not of the truncated absolute value of \f[B]x\f[R] as
-though it has \f[B]32\f[R] binary digits (4 unsigned bytes).
+though it has \f[B]32\f[R] binary digits (\f[B]4\f[R] unsigned bytes).
.RS
.PP
If you want to a use signed two\[cq]s complement argument, use
@@ -1893,7 +1849,7 @@ If you want to a use signed two\[cq]s complement argument, use
.TP
\f[B]bnot64(x)\f[R]
Does a bitwise not of the truncated absolute value of \f[B]x\f[R] as
-though it has \f[B]64\f[R] binary digits (8 unsigned bytes).
+though it has \f[B]64\f[R] binary digits (\f[B]8\f[R] unsigned bytes).
.RS
.PP
If you want to a use signed two\[cq]s complement argument, use
@@ -1921,7 +1877,7 @@ If you want to a use signed two\[cq]s complement argument, use
.TP
\f[B]brev8(x)\f[R]
Runs a bit reversal on the truncated absolute value of \f[B]x\f[R] as
-though it has 8 binary digits (1 unsigned byte).
+though it has 8 binary digits (\f[B]1\f[R] unsigned byte).
.RS
.PP
If you want to a use signed two\[cq]s complement argument, use
@@ -1930,7 +1886,7 @@ If you want to a use signed two\[cq]s complement argument, use
.TP
\f[B]brev16(x)\f[R]
Runs a bit reversal on the truncated absolute value of \f[B]x\f[R] as
-though it has 16 binary digits (2 unsigned bytes).
+though it has 16 binary digits (\f[B]2\f[R] unsigned bytes).
.RS
.PP
If you want to a use signed two\[cq]s complement argument, use
@@ -1939,7 +1895,7 @@ If you want to a use signed two\[cq]s complement argument, use
.TP
\f[B]brev32(x)\f[R]
Runs a bit reversal on the truncated absolute value of \f[B]x\f[R] as
-though it has 32 binary digits (4 unsigned bytes).
+though it has 32 binary digits (\f[B]4\f[R] unsigned bytes).
.RS
.PP
If you want to a use signed two\[cq]s complement argument, use
@@ -1948,7 +1904,7 @@ If you want to a use signed two\[cq]s complement argument, use
.TP
\f[B]brev64(x)\f[R]
Runs a bit reversal on the truncated absolute value of \f[B]x\f[R] as
-though it has 64 binary digits (8 unsigned bytes).
+though it has 64 binary digits (\f[B]8\f[R] unsigned bytes).
.RS
.PP
If you want to a use signed two\[cq]s complement argument, use
@@ -2001,7 +1957,7 @@ If you want to a use signed two\[cq]s complement argument, use
.TP
\f[B]brol32(x, p)\f[R]
Does a left bitwise rotatation of the truncated absolute value of
-\f[B]x\f[R], as though it has \f[B]32\f[R] binary digits (\f[B]2\f[R]
+\f[B]x\f[R], as though it has \f[B]32\f[R] binary digits (\f[B]4\f[R]
unsigned bytes), by the number of places equal to the truncated absolute
value of \f[B]p\f[R] modded by \f[B]2\f[R] to the power of \f[B]32\f[R].
.RS
@@ -2012,7 +1968,7 @@ If you want to a use signed two\[cq]s complement argument, use
.TP
\f[B]brol64(x, p)\f[R]
Does a left bitwise rotatation of the truncated absolute value of
-\f[B]x\f[R], as though it has \f[B]64\f[R] binary digits (\f[B]2\f[R]
+\f[B]x\f[R], as though it has \f[B]64\f[R] binary digits (\f[B]8\f[R]
unsigned bytes), by the number of places equal to the truncated absolute
value of \f[B]p\f[R] modded by \f[B]2\f[R] to the power of \f[B]64\f[R].
.RS
@@ -2457,7 +2413,6 @@ This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
subsection of the \f[B]FUNCTIONS\f[R] section).
.RE
.SS Transcendental Functions
-.PP
All transcendental functions can return slightly inaccurate results, up
to 1 ULP (https://en.wikipedia.org/wiki/Unit_in_the_last_place).
This is unavoidable, and the article at
@@ -2513,7 +2468,6 @@ The transcendental functions in the extended math library are:
.IP \[bu] 2
\f[B]d2r(x)\f[R]
.SH RESET
-.PP
When bc(1) encounters an error or a signal that it has a non-default
handler for, it resets.
This means that several things happen.
@@ -2534,7 +2488,6 @@ Note that this reset behavior is different from the GNU bc(1), which
attempts to start executing the statement right after the one that
caused an error.
.SH PERFORMANCE
-.PP
Most bc(1) implementations use \f[B]char\f[R] types to calculate the
value of \f[B]1\f[R] decimal digit at a time, but that can be slow.
This bc(1) does something different.
@@ -2557,7 +2510,6 @@ checking.
This integer type depends on the value of \f[B]BC_LONG_BIT\f[R], but is
always at least twice as large as the integer type used to store digits.
.SH LIMITS
-.PP
The following are the limits on bc(1):
.TP
\f[B]BC_LONG_BIT\f[R]
@@ -2626,7 +2578,6 @@ large (at least on 64-bit machines) that there should not be any point
at which they become a problem.
In fact, memory should be exhausted before these limits should be hit.
.SH ENVIRONMENT VARIABLES
-.PP
As \f[B]non-portable extensions\f[R], bc(1) recognizes the following
environment variables:
.TP
@@ -2765,7 +2716,6 @@ This environment variable overrides the default, which can be queried
with the \f[B]-h\f[R] or \f[B]--help\f[R] options.
.RE
.SH EXIT STATUS
-.PP
bc(1) returns the following exit statuses:
.TP
\f[B]0\f[R]
@@ -2844,7 +2794,6 @@ These exit statuses allow bc(1) to be used in shell scripting with error
checking, and its normal behavior can be forced by using the
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.SH INTERACTIVE MODE
-.PP
Per the standard (see the \f[B]STANDARDS\f[R] section), bc(1) has an
interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both \f[B]stdin\f[R]
@@ -2858,7 +2807,6 @@ bc(1) may also reset on \f[B]SIGINT\f[R] instead of exit, depending on
the contents of, or default for, the \f[B]BC_SIGINT_RESET\f[R]
environment variable (see the \f[B]ENVIRONMENT VARIABLES\f[R] section).
.SH TTY MODE
-.PP
If \f[B]stdin\f[R], \f[B]stdout\f[R], and \f[B]stderr\f[R] are all
connected to a TTY, then \[lq]TTY mode\[rq] is considered to be
available, and thus, bc(1) can turn on TTY mode, subject to some
@@ -2882,7 +2830,6 @@ required in the bc(1) standard (see the \f[B]STANDARDS\f[R] section),
and interactive mode requires only \f[B]stdin\f[R] and \f[B]stdout\f[R]
to be connected to a terminal.
.SS Prompt
-.PP
If TTY mode is available, then a prompt can be enabled.
Like TTY mode itself, it can be turned on or off with an environment
variable: \f[B]BC_PROMPT\f[R] (see the \f[B]ENVIRONMENT VARIABLES\f[R]
@@ -2903,7 +2850,6 @@ and \f[B]--no-read-prompt\f[R] options.
See the \f[B]ENVIRONMENT VARIABLES\f[R] and \f[B]OPTIONS\f[R] sections
for more details.
.SH SIGNAL HANDLING
-.PP
Sending a \f[B]SIGINT\f[R] will cause bc(1) to do one of two things.
.PP
If bc(1) is not in interactive mode (see the \f[B]INTERACTIVE MODE\f[R]
@@ -2935,10 +2881,8 @@ the user to continue.
\f[B]SIGTERM\f[R] and \f[B]SIGQUIT\f[R] cause bc(1) to clean up and
exit, and it uses the default handler for all other signals.
.SH SEE ALSO
-.PP
dc(1)
.SH STANDARDS
-.PP
bc(1) is compliant with the IEEE Std 1003.1-2017
(\[lq]POSIX.1-2017\[rq]) specification at
https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html .
@@ -2955,13 +2899,13 @@ Note that the specification explicitly says that bc(1) only accepts
numbers that use a period (\f[B].\f[R]) as a radix point, regardless of
the value of \f[B]LC_NUMERIC\f[R].
.SH BUGS
-.PP
Before version \f[B]6.1.0\f[R], this bc(1) had incorrect behavior for
the \f[B]quit\f[R] statement.
.PP
No other bugs are known.
Report bugs at https://git.gavinhoward.com/gavin/bc .
.SH AUTHORS
-.PP
-Gavin D.
-Howard <gavin@gavinhoward.com> and contributors.
+Gavin D. Howard \c
+.MT gavin@gavinhoward.com
+.ME \c
+\ and contributors.
diff --git a/contrib/bc/manuals/bc/HN.1.md b/contrib/bc/manuals/bc/HN.1.md
index 09ea524d95c2..2b3b0d6aa3eb 100644
--- a/contrib/bc/manuals/bc/HN.1.md
+++ b/contrib/bc/manuals/bc/HN.1.md
@@ -1513,7 +1513,7 @@ The extended library is a **non-portable extension**.
**bnot8(x)**
: Does a bitwise not of the truncated absolute value of **x** as though it has
- **8** binary digits (1 unsigned byte).
+ **8** binary digits (**1** unsigned byte).
If you want to a use signed two's complement argument, use **s2u(x)** to
convert.
@@ -1521,7 +1521,7 @@ The extended library is a **non-portable extension**.
**bnot16(x)**
: Does a bitwise not of the truncated absolute value of **x** as though it has
- **16** binary digits (2 unsigned bytes).
+ **16** binary digits (**2** unsigned bytes).
If you want to a use signed two's complement argument, use **s2u(x)** to
convert.
@@ -1529,7 +1529,7 @@ The extended library is a **non-portable extension**.
**bnot32(x)**
: Does a bitwise not of the truncated absolute value of **x** as though it has
- **32** binary digits (4 unsigned bytes).
+ **32** binary digits (**4** unsigned bytes).
If you want to a use signed two's complement argument, use **s2u(x)** to
convert.
@@ -1537,7 +1537,7 @@ The extended library is a **non-portable extension**.
**bnot64(x)**
: Does a bitwise not of the truncated absolute value of **x** as though it has
- **64** binary digits (8 unsigned bytes).
+ **64** binary digits (**8** unsigned bytes).
If you want to a use signed two's complement argument, use **s2u(x)** to
convert.
@@ -1561,7 +1561,7 @@ The extended library is a **non-portable extension**.
**brev8(x)**
: Runs a bit reversal on the truncated absolute value of **x** as though it
- has 8 binary digits (1 unsigned byte).
+ has 8 binary digits (**1** unsigned byte).
If you want to a use signed two's complement argument, use **s2u(x)** to
convert.
@@ -1569,7 +1569,7 @@ The extended library is a **non-portable extension**.
**brev16(x)**
: Runs a bit reversal on the truncated absolute value of **x** as though it
- has 16 binary digits (2 unsigned bytes).
+ has 16 binary digits (**2** unsigned bytes).
If you want to a use signed two's complement argument, use **s2u(x)** to
convert.
@@ -1577,7 +1577,7 @@ The extended library is a **non-portable extension**.
**brev32(x)**
: Runs a bit reversal on the truncated absolute value of **x** as though it
- has 32 binary digits (4 unsigned bytes).
+ has 32 binary digits (**4** unsigned bytes).
If you want to a use signed two's complement argument, use **s2u(x)** to
convert.
@@ -1585,7 +1585,7 @@ The extended library is a **non-portable extension**.
**brev64(x)**
: Runs a bit reversal on the truncated absolute value of **x** as though it
- has 64 binary digits (8 unsigned bytes).
+ has 64 binary digits (**8** unsigned bytes).
If you want to a use signed two's complement argument, use **s2u(x)** to
convert.
@@ -1632,7 +1632,7 @@ The extended library is a **non-portable extension**.
**brol32(x, p)**
: Does a left bitwise rotatation of the truncated absolute value of **x**, as
- though it has **32** binary digits (**2** unsigned bytes), by the number of
+ though it has **32** binary digits (**4** unsigned bytes), by the number of
places equal to the truncated absolute value of **p** modded by **2** to the
power of **32**.
@@ -1642,7 +1642,7 @@ The extended library is a **non-portable extension**.
**brol64(x, p)**
: Does a left bitwise rotatation of the truncated absolute value of **x**, as
- though it has **64** binary digits (**2** unsigned bytes), by the number of
+ though it has **64** binary digits (**8** unsigned bytes), by the number of
places equal to the truncated absolute value of **p** modded by **2** to the
power of **64**.
diff --git a/contrib/bc/manuals/bc/N.1 b/contrib/bc/manuals/bc/N.1
index 79e053ec41fa..7628c50cb4fb 100644
--- a/contrib/bc/manuals/bc/N.1
+++ b/contrib/bc/manuals/bc/N.1
@@ -25,14 +25,12 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.TH "BC" "1" "February 2023" "Gavin D. Howard" "General Commands Manual"
+.TH "BC" "1" "November 2023" "Gavin D. Howard" "General Commands Manual"
.nh
.ad l
.SH NAME
-.PP
bc - arbitrary-precision decimal arithmetic language and calculator
.SH SYNOPSIS
-.PP
\f[B]bc\f[R] [\f[B]-cCghilPqRsvVw\f[R]] [\f[B]--digit-clamp\f[R]]
[\f[B]--no-digit-clamp\f[R]] [\f[B]--global-stacks\f[R]]
[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--mathlib\f[R]]
@@ -48,7 +46,6 @@ bc - arbitrary-precision decimal arithmetic language and calculator
[\f[B]-S\f[R] \f[I]scale\f[R]] [\f[B]--scale\f[R]=\f[I]scale\f[R]]
[\f[B]-E\f[R] \f[I]seed\f[R]] [\f[B]--seed\f[R]=\f[I]seed\f[R]]
.SH DESCRIPTION
-.PP
bc(1) is an interactive processor for a language first standardized in
1991 by POSIX.
(See the \f[B]STANDARDS\f[R] section.)
@@ -77,7 +74,6 @@ If parsing scripts meant for other bc(1) implementations still does not
work, that is a bug and should be reported.
See the \f[B]BUGS\f[R] section.
.SH OPTIONS
-.PP
The following are the options that bc(1) accepts.
.TP
\f[B]-C\f[R], \f[B]--no-digit-clamp\f[R]
@@ -189,19 +185,16 @@ without worrying that the change will affect other functions.
Thus, a hypothetical function named \f[B]output(x,b)\f[R] that simply
printed \f[B]x\f[R] in base \f[B]b\f[R] could be written like this:
.IP
-.nf
-\f[C]
+.EX
define void output(x, b) {
obase=b
x
}
-\f[R]
-.fi
+.EE
.PP
instead of like this:
.IP
-.nf
-\f[C]
+.EX
define void output(x, b) {
auto c
c=obase
@@ -209,8 +202,7 @@ define void output(x, b) {
x
obase=c
}
-\f[R]
-.fi
+.EE
.PP
This makes writing functions much easier.
.PP
@@ -228,12 +220,10 @@ converter, it is possible to replace that capability with various shell
aliases.
Examples:
.IP
-.nf
-\f[C]
+.EX
alias d2o=\[dq]bc -e ibase=A -e obase=8\[dq]
alias h2b=\[dq]bc -e ibase=G -e obase=2\[dq]
-\f[R]
-.fi
+.EE
.PP
Second, if the purpose of a function is to set \f[B]ibase\f[R],
\f[B]obase\f[R], \f[B]scale\f[R], or \f[B]seed\f[R] globally for any
@@ -251,11 +241,9 @@ If a function desires to not affect the sequence of pseudo-random
numbers of its parents, but wants to use the same \f[B]seed\f[R], it can
use the following line:
.IP
-.nf
-\f[C]
+.EX
seed = seed
-\f[R]
-.fi
+.EE
.PP
If the behavior of this option is desired for every run of bc(1), then
users could make sure to define \f[B]BC_ENV_ARGS\f[R] and include this
@@ -485,7 +473,6 @@ This is a \f[B]non-portable extension\f[R].
.PP
All long options are \f[B]non-portable extensions\f[R].
.SH STDIN
-.PP
If no files or expressions are given by the \f[B]-f\f[R],
\f[B]--file\f[R], \f[B]-e\f[R], or \f[B]--expression\f[R] options, then
bc(1) reads from \f[B]stdin\f[R].
@@ -502,7 +489,6 @@ Second, after an \f[B]if\f[R] statement, bc(1) doesn\[cq]t know if an
\f[B]else\f[R] statement will follow, so it will not execute until it
knows there will not be an \f[B]else\f[R] statement.
.SH STDOUT
-.PP
Any non-error output is written to \f[B]stdout\f[R].
In addition, if history (see the \f[B]HISTORY\f[R] section) and the
prompt (see the \f[B]TTY MODE\f[R] section) are enabled, both are output
@@ -511,7 +497,7 @@ to \f[B]stdout\f[R].
\f[B]Note\f[R]: Unlike other bc(1) implementations, this bc(1) will
issue a fatal error (see the \f[B]EXIT STATUS\f[R] section) if it cannot
write to \f[B]stdout\f[R], so if \f[B]stdout\f[R] is closed, as in
-\f[B]bc >&-\f[R], it will quit with an error.
+\f[B]bc >&-\f[R], it will quit with an error.
This is done so that bc(1) can report problems when \f[B]stdout\f[R] is
redirected to a file.
.PP
@@ -519,13 +505,12 @@ If there are scripts that depend on the behavior of other bc(1)
implementations, it is recommended that those scripts be changed to
redirect \f[B]stdout\f[R] to \f[B]/dev/null\f[R].
.SH STDERR
-.PP
Any error output is written to \f[B]stderr\f[R].
.PP
\f[B]Note\f[R]: Unlike other bc(1) implementations, this bc(1) will
issue a fatal error (see the \f[B]EXIT STATUS\f[R] section) if it cannot
write to \f[B]stderr\f[R], so if \f[B]stderr\f[R] is closed, as in
-\f[B]bc 2>&-\f[R], it will quit with an error.
+\f[B]bc 2>&-\f[R], it will quit with an error.
This is done so that bc(1) can exit with an error code when
\f[B]stderr\f[R] is redirected to a file.
.PP
@@ -533,7 +518,6 @@ If there are scripts that depend on the behavior of other bc(1)
implementations, it is recommended that those scripts be changed to
redirect \f[B]stderr\f[R] to \f[B]/dev/null\f[R].
.SH SYNTAX
-.PP
The syntax for bc(1) programs is mostly C-like, with some differences.
This bc(1) follows the POSIX standard (see the \f[B]STANDARDS\f[R]
section), which is a much more thorough resource for the language this
@@ -618,7 +602,6 @@ These are \f[B]non-portable extensions\f[R].
.PP
Either semicolons or newlines may separate statements.
.SS Comments
-.PP
There are two kinds of comments:
.IP "1." 3
Block comments are enclosed in \f[B]/*\f[R] and \f[B]*/\f[R].
@@ -627,7 +610,6 @@ Line comments go from \f[B]#\f[R] until, and not including, the next
newline.
This is a \f[B]non-portable extension\f[R].
.SS Named Expressions
-.PP
The following are named expressions in bc(1):
.IP "1." 3
Variables: \f[B]I\f[R]
@@ -684,7 +666,6 @@ Named expressions are required as the operand of
of \f[B]assignment\f[R] operators (see the \f[I]Operators\f[R]
subsection).
.SS Operands
-.PP
The following are valid operands in bc(1):
.IP " 1." 4
Numbers (see the \f[I]Numbers\f[R] subsection below).
@@ -829,7 +810,6 @@ where a reproducible stream of pseudo-random numbers is
\f[I]ESSENTIAL\f[R].
In any other case, use a non-seeded pseudo-random number generator.
.SS Numbers
-.PP
Numbers are strings made up of digits, uppercase letters, and at most
\f[B]1\f[R] period for a radix.
Numbers can have up to \f[B]BC_NUM_MAX\f[R] digits.
@@ -901,7 +881,6 @@ number string \f[B]FFeA\f[R], the resulting decimal number will be
Accepting input as scientific notation is a \f[B]non-portable
extension\f[R].
.SS Operators
-.PP
The following arithmetic and logical operators can be used.
They are listed in order of decreasing precedence.
Operators in the same group have the same precedence.
@@ -1018,9 +997,9 @@ The operators will be described in more detail below.
.TP
\f[B]++\f[R] \f[B]--\f[R]
The prefix and postfix \f[B]increment\f[R] and \f[B]decrement\f[R]
-operators behave exactly like they would in C.
-They require a named expression (see the \f[I]Named Expressions\f[R]
-subsection) as an operand.
+operators behave exactly like they would in C. They require a named
+expression (see the \f[I]Named Expressions\f[R] subsection) as an
+operand.
.RS
.PP
The prefix versions of these operators are more efficient; use them
@@ -1192,7 +1171,6 @@ This is \f[I]not\f[R] a short-circuit operator.
This is a \f[B]non-portable extension\f[R].
.RE
.SS Statements
-.PP
The following items are statements:
.IP " 1." 4
\f[B]E\f[R]
@@ -1270,11 +1248,9 @@ occur before the \f[B]quit\f[R] statement before exiting.
.PP
In other words, for the bc(1) code below:
.IP
-.nf
-\f[C]
+.EX
for (i = 0; i < 3; ++i) i; quit
-\f[R]
-.fi
+.EE
.PP
Other bc(1) implementations will print nothing, and this bc(1) will
print \f[B]0\f[R], \f[B]1\f[R], and \f[B]2\f[R] on successive lines
@@ -1305,7 +1281,6 @@ run with either the \f[B]-s\f[R] or \f[B]-w\f[R] command-line options
Printing numbers in scientific notation and/or engineering notation is a
\f[B]non-portable extension\f[R].
.SS Strings
-.PP
If strings appear as a statement by themselves, they are printed without
a trailing newline.
.PP
@@ -1324,7 +1299,6 @@ resets (see the \f[B]RESET\f[R] section).
Assigning strings to variables and array elements and passing them to
functions are \f[B]non-portable extensions\f[R].
.SS Print Statement
-.PP
The \[lq]expressions\[rq] in a \f[B]print\f[R] statement may also be
strings.
If they are, there are backslash escape sequences that are interpreted
@@ -1356,7 +1330,6 @@ character to be printed as-is.
Any non-string expression in a print statement shall be assigned to
\f[B]last\f[R], like any other expression that is printed.
.SS Stream Statement
-.PP
The expressions in a \f[B]stream\f[R] statement may also be strings.
.PP
If a \f[B]stream\f[R] statement is given a string, it prints the string
@@ -1370,17 +1343,14 @@ The result is then printed as though \f[B]obase\f[R] is \f[B]256\f[R]
and each digit is interpreted as an 8-bit ASCII character, making it a
byte stream.
.SS Order of Evaluation
-.PP
All expressions in a statment are evaluated left to right, except as
necessary to maintain order of operations.
This means, for example, assuming that \f[B]i\f[R] is equal to
\f[B]0\f[R], in the expression
.IP
-.nf
-\f[C]
+.EX
a[i++] = i++
-\f[R]
-.fi
+.EE
.PP
the first (or 0th) element of \f[B]a\f[R] is set to \f[B]1\f[R], and
\f[B]i\f[R] is equal to \f[B]2\f[R] at the end of the expression.
@@ -1389,28 +1359,23 @@ This includes function arguments.
Thus, assuming \f[B]i\f[R] is equal to \f[B]0\f[R], this means that in
the expression
.IP
-.nf
-\f[C]
+.EX
x(i++, i++)
-\f[R]
-.fi
+.EE
.PP
the first argument passed to \f[B]x()\f[R] is \f[B]0\f[R], and the
second argument is \f[B]1\f[R], while \f[B]i\f[R] is equal to
\f[B]2\f[R] before the function starts executing.
.SH FUNCTIONS
-.PP
Function definitions are as follows:
.IP
-.nf
-\f[C]
+.EX
define I(I,...,I){
auto I,...,I
S;...;S
return(E)
}
-\f[R]
-.fi
+.EE
.PP
Any \f[B]I\f[R] in the parameter list or \f[B]auto\f[R] list may be
replaced with \f[B]I[]\f[R] to make a parameter or \f[B]auto\f[R] var an
@@ -1438,18 +1403,15 @@ equivalent to \f[B]return (0)\f[R], unless the function is a
\f[B]void\f[R] function (see the \f[I]Void Functions\f[R] subsection
below).
.SS Void Functions
-.PP
Functions can also be \f[B]void\f[R] functions, defined as follows:
.IP
-.nf
-\f[C]
+.EX
define void I(I,...,I){
auto I,...,I
S;...;S
return
}
-\f[R]
-.fi
+.EE
.PP
They can only be used as standalone expressions, where such an
expression would be printed alone, except in a print statement.
@@ -1465,15 +1427,12 @@ The word \[lq]void\[rq] is only treated specially right after the
.PP
This is a \f[B]non-portable extension\f[R].
.SS Array References
-.PP
For any array in the parameter list, if the array is declared in the
form
.IP
-.nf
-\f[C]
+.EX
*I[]
-\f[R]
-.fi
+.EE
.PP
it is a \f[B]reference\f[R].
Any changes to the array in the function are reflected, when the
@@ -1483,7 +1442,6 @@ Other than this, all function arguments are passed by value.
.PP
This is a \f[B]non-portable extension\f[R].
.SH LIBRARY
-.PP
All of the functions below, including the functions in the extended math
library (see the \f[I]Extended Library\f[R] subsection below), are
available when the \f[B]-l\f[R] or \f[B]--mathlib\f[R] command-line
@@ -1491,7 +1449,6 @@ flags are given, except that the extended math library is not available
when the \f[B]-s\f[R] option, the \f[B]-w\f[R] option, or equivalents
are given.
.SS Standard Library
-.PP
The standard (see the \f[B]STANDARDS\f[R] section) defines the following
functions for the math library:
.TP
@@ -1544,7 +1501,6 @@ This is a transcendental function (see the \f[I]Transcendental
Functions\f[R] subsection below).
.RE
.SS Extended Library
-.PP
The extended library is \f[I]not\f[R] loaded when the
\f[B]-s\f[R]/\f[B]--standard\f[R] or \f[B]-w\f[R]/\f[B]--warn\f[R]
options are given since they are not part of the library defined by the
@@ -1866,7 +1822,7 @@ If you want to a use signed two\[cq]s complement argument, use
.TP
\f[B]bnot8(x)\f[R]
Does a bitwise not of the truncated absolute value of \f[B]x\f[R] as
-though it has \f[B]8\f[R] binary digits (1 unsigned byte).
+though it has \f[B]8\f[R] binary digits (\f[B]1\f[R] unsigned byte).
.RS
.PP
If you want to a use signed two\[cq]s complement argument, use
@@ -1875,7 +1831,7 @@ If you want to a use signed two\[cq]s complement argument, use
.TP
\f[B]bnot16(x)\f[R]
Does a bitwise not of the truncated absolute value of \f[B]x\f[R] as
-though it has \f[B]16\f[R] binary digits (2 unsigned bytes).
+though it has \f[B]16\f[R] binary digits (\f[B]2\f[R] unsigned bytes).
.RS
.PP
If you want to a use signed two\[cq]s complement argument, use
@@ -1884,7 +1840,7 @@ If you want to a use signed two\[cq]s complement argument, use
.TP
\f[B]bnot32(x)\f[R]
Does a bitwise not of the truncated absolute value of \f[B]x\f[R] as
-though it has \f[B]32\f[R] binary digits (4 unsigned bytes).
+though it has \f[B]32\f[R] binary digits (\f[B]4\f[R] unsigned bytes).
.RS
.PP
If you want to a use signed two\[cq]s complement argument, use
@@ -1893,7 +1849,7 @@ If you want to a use signed two\[cq]s complement argument, use
.TP
\f[B]bnot64(x)\f[R]
Does a bitwise not of the truncated absolute value of \f[B]x\f[R] as
-though it has \f[B]64\f[R] binary digits (8 unsigned bytes).
+though it has \f[B]64\f[R] binary digits (\f[B]8\f[R] unsigned bytes).
.RS
.PP
If you want to a use signed two\[cq]s complement argument, use
@@ -1921,7 +1877,7 @@ If you want to a use signed two\[cq]s complement argument, use
.TP
\f[B]brev8(x)\f[R]
Runs a bit reversal on the truncated absolute value of \f[B]x\f[R] as
-though it has 8 binary digits (1 unsigned byte).
+though it has 8 binary digits (\f[B]1\f[R] unsigned byte).
.RS
.PP
If you want to a use signed two\[cq]s complement argument, use
@@ -1930,7 +1886,7 @@ If you want to a use signed two\[cq]s complement argument, use
.TP
\f[B]brev16(x)\f[R]
Runs a bit reversal on the truncated absolute value of \f[B]x\f[R] as
-though it has 16 binary digits (2 unsigned bytes).
+though it has 16 binary digits (\f[B]2\f[R] unsigned bytes).
.RS
.PP
If you want to a use signed two\[cq]s complement argument, use
@@ -1939,7 +1895,7 @@ If you want to a use signed two\[cq]s complement argument, use
.TP
\f[B]brev32(x)\f[R]
Runs a bit reversal on the truncated absolute value of \f[B]x\f[R] as
-though it has 32 binary digits (4 unsigned bytes).
+though it has 32 binary digits (\f[B]4\f[R] unsigned bytes).
.RS
.PP
If you want to a use signed two\[cq]s complement argument, use
@@ -1948,7 +1904,7 @@ If you want to a use signed two\[cq]s complement argument, use
.TP
\f[B]brev64(x)\f[R]
Runs a bit reversal on the truncated absolute value of \f[B]x\f[R] as
-though it has 64 binary digits (8 unsigned bytes).
+though it has 64 binary digits (\f[B]8\f[R] unsigned bytes).
.RS
.PP
If you want to a use signed two\[cq]s complement argument, use
@@ -2001,7 +1957,7 @@ If you want to a use signed two\[cq]s complement argument, use
.TP
\f[B]brol32(x, p)\f[R]
Does a left bitwise rotatation of the truncated absolute value of
-\f[B]x\f[R], as though it has \f[B]32\f[R] binary digits (\f[B]2\f[R]
+\f[B]x\f[R], as though it has \f[B]32\f[R] binary digits (\f[B]4\f[R]
unsigned bytes), by the number of places equal to the truncated absolute
value of \f[B]p\f[R] modded by \f[B]2\f[R] to the power of \f[B]32\f[R].
.RS
@@ -2012,7 +1968,7 @@ If you want to a use signed two\[cq]s complement argument, use
.TP
\f[B]brol64(x, p)\f[R]
Does a left bitwise rotatation of the truncated absolute value of
-\f[B]x\f[R], as though it has \f[B]64\f[R] binary digits (\f[B]2\f[R]
+\f[B]x\f[R], as though it has \f[B]64\f[R] binary digits (\f[B]8\f[R]
unsigned bytes), by the number of places equal to the truncated absolute
value of \f[B]p\f[R] modded by \f[B]2\f[R] to the power of \f[B]64\f[R].
.RS
@@ -2457,7 +2413,6 @@ This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
subsection of the \f[B]FUNCTIONS\f[R] section).
.RE
.SS Transcendental Functions
-.PP
All transcendental functions can return slightly inaccurate results, up
to 1 ULP (https://en.wikipedia.org/wiki/Unit_in_the_last_place).
This is unavoidable, and the article at
@@ -2513,7 +2468,6 @@ The transcendental functions in the extended math library are:
.IP \[bu] 2
\f[B]d2r(x)\f[R]
.SH RESET
-.PP
When bc(1) encounters an error or a signal that it has a non-default
handler for, it resets.
This means that several things happen.
@@ -2534,7 +2488,6 @@ Note that this reset behavior is different from the GNU bc(1), which
attempts to start executing the statement right after the one that
caused an error.
.SH PERFORMANCE
-.PP
Most bc(1) implementations use \f[B]char\f[R] types to calculate the
value of \f[B]1\f[R] decimal digit at a time, but that can be slow.
This bc(1) does something different.
@@ -2557,7 +2510,6 @@ checking.
This integer type depends on the value of \f[B]BC_LONG_BIT\f[R], but is
always at least twice as large as the integer type used to store digits.
.SH LIMITS
-.PP
The following are the limits on bc(1):
.TP
\f[B]BC_LONG_BIT\f[R]
@@ -2626,7 +2578,6 @@ large (at least on 64-bit machines) that there should not be any point
at which they become a problem.
In fact, memory should be exhausted before these limits should be hit.
.SH ENVIRONMENT VARIABLES
-.PP
As \f[B]non-portable extensions\f[R], bc(1) recognizes the following
environment variables:
.TP
@@ -2765,7 +2716,6 @@ This environment variable overrides the default, which can be queried
with the \f[B]-h\f[R] or \f[B]--help\f[R] options.
.RE
.SH EXIT STATUS
-.PP
bc(1) returns the following exit statuses:
.TP
\f[B]0\f[R]
@@ -2844,7 +2794,6 @@ These exit statuses allow bc(1) to be used in shell scripting with error
checking, and its normal behavior can be forced by using the
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.SH INTERACTIVE MODE
-.PP
Per the standard (see the \f[B]STANDARDS\f[R] section), bc(1) has an
interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both \f[B]stdin\f[R]
@@ -2858,7 +2807,6 @@ bc(1) may also reset on \f[B]SIGINT\f[R] instead of exit, depending on
the contents of, or default for, the \f[B]BC_SIGINT_RESET\f[R]
environment variable (see the \f[B]ENVIRONMENT VARIABLES\f[R] section).
.SH TTY MODE
-.PP
If \f[B]stdin\f[R], \f[B]stdout\f[R], and \f[B]stderr\f[R] are all
connected to a TTY, then \[lq]TTY mode\[rq] is considered to be
available, and thus, bc(1) can turn on TTY mode, subject to some
@@ -2882,7 +2830,6 @@ required in the bc(1) standard (see the \f[B]STANDARDS\f[R] section),
and interactive mode requires only \f[B]stdin\f[R] and \f[B]stdout\f[R]
to be connected to a terminal.
.SS Command-Line History
-.PP
Command-line history is only enabled if TTY mode is, i.e., that
\f[B]stdin\f[R], \f[B]stdout\f[R], and \f[B]stderr\f[R] are connected to
a TTY and the \f[B]BC_TTY_MODE\f[R] environment variable (see the
@@ -2890,7 +2837,6 @@ a TTY and the \f[B]BC_TTY_MODE\f[R] environment variable (see the
TTY mode.
See the \f[B]COMMAND LINE HISTORY\f[R] section for more information.
.SS Prompt
-.PP
If TTY mode is available, then a prompt can be enabled.
Like TTY mode itself, it can be turned on or off with an environment
variable: \f[B]BC_PROMPT\f[R] (see the \f[B]ENVIRONMENT VARIABLES\f[R]
@@ -2911,7 +2857,6 @@ and \f[B]--no-read-prompt\f[R] options.
See the \f[B]ENVIRONMENT VARIABLES\f[R] and \f[B]OPTIONS\f[R] sections
for more details.
.SH SIGNAL HANDLING
-.PP
Sending a \f[B]SIGINT\f[R] will cause bc(1) to do one of two things.
.PP
If bc(1) is not in interactive mode (see the \f[B]INTERACTIVE MODE\f[R]
@@ -2946,7 +2891,6 @@ The one exception is \f[B]SIGHUP\f[R]; in that case, and only when bc(1)
is in TTY mode (see the \f[B]TTY MODE\f[R] section), a \f[B]SIGHUP\f[R]
will cause bc(1) to clean up and exit.
.SH COMMAND LINE HISTORY
-.PP
bc(1) supports interactive command-line editing.
.PP
If bc(1) can be in TTY mode (see the \f[B]TTY MODE\f[R] section),
@@ -2964,10 +2908,8 @@ the arrow keys.
.PP
\f[B]Note\f[R]: tabs are converted to 8 spaces.
.SH SEE ALSO
-.PP
dc(1)
.SH STANDARDS
-.PP
bc(1) is compliant with the IEEE Std 1003.1-2017
(\[lq]POSIX.1-2017\[rq]) specification at
https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html .
@@ -2984,13 +2926,13 @@ Note that the specification explicitly says that bc(1) only accepts
numbers that use a period (\f[B].\f[R]) as a radix point, regardless of
the value of \f[B]LC_NUMERIC\f[R].
.SH BUGS
-.PP
Before version \f[B]6.1.0\f[R], this bc(1) had incorrect behavior for
the \f[B]quit\f[R] statement.
.PP
No other bugs are known.
Report bugs at https://git.gavinhoward.com/gavin/bc .
.SH AUTHORS
-.PP
-Gavin D.
-Howard <gavin@gavinhoward.com> and contributors.
+Gavin D. Howard \c
+.MT gavin@gavinhoward.com
+.ME \c
+\ and contributors.
diff --git a/contrib/bc/manuals/bc/N.1.md b/contrib/bc/manuals/bc/N.1.md
index d4a08817c952..5d5334c70d72 100644
--- a/contrib/bc/manuals/bc/N.1.md
+++ b/contrib/bc/manuals/bc/N.1.md
@@ -1513,7 +1513,7 @@ The extended library is a **non-portable extension**.
**bnot8(x)**
: Does a bitwise not of the truncated absolute value of **x** as though it has
- **8** binary digits (1 unsigned byte).
+ **8** binary digits (**1** unsigned byte).
If you want to a use signed two's complement argument, use **s2u(x)** to
convert.
@@ -1521,7 +1521,7 @@ The extended library is a **non-portable extension**.
**bnot16(x)**
: Does a bitwise not of the truncated absolute value of **x** as though it has
- **16** binary digits (2 unsigned bytes).
+ **16** binary digits (**2** unsigned bytes).
If you want to a use signed two's complement argument, use **s2u(x)** to
convert.
@@ -1529,7 +1529,7 @@ The extended library is a **non-portable extension**.
**bnot32(x)**
: Does a bitwise not of the truncated absolute value of **x** as though it has
- **32** binary digits (4 unsigned bytes).
+ **32** binary digits (**4** unsigned bytes).
If you want to a use signed two's complement argument, use **s2u(x)** to
convert.
@@ -1537,7 +1537,7 @@ The extended library is a **non-portable extension**.
**bnot64(x)**
: Does a bitwise not of the truncated absolute value of **x** as though it has
- **64** binary digits (8 unsigned bytes).
+ **64** binary digits (**8** unsigned bytes).
If you want to a use signed two's complement argument, use **s2u(x)** to
convert.
@@ -1561,7 +1561,7 @@ The extended library is a **non-portable extension**.
**brev8(x)**
: Runs a bit reversal on the truncated absolute value of **x** as though it
- has 8 binary digits (1 unsigned byte).
+ has 8 binary digits (**1** unsigned byte).
If you want to a use signed two's complement argument, use **s2u(x)** to
convert.
@@ -1569,7 +1569,7 @@ The extended library is a **non-portable extension**.
**brev16(x)**
: Runs a bit reversal on the truncated absolute value of **x** as though it
- has 16 binary digits (2 unsigned bytes).
+ has 16 binary digits (**2** unsigned bytes).
If you want to a use signed two's complement argument, use **s2u(x)** to
convert.
@@ -1577,7 +1577,7 @@ The extended library is a **non-portable extension**.
**brev32(x)**
: Runs a bit reversal on the truncated absolute value of **x** as though it
- has 32 binary digits (4 unsigned bytes).
+ has 32 binary digits (**4** unsigned bytes).
If you want to a use signed two's complement argument, use **s2u(x)** to
convert.
@@ -1585,7 +1585,7 @@ The extended library is a **non-portable extension**.
**brev64(x)**
: Runs a bit reversal on the truncated absolute value of **x** as though it
- has 64 binary digits (8 unsigned bytes).
+ has 64 binary digits (**8** unsigned bytes).
If you want to a use signed two's complement argument, use **s2u(x)** to
convert.
@@ -1632,7 +1632,7 @@ The extended library is a **non-portable extension**.
**brol32(x, p)**
: Does a left bitwise rotatation of the truncated absolute value of **x**, as
- though it has **32** binary digits (**2** unsigned bytes), by the number of
+ though it has **32** binary digits (**4** unsigned bytes), by the number of
places equal to the truncated absolute value of **p** modded by **2** to the
power of **32**.
@@ -1642,7 +1642,7 @@ The extended library is a **non-portable extension**.
**brol64(x, p)**
: Does a left bitwise rotatation of the truncated absolute value of **x**, as
- though it has **64** binary digits (**2** unsigned bytes), by the number of
+ though it has **64** binary digits (**8** unsigned bytes), by the number of
places equal to the truncated absolute value of **p** modded by **2** to the
power of **64**.
diff --git a/contrib/bc/manuals/bcl.3 b/contrib/bc/manuals/bcl.3
index cb65a2b8b991..09e5de74597e 100644
--- a/contrib/bc/manuals/bcl.3
+++ b/contrib/bc/manuals/bcl.3
@@ -29,17 +29,14 @@
.nh
.ad l
.SH NAME
-.PP
bcl - library of arbitrary precision decimal arithmetic
.SH SYNOPSIS
.SS Use
-.PP
\f[I]#include <bcl.h>\f[R]
.PP
Link with \f[I]-lbcl\f[R], and on POSIX systems, \f[I]-lpthread\f[R] is
also required.
.SS Setup
-.PP
These items allow clients to set up bcl(3).
.PP
\f[B]BclError bcl_start(\f[R]\f[I]void\f[R]\f[B]);\f[R]
@@ -65,7 +62,6 @@ These items allow clients to set up bcl(3).
.PP
\f[B]void bcl_setDigitClamp(bool\f[R] \f[I]digitClamp\f[R]\f[B]);\f[R]
.SS Contexts
-.PP
These items will allow clients to handle contexts, which are isolated
from each other.
This allows more than one client to use bcl(3) in the same program.
@@ -101,14 +97,12 @@ size_t\f[R] \f[I]ibase\f[R]\f[B]);\f[R]
\f[B]void bcl_ctxt_setObase(BclContext\f[R] \f[I]ctxt\f[R]\f[B],
size_t\f[R] \f[I]obase\f[R]\f[B]);\f[R]
.SS Errors
-.PP
These items allow clients to handle errors.
.PP
\f[B]typedef enum BclError BclError;\f[R]
.PP
\f[B]BclError bcl_err(BclNumber\f[R] \f[I]n\f[R]\f[B]);\f[R]
.SS Numbers
-.PP
These items allow clients to manipulate and query the
arbitrary-precision numbers managed by bcl(3).
.PP
@@ -130,7 +124,6 @@ size_t\f[R] \f[I]scale\f[R]\f[B]);\f[R]
.PP
\f[B]size_t bcl_num_len(BclNumber\f[R] \f[I]n\f[R]\f[B]);\f[R]
.SS Conversion
-.PP
These items allow clients to convert numbers into and from strings and
integers.
.PP
@@ -149,7 +142,6 @@ integers.
.PP
\f[B]BclNumber bcl_bigdig2num(BclBigDig\f[R] \f[I]val\f[R]\f[B]);\f[R]
.SS Math
-.PP
These items allow clients to run math on numbers.
.PP
\f[B]BclNumber bcl_add(BclNumber\f[R] \f[I]a\f[R]\f[B], BclNumber\f[R]
@@ -218,7 +210,6 @@ BclNumber\f[R] \f[I]b\f[R]\f[B], BclNumber\f[R] \f[I]c\f[R]\f[B]);\f[R]
\f[B]BclNumber bcl_modexp_keep(BclNumber\f[R] \f[I]a\f[R]\f[B],
BclNumber\f[R] \f[I]b\f[R]\f[B], BclNumber\f[R] \f[I]c\f[R]\f[B]);\f[R]
.SS Miscellaneous
-.PP
These items are miscellaneous.
.PP
\f[B]void bcl_zero(BclNumber\f[R] \f[I]n\f[R]\f[B]);\f[R]
@@ -233,7 +224,6 @@ These items are miscellaneous.
.PP
\f[B]BclNumber bcl_dup(BclNumber\f[R] \f[I]s\f[R]\f[B]);\f[R]
.SS Pseudo-Random Number Generator
-.PP
These items allow clients to manipulate the seeded pseudo-random number
generator in bcl(3).
.PP
@@ -275,7 +265,6 @@ size_t\f[R] \f[I]places\f[R]\f[B]);\f[R]
\f[B]BclRandInt bcl_rand_bounded(BclRandInt\f[R]
\f[I]bound\f[R]\f[B]);\f[R]
.SH DESCRIPTION
-.PP
bcl(3) is a library that implements arbitrary-precision decimal math, as
standardized by POSIX
(https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html) in
@@ -459,7 +448,6 @@ Garbage collects cached instances of arbitrary-precision numbers.
This only frees the memory of numbers that are \f[I]not\f[R] in use, so
it is safe to call at any time.
.SS Contexts
-.PP
All procedures that take a \f[B]BclContext\f[R] parameter a require a
valid context as an argument.
.TP
@@ -587,7 +575,6 @@ If there was no error, it will return \f[B]BCL_ERROR_NONE\f[R].
There must be a valid current context.
.RE
.SS Numbers
-.PP
All procedures in this section require a valid current context.
.TP
\f[B]BclNumber\f[R]
@@ -651,7 +638,6 @@ Otherwise, this function can return:
Returns the number of \f[I]significant decimal digits\f[R] in
\f[I]n\f[R].
.SS Conversion
-.PP
All procedures in this section require a valid current context.
.PP
All procedures in this section without the \f[B]_keep\f[R] suffix in
@@ -748,7 +734,6 @@ Possible errors include:
\f[B]BCL_ERROR_FATAL_ALLOC_ERR\f[R]
.RE
.SS Math
-.PP
All procedures in this section require a valid current context.
.PP
All procedures in this section without the \f[B]_keep\f[R] suffix in
@@ -1370,7 +1355,6 @@ Possible errors include:
\f[B]BCL_ERROR_FATAL_ALLOC_ERR\f[R]
.RE
.SS Pseudo-Random Number Generator
-.PP
The pseudo-random number generator in bcl(3) is a \f[I]seeded\f[R] PRNG.
Given the same seed twice, it will produce the same sequence of
pseudo-random numbers twice.
@@ -1644,18 +1628,15 @@ Bias is removed before returning the integer.
This procedure cannot fail.
.RE
.SS Consumption and Propagation
-.PP
Some functions are listed as consuming some or all of their arguments.
This means that the arguments are freed, regardless of if there were
errors or not.
.PP
This is to enable compact code like the following:
.IP
-.nf
-\f[C]
+.EX
BclNumber n = bcl_num_add(bcl_num_mul(a, b), bcl_num_div(c, d));
-\f[R]
-.fi
+.EE
.PP
If arguments to those functions were not consumed, memory would be
leaked until reclaimed with \f[B]bcl_ctxt_freeNums(BclContext)\f[R].
@@ -1664,16 +1645,13 @@ When errors occur, they are propagated through.
The result should always be checked with \f[B]bcl_err(BclNumber)\f[R],
so the example above should properly be:
.IP
-.nf
-\f[C]
+.EX
BclNumber n = bcl_num_add(bcl_num_mul(a, b), bcl_num_div(c, d));
if (bcl_err(n) != BCL_ERROR_NONE) {
// Handle the error.
}
-\f[R]
-.fi
+.EE
.SH ERRORS
-.PP
Most functions in bcl(3) return, directly or indirectly, any one of the
error codes defined in \f[B]BclError\f[R].
The complete list of codes is the following:
@@ -1761,7 +1739,6 @@ It is highly recommended that client libraries do \f[I]not\f[R] activate
this behavior.
.RE
.SH ATTRIBUTES
-.PP
bcl(3) is \f[I]MT-Safe\f[R]: it is safe to call any functions from more
than one thread.
However, is is \f[I]not\f[R] safe to pass any data between threads
@@ -1773,7 +1750,6 @@ safe with multiple threads.
If it is necessary to be able to interrupt bcl(3), spawn a separate
thread to run the calculation.
.SH PERFORMANCE
-.PP
Most bc(1) implementations use \f[B]char\f[R] types to calculate the
value of \f[B]1\f[R] decimal digit at a time, but that can be slow.
bcl(3) does something different.
@@ -1793,7 +1769,6 @@ checking.
This integer type depends on the value of \f[B]BC_LONG_BIT\f[R], but is
always at least twice as large as the integer type used to store digits.
.SH LIMITS
-.PP
The following are the limits on bcl(3):
.TP
\f[B]BC_LONG_BIT\f[R]
@@ -1844,10 +1819,8 @@ large (at least on 64-bit machines) that there should not be any point
at which they become a problem.
In fact, memory should be exhausted before these limits should be hit.
.SH SEE ALSO
-.PP
bc(1) and dc(1)
.SH STANDARDS
-.PP
bcl(3) is compliant with the arithmetic defined in the IEEE Std
1003.1-2017 (\[lq]POSIX.1-2017\[rq]) specification at
https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html for
@@ -1858,10 +1831,10 @@ numbers that use a period (\f[B].\f[R]) as a radix point, regardless of
the value of \f[B]LC_NUMERIC\f[R].
This is also true of bcl(3).
.SH BUGS
-.PP
None are known.
Report bugs at https://git.gavinhoward.com/gavin/bc.
.SH AUTHORS
-.PP
-Gavin D.
-Howard <gavin@gavinhoward.com> and contributors.
+Gavin D. Howard \c
+.MT gavin@gavinhoward.com
+.ME \c
+\ and contributors.
diff --git a/contrib/bc/manuals/dc/A.1 b/contrib/bc/manuals/dc/A.1
index bef54876d7f2..7de20035f43f 100644
--- a/contrib/bc/manuals/dc/A.1
+++ b/contrib/bc/manuals/dc/A.1
@@ -29,10 +29,8 @@
.nh
.ad l
.SH Name
-.PP
dc - arbitrary-precision decimal reverse-Polish notation calculator
.SH SYNOPSIS
-.PP
\f[B]dc\f[R] [\f[B]-cChiPRvVx\f[R]] [\f[B]--version\f[R]]
[\f[B]--help\f[R]] [\f[B]--digit-clamp\f[R]]
[\f[B]--no-digit-clamp\f[R]] [\f[B]--interactive\f[R]]
@@ -47,7 +45,6 @@ dc - arbitrary-precision decimal reverse-Polish notation calculator
[\f[B]-S\f[R] \f[I]scale\f[R]] [\f[B]--scale\f[R]=\f[I]scale\f[R]]
[\f[B]-E\f[R] \f[I]seed\f[R]] [\f[B]--seed\f[R]=\f[I]seed\f[R]]
.SH DESCRIPTION
-.PP
dc(1) is an arbitrary-precision calculator.
It uses a stack (reverse Polish notation) to store numbers and results
of computations.
@@ -64,7 +61,6 @@ For example, if a user wants the \f[B]scale\f[R] always set to
\f[B]10\f[R], they can set \f[B]DC_ENV_ARGS\f[R] to \f[B]-e 10k\f[R],
and this dc(1) will always start with a \f[B]scale\f[R] of \f[B]10\f[R].
.SH OPTIONS
-.PP
The following are the options that dc(1) accepts.
.TP
\f[B]-C\f[R], \f[B]--no-digit-clamp\f[R]
@@ -276,7 +272,6 @@ This is a \f[B]non-portable extension\f[R].
.PP
All long options are \f[B]non-portable extensions\f[R].
.SH STDIN
-.PP
If no files are given on the command-line and no files or expressions
are given by the \f[B]-f\f[R], \f[B]--file\f[R], \f[B]-e\f[R], or
\f[B]--expression\f[R] options, then dc(1) reads from \f[B]stdin\f[R].
@@ -289,7 +284,6 @@ ended.
This means that, except for escaped brackets, all brackets must be
balanced before dc(1) parses and executes.
.SH STDOUT
-.PP
Any non-error output is written to \f[B]stdout\f[R].
In addition, if history (see the \f[B]HISTORY\f[R] section) and the
prompt (see the \f[B]TTY MODE\f[R] section) are enabled, both are output
@@ -298,7 +292,7 @@ to \f[B]stdout\f[R].
\f[B]Note\f[R]: Unlike other dc(1) implementations, this dc(1) will
issue a fatal error (see the \f[B]EXIT STATUS\f[R] section) if it cannot
write to \f[B]stdout\f[R], so if \f[B]stdout\f[R] is closed, as in
-\f[B]dc >&-\f[R], it will quit with an error.
+\f[B]dc >&-\f[R], it will quit with an error.
This is done so that dc(1) can report problems when \f[B]stdout\f[R] is
redirected to a file.
.PP
@@ -306,13 +300,12 @@ If there are scripts that depend on the behavior of other dc(1)
implementations, it is recommended that those scripts be changed to
redirect \f[B]stdout\f[R] to \f[B]/dev/null\f[R].
.SH STDERR
-.PP
Any error output is written to \f[B]stderr\f[R].
.PP
\f[B]Note\f[R]: Unlike other dc(1) implementations, this dc(1) will
issue a fatal error (see the \f[B]EXIT STATUS\f[R] section) if it cannot
write to \f[B]stderr\f[R], so if \f[B]stderr\f[R] is closed, as in
-\f[B]dc 2>&-\f[R], it will quit with an error.
+\f[B]dc 2>&-\f[R], it will quit with an error.
This is done so that dc(1) can exit with an error code when
\f[B]stderr\f[R] is redirected to a file.
.PP
@@ -320,7 +313,6 @@ If there are scripts that depend on the behavior of other dc(1)
implementations, it is recommended that those scripts be changed to
redirect \f[B]stderr\f[R] to \f[B]/dev/null\f[R].
.SH SYNTAX
-.PP
Each item in the input source code, either a number (see the
\f[B]NUMBERS\f[R] section) or a command (see the \f[B]COMMANDS\f[R]
section), is processed and executed, in order.
@@ -393,11 +385,9 @@ In any other case, use a non-seeded pseudo-random number generator.
The pseudo-random number generator, \f[B]seed\f[R], and all associated
operations are \f[B]non-portable extensions\f[R].
.SS Comments
-.PP
Comments go from \f[B]#\f[R] until, and not including, the next newline.
This is a \f[B]non-portable extension\f[R].
.SH NUMBERS
-.PP
Numbers are strings made up of digits, uppercase letters up to
\f[B]F\f[R], and at most \f[B]1\f[R] period for a radix.
Numbers can have up to \f[B]DC_NUM_MAX\f[R] digits.
@@ -464,10 +454,8 @@ number string \f[B]FFeA\f[R], the resulting decimal number will be
Accepting input as scientific notation is a \f[B]non-portable
extension\f[R].
.SH COMMANDS
-.PP
The valid commands are listed below.
.SS Printing
-.PP
These commands are used for printing.
.PP
Note that both scientific notation and engineering notation are
@@ -515,7 +503,6 @@ without altering anything.
Users should use this command when they get lost.
.RE
.SS Arithmetic
-.PP
These are the commands used for arithmetic.
.TP
\f[B]+\f[R]
@@ -747,7 +734,6 @@ a short-circuit operator.
This is a \f[B]non-portable extension\f[R].
.RE
.SS Pseudo-Random Number Generator
-.PP
dc(1) has a built-in pseudo-random number generator.
These commands query the pseudo-random number generator.
(See Parameters for more information about the \f[B]seed\f[R] value that
@@ -791,7 +777,6 @@ limitations of the pseudo-random number generator.
This is a \f[B]non-portable extension\f[R].
.RE
.SS Stack Control
-.PP
These commands control the stack.
.TP
\f[B]c\f[R]
@@ -807,7 +792,6 @@ Swaps (\[lq]reverses\[rq]) the two top items on the stack.
\f[B]R\f[R]
Pops (\[lq]removes\[rq]) the top value from the stack.
.SS Register Control
-.PP
These commands control registers (see the \f[B]REGISTERS\f[R] section).
.TP
\f[B]s\f[R]\f[I]r\f[R]
@@ -829,7 +813,6 @@ push it onto the main stack.
The previous value in the stack for register \f[I]r\f[R], if any, is now
accessible via the \f[B]l\f[R]\f[I]r\f[R] command.
.SS Parameters
-.PP
These commands control the values of \f[B]ibase\f[R], \f[B]obase\f[R],
\f[B]scale\f[R], and \f[B]seed\f[R].
Also see the \f[B]SYNTAX\f[R] section.
@@ -941,7 +924,6 @@ Pushes the maximum (inclusive) integer that can be generated with the
This is a \f[B]non-portable extension\f[R].
.RE
.SS Strings
-.PP
The following commands control strings.
.PP
dc(1) can work with both numbers and strings, and registers (see the
@@ -1158,7 +1140,6 @@ to make dc(1) exit with the \f[B]Q\f[R] command, so the sequence
This is a \f[B]non-portable extension\f[R].
.RE
.SS Status
-.PP
These commands query status of the stack or its top value.
.TP
\f[B]Z\f[R]
@@ -1219,7 +1200,6 @@ This means that this command will never push \f[B]0\f[R].
This is a \f[B]non-portable extension\f[R].
.RE
.SS Arrays
-.PP
These commands manipulate arrays.
.TP
\f[B]:\f[R]\f[I]r\f[R]
@@ -1239,7 +1219,6 @@ Pushes the length of the array \f[I]r\f[R] onto the stack.
This is a \f[B]non-portable extension\f[R].
.RE
.SS Global Settings
-.PP
These commands retrieve global settings.
These are the only commands that require multiple specific characters,
and all of them begin with the letter \f[B]g\f[R].
@@ -1262,7 +1241,6 @@ Pushes \f[B]0\f[R] onto the stack if the leading zero setting has not
been enabled with the \f[B]-z\f[R] or \f[B]--leading-zeroes\f[R] options
(see the \f[B]OPTIONS\f[R] section), non-zero otherwise.
.SH REGISTERS
-.PP
Registers are names that can store strings, numbers, and arrays.
(Number/string registers do not interfere with array registers.)
.PP
@@ -1278,7 +1256,6 @@ The only exceptions are: a newline (\f[B]`\[rs]n'\f[R]) and a left
bracket (\f[B]`['\f[R]); it is a parse error for a newline or a left
bracket to be used as a register name.
.SS Extended Register Mode
-.PP
Unlike most other dc(1) implentations, this dc(1) provides nearly
unlimited amounts of registers, if extended register mode is enabled.
.PP
@@ -1293,7 +1270,6 @@ In that case, the register name is found according to the regex
\f[B][a-z][a-z0-9_]*\f[R] (like bc(1) identifiers), and it is a parse
error if the next non-space characters do not match that regex.
.SH RESET
-.PP
When dc(1) encounters an error or a signal that it has a non-default
handler for, it resets.
This means that several things happen.
@@ -1310,7 +1286,6 @@ Then, if it is interactive mode, and the error was not a fatal error
(see the \f[B]EXIT STATUS\f[R] section), it asks for more input;
otherwise, it exits with the appropriate return code.
.SH PERFORMANCE
-.PP
Most dc(1) implementations use \f[B]char\f[R] types to calculate the
value of \f[B]1\f[R] decimal digit at a time, but that can be slow.
This dc(1) does something different.
@@ -1330,7 +1305,6 @@ checking.
This integer type depends on the value of \f[B]DC_LONG_BIT\f[R], but is
always at least twice as large as the integer type used to store digits.
.SH LIMITS
-.PP
The following are the limits on dc(1):
.TP
\f[B]DC_LONG_BIT\f[R]
@@ -1397,7 +1371,6 @@ large (at least on 64-bit machines) that there should not be any point
at which they become a problem.
In fact, memory should be exhausted before these limits should be hit.
.SH ENVIRONMENT VARIABLES
-.PP
As \f[B]non-portable extensions\f[R], dc(1) recognizes the following
environment variables:
.TP
@@ -1520,7 +1493,6 @@ This environment variable overrides the default, which can be queried
with the \f[B]-h\f[R] or \f[B]--help\f[R] options.
.RE
.SH EXIT STATUS
-.PP
dc(1) returns the following exit statuses:
.TP
\f[B]0\f[R]
@@ -1589,7 +1561,6 @@ These exit statuses allow dc(1) to be used in shell scripting with error
checking, and its normal behavior can be forced by using the
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.SH INTERACTIVE MODE
-.PP
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both \f[B]stdin\f[R]
and \f[B]stdout\f[R] are hooked to a terminal, but the \f[B]-i\f[R] flag
@@ -1602,7 +1573,6 @@ dc(1) may also reset on \f[B]SIGINT\f[R] instead of exit, depending on
the contents of, or default for, the \f[B]DC_SIGINT_RESET\f[R]
environment variable (see the \f[B]ENVIRONMENT VARIABLES\f[R] section).
.SH TTY MODE
-.PP
If \f[B]stdin\f[R], \f[B]stdout\f[R], and \f[B]stderr\f[R] are all
connected to a TTY, then \[lq]TTY mode\[rq] is considered to be
available, and thus, dc(1) can turn on TTY mode, subject to some
@@ -1626,7 +1596,6 @@ required in the bc(1) specification (see the \f[B]STANDARDS\f[R]
section), and interactive mode requires only \f[B]stdin\f[R] and
\f[B]stdout\f[R] to be connected to a terminal.
.SS Command-Line History
-.PP
Command-line history is only enabled if TTY mode is, i.e., that
\f[B]stdin\f[R], \f[B]stdout\f[R], and \f[B]stderr\f[R] are connected to
a TTY and the \f[B]DC_TTY_MODE\f[R] environment variable (see the
@@ -1634,7 +1603,6 @@ a TTY and the \f[B]DC_TTY_MODE\f[R] environment variable (see the
TTY mode.
See the \f[B]COMMAND LINE HISTORY\f[R] section for more information.
.SS Prompt
-.PP
If TTY mode is available, then a prompt can be enabled.
Like TTY mode itself, it can be turned on or off with an environment
variable: \f[B]DC_PROMPT\f[R] (see the \f[B]ENVIRONMENT VARIABLES\f[R]
@@ -1655,7 +1623,6 @@ and \f[B]--no-read-prompt\f[R] options.
See the \f[B]ENVIRONMENT VARIABLES\f[R] and \f[B]OPTIONS\f[R] sections
for more details.
.SH SIGNAL HANDLING
-.PP
Sending a \f[B]SIGINT\f[R] will cause dc(1) to do one of two things.
.PP
If dc(1) is not in interactive mode (see the \f[B]INTERACTIVE MODE\f[R]
@@ -1690,7 +1657,6 @@ The one exception is \f[B]SIGHUP\f[R]; in that case, and only when dc(1)
is in TTY mode (see the \f[B]TTY MODE\f[R] section), a \f[B]SIGHUP\f[R]
will cause dc(1) to clean up and exit.
.SH COMMAND LINE HISTORY
-.PP
dc(1) supports interactive command-line editing.
.PP
If dc(1) can be in TTY mode (see the \f[B]TTY MODE\f[R] section),
@@ -1705,23 +1671,20 @@ section).
.PP
\f[B]Note\f[R]: tabs are converted to 8 spaces.
.SH LOCALES
-.PP
This dc(1) ships with support for adding error messages for different
locales and thus, supports \f[B]LC_MESSAGES\f[R].
.SH SEE ALSO
-.PP
bc(1)
.SH STANDARDS
-.PP
The dc(1) utility operators and some behavior are compliant with the
operators in the IEEE Std 1003.1-2017 (\[lq]POSIX.1-2017\[rq]) bc(1)
specification at
https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html .
.SH BUGS
-.PP
None are known.
Report bugs at https://git.gavinhoward.com/gavin/bc .
.SH AUTHOR
-.PP
-Gavin D.
-Howard <gavin@gavinhoward.com> and contributors.
+Gavin D. Howard \c
+.MT gavin@gavinhoward.com
+.ME \c
+\ and contributors.
diff --git a/contrib/bc/manuals/dc/E.1 b/contrib/bc/manuals/dc/E.1
index 41de5e08f743..bc8d66eb3f97 100644
--- a/contrib/bc/manuals/dc/E.1
+++ b/contrib/bc/manuals/dc/E.1
@@ -29,10 +29,8 @@
.nh
.ad l
.SH Name
-.PP
dc - arbitrary-precision decimal reverse-Polish notation calculator
.SH SYNOPSIS
-.PP
\f[B]dc\f[R] [\f[B]-cChiPRvVx\f[R]] [\f[B]--version\f[R]]
[\f[B]--help\f[R]] [\f[B]--digit-clamp\f[R]]
[\f[B]--no-digit-clamp\f[R]] [\f[B]--interactive\f[R]]
@@ -43,7 +41,6 @@ dc - arbitrary-precision decimal reverse-Polish notation calculator
[\f[B]--file\f[R]=\f[I]file\f[R]\&...]
[\f[I]file\f[R]\&...]
.SH DESCRIPTION
-.PP
dc(1) is an arbitrary-precision calculator.
It uses a stack (reverse Polish notation) to store numbers and results
of computations.
@@ -60,7 +57,6 @@ For example, if a user wants the \f[B]scale\f[R] always set to
\f[B]10\f[R], they can set \f[B]DC_ENV_ARGS\f[R] to \f[B]-e 10k\f[R],
and this dc(1) will always start with a \f[B]scale\f[R] of \f[B]10\f[R].
.SH OPTIONS
-.PP
The following are the options that dc(1) accepts.
.TP
\f[B]-C\f[R], \f[B]--no-digit-clamp\f[R]
@@ -261,7 +257,6 @@ This is a \f[B]non-portable extension\f[R].
.PP
All long options are \f[B]non-portable extensions\f[R].
.SH STDIN
-.PP
If no files are given on the command-line and no files or expressions
are given by the \f[B]-f\f[R], \f[B]--file\f[R], \f[B]-e\f[R], or
\f[B]--expression\f[R] options, then dc(1) reads from \f[B]stdin\f[R].
@@ -274,7 +269,6 @@ ended.
This means that, except for escaped brackets, all brackets must be
balanced before dc(1) parses and executes.
.SH STDOUT
-.PP
Any non-error output is written to \f[B]stdout\f[R].
In addition, if history (see the \f[B]HISTORY\f[R] section) and the
prompt (see the \f[B]TTY MODE\f[R] section) are enabled, both are output
@@ -283,7 +277,7 @@ to \f[B]stdout\f[R].
\f[B]Note\f[R]: Unlike other dc(1) implementations, this dc(1) will
issue a fatal error (see the \f[B]EXIT STATUS\f[R] section) if it cannot
write to \f[B]stdout\f[R], so if \f[B]stdout\f[R] is closed, as in
-\f[B]dc >&-\f[R], it will quit with an error.
+\f[B]dc >&-\f[R], it will quit with an error.
This is done so that dc(1) can report problems when \f[B]stdout\f[R] is
redirected to a file.
.PP
@@ -291,13 +285,12 @@ If there are scripts that depend on the behavior of other dc(1)
implementations, it is recommended that those scripts be changed to
redirect \f[B]stdout\f[R] to \f[B]/dev/null\f[R].
.SH STDERR
-.PP
Any error output is written to \f[B]stderr\f[R].
.PP
\f[B]Note\f[R]: Unlike other dc(1) implementations, this dc(1) will
issue a fatal error (see the \f[B]EXIT STATUS\f[R] section) if it cannot
write to \f[B]stderr\f[R], so if \f[B]stderr\f[R] is closed, as in
-\f[B]dc 2>&-\f[R], it will quit with an error.
+\f[B]dc 2>&-\f[R], it will quit with an error.
This is done so that dc(1) can exit with an error code when
\f[B]stderr\f[R] is redirected to a file.
.PP
@@ -305,7 +298,6 @@ If there are scripts that depend on the behavior of other dc(1)
implementations, it is recommended that those scripts be changed to
redirect \f[B]stderr\f[R] to \f[B]/dev/null\f[R].
.SH SYNTAX
-.PP
Each item in the input source code, either a number (see the
\f[B]NUMBERS\f[R] section) or a command (see the \f[B]COMMANDS\f[R]
section), is processed and executed, in order.
@@ -340,11 +332,9 @@ precision of any operations (with exceptions).
The max allowable value for \f[B]scale\f[R] can be queried in dc(1)
programs with the \f[B]V\f[R] command.
.SS Comments
-.PP
Comments go from \f[B]#\f[R] until, and not including, the next newline.
This is a \f[B]non-portable extension\f[R].
.SH NUMBERS
-.PP
Numbers are strings made up of digits, uppercase letters up to
\f[B]F\f[R], and at most \f[B]1\f[R] period for a radix.
Numbers can have up to \f[B]DC_NUM_MAX\f[R] digits.
@@ -391,10 +381,8 @@ value of \f[B]ibase\f[R].
If clamping is on, and the clamped value of a character is needed, use a
leading zero, i.e., for \f[B]A\f[R], use \f[B]0A\f[R].
.SH COMMANDS
-.PP
The valid commands are listed below.
.SS Printing
-.PP
These commands are used for printing.
.TP
\f[B]p\f[R]
@@ -431,7 +419,6 @@ without altering anything.
Users should use this command when they get lost.
.RE
.SS Arithmetic
-.PP
These are the commands used for arithmetic.
.TP
\f[B]+\f[R]
@@ -621,7 +608,6 @@ a short-circuit operator.
This is a \f[B]non-portable extension\f[R].
.RE
.SS Stack Control
-.PP
These commands control the stack.
.TP
\f[B]c\f[R]
@@ -637,7 +623,6 @@ Swaps (\[lq]reverses\[rq]) the two top items on the stack.
\f[B]R\f[R]
Pops (\[lq]removes\[rq]) the top value from the stack.
.SS Register Control
-.PP
These commands control registers (see the \f[B]REGISTERS\f[R] section).
.TP
\f[B]s\f[R]\f[I]r\f[R]
@@ -659,7 +644,6 @@ push it onto the main stack.
The previous value in the stack for register \f[I]r\f[R], if any, is now
accessible via the \f[B]l\f[R]\f[I]r\f[R] command.
.SS Parameters
-.PP
These commands control the values of \f[B]ibase\f[R], \f[B]obase\f[R],
and \f[B]scale\f[R].
Also see the \f[B]SYNTAX\f[R] section.
@@ -726,7 +710,6 @@ stack.
This is a \f[B]non-portable extension\f[R].
.RE
.SS Strings
-.PP
The following commands control strings.
.PP
dc(1) can work with both numbers and strings, and registers (see the
@@ -943,7 +926,6 @@ to make dc(1) exit with the \f[B]Q\f[R] command, so the sequence
This is a \f[B]non-portable extension\f[R].
.RE
.SS Status
-.PP
These commands query status of the stack or its top value.
.TP
\f[B]Z\f[R]
@@ -1004,7 +986,6 @@ This means that this command will never push \f[B]0\f[R].
This is a \f[B]non-portable extension\f[R].
.RE
.SS Arrays
-.PP
These commands manipulate arrays.
.TP
\f[B]:\f[R]\f[I]r\f[R]
@@ -1024,7 +1005,6 @@ Pushes the length of the array \f[I]r\f[R] onto the stack.
This is a \f[B]non-portable extension\f[R].
.RE
.SS Global Settings
-.PP
These commands retrieve global settings.
These are the only commands that require multiple specific characters,
and all of them begin with the letter \f[B]g\f[R].
@@ -1047,7 +1027,6 @@ Pushes \f[B]0\f[R] onto the stack if the leading zero setting has not
been enabled with the \f[B]-z\f[R] or \f[B]--leading-zeroes\f[R] options
(see the \f[B]OPTIONS\f[R] section), non-zero otherwise.
.SH REGISTERS
-.PP
Registers are names that can store strings, numbers, and arrays.
(Number/string registers do not interfere with array registers.)
.PP
@@ -1063,7 +1042,6 @@ The only exceptions are: a newline (\f[B]`\[rs]n'\f[R]) and a left
bracket (\f[B]`['\f[R]); it is a parse error for a newline or a left
bracket to be used as a register name.
.SS Extended Register Mode
-.PP
Unlike most other dc(1) implentations, this dc(1) provides nearly
unlimited amounts of registers, if extended register mode is enabled.
.PP
@@ -1078,7 +1056,6 @@ In that case, the register name is found according to the regex
\f[B][a-z][a-z0-9_]*\f[R] (like bc(1) identifiers), and it is a parse
error if the next non-space characters do not match that regex.
.SH RESET
-.PP
When dc(1) encounters an error or a signal that it has a non-default
handler for, it resets.
This means that several things happen.
@@ -1095,7 +1072,6 @@ Then, if it is interactive mode, and the error was not a fatal error
(see the \f[B]EXIT STATUS\f[R] section), it asks for more input;
otherwise, it exits with the appropriate return code.
.SH PERFORMANCE
-.PP
Most dc(1) implementations use \f[B]char\f[R] types to calculate the
value of \f[B]1\f[R] decimal digit at a time, but that can be slow.
This dc(1) does something different.
@@ -1115,7 +1091,6 @@ checking.
This integer type depends on the value of \f[B]DC_LONG_BIT\f[R], but is
always at least twice as large as the integer type used to store digits.
.SH LIMITS
-.PP
The following are the limits on dc(1):
.TP
\f[B]DC_LONG_BIT\f[R]
@@ -1177,7 +1152,6 @@ large (at least on 64-bit machines) that there should not be any point
at which they become a problem.
In fact, memory should be exhausted before these limits should be hit.
.SH ENVIRONMENT VARIABLES
-.PP
As \f[B]non-portable extensions\f[R], dc(1) recognizes the following
environment variables:
.TP
@@ -1300,7 +1274,6 @@ This environment variable overrides the default, which can be queried
with the \f[B]-h\f[R] or \f[B]--help\f[R] options.
.RE
.SH EXIT STATUS
-.PP
dc(1) returns the following exit statuses:
.TP
\f[B]0\f[R]
@@ -1367,7 +1340,6 @@ These exit statuses allow dc(1) to be used in shell scripting with error
checking, and its normal behavior can be forced by using the
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.SH INTERACTIVE MODE
-.PP
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both \f[B]stdin\f[R]
and \f[B]stdout\f[R] are hooked to a terminal, but the \f[B]-i\f[R] flag
@@ -1380,7 +1352,6 @@ dc(1) may also reset on \f[B]SIGINT\f[R] instead of exit, depending on
the contents of, or default for, the \f[B]DC_SIGINT_RESET\f[R]
environment variable (see the \f[B]ENVIRONMENT VARIABLES\f[R] section).
.SH TTY MODE
-.PP
If \f[B]stdin\f[R], \f[B]stdout\f[R], and \f[B]stderr\f[R] are all
connected to a TTY, then \[lq]TTY mode\[rq] is considered to be
available, and thus, dc(1) can turn on TTY mode, subject to some
@@ -1404,7 +1375,6 @@ required in the bc(1) specification (see the \f[B]STANDARDS\f[R]
section), and interactive mode requires only \f[B]stdin\f[R] and
\f[B]stdout\f[R] to be connected to a terminal.
.SS Command-Line History
-.PP
Command-line history is only enabled if TTY mode is, i.e., that
\f[B]stdin\f[R], \f[B]stdout\f[R], and \f[B]stderr\f[R] are connected to
a TTY and the \f[B]DC_TTY_MODE\f[R] environment variable (see the
@@ -1412,7 +1382,6 @@ a TTY and the \f[B]DC_TTY_MODE\f[R] environment variable (see the
TTY mode.
See the \f[B]COMMAND LINE HISTORY\f[R] section for more information.
.SS Prompt
-.PP
If TTY mode is available, then a prompt can be enabled.
Like TTY mode itself, it can be turned on or off with an environment
variable: \f[B]DC_PROMPT\f[R] (see the \f[B]ENVIRONMENT VARIABLES\f[R]
@@ -1433,7 +1402,6 @@ and \f[B]--no-read-prompt\f[R] options.
See the \f[B]ENVIRONMENT VARIABLES\f[R] and \f[B]OPTIONS\f[R] sections
for more details.
.SH SIGNAL HANDLING
-.PP
Sending a \f[B]SIGINT\f[R] will cause dc(1) to do one of two things.
.PP
If dc(1) is not in interactive mode (see the \f[B]INTERACTIVE MODE\f[R]
@@ -1468,7 +1436,6 @@ The one exception is \f[B]SIGHUP\f[R]; in that case, and only when dc(1)
is in TTY mode (see the \f[B]TTY MODE\f[R] section), a \f[B]SIGHUP\f[R]
will cause dc(1) to clean up and exit.
.SH COMMAND LINE HISTORY
-.PP
dc(1) supports interactive command-line editing.
.PP
If dc(1) can be in TTY mode (see the \f[B]TTY MODE\f[R] section),
@@ -1483,23 +1450,20 @@ section).
.PP
\f[B]Note\f[R]: tabs are converted to 8 spaces.
.SH LOCALES
-.PP
This dc(1) ships with support for adding error messages for different
locales and thus, supports \f[B]LC_MESSAGES\f[R].
.SH SEE ALSO
-.PP
bc(1)
.SH STANDARDS
-.PP
The dc(1) utility operators and some behavior are compliant with the
operators in the IEEE Std 1003.1-2017 (\[lq]POSIX.1-2017\[rq]) bc(1)
specification at
https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html .
.SH BUGS
-.PP
None are known.
Report bugs at https://git.gavinhoward.com/gavin/bc .
.SH AUTHOR
-.PP
-Gavin D.
-Howard <gavin@gavinhoward.com> and contributors.
+Gavin D. Howard \c
+.MT gavin@gavinhoward.com
+.ME \c
+\ and contributors.
diff --git a/contrib/bc/manuals/dc/EH.1 b/contrib/bc/manuals/dc/EH.1
index 08cb483dc926..83b62e24b913 100644
--- a/contrib/bc/manuals/dc/EH.1
+++ b/contrib/bc/manuals/dc/EH.1
@@ -29,10 +29,8 @@
.nh
.ad l
.SH Name
-.PP
dc - arbitrary-precision decimal reverse-Polish notation calculator
.SH SYNOPSIS
-.PP
\f[B]dc\f[R] [\f[B]-cChiPRvVx\f[R]] [\f[B]--version\f[R]]
[\f[B]--help\f[R]] [\f[B]--digit-clamp\f[R]]
[\f[B]--no-digit-clamp\f[R]] [\f[B]--interactive\f[R]]
@@ -43,7 +41,6 @@ dc - arbitrary-precision decimal reverse-Polish notation calculator
[\f[B]--file\f[R]=\f[I]file\f[R]\&...]
[\f[I]file\f[R]\&...]
.SH DESCRIPTION
-.PP
dc(1) is an arbitrary-precision calculator.
It uses a stack (reverse Polish notation) to store numbers and results
of computations.
@@ -60,7 +57,6 @@ For example, if a user wants the \f[B]scale\f[R] always set to
\f[B]10\f[R], they can set \f[B]DC_ENV_ARGS\f[R] to \f[B]-e 10k\f[R],
and this dc(1) will always start with a \f[B]scale\f[R] of \f[B]10\f[R].
.SH OPTIONS
-.PP
The following are the options that dc(1) accepts.
.TP
\f[B]-C\f[R], \f[B]--no-digit-clamp\f[R]
@@ -261,7 +257,6 @@ This is a \f[B]non-portable extension\f[R].
.PP
All long options are \f[B]non-portable extensions\f[R].
.SH STDIN
-.PP
If no files are given on the command-line and no files or expressions
are given by the \f[B]-f\f[R], \f[B]--file\f[R], \f[B]-e\f[R], or
\f[B]--expression\f[R] options, then dc(1) reads from \f[B]stdin\f[R].
@@ -274,7 +269,6 @@ ended.
This means that, except for escaped brackets, all brackets must be
balanced before dc(1) parses and executes.
.SH STDOUT
-.PP
Any non-error output is written to \f[B]stdout\f[R].
In addition, if history (see the \f[B]HISTORY\f[R] section) and the
prompt (see the \f[B]TTY MODE\f[R] section) are enabled, both are output
@@ -283,7 +277,7 @@ to \f[B]stdout\f[R].
\f[B]Note\f[R]: Unlike other dc(1) implementations, this dc(1) will
issue a fatal error (see the \f[B]EXIT STATUS\f[R] section) if it cannot
write to \f[B]stdout\f[R], so if \f[B]stdout\f[R] is closed, as in
-\f[B]dc >&-\f[R], it will quit with an error.
+\f[B]dc >&-\f[R], it will quit with an error.
This is done so that dc(1) can report problems when \f[B]stdout\f[R] is
redirected to a file.
.PP
@@ -291,13 +285,12 @@ If there are scripts that depend on the behavior of other dc(1)
implementations, it is recommended that those scripts be changed to
redirect \f[B]stdout\f[R] to \f[B]/dev/null\f[R].
.SH STDERR
-.PP
Any error output is written to \f[B]stderr\f[R].
.PP
\f[B]Note\f[R]: Unlike other dc(1) implementations, this dc(1) will
issue a fatal error (see the \f[B]EXIT STATUS\f[R] section) if it cannot
write to \f[B]stderr\f[R], so if \f[B]stderr\f[R] is closed, as in
-\f[B]dc 2>&-\f[R], it will quit with an error.
+\f[B]dc 2>&-\f[R], it will quit with an error.
This is done so that dc(1) can exit with an error code when
\f[B]stderr\f[R] is redirected to a file.
.PP
@@ -305,7 +298,6 @@ If there are scripts that depend on the behavior of other dc(1)
implementations, it is recommended that those scripts be changed to
redirect \f[B]stderr\f[R] to \f[B]/dev/null\f[R].
.SH SYNTAX
-.PP
Each item in the input source code, either a number (see the
\f[B]NUMBERS\f[R] section) or a command (see the \f[B]COMMANDS\f[R]
section), is processed and executed, in order.
@@ -340,11 +332,9 @@ precision of any operations (with exceptions).
The max allowable value for \f[B]scale\f[R] can be queried in dc(1)
programs with the \f[B]V\f[R] command.
.SS Comments
-.PP
Comments go from \f[B]#\f[R] until, and not including, the next newline.
This is a \f[B]non-portable extension\f[R].
.SH NUMBERS
-.PP
Numbers are strings made up of digits, uppercase letters up to
\f[B]F\f[R], and at most \f[B]1\f[R] period for a radix.
Numbers can have up to \f[B]DC_NUM_MAX\f[R] digits.
@@ -391,10 +381,8 @@ value of \f[B]ibase\f[R].
If clamping is on, and the clamped value of a character is needed, use a
leading zero, i.e., for \f[B]A\f[R], use \f[B]0A\f[R].
.SH COMMANDS
-.PP
The valid commands are listed below.
.SS Printing
-.PP
These commands are used for printing.
.TP
\f[B]p\f[R]
@@ -431,7 +419,6 @@ without altering anything.
Users should use this command when they get lost.
.RE
.SS Arithmetic
-.PP
These are the commands used for arithmetic.
.TP
\f[B]+\f[R]
@@ -621,7 +608,6 @@ a short-circuit operator.
This is a \f[B]non-portable extension\f[R].
.RE
.SS Stack Control
-.PP
These commands control the stack.
.TP
\f[B]c\f[R]
@@ -637,7 +623,6 @@ Swaps (\[lq]reverses\[rq]) the two top items on the stack.
\f[B]R\f[R]
Pops (\[lq]removes\[rq]) the top value from the stack.
.SS Register Control
-.PP
These commands control registers (see the \f[B]REGISTERS\f[R] section).
.TP
\f[B]s\f[R]\f[I]r\f[R]
@@ -659,7 +644,6 @@ push it onto the main stack.
The previous value in the stack for register \f[I]r\f[R], if any, is now
accessible via the \f[B]l\f[R]\f[I]r\f[R] command.
.SS Parameters
-.PP
These commands control the values of \f[B]ibase\f[R], \f[B]obase\f[R],
and \f[B]scale\f[R].
Also see the \f[B]SYNTAX\f[R] section.
@@ -726,7 +710,6 @@ stack.
This is a \f[B]non-portable extension\f[R].
.RE
.SS Strings
-.PP
The following commands control strings.
.PP
dc(1) can work with both numbers and strings, and registers (see the
@@ -943,7 +926,6 @@ to make dc(1) exit with the \f[B]Q\f[R] command, so the sequence
This is a \f[B]non-portable extension\f[R].
.RE
.SS Status
-.PP
These commands query status of the stack or its top value.
.TP
\f[B]Z\f[R]
@@ -1004,7 +986,6 @@ This means that this command will never push \f[B]0\f[R].
This is a \f[B]non-portable extension\f[R].
.RE
.SS Arrays
-.PP
These commands manipulate arrays.
.TP
\f[B]:\f[R]\f[I]r\f[R]
@@ -1024,7 +1005,6 @@ Pushes the length of the array \f[I]r\f[R] onto the stack.
This is a \f[B]non-portable extension\f[R].
.RE
.SS Global Settings
-.PP
These commands retrieve global settings.
These are the only commands that require multiple specific characters,
and all of them begin with the letter \f[B]g\f[R].
@@ -1047,7 +1027,6 @@ Pushes \f[B]0\f[R] onto the stack if the leading zero setting has not
been enabled with the \f[B]-z\f[R] or \f[B]--leading-zeroes\f[R] options
(see the \f[B]OPTIONS\f[R] section), non-zero otherwise.
.SH REGISTERS
-.PP
Registers are names that can store strings, numbers, and arrays.
(Number/string registers do not interfere with array registers.)
.PP
@@ -1063,7 +1042,6 @@ The only exceptions are: a newline (\f[B]`\[rs]n'\f[R]) and a left
bracket (\f[B]`['\f[R]); it is a parse error for a newline or a left
bracket to be used as a register name.
.SS Extended Register Mode
-.PP
Unlike most other dc(1) implentations, this dc(1) provides nearly
unlimited amounts of registers, if extended register mode is enabled.
.PP
@@ -1078,7 +1056,6 @@ In that case, the register name is found according to the regex
\f[B][a-z][a-z0-9_]*\f[R] (like bc(1) identifiers), and it is a parse
error if the next non-space characters do not match that regex.
.SH RESET
-.PP
When dc(1) encounters an error or a signal that it has a non-default
handler for, it resets.
This means that several things happen.
@@ -1095,7 +1072,6 @@ Then, if it is interactive mode, and the error was not a fatal error
(see the \f[B]EXIT STATUS\f[R] section), it asks for more input;
otherwise, it exits with the appropriate return code.
.SH PERFORMANCE
-.PP
Most dc(1) implementations use \f[B]char\f[R] types to calculate the
value of \f[B]1\f[R] decimal digit at a time, but that can be slow.
This dc(1) does something different.
@@ -1115,7 +1091,6 @@ checking.
This integer type depends on the value of \f[B]DC_LONG_BIT\f[R], but is
always at least twice as large as the integer type used to store digits.
.SH LIMITS
-.PP
The following are the limits on dc(1):
.TP
\f[B]DC_LONG_BIT\f[R]
@@ -1177,7 +1152,6 @@ large (at least on 64-bit machines) that there should not be any point
at which they become a problem.
In fact, memory should be exhausted before these limits should be hit.
.SH ENVIRONMENT VARIABLES
-.PP
As \f[B]non-portable extensions\f[R], dc(1) recognizes the following
environment variables:
.TP
@@ -1300,7 +1274,6 @@ This environment variable overrides the default, which can be queried
with the \f[B]-h\f[R] or \f[B]--help\f[R] options.
.RE
.SH EXIT STATUS
-.PP
dc(1) returns the following exit statuses:
.TP
\f[B]0\f[R]
@@ -1367,7 +1340,6 @@ These exit statuses allow dc(1) to be used in shell scripting with error
checking, and its normal behavior can be forced by using the
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.SH INTERACTIVE MODE
-.PP
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both \f[B]stdin\f[R]
and \f[B]stdout\f[R] are hooked to a terminal, but the \f[B]-i\f[R] flag
@@ -1380,7 +1352,6 @@ dc(1) may also reset on \f[B]SIGINT\f[R] instead of exit, depending on
the contents of, or default for, the \f[B]DC_SIGINT_RESET\f[R]
environment variable (see the \f[B]ENVIRONMENT VARIABLES\f[R] section).
.SH TTY MODE
-.PP
If \f[B]stdin\f[R], \f[B]stdout\f[R], and \f[B]stderr\f[R] are all
connected to a TTY, then \[lq]TTY mode\[rq] is considered to be
available, and thus, dc(1) can turn on TTY mode, subject to some
@@ -1404,7 +1375,6 @@ required in the bc(1) specification (see the \f[B]STANDARDS\f[R]
section), and interactive mode requires only \f[B]stdin\f[R] and
\f[B]stdout\f[R] to be connected to a terminal.
.SS Prompt
-.PP
If TTY mode is available, then a prompt can be enabled.
Like TTY mode itself, it can be turned on or off with an environment
variable: \f[B]DC_PROMPT\f[R] (see the \f[B]ENVIRONMENT VARIABLES\f[R]
@@ -1425,7 +1395,6 @@ and \f[B]--no-read-prompt\f[R] options.
See the \f[B]ENVIRONMENT VARIABLES\f[R] and \f[B]OPTIONS\f[R] sections
for more details.
.SH SIGNAL HANDLING
-.PP
Sending a \f[B]SIGINT\f[R] will cause dc(1) to do one of two things.
.PP
If dc(1) is not in interactive mode (see the \f[B]INTERACTIVE MODE\f[R]
@@ -1457,23 +1426,20 @@ the user to continue.
\f[B]SIGTERM\f[R] and \f[B]SIGQUIT\f[R] cause dc(1) to clean up and
exit, and it uses the default handler for all other signals.
.SH LOCALES
-.PP
This dc(1) ships with support for adding error messages for different
locales and thus, supports \f[B]LC_MESSAGES\f[R].
.SH SEE ALSO
-.PP
bc(1)
.SH STANDARDS
-.PP
The dc(1) utility operators and some behavior are compliant with the
operators in the IEEE Std 1003.1-2017 (\[lq]POSIX.1-2017\[rq]) bc(1)
specification at
https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html .
.SH BUGS
-.PP
None are known.
Report bugs at https://git.gavinhoward.com/gavin/bc .
.SH AUTHOR
-.PP
-Gavin D.
-Howard <gavin@gavinhoward.com> and contributors.
+Gavin D. Howard \c
+.MT gavin@gavinhoward.com
+.ME \c
+\ and contributors.
diff --git a/contrib/bc/manuals/dc/EHN.1 b/contrib/bc/manuals/dc/EHN.1
index efeb0bbaecf9..5df155cf5253 100644
--- a/contrib/bc/manuals/dc/EHN.1
+++ b/contrib/bc/manuals/dc/EHN.1
@@ -29,10 +29,8 @@
.nh
.ad l
.SH Name
-.PP
dc - arbitrary-precision decimal reverse-Polish notation calculator
.SH SYNOPSIS
-.PP
\f[B]dc\f[R] [\f[B]-cChiPRvVx\f[R]] [\f[B]--version\f[R]]
[\f[B]--help\f[R]] [\f[B]--digit-clamp\f[R]]
[\f[B]--no-digit-clamp\f[R]] [\f[B]--interactive\f[R]]
@@ -43,7 +41,6 @@ dc - arbitrary-precision decimal reverse-Polish notation calculator
[\f[B]--file\f[R]=\f[I]file\f[R]\&...]
[\f[I]file\f[R]\&...]
.SH DESCRIPTION
-.PP
dc(1) is an arbitrary-precision calculator.
It uses a stack (reverse Polish notation) to store numbers and results
of computations.
@@ -60,7 +57,6 @@ For example, if a user wants the \f[B]scale\f[R] always set to
\f[B]10\f[R], they can set \f[B]DC_ENV_ARGS\f[R] to \f[B]-e 10k\f[R],
and this dc(1) will always start with a \f[B]scale\f[R] of \f[B]10\f[R].
.SH OPTIONS
-.PP
The following are the options that dc(1) accepts.
.TP
\f[B]-C\f[R], \f[B]--no-digit-clamp\f[R]
@@ -261,7 +257,6 @@ This is a \f[B]non-portable extension\f[R].
.PP
All long options are \f[B]non-portable extensions\f[R].
.SH STDIN
-.PP
If no files are given on the command-line and no files or expressions
are given by the \f[B]-f\f[R], \f[B]--file\f[R], \f[B]-e\f[R], or
\f[B]--expression\f[R] options, then dc(1) reads from \f[B]stdin\f[R].
@@ -274,7 +269,6 @@ ended.
This means that, except for escaped brackets, all brackets must be
balanced before dc(1) parses and executes.
.SH STDOUT
-.PP
Any non-error output is written to \f[B]stdout\f[R].
In addition, if history (see the \f[B]HISTORY\f[R] section) and the
prompt (see the \f[B]TTY MODE\f[R] section) are enabled, both are output
@@ -283,7 +277,7 @@ to \f[B]stdout\f[R].
\f[B]Note\f[R]: Unlike other dc(1) implementations, this dc(1) will
issue a fatal error (see the \f[B]EXIT STATUS\f[R] section) if it cannot
write to \f[B]stdout\f[R], so if \f[B]stdout\f[R] is closed, as in
-\f[B]dc >&-\f[R], it will quit with an error.
+\f[B]dc >&-\f[R], it will quit with an error.
This is done so that dc(1) can report problems when \f[B]stdout\f[R] is
redirected to a file.
.PP
@@ -291,13 +285,12 @@ If there are scripts that depend on the behavior of other dc(1)
implementations, it is recommended that those scripts be changed to
redirect \f[B]stdout\f[R] to \f[B]/dev/null\f[R].
.SH STDERR
-.PP
Any error output is written to \f[B]stderr\f[R].
.PP
\f[B]Note\f[R]: Unlike other dc(1) implementations, this dc(1) will
issue a fatal error (see the \f[B]EXIT STATUS\f[R] section) if it cannot
write to \f[B]stderr\f[R], so if \f[B]stderr\f[R] is closed, as in
-\f[B]dc 2>&-\f[R], it will quit with an error.
+\f[B]dc 2>&-\f[R], it will quit with an error.
This is done so that dc(1) can exit with an error code when
\f[B]stderr\f[R] is redirected to a file.
.PP
@@ -305,7 +298,6 @@ If there are scripts that depend on the behavior of other dc(1)
implementations, it is recommended that those scripts be changed to
redirect \f[B]stderr\f[R] to \f[B]/dev/null\f[R].
.SH SYNTAX
-.PP
Each item in the input source code, either a number (see the
\f[B]NUMBERS\f[R] section) or a command (see the \f[B]COMMANDS\f[R]
section), is processed and executed, in order.
@@ -340,11 +332,9 @@ precision of any operations (with exceptions).
The max allowable value for \f[B]scale\f[R] can be queried in dc(1)
programs with the \f[B]V\f[R] command.
.SS Comments
-.PP
Comments go from \f[B]#\f[R] until, and not including, the next newline.
This is a \f[B]non-portable extension\f[R].
.SH NUMBERS
-.PP
Numbers are strings made up of digits, uppercase letters up to
\f[B]F\f[R], and at most \f[B]1\f[R] period for a radix.
Numbers can have up to \f[B]DC_NUM_MAX\f[R] digits.
@@ -391,10 +381,8 @@ value of \f[B]ibase\f[R].
If clamping is on, and the clamped value of a character is needed, use a
leading zero, i.e., for \f[B]A\f[R], use \f[B]0A\f[R].
.SH COMMANDS
-.PP
The valid commands are listed below.
.SS Printing
-.PP
These commands are used for printing.
.TP
\f[B]p\f[R]
@@ -431,7 +419,6 @@ without altering anything.
Users should use this command when they get lost.
.RE
.SS Arithmetic
-.PP
These are the commands used for arithmetic.
.TP
\f[B]+\f[R]
@@ -621,7 +608,6 @@ a short-circuit operator.
This is a \f[B]non-portable extension\f[R].
.RE
.SS Stack Control
-.PP
These commands control the stack.
.TP
\f[B]c\f[R]
@@ -637,7 +623,6 @@ Swaps (\[lq]reverses\[rq]) the two top items on the stack.
\f[B]R\f[R]
Pops (\[lq]removes\[rq]) the top value from the stack.
.SS Register Control
-.PP
These commands control registers (see the \f[B]REGISTERS\f[R] section).
.TP
\f[B]s\f[R]\f[I]r\f[R]
@@ -659,7 +644,6 @@ push it onto the main stack.
The previous value in the stack for register \f[I]r\f[R], if any, is now
accessible via the \f[B]l\f[R]\f[I]r\f[R] command.
.SS Parameters
-.PP
These commands control the values of \f[B]ibase\f[R], \f[B]obase\f[R],
and \f[B]scale\f[R].
Also see the \f[B]SYNTAX\f[R] section.
@@ -726,7 +710,6 @@ stack.
This is a \f[B]non-portable extension\f[R].
.RE
.SS Strings
-.PP
The following commands control strings.
.PP
dc(1) can work with both numbers and strings, and registers (see the
@@ -943,7 +926,6 @@ to make dc(1) exit with the \f[B]Q\f[R] command, so the sequence
This is a \f[B]non-portable extension\f[R].
.RE
.SS Status
-.PP
These commands query status of the stack or its top value.
.TP
\f[B]Z\f[R]
@@ -1004,7 +986,6 @@ This means that this command will never push \f[B]0\f[R].
This is a \f[B]non-portable extension\f[R].
.RE
.SS Arrays
-.PP
These commands manipulate arrays.
.TP
\f[B]:\f[R]\f[I]r\f[R]
@@ -1024,7 +1005,6 @@ Pushes the length of the array \f[I]r\f[R] onto the stack.
This is a \f[B]non-portable extension\f[R].
.RE
.SS Global Settings
-.PP
These commands retrieve global settings.
These are the only commands that require multiple specific characters,
and all of them begin with the letter \f[B]g\f[R].
@@ -1047,7 +1027,6 @@ Pushes \f[B]0\f[R] onto the stack if the leading zero setting has not
been enabled with the \f[B]-z\f[R] or \f[B]--leading-zeroes\f[R] options
(see the \f[B]OPTIONS\f[R] section), non-zero otherwise.
.SH REGISTERS
-.PP
Registers are names that can store strings, numbers, and arrays.
(Number/string registers do not interfere with array registers.)
.PP
@@ -1063,7 +1042,6 @@ The only exceptions are: a newline (\f[B]`\[rs]n'\f[R]) and a left
bracket (\f[B]`['\f[R]); it is a parse error for a newline or a left
bracket to be used as a register name.
.SS Extended Register Mode
-.PP
Unlike most other dc(1) implentations, this dc(1) provides nearly
unlimited amounts of registers, if extended register mode is enabled.
.PP
@@ -1078,7 +1056,6 @@ In that case, the register name is found according to the regex
\f[B][a-z][a-z0-9_]*\f[R] (like bc(1) identifiers), and it is a parse
error if the next non-space characters do not match that regex.
.SH RESET
-.PP
When dc(1) encounters an error or a signal that it has a non-default
handler for, it resets.
This means that several things happen.
@@ -1095,7 +1072,6 @@ Then, if it is interactive mode, and the error was not a fatal error
(see the \f[B]EXIT STATUS\f[R] section), it asks for more input;
otherwise, it exits with the appropriate return code.
.SH PERFORMANCE
-.PP
Most dc(1) implementations use \f[B]char\f[R] types to calculate the
value of \f[B]1\f[R] decimal digit at a time, but that can be slow.
This dc(1) does something different.
@@ -1115,7 +1091,6 @@ checking.
This integer type depends on the value of \f[B]DC_LONG_BIT\f[R], but is
always at least twice as large as the integer type used to store digits.
.SH LIMITS
-.PP
The following are the limits on dc(1):
.TP
\f[B]DC_LONG_BIT\f[R]
@@ -1177,7 +1152,6 @@ large (at least on 64-bit machines) that there should not be any point
at which they become a problem.
In fact, memory should be exhausted before these limits should be hit.
.SH ENVIRONMENT VARIABLES
-.PP
As \f[B]non-portable extensions\f[R], dc(1) recognizes the following
environment variables:
.TP
@@ -1300,7 +1274,6 @@ This environment variable overrides the default, which can be queried
with the \f[B]-h\f[R] or \f[B]--help\f[R] options.
.RE
.SH EXIT STATUS
-.PP
dc(1) returns the following exit statuses:
.TP
\f[B]0\f[R]
@@ -1367,7 +1340,6 @@ These exit statuses allow dc(1) to be used in shell scripting with error
checking, and its normal behavior can be forced by using the
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.SH INTERACTIVE MODE
-.PP
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both \f[B]stdin\f[R]
and \f[B]stdout\f[R] are hooked to a terminal, but the \f[B]-i\f[R] flag
@@ -1380,7 +1352,6 @@ dc(1) may also reset on \f[B]SIGINT\f[R] instead of exit, depending on
the contents of, or default for, the \f[B]DC_SIGINT_RESET\f[R]
environment variable (see the \f[B]ENVIRONMENT VARIABLES\f[R] section).
.SH TTY MODE
-.PP
If \f[B]stdin\f[R], \f[B]stdout\f[R], and \f[B]stderr\f[R] are all
connected to a TTY, then \[lq]TTY mode\[rq] is considered to be
available, and thus, dc(1) can turn on TTY mode, subject to some
@@ -1404,7 +1375,6 @@ required in the bc(1) specification (see the \f[B]STANDARDS\f[R]
section), and interactive mode requires only \f[B]stdin\f[R] and
\f[B]stdout\f[R] to be connected to a terminal.
.SS Prompt
-.PP
If TTY mode is available, then a prompt can be enabled.
Like TTY mode itself, it can be turned on or off with an environment
variable: \f[B]DC_PROMPT\f[R] (see the \f[B]ENVIRONMENT VARIABLES\f[R]
@@ -1425,7 +1395,6 @@ and \f[B]--no-read-prompt\f[R] options.
See the \f[B]ENVIRONMENT VARIABLES\f[R] and \f[B]OPTIONS\f[R] sections
for more details.
.SH SIGNAL HANDLING
-.PP
Sending a \f[B]SIGINT\f[R] will cause dc(1) to do one of two things.
.PP
If dc(1) is not in interactive mode (see the \f[B]INTERACTIVE MODE\f[R]
@@ -1457,19 +1426,17 @@ the user to continue.
\f[B]SIGTERM\f[R] and \f[B]SIGQUIT\f[R] cause dc(1) to clean up and
exit, and it uses the default handler for all other signals.
.SH SEE ALSO
-.PP
bc(1)
.SH STANDARDS
-.PP
The dc(1) utility operators and some behavior are compliant with the
operators in the IEEE Std 1003.1-2017 (\[lq]POSIX.1-2017\[rq]) bc(1)
specification at
https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html .
.SH BUGS
-.PP
None are known.
Report bugs at https://git.gavinhoward.com/gavin/bc .
.SH AUTHOR
-.PP
-Gavin D.
-Howard <gavin@gavinhoward.com> and contributors.
+Gavin D. Howard \c
+.MT gavin@gavinhoward.com
+.ME \c
+\ and contributors.
diff --git a/contrib/bc/manuals/dc/EN.1 b/contrib/bc/manuals/dc/EN.1
index ce1e6b9be79c..8cdefc2b3522 100644
--- a/contrib/bc/manuals/dc/EN.1
+++ b/contrib/bc/manuals/dc/EN.1
@@ -29,10 +29,8 @@
.nh
.ad l
.SH Name
-.PP
dc - arbitrary-precision decimal reverse-Polish notation calculator
.SH SYNOPSIS
-.PP
\f[B]dc\f[R] [\f[B]-cChiPRvVx\f[R]] [\f[B]--version\f[R]]
[\f[B]--help\f[R]] [\f[B]--digit-clamp\f[R]]
[\f[B]--no-digit-clamp\f[R]] [\f[B]--interactive\f[R]]
@@ -43,7 +41,6 @@ dc - arbitrary-precision decimal reverse-Polish notation calculator
[\f[B]--file\f[R]=\f[I]file\f[R]\&...]
[\f[I]file\f[R]\&...]
.SH DESCRIPTION
-.PP
dc(1) is an arbitrary-precision calculator.
It uses a stack (reverse Polish notation) to store numbers and results
of computations.
@@ -60,7 +57,6 @@ For example, if a user wants the \f[B]scale\f[R] always set to
\f[B]10\f[R], they can set \f[B]DC_ENV_ARGS\f[R] to \f[B]-e 10k\f[R],
and this dc(1) will always start with a \f[B]scale\f[R] of \f[B]10\f[R].
.SH OPTIONS
-.PP
The following are the options that dc(1) accepts.
.TP
\f[B]-C\f[R], \f[B]--no-digit-clamp\f[R]
@@ -261,7 +257,6 @@ This is a \f[B]non-portable extension\f[R].
.PP
All long options are \f[B]non-portable extensions\f[R].
.SH STDIN
-.PP
If no files are given on the command-line and no files or expressions
are given by the \f[B]-f\f[R], \f[B]--file\f[R], \f[B]-e\f[R], or
\f[B]--expression\f[R] options, then dc(1) reads from \f[B]stdin\f[R].
@@ -274,7 +269,6 @@ ended.
This means that, except for escaped brackets, all brackets must be
balanced before dc(1) parses and executes.
.SH STDOUT
-.PP
Any non-error output is written to \f[B]stdout\f[R].
In addition, if history (see the \f[B]HISTORY\f[R] section) and the
prompt (see the \f[B]TTY MODE\f[R] section) are enabled, both are output
@@ -283,7 +277,7 @@ to \f[B]stdout\f[R].
\f[B]Note\f[R]: Unlike other dc(1) implementations, this dc(1) will
issue a fatal error (see the \f[B]EXIT STATUS\f[R] section) if it cannot
write to \f[B]stdout\f[R], so if \f[B]stdout\f[R] is closed, as in
-\f[B]dc >&-\f[R], it will quit with an error.
+\f[B]dc >&-\f[R], it will quit with an error.
This is done so that dc(1) can report problems when \f[B]stdout\f[R] is
redirected to a file.
.PP
@@ -291,13 +285,12 @@ If there are scripts that depend on the behavior of other dc(1)
implementations, it is recommended that those scripts be changed to
redirect \f[B]stdout\f[R] to \f[B]/dev/null\f[R].
.SH STDERR
-.PP
Any error output is written to \f[B]stderr\f[R].
.PP
\f[B]Note\f[R]: Unlike other dc(1) implementations, this dc(1) will
issue a fatal error (see the \f[B]EXIT STATUS\f[R] section) if it cannot
write to \f[B]stderr\f[R], so if \f[B]stderr\f[R] is closed, as in
-\f[B]dc 2>&-\f[R], it will quit with an error.
+\f[B]dc 2>&-\f[R], it will quit with an error.
This is done so that dc(1) can exit with an error code when
\f[B]stderr\f[R] is redirected to a file.
.PP
@@ -305,7 +298,6 @@ If there are scripts that depend on the behavior of other dc(1)
implementations, it is recommended that those scripts be changed to
redirect \f[B]stderr\f[R] to \f[B]/dev/null\f[R].
.SH SYNTAX
-.PP
Each item in the input source code, either a number (see the
\f[B]NUMBERS\f[R] section) or a command (see the \f[B]COMMANDS\f[R]
section), is processed and executed, in order.
@@ -340,11 +332,9 @@ precision of any operations (with exceptions).
The max allowable value for \f[B]scale\f[R] can be queried in dc(1)
programs with the \f[B]V\f[R] command.
.SS Comments
-.PP
Comments go from \f[B]#\f[R] until, and not including, the next newline.
This is a \f[B]non-portable extension\f[R].
.SH NUMBERS
-.PP
Numbers are strings made up of digits, uppercase letters up to
\f[B]F\f[R], and at most \f[B]1\f[R] period for a radix.
Numbers can have up to \f[B]DC_NUM_MAX\f[R] digits.
@@ -391,10 +381,8 @@ value of \f[B]ibase\f[R].
If clamping is on, and the clamped value of a character is needed, use a
leading zero, i.e., for \f[B]A\f[R], use \f[B]0A\f[R].
.SH COMMANDS
-.PP
The valid commands are listed below.
.SS Printing
-.PP
These commands are used for printing.
.TP
\f[B]p\f[R]
@@ -431,7 +419,6 @@ without altering anything.
Users should use this command when they get lost.
.RE
.SS Arithmetic
-.PP
These are the commands used for arithmetic.
.TP
\f[B]+\f[R]
@@ -621,7 +608,6 @@ a short-circuit operator.
This is a \f[B]non-portable extension\f[R].
.RE
.SS Stack Control
-.PP
These commands control the stack.
.TP
\f[B]c\f[R]
@@ -637,7 +623,6 @@ Swaps (\[lq]reverses\[rq]) the two top items on the stack.
\f[B]R\f[R]
Pops (\[lq]removes\[rq]) the top value from the stack.
.SS Register Control
-.PP
These commands control registers (see the \f[B]REGISTERS\f[R] section).
.TP
\f[B]s\f[R]\f[I]r\f[R]
@@ -659,7 +644,6 @@ push it onto the main stack.
The previous value in the stack for register \f[I]r\f[R], if any, is now
accessible via the \f[B]l\f[R]\f[I]r\f[R] command.
.SS Parameters
-.PP
These commands control the values of \f[B]ibase\f[R], \f[B]obase\f[R],
and \f[B]scale\f[R].
Also see the \f[B]SYNTAX\f[R] section.
@@ -726,7 +710,6 @@ stack.
This is a \f[B]non-portable extension\f[R].
.RE
.SS Strings
-.PP
The following commands control strings.
.PP
dc(1) can work with both numbers and strings, and registers (see the
@@ -943,7 +926,6 @@ to make dc(1) exit with the \f[B]Q\f[R] command, so the sequence
This is a \f[B]non-portable extension\f[R].
.RE
.SS Status
-.PP
These commands query status of the stack or its top value.
.TP
\f[B]Z\f[R]
@@ -1004,7 +986,6 @@ This means that this command will never push \f[B]0\f[R].
This is a \f[B]non-portable extension\f[R].
.RE
.SS Arrays
-.PP
These commands manipulate arrays.
.TP
\f[B]:\f[R]\f[I]r\f[R]
@@ -1024,7 +1005,6 @@ Pushes the length of the array \f[I]r\f[R] onto the stack.
This is a \f[B]non-portable extension\f[R].
.RE
.SS Global Settings
-.PP
These commands retrieve global settings.
These are the only commands that require multiple specific characters,
and all of them begin with the letter \f[B]g\f[R].
@@ -1047,7 +1027,6 @@ Pushes \f[B]0\f[R] onto the stack if the leading zero setting has not
been enabled with the \f[B]-z\f[R] or \f[B]--leading-zeroes\f[R] options
(see the \f[B]OPTIONS\f[R] section), non-zero otherwise.
.SH REGISTERS
-.PP
Registers are names that can store strings, numbers, and arrays.
(Number/string registers do not interfere with array registers.)
.PP
@@ -1063,7 +1042,6 @@ The only exceptions are: a newline (\f[B]`\[rs]n'\f[R]) and a left
bracket (\f[B]`['\f[R]); it is a parse error for a newline or a left
bracket to be used as a register name.
.SS Extended Register Mode
-.PP
Unlike most other dc(1) implentations, this dc(1) provides nearly
unlimited amounts of registers, if extended register mode is enabled.
.PP
@@ -1078,7 +1056,6 @@ In that case, the register name is found according to the regex
\f[B][a-z][a-z0-9_]*\f[R] (like bc(1) identifiers), and it is a parse
error if the next non-space characters do not match that regex.
.SH RESET
-.PP
When dc(1) encounters an error or a signal that it has a non-default
handler for, it resets.
This means that several things happen.
@@ -1095,7 +1072,6 @@ Then, if it is interactive mode, and the error was not a fatal error
(see the \f[B]EXIT STATUS\f[R] section), it asks for more input;
otherwise, it exits with the appropriate return code.
.SH PERFORMANCE
-.PP
Most dc(1) implementations use \f[B]char\f[R] types to calculate the
value of \f[B]1\f[R] decimal digit at a time, but that can be slow.
This dc(1) does something different.
@@ -1115,7 +1091,6 @@ checking.
This integer type depends on the value of \f[B]DC_LONG_BIT\f[R], but is
always at least twice as large as the integer type used to store digits.
.SH LIMITS
-.PP
The following are the limits on dc(1):
.TP
\f[B]DC_LONG_BIT\f[R]
@@ -1177,7 +1152,6 @@ large (at least on 64-bit machines) that there should not be any point
at which they become a problem.
In fact, memory should be exhausted before these limits should be hit.
.SH ENVIRONMENT VARIABLES
-.PP
As \f[B]non-portable extensions\f[R], dc(1) recognizes the following
environment variables:
.TP
@@ -1300,7 +1274,6 @@ This environment variable overrides the default, which can be queried
with the \f[B]-h\f[R] or \f[B]--help\f[R] options.
.RE
.SH EXIT STATUS
-.PP
dc(1) returns the following exit statuses:
.TP
\f[B]0\f[R]
@@ -1367,7 +1340,6 @@ These exit statuses allow dc(1) to be used in shell scripting with error
checking, and its normal behavior can be forced by using the
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.SH INTERACTIVE MODE
-.PP
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both \f[B]stdin\f[R]
and \f[B]stdout\f[R] are hooked to a terminal, but the \f[B]-i\f[R] flag
@@ -1380,7 +1352,6 @@ dc(1) may also reset on \f[B]SIGINT\f[R] instead of exit, depending on
the contents of, or default for, the \f[B]DC_SIGINT_RESET\f[R]
environment variable (see the \f[B]ENVIRONMENT VARIABLES\f[R] section).
.SH TTY MODE
-.PP
If \f[B]stdin\f[R], \f[B]stdout\f[R], and \f[B]stderr\f[R] are all
connected to a TTY, then \[lq]TTY mode\[rq] is considered to be
available, and thus, dc(1) can turn on TTY mode, subject to some
@@ -1404,7 +1375,6 @@ required in the bc(1) specification (see the \f[B]STANDARDS\f[R]
section), and interactive mode requires only \f[B]stdin\f[R] and
\f[B]stdout\f[R] to be connected to a terminal.
.SS Command-Line History
-.PP
Command-line history is only enabled if TTY mode is, i.e., that
\f[B]stdin\f[R], \f[B]stdout\f[R], and \f[B]stderr\f[R] are connected to
a TTY and the \f[B]DC_TTY_MODE\f[R] environment variable (see the
@@ -1412,7 +1382,6 @@ a TTY and the \f[B]DC_TTY_MODE\f[R] environment variable (see the
TTY mode.
See the \f[B]COMMAND LINE HISTORY\f[R] section for more information.
.SS Prompt
-.PP
If TTY mode is available, then a prompt can be enabled.
Like TTY mode itself, it can be turned on or off with an environment
variable: \f[B]DC_PROMPT\f[R] (see the \f[B]ENVIRONMENT VARIABLES\f[R]
@@ -1433,7 +1402,6 @@ and \f[B]--no-read-prompt\f[R] options.
See the \f[B]ENVIRONMENT VARIABLES\f[R] and \f[B]OPTIONS\f[R] sections
for more details.
.SH SIGNAL HANDLING
-.PP
Sending a \f[B]SIGINT\f[R] will cause dc(1) to do one of two things.
.PP
If dc(1) is not in interactive mode (see the \f[B]INTERACTIVE MODE\f[R]
@@ -1468,7 +1436,6 @@ The one exception is \f[B]SIGHUP\f[R]; in that case, and only when dc(1)
is in TTY mode (see the \f[B]TTY MODE\f[R] section), a \f[B]SIGHUP\f[R]
will cause dc(1) to clean up and exit.
.SH COMMAND LINE HISTORY
-.PP
dc(1) supports interactive command-line editing.
.PP
If dc(1) can be in TTY mode (see the \f[B]TTY MODE\f[R] section),
@@ -1483,19 +1450,17 @@ section).
.PP
\f[B]Note\f[R]: tabs are converted to 8 spaces.
.SH SEE ALSO
-.PP
bc(1)
.SH STANDARDS
-.PP
The dc(1) utility operators and some behavior are compliant with the
operators in the IEEE Std 1003.1-2017 (\[lq]POSIX.1-2017\[rq]) bc(1)
specification at
https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html .
.SH BUGS
-.PP
None are known.
Report bugs at https://git.gavinhoward.com/gavin/bc .
.SH AUTHOR
-.PP
-Gavin D.
-Howard <gavin@gavinhoward.com> and contributors.
+Gavin D. Howard \c
+.MT gavin@gavinhoward.com
+.ME \c
+\ and contributors.
diff --git a/contrib/bc/manuals/dc/H.1 b/contrib/bc/manuals/dc/H.1
index 8baa0b74316e..caa81645addd 100644
--- a/contrib/bc/manuals/dc/H.1
+++ b/contrib/bc/manuals/dc/H.1
@@ -29,10 +29,8 @@
.nh
.ad l
.SH Name
-.PP
dc - arbitrary-precision decimal reverse-Polish notation calculator
.SH SYNOPSIS
-.PP
\f[B]dc\f[R] [\f[B]-cChiPRvVx\f[R]] [\f[B]--version\f[R]]
[\f[B]--help\f[R]] [\f[B]--digit-clamp\f[R]]
[\f[B]--no-digit-clamp\f[R]] [\f[B]--interactive\f[R]]
@@ -47,7 +45,6 @@ dc - arbitrary-precision decimal reverse-Polish notation calculator
[\f[B]-S\f[R] \f[I]scale\f[R]] [\f[B]--scale\f[R]=\f[I]scale\f[R]]
[\f[B]-E\f[R] \f[I]seed\f[R]] [\f[B]--seed\f[R]=\f[I]seed\f[R]]
.SH DESCRIPTION
-.PP
dc(1) is an arbitrary-precision calculator.
It uses a stack (reverse Polish notation) to store numbers and results
of computations.
@@ -64,7 +61,6 @@ For example, if a user wants the \f[B]scale\f[R] always set to
\f[B]10\f[R], they can set \f[B]DC_ENV_ARGS\f[R] to \f[B]-e 10k\f[R],
and this dc(1) will always start with a \f[B]scale\f[R] of \f[B]10\f[R].
.SH OPTIONS
-.PP
The following are the options that dc(1) accepts.
.TP
\f[B]-C\f[R], \f[B]--no-digit-clamp\f[R]
@@ -276,7 +272,6 @@ This is a \f[B]non-portable extension\f[R].
.PP
All long options are \f[B]non-portable extensions\f[R].
.SH STDIN
-.PP
If no files are given on the command-line and no files or expressions
are given by the \f[B]-f\f[R], \f[B]--file\f[R], \f[B]-e\f[R], or
\f[B]--expression\f[R] options, then dc(1) reads from \f[B]stdin\f[R].
@@ -289,7 +284,6 @@ ended.
This means that, except for escaped brackets, all brackets must be
balanced before dc(1) parses and executes.
.SH STDOUT
-.PP
Any non-error output is written to \f[B]stdout\f[R].
In addition, if history (see the \f[B]HISTORY\f[R] section) and the
prompt (see the \f[B]TTY MODE\f[R] section) are enabled, both are output
@@ -298,7 +292,7 @@ to \f[B]stdout\f[R].
\f[B]Note\f[R]: Unlike other dc(1) implementations, this dc(1) will
issue a fatal error (see the \f[B]EXIT STATUS\f[R] section) if it cannot
write to \f[B]stdout\f[R], so if \f[B]stdout\f[R] is closed, as in
-\f[B]dc >&-\f[R], it will quit with an error.
+\f[B]dc >&-\f[R], it will quit with an error.
This is done so that dc(1) can report problems when \f[B]stdout\f[R] is
redirected to a file.
.PP
@@ -306,13 +300,12 @@ If there are scripts that depend on the behavior of other dc(1)
implementations, it is recommended that those scripts be changed to
redirect \f[B]stdout\f[R] to \f[B]/dev/null\f[R].
.SH STDERR
-.PP
Any error output is written to \f[B]stderr\f[R].
.PP
\f[B]Note\f[R]: Unlike other dc(1) implementations, this dc(1) will
issue a fatal error (see the \f[B]EXIT STATUS\f[R] section) if it cannot
write to \f[B]stderr\f[R], so if \f[B]stderr\f[R] is closed, as in
-\f[B]dc 2>&-\f[R], it will quit with an error.
+\f[B]dc 2>&-\f[R], it will quit with an error.
This is done so that dc(1) can exit with an error code when
\f[B]stderr\f[R] is redirected to a file.
.PP
@@ -320,7 +313,6 @@ If there are scripts that depend on the behavior of other dc(1)
implementations, it is recommended that those scripts be changed to
redirect \f[B]stderr\f[R] to \f[B]/dev/null\f[R].
.SH SYNTAX
-.PP
Each item in the input source code, either a number (see the
\f[B]NUMBERS\f[R] section) or a command (see the \f[B]COMMANDS\f[R]
section), is processed and executed, in order.
@@ -393,11 +385,9 @@ In any other case, use a non-seeded pseudo-random number generator.
The pseudo-random number generator, \f[B]seed\f[R], and all associated
operations are \f[B]non-portable extensions\f[R].
.SS Comments
-.PP
Comments go from \f[B]#\f[R] until, and not including, the next newline.
This is a \f[B]non-portable extension\f[R].
.SH NUMBERS
-.PP
Numbers are strings made up of digits, uppercase letters up to
\f[B]F\f[R], and at most \f[B]1\f[R] period for a radix.
Numbers can have up to \f[B]DC_NUM_MAX\f[R] digits.
@@ -464,10 +454,8 @@ number string \f[B]FFeA\f[R], the resulting decimal number will be
Accepting input as scientific notation is a \f[B]non-portable
extension\f[R].
.SH COMMANDS
-.PP
The valid commands are listed below.
.SS Printing
-.PP
These commands are used for printing.
.PP
Note that both scientific notation and engineering notation are
@@ -515,7 +503,6 @@ without altering anything.
Users should use this command when they get lost.
.RE
.SS Arithmetic
-.PP
These are the commands used for arithmetic.
.TP
\f[B]+\f[R]
@@ -747,7 +734,6 @@ a short-circuit operator.
This is a \f[B]non-portable extension\f[R].
.RE
.SS Pseudo-Random Number Generator
-.PP
dc(1) has a built-in pseudo-random number generator.
These commands query the pseudo-random number generator.
(See Parameters for more information about the \f[B]seed\f[R] value that
@@ -791,7 +777,6 @@ limitations of the pseudo-random number generator.
This is a \f[B]non-portable extension\f[R].
.RE
.SS Stack Control
-.PP
These commands control the stack.
.TP
\f[B]c\f[R]
@@ -807,7 +792,6 @@ Swaps (\[lq]reverses\[rq]) the two top items on the stack.
\f[B]R\f[R]
Pops (\[lq]removes\[rq]) the top value from the stack.
.SS Register Control
-.PP
These commands control registers (see the \f[B]REGISTERS\f[R] section).
.TP
\f[B]s\f[R]\f[I]r\f[R]
@@ -829,7 +813,6 @@ push it onto the main stack.
The previous value in the stack for register \f[I]r\f[R], if any, is now
accessible via the \f[B]l\f[R]\f[I]r\f[R] command.
.SS Parameters
-.PP
These commands control the values of \f[B]ibase\f[R], \f[B]obase\f[R],
\f[B]scale\f[R], and \f[B]seed\f[R].
Also see the \f[B]SYNTAX\f[R] section.
@@ -941,7 +924,6 @@ Pushes the maximum (inclusive) integer that can be generated with the
This is a \f[B]non-portable extension\f[R].
.RE
.SS Strings
-.PP
The following commands control strings.
.PP
dc(1) can work with both numbers and strings, and registers (see the
@@ -1158,7 +1140,6 @@ to make dc(1) exit with the \f[B]Q\f[R] command, so the sequence
This is a \f[B]non-portable extension\f[R].
.RE
.SS Status
-.PP
These commands query status of the stack or its top value.
.TP
\f[B]Z\f[R]
@@ -1219,7 +1200,6 @@ This means that this command will never push \f[B]0\f[R].
This is a \f[B]non-portable extension\f[R].
.RE
.SS Arrays
-.PP
These commands manipulate arrays.
.TP
\f[B]:\f[R]\f[I]r\f[R]
@@ -1239,7 +1219,6 @@ Pushes the length of the array \f[I]r\f[R] onto the stack.
This is a \f[B]non-portable extension\f[R].
.RE
.SS Global Settings
-.PP
These commands retrieve global settings.
These are the only commands that require multiple specific characters,
and all of them begin with the letter \f[B]g\f[R].
@@ -1262,7 +1241,6 @@ Pushes \f[B]0\f[R] onto the stack if the leading zero setting has not
been enabled with the \f[B]-z\f[R] or \f[B]--leading-zeroes\f[R] options
(see the \f[B]OPTIONS\f[R] section), non-zero otherwise.
.SH REGISTERS
-.PP
Registers are names that can store strings, numbers, and arrays.
(Number/string registers do not interfere with array registers.)
.PP
@@ -1278,7 +1256,6 @@ The only exceptions are: a newline (\f[B]`\[rs]n'\f[R]) and a left
bracket (\f[B]`['\f[R]); it is a parse error for a newline or a left
bracket to be used as a register name.
.SS Extended Register Mode
-.PP
Unlike most other dc(1) implentations, this dc(1) provides nearly
unlimited amounts of registers, if extended register mode is enabled.
.PP
@@ -1293,7 +1270,6 @@ In that case, the register name is found according to the regex
\f[B][a-z][a-z0-9_]*\f[R] (like bc(1) identifiers), and it is a parse
error if the next non-space characters do not match that regex.
.SH RESET
-.PP
When dc(1) encounters an error or a signal that it has a non-default
handler for, it resets.
This means that several things happen.
@@ -1310,7 +1286,6 @@ Then, if it is interactive mode, and the error was not a fatal error
(see the \f[B]EXIT STATUS\f[R] section), it asks for more input;
otherwise, it exits with the appropriate return code.
.SH PERFORMANCE
-.PP
Most dc(1) implementations use \f[B]char\f[R] types to calculate the
value of \f[B]1\f[R] decimal digit at a time, but that can be slow.
This dc(1) does something different.
@@ -1330,7 +1305,6 @@ checking.
This integer type depends on the value of \f[B]DC_LONG_BIT\f[R], but is
always at least twice as large as the integer type used to store digits.
.SH LIMITS
-.PP
The following are the limits on dc(1):
.TP
\f[B]DC_LONG_BIT\f[R]
@@ -1397,7 +1371,6 @@ large (at least on 64-bit machines) that there should not be any point
at which they become a problem.
In fact, memory should be exhausted before these limits should be hit.
.SH ENVIRONMENT VARIABLES
-.PP
As \f[B]non-portable extensions\f[R], dc(1) recognizes the following
environment variables:
.TP
@@ -1520,7 +1493,6 @@ This environment variable overrides the default, which can be queried
with the \f[B]-h\f[R] or \f[B]--help\f[R] options.
.RE
.SH EXIT STATUS
-.PP
dc(1) returns the following exit statuses:
.TP
\f[B]0\f[R]
@@ -1589,7 +1561,6 @@ These exit statuses allow dc(1) to be used in shell scripting with error
checking, and its normal behavior can be forced by using the
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.SH INTERACTIVE MODE
-.PP
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both \f[B]stdin\f[R]
and \f[B]stdout\f[R] are hooked to a terminal, but the \f[B]-i\f[R] flag
@@ -1602,7 +1573,6 @@ dc(1) may also reset on \f[B]SIGINT\f[R] instead of exit, depending on
the contents of, or default for, the \f[B]DC_SIGINT_RESET\f[R]
environment variable (see the \f[B]ENVIRONMENT VARIABLES\f[R] section).
.SH TTY MODE
-.PP
If \f[B]stdin\f[R], \f[B]stdout\f[R], and \f[B]stderr\f[R] are all
connected to a TTY, then \[lq]TTY mode\[rq] is considered to be
available, and thus, dc(1) can turn on TTY mode, subject to some
@@ -1626,7 +1596,6 @@ required in the bc(1) specification (see the \f[B]STANDARDS\f[R]
section), and interactive mode requires only \f[B]stdin\f[R] and
\f[B]stdout\f[R] to be connected to a terminal.
.SS Prompt
-.PP
If TTY mode is available, then a prompt can be enabled.
Like TTY mode itself, it can be turned on or off with an environment
variable: \f[B]DC_PROMPT\f[R] (see the \f[B]ENVIRONMENT VARIABLES\f[R]
@@ -1647,7 +1616,6 @@ and \f[B]--no-read-prompt\f[R] options.
See the \f[B]ENVIRONMENT VARIABLES\f[R] and \f[B]OPTIONS\f[R] sections
for more details.
.SH SIGNAL HANDLING
-.PP
Sending a \f[B]SIGINT\f[R] will cause dc(1) to do one of two things.
.PP
If dc(1) is not in interactive mode (see the \f[B]INTERACTIVE MODE\f[R]
@@ -1679,23 +1647,20 @@ the user to continue.
\f[B]SIGTERM\f[R] and \f[B]SIGQUIT\f[R] cause dc(1) to clean up and
exit, and it uses the default handler for all other signals.
.SH LOCALES
-.PP
This dc(1) ships with support for adding error messages for different
locales and thus, supports \f[B]LC_MESSAGES\f[R].
.SH SEE ALSO
-.PP
bc(1)
.SH STANDARDS
-.PP
The dc(1) utility operators and some behavior are compliant with the
operators in the IEEE Std 1003.1-2017 (\[lq]POSIX.1-2017\[rq]) bc(1)
specification at
https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html .
.SH BUGS
-.PP
None are known.
Report bugs at https://git.gavinhoward.com/gavin/bc .
.SH AUTHOR
-.PP
-Gavin D.
-Howard <gavin@gavinhoward.com> and contributors.
+Gavin D. Howard \c
+.MT gavin@gavinhoward.com
+.ME \c
+\ and contributors.
diff --git a/contrib/bc/manuals/dc/HN.1 b/contrib/bc/manuals/dc/HN.1
index 2a3926309868..cdfa4ad82617 100644
--- a/contrib/bc/manuals/dc/HN.1
+++ b/contrib/bc/manuals/dc/HN.1
@@ -29,10 +29,8 @@
.nh
.ad l
.SH Name
-.PP
dc - arbitrary-precision decimal reverse-Polish notation calculator
.SH SYNOPSIS
-.PP
\f[B]dc\f[R] [\f[B]-cChiPRvVx\f[R]] [\f[B]--version\f[R]]
[\f[B]--help\f[R]] [\f[B]--digit-clamp\f[R]]
[\f[B]--no-digit-clamp\f[R]] [\f[B]--interactive\f[R]]
@@ -47,7 +45,6 @@ dc - arbitrary-precision decimal reverse-Polish notation calculator
[\f[B]-S\f[R] \f[I]scale\f[R]] [\f[B]--scale\f[R]=\f[I]scale\f[R]]
[\f[B]-E\f[R] \f[I]seed\f[R]] [\f[B]--seed\f[R]=\f[I]seed\f[R]]
.SH DESCRIPTION
-.PP
dc(1) is an arbitrary-precision calculator.
It uses a stack (reverse Polish notation) to store numbers and results
of computations.
@@ -64,7 +61,6 @@ For example, if a user wants the \f[B]scale\f[R] always set to
\f[B]10\f[R], they can set \f[B]DC_ENV_ARGS\f[R] to \f[B]-e 10k\f[R],
and this dc(1) will always start with a \f[B]scale\f[R] of \f[B]10\f[R].
.SH OPTIONS
-.PP
The following are the options that dc(1) accepts.
.TP
\f[B]-C\f[R], \f[B]--no-digit-clamp\f[R]
@@ -276,7 +272,6 @@ This is a \f[B]non-portable extension\f[R].
.PP
All long options are \f[B]non-portable extensions\f[R].
.SH STDIN
-.PP
If no files are given on the command-line and no files or expressions
are given by the \f[B]-f\f[R], \f[B]--file\f[R], \f[B]-e\f[R], or
\f[B]--expression\f[R] options, then dc(1) reads from \f[B]stdin\f[R].
@@ -289,7 +284,6 @@ ended.
This means that, except for escaped brackets, all brackets must be
balanced before dc(1) parses and executes.
.SH STDOUT
-.PP
Any non-error output is written to \f[B]stdout\f[R].
In addition, if history (see the \f[B]HISTORY\f[R] section) and the
prompt (see the \f[B]TTY MODE\f[R] section) are enabled, both are output
@@ -298,7 +292,7 @@ to \f[B]stdout\f[R].
\f[B]Note\f[R]: Unlike other dc(1) implementations, this dc(1) will
issue a fatal error (see the \f[B]EXIT STATUS\f[R] section) if it cannot
write to \f[B]stdout\f[R], so if \f[B]stdout\f[R] is closed, as in
-\f[B]dc >&-\f[R], it will quit with an error.
+\f[B]dc >&-\f[R], it will quit with an error.
This is done so that dc(1) can report problems when \f[B]stdout\f[R] is
redirected to a file.
.PP
@@ -306,13 +300,12 @@ If there are scripts that depend on the behavior of other dc(1)
implementations, it is recommended that those scripts be changed to
redirect \f[B]stdout\f[R] to \f[B]/dev/null\f[R].
.SH STDERR
-.PP
Any error output is written to \f[B]stderr\f[R].
.PP
\f[B]Note\f[R]: Unlike other dc(1) implementations, this dc(1) will
issue a fatal error (see the \f[B]EXIT STATUS\f[R] section) if it cannot
write to \f[B]stderr\f[R], so if \f[B]stderr\f[R] is closed, as in
-\f[B]dc 2>&-\f[R], it will quit with an error.
+\f[B]dc 2>&-\f[R], it will quit with an error.
This is done so that dc(1) can exit with an error code when
\f[B]stderr\f[R] is redirected to a file.
.PP
@@ -320,7 +313,6 @@ If there are scripts that depend on the behavior of other dc(1)
implementations, it is recommended that those scripts be changed to
redirect \f[B]stderr\f[R] to \f[B]/dev/null\f[R].
.SH SYNTAX
-.PP
Each item in the input source code, either a number (see the
\f[B]NUMBERS\f[R] section) or a command (see the \f[B]COMMANDS\f[R]
section), is processed and executed, in order.
@@ -393,11 +385,9 @@ In any other case, use a non-seeded pseudo-random number generator.
The pseudo-random number generator, \f[B]seed\f[R], and all associated
operations are \f[B]non-portable extensions\f[R].
.SS Comments
-.PP
Comments go from \f[B]#\f[R] until, and not including, the next newline.
This is a \f[B]non-portable extension\f[R].
.SH NUMBERS
-.PP
Numbers are strings made up of digits, uppercase letters up to
\f[B]F\f[R], and at most \f[B]1\f[R] period for a radix.
Numbers can have up to \f[B]DC_NUM_MAX\f[R] digits.
@@ -464,10 +454,8 @@ number string \f[B]FFeA\f[R], the resulting decimal number will be
Accepting input as scientific notation is a \f[B]non-portable
extension\f[R].
.SH COMMANDS
-.PP
The valid commands are listed below.
.SS Printing
-.PP
These commands are used for printing.
.PP
Note that both scientific notation and engineering notation are
@@ -515,7 +503,6 @@ without altering anything.
Users should use this command when they get lost.
.RE
.SS Arithmetic
-.PP
These are the commands used for arithmetic.
.TP
\f[B]+\f[R]
@@ -747,7 +734,6 @@ a short-circuit operator.
This is a \f[B]non-portable extension\f[R].
.RE
.SS Pseudo-Random Number Generator
-.PP
dc(1) has a built-in pseudo-random number generator.
These commands query the pseudo-random number generator.
(See Parameters for more information about the \f[B]seed\f[R] value that
@@ -791,7 +777,6 @@ limitations of the pseudo-random number generator.
This is a \f[B]non-portable extension\f[R].
.RE
.SS Stack Control
-.PP
These commands control the stack.
.TP
\f[B]c\f[R]
@@ -807,7 +792,6 @@ Swaps (\[lq]reverses\[rq]) the two top items on the stack.
\f[B]R\f[R]
Pops (\[lq]removes\[rq]) the top value from the stack.
.SS Register Control
-.PP
These commands control registers (see the \f[B]REGISTERS\f[R] section).
.TP
\f[B]s\f[R]\f[I]r\f[R]
@@ -829,7 +813,6 @@ push it onto the main stack.
The previous value in the stack for register \f[I]r\f[R], if any, is now
accessible via the \f[B]l\f[R]\f[I]r\f[R] command.
.SS Parameters
-.PP
These commands control the values of \f[B]ibase\f[R], \f[B]obase\f[R],
\f[B]scale\f[R], and \f[B]seed\f[R].
Also see the \f[B]SYNTAX\f[R] section.
@@ -941,7 +924,6 @@ Pushes the maximum (inclusive) integer that can be generated with the
This is a \f[B]non-portable extension\f[R].
.RE
.SS Strings
-.PP
The following commands control strings.
.PP
dc(1) can work with both numbers and strings, and registers (see the
@@ -1158,7 +1140,6 @@ to make dc(1) exit with the \f[B]Q\f[R] command, so the sequence
This is a \f[B]non-portable extension\f[R].
.RE
.SS Status
-.PP
These commands query status of the stack or its top value.
.TP
\f[B]Z\f[R]
@@ -1219,7 +1200,6 @@ This means that this command will never push \f[B]0\f[R].
This is a \f[B]non-portable extension\f[R].
.RE
.SS Arrays
-.PP
These commands manipulate arrays.
.TP
\f[B]:\f[R]\f[I]r\f[R]
@@ -1239,7 +1219,6 @@ Pushes the length of the array \f[I]r\f[R] onto the stack.
This is a \f[B]non-portable extension\f[R].
.RE
.SS Global Settings
-.PP
These commands retrieve global settings.
These are the only commands that require multiple specific characters,
and all of them begin with the letter \f[B]g\f[R].
@@ -1262,7 +1241,6 @@ Pushes \f[B]0\f[R] onto the stack if the leading zero setting has not
been enabled with the \f[B]-z\f[R] or \f[B]--leading-zeroes\f[R] options
(see the \f[B]OPTIONS\f[R] section), non-zero otherwise.
.SH REGISTERS
-.PP
Registers are names that can store strings, numbers, and arrays.
(Number/string registers do not interfere with array registers.)
.PP
@@ -1278,7 +1256,6 @@ The only exceptions are: a newline (\f[B]`\[rs]n'\f[R]) and a left
bracket (\f[B]`['\f[R]); it is a parse error for a newline or a left
bracket to be used as a register name.
.SS Extended Register Mode
-.PP
Unlike most other dc(1) implentations, this dc(1) provides nearly
unlimited amounts of registers, if extended register mode is enabled.
.PP
@@ -1293,7 +1270,6 @@ In that case, the register name is found according to the regex
\f[B][a-z][a-z0-9_]*\f[R] (like bc(1) identifiers), and it is a parse
error if the next non-space characters do not match that regex.
.SH RESET
-.PP
When dc(1) encounters an error or a signal that it has a non-default
handler for, it resets.
This means that several things happen.
@@ -1310,7 +1286,6 @@ Then, if it is interactive mode, and the error was not a fatal error
(see the \f[B]EXIT STATUS\f[R] section), it asks for more input;
otherwise, it exits with the appropriate return code.
.SH PERFORMANCE
-.PP
Most dc(1) implementations use \f[B]char\f[R] types to calculate the
value of \f[B]1\f[R] decimal digit at a time, but that can be slow.
This dc(1) does something different.
@@ -1330,7 +1305,6 @@ checking.
This integer type depends on the value of \f[B]DC_LONG_BIT\f[R], but is
always at least twice as large as the integer type used to store digits.
.SH LIMITS
-.PP
The following are the limits on dc(1):
.TP
\f[B]DC_LONG_BIT\f[R]
@@ -1397,7 +1371,6 @@ large (at least on 64-bit machines) that there should not be any point
at which they become a problem.
In fact, memory should be exhausted before these limits should be hit.
.SH ENVIRONMENT VARIABLES
-.PP
As \f[B]non-portable extensions\f[R], dc(1) recognizes the following
environment variables:
.TP
@@ -1520,7 +1493,6 @@ This environment variable overrides the default, which can be queried
with the \f[B]-h\f[R] or \f[B]--help\f[R] options.
.RE
.SH EXIT STATUS
-.PP
dc(1) returns the following exit statuses:
.TP
\f[B]0\f[R]
@@ -1589,7 +1561,6 @@ These exit statuses allow dc(1) to be used in shell scripting with error
checking, and its normal behavior can be forced by using the
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.SH INTERACTIVE MODE
-.PP
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both \f[B]stdin\f[R]
and \f[B]stdout\f[R] are hooked to a terminal, but the \f[B]-i\f[R] flag
@@ -1602,7 +1573,6 @@ dc(1) may also reset on \f[B]SIGINT\f[R] instead of exit, depending on
the contents of, or default for, the \f[B]DC_SIGINT_RESET\f[R]
environment variable (see the \f[B]ENVIRONMENT VARIABLES\f[R] section).
.SH TTY MODE
-.PP
If \f[B]stdin\f[R], \f[B]stdout\f[R], and \f[B]stderr\f[R] are all
connected to a TTY, then \[lq]TTY mode\[rq] is considered to be
available, and thus, dc(1) can turn on TTY mode, subject to some
@@ -1626,7 +1596,6 @@ required in the bc(1) specification (see the \f[B]STANDARDS\f[R]
section), and interactive mode requires only \f[B]stdin\f[R] and
\f[B]stdout\f[R] to be connected to a terminal.
.SS Prompt
-.PP
If TTY mode is available, then a prompt can be enabled.
Like TTY mode itself, it can be turned on or off with an environment
variable: \f[B]DC_PROMPT\f[R] (see the \f[B]ENVIRONMENT VARIABLES\f[R]
@@ -1647,7 +1616,6 @@ and \f[B]--no-read-prompt\f[R] options.
See the \f[B]ENVIRONMENT VARIABLES\f[R] and \f[B]OPTIONS\f[R] sections
for more details.
.SH SIGNAL HANDLING
-.PP
Sending a \f[B]SIGINT\f[R] will cause dc(1) to do one of two things.
.PP
If dc(1) is not in interactive mode (see the \f[B]INTERACTIVE MODE\f[R]
@@ -1679,19 +1647,17 @@ the user to continue.
\f[B]SIGTERM\f[R] and \f[B]SIGQUIT\f[R] cause dc(1) to clean up and
exit, and it uses the default handler for all other signals.
.SH SEE ALSO
-.PP
bc(1)
.SH STANDARDS
-.PP
The dc(1) utility operators and some behavior are compliant with the
operators in the IEEE Std 1003.1-2017 (\[lq]POSIX.1-2017\[rq]) bc(1)
specification at
https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html .
.SH BUGS
-.PP
None are known.
Report bugs at https://git.gavinhoward.com/gavin/bc .
.SH AUTHOR
-.PP
-Gavin D.
-Howard <gavin@gavinhoward.com> and contributors.
+Gavin D. Howard \c
+.MT gavin@gavinhoward.com
+.ME \c
+\ and contributors.
diff --git a/contrib/bc/manuals/dc/N.1 b/contrib/bc/manuals/dc/N.1
index b7b501fbed13..5bb0dff18e0a 100644
--- a/contrib/bc/manuals/dc/N.1
+++ b/contrib/bc/manuals/dc/N.1
@@ -29,10 +29,8 @@
.nh
.ad l
.SH Name
-.PP
dc - arbitrary-precision decimal reverse-Polish notation calculator
.SH SYNOPSIS
-.PP
\f[B]dc\f[R] [\f[B]-cChiPRvVx\f[R]] [\f[B]--version\f[R]]
[\f[B]--help\f[R]] [\f[B]--digit-clamp\f[R]]
[\f[B]--no-digit-clamp\f[R]] [\f[B]--interactive\f[R]]
@@ -47,7 +45,6 @@ dc - arbitrary-precision decimal reverse-Polish notation calculator
[\f[B]-S\f[R] \f[I]scale\f[R]] [\f[B]--scale\f[R]=\f[I]scale\f[R]]
[\f[B]-E\f[R] \f[I]seed\f[R]] [\f[B]--seed\f[R]=\f[I]seed\f[R]]
.SH DESCRIPTION
-.PP
dc(1) is an arbitrary-precision calculator.
It uses a stack (reverse Polish notation) to store numbers and results
of computations.
@@ -64,7 +61,6 @@ For example, if a user wants the \f[B]scale\f[R] always set to
\f[B]10\f[R], they can set \f[B]DC_ENV_ARGS\f[R] to \f[B]-e 10k\f[R],
and this dc(1) will always start with a \f[B]scale\f[R] of \f[B]10\f[R].
.SH OPTIONS
-.PP
The following are the options that dc(1) accepts.
.TP
\f[B]-C\f[R], \f[B]--no-digit-clamp\f[R]
@@ -276,7 +272,6 @@ This is a \f[B]non-portable extension\f[R].
.PP
All long options are \f[B]non-portable extensions\f[R].
.SH STDIN
-.PP
If no files are given on the command-line and no files or expressions
are given by the \f[B]-f\f[R], \f[B]--file\f[R], \f[B]-e\f[R], or
\f[B]--expression\f[R] options, then dc(1) reads from \f[B]stdin\f[R].
@@ -289,7 +284,6 @@ ended.
This means that, except for escaped brackets, all brackets must be
balanced before dc(1) parses and executes.
.SH STDOUT
-.PP
Any non-error output is written to \f[B]stdout\f[R].
In addition, if history (see the \f[B]HISTORY\f[R] section) and the
prompt (see the \f[B]TTY MODE\f[R] section) are enabled, both are output
@@ -298,7 +292,7 @@ to \f[B]stdout\f[R].
\f[B]Note\f[R]: Unlike other dc(1) implementations, this dc(1) will
issue a fatal error (see the \f[B]EXIT STATUS\f[R] section) if it cannot
write to \f[B]stdout\f[R], so if \f[B]stdout\f[R] is closed, as in
-\f[B]dc >&-\f[R], it will quit with an error.
+\f[B]dc >&-\f[R], it will quit with an error.
This is done so that dc(1) can report problems when \f[B]stdout\f[R] is
redirected to a file.
.PP
@@ -306,13 +300,12 @@ If there are scripts that depend on the behavior of other dc(1)
implementations, it is recommended that those scripts be changed to
redirect \f[B]stdout\f[R] to \f[B]/dev/null\f[R].
.SH STDERR
-.PP
Any error output is written to \f[B]stderr\f[R].
.PP
\f[B]Note\f[R]: Unlike other dc(1) implementations, this dc(1) will
issue a fatal error (see the \f[B]EXIT STATUS\f[R] section) if it cannot
write to \f[B]stderr\f[R], so if \f[B]stderr\f[R] is closed, as in
-\f[B]dc 2>&-\f[R], it will quit with an error.
+\f[B]dc 2>&-\f[R], it will quit with an error.
This is done so that dc(1) can exit with an error code when
\f[B]stderr\f[R] is redirected to a file.
.PP
@@ -320,7 +313,6 @@ If there are scripts that depend on the behavior of other dc(1)
implementations, it is recommended that those scripts be changed to
redirect \f[B]stderr\f[R] to \f[B]/dev/null\f[R].
.SH SYNTAX
-.PP
Each item in the input source code, either a number (see the
\f[B]NUMBERS\f[R] section) or a command (see the \f[B]COMMANDS\f[R]
section), is processed and executed, in order.
@@ -393,11 +385,9 @@ In any other case, use a non-seeded pseudo-random number generator.
The pseudo-random number generator, \f[B]seed\f[R], and all associated
operations are \f[B]non-portable extensions\f[R].
.SS Comments
-.PP
Comments go from \f[B]#\f[R] until, and not including, the next newline.
This is a \f[B]non-portable extension\f[R].
.SH NUMBERS
-.PP
Numbers are strings made up of digits, uppercase letters up to
\f[B]F\f[R], and at most \f[B]1\f[R] period for a radix.
Numbers can have up to \f[B]DC_NUM_MAX\f[R] digits.
@@ -464,10 +454,8 @@ number string \f[B]FFeA\f[R], the resulting decimal number will be
Accepting input as scientific notation is a \f[B]non-portable
extension\f[R].
.SH COMMANDS
-.PP
The valid commands are listed below.
.SS Printing
-.PP
These commands are used for printing.
.PP
Note that both scientific notation and engineering notation are
@@ -515,7 +503,6 @@ without altering anything.
Users should use this command when they get lost.
.RE
.SS Arithmetic
-.PP
These are the commands used for arithmetic.
.TP
\f[B]+\f[R]
@@ -747,7 +734,6 @@ a short-circuit operator.
This is a \f[B]non-portable extension\f[R].
.RE
.SS Pseudo-Random Number Generator
-.PP
dc(1) has a built-in pseudo-random number generator.
These commands query the pseudo-random number generator.
(See Parameters for more information about the \f[B]seed\f[R] value that
@@ -791,7 +777,6 @@ limitations of the pseudo-random number generator.
This is a \f[B]non-portable extension\f[R].
.RE
.SS Stack Control
-.PP
These commands control the stack.
.TP
\f[B]c\f[R]
@@ -807,7 +792,6 @@ Swaps (\[lq]reverses\[rq]) the two top items on the stack.
\f[B]R\f[R]
Pops (\[lq]removes\[rq]) the top value from the stack.
.SS Register Control
-.PP
These commands control registers (see the \f[B]REGISTERS\f[R] section).
.TP
\f[B]s\f[R]\f[I]r\f[R]
@@ -829,7 +813,6 @@ push it onto the main stack.
The previous value in the stack for register \f[I]r\f[R], if any, is now
accessible via the \f[B]l\f[R]\f[I]r\f[R] command.
.SS Parameters
-.PP
These commands control the values of \f[B]ibase\f[R], \f[B]obase\f[R],
\f[B]scale\f[R], and \f[B]seed\f[R].
Also see the \f[B]SYNTAX\f[R] section.
@@ -941,7 +924,6 @@ Pushes the maximum (inclusive) integer that can be generated with the
This is a \f[B]non-portable extension\f[R].
.RE
.SS Strings
-.PP
The following commands control strings.
.PP
dc(1) can work with both numbers and strings, and registers (see the
@@ -1158,7 +1140,6 @@ to make dc(1) exit with the \f[B]Q\f[R] command, so the sequence
This is a \f[B]non-portable extension\f[R].
.RE
.SS Status
-.PP
These commands query status of the stack or its top value.
.TP
\f[B]Z\f[R]
@@ -1219,7 +1200,6 @@ This means that this command will never push \f[B]0\f[R].
This is a \f[B]non-portable extension\f[R].
.RE
.SS Arrays
-.PP
These commands manipulate arrays.
.TP
\f[B]:\f[R]\f[I]r\f[R]
@@ -1239,7 +1219,6 @@ Pushes the length of the array \f[I]r\f[R] onto the stack.
This is a \f[B]non-portable extension\f[R].
.RE
.SS Global Settings
-.PP
These commands retrieve global settings.
These are the only commands that require multiple specific characters,
and all of them begin with the letter \f[B]g\f[R].
@@ -1262,7 +1241,6 @@ Pushes \f[B]0\f[R] onto the stack if the leading zero setting has not
been enabled with the \f[B]-z\f[R] or \f[B]--leading-zeroes\f[R] options
(see the \f[B]OPTIONS\f[R] section), non-zero otherwise.
.SH REGISTERS
-.PP
Registers are names that can store strings, numbers, and arrays.
(Number/string registers do not interfere with array registers.)
.PP
@@ -1278,7 +1256,6 @@ The only exceptions are: a newline (\f[B]`\[rs]n'\f[R]) and a left
bracket (\f[B]`['\f[R]); it is a parse error for a newline or a left
bracket to be used as a register name.
.SS Extended Register Mode
-.PP
Unlike most other dc(1) implentations, this dc(1) provides nearly
unlimited amounts of registers, if extended register mode is enabled.
.PP
@@ -1293,7 +1270,6 @@ In that case, the register name is found according to the regex
\f[B][a-z][a-z0-9_]*\f[R] (like bc(1) identifiers), and it is a parse
error if the next non-space characters do not match that regex.
.SH RESET
-.PP
When dc(1) encounters an error or a signal that it has a non-default
handler for, it resets.
This means that several things happen.
@@ -1310,7 +1286,6 @@ Then, if it is interactive mode, and the error was not a fatal error
(see the \f[B]EXIT STATUS\f[R] section), it asks for more input;
otherwise, it exits with the appropriate return code.
.SH PERFORMANCE
-.PP
Most dc(1) implementations use \f[B]char\f[R] types to calculate the
value of \f[B]1\f[R] decimal digit at a time, but that can be slow.
This dc(1) does something different.
@@ -1330,7 +1305,6 @@ checking.
This integer type depends on the value of \f[B]DC_LONG_BIT\f[R], but is
always at least twice as large as the integer type used to store digits.
.SH LIMITS
-.PP
The following are the limits on dc(1):
.TP
\f[B]DC_LONG_BIT\f[R]
@@ -1397,7 +1371,6 @@ large (at least on 64-bit machines) that there should not be any point
at which they become a problem.
In fact, memory should be exhausted before these limits should be hit.
.SH ENVIRONMENT VARIABLES
-.PP
As \f[B]non-portable extensions\f[R], dc(1) recognizes the following
environment variables:
.TP
@@ -1520,7 +1493,6 @@ This environment variable overrides the default, which can be queried
with the \f[B]-h\f[R] or \f[B]--help\f[R] options.
.RE
.SH EXIT STATUS
-.PP
dc(1) returns the following exit statuses:
.TP
\f[B]0\f[R]
@@ -1589,7 +1561,6 @@ These exit statuses allow dc(1) to be used in shell scripting with error
checking, and its normal behavior can be forced by using the
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.SH INTERACTIVE MODE
-.PP
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both \f[B]stdin\f[R]
and \f[B]stdout\f[R] are hooked to a terminal, but the \f[B]-i\f[R] flag
@@ -1602,7 +1573,6 @@ dc(1) may also reset on \f[B]SIGINT\f[R] instead of exit, depending on
the contents of, or default for, the \f[B]DC_SIGINT_RESET\f[R]
environment variable (see the \f[B]ENVIRONMENT VARIABLES\f[R] section).
.SH TTY MODE
-.PP
If \f[B]stdin\f[R], \f[B]stdout\f[R], and \f[B]stderr\f[R] are all
connected to a TTY, then \[lq]TTY mode\[rq] is considered to be
available, and thus, dc(1) can turn on TTY mode, subject to some
@@ -1626,7 +1596,6 @@ required in the bc(1) specification (see the \f[B]STANDARDS\f[R]
section), and interactive mode requires only \f[B]stdin\f[R] and
\f[B]stdout\f[R] to be connected to a terminal.
.SS Command-Line History
-.PP
Command-line history is only enabled if TTY mode is, i.e., that
\f[B]stdin\f[R], \f[B]stdout\f[R], and \f[B]stderr\f[R] are connected to
a TTY and the \f[B]DC_TTY_MODE\f[R] environment variable (see the
@@ -1634,7 +1603,6 @@ a TTY and the \f[B]DC_TTY_MODE\f[R] environment variable (see the
TTY mode.
See the \f[B]COMMAND LINE HISTORY\f[R] section for more information.
.SS Prompt
-.PP
If TTY mode is available, then a prompt can be enabled.
Like TTY mode itself, it can be turned on or off with an environment
variable: \f[B]DC_PROMPT\f[R] (see the \f[B]ENVIRONMENT VARIABLES\f[R]
@@ -1655,7 +1623,6 @@ and \f[B]--no-read-prompt\f[R] options.
See the \f[B]ENVIRONMENT VARIABLES\f[R] and \f[B]OPTIONS\f[R] sections
for more details.
.SH SIGNAL HANDLING
-.PP
Sending a \f[B]SIGINT\f[R] will cause dc(1) to do one of two things.
.PP
If dc(1) is not in interactive mode (see the \f[B]INTERACTIVE MODE\f[R]
@@ -1690,7 +1657,6 @@ The one exception is \f[B]SIGHUP\f[R]; in that case, and only when dc(1)
is in TTY mode (see the \f[B]TTY MODE\f[R] section), a \f[B]SIGHUP\f[R]
will cause dc(1) to clean up and exit.
.SH COMMAND LINE HISTORY
-.PP
dc(1) supports interactive command-line editing.
.PP
If dc(1) can be in TTY mode (see the \f[B]TTY MODE\f[R] section),
@@ -1705,19 +1671,17 @@ section).
.PP
\f[B]Note\f[R]: tabs are converted to 8 spaces.
.SH SEE ALSO
-.PP
bc(1)
.SH STANDARDS
-.PP
The dc(1) utility operators and some behavior are compliant with the
operators in the IEEE Std 1003.1-2017 (\[lq]POSIX.1-2017\[rq]) bc(1)
specification at
https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html .
.SH BUGS
-.PP
None are known.
Report bugs at https://git.gavinhoward.com/gavin/bc .
.SH AUTHOR
-.PP
-Gavin D.
-Howard <gavin@gavinhoward.com> and contributors.
+Gavin D. Howard \c
+.MT gavin@gavinhoward.com
+.ME \c
+\ and contributors.