Lines Matching +full:reset +full:- +full:mode
2 .\" SPDX-License-Identifier: BSD-2-Clause
4 .\" Copyright (c) 2018-2024 Gavin D. Howard and contributors.
32 dc \- arbitrary\-precision decimal reverse\-Polish notation calculator
34 \f[B]dc\f[R] [\f[B]\-cChiPRvVx\f[R]] [\f[B]\-\-version\f[R]]
35 [\f[B]\-\-help\f[R]] [\f[B]\-\-digit\-clamp\f[R]]
36 [\f[B]\-\-no\-digit\-clamp\f[R]] [\f[B]\-\-interactive\f[R]]
37 [\f[B]\-\-no\-prompt\f[R]] [\f[B]\-\-no\-read\-prompt\f[R]]
38 [\f[B]\-\-extended\-register\f[R]] [\f[B]\-e\f[R] \f[I]expr\f[R]]
39 [\f[B]\-\-expression\f[R]=\f[I]expr\f[R]\&...]
40 [\f[B]\-f\f[R] \f[I]file\f[R]\&...]
41 [\f[B]\-\-file\f[R]=\f[I]file\f[R]\&...]
43 [\f[B]\-I\f[R] \f[I]ibase\f[R]] [\f[B]\-\-ibase\f[R]=\f[I]ibase\f[R]]
44 [\f[B]\-O\f[R] \f[I]obase\f[R]] [\f[B]\-\-obase\f[R]=\f[I]obase\f[R]]
45 [\f[B]\-S\f[R] \f[I]scale\f[R]] [\f[B]\-\-scale\f[R]=\f[I]scale\f[R]]
46 [\f[B]\-E\f[R] \f[I]seed\f[R]] [\f[B]\-\-seed\f[R]=\f[I]seed\f[R]]
48 dc(1) is an arbitrary\-precision calculator.
54 If no files are given on the command\-line, then dc(1) reads from
61 \f[B]10\f[R], they can set \f[B]DC_ENV_ARGS\f[R] to \f[B]\-e 10k\f[R],
66 \f[B]\-C\f[R], \f[B]\-\-no\-digit\-clamp\f[R]
76 If this and/or the \f[B]\-c\f[R] or \f[B]\-\-digit\-clamp\f[R] options
81 can be queried with the \f[B]\-h\f[R] or \f[B]\-\-help\f[R] options.
83 This is a \f[B]non\-portable extension\f[R].
86 \f[B]\-c\f[R], \f[B]\-\-digit\-clamp\f[R]
97 If this and/or the \f[B]\-C\f[R] or \f[B]\-\-no\-digit\-clamp\f[R]
102 can be queried with the \f[B]\-h\f[R] or \f[B]\-\-help\f[R] options.
104 This is a \f[B]non\-portable extension\f[R].
107 \f[B]\-E\f[R] \f[I]seed\f[R], \f[B]\-\-seed\f[R]=\f[I]seed\f[R]
115 This is a \f[B]non\-portable extension\f[R].
118 \f[B]\-e\f[R] \f[I]expr\f[R], \f[B]\-\-expression\f[R]=\f[I]expr\f[R]
127 If this option is given on the command\-line (i.e., not in
130 \f[B]\-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
131 \f[B]\-f\f[R] or \f[B]\-\-file\f[R], whether on the command\-line or in
133 However, if any other \f[B]\-e\f[R], \f[B]\-\-expression\f[R],
134 \f[B]\-f\f[R], or \f[B]\-\-file\f[R] arguments are given after
135 \f[B]\-f\-\f[R] or equivalent is given, dc(1) will give a fatal error
138 This is a \f[B]non\-portable extension\f[R].
141 \f[B]\-f\f[R] \f[I]file\f[R], \f[B]\-\-file\f[R]=\f[I]file\f[R]
148 If this option is given on the command\-line (i.e., not in
151 \f[B]\-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
152 \f[B]\-f\f[R] or \f[B]\-\-file\f[R].
153 However, if any other \f[B]\-e\f[R], \f[B]\-\-expression\f[R],
154 \f[B]\-f\f[R], or \f[B]\-\-file\f[R] arguments are given after
155 \f[B]\-f\-\f[R] or equivalent is given, dc(1) will give a fatal error
158 This is a \f[B]non\-portable extension\f[R].
161 \f[B]\-h\f[R], \f[B]\-\-help\f[R]
164 \f[B]\-I\f[R] \f[I]ibase\f[R], \f[B]\-\-ibase\f[R]=\f[I]ibase\f[R]
172 This is a \f[B]non\-portable extension\f[R].
175 \f[B]\-i\f[R], \f[B]\-\-interactive\f[R]
176 Forces interactive mode.
177 (See the \f[B]INTERACTIVE MODE\f[R] section.)
180 This is a \f[B]non\-portable extension\f[R].
183 \f[B]\-L\f[R], \f[B]\-\-no\-line\-length\f[R]
190 This is a \f[B]non\-portable extension\f[R].
193 \f[B]\-O\f[R] \f[I]obase\f[R], \f[B]\-\-obase\f[R]=\f[I]obase\f[R]
201 This is a \f[B]non\-portable extension\f[R].
204 \f[B]\-P\f[R], \f[B]\-\-no\-prompt\f[R]
205 Disables the prompt in TTY mode.
206 (The prompt is only enabled in TTY mode.
207 See the \f[B]TTY MODE\f[R] section.)
217 This is a \f[B]non\-portable extension\f[R].
220 \f[B]\-R\f[R], \f[B]\-\-no\-read\-prompt\f[R]
221 Disables the read prompt in TTY mode.
222 (The read prompt is only enabled in TTY mode.
223 See the \f[B]TTY MODE\f[R] section.)
239 This is a \f[B]non\-portable extension\f[R].
242 \f[B]\-S\f[R] \f[I]scale\f[R], \f[B]\-\-scale\f[R]=\f[I]scale\f[R]
250 This is a \f[B]non\-portable extension\f[R].
253 \f[B]\-v\f[R], \f[B]\-V\f[R], \f[B]\-\-version\f[R]
256 \f[B]\-x\f[R] \f[B]\-\-extended\-register\f[R]
257 Enables extended register mode.
258 See the \f[I]Extended Register Mode\f[R] subsection of the
262 This is a \f[B]non\-portable extension\f[R].
265 \f[B]\-z\f[R], \f[B]\-\-leading\-zeroes\f[R]
266 Makes dc(1) print all numbers greater than \f[B]\-1\f[R] and less than
270 This is a \f[B]non\-portable extension\f[R].
273 All long options are \f[B]non\-portable extensions\f[R].
275 If no files are given on the command\-line and no files or expressions
276 are given by the \f[B]\-f\f[R], \f[B]\-\-file\f[R], \f[B]\-e\f[R], or
277 \f[B]\-\-expression\f[R] options, then dc(1) reads from \f[B]stdin\f[R].
287 Any non\-error output is written to \f[B]stdout\f[R].
289 prompt (see the \f[B]TTY MODE\f[R] section) are enabled, both are output
295 \f[B]dc >&\-\f[R], it will quit with an error.
308 \f[B]dc 2>&\-\f[R], it will quit with an error.
345 \f[B]non\-portable extensions\f[R].
357 pseudo\-random number generator.
359 is assigned to \f[B]seed\f[R] later, the pseudo\-random number generator
360 is guaranteed to produce the same sequence of pseudo\-random numbers
364 of pseudo\-random numbers.
374 \f[B]Note\f[R]: The values returned by the pseudo\-random number
377 This is a consequence of using a seeded pseudo\-random number generator.
380 This means that the pseudo\-random values from dc(1) should only be used
381 where a reproducible stream of pseudo\-random numbers is
383 In any other case, use a non\-seeded pseudo\-random number generator.
385 The pseudo\-random number generator, \f[B]seed\f[R], and all associated
386 operations are \f[B]non\-portable extensions\f[R].
389 This is a \f[B]non\-portable extension\f[R].
400 the \f[B]\-c\f[R]/\f[B]\-\-digit\-clamp\f[R] or
401 \f[B]\-C\f[R]/\f[B]\-\-no\-digit\-clamp\f[R] options (see the
405 \f[B]\-h\f[R]/\f[B]\-\-help\f[R] option.
423 There is one exception to clamping: single\-character numbers (i.e.,
454 Accepting input as scientific notation is a \f[B]non\-portable
470 \f[B]non\-portable extension\f[R].
490 digit is interpreted as an 8\-bit ASCII character, making it a byte
495 This is a \f[B]non\-portable extension\f[R].
514 \f[B]\-\f[R]
535 The first value popped off of the stack must be non\-zero.
545 \f[B]a\-(a/b)*b\f[R] to \f[I]scale\f[R]
548 The first value popped off of the stack must be non\-zero.
559 The first value popped off of the stack must be non\-zero.
561 This is a \f[B]non\-portable extension\f[R].
572 non\-zero.
581 The value popped off of the stack must be non\-negative.
591 This behavior without a number is a \f[B]non\-portable extension\f[R].
600 This is a \f[B]non\-portable extension\f[R].
609 integer and non\-zero.
611 and non\-negative.
614 This is a \f[B]non\-portable extension\f[R].
622 This is a \f[B]non\-portable extension\f[R].
632 non\-negative.
634 This is a \f[B]non\-portable extension\f[R].
643 non\-negative.
645 This is a \f[B]non\-portable extension\f[R].
654 non\-negative.
656 This is a \f[B]non\-portable extension\f[R].
664 This is a \f[B]non\-portable extension\f[R].
672 This is a \f[B]non\-portable extension\f[R].
681 This is a \f[B]non\-portable extension\f[R].
690 This is a \f[B]non\-portable extension\f[R].
699 This is a \f[B]non\-portable extension\f[R].
708 This is a \f[B]non\-portable extension\f[R].
713 If they are both non\-zero, a \f[B]1\f[R] is pushed onto the stack.
719 a short\-circuit operator.
721 This is a \f[B]non\-portable extension\f[R].
726 If at least one of them is non\-zero, a \f[B]1\f[R] is pushed onto the
732 a short\-circuit operator.
734 This is a \f[B]non\-portable extension\f[R].
736 .SS Pseudo\-Random Number Generator
737 dc(1) has a built\-in pseudo\-random number generator.
738 These commands query the pseudo\-random number generator.
740 controls the pseudo\-random number generator.)
742 The pseudo\-random number generator is guaranteed to \f[B]NOT\f[R] be
751 limitations of the pseudo\-random number generator.
753 This is a \f[B]non\-portable extension\f[R].
759 If the bound is negative or is a non\-integer, an error is raised, and
760 dc(1) resets (see the \f[B]RESET\f[R] section) while \f[B]seed\f[R]
763 honored by generating several pseudo\-random integers, multiplying them
775 limitations of the pseudo\-random number generator.
777 This is a \f[B]non\-portable extension\f[R].
843 \f[B]scale\f[R], which must be non\-negative.
853 The meaning of \f[B]seed\f[R] is dependent on the current pseudo\-random
861 pseudo\-random number generator is guaranteed to produce the same
862 sequence of pseudo\-random numbers as it did when the \f[B]seed\f[R]
869 same sequence of pseudo\-random numbers.
871 produce unique sequences of pseudo\-random numbers.
876 This is a \f[B]non\-portable extension\f[R].
892 This is a \f[B]non\-portable extension\f[R].
900 This is a \f[B]non\-portable extension\f[R].
908 This is a \f[B]non\-portable extension\f[R].
916 This is a \f[B]non\-portable extension\f[R].
921 \f[B]\[cq]\f[R] pseudo\-random number generator command.
924 This is a \f[B]non\-portable extension\f[R].
964 one\-character string where the character is the result of the mod
970 create the new string as a one\-character string.
973 This is a \f[B]non\-portable extension\f[R].
998 error and reset (see the \f[B]RESET\f[R] section).
1007 error and reset (see the \f[B]RESET\f[R] section).
1009 This is a \f[B]non\-portable extension\f[R].
1019 error and reset (see the \f[B]RESET\f[R] section).
1028 error and reset (see the \f[B]RESET\f[R] section).
1030 This is a \f[B]non\-portable extension\f[R].
1040 error and reset (see the \f[B]RESET\f[R] section).
1049 error and reset (see the \f[B]RESET\f[R] section).
1051 This is a \f[B]non\-portable extension\f[R].
1061 error and reset (see the \f[B]RESET\f[R] section).
1070 error and reset (see the \f[B]RESET\f[R] section).
1072 This is a \f[B]non\-portable extension\f[R].
1082 error and reset (see the \f[B]RESET\f[R] section).
1091 error and reset (see the \f[B]RESET\f[R] section).
1093 This is a \f[B]non\-portable extension\f[R].
1103 error and reset (see the \f[B]RESET\f[R] section).
1112 error and reset (see the \f[B]RESET\f[R] section).
1114 This is a \f[B]non\-portable extension\f[R].
1127 Pops a value from the stack which must be non\-negative and is used the
1140 This is a \f[B]non\-portable extension\f[R].
1173 This is a \f[B]non\-portable extension\f[R].
1182 This is a \f[B]non\-portable extension\f[R].
1197 an error and reset otherwise (see the \f[B]RESET\f[R] section).
1200 This is a \f[B]non\-portable extension\f[R].
1219 This is a \f[B]non\-portable extension\f[R].
1234 Pushes \f[B]1\f[R] onto the stack if extended register mode is on,
1236 See the \f[I]Extended Register Mode\f[R] subsection of the
1241 been enabled with the \f[B]\-z\f[R] or \f[B]\-\-leading\-zeroes\f[R]
1242 options (see the \f[B]OPTIONS\f[R] section), non\-zero otherwise.
1253 In non\-extended register mode, a register name is just the single
1258 .SS Extended Register Mode
1260 unlimited amounts of registers, if extended register mode is enabled.
1262 If extended register mode is enabled (\f[B]\-x\f[R] or
1263 \f[B]\-\-extended\-register\f[R] command\-line arguments are given),
1270 \f[B][a\-z][a\-z0\-9_]*\f[R] (like bc(1) identifiers), and it is a parse
1271 error if the next non\-space characters do not match that regex.
1272 .SH RESET
1273 When dc(1) encounters an error or a signal that it has a non\-default
1284 mode, users can inspect the stack and manipulate it.
1288 Then, if it is interactive mode, and the error was not a fatal error
1340 Set at \f[B]SIZE_MAX\-1\f[R].
1344 Set at \f[B]DC_OVERFLOW_MAX\-1\f[R].
1348 Set at \f[B]DC_OVERFLOW_MAX\-1\f[R].
1352 Set at \f[B]DC_OVERFLOW_MAX\-1\f[R].
1357 Set at \f[B]DC_OVERFLOW_MAX\-1\f[R].
1362 Set at \f[B]2\[ha]DC_LONG_BIT\-1\f[R].
1370 Set at \f[B]SIZE_MAX\-1\f[R].
1372 These limits are meant to be effectively non\-existent; the limits are
1373 so large (at least on 64\-bit machines) that there should not be any
1377 As \f[B]non\-portable extensions\f[R], dc(1) recognizes the following
1381 This is another way to give command\-line arguments to dc(1).
1382 They should be in the same format as all other command\-line arguments.
1385 on the command\-line.
1390 Another use would be to use the \f[B]\-e\f[R] option to set
1408 parsing, though such files are still supported on the command\-line
1415 (\f[B]2\[ha]16\-1\f[R]), dc(1) will output lines to that length,
1426 If dc(1) is not in interactive mode (see the \f[B]INTERACTIVE MODE\f[R]
1428 exits on \f[B]SIGINT\f[R] when not in interactive mode.
1431 However, when dc(1) is in interactive mode, then if this environment
1432 variable exists and contains an integer, a non\-zero value makes dc(1)
1433 reset on \f[B]SIGINT\f[R], rather than exit, and zero makes dc(1) exit.
1438 with the \f[B]\-h\f[R] or \f[B]\-\-help\f[R] options.
1442 If TTY mode is \f[I]not\f[R] available (see the \f[B]TTY MODE\f[R]
1446 However, when TTY mode is available, then if this environment variable
1447 exists and contains an integer, then a non\-zero value makes dc(1) use
1448 TTY mode, and zero makes dc(1) not use TTY mode.
1451 with the \f[B]\-h\f[R] or \f[B]\-\-help\f[R] options.
1455 If TTY mode is \f[I]not\f[R] available (see the \f[B]TTY MODE\f[R]
1459 However, when TTY mode is available, then if this environment variable
1460 exists and contains an integer, a non\-zero value makes dc(1) use a
1461 prompt, and zero or a non\-integer makes dc(1) not use a prompt.
1468 \f[B]\-h\f[R] or \f[B]\-\-help\f[R] options.
1472 If any expressions or expression files are given on the command\-line
1473 with \f[B]\-e\f[R], \f[B]\-\-expression\f[R], \f[B]\-f\f[R], or
1474 \f[B]\-\-file\f[R], then if this environment variable exists and
1475 contains an integer, a non\-zero value makes dc(1) exit after executing
1481 with the \f[B]\-h\f[R] or \f[B]\-\-help\f[R] options.
1486 contains an integer, a non\-zero value makes dc(1) clamp digits that are
1493 This never applies to single\-digit numbers, as per the bc(1) standard
1497 with the \f[B]\-h\f[R] or \f[B]\-\-help\f[R] options.
1513 pseudo\-random number generator, attempting to convert a negative number
1516 to use a non\-integer where an integer is required.
1551 directory as a file, and giving invalid command\-line options.
1555 always exits and returns \f[B]4\f[R], no matter what mode dc(1) is in.
1558 interactive mode (see the \f[B]INTERACTIVE MODE\f[R] section), since
1559 dc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
1560 more input when one of those errors occurs in interactive mode.
1561 This is also the case when interactive mode is forced by the
1562 \f[B]\-i\f[R] flag or \f[B]\-\-interactive\f[R] option.
1566 \f[B]\-i\f[R] flag or \f[B]\-\-interactive\f[R] option.
1567 .SH INTERACTIVE MODE
1568 Like bc(1), dc(1) has an interactive mode and a non\-interactive mode.
1569 Interactive mode is turned on automatically when both \f[B]stdin\f[R]
1570 and \f[B]stdout\f[R] are hooked to a terminal, but the \f[B]\-i\f[R]
1571 flag and \f[B]\-\-interactive\f[R] option can turn it on in other
1574 In interactive mode, dc(1) attempts to recover from errors (see the
1575 \f[B]RESET\f[R] section), and in normal execution, flushes
1577 dc(1) may also reset on \f[B]SIGINT\f[R] instead of exit, depending on
1580 .SH TTY MODE
1582 connected to a TTY, then \[lq]TTY mode\[rq] is considered to be
1583 available, and thus, dc(1) can turn on TTY mode, subject to some
1588 that environment variable contains a non\-zero integer, dc(1) will turn
1589 on TTY mode when \f[B]stdin\f[R], \f[B]stdout\f[R], and \f[B]stderr\f[R]
1592 \f[I]not\f[R] a non\-zero integer, then dc(1) will not turn TTY mode on.
1596 The default setting can be queried with the \f[B]\-h\f[R] or
1597 \f[B]\-\-help\f[R] options.
1599 TTY mode is different from interactive mode because interactive mode is
1601 section), and interactive mode requires only \f[B]stdin\f[R] and
1603 .SS Command\-Line History
1604 Command\-line history is only enabled if TTY mode is, i.e., that
1608 TTY mode.
1611 If TTY mode is available, then a prompt can be enabled.
1612 Like TTY mode itself, it can be turned on or off with an environment
1617 non\-zero integer, then the prompt is turned on when \f[B]stdin\f[R],
1619 \f[B]\-P\f[R] and \f[B]\-\-no\-prompt\f[R] options were not used.
1621 the \f[B]\-R\f[R] and \f[B]\-\-no\-read\-prompt\f[R] options must also
1626 the \f[B]\-P\f[R] and \f[B]\-\-no\-prompt\f[R] options, and the
1627 \f[B]\-R\f[R] and \f[B]\-\-no\-read\-prompt\f[R] options.
1633 If dc(1) is not in interactive mode (see the \f[B]INTERACTIVE MODE\f[R]
1638 However, if dc(1) is in interactive mode, and the
1639 \f[B]DC_SIGINT_RESET\f[R] or its default is an integer and non\-zero,
1640 then dc(1) will stop executing the current input and reset (see the
1641 \f[B]RESET\f[R] section) upon receiving a \f[B]SIGINT\f[R].
1644 If dc(1) is processing input from \f[B]stdin\f[R] in interactive mode,
1646 If dc(1) is processing input from a file in interactive mode, it will
1662 is in TTY mode (see the \f[B]TTY MODE\f[R] section), a \f[B]SIGHUP\f[R]
1665 dc(1) supports interactive command\-line editing.
1667 If dc(1) can be in TTY mode (see the \f[B]TTY MODE\f[R] section),
1669 This means that command\-line history can only be enabled when
1673 Like TTY mode itself, it can be turned on or off with the environment
1685 operators in the IEEE Std 1003.1\-2017 (\[lq]POSIX.1\-2017\[rq]) bc(1)