Import new 2-clause BSD licenced implementation of the bc and dc commands
These implementations of the bc and dc programs offer a number of advantages
compared to the current implementations in the FreeBSD base system:
- They do not depend on external large number functions (i.e. no dependency
on OpenSSL or any other large number library)
- They implements all features found in GNU bc/dc (with the exception of
the forking of sub-processes, which the author of this version considers
as a security issue).
- They are significantly faster than the current code in base (more than
2 orders of magnitude in some of my tests, e.g. for 12345^100000).
- They should be fully compatible with all features and the behavior of the
current implementations in FreeBSD (not formally verified).
- They support POSIX message catalogs and come with localized messages in
Chinese, Dutch, English, French, German, Japanese, Polish, Portugueze,
and Russian.
- They offer very detailed man-pages that provide far more information than
the current ones.
Approved by: imp
Obtained from: https://git.yzena.com/gavin/bc
Differential Revision: https://reviews.freebsd.org/D19982
2020-06-27 15:03:19 +00:00
|
|
|
/*
|
|
|
|
* *****************************************************************************
|
|
|
|
*
|
2020-07-07 07:02:33 +00:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
Import new 2-clause BSD licenced implementation of the bc and dc commands
These implementations of the bc and dc programs offer a number of advantages
compared to the current implementations in the FreeBSD base system:
- They do not depend on external large number functions (i.e. no dependency
on OpenSSL or any other large number library)
- They implements all features found in GNU bc/dc (with the exception of
the forking of sub-processes, which the author of this version considers
as a security issue).
- They are significantly faster than the current code in base (more than
2 orders of magnitude in some of my tests, e.g. for 12345^100000).
- They should be fully compatible with all features and the behavior of the
current implementations in FreeBSD (not formally verified).
- They support POSIX message catalogs and come with localized messages in
Chinese, Dutch, English, French, German, Japanese, Polish, Portugueze,
and Russian.
- They offer very detailed man-pages that provide far more information than
the current ones.
Approved by: imp
Obtained from: https://git.yzena.com/gavin/bc
Differential Revision: https://reviews.freebsd.org/D19982
2020-06-27 15:03:19 +00:00
|
|
|
*
|
2023-01-28 20:02:27 +00:00
|
|
|
* Copyright (c) 2018-2023 Gavin D. Howard and contributors.
|
Import new 2-clause BSD licenced implementation of the bc and dc commands
These implementations of the bc and dc programs offer a number of advantages
compared to the current implementations in the FreeBSD base system:
- They do not depend on external large number functions (i.e. no dependency
on OpenSSL or any other large number library)
- They implements all features found in GNU bc/dc (with the exception of
the forking of sub-processes, which the author of this version considers
as a security issue).
- They are significantly faster than the current code in base (more than
2 orders of magnitude in some of my tests, e.g. for 12345^100000).
- They should be fully compatible with all features and the behavior of the
current implementations in FreeBSD (not formally verified).
- They support POSIX message catalogs and come with localized messages in
Chinese, Dutch, English, French, German, Japanese, Polish, Portugueze,
and Russian.
- They offer very detailed man-pages that provide far more information than
the current ones.
Approved by: imp
Obtained from: https://git.yzena.com/gavin/bc
Differential Revision: https://reviews.freebsd.org/D19982
2020-06-27 15:03:19 +00:00
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions are met:
|
|
|
|
*
|
|
|
|
* * Redistributions of source code must retain the above copyright notice, this
|
|
|
|
* list of conditions and the following disclaimer.
|
|
|
|
*
|
|
|
|
* * Redistributions in binary form must reproduce the above copyright notice,
|
|
|
|
* this list of conditions and the following disclaimer in the documentation
|
|
|
|
* and/or other materials provided with the distribution.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
|
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
|
|
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
|
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
|
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
|
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
|
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
|
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
* POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*
|
|
|
|
* *****************************************************************************
|
|
|
|
*
|
|
|
|
* The bc help text.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
usage: %s [options] [file...]
|
|
|
|
|
|
|
|
bc is a command-line, arbitrary-precision calculator with a Turing-complete
|
2021-04-06 08:44:52 +00:00
|
|
|
language. For details, use `man %s` or see the online documentation at
|
2023-02-06 21:33:56 +00:00
|
|
|
https://git.gavinhoward.com/gavin/bc/src/tag/%s/manuals/bc/%s.1.md.
|
Import new 2-clause BSD licenced implementation of the bc and dc commands
These implementations of the bc and dc programs offer a number of advantages
compared to the current implementations in the FreeBSD base system:
- They do not depend on external large number functions (i.e. no dependency
on OpenSSL or any other large number library)
- They implements all features found in GNU bc/dc (with the exception of
the forking of sub-processes, which the author of this version considers
as a security issue).
- They are significantly faster than the current code in base (more than
2 orders of magnitude in some of my tests, e.g. for 12345^100000).
- They should be fully compatible with all features and the behavior of the
current implementations in FreeBSD (not formally verified).
- They support POSIX message catalogs and come with localized messages in
Chinese, Dutch, English, French, German, Japanese, Polish, Portugueze,
and Russian.
- They offer very detailed man-pages that provide far more information than
the current ones.
Approved by: imp
Obtained from: https://git.yzena.com/gavin/bc
Differential Revision: https://reviews.freebsd.org/D19982
2020-06-27 15:03:19 +00:00
|
|
|
|
|
|
|
This bc is compatible with both the GNU bc and the POSIX bc spec. See the GNU bc
|
|
|
|
manual (https://www.gnu.org/software/bc/manual/bc.html) and bc spec
|
|
|
|
(http://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
|
|
|
|
for details.
|
|
|
|
|
|
|
|
This bc has three differences to the GNU bc:
|
|
|
|
|
|
|
|
1) Arrays can be passed to the builtin "length" function to get the number of
|
|
|
|
elements currently in the array. The following example prints "1":
|
|
|
|
|
|
|
|
a[0] = 0
|
|
|
|
length(a[])
|
|
|
|
|
|
|
|
2) The precedence of the boolean "not" operator (!) is equal to that of the
|
|
|
|
unary minus (-), or negation, operator. This still allows POSIX-compliant
|
|
|
|
scripts to work while somewhat preserving expected behavior (versus C) and
|
|
|
|
making parsing easier.
|
|
|
|
3) This bc has many more extensions than the GNU bc does. For details, see the
|
2021-04-06 08:44:52 +00:00
|
|
|
man page or online documentation.
|
Import new 2-clause BSD licenced implementation of the bc and dc commands
These implementations of the bc and dc programs offer a number of advantages
compared to the current implementations in the FreeBSD base system:
- They do not depend on external large number functions (i.e. no dependency
on OpenSSL or any other large number library)
- They implements all features found in GNU bc/dc (with the exception of
the forking of sub-processes, which the author of this version considers
as a security issue).
- They are significantly faster than the current code in base (more than
2 orders of magnitude in some of my tests, e.g. for 12345^100000).
- They should be fully compatible with all features and the behavior of the
current implementations in FreeBSD (not formally verified).
- They support POSIX message catalogs and come with localized messages in
Chinese, Dutch, English, French, German, Japanese, Polish, Portugueze,
and Russian.
- They offer very detailed man-pages that provide far more information than
the current ones.
Approved by: imp
Obtained from: https://git.yzena.com/gavin/bc
Differential Revision: https://reviews.freebsd.org/D19982
2020-06-27 15:03:19 +00:00
|
|
|
|
2020-07-07 07:02:33 +00:00
|
|
|
This bc also implements the dot (.) extension of the BSD bc.
|
|
|
|
|
Import new 2-clause BSD licenced implementation of the bc and dc commands
These implementations of the bc and dc programs offer a number of advantages
compared to the current implementations in the FreeBSD base system:
- They do not depend on external large number functions (i.e. no dependency
on OpenSSL or any other large number library)
- They implements all features found in GNU bc/dc (with the exception of
the forking of sub-processes, which the author of this version considers
as a security issue).
- They are significantly faster than the current code in base (more than
2 orders of magnitude in some of my tests, e.g. for 12345^100000).
- They should be fully compatible with all features and the behavior of the
current implementations in FreeBSD (not formally verified).
- They support POSIX message catalogs and come with localized messages in
Chinese, Dutch, English, French, German, Japanese, Polish, Portugueze,
and Russian.
- They offer very detailed man-pages that provide far more information than
the current ones.
Approved by: imp
Obtained from: https://git.yzena.com/gavin/bc
Differential Revision: https://reviews.freebsd.org/D19982
2020-06-27 15:03:19 +00:00
|
|
|
Options:
|
2022-08-30 18:35:22 +00:00
|
|
|
|
|
|
|
-C --no-digit-clamp
|
|
|
|
|
|
|
|
Disables clamping of digits that are larger than or equal to the current
|
|
|
|
ibase when parsing numbers.
|
|
|
|
|
|
|
|
This means that the value added to a number from a digit is always that
|
|
|
|
digit's value multiplied by the value of ibase raised to the power of the
|
|
|
|
digit's position, which starts from 0 at the least significant digit.
|
|
|
|
|
|
|
|
If multiple of this option and the -c option are given, the last is used.
|
|
|
|
|
|
|
|
-c --digit-clamp
|
|
|
|
|
|
|
|
Enables clamping of digits that are larger than or equal to the current
|
|
|
|
ibase when parsing numbers.
|
|
|
|
|
|
|
|
This means that digits that the value added to a number from a digit that
|
|
|
|
is greater than or equal to the ibase is the value of ibase minus 1 all
|
|
|
|
multiplied by the value of ibase raised to the power of the digit's
|
|
|
|
position, which starts from 0 at the least significant digit.
|
|
|
|
|
|
|
|
If multiple of this option and the -C option are given, the last is used.
|
2022-06-11 09:50:28 +00:00
|
|
|
{{ A H N HN }}
|
|
|
|
|
|
|
|
-E seed --seed=seed
|
|
|
|
|
|
|
|
Sets the builtin variable seed to the given value assuming that the given
|
|
|
|
value is in base 10. It is a fatal error if the given value is not a valid
|
|
|
|
number.
|
|
|
|
{{ end }}
|
Import new 2-clause BSD licenced implementation of the bc and dc commands
These implementations of the bc and dc programs offer a number of advantages
compared to the current implementations in the FreeBSD base system:
- They do not depend on external large number functions (i.e. no dependency
on OpenSSL or any other large number library)
- They implements all features found in GNU bc/dc (with the exception of
the forking of sub-processes, which the author of this version considers
as a security issue).
- They are significantly faster than the current code in base (more than
2 orders of magnitude in some of my tests, e.g. for 12345^100000).
- They should be fully compatible with all features and the behavior of the
current implementations in FreeBSD (not formally verified).
- They support POSIX message catalogs and come with localized messages in
Chinese, Dutch, English, French, German, Japanese, Polish, Portugueze,
and Russian.
- They offer very detailed man-pages that provide far more information than
the current ones.
Approved by: imp
Obtained from: https://git.yzena.com/gavin/bc
Differential Revision: https://reviews.freebsd.org/D19982
2020-06-27 15:03:19 +00:00
|
|
|
|
|
|
|
-e expr --expression=expr
|
|
|
|
|
|
|
|
Run "expr" and quit. If multiple expressions or files (see below) are
|
|
|
|
given, they are all run before executing from stdin.
|
|
|
|
|
|
|
|
-f file --file=file
|
|
|
|
|
|
|
|
Run the bc code in "file" and exit. See above as well.
|
|
|
|
|
|
|
|
-g --global-stacks
|
|
|
|
|
|
|
|
Turn scale, ibase, and obase into stacks. This makes the value of each be
|
2021-04-06 08:44:52 +00:00
|
|
|
be restored on returning from functions. See the man page or online
|
|
|
|
documentation for more details.
|
Import new 2-clause BSD licenced implementation of the bc and dc commands
These implementations of the bc and dc programs offer a number of advantages
compared to the current implementations in the FreeBSD base system:
- They do not depend on external large number functions (i.e. no dependency
on OpenSSL or any other large number library)
- They implements all features found in GNU bc/dc (with the exception of
the forking of sub-processes, which the author of this version considers
as a security issue).
- They are significantly faster than the current code in base (more than
2 orders of magnitude in some of my tests, e.g. for 12345^100000).
- They should be fully compatible with all features and the behavior of the
current implementations in FreeBSD (not formally verified).
- They support POSIX message catalogs and come with localized messages in
Chinese, Dutch, English, French, German, Japanese, Polish, Portugueze,
and Russian.
- They offer very detailed man-pages that provide far more information than
the current ones.
Approved by: imp
Obtained from: https://git.yzena.com/gavin/bc
Differential Revision: https://reviews.freebsd.org/D19982
2020-06-27 15:03:19 +00:00
|
|
|
|
|
|
|
-h --help
|
|
|
|
|
|
|
|
Print this usage message and exit.
|
|
|
|
|
2022-06-11 09:50:28 +00:00
|
|
|
-I ibase --ibase=ibase
|
|
|
|
|
|
|
|
Sets the builtin variable ibase to the given value assuming that the given
|
|
|
|
value is in base 10. It is a fatal error if the given value is not a valid
|
|
|
|
number.
|
|
|
|
|
Import new 2-clause BSD licenced implementation of the bc and dc commands
These implementations of the bc and dc programs offer a number of advantages
compared to the current implementations in the FreeBSD base system:
- They do not depend on external large number functions (i.e. no dependency
on OpenSSL or any other large number library)
- They implements all features found in GNU bc/dc (with the exception of
the forking of sub-processes, which the author of this version considers
as a security issue).
- They are significantly faster than the current code in base (more than
2 orders of magnitude in some of my tests, e.g. for 12345^100000).
- They should be fully compatible with all features and the behavior of the
current implementations in FreeBSD (not formally verified).
- They support POSIX message catalogs and come with localized messages in
Chinese, Dutch, English, French, German, Japanese, Polish, Portugueze,
and Russian.
- They offer very detailed man-pages that provide far more information than
the current ones.
Approved by: imp
Obtained from: https://git.yzena.com/gavin/bc
Differential Revision: https://reviews.freebsd.org/D19982
2020-06-27 15:03:19 +00:00
|
|
|
-i --interactive
|
|
|
|
|
|
|
|
Force interactive mode.
|
|
|
|
|
2021-10-04 19:22:35 +00:00
|
|
|
-L --no-line-length
|
|
|
|
|
|
|
|
Disable line length checking.
|
|
|
|
|
Import new 2-clause BSD licenced implementation of the bc and dc commands
These implementations of the bc and dc programs offer a number of advantages
compared to the current implementations in the FreeBSD base system:
- They do not depend on external large number functions (i.e. no dependency
on OpenSSL or any other large number library)
- They implements all features found in GNU bc/dc (with the exception of
the forking of sub-processes, which the author of this version considers
as a security issue).
- They are significantly faster than the current code in base (more than
2 orders of magnitude in some of my tests, e.g. for 12345^100000).
- They should be fully compatible with all features and the behavior of the
current implementations in FreeBSD (not formally verified).
- They support POSIX message catalogs and come with localized messages in
Chinese, Dutch, English, French, German, Japanese, Polish, Portugueze,
and Russian.
- They offer very detailed man-pages that provide far more information than
the current ones.
Approved by: imp
Obtained from: https://git.yzena.com/gavin/bc
Differential Revision: https://reviews.freebsd.org/D19982
2020-06-27 15:03:19 +00:00
|
|
|
-l --mathlib
|
|
|
|
|
|
|
|
Use predefined math routines:
|
|
|
|
|
|
|
|
s(expr) = sine of expr in radians
|
|
|
|
c(expr) = cosine of expr in radians
|
|
|
|
a(expr) = arctangent of expr, returning radians
|
|
|
|
l(expr) = natural log of expr
|
|
|
|
e(expr) = raises e to the power of expr
|
|
|
|
j(n, x) = Bessel function of integer order n of x
|
|
|
|
|
2021-04-06 08:44:52 +00:00
|
|
|
This bc may load more functions with these options. See the manpage or
|
|
|
|
online documentation for details.
|
2020-07-07 07:02:33 +00:00
|
|
|
|
2022-06-11 09:50:28 +00:00
|
|
|
-O obase --obase=obase
|
|
|
|
|
|
|
|
Sets the builtin variable obase to the given value assuming that the given
|
|
|
|
value is in base 10. It is a fatal error if the given value is not a valid
|
|
|
|
number.
|
|
|
|
|
Import new 2-clause BSD licenced implementation of the bc and dc commands
These implementations of the bc and dc programs offer a number of advantages
compared to the current implementations in the FreeBSD base system:
- They do not depend on external large number functions (i.e. no dependency
on OpenSSL or any other large number library)
- They implements all features found in GNU bc/dc (with the exception of
the forking of sub-processes, which the author of this version considers
as a security issue).
- They are significantly faster than the current code in base (more than
2 orders of magnitude in some of my tests, e.g. for 12345^100000).
- They should be fully compatible with all features and the behavior of the
current implementations in FreeBSD (not formally verified).
- They support POSIX message catalogs and come with localized messages in
Chinese, Dutch, English, French, German, Japanese, Polish, Portugueze,
and Russian.
- They offer very detailed man-pages that provide far more information than
the current ones.
Approved by: imp
Obtained from: https://git.yzena.com/gavin/bc
Differential Revision: https://reviews.freebsd.org/D19982
2020-06-27 15:03:19 +00:00
|
|
|
-P --no-prompt
|
|
|
|
|
2021-04-06 08:44:52 +00:00
|
|
|
Disable the prompts in interactive mode.
|
|
|
|
|
|
|
|
-R --no-read-prompt
|
|
|
|
|
|
|
|
Disable the read prompt in interactive mode.
|
Import new 2-clause BSD licenced implementation of the bc and dc commands
These implementations of the bc and dc programs offer a number of advantages
compared to the current implementations in the FreeBSD base system:
- They do not depend on external large number functions (i.e. no dependency
on OpenSSL or any other large number library)
- They implements all features found in GNU bc/dc (with the exception of
the forking of sub-processes, which the author of this version considers
as a security issue).
- They are significantly faster than the current code in base (more than
2 orders of magnitude in some of my tests, e.g. for 12345^100000).
- They should be fully compatible with all features and the behavior of the
current implementations in FreeBSD (not formally verified).
- They support POSIX message catalogs and come with localized messages in
Chinese, Dutch, English, French, German, Japanese, Polish, Portugueze,
and Russian.
- They offer very detailed man-pages that provide far more information than
the current ones.
Approved by: imp
Obtained from: https://git.yzena.com/gavin/bc
Differential Revision: https://reviews.freebsd.org/D19982
2020-06-27 15:03:19 +00:00
|
|
|
|
vendor/bc: imoport release 5.0.0
This is a new major release with a number of changes and extensions:
- Limited the number of temporary numbers and made the space for them
static so that allocating more space for them cannot fail.
- Allowed integers with non-zero scale to be used with power, places,
and shift operators.
- Added greatest common divisor and least common multiple to lib2.bc.
- Made bc and dc UTF-8 capable.
- Added the ability for users to have bc and dc quit on SIGINT.
- Added the ability for users to disable prompt and TTY mode by
environment variables.
- Added the ability for users to redefine keywords.
- Added dc's modular exponentiation and divmod to bc.
- Added the ability to assign strings to variables and array elements
and pass them to functions in bc.
- Added dc's asciify command and stream printing to bc.
- Added bitwise and, or, xor, left shift, right shift, reverse,
left rotate, right rotate, and mod functions to lib2.bc.
- Added the functions s2u(x) and s2un(x,n), to lib2.bc.
2021-08-09 20:32:55 +00:00
|
|
|
-r keyword --redefine=keyword
|
|
|
|
|
|
|
|
Redefines "keyword" and allows it to be used as a function, variable, and
|
|
|
|
array name. This is useful when this bc gives parse errors on scripts
|
|
|
|
meant for other bc implementations.
|
|
|
|
|
|
|
|
Only keywords that are not in the POSIX bc spec may be redefined.
|
|
|
|
|
|
|
|
It is a fatal error to attempt to redefine a keyword that cannot be
|
|
|
|
redefined or does not exist.
|
|
|
|
|
Import new 2-clause BSD licenced implementation of the bc and dc commands
These implementations of the bc and dc programs offer a number of advantages
compared to the current implementations in the FreeBSD base system:
- They do not depend on external large number functions (i.e. no dependency
on OpenSSL or any other large number library)
- They implements all features found in GNU bc/dc (with the exception of
the forking of sub-processes, which the author of this version considers
as a security issue).
- They are significantly faster than the current code in base (more than
2 orders of magnitude in some of my tests, e.g. for 12345^100000).
- They should be fully compatible with all features and the behavior of the
current implementations in FreeBSD (not formally verified).
- They support POSIX message catalogs and come with localized messages in
Chinese, Dutch, English, French, German, Japanese, Polish, Portugueze,
and Russian.
- They offer very detailed man-pages that provide far more information than
the current ones.
Approved by: imp
Obtained from: https://git.yzena.com/gavin/bc
Differential Revision: https://reviews.freebsd.org/D19982
2020-06-27 15:03:19 +00:00
|
|
|
-q --quiet
|
|
|
|
|
|
|
|
Don't print version and copyright.
|
|
|
|
|
2022-06-11 09:50:28 +00:00
|
|
|
-S scale --scale=scale
|
|
|
|
|
|
|
|
Sets the builtin variable scale to the given value assuming that the given
|
|
|
|
value is in base 10. It is a fatal error if the given value is not a valid
|
|
|
|
number.
|
|
|
|
|
Import new 2-clause BSD licenced implementation of the bc and dc commands
These implementations of the bc and dc programs offer a number of advantages
compared to the current implementations in the FreeBSD base system:
- They do not depend on external large number functions (i.e. no dependency
on OpenSSL or any other large number library)
- They implements all features found in GNU bc/dc (with the exception of
the forking of sub-processes, which the author of this version considers
as a security issue).
- They are significantly faster than the current code in base (more than
2 orders of magnitude in some of my tests, e.g. for 12345^100000).
- They should be fully compatible with all features and the behavior of the
current implementations in FreeBSD (not formally verified).
- They support POSIX message catalogs and come with localized messages in
Chinese, Dutch, English, French, German, Japanese, Polish, Portugueze,
and Russian.
- They offer very detailed man-pages that provide far more information than
the current ones.
Approved by: imp
Obtained from: https://git.yzena.com/gavin/bc
Differential Revision: https://reviews.freebsd.org/D19982
2020-06-27 15:03:19 +00:00
|
|
|
-s --standard
|
|
|
|
|
|
|
|
Error if any non-POSIX extensions are used.
|
|
|
|
|
|
|
|
-w --warn
|
|
|
|
|
|
|
|
Warn if any non-POSIX extensions are used.
|
|
|
|
|
|
|
|
-v --version
|
|
|
|
|
|
|
|
Print version information and copyright and exit.
|
vendor/bc: imoport release 5.0.0
This is a new major release with a number of changes and extensions:
- Limited the number of temporary numbers and made the space for them
static so that allocating more space for them cannot fail.
- Allowed integers with non-zero scale to be used with power, places,
and shift operators.
- Added greatest common divisor and least common multiple to lib2.bc.
- Made bc and dc UTF-8 capable.
- Added the ability for users to have bc and dc quit on SIGINT.
- Added the ability for users to disable prompt and TTY mode by
environment variables.
- Added the ability for users to redefine keywords.
- Added dc's modular exponentiation and divmod to bc.
- Added the ability to assign strings to variables and array elements
and pass them to functions in bc.
- Added dc's asciify command and stream printing to bc.
- Added bitwise and, or, xor, left shift, right shift, reverse,
left rotate, right rotate, and mod functions to lib2.bc.
- Added the functions s2u(x) and s2un(x,n), to lib2.bc.
2021-08-09 20:32:55 +00:00
|
|
|
|
2021-10-04 19:22:35 +00:00
|
|
|
-z --leading-zeroes
|
|
|
|
|
|
|
|
Enable leading zeroes on numbers greater than -1 and less than 1.
|
|
|
|
|
vendor/bc: imoport release 5.0.0
This is a new major release with a number of changes and extensions:
- Limited the number of temporary numbers and made the space for them
static so that allocating more space for them cannot fail.
- Allowed integers with non-zero scale to be used with power, places,
and shift operators.
- Added greatest common divisor and least common multiple to lib2.bc.
- Made bc and dc UTF-8 capable.
- Added the ability for users to have bc and dc quit on SIGINT.
- Added the ability for users to disable prompt and TTY mode by
environment variables.
- Added the ability for users to redefine keywords.
- Added dc's modular exponentiation and divmod to bc.
- Added the ability to assign strings to variables and array elements
and pass them to functions in bc.
- Added dc's asciify command and stream printing to bc.
- Added bitwise and, or, xor, left shift, right shift, reverse,
left rotate, right rotate, and mod functions to lib2.bc.
- Added the functions s2u(x) and s2un(x,n), to lib2.bc.
2021-08-09 20:32:55 +00:00
|
|
|
Environment variables:
|
|
|
|
|
|
|
|
POSIXLY_CORRECT
|
|
|
|
|
|
|
|
Error if any non-POSIX extensions are used.
|
|
|
|
|
|
|
|
BC_ENV_ARGS
|
|
|
|
|
|
|
|
Command-line arguments to use on every run.
|
|
|
|
|
|
|
|
BC_LINE_LENGTH
|
|
|
|
|
|
|
|
If an integer, the number of characters to print on a line before
|
2021-10-04 19:22:35 +00:00
|
|
|
wrapping. Using 0 will disable line length checking.
|
vendor/bc: imoport release 5.0.0
This is a new major release with a number of changes and extensions:
- Limited the number of temporary numbers and made the space for them
static so that allocating more space for them cannot fail.
- Allowed integers with non-zero scale to be used with power, places,
and shift operators.
- Added greatest common divisor and least common multiple to lib2.bc.
- Made bc and dc UTF-8 capable.
- Added the ability for users to have bc and dc quit on SIGINT.
- Added the ability for users to disable prompt and TTY mode by
environment variables.
- Added the ability for users to redefine keywords.
- Added dc's modular exponentiation and divmod to bc.
- Added the ability to assign strings to variables and array elements
and pass them to functions in bc.
- Added dc's asciify command and stream printing to bc.
- Added bitwise and, or, xor, left shift, right shift, reverse,
left rotate, right rotate, and mod functions to lib2.bc.
- Added the functions s2u(x) and s2un(x,n), to lib2.bc.
2021-08-09 20:32:55 +00:00
|
|
|
|
|
|
|
BC_BANNER
|
|
|
|
|
|
|
|
If an integer and non-zero, display the copyright banner in interactive
|
|
|
|
mode.
|
|
|
|
|
2022-08-30 18:35:22 +00:00
|
|
|
If zero, disable the banner.
|
|
|
|
|
vendor/bc: imoport release 5.0.0
This is a new major release with a number of changes and extensions:
- Limited the number of temporary numbers and made the space for them
static so that allocating more space for them cannot fail.
- Allowed integers with non-zero scale to be used with power, places,
and shift operators.
- Added greatest common divisor and least common multiple to lib2.bc.
- Made bc and dc UTF-8 capable.
- Added the ability for users to have bc and dc quit on SIGINT.
- Added the ability for users to disable prompt and TTY mode by
environment variables.
- Added the ability for users to redefine keywords.
- Added dc's modular exponentiation and divmod to bc.
- Added the ability to assign strings to variables and array elements
and pass them to functions in bc.
- Added dc's asciify command and stream printing to bc.
- Added bitwise and, or, xor, left shift, right shift, reverse,
left rotate, right rotate, and mod functions to lib2.bc.
- Added the functions s2u(x) and s2un(x,n), to lib2.bc.
2021-08-09 20:32:55 +00:00
|
|
|
Overrides the default, which is %s print the banner.
|
|
|
|
|
|
|
|
BC_SIGINT_RESET
|
|
|
|
|
|
|
|
If an integer and non-zero, reset on SIGINT, rather than exit, when in
|
|
|
|
interactive mode.
|
|
|
|
|
2022-08-30 18:35:22 +00:00
|
|
|
If zero, do not reset on SIGINT in all cases, but exit instead.
|
|
|
|
|
vendor/bc: imoport release 5.0.0
This is a new major release with a number of changes and extensions:
- Limited the number of temporary numbers and made the space for them
static so that allocating more space for them cannot fail.
- Allowed integers with non-zero scale to be used with power, places,
and shift operators.
- Added greatest common divisor and least common multiple to lib2.bc.
- Made bc and dc UTF-8 capable.
- Added the ability for users to have bc and dc quit on SIGINT.
- Added the ability for users to disable prompt and TTY mode by
environment variables.
- Added the ability for users to redefine keywords.
- Added dc's modular exponentiation and divmod to bc.
- Added the ability to assign strings to variables and array elements
and pass them to functions in bc.
- Added dc's asciify command and stream printing to bc.
- Added bitwise and, or, xor, left shift, right shift, reverse,
left rotate, right rotate, and mod functions to lib2.bc.
- Added the functions s2u(x) and s2un(x,n), to lib2.bc.
2021-08-09 20:32:55 +00:00
|
|
|
Overrides the default, which is %s.
|
|
|
|
|
|
|
|
BC_TTY_MODE
|
|
|
|
|
|
|
|
If an integer and non-zero, enable TTY mode when it is available.
|
|
|
|
|
2022-08-30 18:35:22 +00:00
|
|
|
If zero, disable TTY mode in all cases.
|
|
|
|
|
vendor/bc: imoport release 5.0.0
This is a new major release with a number of changes and extensions:
- Limited the number of temporary numbers and made the space for them
static so that allocating more space for them cannot fail.
- Allowed integers with non-zero scale to be used with power, places,
and shift operators.
- Added greatest common divisor and least common multiple to lib2.bc.
- Made bc and dc UTF-8 capable.
- Added the ability for users to have bc and dc quit on SIGINT.
- Added the ability for users to disable prompt and TTY mode by
environment variables.
- Added the ability for users to redefine keywords.
- Added dc's modular exponentiation and divmod to bc.
- Added the ability to assign strings to variables and array elements
and pass them to functions in bc.
- Added dc's asciify command and stream printing to bc.
- Added bitwise and, or, xor, left shift, right shift, reverse,
left rotate, right rotate, and mod functions to lib2.bc.
- Added the functions s2u(x) and s2un(x,n), to lib2.bc.
2021-08-09 20:32:55 +00:00
|
|
|
Overrides the default, which is TTY mode %s.
|
|
|
|
|
|
|
|
BC_PROMPT
|
|
|
|
|
|
|
|
If an integer and non-zero, enable prompt when TTY mode is possible.
|
|
|
|
|
2022-08-30 18:35:22 +00:00
|
|
|
If zero, disable prompt in all cases.
|
|
|
|
|
vendor/bc: imoport release 5.0.0
This is a new major release with a number of changes and extensions:
- Limited the number of temporary numbers and made the space for them
static so that allocating more space for them cannot fail.
- Allowed integers with non-zero scale to be used with power, places,
and shift operators.
- Added greatest common divisor and least common multiple to lib2.bc.
- Made bc and dc UTF-8 capable.
- Added the ability for users to have bc and dc quit on SIGINT.
- Added the ability for users to disable prompt and TTY mode by
environment variables.
- Added the ability for users to redefine keywords.
- Added dc's modular exponentiation and divmod to bc.
- Added the ability to assign strings to variables and array elements
and pass them to functions in bc.
- Added dc's asciify command and stream printing to bc.
- Added bitwise and, or, xor, left shift, right shift, reverse,
left rotate, right rotate, and mod functions to lib2.bc.
- Added the functions s2u(x) and s2un(x,n), to lib2.bc.
2021-08-09 20:32:55 +00:00
|
|
|
Overrides the default, which is prompt %s.
|
2021-11-30 17:26:22 +00:00
|
|
|
|
|
|
|
BC_EXPR_EXIT
|
|
|
|
|
|
|
|
If an integer and non-zero, exit when expressions or expression files are
|
|
|
|
given on the command-line, and does not exit when an integer and zero.
|
|
|
|
|
|
|
|
Overrides the default, which is %s.
|
2022-08-30 18:35:22 +00:00
|
|
|
|
|
|
|
BC_DIGIT_CLAMP
|
|
|
|
|
|
|
|
If an integer and non-zero, clamp digits larger than or equal to the
|
|
|
|
current ibase when parsing numbers.
|
|
|
|
|
|
|
|
Overrides the default, which is %s.
|