bc: Vendor import new version 3.3.3

This commit is contained in:
Stefan Eßer 2021-03-05 11:30:11 +01:00
parent 88832d59de
commit 028616d0dd
84 changed files with 2130 additions and 1871 deletions

View File

@ -29,7 +29,7 @@
#
.POSIX:
VERSION = 3.3.0
VERSION = 3.3.3
SRC = %%SRC%%
OBJ = %%OBJ%%

View File

@ -1,5 +1,31 @@
# News
## 3.3.3
This is a production release with one tweak and fixes for manuals.
The tweak is that `length(0)` returns `1` instead of `0`. In `3.3.1`, I changed
it so `length(0.x)`, where `x` could be any number of digits, returned the
`scale`, but `length(0)` still returned `0` because I believe that `0` has `0`
significant digits.
After request of FreeBSD and considering the arguments of a mathematician,
compatibility with other `bc`'s, and the expectations of users, I decided to
make the change.
The fixes for manuals fixed a bug where `--` was rendered as `-`.
## 3.3.2
This is a production release that fixes a divide-by-zero bug in `root()` in the
[extended math library][16]. All previous versions with `root()` have the bug.
## 3.3.1
This is a production release that fixes a bug.
The bug was in the reporting of number length when the value was 0.
## 3.3.0
This is a production release that changes one behavior and fixes documentation

View File

@ -110,7 +110,7 @@ define root(x,n){
if(n<0)sqrt(n)
n=n$
if(n==0)x/n
if(n==1)return x
if(x==0||n==1)return x
if(n==2)return sqrt(x)
s=scale
scale=0

View File

@ -121,20 +121,20 @@ def run(cmd, env=None):
p = run([ "make", "clean" ])
print("Testing \"make -j4\"")
print("Testing \"make -j12\"")
if p.returncode != 0:
print("make returned an error ({}); exiting...".format(p.returncode))
sys.exit(p.returncode)
p = run([ "make", "-j4" ])
p = run([ "make", "-j12" ])
if p.returncode == 0:
makecmd = [ "make", "-j4" ]
print("Using \"make -j4\"")
makecmd = [ "make", "-j12" ]
print("Using \"make -j12\"")
else:
makecmd = [ "make" ]
print("Not using \"make -j4\"")
print("Not using \"make -j12\"")
if test_num != 0:
mx2 = test_num

View File

@ -34,8 +34,7 @@ bc - arbitrary-precision decimal arithmetic language and calculator
# SYNOPSIS
**bc** [**-ghilPqsvVw**] [**--global-stacks**] [**--help**] [**--interactive**] [**--mathlib**] [**--no-prompt**] [**--quiet**] [**--standard**] [**--warn**] [**--version**] [**-e** *expr*] [**--expression**=*expr*...] [**-f** *file*...] [**-file**=*file*...]
[*file*...]
**bc** [**-ghilPqsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@ -61,7 +60,7 @@ especially) the GNU bc(1).
The following are the options that bc(1) accepts.
**-g**, **--global-stacks**
**-g**, **-\-global-stacks**
{{ A H N P HN HP NP HNP }}
: Turns the globals **ibase**, **obase**, **scale**, and **seed** into stacks.
@ -152,17 +151,17 @@ The following are the options that bc(1) accepts.
This is a **non-portable extension**.
**-h**, **--help**
**-h**, **-\-help**
: Prints a usage message and quits.
**-i**, **--interactive**
**-i**, **-\-interactive**
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
This is a **non-portable extension**.
**-l**, **--mathlib**
**-l**, **-\-mathlib**
: Sets **scale** (see the **SYNTAX** section) to **20** and loads the included
{{ A H N P HN HP NP HNP }}
@ -178,7 +177,7 @@ The following are the options that bc(1) accepts.
To learn what is in the library, see the **LIBRARY** section.
{{ end }}
**-P**, **--no-prompt**
**-P**, **-\-no-prompt**
{{ A E H N EH EN HN EHN }}
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
@ -193,36 +192,36 @@ The following are the options that bc(1) accepts.
This is a **non-portable extension**.
**-q**, **--quiet**
**-q**, **-\-quiet**
: This option is for compatibility with the [GNU bc(1)][2]; it is a no-op.
Without this option, GNU bc(1) prints a copyright header. This bc(1) only
prints the copyright header if one or more of the **-v**, **-V**, or
**--version** options are given.
**-\-version** options are given.
This is a **non-portable extension**.
**-s**, **--standard**
**-s**, **-\-standard**
: Process exactly the language defined by the [standard][1] and error if any
extensions are used.
This is a **non-portable extension**.
**-v**, **-V**, **--version**
**-v**, **-V**, **-\-version**
: Print the version information (copyright header) and exit.
This is a **non-portable extension**.
**-w**, **--warn**
**-w**, **-\-warn**
: Like **-s** and **--standard**, except that warnings (and not errors) are
: Like **-s** and **-\-standard**, except that warnings (and not errors) are
printed for non-standard extensions and execution continues normally.
This is a **non-portable extension**.
**-e** *expr*, **--expression**=*expr*
**-e** *expr*, **-\-expression**=*expr*
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
order. If files are given as well (see below), the expressions and files are
@ -232,14 +231,14 @@ The following are the options that bc(1) accepts.
If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
see the **ENVIRONMENT VARIABLES** section), then after processing all
expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
as an argument at least once to **-f** or **--file**, whether on the
as an argument at least once to **-f** or **-\-file**, whether on the
command-line or in **BC_ENV_ARGS**. However, if any other **-e**,
**--expression**, **-f**, or **--file** arguments are given after **-f-** or
equivalent is given, bc(1) will give a fatal error and exit.
**-\-expression**, **-f**, or **-\-file** arguments are given after **-f-**
or equivalent is given, bc(1) will give a fatal error and exit.
This is a **non-portable extension**.
**-f** *file*, **--file**=*file*
**-f** *file*, **-\-file**=*file*
: Reads in *file* and evaluates it, line by line, as though it were read
through **stdin**. If expressions are also given (see above), the
@ -248,8 +247,8 @@ The following are the options that bc(1) accepts.
If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
see the **ENVIRONMENT VARIABLES** section), then after processing all
expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
as an argument at least once to **-f** or **--file**. However, if any other
**-e**, **--expression**, **-f**, or **--file** arguments are given after
as an argument at least once to **-f** or **-\-file**. However, if any other
**-e**, **-\-expression**, **-f**, or **-\-file** arguments are given after
**-f-** or equivalent is given, bc(1) will give a fatal error and exit.
This is a **non-portable extension**.
@ -304,8 +303,8 @@ Identifiers with more than one character (letter) are a
**ibase** is a global variable determining how to interpret constant numbers. It
is the "input" base, or the number base used for interpreting input numbers.
**ibase** is initially **10**. If the **-s** (**--standard**) and **-w**
(**--warn**) flags were not given on the command line, the max allowable value
**ibase** is initially **10**. If the **-s** (**-\-standard**) and **-w**
(**-\-warn**) flags were not given on the command line, the max allowable value
for **ibase** is **36**. Otherwise, it is **16**. The min allowable value for
**ibase** is **2**. The max allowable value for **ibase** can be queried in
bc(1) programs with the **maxibase()** built-in function.
@ -512,7 +511,7 @@ 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.
**++** **--**
**++** **-\-**
: Type: Prefix and Postfix
@ -617,7 +616,7 @@ precedence.
The operators will be described in more detail below.
**++** **--**
**++** **-\-**
: The prefix and postfix **increment** and **decrement** operators behave
exactly like they would in C. They require a named expression (see the
@ -962,12 +961,12 @@ This is a **non-portable extension**.
{{ A H N P HN HP NP HNP }}
All of the functions below, including the functions in the extended math
library (see the *Extended Library* subsection below), are available when the
**-l** or **--mathlib** command-line flags are given, except that the extended
**-l** or **-\-mathlib** command-line flags are given, except that the extended
math library is not available when the **-s** option, the **-w** option, or
equivalents are given.
{{ end }}
{{ E EH EN EP EHN EHP ENP EHNP }}
All of the functions below are available when the **-l** or **--mathlib**
All of the functions below are available when the **-l** or **-\-mathlib**
command-line flags are given.
{{ end }}
@ -1020,8 +1019,8 @@ The [standard][1] defines the following functions for the math library:
{{ A H N P HN HP NP HNP }}
## Extended Library
The extended library is *not* loaded when the **-s**/**--standard** or
**-w**/**--warn** options are given since they are not part of the library
The extended library is *not* loaded when the **-s**/**-\-standard** or
**-w**/**-\-warn** options are given since they are not part of the library
defined by the [standard][1].
The extended library is a **non-portable extension**.
@ -1705,17 +1704,17 @@ The other statuses will only be returned when bc(1) is not in interactive mode
(see the **INTERACTIVE MODE** section), since bc(1) resets its state (see the
**RESET** section) and accepts more input when one of those errors occurs in
interactive mode. This is also the case when interactive mode is forced by the
**-i** flag or **--interactive** option.
**-i** flag or **-\-interactive** option.
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 **-i** flag or
**--interactive** option.
**-\-interactive** option.
# INTERACTIVE MODE
Per the [standard][1], bc(1) has an interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both **stdin** and **stdout**
are hooked to a terminal, but the **-i** flag and **--interactive** option can
are hooked to a terminal, but the **-i** flag and **-\-interactive** option can
turn it on in other cases.
In interactive mode, bc(1) attempts to recover from errors (see the **RESET**

View File

@ -25,19 +25,18 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
.TH "BC" "1" "February 2021" "Gavin D. Howard" "General Commands Manual"
.TH "BC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
.SH NAME
.PP
bc - arbitrary-precision decimal arithmetic language and calculator
.SH SYNOPSIS
.PP
\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]\[en]global-stacks\f[R]]
[\f[B]\[en]help\f[R]] [\f[B]\[en]interactive\f[R]]
[\f[B]\[en]mathlib\f[R]] [\f[B]\[en]no-prompt\f[R]]
[\f[B]\[en]quiet\f[R]] [\f[B]\[en]standard\f[R]] [\f[B]\[en]warn\f[R]]
[\f[B]\[en]version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
[\f[B]\[en]expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
\f[I]file\f[R]\&...] [\f[B]-file\f[R]=\f[I]file\f[R]\&...]
\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]--global-stacks\f[R]]
[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--mathlib\f[R]]
[\f[B]--no-prompt\f[R]] [\f[B]--quiet\f[R]] [\f[B]--standard\f[R]]
[\f[B]--warn\f[R]] [\f[B]--version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
[\f[I]file\f[R]\&...]
.SH DESCRIPTION
.PP
@ -60,7 +59,7 @@ implementations.
.PP
The following are the options that bc(1) accepts.
.TP
\f[B]-g\f[R], \f[B]\[en]global-stacks\f[R]
\f[B]-g\f[R], \f[B]--global-stacks\f[R]
Turns the globals \f[B]ibase\f[R], \f[B]obase\f[R], \f[B]scale\f[R], and
\f[B]seed\f[R] into stacks.
.RS
@ -152,10 +151,10 @@ is ignored.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-h\f[R], \f[B]\[en]help\f[R]
\f[B]-h\f[R], \f[B]--help\f[R]
Prints a usage message and quits.
.TP
\f[B]-i\f[R], \f[B]\[en]interactive\f[R]
\f[B]-i\f[R], \f[B]--interactive\f[R]
Forces interactive mode.
(See the \f[B]INTERACTIVE MODE\f[R] section.)
.RS
@ -163,7 +162,7 @@ Forces interactive mode.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-l\f[R], \f[B]\[en]mathlib\f[R]
\f[B]-l\f[R], \f[B]--mathlib\f[R]
Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to \f[B]20\f[R]
and loads the included math library and the extended math library before
running any code, including any expressions or files specified on the
@ -173,7 +172,7 @@ command line.
To learn what is in the libraries, see the \f[B]LIBRARY\f[R] section.
.RE
.TP
\f[B]-P\f[R], \f[B]\[en]no-prompt\f[R]
\f[B]-P\f[R], \f[B]--no-prompt\f[R]
Disables the prompt in TTY mode.
(The prompt is only enabled in TTY mode.
See the \f[B]TTY MODE\f[R] section) This is mostly for those users that
@ -185,18 +184,18 @@ Most of those users would want to put this option in
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-q\f[R], \f[B]\[en]quiet\f[R]
\f[B]-q\f[R], \f[B]--quiet\f[R]
This option is for compatibility with the GNU
bc(1) (https://www.gnu.org/software/bc/); it is a no-op.
Without this option, GNU bc(1) prints a copyright header.
This bc(1) only prints the copyright header if one or more of the
\f[B]-v\f[R], \f[B]-V\f[R], or \f[B]\[en]version\f[R] options are given.
\f[B]-v\f[R], \f[B]-V\f[R], or \f[B]--version\f[R] options are given.
.RS
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-s\f[R], \f[B]\[en]standard\f[R]
\f[B]-s\f[R], \f[B]--standard\f[R]
Process exactly the language defined by the
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
and error if any extensions are used.
@ -205,15 +204,15 @@ and error if any extensions are used.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]\[en]version\f[R]
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
Print the version information (copyright header) and exit.
.RS
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-w\f[R], \f[B]\[en]warn\f[R]
Like \f[B]-s\f[R] and \f[B]\[en]standard\f[R], except that warnings (and
\f[B]-w\f[R], \f[B]--warn\f[R]
Like \f[B]-s\f[R] and \f[B]--standard\f[R], except that warnings (and
not errors) are printed for non-standard extensions and execution
continues normally.
.RS
@ -221,7 +220,7 @@ continues normally.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]\[en]expression\f[R]=\f[I]expr\f[R]
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
Evaluates \f[I]expr\f[R].
If multiple expressions are given, they are evaluated in order.
If files are given as well (see below), the expressions and files are
@ -234,17 +233,17 @@ If this option is given on the command-line (i.e., not in
\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
then after processing all expressions and files, bc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
\f[B]-f\f[R] or \f[B]\[en]file\f[R], whether on the command-line or in
\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
\f[B]BC_ENV_ARGS\f[R].
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
exit.
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-f\f[R] \f[I]file\f[R], \f[B]\[en]file\f[R]=\f[I]file\f[R]
\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
were read through \f[B]stdin\f[R].
If expressions are also given (see above), the expressions are evaluated
@ -255,9 +254,9 @@ If this option is given on the command-line (i.e., not in
\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
then after processing all expressions and files, bc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
\f[B]-f\f[R] or \f[B]\[en]file\f[R].
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
\f[B]-f\f[R] or \f[B]--file\f[R].
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
exit.
.PP
@ -322,8 +321,8 @@ constant numbers.
It is the \[lq]input\[rq] base, or the number base used for interpreting
input numbers.
\f[B]ibase\f[R] is initially \f[B]10\f[R].
If the \f[B]-s\f[R] (\f[B]\[en]standard\f[R]) and \f[B]-w\f[R]
(\f[B]\[en]warn\f[R]) flags were not given on the command line, the max
If the \f[B]-s\f[R] (\f[B]--standard\f[R]) and \f[B]-w\f[R]
(\f[B]--warn\f[R]) flags were not given on the command line, the max
allowable value for \f[B]ibase\f[R] is \f[B]36\f[R].
Otherwise, it is \f[B]16\f[R].
The min allowable value for \f[B]ibase\f[R] is \f[B]2\f[R].
@ -582,7 +581,7 @@ 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.
.TP
\f[B]++\f[R] \f[B]\[en]\f[R]
\f[B]++\f[R] \f[B]--\f[R]
Type: Prefix and Postfix
.RS
.PP
@ -692,7 +691,7 @@ Description: \f[B]boolean or\f[R]
.PP
The operators will be described in more detail below.
.TP
\f[B]++\f[R] \f[B]\[en]\f[R]
\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]
@ -1138,7 +1137,7 @@ This is a \f[B]non-portable extension\f[R].
.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]\[en]mathlib\f[R] command-line
available when the \f[B]-l\f[R] or \f[B]--mathlib\f[R] command-line
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.
@ -1199,7 +1198,7 @@ Functions\f[R] subsection below).
.SS Extended Library
.PP
The extended library is \f[I]not\f[R] loaded when the
\f[B]-s\f[R]/\f[B]\[en]standard\f[R] or \f[B]-w\f[R]/\f[B]\[en]warn\f[R]
\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
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html).
.PP
@ -1957,11 +1956,11 @@ interactive mode (see the \f[B]INTERACTIVE MODE\f[R] section), since
bc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
more input when one of those errors occurs in interactive mode.
This is also the case when interactive mode is forced by the
\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.PP
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]\[en]interactive\f[R] option.
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.SH INTERACTIVE MODE
.PP
Per the
@ -1969,7 +1968,7 @@ standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html),
bc(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
and \f[B]\[en]interactive\f[R] option can turn it on in other cases.
and \f[B]--interactive\f[R] option can turn it on in other cases.
.PP
In interactive mode, bc(1) attempts to recover from errors (see the
\f[B]RESET\f[R] section), and in normal execution, flushes

View File

@ -34,8 +34,7 @@ bc - arbitrary-precision decimal arithmetic language and calculator
# SYNOPSIS
**bc** [**-ghilPqsvVw**] [**--global-stacks**] [**--help**] [**--interactive**] [**--mathlib**] [**--no-prompt**] [**--quiet**] [**--standard**] [**--warn**] [**--version**] [**-e** *expr*] [**--expression**=*expr*...] [**-f** *file*...] [**-file**=*file*...]
[*file*...]
**bc** [**-ghilPqsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@ -55,7 +54,7 @@ other implementations.
The following are the options that bc(1) accepts.
**-g**, **--global-stacks**
**-g**, **-\-global-stacks**
: Turns the globals **ibase**, **obase**, **scale**, and **seed** into stacks.
@ -123,17 +122,17 @@ The following are the options that bc(1) accepts.
This is a **non-portable extension**.
**-h**, **--help**
**-h**, **-\-help**
: Prints a usage message and quits.
**-i**, **--interactive**
**-i**, **-\-interactive**
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
This is a **non-portable extension**.
**-l**, **--mathlib**
**-l**, **-\-mathlib**
: Sets **scale** (see the **SYNTAX** section) to **20** and loads the included
math library and the extended math library before running any code,
@ -141,7 +140,7 @@ The following are the options that bc(1) accepts.
To learn what is in the libraries, see the **LIBRARY** section.
**-P**, **--no-prompt**
**-P**, **-\-no-prompt**
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
See the **TTY MODE** section) This is mostly for those users that do not
@ -151,36 +150,36 @@ The following are the options that bc(1) accepts.
This is a **non-portable extension**.
**-q**, **--quiet**
**-q**, **-\-quiet**
: This option is for compatibility with the [GNU bc(1)][2]; it is a no-op.
Without this option, GNU bc(1) prints a copyright header. This bc(1) only
prints the copyright header if one or more of the **-v**, **-V**, or
**--version** options are given.
**-\-version** options are given.
This is a **non-portable extension**.
**-s**, **--standard**
**-s**, **-\-standard**
: Process exactly the language defined by the [standard][1] and error if any
extensions are used.
This is a **non-portable extension**.
**-v**, **-V**, **--version**
**-v**, **-V**, **-\-version**
: Print the version information (copyright header) and exit.
This is a **non-portable extension**.
**-w**, **--warn**
**-w**, **-\-warn**
: Like **-s** and **--standard**, except that warnings (and not errors) are
: Like **-s** and **-\-standard**, except that warnings (and not errors) are
printed for non-standard extensions and execution continues normally.
This is a **non-portable extension**.
**-e** *expr*, **--expression**=*expr*
**-e** *expr*, **-\-expression**=*expr*
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
order. If files are given as well (see below), the expressions and files are
@ -190,14 +189,14 @@ The following are the options that bc(1) accepts.
If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
see the **ENVIRONMENT VARIABLES** section), then after processing all
expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
as an argument at least once to **-f** or **--file**, whether on the
as an argument at least once to **-f** or **-\-file**, whether on the
command-line or in **BC_ENV_ARGS**. However, if any other **-e**,
**--expression**, **-f**, or **--file** arguments are given after **-f-** or
equivalent is given, bc(1) will give a fatal error and exit.
**-\-expression**, **-f**, or **-\-file** arguments are given after **-f-**
or equivalent is given, bc(1) will give a fatal error and exit.
This is a **non-portable extension**.
**-f** *file*, **--file**=*file*
**-f** *file*, **-\-file**=*file*
: Reads in *file* and evaluates it, line by line, as though it were read
through **stdin**. If expressions are also given (see above), the
@ -206,8 +205,8 @@ The following are the options that bc(1) accepts.
If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
see the **ENVIRONMENT VARIABLES** section), then after processing all
expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
as an argument at least once to **-f** or **--file**. However, if any other
**-e**, **--expression**, **-f**, or **--file** arguments are given after
as an argument at least once to **-f** or **-\-file**. However, if any other
**-e**, **-\-expression**, **-f**, or **-\-file** arguments are given after
**-f-** or equivalent is given, bc(1) will give a fatal error and exit.
This is a **non-portable extension**.
@ -262,8 +261,8 @@ Identifiers with more than one character (letter) are a
**ibase** is a global variable determining how to interpret constant numbers. It
is the "input" base, or the number base used for interpreting input numbers.
**ibase** is initially **10**. If the **-s** (**--standard**) and **-w**
(**--warn**) flags were not given on the command line, the max allowable value
**ibase** is initially **10**. If the **-s** (**-\-standard**) and **-w**
(**-\-warn**) flags were not given on the command line, the max allowable value
for **ibase** is **36**. Otherwise, it is **16**. The min allowable value for
**ibase** is **2**. The max allowable value for **ibase** can be queried in
bc(1) programs with the **maxibase()** built-in function.
@ -453,7 +452,7 @@ 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.
**++** **--**
**++** **-\-**
: Type: Prefix and Postfix
@ -551,7 +550,7 @@ precedence.
The operators will be described in more detail below.
**++** **--**
**++** **-\-**
: The prefix and postfix **increment** and **decrement** operators behave
exactly like they would in C. They require a named expression (see the
@ -882,7 +881,7 @@ This is a **non-portable extension**.
All of the functions below, including the functions in the extended math
library (see the *Extended Library* subsection below), are available when the
**-l** or **--mathlib** command-line flags are given, except that the extended
**-l** or **-\-mathlib** command-line flags are given, except that the extended
math library is not available when the **-s** option, the **-w** option, or
equivalents are given.
@ -934,8 +933,8 @@ The [standard][1] defines the following functions for the math library:
## Extended Library
The extended library is *not* loaded when the **-s**/**--standard** or
**-w**/**--warn** options are given since they are not part of the library
The extended library is *not* loaded when the **-s**/**-\-standard** or
**-w**/**-\-warn** options are given since they are not part of the library
defined by the [standard][1].
The extended library is a **non-portable extension**.
@ -1603,17 +1602,17 @@ The other statuses will only be returned when bc(1) is not in interactive mode
(see the **INTERACTIVE MODE** section), since bc(1) resets its state (see the
**RESET** section) and accepts more input when one of those errors occurs in
interactive mode. This is also the case when interactive mode is forced by the
**-i** flag or **--interactive** option.
**-i** flag or **-\-interactive** option.
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 **-i** flag or
**--interactive** option.
**-\-interactive** option.
# INTERACTIVE MODE
Per the [standard][1], bc(1) has an interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both **stdin** and **stdout**
are hooked to a terminal, but the **-i** flag and **--interactive** option can
are hooked to a terminal, but the **-i** flag and **-\-interactive** option can
turn it on in other cases.
In interactive mode, bc(1) attempts to recover from errors (see the **RESET**

View File

@ -25,19 +25,18 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
.TH "BC" "1" "February 2021" "Gavin D. Howard" "General Commands Manual"
.TH "BC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
.SH NAME
.PP
bc - arbitrary-precision decimal arithmetic language and calculator
.SH SYNOPSIS
.PP
\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]\[en]global-stacks\f[R]]
[\f[B]\[en]help\f[R]] [\f[B]\[en]interactive\f[R]]
[\f[B]\[en]mathlib\f[R]] [\f[B]\[en]no-prompt\f[R]]
[\f[B]\[en]quiet\f[R]] [\f[B]\[en]standard\f[R]] [\f[B]\[en]warn\f[R]]
[\f[B]\[en]version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
[\f[B]\[en]expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
\f[I]file\f[R]\&...] [\f[B]-file\f[R]=\f[I]file\f[R]\&...]
\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]--global-stacks\f[R]]
[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--mathlib\f[R]]
[\f[B]--no-prompt\f[R]] [\f[B]--quiet\f[R]] [\f[B]--standard\f[R]]
[\f[B]--warn\f[R]] [\f[B]--version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
[\f[I]file\f[R]\&...]
.SH DESCRIPTION
.PP
@ -58,7 +57,7 @@ This bc(1) is a drop-in replacement for \f[I]any\f[R] bc(1), including
.PP
The following are the options that bc(1) accepts.
.PP
\f[B]-g\f[R], \f[B]\[en]global-stacks\f[R]
\f[B]-g\f[R], \f[B]--global-stacks\f[R]
.IP
.nf
\f[C]
@ -115,10 +114,10 @@ This is a **non-portable extension**.
\f[R]
.fi
.TP
\f[B]-h\f[R], \f[B]\[en]help\f[R]
\f[B]-h\f[R], \f[B]--help\f[R]
Prints a usage message and quits.
.TP
\f[B]-i\f[R], \f[B]\[en]interactive\f[R]
\f[B]-i\f[R], \f[B]--interactive\f[R]
Forces interactive mode.
(See the \f[B]INTERACTIVE MODE\f[R] section.)
.RS
@ -126,7 +125,7 @@ Forces interactive mode.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-l\f[R], \f[B]\[en]mathlib\f[R]
\f[B]-l\f[R], \f[B]--mathlib\f[R]
Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to \f[B]20\f[R]
and loads the included math library before running any code, including
any expressions or files specified on the command line.
@ -135,7 +134,7 @@ any expressions or files specified on the command line.
To learn what is in the library, see the \f[B]LIBRARY\f[R] section.
.RE
.TP
\f[B]-P\f[R], \f[B]\[en]no-prompt\f[R]
\f[B]-P\f[R], \f[B]--no-prompt\f[R]
Disables the prompt in TTY mode.
(The prompt is only enabled in TTY mode.
See the \f[B]TTY MODE\f[R] section) This is mostly for those users that
@ -147,18 +146,18 @@ Most of those users would want to put this option in
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-q\f[R], \f[B]\[en]quiet\f[R]
\f[B]-q\f[R], \f[B]--quiet\f[R]
This option is for compatibility with the GNU
bc(1) (https://www.gnu.org/software/bc/); it is a no-op.
Without this option, GNU bc(1) prints a copyright header.
This bc(1) only prints the copyright header if one or more of the
\f[B]-v\f[R], \f[B]-V\f[R], or \f[B]\[en]version\f[R] options are given.
\f[B]-v\f[R], \f[B]-V\f[R], or \f[B]--version\f[R] options are given.
.RS
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-s\f[R], \f[B]\[en]standard\f[R]
\f[B]-s\f[R], \f[B]--standard\f[R]
Process exactly the language defined by the
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
and error if any extensions are used.
@ -167,15 +166,15 @@ and error if any extensions are used.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]\[en]version\f[R]
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
Print the version information (copyright header) and exit.
.RS
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-w\f[R], \f[B]\[en]warn\f[R]
Like \f[B]-s\f[R] and \f[B]\[en]standard\f[R], except that warnings (and
\f[B]-w\f[R], \f[B]--warn\f[R]
Like \f[B]-s\f[R] and \f[B]--standard\f[R], except that warnings (and
not errors) are printed for non-standard extensions and execution
continues normally.
.RS
@ -183,7 +182,7 @@ continues normally.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]\[en]expression\f[R]=\f[I]expr\f[R]
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
Evaluates \f[I]expr\f[R].
If multiple expressions are given, they are evaluated in order.
If files are given as well (see below), the expressions and files are
@ -196,17 +195,17 @@ If this option is given on the command-line (i.e., not in
\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
then after processing all expressions and files, bc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
\f[B]-f\f[R] or \f[B]\[en]file\f[R], whether on the command-line or in
\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
\f[B]BC_ENV_ARGS\f[R].
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
exit.
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-f\f[R] \f[I]file\f[R], \f[B]\[en]file\f[R]=\f[I]file\f[R]
\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
were read through \f[B]stdin\f[R].
If expressions are also given (see above), the expressions are evaluated
@ -217,9 +216,9 @@ If this option is given on the command-line (i.e., not in
\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
then after processing all expressions and files, bc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
\f[B]-f\f[R] or \f[B]\[en]file\f[R].
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
\f[B]-f\f[R] or \f[B]--file\f[R].
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
exit.
.PP
@ -284,8 +283,8 @@ constant numbers.
It is the \[lq]input\[rq] base, or the number base used for interpreting
input numbers.
\f[B]ibase\f[R] is initially \f[B]10\f[R].
If the \f[B]-s\f[R] (\f[B]\[en]standard\f[R]) and \f[B]-w\f[R]
(\f[B]\[en]warn\f[R]) flags were not given on the command line, the max
If the \f[B]-s\f[R] (\f[B]--standard\f[R]) and \f[B]-w\f[R]
(\f[B]--warn\f[R]) flags were not given on the command line, the max
allowable value for \f[B]ibase\f[R] is \f[B]36\f[R].
Otherwise, it is \f[B]16\f[R].
The min allowable value for \f[B]ibase\f[R] is \f[B]2\f[R].
@ -445,7 +444,7 @@ 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.
.TP
\f[B]++\f[R] \f[B]\[en]\f[R]
\f[B]++\f[R] \f[B]--\f[R]
Type: Prefix and Postfix
.RS
.PP
@ -528,7 +527,7 @@ Description: \f[B]boolean or\f[R]
.PP
The operators will be described in more detail below.
.TP
\f[B]++\f[R] \f[B]\[en]\f[R]
\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]
@ -908,7 +907,7 @@ 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]\[en]mathlib\f[R] command-line flags are given.
\f[B]--mathlib\f[R] command-line flags are given.
.SS Standard Library
.PP
The
@ -1213,11 +1212,11 @@ interactive mode (see the \f[B]INTERACTIVE MODE\f[R] section), since
bc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
more input when one of those errors occurs in interactive mode.
This is also the case when interactive mode is forced by the
\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.PP
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]\[en]interactive\f[R] option.
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.SH INTERACTIVE MODE
.PP
Per the
@ -1225,7 +1224,7 @@ standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html),
bc(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
and \f[B]\[en]interactive\f[R] option can turn it on in other cases.
and \f[B]--interactive\f[R] option can turn it on in other cases.
.PP
In interactive mode, bc(1) attempts to recover from errors (see the
\f[B]RESET\f[R] section), and in normal execution, flushes

View File

@ -34,8 +34,7 @@ bc - arbitrary-precision decimal arithmetic language and calculator
# SYNOPSIS
**bc** [**-ghilPqsvVw**] [**--global-stacks**] [**--help**] [**--interactive**] [**--mathlib**] [**--no-prompt**] [**--quiet**] [**--standard**] [**--warn**] [**--version**] [**-e** *expr*] [**--expression**=*expr*...] [**-f** *file*...] [**-file**=*file*...]
[*file*...]
**bc** [**-ghilPqsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@ -54,7 +53,7 @@ especially) the GNU bc(1).
The following are the options that bc(1) accepts.
**-g**, **--global-stacks**
**-g**, **-\-global-stacks**
Turns the globals **ibase**, **obase**, and **scale** into stacks.
@ -107,17 +106,17 @@ The following are the options that bc(1) accepts.
This is a **non-portable extension**.
**-h**, **--help**
**-h**, **-\-help**
: Prints a usage message and quits.
**-i**, **--interactive**
**-i**, **-\-interactive**
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
This is a **non-portable extension**.
**-l**, **--mathlib**
**-l**, **-\-mathlib**
: Sets **scale** (see the **SYNTAX** section) to **20** and loads the included
math library before running any code, including any expressions or files
@ -125,7 +124,7 @@ The following are the options that bc(1) accepts.
To learn what is in the library, see the **LIBRARY** section.
**-P**, **--no-prompt**
**-P**, **-\-no-prompt**
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
See the **TTY MODE** section) This is mostly for those users that do not
@ -135,36 +134,36 @@ The following are the options that bc(1) accepts.
This is a **non-portable extension**.
**-q**, **--quiet**
**-q**, **-\-quiet**
: This option is for compatibility with the [GNU bc(1)][2]; it is a no-op.
Without this option, GNU bc(1) prints a copyright header. This bc(1) only
prints the copyright header if one or more of the **-v**, **-V**, or
**--version** options are given.
**-\-version** options are given.
This is a **non-portable extension**.
**-s**, **--standard**
**-s**, **-\-standard**
: Process exactly the language defined by the [standard][1] and error if any
extensions are used.
This is a **non-portable extension**.
**-v**, **-V**, **--version**
**-v**, **-V**, **-\-version**
: Print the version information (copyright header) and exit.
This is a **non-portable extension**.
**-w**, **--warn**
**-w**, **-\-warn**
: Like **-s** and **--standard**, except that warnings (and not errors) are
: Like **-s** and **-\-standard**, except that warnings (and not errors) are
printed for non-standard extensions and execution continues normally.
This is a **non-portable extension**.
**-e** *expr*, **--expression**=*expr*
**-e** *expr*, **-\-expression**=*expr*
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
order. If files are given as well (see below), the expressions and files are
@ -174,14 +173,14 @@ The following are the options that bc(1) accepts.
If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
see the **ENVIRONMENT VARIABLES** section), then after processing all
expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
as an argument at least once to **-f** or **--file**, whether on the
as an argument at least once to **-f** or **-\-file**, whether on the
command-line or in **BC_ENV_ARGS**. However, if any other **-e**,
**--expression**, **-f**, or **--file** arguments are given after **-f-** or
equivalent is given, bc(1) will give a fatal error and exit.
**-\-expression**, **-f**, or **-\-file** arguments are given after **-f-**
or equivalent is given, bc(1) will give a fatal error and exit.
This is a **non-portable extension**.
**-f** *file*, **--file**=*file*
**-f** *file*, **-\-file**=*file*
: Reads in *file* and evaluates it, line by line, as though it were read
through **stdin**. If expressions are also given (see above), the
@ -190,8 +189,8 @@ The following are the options that bc(1) accepts.
If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
see the **ENVIRONMENT VARIABLES** section), then after processing all
expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
as an argument at least once to **-f** or **--file**. However, if any other
**-e**, **--expression**, **-f**, or **--file** arguments are given after
as an argument at least once to **-f** or **-\-file**. However, if any other
**-e**, **-\-expression**, **-f**, or **-\-file** arguments are given after
**-f-** or equivalent is given, bc(1) will give a fatal error and exit.
This is a **non-portable extension**.
@ -246,8 +245,8 @@ Identifiers with more than one character (letter) are a
**ibase** is a global variable determining how to interpret constant numbers. It
is the "input" base, or the number base used for interpreting input numbers.
**ibase** is initially **10**. If the **-s** (**--standard**) and **-w**
(**--warn**) flags were not given on the command line, the max allowable value
**ibase** is initially **10**. If the **-s** (**-\-standard**) and **-w**
(**-\-warn**) flags were not given on the command line, the max allowable value
for **ibase** is **36**. Otherwise, it is **16**. The min allowable value for
**ibase** is **2**. The max allowable value for **ibase** can be queried in
bc(1) programs with the **maxibase()** built-in function.
@ -366,7 +365,7 @@ 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.
**++** **--**
**++** **-\-**
: Type: Prefix and Postfix
@ -440,7 +439,7 @@ precedence.
The operators will be described in more detail below.
**++** **--**
**++** **-\-**
: The prefix and postfix **increment** and **decrement** operators behave
exactly like they would in C. They require a named expression (see the
@ -716,7 +715,7 @@ This is a **non-portable extension**.
# LIBRARY
All of the functions below are available when the **-l** or **--mathlib**
All of the functions below are available when the **-l** or **-\-mathlib**
command-line flags are given.
## Standard Library
@ -992,17 +991,17 @@ The other statuses will only be returned when bc(1) is not in interactive mode
(see the **INTERACTIVE MODE** section), since bc(1) resets its state (see the
**RESET** section) and accepts more input when one of those errors occurs in
interactive mode. This is also the case when interactive mode is forced by the
**-i** flag or **--interactive** option.
**-i** flag or **-\-interactive** option.
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 **-i** flag or
**--interactive** option.
**-\-interactive** option.
# INTERACTIVE MODE
Per the [standard][1], bc(1) has an interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both **stdin** and **stdout**
are hooked to a terminal, but the **-i** flag and **--interactive** option can
are hooked to a terminal, but the **-i** flag and **-\-interactive** option can
turn it on in other cases.
In interactive mode, bc(1) attempts to recover from errors (see the **RESET**

View File

@ -25,19 +25,18 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
.TH "BC" "1" "February 2021" "Gavin D. Howard" "General Commands Manual"
.TH "BC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
.SH NAME
.PP
bc - arbitrary-precision decimal arithmetic language and calculator
.SH SYNOPSIS
.PP
\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]\[en]global-stacks\f[R]]
[\f[B]\[en]help\f[R]] [\f[B]\[en]interactive\f[R]]
[\f[B]\[en]mathlib\f[R]] [\f[B]\[en]no-prompt\f[R]]
[\f[B]\[en]quiet\f[R]] [\f[B]\[en]standard\f[R]] [\f[B]\[en]warn\f[R]]
[\f[B]\[en]version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
[\f[B]\[en]expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
\f[I]file\f[R]\&...] [\f[B]-file\f[R]=\f[I]file\f[R]\&...]
\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]--global-stacks\f[R]]
[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--mathlib\f[R]]
[\f[B]--no-prompt\f[R]] [\f[B]--quiet\f[R]] [\f[B]--standard\f[R]]
[\f[B]--warn\f[R]] [\f[B]--version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
[\f[I]file\f[R]\&...]
.SH DESCRIPTION
.PP
@ -55,7 +54,7 @@ the command line and executes them before reading from \f[B]stdin\f[R].
.PP
The following are the options that bc(1) accepts.
.PP
\f[B]-g\f[R], \f[B]\[en]global-stacks\f[R]
\f[B]-g\f[R], \f[B]--global-stacks\f[R]
.IP
.nf
\f[C]
@ -112,10 +111,10 @@ This is a **non-portable extension**.
\f[R]
.fi
.TP
\f[B]-h\f[R], \f[B]\[en]help\f[R]
\f[B]-h\f[R], \f[B]--help\f[R]
Prints a usage message and quits.
.TP
\f[B]-i\f[R], \f[B]\[en]interactive\f[R]
\f[B]-i\f[R], \f[B]--interactive\f[R]
Forces interactive mode.
(See the \f[B]INTERACTIVE MODE\f[R] section.)
.RS
@ -123,7 +122,7 @@ Forces interactive mode.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-l\f[R], \f[B]\[en]mathlib\f[R]
\f[B]-l\f[R], \f[B]--mathlib\f[R]
Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to \f[B]20\f[R]
and loads the included math library before running any code, including
any expressions or files specified on the command line.
@ -132,7 +131,7 @@ any expressions or files specified on the command line.
To learn what is in the library, see the \f[B]LIBRARY\f[R] section.
.RE
.TP
\f[B]-P\f[R], \f[B]\[en]no-prompt\f[R]
\f[B]-P\f[R], \f[B]--no-prompt\f[R]
Disables the prompt in TTY mode.
(The prompt is only enabled in TTY mode.
See the \f[B]TTY MODE\f[R] section) This is mostly for those users that
@ -144,18 +143,18 @@ Most of those users would want to put this option in
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-q\f[R], \f[B]\[en]quiet\f[R]
\f[B]-q\f[R], \f[B]--quiet\f[R]
This option is for compatibility with the GNU
bc(1) (https://www.gnu.org/software/bc/); it is a no-op.
Without this option, GNU bc(1) prints a copyright header.
This bc(1) only prints the copyright header if one or more of the
\f[B]-v\f[R], \f[B]-V\f[R], or \f[B]\[en]version\f[R] options are given.
\f[B]-v\f[R], \f[B]-V\f[R], or \f[B]--version\f[R] options are given.
.RS
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-s\f[R], \f[B]\[en]standard\f[R]
\f[B]-s\f[R], \f[B]--standard\f[R]
Process exactly the language defined by the
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
and error if any extensions are used.
@ -164,15 +163,15 @@ and error if any extensions are used.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]\[en]version\f[R]
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
Print the version information (copyright header) and exit.
.RS
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-w\f[R], \f[B]\[en]warn\f[R]
Like \f[B]-s\f[R] and \f[B]\[en]standard\f[R], except that warnings (and
\f[B]-w\f[R], \f[B]--warn\f[R]
Like \f[B]-s\f[R] and \f[B]--standard\f[R], except that warnings (and
not errors) are printed for non-standard extensions and execution
continues normally.
.RS
@ -180,7 +179,7 @@ continues normally.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]\[en]expression\f[R]=\f[I]expr\f[R]
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
Evaluates \f[I]expr\f[R].
If multiple expressions are given, they are evaluated in order.
If files are given as well (see below), the expressions and files are
@ -193,17 +192,17 @@ If this option is given on the command-line (i.e., not in
\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
then after processing all expressions and files, bc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
\f[B]-f\f[R] or \f[B]\[en]file\f[R], whether on the command-line or in
\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
\f[B]BC_ENV_ARGS\f[R].
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
exit.
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-f\f[R] \f[I]file\f[R], \f[B]\[en]file\f[R]=\f[I]file\f[R]
\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
were read through \f[B]stdin\f[R].
If expressions are also given (see above), the expressions are evaluated
@ -214,9 +213,9 @@ If this option is given on the command-line (i.e., not in
\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
then after processing all expressions and files, bc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
\f[B]-f\f[R] or \f[B]\[en]file\f[R].
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
\f[B]-f\f[R] or \f[B]--file\f[R].
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
exit.
.PP
@ -281,8 +280,8 @@ constant numbers.
It is the \[lq]input\[rq] base, or the number base used for interpreting
input numbers.
\f[B]ibase\f[R] is initially \f[B]10\f[R].
If the \f[B]-s\f[R] (\f[B]\[en]standard\f[R]) and \f[B]-w\f[R]
(\f[B]\[en]warn\f[R]) flags were not given on the command line, the max
If the \f[B]-s\f[R] (\f[B]--standard\f[R]) and \f[B]-w\f[R]
(\f[B]--warn\f[R]) flags were not given on the command line, the max
allowable value for \f[B]ibase\f[R] is \f[B]36\f[R].
Otherwise, it is \f[B]16\f[R].
The min allowable value for \f[B]ibase\f[R] is \f[B]2\f[R].
@ -442,7 +441,7 @@ 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.
.TP
\f[B]++\f[R] \f[B]\[en]\f[R]
\f[B]++\f[R] \f[B]--\f[R]
Type: Prefix and Postfix
.RS
.PP
@ -525,7 +524,7 @@ Description: \f[B]boolean or\f[R]
.PP
The operators will be described in more detail below.
.TP
\f[B]++\f[R] \f[B]\[en]\f[R]
\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]
@ -905,7 +904,7 @@ 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]\[en]mathlib\f[R] command-line flags are given.
\f[B]--mathlib\f[R] command-line flags are given.
.SS Standard Library
.PP
The
@ -1210,11 +1209,11 @@ interactive mode (see the \f[B]INTERACTIVE MODE\f[R] section), since
bc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
more input when one of those errors occurs in interactive mode.
This is also the case when interactive mode is forced by the
\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.PP
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]\[en]interactive\f[R] option.
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.SH INTERACTIVE MODE
.PP
Per the
@ -1222,7 +1221,7 @@ standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html),
bc(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
and \f[B]\[en]interactive\f[R] option can turn it on in other cases.
and \f[B]--interactive\f[R] option can turn it on in other cases.
.PP
In interactive mode, bc(1) attempts to recover from errors (see the
\f[B]RESET\f[R] section), and in normal execution, flushes

View File

@ -34,8 +34,7 @@ bc - arbitrary-precision decimal arithmetic language and calculator
# SYNOPSIS
**bc** [**-ghilPqsvVw**] [**--global-stacks**] [**--help**] [**--interactive**] [**--mathlib**] [**--no-prompt**] [**--quiet**] [**--standard**] [**--warn**] [**--version**] [**-e** *expr*] [**--expression**=*expr*...] [**-f** *file*...] [**-file**=*file*...]
[*file*...]
**bc** [**-ghilPqsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@ -51,7 +50,7 @@ command line and executes them before reading from **stdin**.
The following are the options that bc(1) accepts.
**-g**, **--global-stacks**
**-g**, **-\-global-stacks**
Turns the globals **ibase**, **obase**, and **scale** into stacks.
@ -104,17 +103,17 @@ The following are the options that bc(1) accepts.
This is a **non-portable extension**.
**-h**, **--help**
**-h**, **-\-help**
: Prints a usage message and quits.
**-i**, **--interactive**
**-i**, **-\-interactive**
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
This is a **non-portable extension**.
**-l**, **--mathlib**
**-l**, **-\-mathlib**
: Sets **scale** (see the **SYNTAX** section) to **20** and loads the included
math library before running any code, including any expressions or files
@ -122,7 +121,7 @@ The following are the options that bc(1) accepts.
To learn what is in the library, see the **LIBRARY** section.
**-P**, **--no-prompt**
**-P**, **-\-no-prompt**
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
See the **TTY MODE** section) This is mostly for those users that do not
@ -132,36 +131,36 @@ The following are the options that bc(1) accepts.
This is a **non-portable extension**.
**-q**, **--quiet**
**-q**, **-\-quiet**
: This option is for compatibility with the [GNU bc(1)][2]; it is a no-op.
Without this option, GNU bc(1) prints a copyright header. This bc(1) only
prints the copyright header if one or more of the **-v**, **-V**, or
**--version** options are given.
**-\-version** options are given.
This is a **non-portable extension**.
**-s**, **--standard**
**-s**, **-\-standard**
: Process exactly the language defined by the [standard][1] and error if any
extensions are used.
This is a **non-portable extension**.
**-v**, **-V**, **--version**
**-v**, **-V**, **-\-version**
: Print the version information (copyright header) and exit.
This is a **non-portable extension**.
**-w**, **--warn**
**-w**, **-\-warn**
: Like **-s** and **--standard**, except that warnings (and not errors) are
: Like **-s** and **-\-standard**, except that warnings (and not errors) are
printed for non-standard extensions and execution continues normally.
This is a **non-portable extension**.
**-e** *expr*, **--expression**=*expr*
**-e** *expr*, **-\-expression**=*expr*
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
order. If files are given as well (see below), the expressions and files are
@ -171,14 +170,14 @@ The following are the options that bc(1) accepts.
If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
see the **ENVIRONMENT VARIABLES** section), then after processing all
expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
as an argument at least once to **-f** or **--file**, whether on the
as an argument at least once to **-f** or **-\-file**, whether on the
command-line or in **BC_ENV_ARGS**. However, if any other **-e**,
**--expression**, **-f**, or **--file** arguments are given after **-f-** or
equivalent is given, bc(1) will give a fatal error and exit.
**-\-expression**, **-f**, or **-\-file** arguments are given after **-f-**
or equivalent is given, bc(1) will give a fatal error and exit.
This is a **non-portable extension**.
**-f** *file*, **--file**=*file*
**-f** *file*, **-\-file**=*file*
: Reads in *file* and evaluates it, line by line, as though it were read
through **stdin**. If expressions are also given (see above), the
@ -187,8 +186,8 @@ The following are the options that bc(1) accepts.
If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
see the **ENVIRONMENT VARIABLES** section), then after processing all
expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
as an argument at least once to **-f** or **--file**. However, if any other
**-e**, **--expression**, **-f**, or **--file** arguments are given after
as an argument at least once to **-f** or **-\-file**. However, if any other
**-e**, **-\-expression**, **-f**, or **-\-file** arguments are given after
**-f-** or equivalent is given, bc(1) will give a fatal error and exit.
This is a **non-portable extension**.
@ -243,8 +242,8 @@ Identifiers with more than one character (letter) are a
**ibase** is a global variable determining how to interpret constant numbers. It
is the "input" base, or the number base used for interpreting input numbers.
**ibase** is initially **10**. If the **-s** (**--standard**) and **-w**
(**--warn**) flags were not given on the command line, the max allowable value
**ibase** is initially **10**. If the **-s** (**-\-standard**) and **-w**
(**-\-warn**) flags were not given on the command line, the max allowable value
for **ibase** is **36**. Otherwise, it is **16**. The min allowable value for
**ibase** is **2**. The max allowable value for **ibase** can be queried in
bc(1) programs with the **maxibase()** built-in function.
@ -363,7 +362,7 @@ 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.
**++** **--**
**++** **-\-**
: Type: Prefix and Postfix
@ -437,7 +436,7 @@ precedence.
The operators will be described in more detail below.
**++** **--**
**++** **-\-**
: The prefix and postfix **increment** and **decrement** operators behave
exactly like they would in C. They require a named expression (see the
@ -713,7 +712,7 @@ This is a **non-portable extension**.
# LIBRARY
All of the functions below are available when the **-l** or **--mathlib**
All of the functions below are available when the **-l** or **-\-mathlib**
command-line flags are given.
## Standard Library
@ -989,17 +988,17 @@ The other statuses will only be returned when bc(1) is not in interactive mode
(see the **INTERACTIVE MODE** section), since bc(1) resets its state (see the
**RESET** section) and accepts more input when one of those errors occurs in
interactive mode. This is also the case when interactive mode is forced by the
**-i** flag or **--interactive** option.
**-i** flag or **-\-interactive** option.
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 **-i** flag or
**--interactive** option.
**-\-interactive** option.
# INTERACTIVE MODE
Per the [standard][1], bc(1) has an interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both **stdin** and **stdout**
are hooked to a terminal, but the **-i** flag and **--interactive** option can
are hooked to a terminal, but the **-i** flag and **-\-interactive** option can
turn it on in other cases.
In interactive mode, bc(1) attempts to recover from errors (see the **RESET**

View File

@ -25,19 +25,18 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
.TH "BC" "1" "February 2021" "Gavin D. Howard" "General Commands Manual"
.TH "BC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
.SH NAME
.PP
bc - arbitrary-precision decimal arithmetic language and calculator
.SH SYNOPSIS
.PP
\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]\[en]global-stacks\f[R]]
[\f[B]\[en]help\f[R]] [\f[B]\[en]interactive\f[R]]
[\f[B]\[en]mathlib\f[R]] [\f[B]\[en]no-prompt\f[R]]
[\f[B]\[en]quiet\f[R]] [\f[B]\[en]standard\f[R]] [\f[B]\[en]warn\f[R]]
[\f[B]\[en]version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
[\f[B]\[en]expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
\f[I]file\f[R]\&...] [\f[B]-file\f[R]=\f[I]file\f[R]\&...]
\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]--global-stacks\f[R]]
[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--mathlib\f[R]]
[\f[B]--no-prompt\f[R]] [\f[B]--quiet\f[R]] [\f[B]--standard\f[R]]
[\f[B]--warn\f[R]] [\f[B]--version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
[\f[I]file\f[R]\&...]
.SH DESCRIPTION
.PP
@ -55,7 +54,7 @@ the command line and executes them before reading from \f[B]stdin\f[R].
.PP
The following are the options that bc(1) accepts.
.PP
\f[B]-g\f[R], \f[B]\[en]global-stacks\f[R]
\f[B]-g\f[R], \f[B]--global-stacks\f[R]
.IP
.nf
\f[C]
@ -112,10 +111,10 @@ This is a **non-portable extension**.
\f[R]
.fi
.TP
\f[B]-h\f[R], \f[B]\[en]help\f[R]
\f[B]-h\f[R], \f[B]--help\f[R]
Prints a usage message and quits.
.TP
\f[B]-i\f[R], \f[B]\[en]interactive\f[R]
\f[B]-i\f[R], \f[B]--interactive\f[R]
Forces interactive mode.
(See the \f[B]INTERACTIVE MODE\f[R] section.)
.RS
@ -123,7 +122,7 @@ Forces interactive mode.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-l\f[R], \f[B]\[en]mathlib\f[R]
\f[B]-l\f[R], \f[B]--mathlib\f[R]
Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to \f[B]20\f[R]
and loads the included math library before running any code, including
any expressions or files specified on the command line.
@ -132,7 +131,7 @@ any expressions or files specified on the command line.
To learn what is in the library, see the \f[B]LIBRARY\f[R] section.
.RE
.TP
\f[B]-P\f[R], \f[B]\[en]no-prompt\f[R]
\f[B]-P\f[R], \f[B]--no-prompt\f[R]
Disables the prompt in TTY mode.
(The prompt is only enabled in TTY mode.
See the \f[B]TTY MODE\f[R] section) This is mostly for those users that
@ -144,18 +143,18 @@ Most of those users would want to put this option in
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-q\f[R], \f[B]\[en]quiet\f[R]
\f[B]-q\f[R], \f[B]--quiet\f[R]
This option is for compatibility with the GNU
bc(1) (https://www.gnu.org/software/bc/); it is a no-op.
Without this option, GNU bc(1) prints a copyright header.
This bc(1) only prints the copyright header if one or more of the
\f[B]-v\f[R], \f[B]-V\f[R], or \f[B]\[en]version\f[R] options are given.
\f[B]-v\f[R], \f[B]-V\f[R], or \f[B]--version\f[R] options are given.
.RS
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-s\f[R], \f[B]\[en]standard\f[R]
\f[B]-s\f[R], \f[B]--standard\f[R]
Process exactly the language defined by the
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
and error if any extensions are used.
@ -164,15 +163,15 @@ and error if any extensions are used.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]\[en]version\f[R]
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
Print the version information (copyright header) and exit.
.RS
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-w\f[R], \f[B]\[en]warn\f[R]
Like \f[B]-s\f[R] and \f[B]\[en]standard\f[R], except that warnings (and
\f[B]-w\f[R], \f[B]--warn\f[R]
Like \f[B]-s\f[R] and \f[B]--standard\f[R], except that warnings (and
not errors) are printed for non-standard extensions and execution
continues normally.
.RS
@ -180,7 +179,7 @@ continues normally.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]\[en]expression\f[R]=\f[I]expr\f[R]
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
Evaluates \f[I]expr\f[R].
If multiple expressions are given, they are evaluated in order.
If files are given as well (see below), the expressions and files are
@ -193,17 +192,17 @@ If this option is given on the command-line (i.e., not in
\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
then after processing all expressions and files, bc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
\f[B]-f\f[R] or \f[B]\[en]file\f[R], whether on the command-line or in
\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
\f[B]BC_ENV_ARGS\f[R].
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
exit.
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-f\f[R] \f[I]file\f[R], \f[B]\[en]file\f[R]=\f[I]file\f[R]
\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
were read through \f[B]stdin\f[R].
If expressions are also given (see above), the expressions are evaluated
@ -214,9 +213,9 @@ If this option is given on the command-line (i.e., not in
\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
then after processing all expressions and files, bc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
\f[B]-f\f[R] or \f[B]\[en]file\f[R].
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
\f[B]-f\f[R] or \f[B]--file\f[R].
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
exit.
.PP
@ -281,8 +280,8 @@ constant numbers.
It is the \[lq]input\[rq] base, or the number base used for interpreting
input numbers.
\f[B]ibase\f[R] is initially \f[B]10\f[R].
If the \f[B]-s\f[R] (\f[B]\[en]standard\f[R]) and \f[B]-w\f[R]
(\f[B]\[en]warn\f[R]) flags were not given on the command line, the max
If the \f[B]-s\f[R] (\f[B]--standard\f[R]) and \f[B]-w\f[R]
(\f[B]--warn\f[R]) flags were not given on the command line, the max
allowable value for \f[B]ibase\f[R] is \f[B]36\f[R].
Otherwise, it is \f[B]16\f[R].
The min allowable value for \f[B]ibase\f[R] is \f[B]2\f[R].
@ -442,7 +441,7 @@ 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.
.TP
\f[B]++\f[R] \f[B]\[en]\f[R]
\f[B]++\f[R] \f[B]--\f[R]
Type: Prefix and Postfix
.RS
.PP
@ -525,7 +524,7 @@ Description: \f[B]boolean or\f[R]
.PP
The operators will be described in more detail below.
.TP
\f[B]++\f[R] \f[B]\[en]\f[R]
\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]
@ -905,7 +904,7 @@ 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]\[en]mathlib\f[R] command-line flags are given.
\f[B]--mathlib\f[R] command-line flags are given.
.SS Standard Library
.PP
The
@ -1210,11 +1209,11 @@ interactive mode (see the \f[B]INTERACTIVE MODE\f[R] section), since
bc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
more input when one of those errors occurs in interactive mode.
This is also the case when interactive mode is forced by the
\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.PP
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]\[en]interactive\f[R] option.
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.SH INTERACTIVE MODE
.PP
Per the
@ -1222,7 +1221,7 @@ standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html),
bc(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
and \f[B]\[en]interactive\f[R] option can turn it on in other cases.
and \f[B]--interactive\f[R] option can turn it on in other cases.
.PP
In interactive mode, bc(1) attempts to recover from errors (see the
\f[B]RESET\f[R] section), and in normal execution, flushes

View File

@ -34,8 +34,7 @@ bc - arbitrary-precision decimal arithmetic language and calculator
# SYNOPSIS
**bc** [**-ghilPqsvVw**] [**--global-stacks**] [**--help**] [**--interactive**] [**--mathlib**] [**--no-prompt**] [**--quiet**] [**--standard**] [**--warn**] [**--version**] [**-e** *expr*] [**--expression**=*expr*...] [**-f** *file*...] [**-file**=*file*...]
[*file*...]
**bc** [**-ghilPqsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@ -51,7 +50,7 @@ command line and executes them before reading from **stdin**.
The following are the options that bc(1) accepts.
**-g**, **--global-stacks**
**-g**, **-\-global-stacks**
Turns the globals **ibase**, **obase**, and **scale** into stacks.
@ -104,17 +103,17 @@ The following are the options that bc(1) accepts.
This is a **non-portable extension**.
**-h**, **--help**
**-h**, **-\-help**
: Prints a usage message and quits.
**-i**, **--interactive**
**-i**, **-\-interactive**
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
This is a **non-portable extension**.
**-l**, **--mathlib**
**-l**, **-\-mathlib**
: Sets **scale** (see the **SYNTAX** section) to **20** and loads the included
math library before running any code, including any expressions or files
@ -122,7 +121,7 @@ The following are the options that bc(1) accepts.
To learn what is in the library, see the **LIBRARY** section.
**-P**, **--no-prompt**
**-P**, **-\-no-prompt**
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
See the **TTY MODE** section) This is mostly for those users that do not
@ -132,36 +131,36 @@ The following are the options that bc(1) accepts.
This is a **non-portable extension**.
**-q**, **--quiet**
**-q**, **-\-quiet**
: This option is for compatibility with the [GNU bc(1)][2]; it is a no-op.
Without this option, GNU bc(1) prints a copyright header. This bc(1) only
prints the copyright header if one or more of the **-v**, **-V**, or
**--version** options are given.
**-\-version** options are given.
This is a **non-portable extension**.
**-s**, **--standard**
**-s**, **-\-standard**
: Process exactly the language defined by the [standard][1] and error if any
extensions are used.
This is a **non-portable extension**.
**-v**, **-V**, **--version**
**-v**, **-V**, **-\-version**
: Print the version information (copyright header) and exit.
This is a **non-portable extension**.
**-w**, **--warn**
**-w**, **-\-warn**
: Like **-s** and **--standard**, except that warnings (and not errors) are
: Like **-s** and **-\-standard**, except that warnings (and not errors) are
printed for non-standard extensions and execution continues normally.
This is a **non-portable extension**.
**-e** *expr*, **--expression**=*expr*
**-e** *expr*, **-\-expression**=*expr*
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
order. If files are given as well (see below), the expressions and files are
@ -171,14 +170,14 @@ The following are the options that bc(1) accepts.
If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
see the **ENVIRONMENT VARIABLES** section), then after processing all
expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
as an argument at least once to **-f** or **--file**, whether on the
as an argument at least once to **-f** or **-\-file**, whether on the
command-line or in **BC_ENV_ARGS**. However, if any other **-e**,
**--expression**, **-f**, or **--file** arguments are given after **-f-** or
equivalent is given, bc(1) will give a fatal error and exit.
**-\-expression**, **-f**, or **-\-file** arguments are given after **-f-**
or equivalent is given, bc(1) will give a fatal error and exit.
This is a **non-portable extension**.
**-f** *file*, **--file**=*file*
**-f** *file*, **-\-file**=*file*
: Reads in *file* and evaluates it, line by line, as though it were read
through **stdin**. If expressions are also given (see above), the
@ -187,8 +186,8 @@ The following are the options that bc(1) accepts.
If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
see the **ENVIRONMENT VARIABLES** section), then after processing all
expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
as an argument at least once to **-f** or **--file**. However, if any other
**-e**, **--expression**, **-f**, or **--file** arguments are given after
as an argument at least once to **-f** or **-\-file**. However, if any other
**-e**, **-\-expression**, **-f**, or **-\-file** arguments are given after
**-f-** or equivalent is given, bc(1) will give a fatal error and exit.
This is a **non-portable extension**.
@ -243,8 +242,8 @@ Identifiers with more than one character (letter) are a
**ibase** is a global variable determining how to interpret constant numbers. It
is the "input" base, or the number base used for interpreting input numbers.
**ibase** is initially **10**. If the **-s** (**--standard**) and **-w**
(**--warn**) flags were not given on the command line, the max allowable value
**ibase** is initially **10**. If the **-s** (**-\-standard**) and **-w**
(**-\-warn**) flags were not given on the command line, the max allowable value
for **ibase** is **36**. Otherwise, it is **16**. The min allowable value for
**ibase** is **2**. The max allowable value for **ibase** can be queried in
bc(1) programs with the **maxibase()** built-in function.
@ -363,7 +362,7 @@ 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.
**++** **--**
**++** **-\-**
: Type: Prefix and Postfix
@ -437,7 +436,7 @@ precedence.
The operators will be described in more detail below.
**++** **--**
**++** **-\-**
: The prefix and postfix **increment** and **decrement** operators behave
exactly like they would in C. They require a named expression (see the
@ -713,7 +712,7 @@ This is a **non-portable extension**.
# LIBRARY
All of the functions below are available when the **-l** or **--mathlib**
All of the functions below are available when the **-l** or **-\-mathlib**
command-line flags are given.
## Standard Library
@ -989,17 +988,17 @@ The other statuses will only be returned when bc(1) is not in interactive mode
(see the **INTERACTIVE MODE** section), since bc(1) resets its state (see the
**RESET** section) and accepts more input when one of those errors occurs in
interactive mode. This is also the case when interactive mode is forced by the
**-i** flag or **--interactive** option.
**-i** flag or **-\-interactive** option.
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 **-i** flag or
**--interactive** option.
**-\-interactive** option.
# INTERACTIVE MODE
Per the [standard][1], bc(1) has an interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both **stdin** and **stdout**
are hooked to a terminal, but the **-i** flag and **--interactive** option can
are hooked to a terminal, but the **-i** flag and **-\-interactive** option can
turn it on in other cases.
In interactive mode, bc(1) attempts to recover from errors (see the **RESET**

View File

@ -25,19 +25,18 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
.TH "BC" "1" "February 2021" "Gavin D. Howard" "General Commands Manual"
.TH "BC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
.SH NAME
.PP
bc - arbitrary-precision decimal arithmetic language and calculator
.SH SYNOPSIS
.PP
\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]\[en]global-stacks\f[R]]
[\f[B]\[en]help\f[R]] [\f[B]\[en]interactive\f[R]]
[\f[B]\[en]mathlib\f[R]] [\f[B]\[en]no-prompt\f[R]]
[\f[B]\[en]quiet\f[R]] [\f[B]\[en]standard\f[R]] [\f[B]\[en]warn\f[R]]
[\f[B]\[en]version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
[\f[B]\[en]expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
\f[I]file\f[R]\&...] [\f[B]-file\f[R]=\f[I]file\f[R]\&...]
\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]--global-stacks\f[R]]
[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--mathlib\f[R]]
[\f[B]--no-prompt\f[R]] [\f[B]--quiet\f[R]] [\f[B]--standard\f[R]]
[\f[B]--warn\f[R]] [\f[B]--version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
[\f[I]file\f[R]\&...]
.SH DESCRIPTION
.PP
@ -55,7 +54,7 @@ the command line and executes them before reading from \f[B]stdin\f[R].
.PP
The following are the options that bc(1) accepts.
.PP
\f[B]-g\f[R], \f[B]\[en]global-stacks\f[R]
\f[B]-g\f[R], \f[B]--global-stacks\f[R]
.IP
.nf
\f[C]
@ -112,10 +111,10 @@ This is a **non-portable extension**.
\f[R]
.fi
.TP
\f[B]-h\f[R], \f[B]\[en]help\f[R]
\f[B]-h\f[R], \f[B]--help\f[R]
Prints a usage message and quits.
.TP
\f[B]-i\f[R], \f[B]\[en]interactive\f[R]
\f[B]-i\f[R], \f[B]--interactive\f[R]
Forces interactive mode.
(See the \f[B]INTERACTIVE MODE\f[R] section.)
.RS
@ -123,7 +122,7 @@ Forces interactive mode.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-l\f[R], \f[B]\[en]mathlib\f[R]
\f[B]-l\f[R], \f[B]--mathlib\f[R]
Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to \f[B]20\f[R]
and loads the included math library before running any code, including
any expressions or files specified on the command line.
@ -132,25 +131,25 @@ any expressions or files specified on the command line.
To learn what is in the library, see the \f[B]LIBRARY\f[R] section.
.RE
.TP
\f[B]-P\f[R], \f[B]\[en]no-prompt\f[R]
\f[B]-P\f[R], \f[B]--no-prompt\f[R]
This option is a no-op.
.RS
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-q\f[R], \f[B]\[en]quiet\f[R]
\f[B]-q\f[R], \f[B]--quiet\f[R]
This option is for compatibility with the GNU
bc(1) (https://www.gnu.org/software/bc/); it is a no-op.
Without this option, GNU bc(1) prints a copyright header.
This bc(1) only prints the copyright header if one or more of the
\f[B]-v\f[R], \f[B]-V\f[R], or \f[B]\[en]version\f[R] options are given.
\f[B]-v\f[R], \f[B]-V\f[R], or \f[B]--version\f[R] options are given.
.RS
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-s\f[R], \f[B]\[en]standard\f[R]
\f[B]-s\f[R], \f[B]--standard\f[R]
Process exactly the language defined by the
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
and error if any extensions are used.
@ -159,15 +158,15 @@ and error if any extensions are used.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]\[en]version\f[R]
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
Print the version information (copyright header) and exit.
.RS
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-w\f[R], \f[B]\[en]warn\f[R]
Like \f[B]-s\f[R] and \f[B]\[en]standard\f[R], except that warnings (and
\f[B]-w\f[R], \f[B]--warn\f[R]
Like \f[B]-s\f[R] and \f[B]--standard\f[R], except that warnings (and
not errors) are printed for non-standard extensions and execution
continues normally.
.RS
@ -175,7 +174,7 @@ continues normally.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]\[en]expression\f[R]=\f[I]expr\f[R]
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
Evaluates \f[I]expr\f[R].
If multiple expressions are given, they are evaluated in order.
If files are given as well (see below), the expressions and files are
@ -188,17 +187,17 @@ If this option is given on the command-line (i.e., not in
\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
then after processing all expressions and files, bc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
\f[B]-f\f[R] or \f[B]\[en]file\f[R], whether on the command-line or in
\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
\f[B]BC_ENV_ARGS\f[R].
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
exit.
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-f\f[R] \f[I]file\f[R], \f[B]\[en]file\f[R]=\f[I]file\f[R]
\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
were read through \f[B]stdin\f[R].
If expressions are also given (see above), the expressions are evaluated
@ -209,9 +208,9 @@ If this option is given on the command-line (i.e., not in
\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
then after processing all expressions and files, bc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
\f[B]-f\f[R] or \f[B]\[en]file\f[R].
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
\f[B]-f\f[R] or \f[B]--file\f[R].
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
exit.
.PP
@ -276,8 +275,8 @@ constant numbers.
It is the \[lq]input\[rq] base, or the number base used for interpreting
input numbers.
\f[B]ibase\f[R] is initially \f[B]10\f[R].
If the \f[B]-s\f[R] (\f[B]\[en]standard\f[R]) and \f[B]-w\f[R]
(\f[B]\[en]warn\f[R]) flags were not given on the command line, the max
If the \f[B]-s\f[R] (\f[B]--standard\f[R]) and \f[B]-w\f[R]
(\f[B]--warn\f[R]) flags were not given on the command line, the max
allowable value for \f[B]ibase\f[R] is \f[B]36\f[R].
Otherwise, it is \f[B]16\f[R].
The min allowable value for \f[B]ibase\f[R] is \f[B]2\f[R].
@ -437,7 +436,7 @@ 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.
.TP
\f[B]++\f[R] \f[B]\[en]\f[R]
\f[B]++\f[R] \f[B]--\f[R]
Type: Prefix and Postfix
.RS
.PP
@ -520,7 +519,7 @@ Description: \f[B]boolean or\f[R]
.PP
The operators will be described in more detail below.
.TP
\f[B]++\f[R] \f[B]\[en]\f[R]
\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]
@ -900,7 +899,7 @@ 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]\[en]mathlib\f[R] command-line flags are given.
\f[B]--mathlib\f[R] command-line flags are given.
.SS Standard Library
.PP
The
@ -1205,11 +1204,11 @@ interactive mode (see the \f[B]INTERACTIVE MODE\f[R] section), since
bc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
more input when one of those errors occurs in interactive mode.
This is also the case when interactive mode is forced by the
\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.PP
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]\[en]interactive\f[R] option.
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.SH INTERACTIVE MODE
.PP
Per the
@ -1217,7 +1216,7 @@ standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html),
bc(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
and \f[B]\[en]interactive\f[R] option can turn it on in other cases.
and \f[B]--interactive\f[R] option can turn it on in other cases.
.PP
In interactive mode, bc(1) attempts to recover from errors (see the
\f[B]RESET\f[R] section), and in normal execution, flushes

View File

@ -34,8 +34,7 @@ bc - arbitrary-precision decimal arithmetic language and calculator
# SYNOPSIS
**bc** [**-ghilPqsvVw**] [**--global-stacks**] [**--help**] [**--interactive**] [**--mathlib**] [**--no-prompt**] [**--quiet**] [**--standard**] [**--warn**] [**--version**] [**-e** *expr*] [**--expression**=*expr*...] [**-f** *file*...] [**-file**=*file*...]
[*file*...]
**bc** [**-ghilPqsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@ -51,7 +50,7 @@ command line and executes them before reading from **stdin**.
The following are the options that bc(1) accepts.
**-g**, **--global-stacks**
**-g**, **-\-global-stacks**
Turns the globals **ibase**, **obase**, and **scale** into stacks.
@ -104,17 +103,17 @@ The following are the options that bc(1) accepts.
This is a **non-portable extension**.
**-h**, **--help**
**-h**, **-\-help**
: Prints a usage message and quits.
**-i**, **--interactive**
**-i**, **-\-interactive**
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
This is a **non-portable extension**.
**-l**, **--mathlib**
**-l**, **-\-mathlib**
: Sets **scale** (see the **SYNTAX** section) to **20** and loads the included
math library before running any code, including any expressions or files
@ -122,42 +121,42 @@ The following are the options that bc(1) accepts.
To learn what is in the library, see the **LIBRARY** section.
**-P**, **--no-prompt**
**-P**, **-\-no-prompt**
: This option is a no-op.
This is a **non-portable extension**.
**-q**, **--quiet**
**-q**, **-\-quiet**
: This option is for compatibility with the [GNU bc(1)][2]; it is a no-op.
Without this option, GNU bc(1) prints a copyright header. This bc(1) only
prints the copyright header if one or more of the **-v**, **-V**, or
**--version** options are given.
**-\-version** options are given.
This is a **non-portable extension**.
**-s**, **--standard**
**-s**, **-\-standard**
: Process exactly the language defined by the [standard][1] and error if any
extensions are used.
This is a **non-portable extension**.
**-v**, **-V**, **--version**
**-v**, **-V**, **-\-version**
: Print the version information (copyright header) and exit.
This is a **non-portable extension**.
**-w**, **--warn**
**-w**, **-\-warn**
: Like **-s** and **--standard**, except that warnings (and not errors) are
: Like **-s** and **-\-standard**, except that warnings (and not errors) are
printed for non-standard extensions and execution continues normally.
This is a **non-portable extension**.
**-e** *expr*, **--expression**=*expr*
**-e** *expr*, **-\-expression**=*expr*
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
order. If files are given as well (see below), the expressions and files are
@ -167,14 +166,14 @@ The following are the options that bc(1) accepts.
If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
see the **ENVIRONMENT VARIABLES** section), then after processing all
expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
as an argument at least once to **-f** or **--file**, whether on the
as an argument at least once to **-f** or **-\-file**, whether on the
command-line or in **BC_ENV_ARGS**. However, if any other **-e**,
**--expression**, **-f**, or **--file** arguments are given after **-f-** or
equivalent is given, bc(1) will give a fatal error and exit.
**-\-expression**, **-f**, or **-\-file** arguments are given after **-f-**
or equivalent is given, bc(1) will give a fatal error and exit.
This is a **non-portable extension**.
**-f** *file*, **--file**=*file*
**-f** *file*, **-\-file**=*file*
: Reads in *file* and evaluates it, line by line, as though it were read
through **stdin**. If expressions are also given (see above), the
@ -183,8 +182,8 @@ The following are the options that bc(1) accepts.
If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
see the **ENVIRONMENT VARIABLES** section), then after processing all
expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
as an argument at least once to **-f** or **--file**. However, if any other
**-e**, **--expression**, **-f**, or **--file** arguments are given after
as an argument at least once to **-f** or **-\-file**. However, if any other
**-e**, **-\-expression**, **-f**, or **-\-file** arguments are given after
**-f-** or equivalent is given, bc(1) will give a fatal error and exit.
This is a **non-portable extension**.
@ -239,8 +238,8 @@ Identifiers with more than one character (letter) are a
**ibase** is a global variable determining how to interpret constant numbers. It
is the "input" base, or the number base used for interpreting input numbers.
**ibase** is initially **10**. If the **-s** (**--standard**) and **-w**
(**--warn**) flags were not given on the command line, the max allowable value
**ibase** is initially **10**. If the **-s** (**-\-standard**) and **-w**
(**-\-warn**) flags were not given on the command line, the max allowable value
for **ibase** is **36**. Otherwise, it is **16**. The min allowable value for
**ibase** is **2**. The max allowable value for **ibase** can be queried in
bc(1) programs with the **maxibase()** built-in function.
@ -359,7 +358,7 @@ 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.
**++** **--**
**++** **-\-**
: Type: Prefix and Postfix
@ -433,7 +432,7 @@ precedence.
The operators will be described in more detail below.
**++** **--**
**++** **-\-**
: The prefix and postfix **increment** and **decrement** operators behave
exactly like they would in C. They require a named expression (see the
@ -709,7 +708,7 @@ This is a **non-portable extension**.
# LIBRARY
All of the functions below are available when the **-l** or **--mathlib**
All of the functions below are available when the **-l** or **-\-mathlib**
command-line flags are given.
## Standard Library
@ -985,17 +984,17 @@ The other statuses will only be returned when bc(1) is not in interactive mode
(see the **INTERACTIVE MODE** section), since bc(1) resets its state (see the
**RESET** section) and accepts more input when one of those errors occurs in
interactive mode. This is also the case when interactive mode is forced by the
**-i** flag or **--interactive** option.
**-i** flag or **-\-interactive** option.
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 **-i** flag or
**--interactive** option.
**-\-interactive** option.
# INTERACTIVE MODE
Per the [standard][1], bc(1) has an interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both **stdin** and **stdout**
are hooked to a terminal, but the **-i** flag and **--interactive** option can
are hooked to a terminal, but the **-i** flag and **-\-interactive** option can
turn it on in other cases.
In interactive mode, bc(1) attempts to recover from errors (see the **RESET**

View File

@ -25,19 +25,18 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
.TH "BC" "1" "February 2021" "Gavin D. Howard" "General Commands Manual"
.TH "BC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
.SH NAME
.PP
bc - arbitrary-precision decimal arithmetic language and calculator
.SH SYNOPSIS
.PP
\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]\[en]global-stacks\f[R]]
[\f[B]\[en]help\f[R]] [\f[B]\[en]interactive\f[R]]
[\f[B]\[en]mathlib\f[R]] [\f[B]\[en]no-prompt\f[R]]
[\f[B]\[en]quiet\f[R]] [\f[B]\[en]standard\f[R]] [\f[B]\[en]warn\f[R]]
[\f[B]\[en]version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
[\f[B]\[en]expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
\f[I]file\f[R]\&...] [\f[B]-file\f[R]=\f[I]file\f[R]\&...]
\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]--global-stacks\f[R]]
[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--mathlib\f[R]]
[\f[B]--no-prompt\f[R]] [\f[B]--quiet\f[R]] [\f[B]--standard\f[R]]
[\f[B]--warn\f[R]] [\f[B]--version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
[\f[I]file\f[R]\&...]
.SH DESCRIPTION
.PP
@ -55,7 +54,7 @@ the command line and executes them before reading from \f[B]stdin\f[R].
.PP
The following are the options that bc(1) accepts.
.PP
\f[B]-g\f[R], \f[B]\[en]global-stacks\f[R]
\f[B]-g\f[R], \f[B]--global-stacks\f[R]
.IP
.nf
\f[C]
@ -112,10 +111,10 @@ This is a **non-portable extension**.
\f[R]
.fi
.TP
\f[B]-h\f[R], \f[B]\[en]help\f[R]
\f[B]-h\f[R], \f[B]--help\f[R]
Prints a usage message and quits.
.TP
\f[B]-i\f[R], \f[B]\[en]interactive\f[R]
\f[B]-i\f[R], \f[B]--interactive\f[R]
Forces interactive mode.
(See the \f[B]INTERACTIVE MODE\f[R] section.)
.RS
@ -123,7 +122,7 @@ Forces interactive mode.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-l\f[R], \f[B]\[en]mathlib\f[R]
\f[B]-l\f[R], \f[B]--mathlib\f[R]
Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to \f[B]20\f[R]
and loads the included math library before running any code, including
any expressions or files specified on the command line.
@ -132,25 +131,25 @@ any expressions or files specified on the command line.
To learn what is in the library, see the \f[B]LIBRARY\f[R] section.
.RE
.TP
\f[B]-P\f[R], \f[B]\[en]no-prompt\f[R]
\f[B]-P\f[R], \f[B]--no-prompt\f[R]
This option is a no-op.
.RS
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-q\f[R], \f[B]\[en]quiet\f[R]
\f[B]-q\f[R], \f[B]--quiet\f[R]
This option is for compatibility with the GNU
bc(1) (https://www.gnu.org/software/bc/); it is a no-op.
Without this option, GNU bc(1) prints a copyright header.
This bc(1) only prints the copyright header if one or more of the
\f[B]-v\f[R], \f[B]-V\f[R], or \f[B]\[en]version\f[R] options are given.
\f[B]-v\f[R], \f[B]-V\f[R], or \f[B]--version\f[R] options are given.
.RS
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-s\f[R], \f[B]\[en]standard\f[R]
\f[B]-s\f[R], \f[B]--standard\f[R]
Process exactly the language defined by the
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
and error if any extensions are used.
@ -159,15 +158,15 @@ and error if any extensions are used.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]\[en]version\f[R]
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
Print the version information (copyright header) and exit.
.RS
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-w\f[R], \f[B]\[en]warn\f[R]
Like \f[B]-s\f[R] and \f[B]\[en]standard\f[R], except that warnings (and
\f[B]-w\f[R], \f[B]--warn\f[R]
Like \f[B]-s\f[R] and \f[B]--standard\f[R], except that warnings (and
not errors) are printed for non-standard extensions and execution
continues normally.
.RS
@ -175,7 +174,7 @@ continues normally.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]\[en]expression\f[R]=\f[I]expr\f[R]
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
Evaluates \f[I]expr\f[R].
If multiple expressions are given, they are evaluated in order.
If files are given as well (see below), the expressions and files are
@ -188,17 +187,17 @@ If this option is given on the command-line (i.e., not in
\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
then after processing all expressions and files, bc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
\f[B]-f\f[R] or \f[B]\[en]file\f[R], whether on the command-line or in
\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
\f[B]BC_ENV_ARGS\f[R].
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
exit.
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-f\f[R] \f[I]file\f[R], \f[B]\[en]file\f[R]=\f[I]file\f[R]
\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
were read through \f[B]stdin\f[R].
If expressions are also given (see above), the expressions are evaluated
@ -209,9 +208,9 @@ If this option is given on the command-line (i.e., not in
\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
then after processing all expressions and files, bc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
\f[B]-f\f[R] or \f[B]\[en]file\f[R].
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
\f[B]-f\f[R] or \f[B]--file\f[R].
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
exit.
.PP
@ -276,8 +275,8 @@ constant numbers.
It is the \[lq]input\[rq] base, or the number base used for interpreting
input numbers.
\f[B]ibase\f[R] is initially \f[B]10\f[R].
If the \f[B]-s\f[R] (\f[B]\[en]standard\f[R]) and \f[B]-w\f[R]
(\f[B]\[en]warn\f[R]) flags were not given on the command line, the max
If the \f[B]-s\f[R] (\f[B]--standard\f[R]) and \f[B]-w\f[R]
(\f[B]--warn\f[R]) flags were not given on the command line, the max
allowable value for \f[B]ibase\f[R] is \f[B]36\f[R].
Otherwise, it is \f[B]16\f[R].
The min allowable value for \f[B]ibase\f[R] is \f[B]2\f[R].
@ -437,7 +436,7 @@ 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.
.TP
\f[B]++\f[R] \f[B]\[en]\f[R]
\f[B]++\f[R] \f[B]--\f[R]
Type: Prefix and Postfix
.RS
.PP
@ -520,7 +519,7 @@ Description: \f[B]boolean or\f[R]
.PP
The operators will be described in more detail below.
.TP
\f[B]++\f[R] \f[B]\[en]\f[R]
\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]
@ -900,7 +899,7 @@ 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]\[en]mathlib\f[R] command-line flags are given.
\f[B]--mathlib\f[R] command-line flags are given.
.SS Standard Library
.PP
The
@ -1205,11 +1204,11 @@ interactive mode (see the \f[B]INTERACTIVE MODE\f[R] section), since
bc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
more input when one of those errors occurs in interactive mode.
This is also the case when interactive mode is forced by the
\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.PP
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]\[en]interactive\f[R] option.
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.SH INTERACTIVE MODE
.PP
Per the
@ -1217,7 +1216,7 @@ standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html),
bc(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
and \f[B]\[en]interactive\f[R] option can turn it on in other cases.
and \f[B]--interactive\f[R] option can turn it on in other cases.
.PP
In interactive mode, bc(1) attempts to recover from errors (see the
\f[B]RESET\f[R] section), and in normal execution, flushes

View File

@ -34,8 +34,7 @@ bc - arbitrary-precision decimal arithmetic language and calculator
# SYNOPSIS
**bc** [**-ghilPqsvVw**] [**--global-stacks**] [**--help**] [**--interactive**] [**--mathlib**] [**--no-prompt**] [**--quiet**] [**--standard**] [**--warn**] [**--version**] [**-e** *expr*] [**--expression**=*expr*...] [**-f** *file*...] [**-file**=*file*...]
[*file*...]
**bc** [**-ghilPqsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@ -51,7 +50,7 @@ command line and executes them before reading from **stdin**.
The following are the options that bc(1) accepts.
**-g**, **--global-stacks**
**-g**, **-\-global-stacks**
Turns the globals **ibase**, **obase**, and **scale** into stacks.
@ -104,17 +103,17 @@ The following are the options that bc(1) accepts.
This is a **non-portable extension**.
**-h**, **--help**
**-h**, **-\-help**
: Prints a usage message and quits.
**-i**, **--interactive**
**-i**, **-\-interactive**
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
This is a **non-portable extension**.
**-l**, **--mathlib**
**-l**, **-\-mathlib**
: Sets **scale** (see the **SYNTAX** section) to **20** and loads the included
math library before running any code, including any expressions or files
@ -122,42 +121,42 @@ The following are the options that bc(1) accepts.
To learn what is in the library, see the **LIBRARY** section.
**-P**, **--no-prompt**
**-P**, **-\-no-prompt**
: This option is a no-op.
This is a **non-portable extension**.
**-q**, **--quiet**
**-q**, **-\-quiet**
: This option is for compatibility with the [GNU bc(1)][2]; it is a no-op.
Without this option, GNU bc(1) prints a copyright header. This bc(1) only
prints the copyright header if one or more of the **-v**, **-V**, or
**--version** options are given.
**-\-version** options are given.
This is a **non-portable extension**.
**-s**, **--standard**
**-s**, **-\-standard**
: Process exactly the language defined by the [standard][1] and error if any
extensions are used.
This is a **non-portable extension**.
**-v**, **-V**, **--version**
**-v**, **-V**, **-\-version**
: Print the version information (copyright header) and exit.
This is a **non-portable extension**.
**-w**, **--warn**
**-w**, **-\-warn**
: Like **-s** and **--standard**, except that warnings (and not errors) are
: Like **-s** and **-\-standard**, except that warnings (and not errors) are
printed for non-standard extensions and execution continues normally.
This is a **non-portable extension**.
**-e** *expr*, **--expression**=*expr*
**-e** *expr*, **-\-expression**=*expr*
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
order. If files are given as well (see below), the expressions and files are
@ -167,14 +166,14 @@ The following are the options that bc(1) accepts.
If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
see the **ENVIRONMENT VARIABLES** section), then after processing all
expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
as an argument at least once to **-f** or **--file**, whether on the
as an argument at least once to **-f** or **-\-file**, whether on the
command-line or in **BC_ENV_ARGS**. However, if any other **-e**,
**--expression**, **-f**, or **--file** arguments are given after **-f-** or
equivalent is given, bc(1) will give a fatal error and exit.
**-\-expression**, **-f**, or **-\-file** arguments are given after **-f-**
or equivalent is given, bc(1) will give a fatal error and exit.
This is a **non-portable extension**.
**-f** *file*, **--file**=*file*
**-f** *file*, **-\-file**=*file*
: Reads in *file* and evaluates it, line by line, as though it were read
through **stdin**. If expressions are also given (see above), the
@ -183,8 +182,8 @@ The following are the options that bc(1) accepts.
If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
see the **ENVIRONMENT VARIABLES** section), then after processing all
expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
as an argument at least once to **-f** or **--file**. However, if any other
**-e**, **--expression**, **-f**, or **--file** arguments are given after
as an argument at least once to **-f** or **-\-file**. However, if any other
**-e**, **-\-expression**, **-f**, or **-\-file** arguments are given after
**-f-** or equivalent is given, bc(1) will give a fatal error and exit.
This is a **non-portable extension**.
@ -239,8 +238,8 @@ Identifiers with more than one character (letter) are a
**ibase** is a global variable determining how to interpret constant numbers. It
is the "input" base, or the number base used for interpreting input numbers.
**ibase** is initially **10**. If the **-s** (**--standard**) and **-w**
(**--warn**) flags were not given on the command line, the max allowable value
**ibase** is initially **10**. If the **-s** (**-\-standard**) and **-w**
(**-\-warn**) flags were not given on the command line, the max allowable value
for **ibase** is **36**. Otherwise, it is **16**. The min allowable value for
**ibase** is **2**. The max allowable value for **ibase** can be queried in
bc(1) programs with the **maxibase()** built-in function.
@ -359,7 +358,7 @@ 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.
**++** **--**
**++** **-\-**
: Type: Prefix and Postfix
@ -433,7 +432,7 @@ precedence.
The operators will be described in more detail below.
**++** **--**
**++** **-\-**
: The prefix and postfix **increment** and **decrement** operators behave
exactly like they would in C. They require a named expression (see the
@ -709,7 +708,7 @@ This is a **non-portable extension**.
# LIBRARY
All of the functions below are available when the **-l** or **--mathlib**
All of the functions below are available when the **-l** or **-\-mathlib**
command-line flags are given.
## Standard Library
@ -985,17 +984,17 @@ The other statuses will only be returned when bc(1) is not in interactive mode
(see the **INTERACTIVE MODE** section), since bc(1) resets its state (see the
**RESET** section) and accepts more input when one of those errors occurs in
interactive mode. This is also the case when interactive mode is forced by the
**-i** flag or **--interactive** option.
**-i** flag or **-\-interactive** option.
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 **-i** flag or
**--interactive** option.
**-\-interactive** option.
# INTERACTIVE MODE
Per the [standard][1], bc(1) has an interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both **stdin** and **stdout**
are hooked to a terminal, but the **-i** flag and **--interactive** option can
are hooked to a terminal, but the **-i** flag and **-\-interactive** option can
turn it on in other cases.
In interactive mode, bc(1) attempts to recover from errors (see the **RESET**

View File

@ -25,19 +25,18 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
.TH "BC" "1" "February 2021" "Gavin D. Howard" "General Commands Manual"
.TH "BC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
.SH NAME
.PP
bc - arbitrary-precision decimal arithmetic language and calculator
.SH SYNOPSIS
.PP
\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]\[en]global-stacks\f[R]]
[\f[B]\[en]help\f[R]] [\f[B]\[en]interactive\f[R]]
[\f[B]\[en]mathlib\f[R]] [\f[B]\[en]no-prompt\f[R]]
[\f[B]\[en]quiet\f[R]] [\f[B]\[en]standard\f[R]] [\f[B]\[en]warn\f[R]]
[\f[B]\[en]version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
[\f[B]\[en]expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
\f[I]file\f[R]\&...] [\f[B]-file\f[R]=\f[I]file\f[R]\&...]
\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]--global-stacks\f[R]]
[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--mathlib\f[R]]
[\f[B]--no-prompt\f[R]] [\f[B]--quiet\f[R]] [\f[B]--standard\f[R]]
[\f[B]--warn\f[R]] [\f[B]--version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
[\f[I]file\f[R]\&...]
.SH DESCRIPTION
.PP
@ -58,7 +57,7 @@ This bc(1) is a drop-in replacement for \f[I]any\f[R] bc(1), including
.PP
The following are the options that bc(1) accepts.
.PP
\f[B]-g\f[R], \f[B]\[en]global-stacks\f[R]
\f[B]-g\f[R], \f[B]--global-stacks\f[R]
.IP
.nf
\f[C]
@ -115,10 +114,10 @@ This is a **non-portable extension**.
\f[R]
.fi
.TP
\f[B]-h\f[R], \f[B]\[en]help\f[R]
\f[B]-h\f[R], \f[B]--help\f[R]
Prints a usage message and quits.
.TP
\f[B]-i\f[R], \f[B]\[en]interactive\f[R]
\f[B]-i\f[R], \f[B]--interactive\f[R]
Forces interactive mode.
(See the \f[B]INTERACTIVE MODE\f[R] section.)
.RS
@ -126,7 +125,7 @@ Forces interactive mode.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-l\f[R], \f[B]\[en]mathlib\f[R]
\f[B]-l\f[R], \f[B]--mathlib\f[R]
Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to \f[B]20\f[R]
and loads the included math library before running any code, including
any expressions or files specified on the command line.
@ -135,7 +134,7 @@ any expressions or files specified on the command line.
To learn what is in the library, see the \f[B]LIBRARY\f[R] section.
.RE
.TP
\f[B]-P\f[R], \f[B]\[en]no-prompt\f[R]
\f[B]-P\f[R], \f[B]--no-prompt\f[R]
Disables the prompt in TTY mode.
(The prompt is only enabled in TTY mode.
See the \f[B]TTY MODE\f[R] section) This is mostly for those users that
@ -147,18 +146,18 @@ Most of those users would want to put this option in
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-q\f[R], \f[B]\[en]quiet\f[R]
\f[B]-q\f[R], \f[B]--quiet\f[R]
This option is for compatibility with the GNU
bc(1) (https://www.gnu.org/software/bc/); it is a no-op.
Without this option, GNU bc(1) prints a copyright header.
This bc(1) only prints the copyright header if one or more of the
\f[B]-v\f[R], \f[B]-V\f[R], or \f[B]\[en]version\f[R] options are given.
\f[B]-v\f[R], \f[B]-V\f[R], or \f[B]--version\f[R] options are given.
.RS
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-s\f[R], \f[B]\[en]standard\f[R]
\f[B]-s\f[R], \f[B]--standard\f[R]
Process exactly the language defined by the
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
and error if any extensions are used.
@ -167,15 +166,15 @@ and error if any extensions are used.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]\[en]version\f[R]
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
Print the version information (copyright header) and exit.
.RS
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-w\f[R], \f[B]\[en]warn\f[R]
Like \f[B]-s\f[R] and \f[B]\[en]standard\f[R], except that warnings (and
\f[B]-w\f[R], \f[B]--warn\f[R]
Like \f[B]-s\f[R] and \f[B]--standard\f[R], except that warnings (and
not errors) are printed for non-standard extensions and execution
continues normally.
.RS
@ -183,7 +182,7 @@ continues normally.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]\[en]expression\f[R]=\f[I]expr\f[R]
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
Evaluates \f[I]expr\f[R].
If multiple expressions are given, they are evaluated in order.
If files are given as well (see below), the expressions and files are
@ -196,17 +195,17 @@ If this option is given on the command-line (i.e., not in
\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
then after processing all expressions and files, bc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
\f[B]-f\f[R] or \f[B]\[en]file\f[R], whether on the command-line or in
\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
\f[B]BC_ENV_ARGS\f[R].
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
exit.
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-f\f[R] \f[I]file\f[R], \f[B]\[en]file\f[R]=\f[I]file\f[R]
\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
were read through \f[B]stdin\f[R].
If expressions are also given (see above), the expressions are evaluated
@ -217,9 +216,9 @@ If this option is given on the command-line (i.e., not in
\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
then after processing all expressions and files, bc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
\f[B]-f\f[R] or \f[B]\[en]file\f[R].
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
\f[B]-f\f[R] or \f[B]--file\f[R].
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
exit.
.PP
@ -284,8 +283,8 @@ constant numbers.
It is the \[lq]input\[rq] base, or the number base used for interpreting
input numbers.
\f[B]ibase\f[R] is initially \f[B]10\f[R].
If the \f[B]-s\f[R] (\f[B]\[en]standard\f[R]) and \f[B]-w\f[R]
(\f[B]\[en]warn\f[R]) flags were not given on the command line, the max
If the \f[B]-s\f[R] (\f[B]--standard\f[R]) and \f[B]-w\f[R]
(\f[B]--warn\f[R]) flags were not given on the command line, the max
allowable value for \f[B]ibase\f[R] is \f[B]36\f[R].
Otherwise, it is \f[B]16\f[R].
The min allowable value for \f[B]ibase\f[R] is \f[B]2\f[R].
@ -445,7 +444,7 @@ 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.
.TP
\f[B]++\f[R] \f[B]\[en]\f[R]
\f[B]++\f[R] \f[B]--\f[R]
Type: Prefix and Postfix
.RS
.PP
@ -528,7 +527,7 @@ Description: \f[B]boolean or\f[R]
.PP
The operators will be described in more detail below.
.TP
\f[B]++\f[R] \f[B]\[en]\f[R]
\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]
@ -908,7 +907,7 @@ 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]\[en]mathlib\f[R] command-line flags are given.
\f[B]--mathlib\f[R] command-line flags are given.
.SS Standard Library
.PP
The
@ -1213,11 +1212,11 @@ interactive mode (see the \f[B]INTERACTIVE MODE\f[R] section), since
bc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
more input when one of those errors occurs in interactive mode.
This is also the case when interactive mode is forced by the
\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.PP
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]\[en]interactive\f[R] option.
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.SH INTERACTIVE MODE
.PP
Per the
@ -1225,7 +1224,7 @@ standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html),
bc(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
and \f[B]\[en]interactive\f[R] option can turn it on in other cases.
and \f[B]--interactive\f[R] option can turn it on in other cases.
.PP
In interactive mode, bc(1) attempts to recover from errors (see the
\f[B]RESET\f[R] section), and in normal execution, flushes

View File

@ -34,8 +34,7 @@ bc - arbitrary-precision decimal arithmetic language and calculator
# SYNOPSIS
**bc** [**-ghilPqsvVw**] [**--global-stacks**] [**--help**] [**--interactive**] [**--mathlib**] [**--no-prompt**] [**--quiet**] [**--standard**] [**--warn**] [**--version**] [**-e** *expr*] [**--expression**=*expr*...] [**-f** *file*...] [**-file**=*file*...]
[*file*...]
**bc** [**-ghilPqsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@ -54,7 +53,7 @@ especially) the GNU bc(1).
The following are the options that bc(1) accepts.
**-g**, **--global-stacks**
**-g**, **-\-global-stacks**
Turns the globals **ibase**, **obase**, and **scale** into stacks.
@ -107,17 +106,17 @@ The following are the options that bc(1) accepts.
This is a **non-portable extension**.
**-h**, **--help**
**-h**, **-\-help**
: Prints a usage message and quits.
**-i**, **--interactive**
**-i**, **-\-interactive**
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
This is a **non-portable extension**.
**-l**, **--mathlib**
**-l**, **-\-mathlib**
: Sets **scale** (see the **SYNTAX** section) to **20** and loads the included
math library before running any code, including any expressions or files
@ -125,7 +124,7 @@ The following are the options that bc(1) accepts.
To learn what is in the library, see the **LIBRARY** section.
**-P**, **--no-prompt**
**-P**, **-\-no-prompt**
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
See the **TTY MODE** section) This is mostly for those users that do not
@ -135,36 +134,36 @@ The following are the options that bc(1) accepts.
This is a **non-portable extension**.
**-q**, **--quiet**
**-q**, **-\-quiet**
: This option is for compatibility with the [GNU bc(1)][2]; it is a no-op.
Without this option, GNU bc(1) prints a copyright header. This bc(1) only
prints the copyright header if one or more of the **-v**, **-V**, or
**--version** options are given.
**-\-version** options are given.
This is a **non-portable extension**.
**-s**, **--standard**
**-s**, **-\-standard**
: Process exactly the language defined by the [standard][1] and error if any
extensions are used.
This is a **non-portable extension**.
**-v**, **-V**, **--version**
**-v**, **-V**, **-\-version**
: Print the version information (copyright header) and exit.
This is a **non-portable extension**.
**-w**, **--warn**
**-w**, **-\-warn**
: Like **-s** and **--standard**, except that warnings (and not errors) are
: Like **-s** and **-\-standard**, except that warnings (and not errors) are
printed for non-standard extensions and execution continues normally.
This is a **non-portable extension**.
**-e** *expr*, **--expression**=*expr*
**-e** *expr*, **-\-expression**=*expr*
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
order. If files are given as well (see below), the expressions and files are
@ -174,14 +173,14 @@ The following are the options that bc(1) accepts.
If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
see the **ENVIRONMENT VARIABLES** section), then after processing all
expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
as an argument at least once to **-f** or **--file**, whether on the
as an argument at least once to **-f** or **-\-file**, whether on the
command-line or in **BC_ENV_ARGS**. However, if any other **-e**,
**--expression**, **-f**, or **--file** arguments are given after **-f-** or
equivalent is given, bc(1) will give a fatal error and exit.
**-\-expression**, **-f**, or **-\-file** arguments are given after **-f-**
or equivalent is given, bc(1) will give a fatal error and exit.
This is a **non-portable extension**.
**-f** *file*, **--file**=*file*
**-f** *file*, **-\-file**=*file*
: Reads in *file* and evaluates it, line by line, as though it were read
through **stdin**. If expressions are also given (see above), the
@ -190,8 +189,8 @@ The following are the options that bc(1) accepts.
If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
see the **ENVIRONMENT VARIABLES** section), then after processing all
expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
as an argument at least once to **-f** or **--file**. However, if any other
**-e**, **--expression**, **-f**, or **--file** arguments are given after
as an argument at least once to **-f** or **-\-file**. However, if any other
**-e**, **-\-expression**, **-f**, or **-\-file** arguments are given after
**-f-** or equivalent is given, bc(1) will give a fatal error and exit.
This is a **non-portable extension**.
@ -246,8 +245,8 @@ Identifiers with more than one character (letter) are a
**ibase** is a global variable determining how to interpret constant numbers. It
is the "input" base, or the number base used for interpreting input numbers.
**ibase** is initially **10**. If the **-s** (**--standard**) and **-w**
(**--warn**) flags were not given on the command line, the max allowable value
**ibase** is initially **10**. If the **-s** (**-\-standard**) and **-w**
(**-\-warn**) flags were not given on the command line, the max allowable value
for **ibase** is **36**. Otherwise, it is **16**. The min allowable value for
**ibase** is **2**. The max allowable value for **ibase** can be queried in
bc(1) programs with the **maxibase()** built-in function.
@ -366,7 +365,7 @@ 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.
**++** **--**
**++** **-\-**
: Type: Prefix and Postfix
@ -440,7 +439,7 @@ precedence.
The operators will be described in more detail below.
**++** **--**
**++** **-\-**
: The prefix and postfix **increment** and **decrement** operators behave
exactly like they would in C. They require a named expression (see the
@ -716,7 +715,7 @@ This is a **non-portable extension**.
# LIBRARY
All of the functions below are available when the **-l** or **--mathlib**
All of the functions below are available when the **-l** or **-\-mathlib**
command-line flags are given.
## Standard Library
@ -992,17 +991,17 @@ The other statuses will only be returned when bc(1) is not in interactive mode
(see the **INTERACTIVE MODE** section), since bc(1) resets its state (see the
**RESET** section) and accepts more input when one of those errors occurs in
interactive mode. This is also the case when interactive mode is forced by the
**-i** flag or **--interactive** option.
**-i** flag or **-\-interactive** option.
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 **-i** flag or
**--interactive** option.
**-\-interactive** option.
# INTERACTIVE MODE
Per the [standard][1], bc(1) has an interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both **stdin** and **stdout**
are hooked to a terminal, but the **-i** flag and **--interactive** option can
are hooked to a terminal, but the **-i** flag and **-\-interactive** option can
turn it on in other cases.
In interactive mode, bc(1) attempts to recover from errors (see the **RESET**

View File

@ -25,19 +25,18 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
.TH "BC" "1" "February 2021" "Gavin D. Howard" "General Commands Manual"
.TH "BC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
.SH NAME
.PP
bc - arbitrary-precision decimal arithmetic language and calculator
.SH SYNOPSIS
.PP
\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]\[en]global-stacks\f[R]]
[\f[B]\[en]help\f[R]] [\f[B]\[en]interactive\f[R]]
[\f[B]\[en]mathlib\f[R]] [\f[B]\[en]no-prompt\f[R]]
[\f[B]\[en]quiet\f[R]] [\f[B]\[en]standard\f[R]] [\f[B]\[en]warn\f[R]]
[\f[B]\[en]version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
[\f[B]\[en]expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
\f[I]file\f[R]\&...] [\f[B]-file\f[R]=\f[I]file\f[R]\&...]
\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]--global-stacks\f[R]]
[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--mathlib\f[R]]
[\f[B]--no-prompt\f[R]] [\f[B]--quiet\f[R]] [\f[B]--standard\f[R]]
[\f[B]--warn\f[R]] [\f[B]--version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
[\f[I]file\f[R]\&...]
.SH DESCRIPTION
.PP
@ -58,7 +57,7 @@ This bc(1) is a drop-in replacement for \f[I]any\f[R] bc(1), including
.PP
The following are the options that bc(1) accepts.
.PP
\f[B]-g\f[R], \f[B]\[en]global-stacks\f[R]
\f[B]-g\f[R], \f[B]--global-stacks\f[R]
.IP
.nf
\f[C]
@ -115,10 +114,10 @@ This is a **non-portable extension**.
\f[R]
.fi
.TP
\f[B]-h\f[R], \f[B]\[en]help\f[R]
\f[B]-h\f[R], \f[B]--help\f[R]
Prints a usage message and quits.
.TP
\f[B]-i\f[R], \f[B]\[en]interactive\f[R]
\f[B]-i\f[R], \f[B]--interactive\f[R]
Forces interactive mode.
(See the \f[B]INTERACTIVE MODE\f[R] section.)
.RS
@ -126,7 +125,7 @@ Forces interactive mode.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-l\f[R], \f[B]\[en]mathlib\f[R]
\f[B]-l\f[R], \f[B]--mathlib\f[R]
Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to \f[B]20\f[R]
and loads the included math library before running any code, including
any expressions or files specified on the command line.
@ -135,25 +134,25 @@ any expressions or files specified on the command line.
To learn what is in the library, see the \f[B]LIBRARY\f[R] section.
.RE
.TP
\f[B]-P\f[R], \f[B]\[en]no-prompt\f[R]
\f[B]-P\f[R], \f[B]--no-prompt\f[R]
This option is a no-op.
.RS
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-q\f[R], \f[B]\[en]quiet\f[R]
\f[B]-q\f[R], \f[B]--quiet\f[R]
This option is for compatibility with the GNU
bc(1) (https://www.gnu.org/software/bc/); it is a no-op.
Without this option, GNU bc(1) prints a copyright header.
This bc(1) only prints the copyright header if one or more of the
\f[B]-v\f[R], \f[B]-V\f[R], or \f[B]\[en]version\f[R] options are given.
\f[B]-v\f[R], \f[B]-V\f[R], or \f[B]--version\f[R] options are given.
.RS
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-s\f[R], \f[B]\[en]standard\f[R]
\f[B]-s\f[R], \f[B]--standard\f[R]
Process exactly the language defined by the
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
and error if any extensions are used.
@ -162,15 +161,15 @@ and error if any extensions are used.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]\[en]version\f[R]
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
Print the version information (copyright header) and exit.
.RS
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-w\f[R], \f[B]\[en]warn\f[R]
Like \f[B]-s\f[R] and \f[B]\[en]standard\f[R], except that warnings (and
\f[B]-w\f[R], \f[B]--warn\f[R]
Like \f[B]-s\f[R] and \f[B]--standard\f[R], except that warnings (and
not errors) are printed for non-standard extensions and execution
continues normally.
.RS
@ -178,7 +177,7 @@ continues normally.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]\[en]expression\f[R]=\f[I]expr\f[R]
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
Evaluates \f[I]expr\f[R].
If multiple expressions are given, they are evaluated in order.
If files are given as well (see below), the expressions and files are
@ -191,17 +190,17 @@ If this option is given on the command-line (i.e., not in
\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
then after processing all expressions and files, bc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
\f[B]-f\f[R] or \f[B]\[en]file\f[R], whether on the command-line or in
\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
\f[B]BC_ENV_ARGS\f[R].
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
exit.
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-f\f[R] \f[I]file\f[R], \f[B]\[en]file\f[R]=\f[I]file\f[R]
\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
were read through \f[B]stdin\f[R].
If expressions are also given (see above), the expressions are evaluated
@ -212,9 +211,9 @@ If this option is given on the command-line (i.e., not in
\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
then after processing all expressions and files, bc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
\f[B]-f\f[R] or \f[B]\[en]file\f[R].
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
\f[B]-f\f[R] or \f[B]--file\f[R].
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
exit.
.PP
@ -279,8 +278,8 @@ constant numbers.
It is the \[lq]input\[rq] base, or the number base used for interpreting
input numbers.
\f[B]ibase\f[R] is initially \f[B]10\f[R].
If the \f[B]-s\f[R] (\f[B]\[en]standard\f[R]) and \f[B]-w\f[R]
(\f[B]\[en]warn\f[R]) flags were not given on the command line, the max
If the \f[B]-s\f[R] (\f[B]--standard\f[R]) and \f[B]-w\f[R]
(\f[B]--warn\f[R]) flags were not given on the command line, the max
allowable value for \f[B]ibase\f[R] is \f[B]36\f[R].
Otherwise, it is \f[B]16\f[R].
The min allowable value for \f[B]ibase\f[R] is \f[B]2\f[R].
@ -440,7 +439,7 @@ 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.
.TP
\f[B]++\f[R] \f[B]\[en]\f[R]
\f[B]++\f[R] \f[B]--\f[R]
Type: Prefix and Postfix
.RS
.PP
@ -523,7 +522,7 @@ Description: \f[B]boolean or\f[R]
.PP
The operators will be described in more detail below.
.TP
\f[B]++\f[R] \f[B]\[en]\f[R]
\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]
@ -903,7 +902,7 @@ 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]\[en]mathlib\f[R] command-line flags are given.
\f[B]--mathlib\f[R] command-line flags are given.
.SS Standard Library
.PP
The
@ -1208,11 +1207,11 @@ interactive mode (see the \f[B]INTERACTIVE MODE\f[R] section), since
bc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
more input when one of those errors occurs in interactive mode.
This is also the case when interactive mode is forced by the
\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.PP
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]\[en]interactive\f[R] option.
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.SH INTERACTIVE MODE
.PP
Per the
@ -1220,7 +1219,7 @@ standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html),
bc(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
and \f[B]\[en]interactive\f[R] option can turn it on in other cases.
and \f[B]--interactive\f[R] option can turn it on in other cases.
.PP
In interactive mode, bc(1) attempts to recover from errors (see the
\f[B]RESET\f[R] section), and in normal execution, flushes

View File

@ -34,8 +34,7 @@ bc - arbitrary-precision decimal arithmetic language and calculator
# SYNOPSIS
**bc** [**-ghilPqsvVw**] [**--global-stacks**] [**--help**] [**--interactive**] [**--mathlib**] [**--no-prompt**] [**--quiet**] [**--standard**] [**--warn**] [**--version**] [**-e** *expr*] [**--expression**=*expr*...] [**-f** *file*...] [**-file**=*file*...]
[*file*...]
**bc** [**-ghilPqsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@ -54,7 +53,7 @@ especially) the GNU bc(1).
The following are the options that bc(1) accepts.
**-g**, **--global-stacks**
**-g**, **-\-global-stacks**
Turns the globals **ibase**, **obase**, and **scale** into stacks.
@ -107,17 +106,17 @@ The following are the options that bc(1) accepts.
This is a **non-portable extension**.
**-h**, **--help**
**-h**, **-\-help**
: Prints a usage message and quits.
**-i**, **--interactive**
**-i**, **-\-interactive**
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
This is a **non-portable extension**.
**-l**, **--mathlib**
**-l**, **-\-mathlib**
: Sets **scale** (see the **SYNTAX** section) to **20** and loads the included
math library before running any code, including any expressions or files
@ -125,42 +124,42 @@ The following are the options that bc(1) accepts.
To learn what is in the library, see the **LIBRARY** section.
**-P**, **--no-prompt**
**-P**, **-\-no-prompt**
: This option is a no-op.
This is a **non-portable extension**.
**-q**, **--quiet**
**-q**, **-\-quiet**
: This option is for compatibility with the [GNU bc(1)][2]; it is a no-op.
Without this option, GNU bc(1) prints a copyright header. This bc(1) only
prints the copyright header if one or more of the **-v**, **-V**, or
**--version** options are given.
**-\-version** options are given.
This is a **non-portable extension**.
**-s**, **--standard**
**-s**, **-\-standard**
: Process exactly the language defined by the [standard][1] and error if any
extensions are used.
This is a **non-portable extension**.
**-v**, **-V**, **--version**
**-v**, **-V**, **-\-version**
: Print the version information (copyright header) and exit.
This is a **non-portable extension**.
**-w**, **--warn**
**-w**, **-\-warn**
: Like **-s** and **--standard**, except that warnings (and not errors) are
: Like **-s** and **-\-standard**, except that warnings (and not errors) are
printed for non-standard extensions and execution continues normally.
This is a **non-portable extension**.
**-e** *expr*, **--expression**=*expr*
**-e** *expr*, **-\-expression**=*expr*
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
order. If files are given as well (see below), the expressions and files are
@ -170,14 +169,14 @@ The following are the options that bc(1) accepts.
If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
see the **ENVIRONMENT VARIABLES** section), then after processing all
expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
as an argument at least once to **-f** or **--file**, whether on the
as an argument at least once to **-f** or **-\-file**, whether on the
command-line or in **BC_ENV_ARGS**. However, if any other **-e**,
**--expression**, **-f**, or **--file** arguments are given after **-f-** or
equivalent is given, bc(1) will give a fatal error and exit.
**-\-expression**, **-f**, or **-\-file** arguments are given after **-f-**
or equivalent is given, bc(1) will give a fatal error and exit.
This is a **non-portable extension**.
**-f** *file*, **--file**=*file*
**-f** *file*, **-\-file**=*file*
: Reads in *file* and evaluates it, line by line, as though it were read
through **stdin**. If expressions are also given (see above), the
@ -186,8 +185,8 @@ The following are the options that bc(1) accepts.
If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
see the **ENVIRONMENT VARIABLES** section), then after processing all
expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
as an argument at least once to **-f** or **--file**. However, if any other
**-e**, **--expression**, **-f**, or **--file** arguments are given after
as an argument at least once to **-f** or **-\-file**. However, if any other
**-e**, **-\-expression**, **-f**, or **-\-file** arguments are given after
**-f-** or equivalent is given, bc(1) will give a fatal error and exit.
This is a **non-portable extension**.
@ -242,8 +241,8 @@ Identifiers with more than one character (letter) are a
**ibase** is a global variable determining how to interpret constant numbers. It
is the "input" base, or the number base used for interpreting input numbers.
**ibase** is initially **10**. If the **-s** (**--standard**) and **-w**
(**--warn**) flags were not given on the command line, the max allowable value
**ibase** is initially **10**. If the **-s** (**-\-standard**) and **-w**
(**-\-warn**) flags were not given on the command line, the max allowable value
for **ibase** is **36**. Otherwise, it is **16**. The min allowable value for
**ibase** is **2**. The max allowable value for **ibase** can be queried in
bc(1) programs with the **maxibase()** built-in function.
@ -362,7 +361,7 @@ 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.
**++** **--**
**++** **-\-**
: Type: Prefix and Postfix
@ -436,7 +435,7 @@ precedence.
The operators will be described in more detail below.
**++** **--**
**++** **-\-**
: The prefix and postfix **increment** and **decrement** operators behave
exactly like they would in C. They require a named expression (see the
@ -712,7 +711,7 @@ This is a **non-portable extension**.
# LIBRARY
All of the functions below are available when the **-l** or **--mathlib**
All of the functions below are available when the **-l** or **-\-mathlib**
command-line flags are given.
## Standard Library
@ -988,17 +987,17 @@ The other statuses will only be returned when bc(1) is not in interactive mode
(see the **INTERACTIVE MODE** section), since bc(1) resets its state (see the
**RESET** section) and accepts more input when one of those errors occurs in
interactive mode. This is also the case when interactive mode is forced by the
**-i** flag or **--interactive** option.
**-i** flag or **-\-interactive** option.
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 **-i** flag or
**--interactive** option.
**-\-interactive** option.
# INTERACTIVE MODE
Per the [standard][1], bc(1) has an interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both **stdin** and **stdout**
are hooked to a terminal, but the **-i** flag and **--interactive** option can
are hooked to a terminal, but the **-i** flag and **-\-interactive** option can
turn it on in other cases.
In interactive mode, bc(1) attempts to recover from errors (see the **RESET**

View File

@ -25,19 +25,18 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
.TH "BC" "1" "February 2021" "Gavin D. Howard" "General Commands Manual"
.TH "BC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
.SH NAME
.PP
bc - arbitrary-precision decimal arithmetic language and calculator
.SH SYNOPSIS
.PP
\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]\[en]global-stacks\f[R]]
[\f[B]\[en]help\f[R]] [\f[B]\[en]interactive\f[R]]
[\f[B]\[en]mathlib\f[R]] [\f[B]\[en]no-prompt\f[R]]
[\f[B]\[en]quiet\f[R]] [\f[B]\[en]standard\f[R]] [\f[B]\[en]warn\f[R]]
[\f[B]\[en]version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
[\f[B]\[en]expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
\f[I]file\f[R]\&...] [\f[B]-file\f[R]=\f[I]file\f[R]\&...]
\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]--global-stacks\f[R]]
[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--mathlib\f[R]]
[\f[B]--no-prompt\f[R]] [\f[B]--quiet\f[R]] [\f[B]--standard\f[R]]
[\f[B]--warn\f[R]] [\f[B]--version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
[\f[I]file\f[R]\&...]
.SH DESCRIPTION
.PP
@ -58,7 +57,7 @@ This bc(1) is a drop-in replacement for \f[I]any\f[R] bc(1), including
.PP
The following are the options that bc(1) accepts.
.PP
\f[B]-g\f[R], \f[B]\[en]global-stacks\f[R]
\f[B]-g\f[R], \f[B]--global-stacks\f[R]
.IP
.nf
\f[C]
@ -115,10 +114,10 @@ This is a **non-portable extension**.
\f[R]
.fi
.TP
\f[B]-h\f[R], \f[B]\[en]help\f[R]
\f[B]-h\f[R], \f[B]--help\f[R]
Prints a usage message and quits.
.TP
\f[B]-i\f[R], \f[B]\[en]interactive\f[R]
\f[B]-i\f[R], \f[B]--interactive\f[R]
Forces interactive mode.
(See the \f[B]INTERACTIVE MODE\f[R] section.)
.RS
@ -126,7 +125,7 @@ Forces interactive mode.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-l\f[R], \f[B]\[en]mathlib\f[R]
\f[B]-l\f[R], \f[B]--mathlib\f[R]
Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to \f[B]20\f[R]
and loads the included math library before running any code, including
any expressions or files specified on the command line.
@ -135,25 +134,25 @@ any expressions or files specified on the command line.
To learn what is in the library, see the \f[B]LIBRARY\f[R] section.
.RE
.TP
\f[B]-P\f[R], \f[B]\[en]no-prompt\f[R]
\f[B]-P\f[R], \f[B]--no-prompt\f[R]
This option is a no-op.
.RS
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-q\f[R], \f[B]\[en]quiet\f[R]
\f[B]-q\f[R], \f[B]--quiet\f[R]
This option is for compatibility with the GNU
bc(1) (https://www.gnu.org/software/bc/); it is a no-op.
Without this option, GNU bc(1) prints a copyright header.
This bc(1) only prints the copyright header if one or more of the
\f[B]-v\f[R], \f[B]-V\f[R], or \f[B]\[en]version\f[R] options are given.
\f[B]-v\f[R], \f[B]-V\f[R], or \f[B]--version\f[R] options are given.
.RS
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-s\f[R], \f[B]\[en]standard\f[R]
\f[B]-s\f[R], \f[B]--standard\f[R]
Process exactly the language defined by the
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
and error if any extensions are used.
@ -162,15 +161,15 @@ and error if any extensions are used.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]\[en]version\f[R]
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
Print the version information (copyright header) and exit.
.RS
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-w\f[R], \f[B]\[en]warn\f[R]
Like \f[B]-s\f[R] and \f[B]\[en]standard\f[R], except that warnings (and
\f[B]-w\f[R], \f[B]--warn\f[R]
Like \f[B]-s\f[R] and \f[B]--standard\f[R], except that warnings (and
not errors) are printed for non-standard extensions and execution
continues normally.
.RS
@ -178,7 +177,7 @@ continues normally.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]\[en]expression\f[R]=\f[I]expr\f[R]
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
Evaluates \f[I]expr\f[R].
If multiple expressions are given, they are evaluated in order.
If files are given as well (see below), the expressions and files are
@ -191,17 +190,17 @@ If this option is given on the command-line (i.e., not in
\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
then after processing all expressions and files, bc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
\f[B]-f\f[R] or \f[B]\[en]file\f[R], whether on the command-line or in
\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
\f[B]BC_ENV_ARGS\f[R].
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
exit.
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-f\f[R] \f[I]file\f[R], \f[B]\[en]file\f[R]=\f[I]file\f[R]
\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
were read through \f[B]stdin\f[R].
If expressions are also given (see above), the expressions are evaluated
@ -212,9 +211,9 @@ If this option is given on the command-line (i.e., not in
\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
then after processing all expressions and files, bc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
\f[B]-f\f[R] or \f[B]\[en]file\f[R].
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
\f[B]-f\f[R] or \f[B]--file\f[R].
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
exit.
.PP
@ -279,8 +278,8 @@ constant numbers.
It is the \[lq]input\[rq] base, or the number base used for interpreting
input numbers.
\f[B]ibase\f[R] is initially \f[B]10\f[R].
If the \f[B]-s\f[R] (\f[B]\[en]standard\f[R]) and \f[B]-w\f[R]
(\f[B]\[en]warn\f[R]) flags were not given on the command line, the max
If the \f[B]-s\f[R] (\f[B]--standard\f[R]) and \f[B]-w\f[R]
(\f[B]--warn\f[R]) flags were not given on the command line, the max
allowable value for \f[B]ibase\f[R] is \f[B]36\f[R].
Otherwise, it is \f[B]16\f[R].
The min allowable value for \f[B]ibase\f[R] is \f[B]2\f[R].
@ -440,7 +439,7 @@ 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.
.TP
\f[B]++\f[R] \f[B]\[en]\f[R]
\f[B]++\f[R] \f[B]--\f[R]
Type: Prefix and Postfix
.RS
.PP
@ -523,7 +522,7 @@ Description: \f[B]boolean or\f[R]
.PP
The operators will be described in more detail below.
.TP
\f[B]++\f[R] \f[B]\[en]\f[R]
\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]
@ -903,7 +902,7 @@ 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]\[en]mathlib\f[R] command-line flags are given.
\f[B]--mathlib\f[R] command-line flags are given.
.SS Standard Library
.PP
The
@ -1208,11 +1207,11 @@ interactive mode (see the \f[B]INTERACTIVE MODE\f[R] section), since
bc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
more input when one of those errors occurs in interactive mode.
This is also the case when interactive mode is forced by the
\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.PP
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]\[en]interactive\f[R] option.
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.SH INTERACTIVE MODE
.PP
Per the
@ -1220,7 +1219,7 @@ standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html),
bc(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
and \f[B]\[en]interactive\f[R] option can turn it on in other cases.
and \f[B]--interactive\f[R] option can turn it on in other cases.
.PP
In interactive mode, bc(1) attempts to recover from errors (see the
\f[B]RESET\f[R] section), and in normal execution, flushes

View File

@ -34,8 +34,7 @@ bc - arbitrary-precision decimal arithmetic language and calculator
# SYNOPSIS
**bc** [**-ghilPqsvVw**] [**--global-stacks**] [**--help**] [**--interactive**] [**--mathlib**] [**--no-prompt**] [**--quiet**] [**--standard**] [**--warn**] [**--version**] [**-e** *expr*] [**--expression**=*expr*...] [**-f** *file*...] [**-file**=*file*...]
[*file*...]
**bc** [**-ghilPqsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@ -54,7 +53,7 @@ especially) the GNU bc(1).
The following are the options that bc(1) accepts.
**-g**, **--global-stacks**
**-g**, **-\-global-stacks**
Turns the globals **ibase**, **obase**, and **scale** into stacks.
@ -107,17 +106,17 @@ The following are the options that bc(1) accepts.
This is a **non-portable extension**.
**-h**, **--help**
**-h**, **-\-help**
: Prints a usage message and quits.
**-i**, **--interactive**
**-i**, **-\-interactive**
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
This is a **non-portable extension**.
**-l**, **--mathlib**
**-l**, **-\-mathlib**
: Sets **scale** (see the **SYNTAX** section) to **20** and loads the included
math library before running any code, including any expressions or files
@ -125,42 +124,42 @@ The following are the options that bc(1) accepts.
To learn what is in the library, see the **LIBRARY** section.
**-P**, **--no-prompt**
**-P**, **-\-no-prompt**
: This option is a no-op.
This is a **non-portable extension**.
**-q**, **--quiet**
**-q**, **-\-quiet**
: This option is for compatibility with the [GNU bc(1)][2]; it is a no-op.
Without this option, GNU bc(1) prints a copyright header. This bc(1) only
prints the copyright header if one or more of the **-v**, **-V**, or
**--version** options are given.
**-\-version** options are given.
This is a **non-portable extension**.
**-s**, **--standard**
**-s**, **-\-standard**
: Process exactly the language defined by the [standard][1] and error if any
extensions are used.
This is a **non-portable extension**.
**-v**, **-V**, **--version**
**-v**, **-V**, **-\-version**
: Print the version information (copyright header) and exit.
This is a **non-portable extension**.
**-w**, **--warn**
**-w**, **-\-warn**
: Like **-s** and **--standard**, except that warnings (and not errors) are
: Like **-s** and **-\-standard**, except that warnings (and not errors) are
printed for non-standard extensions and execution continues normally.
This is a **non-portable extension**.
**-e** *expr*, **--expression**=*expr*
**-e** *expr*, **-\-expression**=*expr*
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
order. If files are given as well (see below), the expressions and files are
@ -170,14 +169,14 @@ The following are the options that bc(1) accepts.
If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
see the **ENVIRONMENT VARIABLES** section), then after processing all
expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
as an argument at least once to **-f** or **--file**, whether on the
as an argument at least once to **-f** or **-\-file**, whether on the
command-line or in **BC_ENV_ARGS**. However, if any other **-e**,
**--expression**, **-f**, or **--file** arguments are given after **-f-** or
equivalent is given, bc(1) will give a fatal error and exit.
**-\-expression**, **-f**, or **-\-file** arguments are given after **-f-**
or equivalent is given, bc(1) will give a fatal error and exit.
This is a **non-portable extension**.
**-f** *file*, **--file**=*file*
**-f** *file*, **-\-file**=*file*
: Reads in *file* and evaluates it, line by line, as though it were read
through **stdin**. If expressions are also given (see above), the
@ -186,8 +185,8 @@ The following are the options that bc(1) accepts.
If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
see the **ENVIRONMENT VARIABLES** section), then after processing all
expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
as an argument at least once to **-f** or **--file**. However, if any other
**-e**, **--expression**, **-f**, or **--file** arguments are given after
as an argument at least once to **-f** or **-\-file**. However, if any other
**-e**, **-\-expression**, **-f**, or **-\-file** arguments are given after
**-f-** or equivalent is given, bc(1) will give a fatal error and exit.
This is a **non-portable extension**.
@ -242,8 +241,8 @@ Identifiers with more than one character (letter) are a
**ibase** is a global variable determining how to interpret constant numbers. It
is the "input" base, or the number base used for interpreting input numbers.
**ibase** is initially **10**. If the **-s** (**--standard**) and **-w**
(**--warn**) flags were not given on the command line, the max allowable value
**ibase** is initially **10**. If the **-s** (**-\-standard**) and **-w**
(**-\-warn**) flags were not given on the command line, the max allowable value
for **ibase** is **36**. Otherwise, it is **16**. The min allowable value for
**ibase** is **2**. The max allowable value for **ibase** can be queried in
bc(1) programs with the **maxibase()** built-in function.
@ -362,7 +361,7 @@ 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.
**++** **--**
**++** **-\-**
: Type: Prefix and Postfix
@ -436,7 +435,7 @@ precedence.
The operators will be described in more detail below.
**++** **--**
**++** **-\-**
: The prefix and postfix **increment** and **decrement** operators behave
exactly like they would in C. They require a named expression (see the
@ -712,7 +711,7 @@ This is a **non-portable extension**.
# LIBRARY
All of the functions below are available when the **-l** or **--mathlib**
All of the functions below are available when the **-l** or **-\-mathlib**
command-line flags are given.
## Standard Library
@ -988,17 +987,17 @@ The other statuses will only be returned when bc(1) is not in interactive mode
(see the **INTERACTIVE MODE** section), since bc(1) resets its state (see the
**RESET** section) and accepts more input when one of those errors occurs in
interactive mode. This is also the case when interactive mode is forced by the
**-i** flag or **--interactive** option.
**-i** flag or **-\-interactive** option.
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 **-i** flag or
**--interactive** option.
**-\-interactive** option.
# INTERACTIVE MODE
Per the [standard][1], bc(1) has an interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both **stdin** and **stdout**
are hooked to a terminal, but the **-i** flag and **--interactive** option can
are hooked to a terminal, but the **-i** flag and **-\-interactive** option can
turn it on in other cases.
In interactive mode, bc(1) attempts to recover from errors (see the **RESET**

View File

@ -25,19 +25,18 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
.TH "BC" "1" "February 2021" "Gavin D. Howard" "General Commands Manual"
.TH "BC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
.SH NAME
.PP
bc - arbitrary-precision decimal arithmetic language and calculator
.SH SYNOPSIS
.PP
\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]\[en]global-stacks\f[R]]
[\f[B]\[en]help\f[R]] [\f[B]\[en]interactive\f[R]]
[\f[B]\[en]mathlib\f[R]] [\f[B]\[en]no-prompt\f[R]]
[\f[B]\[en]quiet\f[R]] [\f[B]\[en]standard\f[R]] [\f[B]\[en]warn\f[R]]
[\f[B]\[en]version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
[\f[B]\[en]expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
\f[I]file\f[R]\&...] [\f[B]-file\f[R]=\f[I]file\f[R]\&...]
\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]--global-stacks\f[R]]
[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--mathlib\f[R]]
[\f[B]--no-prompt\f[R]] [\f[B]--quiet\f[R]] [\f[B]--standard\f[R]]
[\f[B]--warn\f[R]] [\f[B]--version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
[\f[I]file\f[R]\&...]
.SH DESCRIPTION
.PP
@ -55,7 +54,7 @@ the command line and executes them before reading from \f[B]stdin\f[R].
.PP
The following are the options that bc(1) accepts.
.TP
\f[B]-g\f[R], \f[B]\[en]global-stacks\f[R]
\f[B]-g\f[R], \f[B]--global-stacks\f[R]
Turns the globals \f[B]ibase\f[R], \f[B]obase\f[R], \f[B]scale\f[R], and
\f[B]seed\f[R] into stacks.
.RS
@ -147,10 +146,10 @@ is ignored.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-h\f[R], \f[B]\[en]help\f[R]
\f[B]-h\f[R], \f[B]--help\f[R]
Prints a usage message and quits.
.TP
\f[B]-i\f[R], \f[B]\[en]interactive\f[R]
\f[B]-i\f[R], \f[B]--interactive\f[R]
Forces interactive mode.
(See the \f[B]INTERACTIVE MODE\f[R] section.)
.RS
@ -158,7 +157,7 @@ Forces interactive mode.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-l\f[R], \f[B]\[en]mathlib\f[R]
\f[B]-l\f[R], \f[B]--mathlib\f[R]
Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to \f[B]20\f[R]
and loads the included math library and the extended math library before
running any code, including any expressions or files specified on the
@ -168,7 +167,7 @@ command line.
To learn what is in the libraries, see the \f[B]LIBRARY\f[R] section.
.RE
.TP
\f[B]-P\f[R], \f[B]\[en]no-prompt\f[R]
\f[B]-P\f[R], \f[B]--no-prompt\f[R]
Disables the prompt in TTY mode.
(The prompt is only enabled in TTY mode.
See the \f[B]TTY MODE\f[R] section) This is mostly for those users that
@ -180,18 +179,18 @@ Most of those users would want to put this option in
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-q\f[R], \f[B]\[en]quiet\f[R]
\f[B]-q\f[R], \f[B]--quiet\f[R]
This option is for compatibility with the GNU
bc(1) (https://www.gnu.org/software/bc/); it is a no-op.
Without this option, GNU bc(1) prints a copyright header.
This bc(1) only prints the copyright header if one or more of the
\f[B]-v\f[R], \f[B]-V\f[R], or \f[B]\[en]version\f[R] options are given.
\f[B]-v\f[R], \f[B]-V\f[R], or \f[B]--version\f[R] options are given.
.RS
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-s\f[R], \f[B]\[en]standard\f[R]
\f[B]-s\f[R], \f[B]--standard\f[R]
Process exactly the language defined by the
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
and error if any extensions are used.
@ -200,15 +199,15 @@ and error if any extensions are used.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]\[en]version\f[R]
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
Print the version information (copyright header) and exit.
.RS
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-w\f[R], \f[B]\[en]warn\f[R]
Like \f[B]-s\f[R] and \f[B]\[en]standard\f[R], except that warnings (and
\f[B]-w\f[R], \f[B]--warn\f[R]
Like \f[B]-s\f[R] and \f[B]--standard\f[R], except that warnings (and
not errors) are printed for non-standard extensions and execution
continues normally.
.RS
@ -216,7 +215,7 @@ continues normally.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]\[en]expression\f[R]=\f[I]expr\f[R]
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
Evaluates \f[I]expr\f[R].
If multiple expressions are given, they are evaluated in order.
If files are given as well (see below), the expressions and files are
@ -229,17 +228,17 @@ If this option is given on the command-line (i.e., not in
\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
then after processing all expressions and files, bc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
\f[B]-f\f[R] or \f[B]\[en]file\f[R], whether on the command-line or in
\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
\f[B]BC_ENV_ARGS\f[R].
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
exit.
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-f\f[R] \f[I]file\f[R], \f[B]\[en]file\f[R]=\f[I]file\f[R]
\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
were read through \f[B]stdin\f[R].
If expressions are also given (see above), the expressions are evaluated
@ -250,9 +249,9 @@ If this option is given on the command-line (i.e., not in
\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
then after processing all expressions and files, bc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
\f[B]-f\f[R] or \f[B]\[en]file\f[R].
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
\f[B]-f\f[R] or \f[B]--file\f[R].
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
exit.
.PP
@ -317,8 +316,8 @@ constant numbers.
It is the \[lq]input\[rq] base, or the number base used for interpreting
input numbers.
\f[B]ibase\f[R] is initially \f[B]10\f[R].
If the \f[B]-s\f[R] (\f[B]\[en]standard\f[R]) and \f[B]-w\f[R]
(\f[B]\[en]warn\f[R]) flags were not given on the command line, the max
If the \f[B]-s\f[R] (\f[B]--standard\f[R]) and \f[B]-w\f[R]
(\f[B]--warn\f[R]) flags were not given on the command line, the max
allowable value for \f[B]ibase\f[R] is \f[B]36\f[R].
Otherwise, it is \f[B]16\f[R].
The min allowable value for \f[B]ibase\f[R] is \f[B]2\f[R].
@ -577,7 +576,7 @@ 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.
.TP
\f[B]++\f[R] \f[B]\[en]\f[R]
\f[B]++\f[R] \f[B]--\f[R]
Type: Prefix and Postfix
.RS
.PP
@ -687,7 +686,7 @@ Description: \f[B]boolean or\f[R]
.PP
The operators will be described in more detail below.
.TP
\f[B]++\f[R] \f[B]\[en]\f[R]
\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]
@ -1133,7 +1132,7 @@ This is a \f[B]non-portable extension\f[R].
.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]\[en]mathlib\f[R] command-line
available when the \f[B]-l\f[R] or \f[B]--mathlib\f[R] command-line
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.
@ -1194,7 +1193,7 @@ Functions\f[R] subsection below).
.SS Extended Library
.PP
The extended library is \f[I]not\f[R] loaded when the
\f[B]-s\f[R]/\f[B]\[en]standard\f[R] or \f[B]-w\f[R]/\f[B]\[en]warn\f[R]
\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
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html).
.PP
@ -1952,11 +1951,11 @@ interactive mode (see the \f[B]INTERACTIVE MODE\f[R] section), since
bc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
more input when one of those errors occurs in interactive mode.
This is also the case when interactive mode is forced by the
\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.PP
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]\[en]interactive\f[R] option.
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.SH INTERACTIVE MODE
.PP
Per the
@ -1964,7 +1963,7 @@ standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html),
bc(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
and \f[B]\[en]interactive\f[R] option can turn it on in other cases.
and \f[B]--interactive\f[R] option can turn it on in other cases.
.PP
In interactive mode, bc(1) attempts to recover from errors (see the
\f[B]RESET\f[R] section), and in normal execution, flushes

View File

@ -34,8 +34,7 @@ bc - arbitrary-precision decimal arithmetic language and calculator
# SYNOPSIS
**bc** [**-ghilPqsvVw**] [**--global-stacks**] [**--help**] [**--interactive**] [**--mathlib**] [**--no-prompt**] [**--quiet**] [**--standard**] [**--warn**] [**--version**] [**-e** *expr*] [**--expression**=*expr*...] [**-f** *file*...] [**-file**=*file*...]
[*file*...]
**bc** [**-ghilPqsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@ -51,7 +50,7 @@ command line and executes them before reading from **stdin**.
The following are the options that bc(1) accepts.
**-g**, **--global-stacks**
**-g**, **-\-global-stacks**
: Turns the globals **ibase**, **obase**, **scale**, and **seed** into stacks.
@ -119,17 +118,17 @@ The following are the options that bc(1) accepts.
This is a **non-portable extension**.
**-h**, **--help**
**-h**, **-\-help**
: Prints a usage message and quits.
**-i**, **--interactive**
**-i**, **-\-interactive**
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
This is a **non-portable extension**.
**-l**, **--mathlib**
**-l**, **-\-mathlib**
: Sets **scale** (see the **SYNTAX** section) to **20** and loads the included
math library and the extended math library before running any code,
@ -137,7 +136,7 @@ The following are the options that bc(1) accepts.
To learn what is in the libraries, see the **LIBRARY** section.
**-P**, **--no-prompt**
**-P**, **-\-no-prompt**
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
See the **TTY MODE** section) This is mostly for those users that do not
@ -147,36 +146,36 @@ The following are the options that bc(1) accepts.
This is a **non-portable extension**.
**-q**, **--quiet**
**-q**, **-\-quiet**
: This option is for compatibility with the [GNU bc(1)][2]; it is a no-op.
Without this option, GNU bc(1) prints a copyright header. This bc(1) only
prints the copyright header if one or more of the **-v**, **-V**, or
**--version** options are given.
**-\-version** options are given.
This is a **non-portable extension**.
**-s**, **--standard**
**-s**, **-\-standard**
: Process exactly the language defined by the [standard][1] and error if any
extensions are used.
This is a **non-portable extension**.
**-v**, **-V**, **--version**
**-v**, **-V**, **-\-version**
: Print the version information (copyright header) and exit.
This is a **non-portable extension**.
**-w**, **--warn**
**-w**, **-\-warn**
: Like **-s** and **--standard**, except that warnings (and not errors) are
: Like **-s** and **-\-standard**, except that warnings (and not errors) are
printed for non-standard extensions and execution continues normally.
This is a **non-portable extension**.
**-e** *expr*, **--expression**=*expr*
**-e** *expr*, **-\-expression**=*expr*
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
order. If files are given as well (see below), the expressions and files are
@ -186,14 +185,14 @@ The following are the options that bc(1) accepts.
If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
see the **ENVIRONMENT VARIABLES** section), then after processing all
expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
as an argument at least once to **-f** or **--file**, whether on the
as an argument at least once to **-f** or **-\-file**, whether on the
command-line or in **BC_ENV_ARGS**. However, if any other **-e**,
**--expression**, **-f**, or **--file** arguments are given after **-f-** or
equivalent is given, bc(1) will give a fatal error and exit.
**-\-expression**, **-f**, or **-\-file** arguments are given after **-f-**
or equivalent is given, bc(1) will give a fatal error and exit.
This is a **non-portable extension**.
**-f** *file*, **--file**=*file*
**-f** *file*, **-\-file**=*file*
: Reads in *file* and evaluates it, line by line, as though it were read
through **stdin**. If expressions are also given (see above), the
@ -202,8 +201,8 @@ The following are the options that bc(1) accepts.
If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
see the **ENVIRONMENT VARIABLES** section), then after processing all
expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
as an argument at least once to **-f** or **--file**. However, if any other
**-e**, **--expression**, **-f**, or **--file** arguments are given after
as an argument at least once to **-f** or **-\-file**. However, if any other
**-e**, **-\-expression**, **-f**, or **-\-file** arguments are given after
**-f-** or equivalent is given, bc(1) will give a fatal error and exit.
This is a **non-portable extension**.
@ -258,8 +257,8 @@ Identifiers with more than one character (letter) are a
**ibase** is a global variable determining how to interpret constant numbers. It
is the "input" base, or the number base used for interpreting input numbers.
**ibase** is initially **10**. If the **-s** (**--standard**) and **-w**
(**--warn**) flags were not given on the command line, the max allowable value
**ibase** is initially **10**. If the **-s** (**-\-standard**) and **-w**
(**-\-warn**) flags were not given on the command line, the max allowable value
for **ibase** is **36**. Otherwise, it is **16**. The min allowable value for
**ibase** is **2**. The max allowable value for **ibase** can be queried in
bc(1) programs with the **maxibase()** built-in function.
@ -449,7 +448,7 @@ 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.
**++** **--**
**++** **-\-**
: Type: Prefix and Postfix
@ -547,7 +546,7 @@ precedence.
The operators will be described in more detail below.
**++** **--**
**++** **-\-**
: The prefix and postfix **increment** and **decrement** operators behave
exactly like they would in C. They require a named expression (see the
@ -878,7 +877,7 @@ This is a **non-portable extension**.
All of the functions below, including the functions in the extended math
library (see the *Extended Library* subsection below), are available when the
**-l** or **--mathlib** command-line flags are given, except that the extended
**-l** or **-\-mathlib** command-line flags are given, except that the extended
math library is not available when the **-s** option, the **-w** option, or
equivalents are given.
@ -930,8 +929,8 @@ The [standard][1] defines the following functions for the math library:
## Extended Library
The extended library is *not* loaded when the **-s**/**--standard** or
**-w**/**--warn** options are given since they are not part of the library
The extended library is *not* loaded when the **-s**/**-\-standard** or
**-w**/**-\-warn** options are given since they are not part of the library
defined by the [standard][1].
The extended library is a **non-portable extension**.
@ -1599,17 +1598,17 @@ The other statuses will only be returned when bc(1) is not in interactive mode
(see the **INTERACTIVE MODE** section), since bc(1) resets its state (see the
**RESET** section) and accepts more input when one of those errors occurs in
interactive mode. This is also the case when interactive mode is forced by the
**-i** flag or **--interactive** option.
**-i** flag or **-\-interactive** option.
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 **-i** flag or
**--interactive** option.
**-\-interactive** option.
# INTERACTIVE MODE
Per the [standard][1], bc(1) has an interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both **stdin** and **stdout**
are hooked to a terminal, but the **-i** flag and **--interactive** option can
are hooked to a terminal, but the **-i** flag and **-\-interactive** option can
turn it on in other cases.
In interactive mode, bc(1) attempts to recover from errors (see the **RESET**

View File

@ -25,19 +25,18 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
.TH "BC" "1" "February 2021" "Gavin D. Howard" "General Commands Manual"
.TH "BC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
.SH NAME
.PP
bc - arbitrary-precision decimal arithmetic language and calculator
.SH SYNOPSIS
.PP
\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]\[en]global-stacks\f[R]]
[\f[B]\[en]help\f[R]] [\f[B]\[en]interactive\f[R]]
[\f[B]\[en]mathlib\f[R]] [\f[B]\[en]no-prompt\f[R]]
[\f[B]\[en]quiet\f[R]] [\f[B]\[en]standard\f[R]] [\f[B]\[en]warn\f[R]]
[\f[B]\[en]version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
[\f[B]\[en]expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
\f[I]file\f[R]\&...] [\f[B]-file\f[R]=\f[I]file\f[R]\&...]
\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]--global-stacks\f[R]]
[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--mathlib\f[R]]
[\f[B]--no-prompt\f[R]] [\f[B]--quiet\f[R]] [\f[B]--standard\f[R]]
[\f[B]--warn\f[R]] [\f[B]--version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
[\f[I]file\f[R]\&...]
.SH DESCRIPTION
.PP
@ -55,7 +54,7 @@ the command line and executes them before reading from \f[B]stdin\f[R].
.PP
The following are the options that bc(1) accepts.
.TP
\f[B]-g\f[R], \f[B]\[en]global-stacks\f[R]
\f[B]-g\f[R], \f[B]--global-stacks\f[R]
Turns the globals \f[B]ibase\f[R], \f[B]obase\f[R], \f[B]scale\f[R], and
\f[B]seed\f[R] into stacks.
.RS
@ -147,10 +146,10 @@ is ignored.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-h\f[R], \f[B]\[en]help\f[R]
\f[B]-h\f[R], \f[B]--help\f[R]
Prints a usage message and quits.
.TP
\f[B]-i\f[R], \f[B]\[en]interactive\f[R]
\f[B]-i\f[R], \f[B]--interactive\f[R]
Forces interactive mode.
(See the \f[B]INTERACTIVE MODE\f[R] section.)
.RS
@ -158,7 +157,7 @@ Forces interactive mode.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-l\f[R], \f[B]\[en]mathlib\f[R]
\f[B]-l\f[R], \f[B]--mathlib\f[R]
Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to \f[B]20\f[R]
and loads the included math library and the extended math library before
running any code, including any expressions or files specified on the
@ -168,7 +167,7 @@ command line.
To learn what is in the libraries, see the \f[B]LIBRARY\f[R] section.
.RE
.TP
\f[B]-P\f[R], \f[B]\[en]no-prompt\f[R]
\f[B]-P\f[R], \f[B]--no-prompt\f[R]
Disables the prompt in TTY mode.
(The prompt is only enabled in TTY mode.
See the \f[B]TTY MODE\f[R] section) This is mostly for those users that
@ -180,18 +179,18 @@ Most of those users would want to put this option in
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-q\f[R], \f[B]\[en]quiet\f[R]
\f[B]-q\f[R], \f[B]--quiet\f[R]
This option is for compatibility with the GNU
bc(1) (https://www.gnu.org/software/bc/); it is a no-op.
Without this option, GNU bc(1) prints a copyright header.
This bc(1) only prints the copyright header if one or more of the
\f[B]-v\f[R], \f[B]-V\f[R], or \f[B]\[en]version\f[R] options are given.
\f[B]-v\f[R], \f[B]-V\f[R], or \f[B]--version\f[R] options are given.
.RS
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-s\f[R], \f[B]\[en]standard\f[R]
\f[B]-s\f[R], \f[B]--standard\f[R]
Process exactly the language defined by the
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
and error if any extensions are used.
@ -200,15 +199,15 @@ and error if any extensions are used.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]\[en]version\f[R]
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
Print the version information (copyright header) and exit.
.RS
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-w\f[R], \f[B]\[en]warn\f[R]
Like \f[B]-s\f[R] and \f[B]\[en]standard\f[R], except that warnings (and
\f[B]-w\f[R], \f[B]--warn\f[R]
Like \f[B]-s\f[R] and \f[B]--standard\f[R], except that warnings (and
not errors) are printed for non-standard extensions and execution
continues normally.
.RS
@ -216,7 +215,7 @@ continues normally.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]\[en]expression\f[R]=\f[I]expr\f[R]
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
Evaluates \f[I]expr\f[R].
If multiple expressions are given, they are evaluated in order.
If files are given as well (see below), the expressions and files are
@ -229,17 +228,17 @@ If this option is given on the command-line (i.e., not in
\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
then after processing all expressions and files, bc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
\f[B]-f\f[R] or \f[B]\[en]file\f[R], whether on the command-line or in
\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
\f[B]BC_ENV_ARGS\f[R].
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
exit.
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-f\f[R] \f[I]file\f[R], \f[B]\[en]file\f[R]=\f[I]file\f[R]
\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
were read through \f[B]stdin\f[R].
If expressions are also given (see above), the expressions are evaluated
@ -250,9 +249,9 @@ If this option is given on the command-line (i.e., not in
\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
then after processing all expressions and files, bc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
\f[B]-f\f[R] or \f[B]\[en]file\f[R].
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
\f[B]-f\f[R] or \f[B]--file\f[R].
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
exit.
.PP
@ -317,8 +316,8 @@ constant numbers.
It is the \[lq]input\[rq] base, or the number base used for interpreting
input numbers.
\f[B]ibase\f[R] is initially \f[B]10\f[R].
If the \f[B]-s\f[R] (\f[B]\[en]standard\f[R]) and \f[B]-w\f[R]
(\f[B]\[en]warn\f[R]) flags were not given on the command line, the max
If the \f[B]-s\f[R] (\f[B]--standard\f[R]) and \f[B]-w\f[R]
(\f[B]--warn\f[R]) flags were not given on the command line, the max
allowable value for \f[B]ibase\f[R] is \f[B]36\f[R].
Otherwise, it is \f[B]16\f[R].
The min allowable value for \f[B]ibase\f[R] is \f[B]2\f[R].
@ -577,7 +576,7 @@ 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.
.TP
\f[B]++\f[R] \f[B]\[en]\f[R]
\f[B]++\f[R] \f[B]--\f[R]
Type: Prefix and Postfix
.RS
.PP
@ -687,7 +686,7 @@ Description: \f[B]boolean or\f[R]
.PP
The operators will be described in more detail below.
.TP
\f[B]++\f[R] \f[B]\[en]\f[R]
\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]
@ -1133,7 +1132,7 @@ This is a \f[B]non-portable extension\f[R].
.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]\[en]mathlib\f[R] command-line
available when the \f[B]-l\f[R] or \f[B]--mathlib\f[R] command-line
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.
@ -1194,7 +1193,7 @@ Functions\f[R] subsection below).
.SS Extended Library
.PP
The extended library is \f[I]not\f[R] loaded when the
\f[B]-s\f[R]/\f[B]\[en]standard\f[R] or \f[B]-w\f[R]/\f[B]\[en]warn\f[R]
\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
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html).
.PP
@ -1952,11 +1951,11 @@ interactive mode (see the \f[B]INTERACTIVE MODE\f[R] section), since
bc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
more input when one of those errors occurs in interactive mode.
This is also the case when interactive mode is forced by the
\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.PP
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]\[en]interactive\f[R] option.
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.SH INTERACTIVE MODE
.PP
Per the
@ -1964,7 +1963,7 @@ standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html),
bc(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
and \f[B]\[en]interactive\f[R] option can turn it on in other cases.
and \f[B]--interactive\f[R] option can turn it on in other cases.
.PP
In interactive mode, bc(1) attempts to recover from errors (see the
\f[B]RESET\f[R] section), and in normal execution, flushes

View File

@ -34,8 +34,7 @@ bc - arbitrary-precision decimal arithmetic language and calculator
# SYNOPSIS
**bc** [**-ghilPqsvVw**] [**--global-stacks**] [**--help**] [**--interactive**] [**--mathlib**] [**--no-prompt**] [**--quiet**] [**--standard**] [**--warn**] [**--version**] [**-e** *expr*] [**--expression**=*expr*...] [**-f** *file*...] [**-file**=*file*...]
[*file*...]
**bc** [**-ghilPqsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@ -51,7 +50,7 @@ command line and executes them before reading from **stdin**.
The following are the options that bc(1) accepts.
**-g**, **--global-stacks**
**-g**, **-\-global-stacks**
: Turns the globals **ibase**, **obase**, **scale**, and **seed** into stacks.
@ -119,17 +118,17 @@ The following are the options that bc(1) accepts.
This is a **non-portable extension**.
**-h**, **--help**
**-h**, **-\-help**
: Prints a usage message and quits.
**-i**, **--interactive**
**-i**, **-\-interactive**
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
This is a **non-portable extension**.
**-l**, **--mathlib**
**-l**, **-\-mathlib**
: Sets **scale** (see the **SYNTAX** section) to **20** and loads the included
math library and the extended math library before running any code,
@ -137,7 +136,7 @@ The following are the options that bc(1) accepts.
To learn what is in the libraries, see the **LIBRARY** section.
**-P**, **--no-prompt**
**-P**, **-\-no-prompt**
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
See the **TTY MODE** section) This is mostly for those users that do not
@ -147,36 +146,36 @@ The following are the options that bc(1) accepts.
This is a **non-portable extension**.
**-q**, **--quiet**
**-q**, **-\-quiet**
: This option is for compatibility with the [GNU bc(1)][2]; it is a no-op.
Without this option, GNU bc(1) prints a copyright header. This bc(1) only
prints the copyright header if one or more of the **-v**, **-V**, or
**--version** options are given.
**-\-version** options are given.
This is a **non-portable extension**.
**-s**, **--standard**
**-s**, **-\-standard**
: Process exactly the language defined by the [standard][1] and error if any
extensions are used.
This is a **non-portable extension**.
**-v**, **-V**, **--version**
**-v**, **-V**, **-\-version**
: Print the version information (copyright header) and exit.
This is a **non-portable extension**.
**-w**, **--warn**
**-w**, **-\-warn**
: Like **-s** and **--standard**, except that warnings (and not errors) are
: Like **-s** and **-\-standard**, except that warnings (and not errors) are
printed for non-standard extensions and execution continues normally.
This is a **non-portable extension**.
**-e** *expr*, **--expression**=*expr*
**-e** *expr*, **-\-expression**=*expr*
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
order. If files are given as well (see below), the expressions and files are
@ -186,14 +185,14 @@ The following are the options that bc(1) accepts.
If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
see the **ENVIRONMENT VARIABLES** section), then after processing all
expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
as an argument at least once to **-f** or **--file**, whether on the
as an argument at least once to **-f** or **-\-file**, whether on the
command-line or in **BC_ENV_ARGS**. However, if any other **-e**,
**--expression**, **-f**, or **--file** arguments are given after **-f-** or
equivalent is given, bc(1) will give a fatal error and exit.
**-\-expression**, **-f**, or **-\-file** arguments are given after **-f-**
or equivalent is given, bc(1) will give a fatal error and exit.
This is a **non-portable extension**.
**-f** *file*, **--file**=*file*
**-f** *file*, **-\-file**=*file*
: Reads in *file* and evaluates it, line by line, as though it were read
through **stdin**. If expressions are also given (see above), the
@ -202,8 +201,8 @@ The following are the options that bc(1) accepts.
If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
see the **ENVIRONMENT VARIABLES** section), then after processing all
expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
as an argument at least once to **-f** or **--file**. However, if any other
**-e**, **--expression**, **-f**, or **--file** arguments are given after
as an argument at least once to **-f** or **-\-file**. However, if any other
**-e**, **-\-expression**, **-f**, or **-\-file** arguments are given after
**-f-** or equivalent is given, bc(1) will give a fatal error and exit.
This is a **non-portable extension**.
@ -258,8 +257,8 @@ Identifiers with more than one character (letter) are a
**ibase** is a global variable determining how to interpret constant numbers. It
is the "input" base, or the number base used for interpreting input numbers.
**ibase** is initially **10**. If the **-s** (**--standard**) and **-w**
(**--warn**) flags were not given on the command line, the max allowable value
**ibase** is initially **10**. If the **-s** (**-\-standard**) and **-w**
(**-\-warn**) flags were not given on the command line, the max allowable value
for **ibase** is **36**. Otherwise, it is **16**. The min allowable value for
**ibase** is **2**. The max allowable value for **ibase** can be queried in
bc(1) programs with the **maxibase()** built-in function.
@ -449,7 +448,7 @@ 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.
**++** **--**
**++** **-\-**
: Type: Prefix and Postfix
@ -547,7 +546,7 @@ precedence.
The operators will be described in more detail below.
**++** **--**
**++** **-\-**
: The prefix and postfix **increment** and **decrement** operators behave
exactly like they would in C. They require a named expression (see the
@ -878,7 +877,7 @@ This is a **non-portable extension**.
All of the functions below, including the functions in the extended math
library (see the *Extended Library* subsection below), are available when the
**-l** or **--mathlib** command-line flags are given, except that the extended
**-l** or **-\-mathlib** command-line flags are given, except that the extended
math library is not available when the **-s** option, the **-w** option, or
equivalents are given.
@ -930,8 +929,8 @@ The [standard][1] defines the following functions for the math library:
## Extended Library
The extended library is *not* loaded when the **-s**/**--standard** or
**-w**/**--warn** options are given since they are not part of the library
The extended library is *not* loaded when the **-s**/**-\-standard** or
**-w**/**-\-warn** options are given since they are not part of the library
defined by the [standard][1].
The extended library is a **non-portable extension**.
@ -1599,17 +1598,17 @@ The other statuses will only be returned when bc(1) is not in interactive mode
(see the **INTERACTIVE MODE** section), since bc(1) resets its state (see the
**RESET** section) and accepts more input when one of those errors occurs in
interactive mode. This is also the case when interactive mode is forced by the
**-i** flag or **--interactive** option.
**-i** flag or **-\-interactive** option.
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 **-i** flag or
**--interactive** option.
**-\-interactive** option.
# INTERACTIVE MODE
Per the [standard][1], bc(1) has an interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both **stdin** and **stdout**
are hooked to a terminal, but the **-i** flag and **--interactive** option can
are hooked to a terminal, but the **-i** flag and **-\-interactive** option can
turn it on in other cases.
In interactive mode, bc(1) attempts to recover from errors (see the **RESET**

View File

@ -25,19 +25,18 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
.TH "BC" "1" "February 2021" "Gavin D. Howard" "General Commands Manual"
.TH "BC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
.SH NAME
.PP
bc - arbitrary-precision decimal arithmetic language and calculator
.SH SYNOPSIS
.PP
\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]\[en]global-stacks\f[R]]
[\f[B]\[en]help\f[R]] [\f[B]\[en]interactive\f[R]]
[\f[B]\[en]mathlib\f[R]] [\f[B]\[en]no-prompt\f[R]]
[\f[B]\[en]quiet\f[R]] [\f[B]\[en]standard\f[R]] [\f[B]\[en]warn\f[R]]
[\f[B]\[en]version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
[\f[B]\[en]expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
\f[I]file\f[R]\&...] [\f[B]-file\f[R]=\f[I]file\f[R]\&...]
\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]--global-stacks\f[R]]
[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--mathlib\f[R]]
[\f[B]--no-prompt\f[R]] [\f[B]--quiet\f[R]] [\f[B]--standard\f[R]]
[\f[B]--warn\f[R]] [\f[B]--version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
[\f[I]file\f[R]\&...]
.SH DESCRIPTION
.PP
@ -55,7 +54,7 @@ the command line and executes them before reading from \f[B]stdin\f[R].
.PP
The following are the options that bc(1) accepts.
.TP
\f[B]-g\f[R], \f[B]\[en]global-stacks\f[R]
\f[B]-g\f[R], \f[B]--global-stacks\f[R]
Turns the globals \f[B]ibase\f[R], \f[B]obase\f[R], \f[B]scale\f[R], and
\f[B]seed\f[R] into stacks.
.RS
@ -147,10 +146,10 @@ is ignored.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-h\f[R], \f[B]\[en]help\f[R]
\f[B]-h\f[R], \f[B]--help\f[R]
Prints a usage message and quits.
.TP
\f[B]-i\f[R], \f[B]\[en]interactive\f[R]
\f[B]-i\f[R], \f[B]--interactive\f[R]
Forces interactive mode.
(See the \f[B]INTERACTIVE MODE\f[R] section.)
.RS
@ -158,7 +157,7 @@ Forces interactive mode.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-l\f[R], \f[B]\[en]mathlib\f[R]
\f[B]-l\f[R], \f[B]--mathlib\f[R]
Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to \f[B]20\f[R]
and loads the included math library and the extended math library before
running any code, including any expressions or files specified on the
@ -168,25 +167,25 @@ command line.
To learn what is in the libraries, see the \f[B]LIBRARY\f[R] section.
.RE
.TP
\f[B]-P\f[R], \f[B]\[en]no-prompt\f[R]
\f[B]-P\f[R], \f[B]--no-prompt\f[R]
This option is a no-op.
.RS
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-q\f[R], \f[B]\[en]quiet\f[R]
\f[B]-q\f[R], \f[B]--quiet\f[R]
This option is for compatibility with the GNU
bc(1) (https://www.gnu.org/software/bc/); it is a no-op.
Without this option, GNU bc(1) prints a copyright header.
This bc(1) only prints the copyright header if one or more of the
\f[B]-v\f[R], \f[B]-V\f[R], or \f[B]\[en]version\f[R] options are given.
\f[B]-v\f[R], \f[B]-V\f[R], or \f[B]--version\f[R] options are given.
.RS
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-s\f[R], \f[B]\[en]standard\f[R]
\f[B]-s\f[R], \f[B]--standard\f[R]
Process exactly the language defined by the
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
and error if any extensions are used.
@ -195,15 +194,15 @@ and error if any extensions are used.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]\[en]version\f[R]
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
Print the version information (copyright header) and exit.
.RS
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-w\f[R], \f[B]\[en]warn\f[R]
Like \f[B]-s\f[R] and \f[B]\[en]standard\f[R], except that warnings (and
\f[B]-w\f[R], \f[B]--warn\f[R]
Like \f[B]-s\f[R] and \f[B]--standard\f[R], except that warnings (and
not errors) are printed for non-standard extensions and execution
continues normally.
.RS
@ -211,7 +210,7 @@ continues normally.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]\[en]expression\f[R]=\f[I]expr\f[R]
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
Evaluates \f[I]expr\f[R].
If multiple expressions are given, they are evaluated in order.
If files are given as well (see below), the expressions and files are
@ -224,17 +223,17 @@ If this option is given on the command-line (i.e., not in
\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
then after processing all expressions and files, bc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
\f[B]-f\f[R] or \f[B]\[en]file\f[R], whether on the command-line or in
\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
\f[B]BC_ENV_ARGS\f[R].
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
exit.
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-f\f[R] \f[I]file\f[R], \f[B]\[en]file\f[R]=\f[I]file\f[R]
\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
were read through \f[B]stdin\f[R].
If expressions are also given (see above), the expressions are evaluated
@ -245,9 +244,9 @@ If this option is given on the command-line (i.e., not in
\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
then after processing all expressions and files, bc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
\f[B]-f\f[R] or \f[B]\[en]file\f[R].
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
\f[B]-f\f[R] or \f[B]--file\f[R].
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
exit.
.PP
@ -312,8 +311,8 @@ constant numbers.
It is the \[lq]input\[rq] base, or the number base used for interpreting
input numbers.
\f[B]ibase\f[R] is initially \f[B]10\f[R].
If the \f[B]-s\f[R] (\f[B]\[en]standard\f[R]) and \f[B]-w\f[R]
(\f[B]\[en]warn\f[R]) flags were not given on the command line, the max
If the \f[B]-s\f[R] (\f[B]--standard\f[R]) and \f[B]-w\f[R]
(\f[B]--warn\f[R]) flags were not given on the command line, the max
allowable value for \f[B]ibase\f[R] is \f[B]36\f[R].
Otherwise, it is \f[B]16\f[R].
The min allowable value for \f[B]ibase\f[R] is \f[B]2\f[R].
@ -572,7 +571,7 @@ 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.
.TP
\f[B]++\f[R] \f[B]\[en]\f[R]
\f[B]++\f[R] \f[B]--\f[R]
Type: Prefix and Postfix
.RS
.PP
@ -682,7 +681,7 @@ Description: \f[B]boolean or\f[R]
.PP
The operators will be described in more detail below.
.TP
\f[B]++\f[R] \f[B]\[en]\f[R]
\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]
@ -1128,7 +1127,7 @@ This is a \f[B]non-portable extension\f[R].
.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]\[en]mathlib\f[R] command-line
available when the \f[B]-l\f[R] or \f[B]--mathlib\f[R] command-line
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.
@ -1189,7 +1188,7 @@ Functions\f[R] subsection below).
.SS Extended Library
.PP
The extended library is \f[I]not\f[R] loaded when the
\f[B]-s\f[R]/\f[B]\[en]standard\f[R] or \f[B]-w\f[R]/\f[B]\[en]warn\f[R]
\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
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html).
.PP
@ -1947,11 +1946,11 @@ interactive mode (see the \f[B]INTERACTIVE MODE\f[R] section), since
bc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
more input when one of those errors occurs in interactive mode.
This is also the case when interactive mode is forced by the
\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.PP
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]\[en]interactive\f[R] option.
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.SH INTERACTIVE MODE
.PP
Per the
@ -1959,7 +1958,7 @@ standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html),
bc(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
and \f[B]\[en]interactive\f[R] option can turn it on in other cases.
and \f[B]--interactive\f[R] option can turn it on in other cases.
.PP
In interactive mode, bc(1) attempts to recover from errors (see the
\f[B]RESET\f[R] section), and in normal execution, flushes

View File

@ -34,8 +34,7 @@ bc - arbitrary-precision decimal arithmetic language and calculator
# SYNOPSIS
**bc** [**-ghilPqsvVw**] [**--global-stacks**] [**--help**] [**--interactive**] [**--mathlib**] [**--no-prompt**] [**--quiet**] [**--standard**] [**--warn**] [**--version**] [**-e** *expr*] [**--expression**=*expr*...] [**-f** *file*...] [**-file**=*file*...]
[*file*...]
**bc** [**-ghilPqsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@ -51,7 +50,7 @@ command line and executes them before reading from **stdin**.
The following are the options that bc(1) accepts.
**-g**, **--global-stacks**
**-g**, **-\-global-stacks**
: Turns the globals **ibase**, **obase**, **scale**, and **seed** into stacks.
@ -119,17 +118,17 @@ The following are the options that bc(1) accepts.
This is a **non-portable extension**.
**-h**, **--help**
**-h**, **-\-help**
: Prints a usage message and quits.
**-i**, **--interactive**
**-i**, **-\-interactive**
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
This is a **non-portable extension**.
**-l**, **--mathlib**
**-l**, **-\-mathlib**
: Sets **scale** (see the **SYNTAX** section) to **20** and loads the included
math library and the extended math library before running any code,
@ -137,42 +136,42 @@ The following are the options that bc(1) accepts.
To learn what is in the libraries, see the **LIBRARY** section.
**-P**, **--no-prompt**
**-P**, **-\-no-prompt**
: This option is a no-op.
This is a **non-portable extension**.
**-q**, **--quiet**
**-q**, **-\-quiet**
: This option is for compatibility with the [GNU bc(1)][2]; it is a no-op.
Without this option, GNU bc(1) prints a copyright header. This bc(1) only
prints the copyright header if one or more of the **-v**, **-V**, or
**--version** options are given.
**-\-version** options are given.
This is a **non-portable extension**.
**-s**, **--standard**
**-s**, **-\-standard**
: Process exactly the language defined by the [standard][1] and error if any
extensions are used.
This is a **non-portable extension**.
**-v**, **-V**, **--version**
**-v**, **-V**, **-\-version**
: Print the version information (copyright header) and exit.
This is a **non-portable extension**.
**-w**, **--warn**
**-w**, **-\-warn**
: Like **-s** and **--standard**, except that warnings (and not errors) are
: Like **-s** and **-\-standard**, except that warnings (and not errors) are
printed for non-standard extensions and execution continues normally.
This is a **non-portable extension**.
**-e** *expr*, **--expression**=*expr*
**-e** *expr*, **-\-expression**=*expr*
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
order. If files are given as well (see below), the expressions and files are
@ -182,14 +181,14 @@ The following are the options that bc(1) accepts.
If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
see the **ENVIRONMENT VARIABLES** section), then after processing all
expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
as an argument at least once to **-f** or **--file**, whether on the
as an argument at least once to **-f** or **-\-file**, whether on the
command-line or in **BC_ENV_ARGS**. However, if any other **-e**,
**--expression**, **-f**, or **--file** arguments are given after **-f-** or
equivalent is given, bc(1) will give a fatal error and exit.
**-\-expression**, **-f**, or **-\-file** arguments are given after **-f-**
or equivalent is given, bc(1) will give a fatal error and exit.
This is a **non-portable extension**.
**-f** *file*, **--file**=*file*
**-f** *file*, **-\-file**=*file*
: Reads in *file* and evaluates it, line by line, as though it were read
through **stdin**. If expressions are also given (see above), the
@ -198,8 +197,8 @@ The following are the options that bc(1) accepts.
If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
see the **ENVIRONMENT VARIABLES** section), then after processing all
expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
as an argument at least once to **-f** or **--file**. However, if any other
**-e**, **--expression**, **-f**, or **--file** arguments are given after
as an argument at least once to **-f** or **-\-file**. However, if any other
**-e**, **-\-expression**, **-f**, or **-\-file** arguments are given after
**-f-** or equivalent is given, bc(1) will give a fatal error and exit.
This is a **non-portable extension**.
@ -254,8 +253,8 @@ Identifiers with more than one character (letter) are a
**ibase** is a global variable determining how to interpret constant numbers. It
is the "input" base, or the number base used for interpreting input numbers.
**ibase** is initially **10**. If the **-s** (**--standard**) and **-w**
(**--warn**) flags were not given on the command line, the max allowable value
**ibase** is initially **10**. If the **-s** (**-\-standard**) and **-w**
(**-\-warn**) flags were not given on the command line, the max allowable value
for **ibase** is **36**. Otherwise, it is **16**. The min allowable value for
**ibase** is **2**. The max allowable value for **ibase** can be queried in
bc(1) programs with the **maxibase()** built-in function.
@ -445,7 +444,7 @@ 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.
**++** **--**
**++** **-\-**
: Type: Prefix and Postfix
@ -543,7 +542,7 @@ precedence.
The operators will be described in more detail below.
**++** **--**
**++** **-\-**
: The prefix and postfix **increment** and **decrement** operators behave
exactly like they would in C. They require a named expression (see the
@ -874,7 +873,7 @@ This is a **non-portable extension**.
All of the functions below, including the functions in the extended math
library (see the *Extended Library* subsection below), are available when the
**-l** or **--mathlib** command-line flags are given, except that the extended
**-l** or **-\-mathlib** command-line flags are given, except that the extended
math library is not available when the **-s** option, the **-w** option, or
equivalents are given.
@ -926,8 +925,8 @@ The [standard][1] defines the following functions for the math library:
## Extended Library
The extended library is *not* loaded when the **-s**/**--standard** or
**-w**/**--warn** options are given since they are not part of the library
The extended library is *not* loaded when the **-s**/**-\-standard** or
**-w**/**-\-warn** options are given since they are not part of the library
defined by the [standard][1].
The extended library is a **non-portable extension**.
@ -1595,17 +1594,17 @@ The other statuses will only be returned when bc(1) is not in interactive mode
(see the **INTERACTIVE MODE** section), since bc(1) resets its state (see the
**RESET** section) and accepts more input when one of those errors occurs in
interactive mode. This is also the case when interactive mode is forced by the
**-i** flag or **--interactive** option.
**-i** flag or **-\-interactive** option.
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 **-i** flag or
**--interactive** option.
**-\-interactive** option.
# INTERACTIVE MODE
Per the [standard][1], bc(1) has an interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both **stdin** and **stdout**
are hooked to a terminal, but the **-i** flag and **--interactive** option can
are hooked to a terminal, but the **-i** flag and **-\-interactive** option can
turn it on in other cases.
In interactive mode, bc(1) attempts to recover from errors (see the **RESET**

View File

@ -25,19 +25,18 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
.TH "BC" "1" "February 2021" "Gavin D. Howard" "General Commands Manual"
.TH "BC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
.SH NAME
.PP
bc - arbitrary-precision decimal arithmetic language and calculator
.SH SYNOPSIS
.PP
\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]\[en]global-stacks\f[R]]
[\f[B]\[en]help\f[R]] [\f[B]\[en]interactive\f[R]]
[\f[B]\[en]mathlib\f[R]] [\f[B]\[en]no-prompt\f[R]]
[\f[B]\[en]quiet\f[R]] [\f[B]\[en]standard\f[R]] [\f[B]\[en]warn\f[R]]
[\f[B]\[en]version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
[\f[B]\[en]expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
\f[I]file\f[R]\&...] [\f[B]-file\f[R]=\f[I]file\f[R]\&...]
\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]--global-stacks\f[R]]
[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--mathlib\f[R]]
[\f[B]--no-prompt\f[R]] [\f[B]--quiet\f[R]] [\f[B]--standard\f[R]]
[\f[B]--warn\f[R]] [\f[B]--version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
[\f[I]file\f[R]\&...]
.SH DESCRIPTION
.PP
@ -55,7 +54,7 @@ the command line and executes them before reading from \f[B]stdin\f[R].
.PP
The following are the options that bc(1) accepts.
.TP
\f[B]-g\f[R], \f[B]\[en]global-stacks\f[R]
\f[B]-g\f[R], \f[B]--global-stacks\f[R]
Turns the globals \f[B]ibase\f[R], \f[B]obase\f[R], \f[B]scale\f[R], and
\f[B]seed\f[R] into stacks.
.RS
@ -147,10 +146,10 @@ is ignored.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-h\f[R], \f[B]\[en]help\f[R]
\f[B]-h\f[R], \f[B]--help\f[R]
Prints a usage message and quits.
.TP
\f[B]-i\f[R], \f[B]\[en]interactive\f[R]
\f[B]-i\f[R], \f[B]--interactive\f[R]
Forces interactive mode.
(See the \f[B]INTERACTIVE MODE\f[R] section.)
.RS
@ -158,7 +157,7 @@ Forces interactive mode.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-l\f[R], \f[B]\[en]mathlib\f[R]
\f[B]-l\f[R], \f[B]--mathlib\f[R]
Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to \f[B]20\f[R]
and loads the included math library and the extended math library before
running any code, including any expressions or files specified on the
@ -168,25 +167,25 @@ command line.
To learn what is in the libraries, see the \f[B]LIBRARY\f[R] section.
.RE
.TP
\f[B]-P\f[R], \f[B]\[en]no-prompt\f[R]
\f[B]-P\f[R], \f[B]--no-prompt\f[R]
This option is a no-op.
.RS
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-q\f[R], \f[B]\[en]quiet\f[R]
\f[B]-q\f[R], \f[B]--quiet\f[R]
This option is for compatibility with the GNU
bc(1) (https://www.gnu.org/software/bc/); it is a no-op.
Without this option, GNU bc(1) prints a copyright header.
This bc(1) only prints the copyright header if one or more of the
\f[B]-v\f[R], \f[B]-V\f[R], or \f[B]\[en]version\f[R] options are given.
\f[B]-v\f[R], \f[B]-V\f[R], or \f[B]--version\f[R] options are given.
.RS
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-s\f[R], \f[B]\[en]standard\f[R]
\f[B]-s\f[R], \f[B]--standard\f[R]
Process exactly the language defined by the
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
and error if any extensions are used.
@ -195,15 +194,15 @@ and error if any extensions are used.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]\[en]version\f[R]
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
Print the version information (copyright header) and exit.
.RS
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-w\f[R], \f[B]\[en]warn\f[R]
Like \f[B]-s\f[R] and \f[B]\[en]standard\f[R], except that warnings (and
\f[B]-w\f[R], \f[B]--warn\f[R]
Like \f[B]-s\f[R] and \f[B]--standard\f[R], except that warnings (and
not errors) are printed for non-standard extensions and execution
continues normally.
.RS
@ -211,7 +210,7 @@ continues normally.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]\[en]expression\f[R]=\f[I]expr\f[R]
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
Evaluates \f[I]expr\f[R].
If multiple expressions are given, they are evaluated in order.
If files are given as well (see below), the expressions and files are
@ -224,17 +223,17 @@ If this option is given on the command-line (i.e., not in
\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
then after processing all expressions and files, bc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
\f[B]-f\f[R] or \f[B]\[en]file\f[R], whether on the command-line or in
\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
\f[B]BC_ENV_ARGS\f[R].
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
exit.
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-f\f[R] \f[I]file\f[R], \f[B]\[en]file\f[R]=\f[I]file\f[R]
\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
were read through \f[B]stdin\f[R].
If expressions are also given (see above), the expressions are evaluated
@ -245,9 +244,9 @@ If this option is given on the command-line (i.e., not in
\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
then after processing all expressions and files, bc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
\f[B]-f\f[R] or \f[B]\[en]file\f[R].
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
\f[B]-f\f[R] or \f[B]--file\f[R].
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
exit.
.PP
@ -312,8 +311,8 @@ constant numbers.
It is the \[lq]input\[rq] base, or the number base used for interpreting
input numbers.
\f[B]ibase\f[R] is initially \f[B]10\f[R].
If the \f[B]-s\f[R] (\f[B]\[en]standard\f[R]) and \f[B]-w\f[R]
(\f[B]\[en]warn\f[R]) flags were not given on the command line, the max
If the \f[B]-s\f[R] (\f[B]--standard\f[R]) and \f[B]-w\f[R]
(\f[B]--warn\f[R]) flags were not given on the command line, the max
allowable value for \f[B]ibase\f[R] is \f[B]36\f[R].
Otherwise, it is \f[B]16\f[R].
The min allowable value for \f[B]ibase\f[R] is \f[B]2\f[R].
@ -572,7 +571,7 @@ 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.
.TP
\f[B]++\f[R] \f[B]\[en]\f[R]
\f[B]++\f[R] \f[B]--\f[R]
Type: Prefix and Postfix
.RS
.PP
@ -682,7 +681,7 @@ Description: \f[B]boolean or\f[R]
.PP
The operators will be described in more detail below.
.TP
\f[B]++\f[R] \f[B]\[en]\f[R]
\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]
@ -1128,7 +1127,7 @@ This is a \f[B]non-portable extension\f[R].
.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]\[en]mathlib\f[R] command-line
available when the \f[B]-l\f[R] or \f[B]--mathlib\f[R] command-line
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.
@ -1189,7 +1188,7 @@ Functions\f[R] subsection below).
.SS Extended Library
.PP
The extended library is \f[I]not\f[R] loaded when the
\f[B]-s\f[R]/\f[B]\[en]standard\f[R] or \f[B]-w\f[R]/\f[B]\[en]warn\f[R]
\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
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html).
.PP
@ -1947,11 +1946,11 @@ interactive mode (see the \f[B]INTERACTIVE MODE\f[R] section), since
bc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
more input when one of those errors occurs in interactive mode.
This is also the case when interactive mode is forced by the
\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.PP
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]\[en]interactive\f[R] option.
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.SH INTERACTIVE MODE
.PP
Per the
@ -1959,7 +1958,7 @@ standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html),
bc(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
and \f[B]\[en]interactive\f[R] option can turn it on in other cases.
and \f[B]--interactive\f[R] option can turn it on in other cases.
.PP
In interactive mode, bc(1) attempts to recover from errors (see the
\f[B]RESET\f[R] section), and in normal execution, flushes

View File

@ -34,8 +34,7 @@ bc - arbitrary-precision decimal arithmetic language and calculator
# SYNOPSIS
**bc** [**-ghilPqsvVw**] [**--global-stacks**] [**--help**] [**--interactive**] [**--mathlib**] [**--no-prompt**] [**--quiet**] [**--standard**] [**--warn**] [**--version**] [**-e** *expr*] [**--expression**=*expr*...] [**-f** *file*...] [**-file**=*file*...]
[*file*...]
**bc** [**-ghilPqsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@ -51,7 +50,7 @@ command line and executes them before reading from **stdin**.
The following are the options that bc(1) accepts.
**-g**, **--global-stacks**
**-g**, **-\-global-stacks**
: Turns the globals **ibase**, **obase**, **scale**, and **seed** into stacks.
@ -119,17 +118,17 @@ The following are the options that bc(1) accepts.
This is a **non-portable extension**.
**-h**, **--help**
**-h**, **-\-help**
: Prints a usage message and quits.
**-i**, **--interactive**
**-i**, **-\-interactive**
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
This is a **non-portable extension**.
**-l**, **--mathlib**
**-l**, **-\-mathlib**
: Sets **scale** (see the **SYNTAX** section) to **20** and loads the included
math library and the extended math library before running any code,
@ -137,42 +136,42 @@ The following are the options that bc(1) accepts.
To learn what is in the libraries, see the **LIBRARY** section.
**-P**, **--no-prompt**
**-P**, **-\-no-prompt**
: This option is a no-op.
This is a **non-portable extension**.
**-q**, **--quiet**
**-q**, **-\-quiet**
: This option is for compatibility with the [GNU bc(1)][2]; it is a no-op.
Without this option, GNU bc(1) prints a copyright header. This bc(1) only
prints the copyright header if one or more of the **-v**, **-V**, or
**--version** options are given.
**-\-version** options are given.
This is a **non-portable extension**.
**-s**, **--standard**
**-s**, **-\-standard**
: Process exactly the language defined by the [standard][1] and error if any
extensions are used.
This is a **non-portable extension**.
**-v**, **-V**, **--version**
**-v**, **-V**, **-\-version**
: Print the version information (copyright header) and exit.
This is a **non-portable extension**.
**-w**, **--warn**
**-w**, **-\-warn**
: Like **-s** and **--standard**, except that warnings (and not errors) are
: Like **-s** and **-\-standard**, except that warnings (and not errors) are
printed for non-standard extensions and execution continues normally.
This is a **non-portable extension**.
**-e** *expr*, **--expression**=*expr*
**-e** *expr*, **-\-expression**=*expr*
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
order. If files are given as well (see below), the expressions and files are
@ -182,14 +181,14 @@ The following are the options that bc(1) accepts.
If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
see the **ENVIRONMENT VARIABLES** section), then after processing all
expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
as an argument at least once to **-f** or **--file**, whether on the
as an argument at least once to **-f** or **-\-file**, whether on the
command-line or in **BC_ENV_ARGS**. However, if any other **-e**,
**--expression**, **-f**, or **--file** arguments are given after **-f-** or
equivalent is given, bc(1) will give a fatal error and exit.
**-\-expression**, **-f**, or **-\-file** arguments are given after **-f-**
or equivalent is given, bc(1) will give a fatal error and exit.
This is a **non-portable extension**.
**-f** *file*, **--file**=*file*
**-f** *file*, **-\-file**=*file*
: Reads in *file* and evaluates it, line by line, as though it were read
through **stdin**. If expressions are also given (see above), the
@ -198,8 +197,8 @@ The following are the options that bc(1) accepts.
If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
see the **ENVIRONMENT VARIABLES** section), then after processing all
expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
as an argument at least once to **-f** or **--file**. However, if any other
**-e**, **--expression**, **-f**, or **--file** arguments are given after
as an argument at least once to **-f** or **-\-file**. However, if any other
**-e**, **-\-expression**, **-f**, or **-\-file** arguments are given after
**-f-** or equivalent is given, bc(1) will give a fatal error and exit.
This is a **non-portable extension**.
@ -254,8 +253,8 @@ Identifiers with more than one character (letter) are a
**ibase** is a global variable determining how to interpret constant numbers. It
is the "input" base, or the number base used for interpreting input numbers.
**ibase** is initially **10**. If the **-s** (**--standard**) and **-w**
(**--warn**) flags were not given on the command line, the max allowable value
**ibase** is initially **10**. If the **-s** (**-\-standard**) and **-w**
(**-\-warn**) flags were not given on the command line, the max allowable value
for **ibase** is **36**. Otherwise, it is **16**. The min allowable value for
**ibase** is **2**. The max allowable value for **ibase** can be queried in
bc(1) programs with the **maxibase()** built-in function.
@ -445,7 +444,7 @@ 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.
**++** **--**
**++** **-\-**
: Type: Prefix and Postfix
@ -543,7 +542,7 @@ precedence.
The operators will be described in more detail below.
**++** **--**
**++** **-\-**
: The prefix and postfix **increment** and **decrement** operators behave
exactly like they would in C. They require a named expression (see the
@ -874,7 +873,7 @@ This is a **non-portable extension**.
All of the functions below, including the functions in the extended math
library (see the *Extended Library* subsection below), are available when the
**-l** or **--mathlib** command-line flags are given, except that the extended
**-l** or **-\-mathlib** command-line flags are given, except that the extended
math library is not available when the **-s** option, the **-w** option, or
equivalents are given.
@ -926,8 +925,8 @@ The [standard][1] defines the following functions for the math library:
## Extended Library
The extended library is *not* loaded when the **-s**/**--standard** or
**-w**/**--warn** options are given since they are not part of the library
The extended library is *not* loaded when the **-s**/**-\-standard** or
**-w**/**-\-warn** options are given since they are not part of the library
defined by the [standard][1].
The extended library is a **non-portable extension**.
@ -1595,17 +1594,17 @@ The other statuses will only be returned when bc(1) is not in interactive mode
(see the **INTERACTIVE MODE** section), since bc(1) resets its state (see the
**RESET** section) and accepts more input when one of those errors occurs in
interactive mode. This is also the case when interactive mode is forced by the
**-i** flag or **--interactive** option.
**-i** flag or **-\-interactive** option.
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 **-i** flag or
**--interactive** option.
**-\-interactive** option.
# INTERACTIVE MODE
Per the [standard][1], bc(1) has an interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both **stdin** and **stdout**
are hooked to a terminal, but the **-i** flag and **--interactive** option can
are hooked to a terminal, but the **-i** flag and **-\-interactive** option can
turn it on in other cases.
In interactive mode, bc(1) attempts to recover from errors (see the **RESET**

View File

@ -25,19 +25,18 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
.TH "BC" "1" "February 2021" "Gavin D. Howard" "General Commands Manual"
.TH "BC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
.SH NAME
.PP
bc - arbitrary-precision decimal arithmetic language and calculator
.SH SYNOPSIS
.PP
\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]\[en]global-stacks\f[R]]
[\f[B]\[en]help\f[R]] [\f[B]\[en]interactive\f[R]]
[\f[B]\[en]mathlib\f[R]] [\f[B]\[en]no-prompt\f[R]]
[\f[B]\[en]quiet\f[R]] [\f[B]\[en]standard\f[R]] [\f[B]\[en]warn\f[R]]
[\f[B]\[en]version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
[\f[B]\[en]expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
\f[I]file\f[R]\&...] [\f[B]-file\f[R]=\f[I]file\f[R]\&...]
\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]--global-stacks\f[R]]
[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--mathlib\f[R]]
[\f[B]--no-prompt\f[R]] [\f[B]--quiet\f[R]] [\f[B]--standard\f[R]]
[\f[B]--warn\f[R]] [\f[B]--version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
[\f[I]file\f[R]\&...]
.SH DESCRIPTION
.PP
@ -60,7 +59,7 @@ implementations.
.PP
The following are the options that bc(1) accepts.
.TP
\f[B]-g\f[R], \f[B]\[en]global-stacks\f[R]
\f[B]-g\f[R], \f[B]--global-stacks\f[R]
Turns the globals \f[B]ibase\f[R], \f[B]obase\f[R], \f[B]scale\f[R], and
\f[B]seed\f[R] into stacks.
.RS
@ -152,10 +151,10 @@ is ignored.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-h\f[R], \f[B]\[en]help\f[R]
\f[B]-h\f[R], \f[B]--help\f[R]
Prints a usage message and quits.
.TP
\f[B]-i\f[R], \f[B]\[en]interactive\f[R]
\f[B]-i\f[R], \f[B]--interactive\f[R]
Forces interactive mode.
(See the \f[B]INTERACTIVE MODE\f[R] section.)
.RS
@ -163,7 +162,7 @@ Forces interactive mode.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-l\f[R], \f[B]\[en]mathlib\f[R]
\f[B]-l\f[R], \f[B]--mathlib\f[R]
Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to \f[B]20\f[R]
and loads the included math library and the extended math library before
running any code, including any expressions or files specified on the
@ -173,7 +172,7 @@ command line.
To learn what is in the libraries, see the \f[B]LIBRARY\f[R] section.
.RE
.TP
\f[B]-P\f[R], \f[B]\[en]no-prompt\f[R]
\f[B]-P\f[R], \f[B]--no-prompt\f[R]
Disables the prompt in TTY mode.
(The prompt is only enabled in TTY mode.
See the \f[B]TTY MODE\f[R] section) This is mostly for those users that
@ -185,18 +184,18 @@ Most of those users would want to put this option in
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-q\f[R], \f[B]\[en]quiet\f[R]
\f[B]-q\f[R], \f[B]--quiet\f[R]
This option is for compatibility with the GNU
bc(1) (https://www.gnu.org/software/bc/); it is a no-op.
Without this option, GNU bc(1) prints a copyright header.
This bc(1) only prints the copyright header if one or more of the
\f[B]-v\f[R], \f[B]-V\f[R], or \f[B]\[en]version\f[R] options are given.
\f[B]-v\f[R], \f[B]-V\f[R], or \f[B]--version\f[R] options are given.
.RS
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-s\f[R], \f[B]\[en]standard\f[R]
\f[B]-s\f[R], \f[B]--standard\f[R]
Process exactly the language defined by the
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
and error if any extensions are used.
@ -205,15 +204,15 @@ and error if any extensions are used.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]\[en]version\f[R]
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
Print the version information (copyright header) and exit.
.RS
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-w\f[R], \f[B]\[en]warn\f[R]
Like \f[B]-s\f[R] and \f[B]\[en]standard\f[R], except that warnings (and
\f[B]-w\f[R], \f[B]--warn\f[R]
Like \f[B]-s\f[R] and \f[B]--standard\f[R], except that warnings (and
not errors) are printed for non-standard extensions and execution
continues normally.
.RS
@ -221,7 +220,7 @@ continues normally.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]\[en]expression\f[R]=\f[I]expr\f[R]
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
Evaluates \f[I]expr\f[R].
If multiple expressions are given, they are evaluated in order.
If files are given as well (see below), the expressions and files are
@ -234,17 +233,17 @@ If this option is given on the command-line (i.e., not in
\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
then after processing all expressions and files, bc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
\f[B]-f\f[R] or \f[B]\[en]file\f[R], whether on the command-line or in
\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
\f[B]BC_ENV_ARGS\f[R].
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
exit.
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-f\f[R] \f[I]file\f[R], \f[B]\[en]file\f[R]=\f[I]file\f[R]
\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
were read through \f[B]stdin\f[R].
If expressions are also given (see above), the expressions are evaluated
@ -255,9 +254,9 @@ If this option is given on the command-line (i.e., not in
\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
then after processing all expressions and files, bc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
\f[B]-f\f[R] or \f[B]\[en]file\f[R].
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
\f[B]-f\f[R] or \f[B]--file\f[R].
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
exit.
.PP
@ -322,8 +321,8 @@ constant numbers.
It is the \[lq]input\[rq] base, or the number base used for interpreting
input numbers.
\f[B]ibase\f[R] is initially \f[B]10\f[R].
If the \f[B]-s\f[R] (\f[B]\[en]standard\f[R]) and \f[B]-w\f[R]
(\f[B]\[en]warn\f[R]) flags were not given on the command line, the max
If the \f[B]-s\f[R] (\f[B]--standard\f[R]) and \f[B]-w\f[R]
(\f[B]--warn\f[R]) flags were not given on the command line, the max
allowable value for \f[B]ibase\f[R] is \f[B]36\f[R].
Otherwise, it is \f[B]16\f[R].
The min allowable value for \f[B]ibase\f[R] is \f[B]2\f[R].
@ -582,7 +581,7 @@ 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.
.TP
\f[B]++\f[R] \f[B]\[en]\f[R]
\f[B]++\f[R] \f[B]--\f[R]
Type: Prefix and Postfix
.RS
.PP
@ -692,7 +691,7 @@ Description: \f[B]boolean or\f[R]
.PP
The operators will be described in more detail below.
.TP
\f[B]++\f[R] \f[B]\[en]\f[R]
\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]
@ -1138,7 +1137,7 @@ This is a \f[B]non-portable extension\f[R].
.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]\[en]mathlib\f[R] command-line
available when the \f[B]-l\f[R] or \f[B]--mathlib\f[R] command-line
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.
@ -1199,7 +1198,7 @@ Functions\f[R] subsection below).
.SS Extended Library
.PP
The extended library is \f[I]not\f[R] loaded when the
\f[B]-s\f[R]/\f[B]\[en]standard\f[R] or \f[B]-w\f[R]/\f[B]\[en]warn\f[R]
\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
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html).
.PP
@ -1957,11 +1956,11 @@ interactive mode (see the \f[B]INTERACTIVE MODE\f[R] section), since
bc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
more input when one of those errors occurs in interactive mode.
This is also the case when interactive mode is forced by the
\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.PP
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]\[en]interactive\f[R] option.
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.SH INTERACTIVE MODE
.PP
Per the
@ -1969,7 +1968,7 @@ standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html),
bc(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
and \f[B]\[en]interactive\f[R] option can turn it on in other cases.
and \f[B]--interactive\f[R] option can turn it on in other cases.
.PP
In interactive mode, bc(1) attempts to recover from errors (see the
\f[B]RESET\f[R] section), and in normal execution, flushes

View File

@ -34,8 +34,7 @@ bc - arbitrary-precision decimal arithmetic language and calculator
# SYNOPSIS
**bc** [**-ghilPqsvVw**] [**--global-stacks**] [**--help**] [**--interactive**] [**--mathlib**] [**--no-prompt**] [**--quiet**] [**--standard**] [**--warn**] [**--version**] [**-e** *expr*] [**--expression**=*expr*...] [**-f** *file*...] [**-file**=*file*...]
[*file*...]
**bc** [**-ghilPqsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@ -55,7 +54,7 @@ other implementations.
The following are the options that bc(1) accepts.
**-g**, **--global-stacks**
**-g**, **-\-global-stacks**
: Turns the globals **ibase**, **obase**, **scale**, and **seed** into stacks.
@ -123,17 +122,17 @@ The following are the options that bc(1) accepts.
This is a **non-portable extension**.
**-h**, **--help**
**-h**, **-\-help**
: Prints a usage message and quits.
**-i**, **--interactive**
**-i**, **-\-interactive**
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
This is a **non-portable extension**.
**-l**, **--mathlib**
**-l**, **-\-mathlib**
: Sets **scale** (see the **SYNTAX** section) to **20** and loads the included
math library and the extended math library before running any code,
@ -141,7 +140,7 @@ The following are the options that bc(1) accepts.
To learn what is in the libraries, see the **LIBRARY** section.
**-P**, **--no-prompt**
**-P**, **-\-no-prompt**
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
See the **TTY MODE** section) This is mostly for those users that do not
@ -151,36 +150,36 @@ The following are the options that bc(1) accepts.
This is a **non-portable extension**.
**-q**, **--quiet**
**-q**, **-\-quiet**
: This option is for compatibility with the [GNU bc(1)][2]; it is a no-op.
Without this option, GNU bc(1) prints a copyright header. This bc(1) only
prints the copyright header if one or more of the **-v**, **-V**, or
**--version** options are given.
**-\-version** options are given.
This is a **non-portable extension**.
**-s**, **--standard**
**-s**, **-\-standard**
: Process exactly the language defined by the [standard][1] and error if any
extensions are used.
This is a **non-portable extension**.
**-v**, **-V**, **--version**
**-v**, **-V**, **-\-version**
: Print the version information (copyright header) and exit.
This is a **non-portable extension**.
**-w**, **--warn**
**-w**, **-\-warn**
: Like **-s** and **--standard**, except that warnings (and not errors) are
: Like **-s** and **-\-standard**, except that warnings (and not errors) are
printed for non-standard extensions and execution continues normally.
This is a **non-portable extension**.
**-e** *expr*, **--expression**=*expr*
**-e** *expr*, **-\-expression**=*expr*
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
order. If files are given as well (see below), the expressions and files are
@ -190,14 +189,14 @@ The following are the options that bc(1) accepts.
If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
see the **ENVIRONMENT VARIABLES** section), then after processing all
expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
as an argument at least once to **-f** or **--file**, whether on the
as an argument at least once to **-f** or **-\-file**, whether on the
command-line or in **BC_ENV_ARGS**. However, if any other **-e**,
**--expression**, **-f**, or **--file** arguments are given after **-f-** or
equivalent is given, bc(1) will give a fatal error and exit.
**-\-expression**, **-f**, or **-\-file** arguments are given after **-f-**
or equivalent is given, bc(1) will give a fatal error and exit.
This is a **non-portable extension**.
**-f** *file*, **--file**=*file*
**-f** *file*, **-\-file**=*file*
: Reads in *file* and evaluates it, line by line, as though it were read
through **stdin**. If expressions are also given (see above), the
@ -206,8 +205,8 @@ The following are the options that bc(1) accepts.
If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
see the **ENVIRONMENT VARIABLES** section), then after processing all
expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
as an argument at least once to **-f** or **--file**. However, if any other
**-e**, **--expression**, **-f**, or **--file** arguments are given after
as an argument at least once to **-f** or **-\-file**. However, if any other
**-e**, **-\-expression**, **-f**, or **-\-file** arguments are given after
**-f-** or equivalent is given, bc(1) will give a fatal error and exit.
This is a **non-portable extension**.
@ -262,8 +261,8 @@ Identifiers with more than one character (letter) are a
**ibase** is a global variable determining how to interpret constant numbers. It
is the "input" base, or the number base used for interpreting input numbers.
**ibase** is initially **10**. If the **-s** (**--standard**) and **-w**
(**--warn**) flags were not given on the command line, the max allowable value
**ibase** is initially **10**. If the **-s** (**-\-standard**) and **-w**
(**-\-warn**) flags were not given on the command line, the max allowable value
for **ibase** is **36**. Otherwise, it is **16**. The min allowable value for
**ibase** is **2**. The max allowable value for **ibase** can be queried in
bc(1) programs with the **maxibase()** built-in function.
@ -453,7 +452,7 @@ 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.
**++** **--**
**++** **-\-**
: Type: Prefix and Postfix
@ -551,7 +550,7 @@ precedence.
The operators will be described in more detail below.
**++** **--**
**++** **-\-**
: The prefix and postfix **increment** and **decrement** operators behave
exactly like they would in C. They require a named expression (see the
@ -882,7 +881,7 @@ This is a **non-portable extension**.
All of the functions below, including the functions in the extended math
library (see the *Extended Library* subsection below), are available when the
**-l** or **--mathlib** command-line flags are given, except that the extended
**-l** or **-\-mathlib** command-line flags are given, except that the extended
math library is not available when the **-s** option, the **-w** option, or
equivalents are given.
@ -934,8 +933,8 @@ The [standard][1] defines the following functions for the math library:
## Extended Library
The extended library is *not* loaded when the **-s**/**--standard** or
**-w**/**--warn** options are given since they are not part of the library
The extended library is *not* loaded when the **-s**/**-\-standard** or
**-w**/**-\-warn** options are given since they are not part of the library
defined by the [standard][1].
The extended library is a **non-portable extension**.
@ -1603,17 +1602,17 @@ The other statuses will only be returned when bc(1) is not in interactive mode
(see the **INTERACTIVE MODE** section), since bc(1) resets its state (see the
**RESET** section) and accepts more input when one of those errors occurs in
interactive mode. This is also the case when interactive mode is forced by the
**-i** flag or **--interactive** option.
**-i** flag or **-\-interactive** option.
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 **-i** flag or
**--interactive** option.
**-\-interactive** option.
# INTERACTIVE MODE
Per the [standard][1], bc(1) has an interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both **stdin** and **stdout**
are hooked to a terminal, but the **-i** flag and **--interactive** option can
are hooked to a terminal, but the **-i** flag and **-\-interactive** option can
turn it on in other cases.
In interactive mode, bc(1) attempts to recover from errors (see the **RESET**

View File

@ -25,19 +25,18 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
.TH "BC" "1" "February 2021" "Gavin D. Howard" "General Commands Manual"
.TH "BC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
.SH NAME
.PP
bc - arbitrary-precision decimal arithmetic language and calculator
.SH SYNOPSIS
.PP
\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]\[en]global-stacks\f[R]]
[\f[B]\[en]help\f[R]] [\f[B]\[en]interactive\f[R]]
[\f[B]\[en]mathlib\f[R]] [\f[B]\[en]no-prompt\f[R]]
[\f[B]\[en]quiet\f[R]] [\f[B]\[en]standard\f[R]] [\f[B]\[en]warn\f[R]]
[\f[B]\[en]version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
[\f[B]\[en]expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
\f[I]file\f[R]\&...] [\f[B]-file\f[R]=\f[I]file\f[R]\&...]
\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]--global-stacks\f[R]]
[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--mathlib\f[R]]
[\f[B]--no-prompt\f[R]] [\f[B]--quiet\f[R]] [\f[B]--standard\f[R]]
[\f[B]--warn\f[R]] [\f[B]--version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
[\f[I]file\f[R]\&...]
.SH DESCRIPTION
.PP
@ -60,7 +59,7 @@ implementations.
.PP
The following are the options that bc(1) accepts.
.TP
\f[B]-g\f[R], \f[B]\[en]global-stacks\f[R]
\f[B]-g\f[R], \f[B]--global-stacks\f[R]
Turns the globals \f[B]ibase\f[R], \f[B]obase\f[R], \f[B]scale\f[R], and
\f[B]seed\f[R] into stacks.
.RS
@ -152,10 +151,10 @@ is ignored.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-h\f[R], \f[B]\[en]help\f[R]
\f[B]-h\f[R], \f[B]--help\f[R]
Prints a usage message and quits.
.TP
\f[B]-i\f[R], \f[B]\[en]interactive\f[R]
\f[B]-i\f[R], \f[B]--interactive\f[R]
Forces interactive mode.
(See the \f[B]INTERACTIVE MODE\f[R] section.)
.RS
@ -163,7 +162,7 @@ Forces interactive mode.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-l\f[R], \f[B]\[en]mathlib\f[R]
\f[B]-l\f[R], \f[B]--mathlib\f[R]
Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to \f[B]20\f[R]
and loads the included math library and the extended math library before
running any code, including any expressions or files specified on the
@ -173,25 +172,25 @@ command line.
To learn what is in the libraries, see the \f[B]LIBRARY\f[R] section.
.RE
.TP
\f[B]-P\f[R], \f[B]\[en]no-prompt\f[R]
\f[B]-P\f[R], \f[B]--no-prompt\f[R]
This option is a no-op.
.RS
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-q\f[R], \f[B]\[en]quiet\f[R]
\f[B]-q\f[R], \f[B]--quiet\f[R]
This option is for compatibility with the GNU
bc(1) (https://www.gnu.org/software/bc/); it is a no-op.
Without this option, GNU bc(1) prints a copyright header.
This bc(1) only prints the copyright header if one or more of the
\f[B]-v\f[R], \f[B]-V\f[R], or \f[B]\[en]version\f[R] options are given.
\f[B]-v\f[R], \f[B]-V\f[R], or \f[B]--version\f[R] options are given.
.RS
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-s\f[R], \f[B]\[en]standard\f[R]
\f[B]-s\f[R], \f[B]--standard\f[R]
Process exactly the language defined by the
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
and error if any extensions are used.
@ -200,15 +199,15 @@ and error if any extensions are used.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]\[en]version\f[R]
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
Print the version information (copyright header) and exit.
.RS
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-w\f[R], \f[B]\[en]warn\f[R]
Like \f[B]-s\f[R] and \f[B]\[en]standard\f[R], except that warnings (and
\f[B]-w\f[R], \f[B]--warn\f[R]
Like \f[B]-s\f[R] and \f[B]--standard\f[R], except that warnings (and
not errors) are printed for non-standard extensions and execution
continues normally.
.RS
@ -216,7 +215,7 @@ continues normally.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]\[en]expression\f[R]=\f[I]expr\f[R]
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
Evaluates \f[I]expr\f[R].
If multiple expressions are given, they are evaluated in order.
If files are given as well (see below), the expressions and files are
@ -229,17 +228,17 @@ If this option is given on the command-line (i.e., not in
\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
then after processing all expressions and files, bc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
\f[B]-f\f[R] or \f[B]\[en]file\f[R], whether on the command-line or in
\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
\f[B]BC_ENV_ARGS\f[R].
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
exit.
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-f\f[R] \f[I]file\f[R], \f[B]\[en]file\f[R]=\f[I]file\f[R]
\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
were read through \f[B]stdin\f[R].
If expressions are also given (see above), the expressions are evaluated
@ -250,9 +249,9 @@ If this option is given on the command-line (i.e., not in
\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
then after processing all expressions and files, bc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
\f[B]-f\f[R] or \f[B]\[en]file\f[R].
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
\f[B]-f\f[R] or \f[B]--file\f[R].
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
exit.
.PP
@ -317,8 +316,8 @@ constant numbers.
It is the \[lq]input\[rq] base, or the number base used for interpreting
input numbers.
\f[B]ibase\f[R] is initially \f[B]10\f[R].
If the \f[B]-s\f[R] (\f[B]\[en]standard\f[R]) and \f[B]-w\f[R]
(\f[B]\[en]warn\f[R]) flags were not given on the command line, the max
If the \f[B]-s\f[R] (\f[B]--standard\f[R]) and \f[B]-w\f[R]
(\f[B]--warn\f[R]) flags were not given on the command line, the max
allowable value for \f[B]ibase\f[R] is \f[B]36\f[R].
Otherwise, it is \f[B]16\f[R].
The min allowable value for \f[B]ibase\f[R] is \f[B]2\f[R].
@ -577,7 +576,7 @@ 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.
.TP
\f[B]++\f[R] \f[B]\[en]\f[R]
\f[B]++\f[R] \f[B]--\f[R]
Type: Prefix and Postfix
.RS
.PP
@ -687,7 +686,7 @@ Description: \f[B]boolean or\f[R]
.PP
The operators will be described in more detail below.
.TP
\f[B]++\f[R] \f[B]\[en]\f[R]
\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]
@ -1133,7 +1132,7 @@ This is a \f[B]non-portable extension\f[R].
.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]\[en]mathlib\f[R] command-line
available when the \f[B]-l\f[R] or \f[B]--mathlib\f[R] command-line
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.
@ -1194,7 +1193,7 @@ Functions\f[R] subsection below).
.SS Extended Library
.PP
The extended library is \f[I]not\f[R] loaded when the
\f[B]-s\f[R]/\f[B]\[en]standard\f[R] or \f[B]-w\f[R]/\f[B]\[en]warn\f[R]
\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
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html).
.PP
@ -1952,11 +1951,11 @@ interactive mode (see the \f[B]INTERACTIVE MODE\f[R] section), since
bc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
more input when one of those errors occurs in interactive mode.
This is also the case when interactive mode is forced by the
\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.PP
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]\[en]interactive\f[R] option.
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.SH INTERACTIVE MODE
.PP
Per the
@ -1964,7 +1963,7 @@ standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html),
bc(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
and \f[B]\[en]interactive\f[R] option can turn it on in other cases.
and \f[B]--interactive\f[R] option can turn it on in other cases.
.PP
In interactive mode, bc(1) attempts to recover from errors (see the
\f[B]RESET\f[R] section), and in normal execution, flushes

View File

@ -34,8 +34,7 @@ bc - arbitrary-precision decimal arithmetic language and calculator
# SYNOPSIS
**bc** [**-ghilPqsvVw**] [**--global-stacks**] [**--help**] [**--interactive**] [**--mathlib**] [**--no-prompt**] [**--quiet**] [**--standard**] [**--warn**] [**--version**] [**-e** *expr*] [**--expression**=*expr*...] [**-f** *file*...] [**-file**=*file*...]
[*file*...]
**bc** [**-ghilPqsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@ -55,7 +54,7 @@ other implementations.
The following are the options that bc(1) accepts.
**-g**, **--global-stacks**
**-g**, **-\-global-stacks**
: Turns the globals **ibase**, **obase**, **scale**, and **seed** into stacks.
@ -123,17 +122,17 @@ The following are the options that bc(1) accepts.
This is a **non-portable extension**.
**-h**, **--help**
**-h**, **-\-help**
: Prints a usage message and quits.
**-i**, **--interactive**
**-i**, **-\-interactive**
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
This is a **non-portable extension**.
**-l**, **--mathlib**
**-l**, **-\-mathlib**
: Sets **scale** (see the **SYNTAX** section) to **20** and loads the included
math library and the extended math library before running any code,
@ -141,42 +140,42 @@ The following are the options that bc(1) accepts.
To learn what is in the libraries, see the **LIBRARY** section.
**-P**, **--no-prompt**
**-P**, **-\-no-prompt**
: This option is a no-op.
This is a **non-portable extension**.
**-q**, **--quiet**
**-q**, **-\-quiet**
: This option is for compatibility with the [GNU bc(1)][2]; it is a no-op.
Without this option, GNU bc(1) prints a copyright header. This bc(1) only
prints the copyright header if one or more of the **-v**, **-V**, or
**--version** options are given.
**-\-version** options are given.
This is a **non-portable extension**.
**-s**, **--standard**
**-s**, **-\-standard**
: Process exactly the language defined by the [standard][1] and error if any
extensions are used.
This is a **non-portable extension**.
**-v**, **-V**, **--version**
**-v**, **-V**, **-\-version**
: Print the version information (copyright header) and exit.
This is a **non-portable extension**.
**-w**, **--warn**
**-w**, **-\-warn**
: Like **-s** and **--standard**, except that warnings (and not errors) are
: Like **-s** and **-\-standard**, except that warnings (and not errors) are
printed for non-standard extensions and execution continues normally.
This is a **non-portable extension**.
**-e** *expr*, **--expression**=*expr*
**-e** *expr*, **-\-expression**=*expr*
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
order. If files are given as well (see below), the expressions and files are
@ -186,14 +185,14 @@ The following are the options that bc(1) accepts.
If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
see the **ENVIRONMENT VARIABLES** section), then after processing all
expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
as an argument at least once to **-f** or **--file**, whether on the
as an argument at least once to **-f** or **-\-file**, whether on the
command-line or in **BC_ENV_ARGS**. However, if any other **-e**,
**--expression**, **-f**, or **--file** arguments are given after **-f-** or
equivalent is given, bc(1) will give a fatal error and exit.
**-\-expression**, **-f**, or **-\-file** arguments are given after **-f-**
or equivalent is given, bc(1) will give a fatal error and exit.
This is a **non-portable extension**.
**-f** *file*, **--file**=*file*
**-f** *file*, **-\-file**=*file*
: Reads in *file* and evaluates it, line by line, as though it were read
through **stdin**. If expressions are also given (see above), the
@ -202,8 +201,8 @@ The following are the options that bc(1) accepts.
If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
see the **ENVIRONMENT VARIABLES** section), then after processing all
expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
as an argument at least once to **-f** or **--file**. However, if any other
**-e**, **--expression**, **-f**, or **--file** arguments are given after
as an argument at least once to **-f** or **-\-file**. However, if any other
**-e**, **-\-expression**, **-f**, or **-\-file** arguments are given after
**-f-** or equivalent is given, bc(1) will give a fatal error and exit.
This is a **non-portable extension**.
@ -258,8 +257,8 @@ Identifiers with more than one character (letter) are a
**ibase** is a global variable determining how to interpret constant numbers. It
is the "input" base, or the number base used for interpreting input numbers.
**ibase** is initially **10**. If the **-s** (**--standard**) and **-w**
(**--warn**) flags were not given on the command line, the max allowable value
**ibase** is initially **10**. If the **-s** (**-\-standard**) and **-w**
(**-\-warn**) flags were not given on the command line, the max allowable value
for **ibase** is **36**. Otherwise, it is **16**. The min allowable value for
**ibase** is **2**. The max allowable value for **ibase** can be queried in
bc(1) programs with the **maxibase()** built-in function.
@ -449,7 +448,7 @@ 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.
**++** **--**
**++** **-\-**
: Type: Prefix and Postfix
@ -547,7 +546,7 @@ precedence.
The operators will be described in more detail below.
**++** **--**
**++** **-\-**
: The prefix and postfix **increment** and **decrement** operators behave
exactly like they would in C. They require a named expression (see the
@ -878,7 +877,7 @@ This is a **non-portable extension**.
All of the functions below, including the functions in the extended math
library (see the *Extended Library* subsection below), are available when the
**-l** or **--mathlib** command-line flags are given, except that the extended
**-l** or **-\-mathlib** command-line flags are given, except that the extended
math library is not available when the **-s** option, the **-w** option, or
equivalents are given.
@ -930,8 +929,8 @@ The [standard][1] defines the following functions for the math library:
## Extended Library
The extended library is *not* loaded when the **-s**/**--standard** or
**-w**/**--warn** options are given since they are not part of the library
The extended library is *not* loaded when the **-s**/**-\-standard** or
**-w**/**-\-warn** options are given since they are not part of the library
defined by the [standard][1].
The extended library is a **non-portable extension**.
@ -1599,17 +1598,17 @@ The other statuses will only be returned when bc(1) is not in interactive mode
(see the **INTERACTIVE MODE** section), since bc(1) resets its state (see the
**RESET** section) and accepts more input when one of those errors occurs in
interactive mode. This is also the case when interactive mode is forced by the
**-i** flag or **--interactive** option.
**-i** flag or **-\-interactive** option.
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 **-i** flag or
**--interactive** option.
**-\-interactive** option.
# INTERACTIVE MODE
Per the [standard][1], bc(1) has an interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both **stdin** and **stdout**
are hooked to a terminal, but the **-i** flag and **--interactive** option can
are hooked to a terminal, but the **-i** flag and **-\-interactive** option can
turn it on in other cases.
In interactive mode, bc(1) attempts to recover from errors (see the **RESET**

View File

@ -25,19 +25,18 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
.TH "BC" "1" "February 2021" "Gavin D. Howard" "General Commands Manual"
.TH "BC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
.SH NAME
.PP
bc - arbitrary-precision decimal arithmetic language and calculator
.SH SYNOPSIS
.PP
\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]\[en]global-stacks\f[R]]
[\f[B]\[en]help\f[R]] [\f[B]\[en]interactive\f[R]]
[\f[B]\[en]mathlib\f[R]] [\f[B]\[en]no-prompt\f[R]]
[\f[B]\[en]quiet\f[R]] [\f[B]\[en]standard\f[R]] [\f[B]\[en]warn\f[R]]
[\f[B]\[en]version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
[\f[B]\[en]expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
\f[I]file\f[R]\&...] [\f[B]-file\f[R]=\f[I]file\f[R]\&...]
\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]--global-stacks\f[R]]
[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--mathlib\f[R]]
[\f[B]--no-prompt\f[R]] [\f[B]--quiet\f[R]] [\f[B]--standard\f[R]]
[\f[B]--warn\f[R]] [\f[B]--version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
[\f[I]file\f[R]\&...]
.SH DESCRIPTION
.PP
@ -60,7 +59,7 @@ implementations.
.PP
The following are the options that bc(1) accepts.
.TP
\f[B]-g\f[R], \f[B]\[en]global-stacks\f[R]
\f[B]-g\f[R], \f[B]--global-stacks\f[R]
Turns the globals \f[B]ibase\f[R], \f[B]obase\f[R], \f[B]scale\f[R], and
\f[B]seed\f[R] into stacks.
.RS
@ -152,10 +151,10 @@ is ignored.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-h\f[R], \f[B]\[en]help\f[R]
\f[B]-h\f[R], \f[B]--help\f[R]
Prints a usage message and quits.
.TP
\f[B]-i\f[R], \f[B]\[en]interactive\f[R]
\f[B]-i\f[R], \f[B]--interactive\f[R]
Forces interactive mode.
(See the \f[B]INTERACTIVE MODE\f[R] section.)
.RS
@ -163,7 +162,7 @@ Forces interactive mode.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-l\f[R], \f[B]\[en]mathlib\f[R]
\f[B]-l\f[R], \f[B]--mathlib\f[R]
Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to \f[B]20\f[R]
and loads the included math library and the extended math library before
running any code, including any expressions or files specified on the
@ -173,25 +172,25 @@ command line.
To learn what is in the libraries, see the \f[B]LIBRARY\f[R] section.
.RE
.TP
\f[B]-P\f[R], \f[B]\[en]no-prompt\f[R]
\f[B]-P\f[R], \f[B]--no-prompt\f[R]
This option is a no-op.
.RS
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-q\f[R], \f[B]\[en]quiet\f[R]
\f[B]-q\f[R], \f[B]--quiet\f[R]
This option is for compatibility with the GNU
bc(1) (https://www.gnu.org/software/bc/); it is a no-op.
Without this option, GNU bc(1) prints a copyright header.
This bc(1) only prints the copyright header if one or more of the
\f[B]-v\f[R], \f[B]-V\f[R], or \f[B]\[en]version\f[R] options are given.
\f[B]-v\f[R], \f[B]-V\f[R], or \f[B]--version\f[R] options are given.
.RS
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-s\f[R], \f[B]\[en]standard\f[R]
\f[B]-s\f[R], \f[B]--standard\f[R]
Process exactly the language defined by the
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
and error if any extensions are used.
@ -200,15 +199,15 @@ and error if any extensions are used.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]\[en]version\f[R]
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
Print the version information (copyright header) and exit.
.RS
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-w\f[R], \f[B]\[en]warn\f[R]
Like \f[B]-s\f[R] and \f[B]\[en]standard\f[R], except that warnings (and
\f[B]-w\f[R], \f[B]--warn\f[R]
Like \f[B]-s\f[R] and \f[B]--standard\f[R], except that warnings (and
not errors) are printed for non-standard extensions and execution
continues normally.
.RS
@ -216,7 +215,7 @@ continues normally.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]\[en]expression\f[R]=\f[I]expr\f[R]
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
Evaluates \f[I]expr\f[R].
If multiple expressions are given, they are evaluated in order.
If files are given as well (see below), the expressions and files are
@ -229,17 +228,17 @@ If this option is given on the command-line (i.e., not in
\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
then after processing all expressions and files, bc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
\f[B]-f\f[R] or \f[B]\[en]file\f[R], whether on the command-line or in
\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
\f[B]BC_ENV_ARGS\f[R].
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
exit.
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-f\f[R] \f[I]file\f[R], \f[B]\[en]file\f[R]=\f[I]file\f[R]
\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
were read through \f[B]stdin\f[R].
If expressions are also given (see above), the expressions are evaluated
@ -250,9 +249,9 @@ If this option is given on the command-line (i.e., not in
\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
then after processing all expressions and files, bc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
\f[B]-f\f[R] or \f[B]\[en]file\f[R].
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
\f[B]-f\f[R] or \f[B]--file\f[R].
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
exit.
.PP
@ -317,8 +316,8 @@ constant numbers.
It is the \[lq]input\[rq] base, or the number base used for interpreting
input numbers.
\f[B]ibase\f[R] is initially \f[B]10\f[R].
If the \f[B]-s\f[R] (\f[B]\[en]standard\f[R]) and \f[B]-w\f[R]
(\f[B]\[en]warn\f[R]) flags were not given on the command line, the max
If the \f[B]-s\f[R] (\f[B]--standard\f[R]) and \f[B]-w\f[R]
(\f[B]--warn\f[R]) flags were not given on the command line, the max
allowable value for \f[B]ibase\f[R] is \f[B]36\f[R].
Otherwise, it is \f[B]16\f[R].
The min allowable value for \f[B]ibase\f[R] is \f[B]2\f[R].
@ -577,7 +576,7 @@ 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.
.TP
\f[B]++\f[R] \f[B]\[en]\f[R]
\f[B]++\f[R] \f[B]--\f[R]
Type: Prefix and Postfix
.RS
.PP
@ -687,7 +686,7 @@ Description: \f[B]boolean or\f[R]
.PP
The operators will be described in more detail below.
.TP
\f[B]++\f[R] \f[B]\[en]\f[R]
\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]
@ -1133,7 +1132,7 @@ This is a \f[B]non-portable extension\f[R].
.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]\[en]mathlib\f[R] command-line
available when the \f[B]-l\f[R] or \f[B]--mathlib\f[R] command-line
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.
@ -1194,7 +1193,7 @@ Functions\f[R] subsection below).
.SS Extended Library
.PP
The extended library is \f[I]not\f[R] loaded when the
\f[B]-s\f[R]/\f[B]\[en]standard\f[R] or \f[B]-w\f[R]/\f[B]\[en]warn\f[R]
\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
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html).
.PP
@ -1952,11 +1951,11 @@ interactive mode (see the \f[B]INTERACTIVE MODE\f[R] section), since
bc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
more input when one of those errors occurs in interactive mode.
This is also the case when interactive mode is forced by the
\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.PP
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]\[en]interactive\f[R] option.
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.SH INTERACTIVE MODE
.PP
Per the
@ -1964,7 +1963,7 @@ standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html),
bc(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
and \f[B]\[en]interactive\f[R] option can turn it on in other cases.
and \f[B]--interactive\f[R] option can turn it on in other cases.
.PP
In interactive mode, bc(1) attempts to recover from errors (see the
\f[B]RESET\f[R] section), and in normal execution, flushes

View File

@ -34,8 +34,7 @@ bc - arbitrary-precision decimal arithmetic language and calculator
# SYNOPSIS
**bc** [**-ghilPqsvVw**] [**--global-stacks**] [**--help**] [**--interactive**] [**--mathlib**] [**--no-prompt**] [**--quiet**] [**--standard**] [**--warn**] [**--version**] [**-e** *expr*] [**--expression**=*expr*...] [**-f** *file*...] [**-file**=*file*...]
[*file*...]
**bc** [**-ghilPqsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@ -55,7 +54,7 @@ other implementations.
The following are the options that bc(1) accepts.
**-g**, **--global-stacks**
**-g**, **-\-global-stacks**
: Turns the globals **ibase**, **obase**, **scale**, and **seed** into stacks.
@ -123,17 +122,17 @@ The following are the options that bc(1) accepts.
This is a **non-portable extension**.
**-h**, **--help**
**-h**, **-\-help**
: Prints a usage message and quits.
**-i**, **--interactive**
**-i**, **-\-interactive**
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
This is a **non-portable extension**.
**-l**, **--mathlib**
**-l**, **-\-mathlib**
: Sets **scale** (see the **SYNTAX** section) to **20** and loads the included
math library and the extended math library before running any code,
@ -141,42 +140,42 @@ The following are the options that bc(1) accepts.
To learn what is in the libraries, see the **LIBRARY** section.
**-P**, **--no-prompt**
**-P**, **-\-no-prompt**
: This option is a no-op.
This is a **non-portable extension**.
**-q**, **--quiet**
**-q**, **-\-quiet**
: This option is for compatibility with the [GNU bc(1)][2]; it is a no-op.
Without this option, GNU bc(1) prints a copyright header. This bc(1) only
prints the copyright header if one or more of the **-v**, **-V**, or
**--version** options are given.
**-\-version** options are given.
This is a **non-portable extension**.
**-s**, **--standard**
**-s**, **-\-standard**
: Process exactly the language defined by the [standard][1] and error if any
extensions are used.
This is a **non-portable extension**.
**-v**, **-V**, **--version**
**-v**, **-V**, **-\-version**
: Print the version information (copyright header) and exit.
This is a **non-portable extension**.
**-w**, **--warn**
**-w**, **-\-warn**
: Like **-s** and **--standard**, except that warnings (and not errors) are
: Like **-s** and **-\-standard**, except that warnings (and not errors) are
printed for non-standard extensions and execution continues normally.
This is a **non-portable extension**.
**-e** *expr*, **--expression**=*expr*
**-e** *expr*, **-\-expression**=*expr*
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
order. If files are given as well (see below), the expressions and files are
@ -186,14 +185,14 @@ The following are the options that bc(1) accepts.
If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
see the **ENVIRONMENT VARIABLES** section), then after processing all
expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
as an argument at least once to **-f** or **--file**, whether on the
as an argument at least once to **-f** or **-\-file**, whether on the
command-line or in **BC_ENV_ARGS**. However, if any other **-e**,
**--expression**, **-f**, or **--file** arguments are given after **-f-** or
equivalent is given, bc(1) will give a fatal error and exit.
**-\-expression**, **-f**, or **-\-file** arguments are given after **-f-**
or equivalent is given, bc(1) will give a fatal error and exit.
This is a **non-portable extension**.
**-f** *file*, **--file**=*file*
**-f** *file*, **-\-file**=*file*
: Reads in *file* and evaluates it, line by line, as though it were read
through **stdin**. If expressions are also given (see above), the
@ -202,8 +201,8 @@ The following are the options that bc(1) accepts.
If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
see the **ENVIRONMENT VARIABLES** section), then after processing all
expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
as an argument at least once to **-f** or **--file**. However, if any other
**-e**, **--expression**, **-f**, or **--file** arguments are given after
as an argument at least once to **-f** or **-\-file**. However, if any other
**-e**, **-\-expression**, **-f**, or **-\-file** arguments are given after
**-f-** or equivalent is given, bc(1) will give a fatal error and exit.
This is a **non-portable extension**.
@ -258,8 +257,8 @@ Identifiers with more than one character (letter) are a
**ibase** is a global variable determining how to interpret constant numbers. It
is the "input" base, or the number base used for interpreting input numbers.
**ibase** is initially **10**. If the **-s** (**--standard**) and **-w**
(**--warn**) flags were not given on the command line, the max allowable value
**ibase** is initially **10**. If the **-s** (**-\-standard**) and **-w**
(**-\-warn**) flags were not given on the command line, the max allowable value
for **ibase** is **36**. Otherwise, it is **16**. The min allowable value for
**ibase** is **2**. The max allowable value for **ibase** can be queried in
bc(1) programs with the **maxibase()** built-in function.
@ -449,7 +448,7 @@ 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.
**++** **--**
**++** **-\-**
: Type: Prefix and Postfix
@ -547,7 +546,7 @@ precedence.
The operators will be described in more detail below.
**++** **--**
**++** **-\-**
: The prefix and postfix **increment** and **decrement** operators behave
exactly like they would in C. They require a named expression (see the
@ -878,7 +877,7 @@ This is a **non-portable extension**.
All of the functions below, including the functions in the extended math
library (see the *Extended Library* subsection below), are available when the
**-l** or **--mathlib** command-line flags are given, except that the extended
**-l** or **-\-mathlib** command-line flags are given, except that the extended
math library is not available when the **-s** option, the **-w** option, or
equivalents are given.
@ -930,8 +929,8 @@ The [standard][1] defines the following functions for the math library:
## Extended Library
The extended library is *not* loaded when the **-s**/**--standard** or
**-w**/**--warn** options are given since they are not part of the library
The extended library is *not* loaded when the **-s**/**-\-standard** or
**-w**/**-\-warn** options are given since they are not part of the library
defined by the [standard][1].
The extended library is a **non-portable extension**.
@ -1599,17 +1598,17 @@ The other statuses will only be returned when bc(1) is not in interactive mode
(see the **INTERACTIVE MODE** section), since bc(1) resets its state (see the
**RESET** section) and accepts more input when one of those errors occurs in
interactive mode. This is also the case when interactive mode is forced by the
**-i** flag or **--interactive** option.
**-i** flag or **-\-interactive** option.
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 **-i** flag or
**--interactive** option.
**-\-interactive** option.
# INTERACTIVE MODE
Per the [standard][1], bc(1) has an interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both **stdin** and **stdout**
are hooked to a terminal, but the **-i** flag and **--interactive** option can
are hooked to a terminal, but the **-i** flag and **-\-interactive** option can
turn it on in other cases.
In interactive mode, bc(1) attempts to recover from errors (see the **RESET**

View File

@ -25,7 +25,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
.TH "BCL" "3" "February 2021" "Gavin D. Howard" "Libraries Manual"
.TH "BCL" "3" "March 2021" "Gavin D. Howard" "Libraries Manual"
.SH NAME
.PP
bcl - library of arbitrary precision decimal arithmetic

View File

@ -426,7 +426,7 @@ All procedures in this section require a valid current context.
bcl(3) will encode an error in the return value, if there was one. The error
can be queried with **bcl_err(BclNumber)**. Possible errors include:
* **BCL_ERROR_INVALID_CONTEXT**
* **BCL_ERROR_INVALID_CONTEXT**
* **BCL_ERROR_FATAL_ALLOC_ERR**
**void bcl_num_free(BclNumber** *n***)**
@ -487,7 +487,7 @@ subsection below.
can be queried with **bcl_err(BclNumber)**. Possible errors include:
* **BCL_ERROR_INVALID_NUM**
* **BCL_ERROR_INVALID_CONTEXT**
* **BCL_ERROR_INVALID_CONTEXT**
* **BCL_ERROR_PARSE_INVALID_STR**
* **BCL_ERROR_FATAL_ALLOC_ERR**
@ -524,7 +524,7 @@ subsection below.
bcl(3) will encode an error in the return value, if there was one. The error
can be queried with **bcl_err(BclNumber)**. Possible errors include:
* **BCL_ERROR_INVALID_CONTEXT**
* **BCL_ERROR_INVALID_CONTEXT**
* **BCL_ERROR_FATAL_ALLOC_ERR**
## Math
@ -551,7 +551,7 @@ All procedures in this section can return the following errors:
can be queried with **bcl_err(BclNumber)**. Possible errors include:
* **BCL_ERROR_INVALID_NUM**
* **BCL_ERROR_INVALID_CONTEXT**
* **BCL_ERROR_INVALID_CONTEXT**
* **BCL_ERROR_FATAL_ALLOC_ERR**
**BclNumber bcl_sub(BclNumber** *a***, BclNumber** *b***)**
@ -568,7 +568,7 @@ All procedures in this section can return the following errors:
can be queried with **bcl_err(BclNumber)**. Possible errors include:
* **BCL_ERROR_INVALID_NUM**
* **BCL_ERROR_INVALID_CONTEXT**
* **BCL_ERROR_INVALID_CONTEXT**
* **BCL_ERROR_FATAL_ALLOC_ERR**
**BclNumber bcl_mul(BclNumber** *a***, BclNumber** *b***)**
@ -587,7 +587,7 @@ All procedures in this section can return the following errors:
can be queried with **bcl_err(BclNumber)**. Possible errors include:
* **BCL_ERROR_INVALID_NUM**
* **BCL_ERROR_INVALID_CONTEXT**
* **BCL_ERROR_INVALID_CONTEXT**
* **BCL_ERROR_FATAL_ALLOC_ERR**
**BclNumber bcl_div(BclNumber** *a***, BclNumber** *b***)**
@ -606,8 +606,8 @@ All procedures in this section can return the following errors:
can be queried with **bcl_err(BclNumber)**. Possible errors include:
* **BCL_ERROR_INVALID_NUM**
* **BCL_ERROR_INVALID_CONTEXT**
* **BCL_ERROR_MATH_DIVIDE_BY_ZERO**
* **BCL_ERROR_INVALID_CONTEXT**
* **BCL_ERROR_MATH_DIVIDE_BY_ZERO**
* **BCL_ERROR_FATAL_ALLOC_ERR**
**BclNumber bcl_mod(BclNumber** *a***, BclNumber** *b***)**
@ -626,8 +626,8 @@ All procedures in this section can return the following errors:
can be queried with **bcl_err(BclNumber)**. Possible errors include:
* **BCL_ERROR_INVALID_NUM**
* **BCL_ERROR_INVALID_CONTEXT**
* **BCL_ERROR_MATH_DIVIDE_BY_ZERO**
* **BCL_ERROR_INVALID_CONTEXT**
* **BCL_ERROR_MATH_DIVIDE_BY_ZERO**
* **BCL_ERROR_FATAL_ALLOC_ERR**
**BclNumber bcl_pow(BclNumber** *a***, BclNumber** *b***)**
@ -649,10 +649,10 @@ All procedures in this section can return the following errors:
can be queried with **bcl_err(BclNumber)**. Possible errors include:
* **BCL_ERROR_INVALID_NUM**
* **BCL_ERROR_INVALID_CONTEXT**
* **BCL_ERROR_MATH_NON_INTEGER**
* **BCL_ERROR_MATH_OVERFLOW**
* **BCL_ERROR_MATH_DIVIDE_BY_ZERO**
* **BCL_ERROR_INVALID_CONTEXT**
* **BCL_ERROR_MATH_NON_INTEGER**
* **BCL_ERROR_MATH_OVERFLOW**
* **BCL_ERROR_MATH_DIVIDE_BY_ZERO**
* **BCL_ERROR_FATAL_ALLOC_ERR**
**BclNumber bcl_lshift(BclNumber** *a***, BclNumber** *b***)**
@ -671,8 +671,8 @@ All procedures in this section can return the following errors:
can be queried with **bcl_err(BclNumber)**. Possible errors include:
* **BCL_ERROR_INVALID_NUM**
* **BCL_ERROR_INVALID_CONTEXT**
* **BCL_ERROR_MATH_NON_INTEGER**
* **BCL_ERROR_INVALID_CONTEXT**
* **BCL_ERROR_MATH_NON_INTEGER**
* **BCL_ERROR_FATAL_ALLOC_ERR**
**BclNumber bcl_rshift(BclNumber** *a***, BclNumber** *b***)**
@ -691,8 +691,8 @@ All procedures in this section can return the following errors:
can be queried with **bcl_err(BclNumber)**. Possible errors include:
* **BCL_ERROR_INVALID_NUM**
* **BCL_ERROR_INVALID_CONTEXT**
* **BCL_ERROR_MATH_NON_INTEGER**
* **BCL_ERROR_INVALID_CONTEXT**
* **BCL_ERROR_MATH_NON_INTEGER**
* **BCL_ERROR_FATAL_ALLOC_ERR**
**BclNumber bcl_sqrt(BclNumber** *a***)**
@ -709,8 +709,8 @@ All procedures in this section can return the following errors:
can be queried with **bcl_err(BclNumber)**. Possible errors include:
* **BCL_ERROR_INVALID_NUM**
* **BCL_ERROR_INVALID_CONTEXT**
* **BCL_ERROR_MATH_NEGATIVE**
* **BCL_ERROR_INVALID_CONTEXT**
* **BCL_ERROR_MATH_NEGATIVE**
* **BCL_ERROR_FATAL_ALLOC_ERR**
**BclError bcl_divmod(BclNumber** *a***, BclNumber** *b***, BclNumber \****c***, BclNumber \****d***)**
@ -719,7 +719,7 @@ All procedures in this section can return the following errors:
into the space pointed to by *c*, and puts the modulus in a new number which
is put into the space pointed to by *d*.
*b* cannot be **0**.
*b* cannot be **0**.
*a* and *b* are consumed; they cannot be used after the call. See the
**Consumption and Propagation** subsection below.
@ -731,8 +731,8 @@ All procedures in this section can return the following errors:
function can return:
* **BCL_ERROR_INVALID_NUM**
* **BCL_ERROR_INVALID_CONTEXT**
* **BCL_ERROR_MATH_DIVIDE_BY_ZERO**
* **BCL_ERROR_INVALID_CONTEXT**
* **BCL_ERROR_MATH_DIVIDE_BY_ZERO**
* **BCL_ERROR_FATAL_ALLOC_ERR**
**BclNumber bcl_modexp(BclNumber** *a***, BclNumber** *b***, BclNumber** *c***)**
@ -751,10 +751,10 @@ All procedures in this section can return the following errors:
can be queried with **bcl_err(BclNumber)**. Possible errors include:
* **BCL_ERROR_INVALID_NUM**
* **BCL_ERROR_INVALID_CONTEXT**
* **BCL_ERROR_MATH_NEGATIVE**
* **BCL_ERROR_MATH_NON_INTEGER**
* **BCL_ERROR_MATH_DIVIDE_BY_ZERO**
* **BCL_ERROR_INVALID_CONTEXT**
* **BCL_ERROR_MATH_NEGATIVE**
* **BCL_ERROR_MATH_NON_INTEGER**
* **BCL_ERROR_MATH_DIVIDE_BY_ZERO**
* **BCL_ERROR_FATAL_ALLOC_ERR**
## Miscellaneous
@ -791,7 +791,7 @@ All procedures in this section can return the following errors:
can be queried with **bcl_err(BclNumber)**. Possible errors include:
* **BCL_ERROR_INVALID_NUM**
* **BCL_ERROR_INVALID_CONTEXT**
* **BCL_ERROR_INVALID_CONTEXT**
* **BCL_ERROR_FATAL_ALLOC_ERR**
## Pseudo-Random Number Generator
@ -852,9 +852,9 @@ procedures require a valid current context.
can be queried with **bcl_err(BclNumber)**. Possible errors include:
* **BCL_ERROR_INVALID_NUM**
* **BCL_ERROR_INVALID_CONTEXT**
* **BCL_ERROR_MATH_NEGATIVE**
* **BCL_ERROR_MATH_NON_INTEGER**
* **BCL_ERROR_INVALID_CONTEXT**
* **BCL_ERROR_MATH_NEGATIVE**
* **BCL_ERROR_MATH_NON_INTEGER**
* **BCL_ERROR_FATAL_ALLOC_ERR**
**BclNumber bcl_frand(size_t** *places***)**
@ -868,7 +868,7 @@ procedures require a valid current context.
bcl(3) will encode an error in the return value, if there was one. The error
can be queried with **bcl_err(BclNumber)**. Possible errors include:
* **BCL_ERROR_INVALID_CONTEXT**
* **BCL_ERROR_INVALID_CONTEXT**
* **BCL_ERROR_FATAL_ALLOC_ERR**
**BclNumber bcl_ifrand(BclNumber** *a***, size_t** *places***)**
@ -887,9 +887,9 @@ procedures require a valid current context.
can be queried with **bcl_err(BclNumber)**. Possible errors include:
* **BCL_ERROR_INVALID_NUM**
* **BCL_ERROR_INVALID_CONTEXT**
* **BCL_ERROR_MATH_NEGATIVE**
* **BCL_ERROR_MATH_NON_INTEGER**
* **BCL_ERROR_INVALID_CONTEXT**
* **BCL_ERROR_MATH_NEGATIVE**
* **BCL_ERROR_MATH_NON_INTEGER**
* **BCL_ERROR_FATAL_ALLOC_ERR**
**BclError bcl_rand_seedWithNum(BclNumber** *n***)**
@ -904,7 +904,7 @@ procedures require a valid current context.
function can return:
* **BCL_ERROR_INVALID_NUM**
* **BCL_ERROR_INVALID_CONTEXT**
* **BCL_ERROR_INVALID_CONTEXT**
Note that if **bcl_rand_seed2num(***void***)** or
**bcl_rand_seed2num_err(BclNumber)** are called right after this function,
@ -917,7 +917,7 @@ procedures require a valid current context.
If there was no error, **BCL_ERROR_NONE** is returned. Otherwise, this
function can return:
* **BCL_ERROR_INVALID_CONTEXT**
* **BCL_ERROR_INVALID_CONTEXT**
**void bcl_rand_reseed(***void***)**
@ -935,7 +935,7 @@ procedures require a valid current context.
bcl(3) will encode an error in the return value, if there was one. The error
can be queried with **bcl_err(BclNumber)**. Possible errors include:
* **BCL_ERROR_INVALID_CONTEXT**
* **BCL_ERROR_INVALID_CONTEXT**
* **BCL_ERROR_FATAL_ALLOC_ERR**
**BclRandInt bcl_rand_int(***void***)**

View File

@ -34,7 +34,7 @@ dc - arbitrary-precision decimal reverse-Polish notation calculator
# SYNOPSIS
**dc** [**-hiPvVx**] [**--version**] [**--help**] [**--interactive**] [**--no-prompt**] [**--extended-register**] [**-e** *expr*] [**--expression**=*expr*...] [**-f** *file*...] [**-file**=*file*...] [*file*...]
**dc** [**-hiPvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@ -43,11 +43,11 @@ notation) to store numbers and results of computations. Arithmetic operations
pop arguments off of the stack and push the results.
If no files are given on the command-line as extra arguments (i.e., not as
**-f** or **--file** arguments), then dc(1) reads from **stdin**. Otherwise,
**-f** or **-\-file** arguments), then dc(1) reads from **stdin**. Otherwise,
those files are processed, and dc(1) will then exit.
This is different from the dc(1) on OpenBSD and possibly other dc(1)
implementations, where **-e** (**--expression**) and **-f** (**--file**)
implementations, where **-e** (**-\-expression**) and **-f** (**-\-file**)
arguments cause dc(1) to execute them and exit. The reason for this is that this
dc(1) allows users to set arguments in the environment variable **DC_ENV_ARGS**
(see the **ENVIRONMENT VARIABLES** section). Any expressions given on the
@ -64,21 +64,21 @@ as the last command-line argument or define the environment variable
The following are the options that dc(1) accepts.
**-h**, **--help**
**-h**, **-\-help**
: Prints a usage message and quits.
**-v**, **-V**, **--version**
**-v**, **-V**, **-\-version**
: Print the version information (copyright header) and exit.
**-i**, **--interactive**
**-i**, **-\-interactive**
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
This is a **non-portable extension**.
**-P**, **--no-prompt**
**-P**, **-\-no-prompt**
{{ A E H N EH EN HN EHN }}
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
@ -92,14 +92,14 @@ The following are the options that dc(1) accepts.
This is a **non-portable extension**.
**-x** **--extended-register**
**-x** **-\-extended-register**
: Enables extended register mode. See the *Extended Register Mode* subsection
of the **REGISTERS** section for more information.
This is a **non-portable extension**.
**-e** *expr*, **--expression**=*expr*
**-e** *expr*, **-\-expression**=*expr*
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
order. If files are given as well (see below), the expressions and files are
@ -109,14 +109,14 @@ The following are the options that dc(1) accepts.
If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
see the **ENVIRONMENT VARIABLES** section), then after processing all
expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
as an argument at least once to **-f** or **--file**, whether on the
as an argument at least once to **-f** or **-\-file**, whether on the
command-line or in **DC_ENV_ARGS**. However, if any other **-e**,
**--expression**, **-f**, or **--file** arguments are given after **-f-** or
equivalent is given, dc(1) will give a fatal error and exit.
**-\-expression**, **-f**, or **-\-file** arguments are given after **-f-**
or equivalent is given, dc(1) will give a fatal error and exit.
This is a **non-portable extension**.
**-f** *file*, **--file**=*file*
**-f** *file*, **-\-file**=*file*
: Reads in *file* and evaluates it, line by line, as though it were read
through **stdin**. If expressions are also given (see above), the
@ -125,8 +125,8 @@ The following are the options that dc(1) accepts.
If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
see the **ENVIRONMENT VARIABLES** section), then after processing all
expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
as an argument at least once to **-f** or **--file**. However, if any other
**-e**, **--expression**, **-f**, or **--file** arguments are given after
as an argument at least once to **-f** or **-\-file**. However, if any other
**-e**, **-\-expression**, **-f**, or **-\-file** arguments are given after
**-f-** or equivalent is given, dc(1) will give a fatal error and exit.
This is a **non-portable extension**.
@ -947,7 +947,7 @@ follows any command that needs a register name. The only exception is a newline
Unlike most other dc(1) implentations, this dc(1) provides nearly unlimited
amounts of registers, if extended register mode is enabled.
If extended register mode is enabled (**-x** or **--extended-register**
If extended register mode is enabled (**-x** or **-\-extended-register**
command-line arguments are given), then normal single character registers are
used *unless* the character immediately following a command that needs a
register name is a space (according to **isspace()**) and not a newline
@ -1168,17 +1168,17 @@ The other statuses will only be returned when dc(1) is not in interactive mode
(see the **INTERACTIVE MODE** section), since dc(1) resets its state (see the
**RESET** section) and accepts more input when one of those errors occurs in
interactive mode. This is also the case when interactive mode is forced by the
**-i** flag or **--interactive** option.
**-i** flag or **-\-interactive** option.
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 **-i** flag or
**--interactive** option.
**-\-interactive** option.
# INTERACTIVE MODE
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both **stdin** and **stdout**
are hooked to a terminal, but the **-i** flag and **--interactive** option can
are hooked to a terminal, but the **-i** flag and **-\-interactive** option can
turn it on in other cases.
In interactive mode, dc(1) attempts to recover from errors (see the **RESET**

View File

@ -25,18 +25,17 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
.TH "DC" "1" "February 2021" "Gavin D. Howard" "General Commands Manual"
.TH "DC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
.SH Name
.PP
dc - arbitrary-precision decimal reverse-Polish notation calculator
.SH SYNOPSIS
.PP
\f[B]dc\f[R] [\f[B]-hiPvVx\f[R]] [\f[B]\[en]version\f[R]]
[\f[B]\[en]help\f[R]] [\f[B]\[en]interactive\f[R]]
[\f[B]\[en]no-prompt\f[R]] [\f[B]\[en]extended-register\f[R]]
[\f[B]-e\f[R] \f[I]expr\f[R]]
[\f[B]\[en]expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
\f[I]file\f[R]\&...] [\f[B]-file\f[R]=\f[I]file\f[R]\&...]
\f[B]dc\f[R] [\f[B]-hiPvVx\f[R]] [\f[B]--version\f[R]]
[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--no-prompt\f[R]]
[\f[B]--extended-register\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
[\f[I]file\f[R]\&...]
.SH DESCRIPTION
.PP
@ -47,13 +46,13 @@ Arithmetic operations pop arguments off of the stack and push the
results.
.PP
If no files are given on the command-line as extra arguments (i.e., not
as \f[B]-f\f[R] or \f[B]\[en]file\f[R] arguments), then dc(1) reads from
as \f[B]-f\f[R] or \f[B]--file\f[R] arguments), then dc(1) reads from
\f[B]stdin\f[R].
Otherwise, those files are processed, and dc(1) will then exit.
.PP
This is different from the dc(1) on OpenBSD and possibly other dc(1)
implementations, where \f[B]-e\f[R] (\f[B]\[en]expression\f[R]) and
\f[B]-f\f[R] (\f[B]\[en]file\f[R]) arguments cause dc(1) to execute them
implementations, where \f[B]-e\f[R] (\f[B]--expression\f[R]) and
\f[B]-f\f[R] (\f[B]--file\f[R]) arguments cause dc(1) to execute them
and exit.
The reason for this is that this dc(1) allows users to set arguments in
the environment variable \f[B]DC_ENV_ARGS\f[R] (see the \f[B]ENVIRONMENT
@ -72,13 +71,13 @@ argument or define the environment variable \f[B]DC_EXPR_EXIT\f[R].
.PP
The following are the options that dc(1) accepts.
.TP
\f[B]-h\f[R], \f[B]\[en]help\f[R]
\f[B]-h\f[R], \f[B]--help\f[R]
Prints a usage message and quits.
.TP
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]\[en]version\f[R]
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
Print the version information (copyright header) and exit.
.TP
\f[B]-i\f[R], \f[B]\[en]interactive\f[R]
\f[B]-i\f[R], \f[B]--interactive\f[R]
Forces interactive mode.
(See the \f[B]INTERACTIVE MODE\f[R] section.)
.RS
@ -86,7 +85,7 @@ Forces interactive mode.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-P\f[R], \f[B]\[en]no-prompt\f[R]
\f[B]-P\f[R], \f[B]--no-prompt\f[R]
Disables the prompt in TTY mode.
(The prompt is only enabled in TTY mode.
See the \f[B]TTY MODE\f[R] section) This is mostly for those users that
@ -98,7 +97,7 @@ Most of those users would want to put this option in
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-x\f[R] \f[B]\[en]extended-register\f[R]
\f[B]-x\f[R] \f[B]--extended-register\f[R]
Enables extended register mode.
See the \f[I]Extended Register Mode\f[R] subsection of the
\f[B]REGISTERS\f[R] section for more information.
@ -107,7 +106,7 @@ See the \f[I]Extended Register Mode\f[R] subsection of the
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]\[en]expression\f[R]=\f[I]expr\f[R]
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
Evaluates \f[I]expr\f[R].
If multiple expressions are given, they are evaluated in order.
If files are given as well (see below), the expressions and files are
@ -120,17 +119,17 @@ If this option is given on the command-line (i.e., not in
\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
then after processing all expressions and files, dc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
\f[B]-f\f[R] or \f[B]\[en]file\f[R], whether on the command-line or in
\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
\f[B]DC_ENV_ARGS\f[R].
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
exit.
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-f\f[R] \f[I]file\f[R], \f[B]\[en]file\f[R]=\f[I]file\f[R]
\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
were read through \f[B]stdin\f[R].
If expressions are also given (see above), the expressions are evaluated
@ -141,9 +140,9 @@ If this option is given on the command-line (i.e., not in
\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
then after processing all expressions and files, dc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
\f[B]-f\f[R] or \f[B]\[en]file\f[R].
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
\f[B]-f\f[R] or \f[B]--file\f[R].
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
exit.
.PP
@ -1037,7 +1036,7 @@ Unlike most other dc(1) implentations, this dc(1) provides nearly
unlimited amounts of registers, if extended register mode is enabled.
.PP
If extended register mode is enabled (\f[B]-x\f[R] or
\f[B]\[en]extended-register\f[R] command-line arguments are given), then
\f[B]--extended-register\f[R] command-line arguments are given), then
normal single character registers are used \f[I]unless\f[R] the
character immediately following a command that needs a register name is
a space (according to \f[B]isspace()\f[R]) and not a newline
@ -1260,17 +1259,17 @@ interactive mode (see the \f[B]INTERACTIVE MODE\f[R] section), since
dc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
more input when one of those errors occurs in interactive mode.
This is also the case when interactive mode is forced by the
\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.PP
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]\[en]interactive\f[R] option.
\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
and \f[B]\[en]interactive\f[R] option can turn it on in other cases.
and \f[B]--interactive\f[R] option can turn it on in other cases.
.PP
In interactive mode, dc(1) attempts to recover from errors (see the
\f[B]RESET\f[R] section), and in normal execution, flushes

View File

@ -34,7 +34,7 @@ dc - arbitrary-precision decimal reverse-Polish notation calculator
# SYNOPSIS
**dc** [**-hiPvVx**] [**--version**] [**--help**] [**--interactive**] [**--no-prompt**] [**--extended-register**] [**-e** *expr*] [**--expression**=*expr*...] [**-f** *file*...] [**-file**=*file*...] [*file*...]
**dc** [**-hiPvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@ -43,11 +43,11 @@ notation) to store numbers and results of computations. Arithmetic operations
pop arguments off of the stack and push the results.
If no files are given on the command-line as extra arguments (i.e., not as
**-f** or **--file** arguments), then dc(1) reads from **stdin**. Otherwise,
**-f** or **-\-file** arguments), then dc(1) reads from **stdin**. Otherwise,
those files are processed, and dc(1) will then exit.
This is different from the dc(1) on OpenBSD and possibly other dc(1)
implementations, where **-e** (**--expression**) and **-f** (**--file**)
implementations, where **-e** (**-\-expression**) and **-f** (**-\-file**)
arguments cause dc(1) to execute them and exit. The reason for this is that this
dc(1) allows users to set arguments in the environment variable **DC_ENV_ARGS**
(see the **ENVIRONMENT VARIABLES** section). Any expressions given on the
@ -64,21 +64,21 @@ as the last command-line argument or define the environment variable
The following are the options that dc(1) accepts.
**-h**, **--help**
**-h**, **-\-help**
: Prints a usage message and quits.
**-v**, **-V**, **--version**
**-v**, **-V**, **-\-version**
: Print the version information (copyright header) and exit.
**-i**, **--interactive**
**-i**, **-\-interactive**
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
This is a **non-portable extension**.
**-P**, **--no-prompt**
**-P**, **-\-no-prompt**
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
See the **TTY MODE** section) This is mostly for those users that do not
@ -87,14 +87,14 @@ The following are the options that dc(1) accepts.
This is a **non-portable extension**.
**-x** **--extended-register**
**-x** **-\-extended-register**
: Enables extended register mode. See the *Extended Register Mode* subsection
of the **REGISTERS** section for more information.
This is a **non-portable extension**.
**-e** *expr*, **--expression**=*expr*
**-e** *expr*, **-\-expression**=*expr*
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
order. If files are given as well (see below), the expressions and files are
@ -104,14 +104,14 @@ The following are the options that dc(1) accepts.
If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
see the **ENVIRONMENT VARIABLES** section), then after processing all
expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
as an argument at least once to **-f** or **--file**, whether on the
as an argument at least once to **-f** or **-\-file**, whether on the
command-line or in **DC_ENV_ARGS**. However, if any other **-e**,
**--expression**, **-f**, or **--file** arguments are given after **-f-** or
equivalent is given, dc(1) will give a fatal error and exit.
**-\-expression**, **-f**, or **-\-file** arguments are given after **-f-**
or equivalent is given, dc(1) will give a fatal error and exit.
This is a **non-portable extension**.
**-f** *file*, **--file**=*file*
**-f** *file*, **-\-file**=*file*
: Reads in *file* and evaluates it, line by line, as though it were read
through **stdin**. If expressions are also given (see above), the
@ -120,8 +120,8 @@ The following are the options that dc(1) accepts.
If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
see the **ENVIRONMENT VARIABLES** section), then after processing all
expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
as an argument at least once to **-f** or **--file**. However, if any other
**-e**, **--expression**, **-f**, or **--file** arguments are given after
as an argument at least once to **-f** or **-\-file**. However, if any other
**-e**, **-\-expression**, **-f**, or **-\-file** arguments are given after
**-f-** or equivalent is given, dc(1) will give a fatal error and exit.
This is a **non-portable extension**.
@ -909,7 +909,7 @@ follows any command that needs a register name. The only exception is a newline
Unlike most other dc(1) implentations, this dc(1) provides nearly unlimited
amounts of registers, if extended register mode is enabled.
If extended register mode is enabled (**-x** or **--extended-register**
If extended register mode is enabled (**-x** or **-\-extended-register**
command-line arguments are given), then normal single character registers are
used *unless* the character immediately following a command that needs a
register name is a space (according to **isspace()**) and not a newline
@ -1118,17 +1118,17 @@ The other statuses will only be returned when dc(1) is not in interactive mode
(see the **INTERACTIVE MODE** section), since dc(1) resets its state (see the
**RESET** section) and accepts more input when one of those errors occurs in
interactive mode. This is also the case when interactive mode is forced by the
**-i** flag or **--interactive** option.
**-i** flag or **-\-interactive** option.
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 **-i** flag or
**--interactive** option.
**-\-interactive** option.
# INTERACTIVE MODE
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both **stdin** and **stdout**
are hooked to a terminal, but the **-i** flag and **--interactive** option can
are hooked to a terminal, but the **-i** flag and **-\-interactive** option can
turn it on in other cases.
In interactive mode, dc(1) attempts to recover from errors (see the **RESET**

View File

@ -25,18 +25,17 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
.TH "DC" "1" "February 2021" "Gavin D. Howard" "General Commands Manual"
.TH "DC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
.SH Name
.PP
dc - arbitrary-precision decimal reverse-Polish notation calculator
.SH SYNOPSIS
.PP
\f[B]dc\f[R] [\f[B]-hiPvVx\f[R]] [\f[B]\[en]version\f[R]]
[\f[B]\[en]help\f[R]] [\f[B]\[en]interactive\f[R]]
[\f[B]\[en]no-prompt\f[R]] [\f[B]\[en]extended-register\f[R]]
[\f[B]-e\f[R] \f[I]expr\f[R]]
[\f[B]\[en]expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
\f[I]file\f[R]\&...] [\f[B]-file\f[R]=\f[I]file\f[R]\&...]
\f[B]dc\f[R] [\f[B]-hiPvVx\f[R]] [\f[B]--version\f[R]]
[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--no-prompt\f[R]]
[\f[B]--extended-register\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
[\f[I]file\f[R]\&...]
.SH DESCRIPTION
.PP
@ -47,13 +46,13 @@ Arithmetic operations pop arguments off of the stack and push the
results.
.PP
If no files are given on the command-line as extra arguments (i.e., not
as \f[B]-f\f[R] or \f[B]\[en]file\f[R] arguments), then dc(1) reads from
as \f[B]-f\f[R] or \f[B]--file\f[R] arguments), then dc(1) reads from
\f[B]stdin\f[R].
Otherwise, those files are processed, and dc(1) will then exit.
.PP
This is different from the dc(1) on OpenBSD and possibly other dc(1)
implementations, where \f[B]-e\f[R] (\f[B]\[en]expression\f[R]) and
\f[B]-f\f[R] (\f[B]\[en]file\f[R]) arguments cause dc(1) to execute them
implementations, where \f[B]-e\f[R] (\f[B]--expression\f[R]) and
\f[B]-f\f[R] (\f[B]--file\f[R]) arguments cause dc(1) to execute them
and exit.
The reason for this is that this dc(1) allows users to set arguments in
the environment variable \f[B]DC_ENV_ARGS\f[R] (see the \f[B]ENVIRONMENT
@ -72,13 +71,13 @@ argument or define the environment variable \f[B]DC_EXPR_EXIT\f[R].
.PP
The following are the options that dc(1) accepts.
.TP
\f[B]-h\f[R], \f[B]\[en]help\f[R]
\f[B]-h\f[R], \f[B]--help\f[R]
Prints a usage message and quits.
.TP
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]\[en]version\f[R]
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
Print the version information (copyright header) and exit.
.TP
\f[B]-i\f[R], \f[B]\[en]interactive\f[R]
\f[B]-i\f[R], \f[B]--interactive\f[R]
Forces interactive mode.
(See the \f[B]INTERACTIVE MODE\f[R] section.)
.RS
@ -86,7 +85,7 @@ Forces interactive mode.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-P\f[R], \f[B]\[en]no-prompt\f[R]
\f[B]-P\f[R], \f[B]--no-prompt\f[R]
Disables the prompt in TTY mode.
(The prompt is only enabled in TTY mode.
See the \f[B]TTY MODE\f[R] section) This is mostly for those users that
@ -98,7 +97,7 @@ Most of those users would want to put this option in
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-x\f[R] \f[B]\[en]extended-register\f[R]
\f[B]-x\f[R] \f[B]--extended-register\f[R]
Enables extended register mode.
See the \f[I]Extended Register Mode\f[R] subsection of the
\f[B]REGISTERS\f[R] section for more information.
@ -107,7 +106,7 @@ See the \f[I]Extended Register Mode\f[R] subsection of the
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]\[en]expression\f[R]=\f[I]expr\f[R]
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
Evaluates \f[I]expr\f[R].
If multiple expressions are given, they are evaluated in order.
If files are given as well (see below), the expressions and files are
@ -120,17 +119,17 @@ If this option is given on the command-line (i.e., not in
\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
then after processing all expressions and files, dc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
\f[B]-f\f[R] or \f[B]\[en]file\f[R], whether on the command-line or in
\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
\f[B]DC_ENV_ARGS\f[R].
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
exit.
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-f\f[R] \f[I]file\f[R], \f[B]\[en]file\f[R]=\f[I]file\f[R]
\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
were read through \f[B]stdin\f[R].
If expressions are also given (see above), the expressions are evaluated
@ -141,9 +140,9 @@ If this option is given on the command-line (i.e., not in
\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
then after processing all expressions and files, dc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
\f[B]-f\f[R] or \f[B]\[en]file\f[R].
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
\f[B]-f\f[R] or \f[B]--file\f[R].
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
exit.
.PP
@ -837,7 +836,7 @@ Unlike most other dc(1) implentations, this dc(1) provides nearly
unlimited amounts of registers, if extended register mode is enabled.
.PP
If extended register mode is enabled (\f[B]-x\f[R] or
\f[B]\[en]extended-register\f[R] command-line arguments are given), then
\f[B]--extended-register\f[R] command-line arguments are given), then
normal single character registers are used \f[I]unless\f[R] the
character immediately following a command that needs a register name is
a space (according to \f[B]isspace()\f[R]) and not a newline
@ -1052,17 +1051,17 @@ interactive mode (see the \f[B]INTERACTIVE MODE\f[R] section), since
dc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
more input when one of those errors occurs in interactive mode.
This is also the case when interactive mode is forced by the
\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.PP
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]\[en]interactive\f[R] option.
\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
and \f[B]\[en]interactive\f[R] option can turn it on in other cases.
and \f[B]--interactive\f[R] option can turn it on in other cases.
.PP
In interactive mode, dc(1) attempts to recover from errors (see the
\f[B]RESET\f[R] section), and in normal execution, flushes

View File

@ -34,7 +34,7 @@ dc - arbitrary-precision decimal reverse-Polish notation calculator
# SYNOPSIS
**dc** [**-hiPvVx**] [**--version**] [**--help**] [**--interactive**] [**--no-prompt**] [**--extended-register**] [**-e** *expr*] [**--expression**=*expr*...] [**-f** *file*...] [**-file**=*file*...] [*file*...]
**dc** [**-hiPvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@ -43,11 +43,11 @@ notation) to store numbers and results of computations. Arithmetic operations
pop arguments off of the stack and push the results.
If no files are given on the command-line as extra arguments (i.e., not as
**-f** or **--file** arguments), then dc(1) reads from **stdin**. Otherwise,
**-f** or **-\-file** arguments), then dc(1) reads from **stdin**. Otherwise,
those files are processed, and dc(1) will then exit.
This is different from the dc(1) on OpenBSD and possibly other dc(1)
implementations, where **-e** (**--expression**) and **-f** (**--file**)
implementations, where **-e** (**-\-expression**) and **-f** (**-\-file**)
arguments cause dc(1) to execute them and exit. The reason for this is that this
dc(1) allows users to set arguments in the environment variable **DC_ENV_ARGS**
(see the **ENVIRONMENT VARIABLES** section). Any expressions given on the
@ -64,21 +64,21 @@ as the last command-line argument or define the environment variable
The following are the options that dc(1) accepts.
**-h**, **--help**
**-h**, **-\-help**
: Prints a usage message and quits.
**-v**, **-V**, **--version**
**-v**, **-V**, **-\-version**
: Print the version information (copyright header) and exit.
**-i**, **--interactive**
**-i**, **-\-interactive**
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
This is a **non-portable extension**.
**-P**, **--no-prompt**
**-P**, **-\-no-prompt**
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
See the **TTY MODE** section) This is mostly for those users that do not
@ -87,14 +87,14 @@ The following are the options that dc(1) accepts.
This is a **non-portable extension**.
**-x** **--extended-register**
**-x** **-\-extended-register**
: Enables extended register mode. See the *Extended Register Mode* subsection
of the **REGISTERS** section for more information.
This is a **non-portable extension**.
**-e** *expr*, **--expression**=*expr*
**-e** *expr*, **-\-expression**=*expr*
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
order. If files are given as well (see below), the expressions and files are
@ -104,14 +104,14 @@ The following are the options that dc(1) accepts.
If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
see the **ENVIRONMENT VARIABLES** section), then after processing all
expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
as an argument at least once to **-f** or **--file**, whether on the
as an argument at least once to **-f** or **-\-file**, whether on the
command-line or in **DC_ENV_ARGS**. However, if any other **-e**,
**--expression**, **-f**, or **--file** arguments are given after **-f-** or
equivalent is given, dc(1) will give a fatal error and exit.
**-\-expression**, **-f**, or **-\-file** arguments are given after **-f-**
or equivalent is given, dc(1) will give a fatal error and exit.
This is a **non-portable extension**.
**-f** *file*, **--file**=*file*
**-f** *file*, **-\-file**=*file*
: Reads in *file* and evaluates it, line by line, as though it were read
through **stdin**. If expressions are also given (see above), the
@ -120,8 +120,8 @@ The following are the options that dc(1) accepts.
If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
see the **ENVIRONMENT VARIABLES** section), then after processing all
expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
as an argument at least once to **-f** or **--file**. However, if any other
**-e**, **--expression**, **-f**, or **--file** arguments are given after
as an argument at least once to **-f** or **-\-file**. However, if any other
**-e**, **-\-expression**, **-f**, or **-\-file** arguments are given after
**-f-** or equivalent is given, dc(1) will give a fatal error and exit.
This is a **non-portable extension**.
@ -749,7 +749,7 @@ follows any command that needs a register name. The only exception is a newline
Unlike most other dc(1) implentations, this dc(1) provides nearly unlimited
amounts of registers, if extended register mode is enabled.
If extended register mode is enabled (**-x** or **--extended-register**
If extended register mode is enabled (**-x** or **-\-extended-register**
command-line arguments are given), then normal single character registers are
used *unless* the character immediately following a command that needs a
register name is a space (according to **isspace()**) and not a newline
@ -951,17 +951,17 @@ The other statuses will only be returned when dc(1) is not in interactive mode
(see the **INTERACTIVE MODE** section), since dc(1) resets its state (see the
**RESET** section) and accepts more input when one of those errors occurs in
interactive mode. This is also the case when interactive mode is forced by the
**-i** flag or **--interactive** option.
**-i** flag or **-\-interactive** option.
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 **-i** flag or
**--interactive** option.
**-\-interactive** option.
# INTERACTIVE MODE
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both **stdin** and **stdout**
are hooked to a terminal, but the **-i** flag and **--interactive** option can
are hooked to a terminal, but the **-i** flag and **-\-interactive** option can
turn it on in other cases.
In interactive mode, dc(1) attempts to recover from errors (see the **RESET**

View File

@ -25,18 +25,17 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
.TH "DC" "1" "February 2021" "Gavin D. Howard" "General Commands Manual"
.TH "DC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
.SH Name
.PP
dc - arbitrary-precision decimal reverse-Polish notation calculator
.SH SYNOPSIS
.PP
\f[B]dc\f[R] [\f[B]-hiPvVx\f[R]] [\f[B]\[en]version\f[R]]
[\f[B]\[en]help\f[R]] [\f[B]\[en]interactive\f[R]]
[\f[B]\[en]no-prompt\f[R]] [\f[B]\[en]extended-register\f[R]]
[\f[B]-e\f[R] \f[I]expr\f[R]]
[\f[B]\[en]expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
\f[I]file\f[R]\&...] [\f[B]-file\f[R]=\f[I]file\f[R]\&...]
\f[B]dc\f[R] [\f[B]-hiPvVx\f[R]] [\f[B]--version\f[R]]
[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--no-prompt\f[R]]
[\f[B]--extended-register\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
[\f[I]file\f[R]\&...]
.SH DESCRIPTION
.PP
@ -47,13 +46,13 @@ Arithmetic operations pop arguments off of the stack and push the
results.
.PP
If no files are given on the command-line as extra arguments (i.e., not
as \f[B]-f\f[R] or \f[B]\[en]file\f[R] arguments), then dc(1) reads from
as \f[B]-f\f[R] or \f[B]--file\f[R] arguments), then dc(1) reads from
\f[B]stdin\f[R].
Otherwise, those files are processed, and dc(1) will then exit.
.PP
This is different from the dc(1) on OpenBSD and possibly other dc(1)
implementations, where \f[B]-e\f[R] (\f[B]\[en]expression\f[R]) and
\f[B]-f\f[R] (\f[B]\[en]file\f[R]) arguments cause dc(1) to execute them
implementations, where \f[B]-e\f[R] (\f[B]--expression\f[R]) and
\f[B]-f\f[R] (\f[B]--file\f[R]) arguments cause dc(1) to execute them
and exit.
The reason for this is that this dc(1) allows users to set arguments in
the environment variable \f[B]DC_ENV_ARGS\f[R] (see the \f[B]ENVIRONMENT
@ -72,13 +71,13 @@ argument or define the environment variable \f[B]DC_EXPR_EXIT\f[R].
.PP
The following are the options that dc(1) accepts.
.TP
\f[B]-h\f[R], \f[B]\[en]help\f[R]
\f[B]-h\f[R], \f[B]--help\f[R]
Prints a usage message and quits.
.TP
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]\[en]version\f[R]
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
Print the version information (copyright header) and exit.
.TP
\f[B]-i\f[R], \f[B]\[en]interactive\f[R]
\f[B]-i\f[R], \f[B]--interactive\f[R]
Forces interactive mode.
(See the \f[B]INTERACTIVE MODE\f[R] section.)
.RS
@ -86,7 +85,7 @@ Forces interactive mode.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-P\f[R], \f[B]\[en]no-prompt\f[R]
\f[B]-P\f[R], \f[B]--no-prompt\f[R]
Disables the prompt in TTY mode.
(The prompt is only enabled in TTY mode.
See the \f[B]TTY MODE\f[R] section) This is mostly for those users that
@ -98,7 +97,7 @@ Most of those users would want to put this option in
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-x\f[R] \f[B]\[en]extended-register\f[R]
\f[B]-x\f[R] \f[B]--extended-register\f[R]
Enables extended register mode.
See the \f[I]Extended Register Mode\f[R] subsection of the
\f[B]REGISTERS\f[R] section for more information.
@ -107,7 +106,7 @@ See the \f[I]Extended Register Mode\f[R] subsection of the
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]\[en]expression\f[R]=\f[I]expr\f[R]
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
Evaluates \f[I]expr\f[R].
If multiple expressions are given, they are evaluated in order.
If files are given as well (see below), the expressions and files are
@ -120,17 +119,17 @@ If this option is given on the command-line (i.e., not in
\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
then after processing all expressions and files, dc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
\f[B]-f\f[R] or \f[B]\[en]file\f[R], whether on the command-line or in
\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
\f[B]DC_ENV_ARGS\f[R].
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
exit.
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-f\f[R] \f[I]file\f[R], \f[B]\[en]file\f[R]=\f[I]file\f[R]
\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
were read through \f[B]stdin\f[R].
If expressions are also given (see above), the expressions are evaluated
@ -141,9 +140,9 @@ If this option is given on the command-line (i.e., not in
\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
then after processing all expressions and files, dc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
\f[B]-f\f[R] or \f[B]\[en]file\f[R].
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
\f[B]-f\f[R] or \f[B]--file\f[R].
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
exit.
.PP
@ -837,7 +836,7 @@ Unlike most other dc(1) implentations, this dc(1) provides nearly
unlimited amounts of registers, if extended register mode is enabled.
.PP
If extended register mode is enabled (\f[B]-x\f[R] or
\f[B]\[en]extended-register\f[R] command-line arguments are given), then
\f[B]--extended-register\f[R] command-line arguments are given), then
normal single character registers are used \f[I]unless\f[R] the
character immediately following a command that needs a register name is
a space (according to \f[B]isspace()\f[R]) and not a newline
@ -1052,17 +1051,17 @@ interactive mode (see the \f[B]INTERACTIVE MODE\f[R] section), since
dc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
more input when one of those errors occurs in interactive mode.
This is also the case when interactive mode is forced by the
\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.PP
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]\[en]interactive\f[R] option.
\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
and \f[B]\[en]interactive\f[R] option can turn it on in other cases.
and \f[B]--interactive\f[R] option can turn it on in other cases.
.PP
In interactive mode, dc(1) attempts to recover from errors (see the
\f[B]RESET\f[R] section), and in normal execution, flushes

View File

@ -34,7 +34,7 @@ dc - arbitrary-precision decimal reverse-Polish notation calculator
# SYNOPSIS
**dc** [**-hiPvVx**] [**--version**] [**--help**] [**--interactive**] [**--no-prompt**] [**--extended-register**] [**-e** *expr*] [**--expression**=*expr*...] [**-f** *file*...] [**-file**=*file*...] [*file*...]
**dc** [**-hiPvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@ -43,11 +43,11 @@ notation) to store numbers and results of computations. Arithmetic operations
pop arguments off of the stack and push the results.
If no files are given on the command-line as extra arguments (i.e., not as
**-f** or **--file** arguments), then dc(1) reads from **stdin**. Otherwise,
**-f** or **-\-file** arguments), then dc(1) reads from **stdin**. Otherwise,
those files are processed, and dc(1) will then exit.
This is different from the dc(1) on OpenBSD and possibly other dc(1)
implementations, where **-e** (**--expression**) and **-f** (**--file**)
implementations, where **-e** (**-\-expression**) and **-f** (**-\-file**)
arguments cause dc(1) to execute them and exit. The reason for this is that this
dc(1) allows users to set arguments in the environment variable **DC_ENV_ARGS**
(see the **ENVIRONMENT VARIABLES** section). Any expressions given on the
@ -64,21 +64,21 @@ as the last command-line argument or define the environment variable
The following are the options that dc(1) accepts.
**-h**, **--help**
**-h**, **-\-help**
: Prints a usage message and quits.
**-v**, **-V**, **--version**
**-v**, **-V**, **-\-version**
: Print the version information (copyright header) and exit.
**-i**, **--interactive**
**-i**, **-\-interactive**
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
This is a **non-portable extension**.
**-P**, **--no-prompt**
**-P**, **-\-no-prompt**
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
See the **TTY MODE** section) This is mostly for those users that do not
@ -87,14 +87,14 @@ The following are the options that dc(1) accepts.
This is a **non-portable extension**.
**-x** **--extended-register**
**-x** **-\-extended-register**
: Enables extended register mode. See the *Extended Register Mode* subsection
of the **REGISTERS** section for more information.
This is a **non-portable extension**.
**-e** *expr*, **--expression**=*expr*
**-e** *expr*, **-\-expression**=*expr*
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
order. If files are given as well (see below), the expressions and files are
@ -104,14 +104,14 @@ The following are the options that dc(1) accepts.
If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
see the **ENVIRONMENT VARIABLES** section), then after processing all
expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
as an argument at least once to **-f** or **--file**, whether on the
as an argument at least once to **-f** or **-\-file**, whether on the
command-line or in **DC_ENV_ARGS**. However, if any other **-e**,
**--expression**, **-f**, or **--file** arguments are given after **-f-** or
equivalent is given, dc(1) will give a fatal error and exit.
**-\-expression**, **-f**, or **-\-file** arguments are given after **-f-**
or equivalent is given, dc(1) will give a fatal error and exit.
This is a **non-portable extension**.
**-f** *file*, **--file**=*file*
**-f** *file*, **-\-file**=*file*
: Reads in *file* and evaluates it, line by line, as though it were read
through **stdin**. If expressions are also given (see above), the
@ -120,8 +120,8 @@ The following are the options that dc(1) accepts.
If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
see the **ENVIRONMENT VARIABLES** section), then after processing all
expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
as an argument at least once to **-f** or **--file**. However, if any other
**-e**, **--expression**, **-f**, or **--file** arguments are given after
as an argument at least once to **-f** or **-\-file**. However, if any other
**-e**, **-\-expression**, **-f**, or **-\-file** arguments are given after
**-f-** or equivalent is given, dc(1) will give a fatal error and exit.
This is a **non-portable extension**.
@ -749,7 +749,7 @@ follows any command that needs a register name. The only exception is a newline
Unlike most other dc(1) implentations, this dc(1) provides nearly unlimited
amounts of registers, if extended register mode is enabled.
If extended register mode is enabled (**-x** or **--extended-register**
If extended register mode is enabled (**-x** or **-\-extended-register**
command-line arguments are given), then normal single character registers are
used *unless* the character immediately following a command that needs a
register name is a space (according to **isspace()**) and not a newline
@ -951,17 +951,17 @@ The other statuses will only be returned when dc(1) is not in interactive mode
(see the **INTERACTIVE MODE** section), since dc(1) resets its state (see the
**RESET** section) and accepts more input when one of those errors occurs in
interactive mode. This is also the case when interactive mode is forced by the
**-i** flag or **--interactive** option.
**-i** flag or **-\-interactive** option.
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 **-i** flag or
**--interactive** option.
**-\-interactive** option.
# INTERACTIVE MODE
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both **stdin** and **stdout**
are hooked to a terminal, but the **-i** flag and **--interactive** option can
are hooked to a terminal, but the **-i** flag and **-\-interactive** option can
turn it on in other cases.
In interactive mode, dc(1) attempts to recover from errors (see the **RESET**

View File

@ -25,18 +25,17 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
.TH "DC" "1" "February 2021" "Gavin D. Howard" "General Commands Manual"
.TH "DC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
.SH Name
.PP
dc - arbitrary-precision decimal reverse-Polish notation calculator
.SH SYNOPSIS
.PP
\f[B]dc\f[R] [\f[B]-hiPvVx\f[R]] [\f[B]\[en]version\f[R]]
[\f[B]\[en]help\f[R]] [\f[B]\[en]interactive\f[R]]
[\f[B]\[en]no-prompt\f[R]] [\f[B]\[en]extended-register\f[R]]
[\f[B]-e\f[R] \f[I]expr\f[R]]
[\f[B]\[en]expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
\f[I]file\f[R]\&...] [\f[B]-file\f[R]=\f[I]file\f[R]\&...]
\f[B]dc\f[R] [\f[B]-hiPvVx\f[R]] [\f[B]--version\f[R]]
[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--no-prompt\f[R]]
[\f[B]--extended-register\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
[\f[I]file\f[R]\&...]
.SH DESCRIPTION
.PP
@ -47,13 +46,13 @@ Arithmetic operations pop arguments off of the stack and push the
results.
.PP
If no files are given on the command-line as extra arguments (i.e., not
as \f[B]-f\f[R] or \f[B]\[en]file\f[R] arguments), then dc(1) reads from
as \f[B]-f\f[R] or \f[B]--file\f[R] arguments), then dc(1) reads from
\f[B]stdin\f[R].
Otherwise, those files are processed, and dc(1) will then exit.
.PP
This is different from the dc(1) on OpenBSD and possibly other dc(1)
implementations, where \f[B]-e\f[R] (\f[B]\[en]expression\f[R]) and
\f[B]-f\f[R] (\f[B]\[en]file\f[R]) arguments cause dc(1) to execute them
implementations, where \f[B]-e\f[R] (\f[B]--expression\f[R]) and
\f[B]-f\f[R] (\f[B]--file\f[R]) arguments cause dc(1) to execute them
and exit.
The reason for this is that this dc(1) allows users to set arguments in
the environment variable \f[B]DC_ENV_ARGS\f[R] (see the \f[B]ENVIRONMENT
@ -72,13 +71,13 @@ argument or define the environment variable \f[B]DC_EXPR_EXIT\f[R].
.PP
The following are the options that dc(1) accepts.
.TP
\f[B]-h\f[R], \f[B]\[en]help\f[R]
\f[B]-h\f[R], \f[B]--help\f[R]
Prints a usage message and quits.
.TP
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]\[en]version\f[R]
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
Print the version information (copyright header) and exit.
.TP
\f[B]-i\f[R], \f[B]\[en]interactive\f[R]
\f[B]-i\f[R], \f[B]--interactive\f[R]
Forces interactive mode.
(See the \f[B]INTERACTIVE MODE\f[R] section.)
.RS
@ -86,7 +85,7 @@ Forces interactive mode.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-P\f[R], \f[B]\[en]no-prompt\f[R]
\f[B]-P\f[R], \f[B]--no-prompt\f[R]
Disables the prompt in TTY mode.
(The prompt is only enabled in TTY mode.
See the \f[B]TTY MODE\f[R] section) This is mostly for those users that
@ -98,7 +97,7 @@ Most of those users would want to put this option in
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-x\f[R] \f[B]\[en]extended-register\f[R]
\f[B]-x\f[R] \f[B]--extended-register\f[R]
Enables extended register mode.
See the \f[I]Extended Register Mode\f[R] subsection of the
\f[B]REGISTERS\f[R] section for more information.
@ -107,7 +106,7 @@ See the \f[I]Extended Register Mode\f[R] subsection of the
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]\[en]expression\f[R]=\f[I]expr\f[R]
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
Evaluates \f[I]expr\f[R].
If multiple expressions are given, they are evaluated in order.
If files are given as well (see below), the expressions and files are
@ -120,17 +119,17 @@ If this option is given on the command-line (i.e., not in
\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
then after processing all expressions and files, dc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
\f[B]-f\f[R] or \f[B]\[en]file\f[R], whether on the command-line or in
\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
\f[B]DC_ENV_ARGS\f[R].
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
exit.
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-f\f[R] \f[I]file\f[R], \f[B]\[en]file\f[R]=\f[I]file\f[R]
\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
were read through \f[B]stdin\f[R].
If expressions are also given (see above), the expressions are evaluated
@ -141,9 +140,9 @@ If this option is given on the command-line (i.e., not in
\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
then after processing all expressions and files, dc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
\f[B]-f\f[R] or \f[B]\[en]file\f[R].
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
\f[B]-f\f[R] or \f[B]--file\f[R].
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
exit.
.PP
@ -837,7 +836,7 @@ Unlike most other dc(1) implentations, this dc(1) provides nearly
unlimited amounts of registers, if extended register mode is enabled.
.PP
If extended register mode is enabled (\f[B]-x\f[R] or
\f[B]\[en]extended-register\f[R] command-line arguments are given), then
\f[B]--extended-register\f[R] command-line arguments are given), then
normal single character registers are used \f[I]unless\f[R] the
character immediately following a command that needs a register name is
a space (according to \f[B]isspace()\f[R]) and not a newline
@ -1052,17 +1051,17 @@ interactive mode (see the \f[B]INTERACTIVE MODE\f[R] section), since
dc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
more input when one of those errors occurs in interactive mode.
This is also the case when interactive mode is forced by the
\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.PP
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]\[en]interactive\f[R] option.
\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
and \f[B]\[en]interactive\f[R] option can turn it on in other cases.
and \f[B]--interactive\f[R] option can turn it on in other cases.
.PP
In interactive mode, dc(1) attempts to recover from errors (see the
\f[B]RESET\f[R] section), and in normal execution, flushes

View File

@ -34,7 +34,7 @@ dc - arbitrary-precision decimal reverse-Polish notation calculator
# SYNOPSIS
**dc** [**-hiPvVx**] [**--version**] [**--help**] [**--interactive**] [**--no-prompt**] [**--extended-register**] [**-e** *expr*] [**--expression**=*expr*...] [**-f** *file*...] [**-file**=*file*...] [*file*...]
**dc** [**-hiPvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@ -43,11 +43,11 @@ notation) to store numbers and results of computations. Arithmetic operations
pop arguments off of the stack and push the results.
If no files are given on the command-line as extra arguments (i.e., not as
**-f** or **--file** arguments), then dc(1) reads from **stdin**. Otherwise,
**-f** or **-\-file** arguments), then dc(1) reads from **stdin**. Otherwise,
those files are processed, and dc(1) will then exit.
This is different from the dc(1) on OpenBSD and possibly other dc(1)
implementations, where **-e** (**--expression**) and **-f** (**--file**)
implementations, where **-e** (**-\-expression**) and **-f** (**-\-file**)
arguments cause dc(1) to execute them and exit. The reason for this is that this
dc(1) allows users to set arguments in the environment variable **DC_ENV_ARGS**
(see the **ENVIRONMENT VARIABLES** section). Any expressions given on the
@ -64,21 +64,21 @@ as the last command-line argument or define the environment variable
The following are the options that dc(1) accepts.
**-h**, **--help**
**-h**, **-\-help**
: Prints a usage message and quits.
**-v**, **-V**, **--version**
**-v**, **-V**, **-\-version**
: Print the version information (copyright header) and exit.
**-i**, **--interactive**
**-i**, **-\-interactive**
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
This is a **non-portable extension**.
**-P**, **--no-prompt**
**-P**, **-\-no-prompt**
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
See the **TTY MODE** section) This is mostly for those users that do not
@ -87,14 +87,14 @@ The following are the options that dc(1) accepts.
This is a **non-portable extension**.
**-x** **--extended-register**
**-x** **-\-extended-register**
: Enables extended register mode. See the *Extended Register Mode* subsection
of the **REGISTERS** section for more information.
This is a **non-portable extension**.
**-e** *expr*, **--expression**=*expr*
**-e** *expr*, **-\-expression**=*expr*
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
order. If files are given as well (see below), the expressions and files are
@ -104,14 +104,14 @@ The following are the options that dc(1) accepts.
If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
see the **ENVIRONMENT VARIABLES** section), then after processing all
expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
as an argument at least once to **-f** or **--file**, whether on the
as an argument at least once to **-f** or **-\-file**, whether on the
command-line or in **DC_ENV_ARGS**. However, if any other **-e**,
**--expression**, **-f**, or **--file** arguments are given after **-f-** or
equivalent is given, dc(1) will give a fatal error and exit.
**-\-expression**, **-f**, or **-\-file** arguments are given after **-f-**
or equivalent is given, dc(1) will give a fatal error and exit.
This is a **non-portable extension**.
**-f** *file*, **--file**=*file*
**-f** *file*, **-\-file**=*file*
: Reads in *file* and evaluates it, line by line, as though it were read
through **stdin**. If expressions are also given (see above), the
@ -120,8 +120,8 @@ The following are the options that dc(1) accepts.
If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
see the **ENVIRONMENT VARIABLES** section), then after processing all
expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
as an argument at least once to **-f** or **--file**. However, if any other
**-e**, **--expression**, **-f**, or **--file** arguments are given after
as an argument at least once to **-f** or **-\-file**. However, if any other
**-e**, **-\-expression**, **-f**, or **-\-file** arguments are given after
**-f-** or equivalent is given, dc(1) will give a fatal error and exit.
This is a **non-portable extension**.
@ -749,7 +749,7 @@ follows any command that needs a register name. The only exception is a newline
Unlike most other dc(1) implentations, this dc(1) provides nearly unlimited
amounts of registers, if extended register mode is enabled.
If extended register mode is enabled (**-x** or **--extended-register**
If extended register mode is enabled (**-x** or **-\-extended-register**
command-line arguments are given), then normal single character registers are
used *unless* the character immediately following a command that needs a
register name is a space (according to **isspace()**) and not a newline
@ -951,17 +951,17 @@ The other statuses will only be returned when dc(1) is not in interactive mode
(see the **INTERACTIVE MODE** section), since dc(1) resets its state (see the
**RESET** section) and accepts more input when one of those errors occurs in
interactive mode. This is also the case when interactive mode is forced by the
**-i** flag or **--interactive** option.
**-i** flag or **-\-interactive** option.
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 **-i** flag or
**--interactive** option.
**-\-interactive** option.
# INTERACTIVE MODE
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both **stdin** and **stdout**
are hooked to a terminal, but the **-i** flag and **--interactive** option can
are hooked to a terminal, but the **-i** flag and **-\-interactive** option can
turn it on in other cases.
In interactive mode, dc(1) attempts to recover from errors (see the **RESET**

View File

@ -25,18 +25,17 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
.TH "DC" "1" "February 2021" "Gavin D. Howard" "General Commands Manual"
.TH "DC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
.SH Name
.PP
dc - arbitrary-precision decimal reverse-Polish notation calculator
.SH SYNOPSIS
.PP
\f[B]dc\f[R] [\f[B]-hiPvVx\f[R]] [\f[B]\[en]version\f[R]]
[\f[B]\[en]help\f[R]] [\f[B]\[en]interactive\f[R]]
[\f[B]\[en]no-prompt\f[R]] [\f[B]\[en]extended-register\f[R]]
[\f[B]-e\f[R] \f[I]expr\f[R]]
[\f[B]\[en]expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
\f[I]file\f[R]\&...] [\f[B]-file\f[R]=\f[I]file\f[R]\&...]
\f[B]dc\f[R] [\f[B]-hiPvVx\f[R]] [\f[B]--version\f[R]]
[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--no-prompt\f[R]]
[\f[B]--extended-register\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
[\f[I]file\f[R]\&...]
.SH DESCRIPTION
.PP
@ -47,13 +46,13 @@ Arithmetic operations pop arguments off of the stack and push the
results.
.PP
If no files are given on the command-line as extra arguments (i.e., not
as \f[B]-f\f[R] or \f[B]\[en]file\f[R] arguments), then dc(1) reads from
as \f[B]-f\f[R] or \f[B]--file\f[R] arguments), then dc(1) reads from
\f[B]stdin\f[R].
Otherwise, those files are processed, and dc(1) will then exit.
.PP
This is different from the dc(1) on OpenBSD and possibly other dc(1)
implementations, where \f[B]-e\f[R] (\f[B]\[en]expression\f[R]) and
\f[B]-f\f[R] (\f[B]\[en]file\f[R]) arguments cause dc(1) to execute them
implementations, where \f[B]-e\f[R] (\f[B]--expression\f[R]) and
\f[B]-f\f[R] (\f[B]--file\f[R]) arguments cause dc(1) to execute them
and exit.
The reason for this is that this dc(1) allows users to set arguments in
the environment variable \f[B]DC_ENV_ARGS\f[R] (see the \f[B]ENVIRONMENT
@ -72,13 +71,13 @@ argument or define the environment variable \f[B]DC_EXPR_EXIT\f[R].
.PP
The following are the options that dc(1) accepts.
.TP
\f[B]-h\f[R], \f[B]\[en]help\f[R]
\f[B]-h\f[R], \f[B]--help\f[R]
Prints a usage message and quits.
.TP
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]\[en]version\f[R]
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
Print the version information (copyright header) and exit.
.TP
\f[B]-i\f[R], \f[B]\[en]interactive\f[R]
\f[B]-i\f[R], \f[B]--interactive\f[R]
Forces interactive mode.
(See the \f[B]INTERACTIVE MODE\f[R] section.)
.RS
@ -86,14 +85,14 @@ Forces interactive mode.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-P\f[R], \f[B]\[en]no-prompt\f[R]
\f[B]-P\f[R], \f[B]--no-prompt\f[R]
This option is a no-op.
.RS
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-x\f[R] \f[B]\[en]extended-register\f[R]
\f[B]-x\f[R] \f[B]--extended-register\f[R]
Enables extended register mode.
See the \f[I]Extended Register Mode\f[R] subsection of the
\f[B]REGISTERS\f[R] section for more information.
@ -102,7 +101,7 @@ See the \f[I]Extended Register Mode\f[R] subsection of the
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]\[en]expression\f[R]=\f[I]expr\f[R]
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
Evaluates \f[I]expr\f[R].
If multiple expressions are given, they are evaluated in order.
If files are given as well (see below), the expressions and files are
@ -115,17 +114,17 @@ If this option is given on the command-line (i.e., not in
\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
then after processing all expressions and files, dc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
\f[B]-f\f[R] or \f[B]\[en]file\f[R], whether on the command-line or in
\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
\f[B]DC_ENV_ARGS\f[R].
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
exit.
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-f\f[R] \f[I]file\f[R], \f[B]\[en]file\f[R]=\f[I]file\f[R]
\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
were read through \f[B]stdin\f[R].
If expressions are also given (see above), the expressions are evaluated
@ -136,9 +135,9 @@ If this option is given on the command-line (i.e., not in
\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
then after processing all expressions and files, dc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
\f[B]-f\f[R] or \f[B]\[en]file\f[R].
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
\f[B]-f\f[R] or \f[B]--file\f[R].
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
exit.
.PP
@ -832,7 +831,7 @@ Unlike most other dc(1) implentations, this dc(1) provides nearly
unlimited amounts of registers, if extended register mode is enabled.
.PP
If extended register mode is enabled (\f[B]-x\f[R] or
\f[B]\[en]extended-register\f[R] command-line arguments are given), then
\f[B]--extended-register\f[R] command-line arguments are given), then
normal single character registers are used \f[I]unless\f[R] the
character immediately following a command that needs a register name is
a space (according to \f[B]isspace()\f[R]) and not a newline
@ -1047,17 +1046,17 @@ interactive mode (see the \f[B]INTERACTIVE MODE\f[R] section), since
dc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
more input when one of those errors occurs in interactive mode.
This is also the case when interactive mode is forced by the
\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.PP
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]\[en]interactive\f[R] option.
\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
and \f[B]\[en]interactive\f[R] option can turn it on in other cases.
and \f[B]--interactive\f[R] option can turn it on in other cases.
.PP
In interactive mode, dc(1) attempts to recover from errors (see the
\f[B]RESET\f[R] section), and in normal execution, flushes

View File

@ -34,7 +34,7 @@ dc - arbitrary-precision decimal reverse-Polish notation calculator
# SYNOPSIS
**dc** [**-hiPvVx**] [**--version**] [**--help**] [**--interactive**] [**--no-prompt**] [**--extended-register**] [**-e** *expr*] [**--expression**=*expr*...] [**-f** *file*...] [**-file**=*file*...] [*file*...]
**dc** [**-hiPvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@ -43,11 +43,11 @@ notation) to store numbers and results of computations. Arithmetic operations
pop arguments off of the stack and push the results.
If no files are given on the command-line as extra arguments (i.e., not as
**-f** or **--file** arguments), then dc(1) reads from **stdin**. Otherwise,
**-f** or **-\-file** arguments), then dc(1) reads from **stdin**. Otherwise,
those files are processed, and dc(1) will then exit.
This is different from the dc(1) on OpenBSD and possibly other dc(1)
implementations, where **-e** (**--expression**) and **-f** (**--file**)
implementations, where **-e** (**-\-expression**) and **-f** (**-\-file**)
arguments cause dc(1) to execute them and exit. The reason for this is that this
dc(1) allows users to set arguments in the environment variable **DC_ENV_ARGS**
(see the **ENVIRONMENT VARIABLES** section). Any expressions given on the
@ -64,34 +64,34 @@ as the last command-line argument or define the environment variable
The following are the options that dc(1) accepts.
**-h**, **--help**
**-h**, **-\-help**
: Prints a usage message and quits.
**-v**, **-V**, **--version**
**-v**, **-V**, **-\-version**
: Print the version information (copyright header) and exit.
**-i**, **--interactive**
**-i**, **-\-interactive**
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
This is a **non-portable extension**.
**-P**, **--no-prompt**
**-P**, **-\-no-prompt**
: This option is a no-op.
This is a **non-portable extension**.
**-x** **--extended-register**
**-x** **-\-extended-register**
: Enables extended register mode. See the *Extended Register Mode* subsection
of the **REGISTERS** section for more information.
This is a **non-portable extension**.
**-e** *expr*, **--expression**=*expr*
**-e** *expr*, **-\-expression**=*expr*
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
order. If files are given as well (see below), the expressions and files are
@ -101,14 +101,14 @@ The following are the options that dc(1) accepts.
If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
see the **ENVIRONMENT VARIABLES** section), then after processing all
expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
as an argument at least once to **-f** or **--file**, whether on the
as an argument at least once to **-f** or **-\-file**, whether on the
command-line or in **DC_ENV_ARGS**. However, if any other **-e**,
**--expression**, **-f**, or **--file** arguments are given after **-f-** or
equivalent is given, dc(1) will give a fatal error and exit.
**-\-expression**, **-f**, or **-\-file** arguments are given after **-f-**
or equivalent is given, dc(1) will give a fatal error and exit.
This is a **non-portable extension**.
**-f** *file*, **--file**=*file*
**-f** *file*, **-\-file**=*file*
: Reads in *file* and evaluates it, line by line, as though it were read
through **stdin**. If expressions are also given (see above), the
@ -117,8 +117,8 @@ The following are the options that dc(1) accepts.
If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
see the **ENVIRONMENT VARIABLES** section), then after processing all
expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
as an argument at least once to **-f** or **--file**. However, if any other
**-e**, **--expression**, **-f**, or **--file** arguments are given after
as an argument at least once to **-f** or **-\-file**. However, if any other
**-e**, **-\-expression**, **-f**, or **-\-file** arguments are given after
**-f-** or equivalent is given, dc(1) will give a fatal error and exit.
This is a **non-portable extension**.
@ -746,7 +746,7 @@ follows any command that needs a register name. The only exception is a newline
Unlike most other dc(1) implentations, this dc(1) provides nearly unlimited
amounts of registers, if extended register mode is enabled.
If extended register mode is enabled (**-x** or **--extended-register**
If extended register mode is enabled (**-x** or **-\-extended-register**
command-line arguments are given), then normal single character registers are
used *unless* the character immediately following a command that needs a
register name is a space (according to **isspace()**) and not a newline
@ -948,17 +948,17 @@ The other statuses will only be returned when dc(1) is not in interactive mode
(see the **INTERACTIVE MODE** section), since dc(1) resets its state (see the
**RESET** section) and accepts more input when one of those errors occurs in
interactive mode. This is also the case when interactive mode is forced by the
**-i** flag or **--interactive** option.
**-i** flag or **-\-interactive** option.
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 **-i** flag or
**--interactive** option.
**-\-interactive** option.
# INTERACTIVE MODE
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both **stdin** and **stdout**
are hooked to a terminal, but the **-i** flag and **--interactive** option can
are hooked to a terminal, but the **-i** flag and **-\-interactive** option can
turn it on in other cases.
In interactive mode, dc(1) attempts to recover from errors (see the **RESET**

View File

@ -25,18 +25,17 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
.TH "DC" "1" "February 2021" "Gavin D. Howard" "General Commands Manual"
.TH "DC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
.SH Name
.PP
dc - arbitrary-precision decimal reverse-Polish notation calculator
.SH SYNOPSIS
.PP
\f[B]dc\f[R] [\f[B]-hiPvVx\f[R]] [\f[B]\[en]version\f[R]]
[\f[B]\[en]help\f[R]] [\f[B]\[en]interactive\f[R]]
[\f[B]\[en]no-prompt\f[R]] [\f[B]\[en]extended-register\f[R]]
[\f[B]-e\f[R] \f[I]expr\f[R]]
[\f[B]\[en]expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
\f[I]file\f[R]\&...] [\f[B]-file\f[R]=\f[I]file\f[R]\&...]
\f[B]dc\f[R] [\f[B]-hiPvVx\f[R]] [\f[B]--version\f[R]]
[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--no-prompt\f[R]]
[\f[B]--extended-register\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
[\f[I]file\f[R]\&...]
.SH DESCRIPTION
.PP
@ -47,13 +46,13 @@ Arithmetic operations pop arguments off of the stack and push the
results.
.PP
If no files are given on the command-line as extra arguments (i.e., not
as \f[B]-f\f[R] or \f[B]\[en]file\f[R] arguments), then dc(1) reads from
as \f[B]-f\f[R] or \f[B]--file\f[R] arguments), then dc(1) reads from
\f[B]stdin\f[R].
Otherwise, those files are processed, and dc(1) will then exit.
.PP
This is different from the dc(1) on OpenBSD and possibly other dc(1)
implementations, where \f[B]-e\f[R] (\f[B]\[en]expression\f[R]) and
\f[B]-f\f[R] (\f[B]\[en]file\f[R]) arguments cause dc(1) to execute them
implementations, where \f[B]-e\f[R] (\f[B]--expression\f[R]) and
\f[B]-f\f[R] (\f[B]--file\f[R]) arguments cause dc(1) to execute them
and exit.
The reason for this is that this dc(1) allows users to set arguments in
the environment variable \f[B]DC_ENV_ARGS\f[R] (see the \f[B]ENVIRONMENT
@ -72,13 +71,13 @@ argument or define the environment variable \f[B]DC_EXPR_EXIT\f[R].
.PP
The following are the options that dc(1) accepts.
.TP
\f[B]-h\f[R], \f[B]\[en]help\f[R]
\f[B]-h\f[R], \f[B]--help\f[R]
Prints a usage message and quits.
.TP
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]\[en]version\f[R]
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
Print the version information (copyright header) and exit.
.TP
\f[B]-i\f[R], \f[B]\[en]interactive\f[R]
\f[B]-i\f[R], \f[B]--interactive\f[R]
Forces interactive mode.
(See the \f[B]INTERACTIVE MODE\f[R] section.)
.RS
@ -86,14 +85,14 @@ Forces interactive mode.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-P\f[R], \f[B]\[en]no-prompt\f[R]
\f[B]-P\f[R], \f[B]--no-prompt\f[R]
This option is a no-op.
.RS
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-x\f[R] \f[B]\[en]extended-register\f[R]
\f[B]-x\f[R] \f[B]--extended-register\f[R]
Enables extended register mode.
See the \f[I]Extended Register Mode\f[R] subsection of the
\f[B]REGISTERS\f[R] section for more information.
@ -102,7 +101,7 @@ See the \f[I]Extended Register Mode\f[R] subsection of the
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]\[en]expression\f[R]=\f[I]expr\f[R]
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
Evaluates \f[I]expr\f[R].
If multiple expressions are given, they are evaluated in order.
If files are given as well (see below), the expressions and files are
@ -115,17 +114,17 @@ If this option is given on the command-line (i.e., not in
\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
then after processing all expressions and files, dc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
\f[B]-f\f[R] or \f[B]\[en]file\f[R], whether on the command-line or in
\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
\f[B]DC_ENV_ARGS\f[R].
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
exit.
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-f\f[R] \f[I]file\f[R], \f[B]\[en]file\f[R]=\f[I]file\f[R]
\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
were read through \f[B]stdin\f[R].
If expressions are also given (see above), the expressions are evaluated
@ -136,9 +135,9 @@ If this option is given on the command-line (i.e., not in
\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
then after processing all expressions and files, dc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
\f[B]-f\f[R] or \f[B]\[en]file\f[R].
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
\f[B]-f\f[R] or \f[B]--file\f[R].
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
exit.
.PP
@ -832,7 +831,7 @@ Unlike most other dc(1) implentations, this dc(1) provides nearly
unlimited amounts of registers, if extended register mode is enabled.
.PP
If extended register mode is enabled (\f[B]-x\f[R] or
\f[B]\[en]extended-register\f[R] command-line arguments are given), then
\f[B]--extended-register\f[R] command-line arguments are given), then
normal single character registers are used \f[I]unless\f[R] the
character immediately following a command that needs a register name is
a space (according to \f[B]isspace()\f[R]) and not a newline
@ -1047,17 +1046,17 @@ interactive mode (see the \f[B]INTERACTIVE MODE\f[R] section), since
dc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
more input when one of those errors occurs in interactive mode.
This is also the case when interactive mode is forced by the
\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.PP
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]\[en]interactive\f[R] option.
\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
and \f[B]\[en]interactive\f[R] option can turn it on in other cases.
and \f[B]--interactive\f[R] option can turn it on in other cases.
.PP
In interactive mode, dc(1) attempts to recover from errors (see the
\f[B]RESET\f[R] section), and in normal execution, flushes

View File

@ -34,7 +34,7 @@ dc - arbitrary-precision decimal reverse-Polish notation calculator
# SYNOPSIS
**dc** [**-hiPvVx**] [**--version**] [**--help**] [**--interactive**] [**--no-prompt**] [**--extended-register**] [**-e** *expr*] [**--expression**=*expr*...] [**-f** *file*...] [**-file**=*file*...] [*file*...]
**dc** [**-hiPvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@ -43,11 +43,11 @@ notation) to store numbers and results of computations. Arithmetic operations
pop arguments off of the stack and push the results.
If no files are given on the command-line as extra arguments (i.e., not as
**-f** or **--file** arguments), then dc(1) reads from **stdin**. Otherwise,
**-f** or **-\-file** arguments), then dc(1) reads from **stdin**. Otherwise,
those files are processed, and dc(1) will then exit.
This is different from the dc(1) on OpenBSD and possibly other dc(1)
implementations, where **-e** (**--expression**) and **-f** (**--file**)
implementations, where **-e** (**-\-expression**) and **-f** (**-\-file**)
arguments cause dc(1) to execute them and exit. The reason for this is that this
dc(1) allows users to set arguments in the environment variable **DC_ENV_ARGS**
(see the **ENVIRONMENT VARIABLES** section). Any expressions given on the
@ -64,34 +64,34 @@ as the last command-line argument or define the environment variable
The following are the options that dc(1) accepts.
**-h**, **--help**
**-h**, **-\-help**
: Prints a usage message and quits.
**-v**, **-V**, **--version**
**-v**, **-V**, **-\-version**
: Print the version information (copyright header) and exit.
**-i**, **--interactive**
**-i**, **-\-interactive**
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
This is a **non-portable extension**.
**-P**, **--no-prompt**
**-P**, **-\-no-prompt**
: This option is a no-op.
This is a **non-portable extension**.
**-x** **--extended-register**
**-x** **-\-extended-register**
: Enables extended register mode. See the *Extended Register Mode* subsection
of the **REGISTERS** section for more information.
This is a **non-portable extension**.
**-e** *expr*, **--expression**=*expr*
**-e** *expr*, **-\-expression**=*expr*
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
order. If files are given as well (see below), the expressions and files are
@ -101,14 +101,14 @@ The following are the options that dc(1) accepts.
If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
see the **ENVIRONMENT VARIABLES** section), then after processing all
expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
as an argument at least once to **-f** or **--file**, whether on the
as an argument at least once to **-f** or **-\-file**, whether on the
command-line or in **DC_ENV_ARGS**. However, if any other **-e**,
**--expression**, **-f**, or **--file** arguments are given after **-f-** or
equivalent is given, dc(1) will give a fatal error and exit.
**-\-expression**, **-f**, or **-\-file** arguments are given after **-f-**
or equivalent is given, dc(1) will give a fatal error and exit.
This is a **non-portable extension**.
**-f** *file*, **--file**=*file*
**-f** *file*, **-\-file**=*file*
: Reads in *file* and evaluates it, line by line, as though it were read
through **stdin**. If expressions are also given (see above), the
@ -117,8 +117,8 @@ The following are the options that dc(1) accepts.
If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
see the **ENVIRONMENT VARIABLES** section), then after processing all
expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
as an argument at least once to **-f** or **--file**. However, if any other
**-e**, **--expression**, **-f**, or **--file** arguments are given after
as an argument at least once to **-f** or **-\-file**. However, if any other
**-e**, **-\-expression**, **-f**, or **-\-file** arguments are given after
**-f-** or equivalent is given, dc(1) will give a fatal error and exit.
This is a **non-portable extension**.
@ -746,7 +746,7 @@ follows any command that needs a register name. The only exception is a newline
Unlike most other dc(1) implentations, this dc(1) provides nearly unlimited
amounts of registers, if extended register mode is enabled.
If extended register mode is enabled (**-x** or **--extended-register**
If extended register mode is enabled (**-x** or **-\-extended-register**
command-line arguments are given), then normal single character registers are
used *unless* the character immediately following a command that needs a
register name is a space (according to **isspace()**) and not a newline
@ -948,17 +948,17 @@ The other statuses will only be returned when dc(1) is not in interactive mode
(see the **INTERACTIVE MODE** section), since dc(1) resets its state (see the
**RESET** section) and accepts more input when one of those errors occurs in
interactive mode. This is also the case when interactive mode is forced by the
**-i** flag or **--interactive** option.
**-i** flag or **-\-interactive** option.
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 **-i** flag or
**--interactive** option.
**-\-interactive** option.
# INTERACTIVE MODE
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both **stdin** and **stdout**
are hooked to a terminal, but the **-i** flag and **--interactive** option can
are hooked to a terminal, but the **-i** flag and **-\-interactive** option can
turn it on in other cases.
In interactive mode, dc(1) attempts to recover from errors (see the **RESET**

View File

@ -25,18 +25,17 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
.TH "DC" "1" "February 2021" "Gavin D. Howard" "General Commands Manual"
.TH "DC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
.SH Name
.PP
dc - arbitrary-precision decimal reverse-Polish notation calculator
.SH SYNOPSIS
.PP
\f[B]dc\f[R] [\f[B]-hiPvVx\f[R]] [\f[B]\[en]version\f[R]]
[\f[B]\[en]help\f[R]] [\f[B]\[en]interactive\f[R]]
[\f[B]\[en]no-prompt\f[R]] [\f[B]\[en]extended-register\f[R]]
[\f[B]-e\f[R] \f[I]expr\f[R]]
[\f[B]\[en]expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
\f[I]file\f[R]\&...] [\f[B]-file\f[R]=\f[I]file\f[R]\&...]
\f[B]dc\f[R] [\f[B]-hiPvVx\f[R]] [\f[B]--version\f[R]]
[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--no-prompt\f[R]]
[\f[B]--extended-register\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
[\f[I]file\f[R]\&...]
.SH DESCRIPTION
.PP
@ -47,13 +46,13 @@ Arithmetic operations pop arguments off of the stack and push the
results.
.PP
If no files are given on the command-line as extra arguments (i.e., not
as \f[B]-f\f[R] or \f[B]\[en]file\f[R] arguments), then dc(1) reads from
as \f[B]-f\f[R] or \f[B]--file\f[R] arguments), then dc(1) reads from
\f[B]stdin\f[R].
Otherwise, those files are processed, and dc(1) will then exit.
.PP
This is different from the dc(1) on OpenBSD and possibly other dc(1)
implementations, where \f[B]-e\f[R] (\f[B]\[en]expression\f[R]) and
\f[B]-f\f[R] (\f[B]\[en]file\f[R]) arguments cause dc(1) to execute them
implementations, where \f[B]-e\f[R] (\f[B]--expression\f[R]) and
\f[B]-f\f[R] (\f[B]--file\f[R]) arguments cause dc(1) to execute them
and exit.
The reason for this is that this dc(1) allows users to set arguments in
the environment variable \f[B]DC_ENV_ARGS\f[R] (see the \f[B]ENVIRONMENT
@ -72,13 +71,13 @@ argument or define the environment variable \f[B]DC_EXPR_EXIT\f[R].
.PP
The following are the options that dc(1) accepts.
.TP
\f[B]-h\f[R], \f[B]\[en]help\f[R]
\f[B]-h\f[R], \f[B]--help\f[R]
Prints a usage message and quits.
.TP
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]\[en]version\f[R]
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
Print the version information (copyright header) and exit.
.TP
\f[B]-i\f[R], \f[B]\[en]interactive\f[R]
\f[B]-i\f[R], \f[B]--interactive\f[R]
Forces interactive mode.
(See the \f[B]INTERACTIVE MODE\f[R] section.)
.RS
@ -86,7 +85,7 @@ Forces interactive mode.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-P\f[R], \f[B]\[en]no-prompt\f[R]
\f[B]-P\f[R], \f[B]--no-prompt\f[R]
Disables the prompt in TTY mode.
(The prompt is only enabled in TTY mode.
See the \f[B]TTY MODE\f[R] section) This is mostly for those users that
@ -98,7 +97,7 @@ Most of those users would want to put this option in
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-x\f[R] \f[B]\[en]extended-register\f[R]
\f[B]-x\f[R] \f[B]--extended-register\f[R]
Enables extended register mode.
See the \f[I]Extended Register Mode\f[R] subsection of the
\f[B]REGISTERS\f[R] section for more information.
@ -107,7 +106,7 @@ See the \f[I]Extended Register Mode\f[R] subsection of the
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]\[en]expression\f[R]=\f[I]expr\f[R]
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
Evaluates \f[I]expr\f[R].
If multiple expressions are given, they are evaluated in order.
If files are given as well (see below), the expressions and files are
@ -120,17 +119,17 @@ If this option is given on the command-line (i.e., not in
\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
then after processing all expressions and files, dc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
\f[B]-f\f[R] or \f[B]\[en]file\f[R], whether on the command-line or in
\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
\f[B]DC_ENV_ARGS\f[R].
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
exit.
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-f\f[R] \f[I]file\f[R], \f[B]\[en]file\f[R]=\f[I]file\f[R]
\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
were read through \f[B]stdin\f[R].
If expressions are also given (see above), the expressions are evaluated
@ -141,9 +140,9 @@ If this option is given on the command-line (i.e., not in
\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
then after processing all expressions and files, dc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
\f[B]-f\f[R] or \f[B]\[en]file\f[R].
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
\f[B]-f\f[R] or \f[B]--file\f[R].
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
exit.
.PP
@ -837,7 +836,7 @@ Unlike most other dc(1) implentations, this dc(1) provides nearly
unlimited amounts of registers, if extended register mode is enabled.
.PP
If extended register mode is enabled (\f[B]-x\f[R] or
\f[B]\[en]extended-register\f[R] command-line arguments are given), then
\f[B]--extended-register\f[R] command-line arguments are given), then
normal single character registers are used \f[I]unless\f[R] the
character immediately following a command that needs a register name is
a space (according to \f[B]isspace()\f[R]) and not a newline
@ -1052,17 +1051,17 @@ interactive mode (see the \f[B]INTERACTIVE MODE\f[R] section), since
dc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
more input when one of those errors occurs in interactive mode.
This is also the case when interactive mode is forced by the
\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.PP
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]\[en]interactive\f[R] option.
\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
and \f[B]\[en]interactive\f[R] option can turn it on in other cases.
and \f[B]--interactive\f[R] option can turn it on in other cases.
.PP
In interactive mode, dc(1) attempts to recover from errors (see the
\f[B]RESET\f[R] section), and in normal execution, flushes

View File

@ -34,7 +34,7 @@ dc - arbitrary-precision decimal reverse-Polish notation calculator
# SYNOPSIS
**dc** [**-hiPvVx**] [**--version**] [**--help**] [**--interactive**] [**--no-prompt**] [**--extended-register**] [**-e** *expr*] [**--expression**=*expr*...] [**-f** *file*...] [**-file**=*file*...] [*file*...]
**dc** [**-hiPvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@ -43,11 +43,11 @@ notation) to store numbers and results of computations. Arithmetic operations
pop arguments off of the stack and push the results.
If no files are given on the command-line as extra arguments (i.e., not as
**-f** or **--file** arguments), then dc(1) reads from **stdin**. Otherwise,
**-f** or **-\-file** arguments), then dc(1) reads from **stdin**. Otherwise,
those files are processed, and dc(1) will then exit.
This is different from the dc(1) on OpenBSD and possibly other dc(1)
implementations, where **-e** (**--expression**) and **-f** (**--file**)
implementations, where **-e** (**-\-expression**) and **-f** (**-\-file**)
arguments cause dc(1) to execute them and exit. The reason for this is that this
dc(1) allows users to set arguments in the environment variable **DC_ENV_ARGS**
(see the **ENVIRONMENT VARIABLES** section). Any expressions given on the
@ -64,21 +64,21 @@ as the last command-line argument or define the environment variable
The following are the options that dc(1) accepts.
**-h**, **--help**
**-h**, **-\-help**
: Prints a usage message and quits.
**-v**, **-V**, **--version**
**-v**, **-V**, **-\-version**
: Print the version information (copyright header) and exit.
**-i**, **--interactive**
**-i**, **-\-interactive**
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
This is a **non-portable extension**.
**-P**, **--no-prompt**
**-P**, **-\-no-prompt**
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
See the **TTY MODE** section) This is mostly for those users that do not
@ -87,14 +87,14 @@ The following are the options that dc(1) accepts.
This is a **non-portable extension**.
**-x** **--extended-register**
**-x** **-\-extended-register**
: Enables extended register mode. See the *Extended Register Mode* subsection
of the **REGISTERS** section for more information.
This is a **non-portable extension**.
**-e** *expr*, **--expression**=*expr*
**-e** *expr*, **-\-expression**=*expr*
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
order. If files are given as well (see below), the expressions and files are
@ -104,14 +104,14 @@ The following are the options that dc(1) accepts.
If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
see the **ENVIRONMENT VARIABLES** section), then after processing all
expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
as an argument at least once to **-f** or **--file**, whether on the
as an argument at least once to **-f** or **-\-file**, whether on the
command-line or in **DC_ENV_ARGS**. However, if any other **-e**,
**--expression**, **-f**, or **--file** arguments are given after **-f-** or
equivalent is given, dc(1) will give a fatal error and exit.
**-\-expression**, **-f**, or **-\-file** arguments are given after **-f-**
or equivalent is given, dc(1) will give a fatal error and exit.
This is a **non-portable extension**.
**-f** *file*, **--file**=*file*
**-f** *file*, **-\-file**=*file*
: Reads in *file* and evaluates it, line by line, as though it were read
through **stdin**. If expressions are also given (see above), the
@ -120,8 +120,8 @@ The following are the options that dc(1) accepts.
If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
see the **ENVIRONMENT VARIABLES** section), then after processing all
expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
as an argument at least once to **-f** or **--file**. However, if any other
**-e**, **--expression**, **-f**, or **--file** arguments are given after
as an argument at least once to **-f** or **-\-file**. However, if any other
**-e**, **-\-expression**, **-f**, or **-\-file** arguments are given after
**-f-** or equivalent is given, dc(1) will give a fatal error and exit.
This is a **non-portable extension**.
@ -749,7 +749,7 @@ follows any command that needs a register name. The only exception is a newline
Unlike most other dc(1) implentations, this dc(1) provides nearly unlimited
amounts of registers, if extended register mode is enabled.
If extended register mode is enabled (**-x** or **--extended-register**
If extended register mode is enabled (**-x** or **-\-extended-register**
command-line arguments are given), then normal single character registers are
used *unless* the character immediately following a command that needs a
register name is a space (according to **isspace()**) and not a newline
@ -951,17 +951,17 @@ The other statuses will only be returned when dc(1) is not in interactive mode
(see the **INTERACTIVE MODE** section), since dc(1) resets its state (see the
**RESET** section) and accepts more input when one of those errors occurs in
interactive mode. This is also the case when interactive mode is forced by the
**-i** flag or **--interactive** option.
**-i** flag or **-\-interactive** option.
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 **-i** flag or
**--interactive** option.
**-\-interactive** option.
# INTERACTIVE MODE
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both **stdin** and **stdout**
are hooked to a terminal, but the **-i** flag and **--interactive** option can
are hooked to a terminal, but the **-i** flag and **-\-interactive** option can
turn it on in other cases.
In interactive mode, dc(1) attempts to recover from errors (see the **RESET**

View File

@ -25,18 +25,17 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
.TH "DC" "1" "February 2021" "Gavin D. Howard" "General Commands Manual"
.TH "DC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
.SH Name
.PP
dc - arbitrary-precision decimal reverse-Polish notation calculator
.SH SYNOPSIS
.PP
\f[B]dc\f[R] [\f[B]-hiPvVx\f[R]] [\f[B]\[en]version\f[R]]
[\f[B]\[en]help\f[R]] [\f[B]\[en]interactive\f[R]]
[\f[B]\[en]no-prompt\f[R]] [\f[B]\[en]extended-register\f[R]]
[\f[B]-e\f[R] \f[I]expr\f[R]]
[\f[B]\[en]expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
\f[I]file\f[R]\&...] [\f[B]-file\f[R]=\f[I]file\f[R]\&...]
\f[B]dc\f[R] [\f[B]-hiPvVx\f[R]] [\f[B]--version\f[R]]
[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--no-prompt\f[R]]
[\f[B]--extended-register\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
[\f[I]file\f[R]\&...]
.SH DESCRIPTION
.PP
@ -47,13 +46,13 @@ Arithmetic operations pop arguments off of the stack and push the
results.
.PP
If no files are given on the command-line as extra arguments (i.e., not
as \f[B]-f\f[R] or \f[B]\[en]file\f[R] arguments), then dc(1) reads from
as \f[B]-f\f[R] or \f[B]--file\f[R] arguments), then dc(1) reads from
\f[B]stdin\f[R].
Otherwise, those files are processed, and dc(1) will then exit.
.PP
This is different from the dc(1) on OpenBSD and possibly other dc(1)
implementations, where \f[B]-e\f[R] (\f[B]\[en]expression\f[R]) and
\f[B]-f\f[R] (\f[B]\[en]file\f[R]) arguments cause dc(1) to execute them
implementations, where \f[B]-e\f[R] (\f[B]--expression\f[R]) and
\f[B]-f\f[R] (\f[B]--file\f[R]) arguments cause dc(1) to execute them
and exit.
The reason for this is that this dc(1) allows users to set arguments in
the environment variable \f[B]DC_ENV_ARGS\f[R] (see the \f[B]ENVIRONMENT
@ -72,13 +71,13 @@ argument or define the environment variable \f[B]DC_EXPR_EXIT\f[R].
.PP
The following are the options that dc(1) accepts.
.TP
\f[B]-h\f[R], \f[B]\[en]help\f[R]
\f[B]-h\f[R], \f[B]--help\f[R]
Prints a usage message and quits.
.TP
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]\[en]version\f[R]
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
Print the version information (copyright header) and exit.
.TP
\f[B]-i\f[R], \f[B]\[en]interactive\f[R]
\f[B]-i\f[R], \f[B]--interactive\f[R]
Forces interactive mode.
(See the \f[B]INTERACTIVE MODE\f[R] section.)
.RS
@ -86,14 +85,14 @@ Forces interactive mode.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-P\f[R], \f[B]\[en]no-prompt\f[R]
\f[B]-P\f[R], \f[B]--no-prompt\f[R]
This option is a no-op.
.RS
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-x\f[R] \f[B]\[en]extended-register\f[R]
\f[B]-x\f[R] \f[B]--extended-register\f[R]
Enables extended register mode.
See the \f[I]Extended Register Mode\f[R] subsection of the
\f[B]REGISTERS\f[R] section for more information.
@ -102,7 +101,7 @@ See the \f[I]Extended Register Mode\f[R] subsection of the
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]\[en]expression\f[R]=\f[I]expr\f[R]
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
Evaluates \f[I]expr\f[R].
If multiple expressions are given, they are evaluated in order.
If files are given as well (see below), the expressions and files are
@ -115,17 +114,17 @@ If this option is given on the command-line (i.e., not in
\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
then after processing all expressions and files, dc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
\f[B]-f\f[R] or \f[B]\[en]file\f[R], whether on the command-line or in
\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
\f[B]DC_ENV_ARGS\f[R].
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
exit.
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-f\f[R] \f[I]file\f[R], \f[B]\[en]file\f[R]=\f[I]file\f[R]
\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
were read through \f[B]stdin\f[R].
If expressions are also given (see above), the expressions are evaluated
@ -136,9 +135,9 @@ If this option is given on the command-line (i.e., not in
\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
then after processing all expressions and files, dc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
\f[B]-f\f[R] or \f[B]\[en]file\f[R].
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
\f[B]-f\f[R] or \f[B]--file\f[R].
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
exit.
.PP
@ -832,7 +831,7 @@ Unlike most other dc(1) implentations, this dc(1) provides nearly
unlimited amounts of registers, if extended register mode is enabled.
.PP
If extended register mode is enabled (\f[B]-x\f[R] or
\f[B]\[en]extended-register\f[R] command-line arguments are given), then
\f[B]--extended-register\f[R] command-line arguments are given), then
normal single character registers are used \f[I]unless\f[R] the
character immediately following a command that needs a register name is
a space (according to \f[B]isspace()\f[R]) and not a newline
@ -1047,17 +1046,17 @@ interactive mode (see the \f[B]INTERACTIVE MODE\f[R] section), since
dc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
more input when one of those errors occurs in interactive mode.
This is also the case when interactive mode is forced by the
\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.PP
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]\[en]interactive\f[R] option.
\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
and \f[B]\[en]interactive\f[R] option can turn it on in other cases.
and \f[B]--interactive\f[R] option can turn it on in other cases.
.PP
In interactive mode, dc(1) attempts to recover from errors (see the
\f[B]RESET\f[R] section), and in normal execution, flushes

View File

@ -34,7 +34,7 @@ dc - arbitrary-precision decimal reverse-Polish notation calculator
# SYNOPSIS
**dc** [**-hiPvVx**] [**--version**] [**--help**] [**--interactive**] [**--no-prompt**] [**--extended-register**] [**-e** *expr*] [**--expression**=*expr*...] [**-f** *file*...] [**-file**=*file*...] [*file*...]
**dc** [**-hiPvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@ -43,11 +43,11 @@ notation) to store numbers and results of computations. Arithmetic operations
pop arguments off of the stack and push the results.
If no files are given on the command-line as extra arguments (i.e., not as
**-f** or **--file** arguments), then dc(1) reads from **stdin**. Otherwise,
**-f** or **-\-file** arguments), then dc(1) reads from **stdin**. Otherwise,
those files are processed, and dc(1) will then exit.
This is different from the dc(1) on OpenBSD and possibly other dc(1)
implementations, where **-e** (**--expression**) and **-f** (**--file**)
implementations, where **-e** (**-\-expression**) and **-f** (**-\-file**)
arguments cause dc(1) to execute them and exit. The reason for this is that this
dc(1) allows users to set arguments in the environment variable **DC_ENV_ARGS**
(see the **ENVIRONMENT VARIABLES** section). Any expressions given on the
@ -64,34 +64,34 @@ as the last command-line argument or define the environment variable
The following are the options that dc(1) accepts.
**-h**, **--help**
**-h**, **-\-help**
: Prints a usage message and quits.
**-v**, **-V**, **--version**
**-v**, **-V**, **-\-version**
: Print the version information (copyright header) and exit.
**-i**, **--interactive**
**-i**, **-\-interactive**
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
This is a **non-portable extension**.
**-P**, **--no-prompt**
**-P**, **-\-no-prompt**
: This option is a no-op.
This is a **non-portable extension**.
**-x** **--extended-register**
**-x** **-\-extended-register**
: Enables extended register mode. See the *Extended Register Mode* subsection
of the **REGISTERS** section for more information.
This is a **non-portable extension**.
**-e** *expr*, **--expression**=*expr*
**-e** *expr*, **-\-expression**=*expr*
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
order. If files are given as well (see below), the expressions and files are
@ -101,14 +101,14 @@ The following are the options that dc(1) accepts.
If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
see the **ENVIRONMENT VARIABLES** section), then after processing all
expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
as an argument at least once to **-f** or **--file**, whether on the
as an argument at least once to **-f** or **-\-file**, whether on the
command-line or in **DC_ENV_ARGS**. However, if any other **-e**,
**--expression**, **-f**, or **--file** arguments are given after **-f-** or
equivalent is given, dc(1) will give a fatal error and exit.
**-\-expression**, **-f**, or **-\-file** arguments are given after **-f-**
or equivalent is given, dc(1) will give a fatal error and exit.
This is a **non-portable extension**.
**-f** *file*, **--file**=*file*
**-f** *file*, **-\-file**=*file*
: Reads in *file* and evaluates it, line by line, as though it were read
through **stdin**. If expressions are also given (see above), the
@ -117,8 +117,8 @@ The following are the options that dc(1) accepts.
If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
see the **ENVIRONMENT VARIABLES** section), then after processing all
expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
as an argument at least once to **-f** or **--file**. However, if any other
**-e**, **--expression**, **-f**, or **--file** arguments are given after
as an argument at least once to **-f** or **-\-file**. However, if any other
**-e**, **-\-expression**, **-f**, or **-\-file** arguments are given after
**-f-** or equivalent is given, dc(1) will give a fatal error and exit.
This is a **non-portable extension**.
@ -746,7 +746,7 @@ follows any command that needs a register name. The only exception is a newline
Unlike most other dc(1) implentations, this dc(1) provides nearly unlimited
amounts of registers, if extended register mode is enabled.
If extended register mode is enabled (**-x** or **--extended-register**
If extended register mode is enabled (**-x** or **-\-extended-register**
command-line arguments are given), then normal single character registers are
used *unless* the character immediately following a command that needs a
register name is a space (according to **isspace()**) and not a newline
@ -948,17 +948,17 @@ The other statuses will only be returned when dc(1) is not in interactive mode
(see the **INTERACTIVE MODE** section), since dc(1) resets its state (see the
**RESET** section) and accepts more input when one of those errors occurs in
interactive mode. This is also the case when interactive mode is forced by the
**-i** flag or **--interactive** option.
**-i** flag or **-\-interactive** option.
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 **-i** flag or
**--interactive** option.
**-\-interactive** option.
# INTERACTIVE MODE
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both **stdin** and **stdout**
are hooked to a terminal, but the **-i** flag and **--interactive** option can
are hooked to a terminal, but the **-i** flag and **-\-interactive** option can
turn it on in other cases.
In interactive mode, dc(1) attempts to recover from errors (see the **RESET**

View File

@ -25,18 +25,17 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
.TH "DC" "1" "February 2021" "Gavin D. Howard" "General Commands Manual"
.TH "DC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
.SH Name
.PP
dc - arbitrary-precision decimal reverse-Polish notation calculator
.SH SYNOPSIS
.PP
\f[B]dc\f[R] [\f[B]-hiPvVx\f[R]] [\f[B]\[en]version\f[R]]
[\f[B]\[en]help\f[R]] [\f[B]\[en]interactive\f[R]]
[\f[B]\[en]no-prompt\f[R]] [\f[B]\[en]extended-register\f[R]]
[\f[B]-e\f[R] \f[I]expr\f[R]]
[\f[B]\[en]expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
\f[I]file\f[R]\&...] [\f[B]-file\f[R]=\f[I]file\f[R]\&...]
\f[B]dc\f[R] [\f[B]-hiPvVx\f[R]] [\f[B]--version\f[R]]
[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--no-prompt\f[R]]
[\f[B]--extended-register\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
[\f[I]file\f[R]\&...]
.SH DESCRIPTION
.PP
@ -47,13 +46,13 @@ Arithmetic operations pop arguments off of the stack and push the
results.
.PP
If no files are given on the command-line as extra arguments (i.e., not
as \f[B]-f\f[R] or \f[B]\[en]file\f[R] arguments), then dc(1) reads from
as \f[B]-f\f[R] or \f[B]--file\f[R] arguments), then dc(1) reads from
\f[B]stdin\f[R].
Otherwise, those files are processed, and dc(1) will then exit.
.PP
This is different from the dc(1) on OpenBSD and possibly other dc(1)
implementations, where \f[B]-e\f[R] (\f[B]\[en]expression\f[R]) and
\f[B]-f\f[R] (\f[B]\[en]file\f[R]) arguments cause dc(1) to execute them
implementations, where \f[B]-e\f[R] (\f[B]--expression\f[R]) and
\f[B]-f\f[R] (\f[B]--file\f[R]) arguments cause dc(1) to execute them
and exit.
The reason for this is that this dc(1) allows users to set arguments in
the environment variable \f[B]DC_ENV_ARGS\f[R] (see the \f[B]ENVIRONMENT
@ -72,13 +71,13 @@ argument or define the environment variable \f[B]DC_EXPR_EXIT\f[R].
.PP
The following are the options that dc(1) accepts.
.TP
\f[B]-h\f[R], \f[B]\[en]help\f[R]
\f[B]-h\f[R], \f[B]--help\f[R]
Prints a usage message and quits.
.TP
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]\[en]version\f[R]
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
Print the version information (copyright header) and exit.
.TP
\f[B]-i\f[R], \f[B]\[en]interactive\f[R]
\f[B]-i\f[R], \f[B]--interactive\f[R]
Forces interactive mode.
(See the \f[B]INTERACTIVE MODE\f[R] section.)
.RS
@ -86,14 +85,14 @@ Forces interactive mode.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-P\f[R], \f[B]\[en]no-prompt\f[R]
\f[B]-P\f[R], \f[B]--no-prompt\f[R]
This option is a no-op.
.RS
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-x\f[R] \f[B]\[en]extended-register\f[R]
\f[B]-x\f[R] \f[B]--extended-register\f[R]
Enables extended register mode.
See the \f[I]Extended Register Mode\f[R] subsection of the
\f[B]REGISTERS\f[R] section for more information.
@ -102,7 +101,7 @@ See the \f[I]Extended Register Mode\f[R] subsection of the
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]\[en]expression\f[R]=\f[I]expr\f[R]
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
Evaluates \f[I]expr\f[R].
If multiple expressions are given, they are evaluated in order.
If files are given as well (see below), the expressions and files are
@ -115,17 +114,17 @@ If this option is given on the command-line (i.e., not in
\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
then after processing all expressions and files, dc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
\f[B]-f\f[R] or \f[B]\[en]file\f[R], whether on the command-line or in
\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
\f[B]DC_ENV_ARGS\f[R].
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
exit.
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-f\f[R] \f[I]file\f[R], \f[B]\[en]file\f[R]=\f[I]file\f[R]
\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
were read through \f[B]stdin\f[R].
If expressions are also given (see above), the expressions are evaluated
@ -136,9 +135,9 @@ If this option is given on the command-line (i.e., not in
\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
then after processing all expressions and files, dc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
\f[B]-f\f[R] or \f[B]\[en]file\f[R].
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
\f[B]-f\f[R] or \f[B]--file\f[R].
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
exit.
.PP
@ -832,7 +831,7 @@ Unlike most other dc(1) implentations, this dc(1) provides nearly
unlimited amounts of registers, if extended register mode is enabled.
.PP
If extended register mode is enabled (\f[B]-x\f[R] or
\f[B]\[en]extended-register\f[R] command-line arguments are given), then
\f[B]--extended-register\f[R] command-line arguments are given), then
normal single character registers are used \f[I]unless\f[R] the
character immediately following a command that needs a register name is
a space (according to \f[B]isspace()\f[R]) and not a newline
@ -1047,17 +1046,17 @@ interactive mode (see the \f[B]INTERACTIVE MODE\f[R] section), since
dc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
more input when one of those errors occurs in interactive mode.
This is also the case when interactive mode is forced by the
\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.PP
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]\[en]interactive\f[R] option.
\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
and \f[B]\[en]interactive\f[R] option can turn it on in other cases.
and \f[B]--interactive\f[R] option can turn it on in other cases.
.PP
In interactive mode, dc(1) attempts to recover from errors (see the
\f[B]RESET\f[R] section), and in normal execution, flushes

View File

@ -34,7 +34,7 @@ dc - arbitrary-precision decimal reverse-Polish notation calculator
# SYNOPSIS
**dc** [**-hiPvVx**] [**--version**] [**--help**] [**--interactive**] [**--no-prompt**] [**--extended-register**] [**-e** *expr*] [**--expression**=*expr*...] [**-f** *file*...] [**-file**=*file*...] [*file*...]
**dc** [**-hiPvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@ -43,11 +43,11 @@ notation) to store numbers and results of computations. Arithmetic operations
pop arguments off of the stack and push the results.
If no files are given on the command-line as extra arguments (i.e., not as
**-f** or **--file** arguments), then dc(1) reads from **stdin**. Otherwise,
**-f** or **-\-file** arguments), then dc(1) reads from **stdin**. Otherwise,
those files are processed, and dc(1) will then exit.
This is different from the dc(1) on OpenBSD and possibly other dc(1)
implementations, where **-e** (**--expression**) and **-f** (**--file**)
implementations, where **-e** (**-\-expression**) and **-f** (**-\-file**)
arguments cause dc(1) to execute them and exit. The reason for this is that this
dc(1) allows users to set arguments in the environment variable **DC_ENV_ARGS**
(see the **ENVIRONMENT VARIABLES** section). Any expressions given on the
@ -64,34 +64,34 @@ as the last command-line argument or define the environment variable
The following are the options that dc(1) accepts.
**-h**, **--help**
**-h**, **-\-help**
: Prints a usage message and quits.
**-v**, **-V**, **--version**
**-v**, **-V**, **-\-version**
: Print the version information (copyright header) and exit.
**-i**, **--interactive**
**-i**, **-\-interactive**
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
This is a **non-portable extension**.
**-P**, **--no-prompt**
**-P**, **-\-no-prompt**
: This option is a no-op.
This is a **non-portable extension**.
**-x** **--extended-register**
**-x** **-\-extended-register**
: Enables extended register mode. See the *Extended Register Mode* subsection
of the **REGISTERS** section for more information.
This is a **non-portable extension**.
**-e** *expr*, **--expression**=*expr*
**-e** *expr*, **-\-expression**=*expr*
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
order. If files are given as well (see below), the expressions and files are
@ -101,14 +101,14 @@ The following are the options that dc(1) accepts.
If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
see the **ENVIRONMENT VARIABLES** section), then after processing all
expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
as an argument at least once to **-f** or **--file**, whether on the
as an argument at least once to **-f** or **-\-file**, whether on the
command-line or in **DC_ENV_ARGS**. However, if any other **-e**,
**--expression**, **-f**, or **--file** arguments are given after **-f-** or
equivalent is given, dc(1) will give a fatal error and exit.
**-\-expression**, **-f**, or **-\-file** arguments are given after **-f-**
or equivalent is given, dc(1) will give a fatal error and exit.
This is a **non-portable extension**.
**-f** *file*, **--file**=*file*
**-f** *file*, **-\-file**=*file*
: Reads in *file* and evaluates it, line by line, as though it were read
through **stdin**. If expressions are also given (see above), the
@ -117,8 +117,8 @@ The following are the options that dc(1) accepts.
If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
see the **ENVIRONMENT VARIABLES** section), then after processing all
expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
as an argument at least once to **-f** or **--file**. However, if any other
**-e**, **--expression**, **-f**, or **--file** arguments are given after
as an argument at least once to **-f** or **-\-file**. However, if any other
**-e**, **-\-expression**, **-f**, or **-\-file** arguments are given after
**-f-** or equivalent is given, dc(1) will give a fatal error and exit.
This is a **non-portable extension**.
@ -746,7 +746,7 @@ follows any command that needs a register name. The only exception is a newline
Unlike most other dc(1) implentations, this dc(1) provides nearly unlimited
amounts of registers, if extended register mode is enabled.
If extended register mode is enabled (**-x** or **--extended-register**
If extended register mode is enabled (**-x** or **-\-extended-register**
command-line arguments are given), then normal single character registers are
used *unless* the character immediately following a command that needs a
register name is a space (according to **isspace()**) and not a newline
@ -948,17 +948,17 @@ The other statuses will only be returned when dc(1) is not in interactive mode
(see the **INTERACTIVE MODE** section), since dc(1) resets its state (see the
**RESET** section) and accepts more input when one of those errors occurs in
interactive mode. This is also the case when interactive mode is forced by the
**-i** flag or **--interactive** option.
**-i** flag or **-\-interactive** option.
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 **-i** flag or
**--interactive** option.
**-\-interactive** option.
# INTERACTIVE MODE
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both **stdin** and **stdout**
are hooked to a terminal, but the **-i** flag and **--interactive** option can
are hooked to a terminal, but the **-i** flag and **-\-interactive** option can
turn it on in other cases.
In interactive mode, dc(1) attempts to recover from errors (see the **RESET**

View File

@ -25,18 +25,17 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
.TH "DC" "1" "February 2021" "Gavin D. Howard" "General Commands Manual"
.TH "DC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
.SH Name
.PP
dc - arbitrary-precision decimal reverse-Polish notation calculator
.SH SYNOPSIS
.PP
\f[B]dc\f[R] [\f[B]-hiPvVx\f[R]] [\f[B]\[en]version\f[R]]
[\f[B]\[en]help\f[R]] [\f[B]\[en]interactive\f[R]]
[\f[B]\[en]no-prompt\f[R]] [\f[B]\[en]extended-register\f[R]]
[\f[B]-e\f[R] \f[I]expr\f[R]]
[\f[B]\[en]expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
\f[I]file\f[R]\&...] [\f[B]-file\f[R]=\f[I]file\f[R]\&...]
\f[B]dc\f[R] [\f[B]-hiPvVx\f[R]] [\f[B]--version\f[R]]
[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--no-prompt\f[R]]
[\f[B]--extended-register\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
[\f[I]file\f[R]\&...]
.SH DESCRIPTION
.PP
@ -47,13 +46,13 @@ Arithmetic operations pop arguments off of the stack and push the
results.
.PP
If no files are given on the command-line as extra arguments (i.e., not
as \f[B]-f\f[R] or \f[B]\[en]file\f[R] arguments), then dc(1) reads from
as \f[B]-f\f[R] or \f[B]--file\f[R] arguments), then dc(1) reads from
\f[B]stdin\f[R].
Otherwise, those files are processed, and dc(1) will then exit.
.PP
This is different from the dc(1) on OpenBSD and possibly other dc(1)
implementations, where \f[B]-e\f[R] (\f[B]\[en]expression\f[R]) and
\f[B]-f\f[R] (\f[B]\[en]file\f[R]) arguments cause dc(1) to execute them
implementations, where \f[B]-e\f[R] (\f[B]--expression\f[R]) and
\f[B]-f\f[R] (\f[B]--file\f[R]) arguments cause dc(1) to execute them
and exit.
The reason for this is that this dc(1) allows users to set arguments in
the environment variable \f[B]DC_ENV_ARGS\f[R] (see the \f[B]ENVIRONMENT
@ -72,13 +71,13 @@ argument or define the environment variable \f[B]DC_EXPR_EXIT\f[R].
.PP
The following are the options that dc(1) accepts.
.TP
\f[B]-h\f[R], \f[B]\[en]help\f[R]
\f[B]-h\f[R], \f[B]--help\f[R]
Prints a usage message and quits.
.TP
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]\[en]version\f[R]
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
Print the version information (copyright header) and exit.
.TP
\f[B]-i\f[R], \f[B]\[en]interactive\f[R]
\f[B]-i\f[R], \f[B]--interactive\f[R]
Forces interactive mode.
(See the \f[B]INTERACTIVE MODE\f[R] section.)
.RS
@ -86,7 +85,7 @@ Forces interactive mode.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-P\f[R], \f[B]\[en]no-prompt\f[R]
\f[B]-P\f[R], \f[B]--no-prompt\f[R]
Disables the prompt in TTY mode.
(The prompt is only enabled in TTY mode.
See the \f[B]TTY MODE\f[R] section) This is mostly for those users that
@ -98,7 +97,7 @@ Most of those users would want to put this option in
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-x\f[R] \f[B]\[en]extended-register\f[R]
\f[B]-x\f[R] \f[B]--extended-register\f[R]
Enables extended register mode.
See the \f[I]Extended Register Mode\f[R] subsection of the
\f[B]REGISTERS\f[R] section for more information.
@ -107,7 +106,7 @@ See the \f[I]Extended Register Mode\f[R] subsection of the
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]\[en]expression\f[R]=\f[I]expr\f[R]
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
Evaluates \f[I]expr\f[R].
If multiple expressions are given, they are evaluated in order.
If files are given as well (see below), the expressions and files are
@ -120,17 +119,17 @@ If this option is given on the command-line (i.e., not in
\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
then after processing all expressions and files, dc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
\f[B]-f\f[R] or \f[B]\[en]file\f[R], whether on the command-line or in
\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
\f[B]DC_ENV_ARGS\f[R].
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
exit.
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-f\f[R] \f[I]file\f[R], \f[B]\[en]file\f[R]=\f[I]file\f[R]
\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
were read through \f[B]stdin\f[R].
If expressions are also given (see above), the expressions are evaluated
@ -141,9 +140,9 @@ If this option is given on the command-line (i.e., not in
\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
then after processing all expressions and files, dc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
\f[B]-f\f[R] or \f[B]\[en]file\f[R].
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
\f[B]-f\f[R] or \f[B]--file\f[R].
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
exit.
.PP
@ -1037,7 +1036,7 @@ Unlike most other dc(1) implentations, this dc(1) provides nearly
unlimited amounts of registers, if extended register mode is enabled.
.PP
If extended register mode is enabled (\f[B]-x\f[R] or
\f[B]\[en]extended-register\f[R] command-line arguments are given), then
\f[B]--extended-register\f[R] command-line arguments are given), then
normal single character registers are used \f[I]unless\f[R] the
character immediately following a command that needs a register name is
a space (according to \f[B]isspace()\f[R]) and not a newline
@ -1260,17 +1259,17 @@ interactive mode (see the \f[B]INTERACTIVE MODE\f[R] section), since
dc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
more input when one of those errors occurs in interactive mode.
This is also the case when interactive mode is forced by the
\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.PP
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]\[en]interactive\f[R] option.
\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
and \f[B]\[en]interactive\f[R] option can turn it on in other cases.
and \f[B]--interactive\f[R] option can turn it on in other cases.
.PP
In interactive mode, dc(1) attempts to recover from errors (see the
\f[B]RESET\f[R] section), and in normal execution, flushes

View File

@ -34,7 +34,7 @@ dc - arbitrary-precision decimal reverse-Polish notation calculator
# SYNOPSIS
**dc** [**-hiPvVx**] [**--version**] [**--help**] [**--interactive**] [**--no-prompt**] [**--extended-register**] [**-e** *expr*] [**--expression**=*expr*...] [**-f** *file*...] [**-file**=*file*...] [*file*...]
**dc** [**-hiPvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@ -43,11 +43,11 @@ notation) to store numbers and results of computations. Arithmetic operations
pop arguments off of the stack and push the results.
If no files are given on the command-line as extra arguments (i.e., not as
**-f** or **--file** arguments), then dc(1) reads from **stdin**. Otherwise,
**-f** or **-\-file** arguments), then dc(1) reads from **stdin**. Otherwise,
those files are processed, and dc(1) will then exit.
This is different from the dc(1) on OpenBSD and possibly other dc(1)
implementations, where **-e** (**--expression**) and **-f** (**--file**)
implementations, where **-e** (**-\-expression**) and **-f** (**-\-file**)
arguments cause dc(1) to execute them and exit. The reason for this is that this
dc(1) allows users to set arguments in the environment variable **DC_ENV_ARGS**
(see the **ENVIRONMENT VARIABLES** section). Any expressions given on the
@ -64,21 +64,21 @@ as the last command-line argument or define the environment variable
The following are the options that dc(1) accepts.
**-h**, **--help**
**-h**, **-\-help**
: Prints a usage message and quits.
**-v**, **-V**, **--version**
**-v**, **-V**, **-\-version**
: Print the version information (copyright header) and exit.
**-i**, **--interactive**
**-i**, **-\-interactive**
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
This is a **non-portable extension**.
**-P**, **--no-prompt**
**-P**, **-\-no-prompt**
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
See the **TTY MODE** section) This is mostly for those users that do not
@ -87,14 +87,14 @@ The following are the options that dc(1) accepts.
This is a **non-portable extension**.
**-x** **--extended-register**
**-x** **-\-extended-register**
: Enables extended register mode. See the *Extended Register Mode* subsection
of the **REGISTERS** section for more information.
This is a **non-portable extension**.
**-e** *expr*, **--expression**=*expr*
**-e** *expr*, **-\-expression**=*expr*
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
order. If files are given as well (see below), the expressions and files are
@ -104,14 +104,14 @@ The following are the options that dc(1) accepts.
If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
see the **ENVIRONMENT VARIABLES** section), then after processing all
expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
as an argument at least once to **-f** or **--file**, whether on the
as an argument at least once to **-f** or **-\-file**, whether on the
command-line or in **DC_ENV_ARGS**. However, if any other **-e**,
**--expression**, **-f**, or **--file** arguments are given after **-f-** or
equivalent is given, dc(1) will give a fatal error and exit.
**-\-expression**, **-f**, or **-\-file** arguments are given after **-f-**
or equivalent is given, dc(1) will give a fatal error and exit.
This is a **non-portable extension**.
**-f** *file*, **--file**=*file*
**-f** *file*, **-\-file**=*file*
: Reads in *file* and evaluates it, line by line, as though it were read
through **stdin**. If expressions are also given (see above), the
@ -120,8 +120,8 @@ The following are the options that dc(1) accepts.
If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
see the **ENVIRONMENT VARIABLES** section), then after processing all
expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
as an argument at least once to **-f** or **--file**. However, if any other
**-e**, **--expression**, **-f**, or **--file** arguments are given after
as an argument at least once to **-f** or **-\-file**. However, if any other
**-e**, **-\-expression**, **-f**, or **-\-file** arguments are given after
**-f-** or equivalent is given, dc(1) will give a fatal error and exit.
This is a **non-portable extension**.
@ -909,7 +909,7 @@ follows any command that needs a register name. The only exception is a newline
Unlike most other dc(1) implentations, this dc(1) provides nearly unlimited
amounts of registers, if extended register mode is enabled.
If extended register mode is enabled (**-x** or **--extended-register**
If extended register mode is enabled (**-x** or **-\-extended-register**
command-line arguments are given), then normal single character registers are
used *unless* the character immediately following a command that needs a
register name is a space (according to **isspace()**) and not a newline
@ -1118,17 +1118,17 @@ The other statuses will only be returned when dc(1) is not in interactive mode
(see the **INTERACTIVE MODE** section), since dc(1) resets its state (see the
**RESET** section) and accepts more input when one of those errors occurs in
interactive mode. This is also the case when interactive mode is forced by the
**-i** flag or **--interactive** option.
**-i** flag or **-\-interactive** option.
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 **-i** flag or
**--interactive** option.
**-\-interactive** option.
# INTERACTIVE MODE
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both **stdin** and **stdout**
are hooked to a terminal, but the **-i** flag and **--interactive** option can
are hooked to a terminal, but the **-i** flag and **-\-interactive** option can
turn it on in other cases.
In interactive mode, dc(1) attempts to recover from errors (see the **RESET**

View File

@ -25,18 +25,17 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
.TH "DC" "1" "February 2021" "Gavin D. Howard" "General Commands Manual"
.TH "DC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
.SH Name
.PP
dc - arbitrary-precision decimal reverse-Polish notation calculator
.SH SYNOPSIS
.PP
\f[B]dc\f[R] [\f[B]-hiPvVx\f[R]] [\f[B]\[en]version\f[R]]
[\f[B]\[en]help\f[R]] [\f[B]\[en]interactive\f[R]]
[\f[B]\[en]no-prompt\f[R]] [\f[B]\[en]extended-register\f[R]]
[\f[B]-e\f[R] \f[I]expr\f[R]]
[\f[B]\[en]expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
\f[I]file\f[R]\&...] [\f[B]-file\f[R]=\f[I]file\f[R]\&...]
\f[B]dc\f[R] [\f[B]-hiPvVx\f[R]] [\f[B]--version\f[R]]
[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--no-prompt\f[R]]
[\f[B]--extended-register\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
[\f[I]file\f[R]\&...]
.SH DESCRIPTION
.PP
@ -47,13 +46,13 @@ Arithmetic operations pop arguments off of the stack and push the
results.
.PP
If no files are given on the command-line as extra arguments (i.e., not
as \f[B]-f\f[R] or \f[B]\[en]file\f[R] arguments), then dc(1) reads from
as \f[B]-f\f[R] or \f[B]--file\f[R] arguments), then dc(1) reads from
\f[B]stdin\f[R].
Otherwise, those files are processed, and dc(1) will then exit.
.PP
This is different from the dc(1) on OpenBSD and possibly other dc(1)
implementations, where \f[B]-e\f[R] (\f[B]\[en]expression\f[R]) and
\f[B]-f\f[R] (\f[B]\[en]file\f[R]) arguments cause dc(1) to execute them
implementations, where \f[B]-e\f[R] (\f[B]--expression\f[R]) and
\f[B]-f\f[R] (\f[B]--file\f[R]) arguments cause dc(1) to execute them
and exit.
The reason for this is that this dc(1) allows users to set arguments in
the environment variable \f[B]DC_ENV_ARGS\f[R] (see the \f[B]ENVIRONMENT
@ -72,13 +71,13 @@ argument or define the environment variable \f[B]DC_EXPR_EXIT\f[R].
.PP
The following are the options that dc(1) accepts.
.TP
\f[B]-h\f[R], \f[B]\[en]help\f[R]
\f[B]-h\f[R], \f[B]--help\f[R]
Prints a usage message and quits.
.TP
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]\[en]version\f[R]
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
Print the version information (copyright header) and exit.
.TP
\f[B]-i\f[R], \f[B]\[en]interactive\f[R]
\f[B]-i\f[R], \f[B]--interactive\f[R]
Forces interactive mode.
(See the \f[B]INTERACTIVE MODE\f[R] section.)
.RS
@ -86,7 +85,7 @@ Forces interactive mode.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-P\f[R], \f[B]\[en]no-prompt\f[R]
\f[B]-P\f[R], \f[B]--no-prompt\f[R]
Disables the prompt in TTY mode.
(The prompt is only enabled in TTY mode.
See the \f[B]TTY MODE\f[R] section) This is mostly for those users that
@ -98,7 +97,7 @@ Most of those users would want to put this option in
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-x\f[R] \f[B]\[en]extended-register\f[R]
\f[B]-x\f[R] \f[B]--extended-register\f[R]
Enables extended register mode.
See the \f[I]Extended Register Mode\f[R] subsection of the
\f[B]REGISTERS\f[R] section for more information.
@ -107,7 +106,7 @@ See the \f[I]Extended Register Mode\f[R] subsection of the
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]\[en]expression\f[R]=\f[I]expr\f[R]
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
Evaluates \f[I]expr\f[R].
If multiple expressions are given, they are evaluated in order.
If files are given as well (see below), the expressions and files are
@ -120,17 +119,17 @@ If this option is given on the command-line (i.e., not in
\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
then after processing all expressions and files, dc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
\f[B]-f\f[R] or \f[B]\[en]file\f[R], whether on the command-line or in
\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
\f[B]DC_ENV_ARGS\f[R].
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
exit.
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-f\f[R] \f[I]file\f[R], \f[B]\[en]file\f[R]=\f[I]file\f[R]
\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
were read through \f[B]stdin\f[R].
If expressions are also given (see above), the expressions are evaluated
@ -141,9 +140,9 @@ If this option is given on the command-line (i.e., not in
\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
then after processing all expressions and files, dc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
\f[B]-f\f[R] or \f[B]\[en]file\f[R].
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
\f[B]-f\f[R] or \f[B]--file\f[R].
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
exit.
.PP
@ -1037,7 +1036,7 @@ Unlike most other dc(1) implentations, this dc(1) provides nearly
unlimited amounts of registers, if extended register mode is enabled.
.PP
If extended register mode is enabled (\f[B]-x\f[R] or
\f[B]\[en]extended-register\f[R] command-line arguments are given), then
\f[B]--extended-register\f[R] command-line arguments are given), then
normal single character registers are used \f[I]unless\f[R] the
character immediately following a command that needs a register name is
a space (according to \f[B]isspace()\f[R]) and not a newline
@ -1260,17 +1259,17 @@ interactive mode (see the \f[B]INTERACTIVE MODE\f[R] section), since
dc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
more input when one of those errors occurs in interactive mode.
This is also the case when interactive mode is forced by the
\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.PP
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]\[en]interactive\f[R] option.
\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
and \f[B]\[en]interactive\f[R] option can turn it on in other cases.
and \f[B]--interactive\f[R] option can turn it on in other cases.
.PP
In interactive mode, dc(1) attempts to recover from errors (see the
\f[B]RESET\f[R] section), and in normal execution, flushes

View File

@ -34,7 +34,7 @@ dc - arbitrary-precision decimal reverse-Polish notation calculator
# SYNOPSIS
**dc** [**-hiPvVx**] [**--version**] [**--help**] [**--interactive**] [**--no-prompt**] [**--extended-register**] [**-e** *expr*] [**--expression**=*expr*...] [**-f** *file*...] [**-file**=*file*...] [*file*...]
**dc** [**-hiPvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@ -43,11 +43,11 @@ notation) to store numbers and results of computations. Arithmetic operations
pop arguments off of the stack and push the results.
If no files are given on the command-line as extra arguments (i.e., not as
**-f** or **--file** arguments), then dc(1) reads from **stdin**. Otherwise,
**-f** or **-\-file** arguments), then dc(1) reads from **stdin**. Otherwise,
those files are processed, and dc(1) will then exit.
This is different from the dc(1) on OpenBSD and possibly other dc(1)
implementations, where **-e** (**--expression**) and **-f** (**--file**)
implementations, where **-e** (**-\-expression**) and **-f** (**-\-file**)
arguments cause dc(1) to execute them and exit. The reason for this is that this
dc(1) allows users to set arguments in the environment variable **DC_ENV_ARGS**
(see the **ENVIRONMENT VARIABLES** section). Any expressions given on the
@ -64,21 +64,21 @@ as the last command-line argument or define the environment variable
The following are the options that dc(1) accepts.
**-h**, **--help**
**-h**, **-\-help**
: Prints a usage message and quits.
**-v**, **-V**, **--version**
**-v**, **-V**, **-\-version**
: Print the version information (copyright header) and exit.
**-i**, **--interactive**
**-i**, **-\-interactive**
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
This is a **non-portable extension**.
**-P**, **--no-prompt**
**-P**, **-\-no-prompt**
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
See the **TTY MODE** section) This is mostly for those users that do not
@ -87,14 +87,14 @@ The following are the options that dc(1) accepts.
This is a **non-portable extension**.
**-x** **--extended-register**
**-x** **-\-extended-register**
: Enables extended register mode. See the *Extended Register Mode* subsection
of the **REGISTERS** section for more information.
This is a **non-portable extension**.
**-e** *expr*, **--expression**=*expr*
**-e** *expr*, **-\-expression**=*expr*
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
order. If files are given as well (see below), the expressions and files are
@ -104,14 +104,14 @@ The following are the options that dc(1) accepts.
If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
see the **ENVIRONMENT VARIABLES** section), then after processing all
expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
as an argument at least once to **-f** or **--file**, whether on the
as an argument at least once to **-f** or **-\-file**, whether on the
command-line or in **DC_ENV_ARGS**. However, if any other **-e**,
**--expression**, **-f**, or **--file** arguments are given after **-f-** or
equivalent is given, dc(1) will give a fatal error and exit.
**-\-expression**, **-f**, or **-\-file** arguments are given after **-f-**
or equivalent is given, dc(1) will give a fatal error and exit.
This is a **non-portable extension**.
**-f** *file*, **--file**=*file*
**-f** *file*, **-\-file**=*file*
: Reads in *file* and evaluates it, line by line, as though it were read
through **stdin**. If expressions are also given (see above), the
@ -120,8 +120,8 @@ The following are the options that dc(1) accepts.
If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
see the **ENVIRONMENT VARIABLES** section), then after processing all
expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
as an argument at least once to **-f** or **--file**. However, if any other
**-e**, **--expression**, **-f**, or **--file** arguments are given after
as an argument at least once to **-f** or **-\-file**. However, if any other
**-e**, **-\-expression**, **-f**, or **-\-file** arguments are given after
**-f-** or equivalent is given, dc(1) will give a fatal error and exit.
This is a **non-portable extension**.
@ -909,7 +909,7 @@ follows any command that needs a register name. The only exception is a newline
Unlike most other dc(1) implentations, this dc(1) provides nearly unlimited
amounts of registers, if extended register mode is enabled.
If extended register mode is enabled (**-x** or **--extended-register**
If extended register mode is enabled (**-x** or **-\-extended-register**
command-line arguments are given), then normal single character registers are
used *unless* the character immediately following a command that needs a
register name is a space (according to **isspace()**) and not a newline
@ -1118,17 +1118,17 @@ The other statuses will only be returned when dc(1) is not in interactive mode
(see the **INTERACTIVE MODE** section), since dc(1) resets its state (see the
**RESET** section) and accepts more input when one of those errors occurs in
interactive mode. This is also the case when interactive mode is forced by the
**-i** flag or **--interactive** option.
**-i** flag or **-\-interactive** option.
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 **-i** flag or
**--interactive** option.
**-\-interactive** option.
# INTERACTIVE MODE
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both **stdin** and **stdout**
are hooked to a terminal, but the **-i** flag and **--interactive** option can
are hooked to a terminal, but the **-i** flag and **-\-interactive** option can
turn it on in other cases.
In interactive mode, dc(1) attempts to recover from errors (see the **RESET**

View File

@ -25,18 +25,17 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
.TH "DC" "1" "February 2021" "Gavin D. Howard" "General Commands Manual"
.TH "DC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
.SH Name
.PP
dc - arbitrary-precision decimal reverse-Polish notation calculator
.SH SYNOPSIS
.PP
\f[B]dc\f[R] [\f[B]-hiPvVx\f[R]] [\f[B]\[en]version\f[R]]
[\f[B]\[en]help\f[R]] [\f[B]\[en]interactive\f[R]]
[\f[B]\[en]no-prompt\f[R]] [\f[B]\[en]extended-register\f[R]]
[\f[B]-e\f[R] \f[I]expr\f[R]]
[\f[B]\[en]expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
\f[I]file\f[R]\&...] [\f[B]-file\f[R]=\f[I]file\f[R]\&...]
\f[B]dc\f[R] [\f[B]-hiPvVx\f[R]] [\f[B]--version\f[R]]
[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--no-prompt\f[R]]
[\f[B]--extended-register\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
[\f[I]file\f[R]\&...]
.SH DESCRIPTION
.PP
@ -47,13 +46,13 @@ Arithmetic operations pop arguments off of the stack and push the
results.
.PP
If no files are given on the command-line as extra arguments (i.e., not
as \f[B]-f\f[R] or \f[B]\[en]file\f[R] arguments), then dc(1) reads from
as \f[B]-f\f[R] or \f[B]--file\f[R] arguments), then dc(1) reads from
\f[B]stdin\f[R].
Otherwise, those files are processed, and dc(1) will then exit.
.PP
This is different from the dc(1) on OpenBSD and possibly other dc(1)
implementations, where \f[B]-e\f[R] (\f[B]\[en]expression\f[R]) and
\f[B]-f\f[R] (\f[B]\[en]file\f[R]) arguments cause dc(1) to execute them
implementations, where \f[B]-e\f[R] (\f[B]--expression\f[R]) and
\f[B]-f\f[R] (\f[B]--file\f[R]) arguments cause dc(1) to execute them
and exit.
The reason for this is that this dc(1) allows users to set arguments in
the environment variable \f[B]DC_ENV_ARGS\f[R] (see the \f[B]ENVIRONMENT
@ -72,13 +71,13 @@ argument or define the environment variable \f[B]DC_EXPR_EXIT\f[R].
.PP
The following are the options that dc(1) accepts.
.TP
\f[B]-h\f[R], \f[B]\[en]help\f[R]
\f[B]-h\f[R], \f[B]--help\f[R]
Prints a usage message and quits.
.TP
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]\[en]version\f[R]
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
Print the version information (copyright header) and exit.
.TP
\f[B]-i\f[R], \f[B]\[en]interactive\f[R]
\f[B]-i\f[R], \f[B]--interactive\f[R]
Forces interactive mode.
(See the \f[B]INTERACTIVE MODE\f[R] section.)
.RS
@ -86,14 +85,14 @@ Forces interactive mode.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-P\f[R], \f[B]\[en]no-prompt\f[R]
\f[B]-P\f[R], \f[B]--no-prompt\f[R]
This option is a no-op.
.RS
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-x\f[R] \f[B]\[en]extended-register\f[R]
\f[B]-x\f[R] \f[B]--extended-register\f[R]
Enables extended register mode.
See the \f[I]Extended Register Mode\f[R] subsection of the
\f[B]REGISTERS\f[R] section for more information.
@ -102,7 +101,7 @@ See the \f[I]Extended Register Mode\f[R] subsection of the
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]\[en]expression\f[R]=\f[I]expr\f[R]
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
Evaluates \f[I]expr\f[R].
If multiple expressions are given, they are evaluated in order.
If files are given as well (see below), the expressions and files are
@ -115,17 +114,17 @@ If this option is given on the command-line (i.e., not in
\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
then after processing all expressions and files, dc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
\f[B]-f\f[R] or \f[B]\[en]file\f[R], whether on the command-line or in
\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
\f[B]DC_ENV_ARGS\f[R].
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
exit.
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-f\f[R] \f[I]file\f[R], \f[B]\[en]file\f[R]=\f[I]file\f[R]
\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
were read through \f[B]stdin\f[R].
If expressions are also given (see above), the expressions are evaluated
@ -136,9 +135,9 @@ If this option is given on the command-line (i.e., not in
\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
then after processing all expressions and files, dc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
\f[B]-f\f[R] or \f[B]\[en]file\f[R].
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
\f[B]-f\f[R] or \f[B]--file\f[R].
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
exit.
.PP
@ -1032,7 +1031,7 @@ Unlike most other dc(1) implentations, this dc(1) provides nearly
unlimited amounts of registers, if extended register mode is enabled.
.PP
If extended register mode is enabled (\f[B]-x\f[R] or
\f[B]\[en]extended-register\f[R] command-line arguments are given), then
\f[B]--extended-register\f[R] command-line arguments are given), then
normal single character registers are used \f[I]unless\f[R] the
character immediately following a command that needs a register name is
a space (according to \f[B]isspace()\f[R]) and not a newline
@ -1255,17 +1254,17 @@ interactive mode (see the \f[B]INTERACTIVE MODE\f[R] section), since
dc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
more input when one of those errors occurs in interactive mode.
This is also the case when interactive mode is forced by the
\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.PP
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]\[en]interactive\f[R] option.
\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
and \f[B]\[en]interactive\f[R] option can turn it on in other cases.
and \f[B]--interactive\f[R] option can turn it on in other cases.
.PP
In interactive mode, dc(1) attempts to recover from errors (see the
\f[B]RESET\f[R] section), and in normal execution, flushes

View File

@ -34,7 +34,7 @@ dc - arbitrary-precision decimal reverse-Polish notation calculator
# SYNOPSIS
**dc** [**-hiPvVx**] [**--version**] [**--help**] [**--interactive**] [**--no-prompt**] [**--extended-register**] [**-e** *expr*] [**--expression**=*expr*...] [**-f** *file*...] [**-file**=*file*...] [*file*...]
**dc** [**-hiPvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@ -43,11 +43,11 @@ notation) to store numbers and results of computations. Arithmetic operations
pop arguments off of the stack and push the results.
If no files are given on the command-line as extra arguments (i.e., not as
**-f** or **--file** arguments), then dc(1) reads from **stdin**. Otherwise,
**-f** or **-\-file** arguments), then dc(1) reads from **stdin**. Otherwise,
those files are processed, and dc(1) will then exit.
This is different from the dc(1) on OpenBSD and possibly other dc(1)
implementations, where **-e** (**--expression**) and **-f** (**--file**)
implementations, where **-e** (**-\-expression**) and **-f** (**-\-file**)
arguments cause dc(1) to execute them and exit. The reason for this is that this
dc(1) allows users to set arguments in the environment variable **DC_ENV_ARGS**
(see the **ENVIRONMENT VARIABLES** section). Any expressions given on the
@ -64,34 +64,34 @@ as the last command-line argument or define the environment variable
The following are the options that dc(1) accepts.
**-h**, **--help**
**-h**, **-\-help**
: Prints a usage message and quits.
**-v**, **-V**, **--version**
**-v**, **-V**, **-\-version**
: Print the version information (copyright header) and exit.
**-i**, **--interactive**
**-i**, **-\-interactive**
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
This is a **non-portable extension**.
**-P**, **--no-prompt**
**-P**, **-\-no-prompt**
: This option is a no-op.
This is a **non-portable extension**.
**-x** **--extended-register**
**-x** **-\-extended-register**
: Enables extended register mode. See the *Extended Register Mode* subsection
of the **REGISTERS** section for more information.
This is a **non-portable extension**.
**-e** *expr*, **--expression**=*expr*
**-e** *expr*, **-\-expression**=*expr*
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
order. If files are given as well (see below), the expressions and files are
@ -101,14 +101,14 @@ The following are the options that dc(1) accepts.
If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
see the **ENVIRONMENT VARIABLES** section), then after processing all
expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
as an argument at least once to **-f** or **--file**, whether on the
as an argument at least once to **-f** or **-\-file**, whether on the
command-line or in **DC_ENV_ARGS**. However, if any other **-e**,
**--expression**, **-f**, or **--file** arguments are given after **-f-** or
equivalent is given, dc(1) will give a fatal error and exit.
**-\-expression**, **-f**, or **-\-file** arguments are given after **-f-**
or equivalent is given, dc(1) will give a fatal error and exit.
This is a **non-portable extension**.
**-f** *file*, **--file**=*file*
**-f** *file*, **-\-file**=*file*
: Reads in *file* and evaluates it, line by line, as though it were read
through **stdin**. If expressions are also given (see above), the
@ -117,8 +117,8 @@ The following are the options that dc(1) accepts.
If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
see the **ENVIRONMENT VARIABLES** section), then after processing all
expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
as an argument at least once to **-f** or **--file**. However, if any other
**-e**, **--expression**, **-f**, or **--file** arguments are given after
as an argument at least once to **-f** or **-\-file**. However, if any other
**-e**, **-\-expression**, **-f**, or **-\-file** arguments are given after
**-f-** or equivalent is given, dc(1) will give a fatal error and exit.
This is a **non-portable extension**.
@ -906,7 +906,7 @@ follows any command that needs a register name. The only exception is a newline
Unlike most other dc(1) implentations, this dc(1) provides nearly unlimited
amounts of registers, if extended register mode is enabled.
If extended register mode is enabled (**-x** or **--extended-register**
If extended register mode is enabled (**-x** or **-\-extended-register**
command-line arguments are given), then normal single character registers are
used *unless* the character immediately following a command that needs a
register name is a space (according to **isspace()**) and not a newline
@ -1115,17 +1115,17 @@ The other statuses will only be returned when dc(1) is not in interactive mode
(see the **INTERACTIVE MODE** section), since dc(1) resets its state (see the
**RESET** section) and accepts more input when one of those errors occurs in
interactive mode. This is also the case when interactive mode is forced by the
**-i** flag or **--interactive** option.
**-i** flag or **-\-interactive** option.
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 **-i** flag or
**--interactive** option.
**-\-interactive** option.
# INTERACTIVE MODE
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both **stdin** and **stdout**
are hooked to a terminal, but the **-i** flag and **--interactive** option can
are hooked to a terminal, but the **-i** flag and **-\-interactive** option can
turn it on in other cases.
In interactive mode, dc(1) attempts to recover from errors (see the **RESET**

View File

@ -25,18 +25,17 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
.TH "DC" "1" "February 2021" "Gavin D. Howard" "General Commands Manual"
.TH "DC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
.SH Name
.PP
dc - arbitrary-precision decimal reverse-Polish notation calculator
.SH SYNOPSIS
.PP
\f[B]dc\f[R] [\f[B]-hiPvVx\f[R]] [\f[B]\[en]version\f[R]]
[\f[B]\[en]help\f[R]] [\f[B]\[en]interactive\f[R]]
[\f[B]\[en]no-prompt\f[R]] [\f[B]\[en]extended-register\f[R]]
[\f[B]-e\f[R] \f[I]expr\f[R]]
[\f[B]\[en]expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
\f[I]file\f[R]\&...] [\f[B]-file\f[R]=\f[I]file\f[R]\&...]
\f[B]dc\f[R] [\f[B]-hiPvVx\f[R]] [\f[B]--version\f[R]]
[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--no-prompt\f[R]]
[\f[B]--extended-register\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
[\f[I]file\f[R]\&...]
.SH DESCRIPTION
.PP
@ -47,13 +46,13 @@ Arithmetic operations pop arguments off of the stack and push the
results.
.PP
If no files are given on the command-line as extra arguments (i.e., not
as \f[B]-f\f[R] or \f[B]\[en]file\f[R] arguments), then dc(1) reads from
as \f[B]-f\f[R] or \f[B]--file\f[R] arguments), then dc(1) reads from
\f[B]stdin\f[R].
Otherwise, those files are processed, and dc(1) will then exit.
.PP
This is different from the dc(1) on OpenBSD and possibly other dc(1)
implementations, where \f[B]-e\f[R] (\f[B]\[en]expression\f[R]) and
\f[B]-f\f[R] (\f[B]\[en]file\f[R]) arguments cause dc(1) to execute them
implementations, where \f[B]-e\f[R] (\f[B]--expression\f[R]) and
\f[B]-f\f[R] (\f[B]--file\f[R]) arguments cause dc(1) to execute them
and exit.
The reason for this is that this dc(1) allows users to set arguments in
the environment variable \f[B]DC_ENV_ARGS\f[R] (see the \f[B]ENVIRONMENT
@ -72,13 +71,13 @@ argument or define the environment variable \f[B]DC_EXPR_EXIT\f[R].
.PP
The following are the options that dc(1) accepts.
.TP
\f[B]-h\f[R], \f[B]\[en]help\f[R]
\f[B]-h\f[R], \f[B]--help\f[R]
Prints a usage message and quits.
.TP
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]\[en]version\f[R]
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
Print the version information (copyright header) and exit.
.TP
\f[B]-i\f[R], \f[B]\[en]interactive\f[R]
\f[B]-i\f[R], \f[B]--interactive\f[R]
Forces interactive mode.
(See the \f[B]INTERACTIVE MODE\f[R] section.)
.RS
@ -86,14 +85,14 @@ Forces interactive mode.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-P\f[R], \f[B]\[en]no-prompt\f[R]
\f[B]-P\f[R], \f[B]--no-prompt\f[R]
This option is a no-op.
.RS
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-x\f[R] \f[B]\[en]extended-register\f[R]
\f[B]-x\f[R] \f[B]--extended-register\f[R]
Enables extended register mode.
See the \f[I]Extended Register Mode\f[R] subsection of the
\f[B]REGISTERS\f[R] section for more information.
@ -102,7 +101,7 @@ See the \f[I]Extended Register Mode\f[R] subsection of the
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]\[en]expression\f[R]=\f[I]expr\f[R]
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
Evaluates \f[I]expr\f[R].
If multiple expressions are given, they are evaluated in order.
If files are given as well (see below), the expressions and files are
@ -115,17 +114,17 @@ If this option is given on the command-line (i.e., not in
\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
then after processing all expressions and files, dc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
\f[B]-f\f[R] or \f[B]\[en]file\f[R], whether on the command-line or in
\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
\f[B]DC_ENV_ARGS\f[R].
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
exit.
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-f\f[R] \f[I]file\f[R], \f[B]\[en]file\f[R]=\f[I]file\f[R]
\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
were read through \f[B]stdin\f[R].
If expressions are also given (see above), the expressions are evaluated
@ -136,9 +135,9 @@ If this option is given on the command-line (i.e., not in
\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
then after processing all expressions and files, dc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
\f[B]-f\f[R] or \f[B]\[en]file\f[R].
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
\f[B]-f\f[R] or \f[B]--file\f[R].
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
exit.
.PP
@ -1032,7 +1031,7 @@ Unlike most other dc(1) implentations, this dc(1) provides nearly
unlimited amounts of registers, if extended register mode is enabled.
.PP
If extended register mode is enabled (\f[B]-x\f[R] or
\f[B]\[en]extended-register\f[R] command-line arguments are given), then
\f[B]--extended-register\f[R] command-line arguments are given), then
normal single character registers are used \f[I]unless\f[R] the
character immediately following a command that needs a register name is
a space (according to \f[B]isspace()\f[R]) and not a newline
@ -1255,17 +1254,17 @@ interactive mode (see the \f[B]INTERACTIVE MODE\f[R] section), since
dc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
more input when one of those errors occurs in interactive mode.
This is also the case when interactive mode is forced by the
\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.PP
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]\[en]interactive\f[R] option.
\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
and \f[B]\[en]interactive\f[R] option can turn it on in other cases.
and \f[B]--interactive\f[R] option can turn it on in other cases.
.PP
In interactive mode, dc(1) attempts to recover from errors (see the
\f[B]RESET\f[R] section), and in normal execution, flushes

View File

@ -34,7 +34,7 @@ dc - arbitrary-precision decimal reverse-Polish notation calculator
# SYNOPSIS
**dc** [**-hiPvVx**] [**--version**] [**--help**] [**--interactive**] [**--no-prompt**] [**--extended-register**] [**-e** *expr*] [**--expression**=*expr*...] [**-f** *file*...] [**-file**=*file*...] [*file*...]
**dc** [**-hiPvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@ -43,11 +43,11 @@ notation) to store numbers and results of computations. Arithmetic operations
pop arguments off of the stack and push the results.
If no files are given on the command-line as extra arguments (i.e., not as
**-f** or **--file** arguments), then dc(1) reads from **stdin**. Otherwise,
**-f** or **-\-file** arguments), then dc(1) reads from **stdin**. Otherwise,
those files are processed, and dc(1) will then exit.
This is different from the dc(1) on OpenBSD and possibly other dc(1)
implementations, where **-e** (**--expression**) and **-f** (**--file**)
implementations, where **-e** (**-\-expression**) and **-f** (**-\-file**)
arguments cause dc(1) to execute them and exit. The reason for this is that this
dc(1) allows users to set arguments in the environment variable **DC_ENV_ARGS**
(see the **ENVIRONMENT VARIABLES** section). Any expressions given on the
@ -64,34 +64,34 @@ as the last command-line argument or define the environment variable
The following are the options that dc(1) accepts.
**-h**, **--help**
**-h**, **-\-help**
: Prints a usage message and quits.
**-v**, **-V**, **--version**
**-v**, **-V**, **-\-version**
: Print the version information (copyright header) and exit.
**-i**, **--interactive**
**-i**, **-\-interactive**
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
This is a **non-portable extension**.
**-P**, **--no-prompt**
**-P**, **-\-no-prompt**
: This option is a no-op.
This is a **non-portable extension**.
**-x** **--extended-register**
**-x** **-\-extended-register**
: Enables extended register mode. See the *Extended Register Mode* subsection
of the **REGISTERS** section for more information.
This is a **non-portable extension**.
**-e** *expr*, **--expression**=*expr*
**-e** *expr*, **-\-expression**=*expr*
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
order. If files are given as well (see below), the expressions and files are
@ -101,14 +101,14 @@ The following are the options that dc(1) accepts.
If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
see the **ENVIRONMENT VARIABLES** section), then after processing all
expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
as an argument at least once to **-f** or **--file**, whether on the
as an argument at least once to **-f** or **-\-file**, whether on the
command-line or in **DC_ENV_ARGS**. However, if any other **-e**,
**--expression**, **-f**, or **--file** arguments are given after **-f-** or
equivalent is given, dc(1) will give a fatal error and exit.
**-\-expression**, **-f**, or **-\-file** arguments are given after **-f-**
or equivalent is given, dc(1) will give a fatal error and exit.
This is a **non-portable extension**.
**-f** *file*, **--file**=*file*
**-f** *file*, **-\-file**=*file*
: Reads in *file* and evaluates it, line by line, as though it were read
through **stdin**. If expressions are also given (see above), the
@ -117,8 +117,8 @@ The following are the options that dc(1) accepts.
If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
see the **ENVIRONMENT VARIABLES** section), then after processing all
expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
as an argument at least once to **-f** or **--file**. However, if any other
**-e**, **--expression**, **-f**, or **--file** arguments are given after
as an argument at least once to **-f** or **-\-file**. However, if any other
**-e**, **-\-expression**, **-f**, or **-\-file** arguments are given after
**-f-** or equivalent is given, dc(1) will give a fatal error and exit.
This is a **non-portable extension**.
@ -906,7 +906,7 @@ follows any command that needs a register name. The only exception is a newline
Unlike most other dc(1) implentations, this dc(1) provides nearly unlimited
amounts of registers, if extended register mode is enabled.
If extended register mode is enabled (**-x** or **--extended-register**
If extended register mode is enabled (**-x** or **-\-extended-register**
command-line arguments are given), then normal single character registers are
used *unless* the character immediately following a command that needs a
register name is a space (according to **isspace()**) and not a newline
@ -1115,17 +1115,17 @@ The other statuses will only be returned when dc(1) is not in interactive mode
(see the **INTERACTIVE MODE** section), since dc(1) resets its state (see the
**RESET** section) and accepts more input when one of those errors occurs in
interactive mode. This is also the case when interactive mode is forced by the
**-i** flag or **--interactive** option.
**-i** flag or **-\-interactive** option.
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 **-i** flag or
**--interactive** option.
**-\-interactive** option.
# INTERACTIVE MODE
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both **stdin** and **stdout**
are hooked to a terminal, but the **-i** flag and **--interactive** option can
are hooked to a terminal, but the **-i** flag and **-\-interactive** option can
turn it on in other cases.
In interactive mode, dc(1) attempts to recover from errors (see the **RESET**

View File

@ -25,18 +25,17 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
.TH "DC" "1" "February 2021" "Gavin D. Howard" "General Commands Manual"
.TH "DC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
.SH Name
.PP
dc - arbitrary-precision decimal reverse-Polish notation calculator
.SH SYNOPSIS
.PP
\f[B]dc\f[R] [\f[B]-hiPvVx\f[R]] [\f[B]\[en]version\f[R]]
[\f[B]\[en]help\f[R]] [\f[B]\[en]interactive\f[R]]
[\f[B]\[en]no-prompt\f[R]] [\f[B]\[en]extended-register\f[R]]
[\f[B]-e\f[R] \f[I]expr\f[R]]
[\f[B]\[en]expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
\f[I]file\f[R]\&...] [\f[B]-file\f[R]=\f[I]file\f[R]\&...]
\f[B]dc\f[R] [\f[B]-hiPvVx\f[R]] [\f[B]--version\f[R]]
[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--no-prompt\f[R]]
[\f[B]--extended-register\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
[\f[I]file\f[R]\&...]
.SH DESCRIPTION
.PP
@ -47,13 +46,13 @@ Arithmetic operations pop arguments off of the stack and push the
results.
.PP
If no files are given on the command-line as extra arguments (i.e., not
as \f[B]-f\f[R] or \f[B]\[en]file\f[R] arguments), then dc(1) reads from
as \f[B]-f\f[R] or \f[B]--file\f[R] arguments), then dc(1) reads from
\f[B]stdin\f[R].
Otherwise, those files are processed, and dc(1) will then exit.
.PP
This is different from the dc(1) on OpenBSD and possibly other dc(1)
implementations, where \f[B]-e\f[R] (\f[B]\[en]expression\f[R]) and
\f[B]-f\f[R] (\f[B]\[en]file\f[R]) arguments cause dc(1) to execute them
implementations, where \f[B]-e\f[R] (\f[B]--expression\f[R]) and
\f[B]-f\f[R] (\f[B]--file\f[R]) arguments cause dc(1) to execute them
and exit.
The reason for this is that this dc(1) allows users to set arguments in
the environment variable \f[B]DC_ENV_ARGS\f[R] (see the \f[B]ENVIRONMENT
@ -72,13 +71,13 @@ argument or define the environment variable \f[B]DC_EXPR_EXIT\f[R].
.PP
The following are the options that dc(1) accepts.
.TP
\f[B]-h\f[R], \f[B]\[en]help\f[R]
\f[B]-h\f[R], \f[B]--help\f[R]
Prints a usage message and quits.
.TP
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]\[en]version\f[R]
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
Print the version information (copyright header) and exit.
.TP
\f[B]-i\f[R], \f[B]\[en]interactive\f[R]
\f[B]-i\f[R], \f[B]--interactive\f[R]
Forces interactive mode.
(See the \f[B]INTERACTIVE MODE\f[R] section.)
.RS
@ -86,7 +85,7 @@ Forces interactive mode.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-P\f[R], \f[B]\[en]no-prompt\f[R]
\f[B]-P\f[R], \f[B]--no-prompt\f[R]
Disables the prompt in TTY mode.
(The prompt is only enabled in TTY mode.
See the \f[B]TTY MODE\f[R] section) This is mostly for those users that
@ -98,7 +97,7 @@ Most of those users would want to put this option in
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-x\f[R] \f[B]\[en]extended-register\f[R]
\f[B]-x\f[R] \f[B]--extended-register\f[R]
Enables extended register mode.
See the \f[I]Extended Register Mode\f[R] subsection of the
\f[B]REGISTERS\f[R] section for more information.
@ -107,7 +106,7 @@ See the \f[I]Extended Register Mode\f[R] subsection of the
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]\[en]expression\f[R]=\f[I]expr\f[R]
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
Evaluates \f[I]expr\f[R].
If multiple expressions are given, they are evaluated in order.
If files are given as well (see below), the expressions and files are
@ -120,17 +119,17 @@ If this option is given on the command-line (i.e., not in
\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
then after processing all expressions and files, dc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
\f[B]-f\f[R] or \f[B]\[en]file\f[R], whether on the command-line or in
\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
\f[B]DC_ENV_ARGS\f[R].
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
exit.
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-f\f[R] \f[I]file\f[R], \f[B]\[en]file\f[R]=\f[I]file\f[R]
\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
were read through \f[B]stdin\f[R].
If expressions are also given (see above), the expressions are evaluated
@ -141,9 +140,9 @@ If this option is given on the command-line (i.e., not in
\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
then after processing all expressions and files, dc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
\f[B]-f\f[R] or \f[B]\[en]file\f[R].
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
\f[B]-f\f[R] or \f[B]--file\f[R].
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
exit.
.PP
@ -1037,7 +1036,7 @@ Unlike most other dc(1) implentations, this dc(1) provides nearly
unlimited amounts of registers, if extended register mode is enabled.
.PP
If extended register mode is enabled (\f[B]-x\f[R] or
\f[B]\[en]extended-register\f[R] command-line arguments are given), then
\f[B]--extended-register\f[R] command-line arguments are given), then
normal single character registers are used \f[I]unless\f[R] the
character immediately following a command that needs a register name is
a space (according to \f[B]isspace()\f[R]) and not a newline
@ -1260,17 +1259,17 @@ interactive mode (see the \f[B]INTERACTIVE MODE\f[R] section), since
dc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
more input when one of those errors occurs in interactive mode.
This is also the case when interactive mode is forced by the
\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.PP
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]\[en]interactive\f[R] option.
\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
and \f[B]\[en]interactive\f[R] option can turn it on in other cases.
and \f[B]--interactive\f[R] option can turn it on in other cases.
.PP
In interactive mode, dc(1) attempts to recover from errors (see the
\f[B]RESET\f[R] section), and in normal execution, flushes

View File

@ -34,7 +34,7 @@ dc - arbitrary-precision decimal reverse-Polish notation calculator
# SYNOPSIS
**dc** [**-hiPvVx**] [**--version**] [**--help**] [**--interactive**] [**--no-prompt**] [**--extended-register**] [**-e** *expr*] [**--expression**=*expr*...] [**-f** *file*...] [**-file**=*file*...] [*file*...]
**dc** [**-hiPvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@ -43,11 +43,11 @@ notation) to store numbers and results of computations. Arithmetic operations
pop arguments off of the stack and push the results.
If no files are given on the command-line as extra arguments (i.e., not as
**-f** or **--file** arguments), then dc(1) reads from **stdin**. Otherwise,
**-f** or **-\-file** arguments), then dc(1) reads from **stdin**. Otherwise,
those files are processed, and dc(1) will then exit.
This is different from the dc(1) on OpenBSD and possibly other dc(1)
implementations, where **-e** (**--expression**) and **-f** (**--file**)
implementations, where **-e** (**-\-expression**) and **-f** (**-\-file**)
arguments cause dc(1) to execute them and exit. The reason for this is that this
dc(1) allows users to set arguments in the environment variable **DC_ENV_ARGS**
(see the **ENVIRONMENT VARIABLES** section). Any expressions given on the
@ -64,21 +64,21 @@ as the last command-line argument or define the environment variable
The following are the options that dc(1) accepts.
**-h**, **--help**
**-h**, **-\-help**
: Prints a usage message and quits.
**-v**, **-V**, **--version**
**-v**, **-V**, **-\-version**
: Print the version information (copyright header) and exit.
**-i**, **--interactive**
**-i**, **-\-interactive**
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
This is a **non-portable extension**.
**-P**, **--no-prompt**
**-P**, **-\-no-prompt**
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
See the **TTY MODE** section) This is mostly for those users that do not
@ -87,14 +87,14 @@ The following are the options that dc(1) accepts.
This is a **non-portable extension**.
**-x** **--extended-register**
**-x** **-\-extended-register**
: Enables extended register mode. See the *Extended Register Mode* subsection
of the **REGISTERS** section for more information.
This is a **non-portable extension**.
**-e** *expr*, **--expression**=*expr*
**-e** *expr*, **-\-expression**=*expr*
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
order. If files are given as well (see below), the expressions and files are
@ -104,14 +104,14 @@ The following are the options that dc(1) accepts.
If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
see the **ENVIRONMENT VARIABLES** section), then after processing all
expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
as an argument at least once to **-f** or **--file**, whether on the
as an argument at least once to **-f** or **-\-file**, whether on the
command-line or in **DC_ENV_ARGS**. However, if any other **-e**,
**--expression**, **-f**, or **--file** arguments are given after **-f-** or
equivalent is given, dc(1) will give a fatal error and exit.
**-\-expression**, **-f**, or **-\-file** arguments are given after **-f-**
or equivalent is given, dc(1) will give a fatal error and exit.
This is a **non-portable extension**.
**-f** *file*, **--file**=*file*
**-f** *file*, **-\-file**=*file*
: Reads in *file* and evaluates it, line by line, as though it were read
through **stdin**. If expressions are also given (see above), the
@ -120,8 +120,8 @@ The following are the options that dc(1) accepts.
If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
see the **ENVIRONMENT VARIABLES** section), then after processing all
expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
as an argument at least once to **-f** or **--file**. However, if any other
**-e**, **--expression**, **-f**, or **--file** arguments are given after
as an argument at least once to **-f** or **-\-file**. However, if any other
**-e**, **-\-expression**, **-f**, or **-\-file** arguments are given after
**-f-** or equivalent is given, dc(1) will give a fatal error and exit.
This is a **non-portable extension**.
@ -909,7 +909,7 @@ follows any command that needs a register name. The only exception is a newline
Unlike most other dc(1) implentations, this dc(1) provides nearly unlimited
amounts of registers, if extended register mode is enabled.
If extended register mode is enabled (**-x** or **--extended-register**
If extended register mode is enabled (**-x** or **-\-extended-register**
command-line arguments are given), then normal single character registers are
used *unless* the character immediately following a command that needs a
register name is a space (according to **isspace()**) and not a newline
@ -1118,17 +1118,17 @@ The other statuses will only be returned when dc(1) is not in interactive mode
(see the **INTERACTIVE MODE** section), since dc(1) resets its state (see the
**RESET** section) and accepts more input when one of those errors occurs in
interactive mode. This is also the case when interactive mode is forced by the
**-i** flag or **--interactive** option.
**-i** flag or **-\-interactive** option.
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 **-i** flag or
**--interactive** option.
**-\-interactive** option.
# INTERACTIVE MODE
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both **stdin** and **stdout**
are hooked to a terminal, but the **-i** flag and **--interactive** option can
are hooked to a terminal, but the **-i** flag and **-\-interactive** option can
turn it on in other cases.
In interactive mode, dc(1) attempts to recover from errors (see the **RESET**

View File

@ -25,18 +25,17 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
.TH "DC" "1" "February 2021" "Gavin D. Howard" "General Commands Manual"
.TH "DC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
.SH Name
.PP
dc - arbitrary-precision decimal reverse-Polish notation calculator
.SH SYNOPSIS
.PP
\f[B]dc\f[R] [\f[B]-hiPvVx\f[R]] [\f[B]\[en]version\f[R]]
[\f[B]\[en]help\f[R]] [\f[B]\[en]interactive\f[R]]
[\f[B]\[en]no-prompt\f[R]] [\f[B]\[en]extended-register\f[R]]
[\f[B]-e\f[R] \f[I]expr\f[R]]
[\f[B]\[en]expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
\f[I]file\f[R]\&...] [\f[B]-file\f[R]=\f[I]file\f[R]\&...]
\f[B]dc\f[R] [\f[B]-hiPvVx\f[R]] [\f[B]--version\f[R]]
[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--no-prompt\f[R]]
[\f[B]--extended-register\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
[\f[I]file\f[R]\&...]
.SH DESCRIPTION
.PP
@ -47,13 +46,13 @@ Arithmetic operations pop arguments off of the stack and push the
results.
.PP
If no files are given on the command-line as extra arguments (i.e., not
as \f[B]-f\f[R] or \f[B]\[en]file\f[R] arguments), then dc(1) reads from
as \f[B]-f\f[R] or \f[B]--file\f[R] arguments), then dc(1) reads from
\f[B]stdin\f[R].
Otherwise, those files are processed, and dc(1) will then exit.
.PP
This is different from the dc(1) on OpenBSD and possibly other dc(1)
implementations, where \f[B]-e\f[R] (\f[B]\[en]expression\f[R]) and
\f[B]-f\f[R] (\f[B]\[en]file\f[R]) arguments cause dc(1) to execute them
implementations, where \f[B]-e\f[R] (\f[B]--expression\f[R]) and
\f[B]-f\f[R] (\f[B]--file\f[R]) arguments cause dc(1) to execute them
and exit.
The reason for this is that this dc(1) allows users to set arguments in
the environment variable \f[B]DC_ENV_ARGS\f[R] (see the \f[B]ENVIRONMENT
@ -72,13 +71,13 @@ argument or define the environment variable \f[B]DC_EXPR_EXIT\f[R].
.PP
The following are the options that dc(1) accepts.
.TP
\f[B]-h\f[R], \f[B]\[en]help\f[R]
\f[B]-h\f[R], \f[B]--help\f[R]
Prints a usage message and quits.
.TP
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]\[en]version\f[R]
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
Print the version information (copyright header) and exit.
.TP
\f[B]-i\f[R], \f[B]\[en]interactive\f[R]
\f[B]-i\f[R], \f[B]--interactive\f[R]
Forces interactive mode.
(See the \f[B]INTERACTIVE MODE\f[R] section.)
.RS
@ -86,14 +85,14 @@ Forces interactive mode.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-P\f[R], \f[B]\[en]no-prompt\f[R]
\f[B]-P\f[R], \f[B]--no-prompt\f[R]
This option is a no-op.
.RS
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-x\f[R] \f[B]\[en]extended-register\f[R]
\f[B]-x\f[R] \f[B]--extended-register\f[R]
Enables extended register mode.
See the \f[I]Extended Register Mode\f[R] subsection of the
\f[B]REGISTERS\f[R] section for more information.
@ -102,7 +101,7 @@ See the \f[I]Extended Register Mode\f[R] subsection of the
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]\[en]expression\f[R]=\f[I]expr\f[R]
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
Evaluates \f[I]expr\f[R].
If multiple expressions are given, they are evaluated in order.
If files are given as well (see below), the expressions and files are
@ -115,17 +114,17 @@ If this option is given on the command-line (i.e., not in
\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
then after processing all expressions and files, dc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
\f[B]-f\f[R] or \f[B]\[en]file\f[R], whether on the command-line or in
\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
\f[B]DC_ENV_ARGS\f[R].
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
exit.
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-f\f[R] \f[I]file\f[R], \f[B]\[en]file\f[R]=\f[I]file\f[R]
\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
were read through \f[B]stdin\f[R].
If expressions are also given (see above), the expressions are evaluated
@ -136,9 +135,9 @@ If this option is given on the command-line (i.e., not in
\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
then after processing all expressions and files, dc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
\f[B]-f\f[R] or \f[B]\[en]file\f[R].
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
\f[B]-f\f[R] or \f[B]--file\f[R].
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
exit.
.PP
@ -1032,7 +1031,7 @@ Unlike most other dc(1) implentations, this dc(1) provides nearly
unlimited amounts of registers, if extended register mode is enabled.
.PP
If extended register mode is enabled (\f[B]-x\f[R] or
\f[B]\[en]extended-register\f[R] command-line arguments are given), then
\f[B]--extended-register\f[R] command-line arguments are given), then
normal single character registers are used \f[I]unless\f[R] the
character immediately following a command that needs a register name is
a space (according to \f[B]isspace()\f[R]) and not a newline
@ -1255,17 +1254,17 @@ interactive mode (see the \f[B]INTERACTIVE MODE\f[R] section), since
dc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
more input when one of those errors occurs in interactive mode.
This is also the case when interactive mode is forced by the
\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.PP
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]\[en]interactive\f[R] option.
\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
and \f[B]\[en]interactive\f[R] option can turn it on in other cases.
and \f[B]--interactive\f[R] option can turn it on in other cases.
.PP
In interactive mode, dc(1) attempts to recover from errors (see the
\f[B]RESET\f[R] section), and in normal execution, flushes

View File

@ -34,7 +34,7 @@ dc - arbitrary-precision decimal reverse-Polish notation calculator
# SYNOPSIS
**dc** [**-hiPvVx**] [**--version**] [**--help**] [**--interactive**] [**--no-prompt**] [**--extended-register**] [**-e** *expr*] [**--expression**=*expr*...] [**-f** *file*...] [**-file**=*file*...] [*file*...]
**dc** [**-hiPvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@ -43,11 +43,11 @@ notation) to store numbers and results of computations. Arithmetic operations
pop arguments off of the stack and push the results.
If no files are given on the command-line as extra arguments (i.e., not as
**-f** or **--file** arguments), then dc(1) reads from **stdin**. Otherwise,
**-f** or **-\-file** arguments), then dc(1) reads from **stdin**. Otherwise,
those files are processed, and dc(1) will then exit.
This is different from the dc(1) on OpenBSD and possibly other dc(1)
implementations, where **-e** (**--expression**) and **-f** (**--file**)
implementations, where **-e** (**-\-expression**) and **-f** (**-\-file**)
arguments cause dc(1) to execute them and exit. The reason for this is that this
dc(1) allows users to set arguments in the environment variable **DC_ENV_ARGS**
(see the **ENVIRONMENT VARIABLES** section). Any expressions given on the
@ -64,34 +64,34 @@ as the last command-line argument or define the environment variable
The following are the options that dc(1) accepts.
**-h**, **--help**
**-h**, **-\-help**
: Prints a usage message and quits.
**-v**, **-V**, **--version**
**-v**, **-V**, **-\-version**
: Print the version information (copyright header) and exit.
**-i**, **--interactive**
**-i**, **-\-interactive**
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
This is a **non-portable extension**.
**-P**, **--no-prompt**
**-P**, **-\-no-prompt**
: This option is a no-op.
This is a **non-portable extension**.
**-x** **--extended-register**
**-x** **-\-extended-register**
: Enables extended register mode. See the *Extended Register Mode* subsection
of the **REGISTERS** section for more information.
This is a **non-portable extension**.
**-e** *expr*, **--expression**=*expr*
**-e** *expr*, **-\-expression**=*expr*
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
order. If files are given as well (see below), the expressions and files are
@ -101,14 +101,14 @@ The following are the options that dc(1) accepts.
If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
see the **ENVIRONMENT VARIABLES** section), then after processing all
expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
as an argument at least once to **-f** or **--file**, whether on the
as an argument at least once to **-f** or **-\-file**, whether on the
command-line or in **DC_ENV_ARGS**. However, if any other **-e**,
**--expression**, **-f**, or **--file** arguments are given after **-f-** or
equivalent is given, dc(1) will give a fatal error and exit.
**-\-expression**, **-f**, or **-\-file** arguments are given after **-f-**
or equivalent is given, dc(1) will give a fatal error and exit.
This is a **non-portable extension**.
**-f** *file*, **--file**=*file*
**-f** *file*, **-\-file**=*file*
: Reads in *file* and evaluates it, line by line, as though it were read
through **stdin**. If expressions are also given (see above), the
@ -117,8 +117,8 @@ The following are the options that dc(1) accepts.
If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
see the **ENVIRONMENT VARIABLES** section), then after processing all
expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
as an argument at least once to **-f** or **--file**. However, if any other
**-e**, **--expression**, **-f**, or **--file** arguments are given after
as an argument at least once to **-f** or **-\-file**. However, if any other
**-e**, **-\-expression**, **-f**, or **-\-file** arguments are given after
**-f-** or equivalent is given, dc(1) will give a fatal error and exit.
This is a **non-portable extension**.
@ -906,7 +906,7 @@ follows any command that needs a register name. The only exception is a newline
Unlike most other dc(1) implentations, this dc(1) provides nearly unlimited
amounts of registers, if extended register mode is enabled.
If extended register mode is enabled (**-x** or **--extended-register**
If extended register mode is enabled (**-x** or **-\-extended-register**
command-line arguments are given), then normal single character registers are
used *unless* the character immediately following a command that needs a
register name is a space (according to **isspace()**) and not a newline
@ -1115,17 +1115,17 @@ The other statuses will only be returned when dc(1) is not in interactive mode
(see the **INTERACTIVE MODE** section), since dc(1) resets its state (see the
**RESET** section) and accepts more input when one of those errors occurs in
interactive mode. This is also the case when interactive mode is forced by the
**-i** flag or **--interactive** option.
**-i** flag or **-\-interactive** option.
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 **-i** flag or
**--interactive** option.
**-\-interactive** option.
# INTERACTIVE MODE
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both **stdin** and **stdout**
are hooked to a terminal, but the **-i** flag and **--interactive** option can
are hooked to a terminal, but the **-i** flag and **-\-interactive** option can
turn it on in other cases.
In interactive mode, dc(1) attempts to recover from errors (see the **RESET**

View File

@ -25,18 +25,17 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
.TH "DC" "1" "February 2021" "Gavin D. Howard" "General Commands Manual"
.TH "DC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
.SH Name
.PP
dc - arbitrary-precision decimal reverse-Polish notation calculator
.SH SYNOPSIS
.PP
\f[B]dc\f[R] [\f[B]-hiPvVx\f[R]] [\f[B]\[en]version\f[R]]
[\f[B]\[en]help\f[R]] [\f[B]\[en]interactive\f[R]]
[\f[B]\[en]no-prompt\f[R]] [\f[B]\[en]extended-register\f[R]]
[\f[B]-e\f[R] \f[I]expr\f[R]]
[\f[B]\[en]expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
\f[I]file\f[R]\&...] [\f[B]-file\f[R]=\f[I]file\f[R]\&...]
\f[B]dc\f[R] [\f[B]-hiPvVx\f[R]] [\f[B]--version\f[R]]
[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--no-prompt\f[R]]
[\f[B]--extended-register\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
[\f[I]file\f[R]\&...]
.SH DESCRIPTION
.PP
@ -47,13 +46,13 @@ Arithmetic operations pop arguments off of the stack and push the
results.
.PP
If no files are given on the command-line as extra arguments (i.e., not
as \f[B]-f\f[R] or \f[B]\[en]file\f[R] arguments), then dc(1) reads from
as \f[B]-f\f[R] or \f[B]--file\f[R] arguments), then dc(1) reads from
\f[B]stdin\f[R].
Otherwise, those files are processed, and dc(1) will then exit.
.PP
This is different from the dc(1) on OpenBSD and possibly other dc(1)
implementations, where \f[B]-e\f[R] (\f[B]\[en]expression\f[R]) and
\f[B]-f\f[R] (\f[B]\[en]file\f[R]) arguments cause dc(1) to execute them
implementations, where \f[B]-e\f[R] (\f[B]--expression\f[R]) and
\f[B]-f\f[R] (\f[B]--file\f[R]) arguments cause dc(1) to execute them
and exit.
The reason for this is that this dc(1) allows users to set arguments in
the environment variable \f[B]DC_ENV_ARGS\f[R] (see the \f[B]ENVIRONMENT
@ -72,13 +71,13 @@ argument or define the environment variable \f[B]DC_EXPR_EXIT\f[R].
.PP
The following are the options that dc(1) accepts.
.TP
\f[B]-h\f[R], \f[B]\[en]help\f[R]
\f[B]-h\f[R], \f[B]--help\f[R]
Prints a usage message and quits.
.TP
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]\[en]version\f[R]
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
Print the version information (copyright header) and exit.
.TP
\f[B]-i\f[R], \f[B]\[en]interactive\f[R]
\f[B]-i\f[R], \f[B]--interactive\f[R]
Forces interactive mode.
(See the \f[B]INTERACTIVE MODE\f[R] section.)
.RS
@ -86,14 +85,14 @@ Forces interactive mode.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-P\f[R], \f[B]\[en]no-prompt\f[R]
\f[B]-P\f[R], \f[B]--no-prompt\f[R]
This option is a no-op.
.RS
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-x\f[R] \f[B]\[en]extended-register\f[R]
\f[B]-x\f[R] \f[B]--extended-register\f[R]
Enables extended register mode.
See the \f[I]Extended Register Mode\f[R] subsection of the
\f[B]REGISTERS\f[R] section for more information.
@ -102,7 +101,7 @@ See the \f[I]Extended Register Mode\f[R] subsection of the
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]\[en]expression\f[R]=\f[I]expr\f[R]
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
Evaluates \f[I]expr\f[R].
If multiple expressions are given, they are evaluated in order.
If files are given as well (see below), the expressions and files are
@ -115,17 +114,17 @@ If this option is given on the command-line (i.e., not in
\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
then after processing all expressions and files, dc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
\f[B]-f\f[R] or \f[B]\[en]file\f[R], whether on the command-line or in
\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
\f[B]DC_ENV_ARGS\f[R].
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
exit.
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-f\f[R] \f[I]file\f[R], \f[B]\[en]file\f[R]=\f[I]file\f[R]
\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
were read through \f[B]stdin\f[R].
If expressions are also given (see above), the expressions are evaluated
@ -136,9 +135,9 @@ If this option is given on the command-line (i.e., not in
\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
then after processing all expressions and files, dc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
\f[B]-f\f[R] or \f[B]\[en]file\f[R].
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
\f[B]-f\f[R] or \f[B]--file\f[R].
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
exit.
.PP
@ -1032,7 +1031,7 @@ Unlike most other dc(1) implentations, this dc(1) provides nearly
unlimited amounts of registers, if extended register mode is enabled.
.PP
If extended register mode is enabled (\f[B]-x\f[R] or
\f[B]\[en]extended-register\f[R] command-line arguments are given), then
\f[B]--extended-register\f[R] command-line arguments are given), then
normal single character registers are used \f[I]unless\f[R] the
character immediately following a command that needs a register name is
a space (according to \f[B]isspace()\f[R]) and not a newline
@ -1255,17 +1254,17 @@ interactive mode (see the \f[B]INTERACTIVE MODE\f[R] section), since
dc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
more input when one of those errors occurs in interactive mode.
This is also the case when interactive mode is forced by the
\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.PP
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]\[en]interactive\f[R] option.
\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
and \f[B]\[en]interactive\f[R] option can turn it on in other cases.
and \f[B]--interactive\f[R] option can turn it on in other cases.
.PP
In interactive mode, dc(1) attempts to recover from errors (see the
\f[B]RESET\f[R] section), and in normal execution, flushes

View File

@ -34,7 +34,7 @@ dc - arbitrary-precision decimal reverse-Polish notation calculator
# SYNOPSIS
**dc** [**-hiPvVx**] [**--version**] [**--help**] [**--interactive**] [**--no-prompt**] [**--extended-register**] [**-e** *expr*] [**--expression**=*expr*...] [**-f** *file*...] [**-file**=*file*...] [*file*...]
**dc** [**-hiPvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@ -43,11 +43,11 @@ notation) to store numbers and results of computations. Arithmetic operations
pop arguments off of the stack and push the results.
If no files are given on the command-line as extra arguments (i.e., not as
**-f** or **--file** arguments), then dc(1) reads from **stdin**. Otherwise,
**-f** or **-\-file** arguments), then dc(1) reads from **stdin**. Otherwise,
those files are processed, and dc(1) will then exit.
This is different from the dc(1) on OpenBSD and possibly other dc(1)
implementations, where **-e** (**--expression**) and **-f** (**--file**)
implementations, where **-e** (**-\-expression**) and **-f** (**-\-file**)
arguments cause dc(1) to execute them and exit. The reason for this is that this
dc(1) allows users to set arguments in the environment variable **DC_ENV_ARGS**
(see the **ENVIRONMENT VARIABLES** section). Any expressions given on the
@ -64,34 +64,34 @@ as the last command-line argument or define the environment variable
The following are the options that dc(1) accepts.
**-h**, **--help**
**-h**, **-\-help**
: Prints a usage message and quits.
**-v**, **-V**, **--version**
**-v**, **-V**, **-\-version**
: Print the version information (copyright header) and exit.
**-i**, **--interactive**
**-i**, **-\-interactive**
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
This is a **non-portable extension**.
**-P**, **--no-prompt**
**-P**, **-\-no-prompt**
: This option is a no-op.
This is a **non-portable extension**.
**-x** **--extended-register**
**-x** **-\-extended-register**
: Enables extended register mode. See the *Extended Register Mode* subsection
of the **REGISTERS** section for more information.
This is a **non-portable extension**.
**-e** *expr*, **--expression**=*expr*
**-e** *expr*, **-\-expression**=*expr*
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
order. If files are given as well (see below), the expressions and files are
@ -101,14 +101,14 @@ The following are the options that dc(1) accepts.
If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
see the **ENVIRONMENT VARIABLES** section), then after processing all
expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
as an argument at least once to **-f** or **--file**, whether on the
as an argument at least once to **-f** or **-\-file**, whether on the
command-line or in **DC_ENV_ARGS**. However, if any other **-e**,
**--expression**, **-f**, or **--file** arguments are given after **-f-** or
equivalent is given, dc(1) will give a fatal error and exit.
**-\-expression**, **-f**, or **-\-file** arguments are given after **-f-**
or equivalent is given, dc(1) will give a fatal error and exit.
This is a **non-portable extension**.
**-f** *file*, **--file**=*file*
**-f** *file*, **-\-file**=*file*
: Reads in *file* and evaluates it, line by line, as though it were read
through **stdin**. If expressions are also given (see above), the
@ -117,8 +117,8 @@ The following are the options that dc(1) accepts.
If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
see the **ENVIRONMENT VARIABLES** section), then after processing all
expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
as an argument at least once to **-f** or **--file**. However, if any other
**-e**, **--expression**, **-f**, or **--file** arguments are given after
as an argument at least once to **-f** or **-\-file**. However, if any other
**-e**, **-\-expression**, **-f**, or **-\-file** arguments are given after
**-f-** or equivalent is given, dc(1) will give a fatal error and exit.
This is a **non-portable extension**.
@ -906,7 +906,7 @@ follows any command that needs a register name. The only exception is a newline
Unlike most other dc(1) implentations, this dc(1) provides nearly unlimited
amounts of registers, if extended register mode is enabled.
If extended register mode is enabled (**-x** or **--extended-register**
If extended register mode is enabled (**-x** or **-\-extended-register**
command-line arguments are given), then normal single character registers are
used *unless* the character immediately following a command that needs a
register name is a space (according to **isspace()**) and not a newline
@ -1115,17 +1115,17 @@ The other statuses will only be returned when dc(1) is not in interactive mode
(see the **INTERACTIVE MODE** section), since dc(1) resets its state (see the
**RESET** section) and accepts more input when one of those errors occurs in
interactive mode. This is also the case when interactive mode is forced by the
**-i** flag or **--interactive** option.
**-i** flag or **-\-interactive** option.
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 **-i** flag or
**--interactive** option.
**-\-interactive** option.
# INTERACTIVE MODE
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both **stdin** and **stdout**
are hooked to a terminal, but the **-i** flag and **--interactive** option can
are hooked to a terminal, but the **-i** flag and **-\-interactive** option can
turn it on in other cases.
In interactive mode, dc(1) attempts to recover from errors (see the **RESET**

View File

@ -1 +1 @@
.TH "BC" "1" "February 2021" "Gavin D. Howard" "General Commands Manual"
.TH "BC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"

View File

@ -1 +1 @@
.TH "BCL" "3" "February 2021" "Gavin D. Howard" "Libraries Manual"
.TH "BCL" "3" "March 2021" "Gavin D. Howard" "Libraries Manual"

View File

@ -1 +1 @@
.TH "DC" "1" "February 2021" "Gavin D. Howard" "General Commands Manual"
.TH "DC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"

View File

@ -2138,7 +2138,7 @@ size_t bc_num_len(const BcNum *restrict n) {
size_t len = n->len;
if (BC_NUM_ZERO(n)) return 0;
if (BC_NUM_ZERO(n)) return n->scale ? n->scale : 1;
if (BC_NUM_RDX_VAL(n) == len) {

View File

@ -1,4 +1,7 @@
length(0)
length(0.0000)
length(0.00000000)
length(0.00000000000)
length(1)
length(12)
length(123)

View File

@ -1,4 +1,7 @@
0
1
4
8
11
1
2
3

View File

@ -84,6 +84,12 @@ cbrt(27)
cbrt(-27)
cbrt(4096)
cbrt(-4096)
root(0, 3)
root(0, 4)
root(0, 5)
root(0.0000000000000, 3)
root(0.0000000000000, 4)
root(0.0000000000000, 5)
root(16, 4)
root(3125, 5)
root(-3125, 5)

View File

@ -84,6 +84,12 @@
-3.00000000000000000000
16.00000000000000000000
-16.00000000000000000000
0
0
0
0
0
0
2.00000000000000000000
5.00000000000000000000
-5.00000000000000000000

View File

@ -15,8 +15,9 @@ t[11] = -1.74
t[12] = -2
t[13] = -3.2345
t[14] = -100
t[15] = 0.0000000000000000
l = 15
l = 16
a[0] = t[0]
@ -30,7 +31,11 @@ l -= 1
for (i = 0; i < l; ++i) {
for (j = 0; j < l; ++j) {
print "j(", a[i], ", ", a[j], ")\n"
print "j(", a[i]
if (a[i] == 0 && scale(a[i]) > 0) print ".0000000000000000"
print ", ", a[j]
if (a[j] == 0 && scale(a[j]) > 0) print ".0000000000000000"
print ")\n"
}
}

View File

@ -1,4 +1,5 @@
decimal
length
add
subtract
multiply

View File

@ -0,0 +1,129 @@
0ZpR
0.0000ZpR
0.00000000ZpR
0.00000000000ZpR
1ZpR
12ZpR
123ZpR
1234ZpR
12345ZpR
123456ZpR
1234567ZpR
12345678ZpR
123456789ZpR
1234567890ZpR
1.0ZpR
12.0ZpR
123.0ZpR
1234.0ZpR
12345.0ZpR
123456.0ZpR
1234567.0ZpR
12345678.0ZpR
123456789.0ZpR
1234567890.0ZpR
.1ZpR
.12ZpR
.123ZpR
.1234ZpR
.12345ZpR
.123456ZpR
.1234567ZpR
.12345678ZpR
.123456789ZpR
.1234567890ZpR
.01ZpR
.012ZpR
.0123ZpR
.01234ZpR
.012345ZpR
.0123456ZpR
.01234567ZpR
.012345678ZpR
.0123456789ZpR
.01234567890ZpR
.001ZpR
.0012ZpR
.00123ZpR
.001234ZpR
.0012345ZpR
.00123456ZpR
.001234567ZpR
.0012345678ZpR
.00123456789ZpR
.001234567890ZpR
.0001ZpR
.00012ZpR
.000123ZpR
.0001234ZpR
.00012345ZpR
.000123456ZpR
.0001234567ZpR
.00012345678ZpR
.000123456789ZpR
.0001234567890ZpR
.00001ZpR
.000012ZpR
.0000123ZpR
.00001234ZpR
.000012345ZpR
.0000123456ZpR
.00001234567ZpR
.000012345678ZpR
.0000123456789ZpR
.00001234567890ZpR
.000001ZpR
.0000012ZpR
.00000123ZpR
.000001234ZpR
.0000012345ZpR
.00000123456ZpR
.000001234567ZpR
.0000012345678ZpR
.00000123456789ZpR
.000001234567890ZpR
.0000001ZpR
.00000012ZpR
.000000123ZpR
.0000001234ZpR
.00000012345ZpR
.000000123456ZpR
.0000001234567ZpR
.00000012345678ZpR
.000000123456789ZpR
.0000001234567890ZpR
.00000001ZpR
.000000012ZpR
.0000000123ZpR
.00000001234ZpR
.000000012345ZpR
.0000000123456ZpR
.00000001234567ZpR
.000000012345678ZpR
.0000000123456789ZpR
.00000001234567890ZpR
.000000001ZpR
.0000000012ZpR
.00000000123ZpR
.000000001234ZpR
.0000000012345ZpR
.00000000123456ZpR
.000000001234567ZpR
.0000000012345678ZpR
.00000000123456789ZpR
.000000001234567890ZpR
.0000000001ZpR
.00000000012ZpR
.000000000123ZpR
.0000000001234ZpR
.00000000012345ZpR
.000000000123456ZpR
.0000000001234567ZpR
.00000000012345678ZpR
.000000000123456789ZpR
.0000000001234567890ZpR
289.29837ZpR
2893.00000ZpR
289.0ZpR
1802973.0000000238ZpR
.000000000000000093182394080000000000ZpR

View File

@ -0,0 +1,129 @@
1
4
8
11
1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10
11
1
2
3
4
5
6
7
8
9
10
1
2
3
4
5
6
7
8
9
10
1
2
3
4
5
6
7
8
9
10
1
2
3
4
5
6
7
8
9
10
1
2
3
4
5
6
7
8
9
10
1
2
3
4
5
6
7
8
9
10
1
2
3
4
5
6
7
8
9
10
1
2
3
4
5
6
7
8
9
10
1
2
3
4
5
6
7
8
9
10
1
2
3
4
5
6
7
8
9
10
8
9
4
17
20