2 * *****************************************************************************
4 * SPDX-License-Identifier: BSD-2-Clause
6 * Copyright (c) 2018-2021 Gavin D. Howard and contributors.
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions are met:
11 * * Redistributions of source code must retain the above copyright notice, this
12 * list of conditions and the following disclaimer.
14 * * Redistributions in binary form must reproduce the above copyright notice,
15 * this list of conditions and the following disclaimer in the documentation
16 * and/or other materials provided with the distribution.
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
22 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 * POSSIBILITY OF SUCH DAMAGE.
30 * *****************************************************************************
36 usage: %s [options] [file...]
38 bc is a command-line, arbitrary-precision calculator with a Turing-complete
39 language. For details, use `man %s` or see the online documentation at
40 https://git.yzena.com/gavin/bc/src/tag/%s/manuals/bc/%s.1.md.
42 This bc is compatible with both the GNU bc and the POSIX bc spec. See the GNU bc
43 manual (https://www.gnu.org/software/bc/manual/bc.html) and bc spec
44 (http://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
47 This bc has three differences to the GNU bc:
49 1) Arrays can be passed to the builtin "length" function to get the number of
50 elements currently in the array. The following example prints "1":
55 2) The precedence of the boolean "not" operator (!) is equal to that of the
56 unary minus (-), or negation, operator. This still allows POSIX-compliant
57 scripts to work while somewhat preserving expected behavior (versus C) and
58 making parsing easier.
59 3) This bc has many more extensions than the GNU bc does. For details, see the
60 man page or online documentation.
62 This bc also implements the dot (.) extension of the BSD bc.
66 -e expr --expression=expr
68 Run "expr" and quit. If multiple expressions or files (see below) are
69 given, they are all run before executing from stdin.
73 Run the bc code in "file" and exit. See above as well.
77 Turn scale, ibase, and obase into stacks. This makes the value of each be
78 be restored on returning from functions. See the man page or online
79 documentation for more details.
83 Print this usage message and exit.
87 Force interactive mode.
91 Disable line length checking.
95 Use predefined math routines:
97 s(expr) = sine of expr in radians
98 c(expr) = cosine of expr in radians
99 a(expr) = arctangent of expr, returning radians
100 l(expr) = natural log of expr
101 e(expr) = raises e to the power of expr
102 j(n, x) = Bessel function of integer order n of x
104 This bc may load more functions with these options. See the manpage or
105 online documentation for details.
109 Disable the prompts in interactive mode.
113 Disable the read prompt in interactive mode.
115 -r keyword --redefine=keyword
117 Redefines "keyword" and allows it to be used as a function, variable, and
118 array name. This is useful when this bc gives parse errors on scripts
119 meant for other bc implementations.
121 Only keywords that are not in the POSIX bc spec may be redefined.
123 It is a fatal error to attempt to redefine a keyword that cannot be
124 redefined or does not exist.
128 Don't print version and copyright.
132 Error if any non-POSIX extensions are used.
136 Warn if any non-POSIX extensions are used.
140 Print version information and copyright and exit.
144 Enable leading zeroes on numbers greater than -1 and less than 1.
146 Environment variables:
150 Error if any non-POSIX extensions are used.
154 Command-line arguments to use on every run.
158 If an integer, the number of characters to print on a line before
159 wrapping. Using 0 will disable line length checking.
163 If an integer and non-zero, display the copyright banner in interactive
166 Overrides the default, which is %s print the banner.
170 If an integer and non-zero, reset on SIGINT, rather than exit, when in
173 Overrides the default, which is %s.
177 If an integer and non-zero, enable TTY mode when it is available.
179 Overrides the default, which is TTY mode %s.
183 If an integer and non-zero, enable prompt when TTY mode is possible.
185 Overrides the default, which is prompt %s.