1/* 2 * ***************************************************************************** 3 * 4 * SPDX-License-Identifier: BSD-2-Clause 5 * 6 * Copyright (c) 2018-2021 Gavin D. Howard and contributors. 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions are met: 10 * 11 * * Redistributions of source code must retain the above copyright notice, this 12 * list of conditions and the following disclaimer. 13 * 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. 17 * 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. 29 * 30 * ***************************************************************************** 31 * 32 * The bc help text. 33 * 34 */ 35 36usage: %s [options] [file...] 37 38bc is a command-line, arbitrary-precision calculator with a Turing-complete 39language. For details, use `man %s` or see the online documentation at 40https://git.yzena.com/gavin/bc/src/tag/%s/manuals/bc/%s.1.md. 41 42This bc is compatible with both the GNU bc and the POSIX bc spec. See the GNU bc 43manual (https://www.gnu.org/software/bc/manual/bc.html) and bc spec 44(http://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html) 45for details. 46 47This bc has three differences to the GNU bc: 48 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": 51 52 a[0] = 0 53 length(a[]) 54 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. 61 62This bc also implements the dot (.) extension of the BSD bc. 63 64Options: 65 66 -e expr --expression=expr 67 68 Run "expr" and quit. If multiple expressions or files (see below) are 69 given, they are all run before executing from stdin. 70 71 -f file --file=file 72 73 Run the bc code in "file" and exit. See above as well. 74 75 -g --global-stacks 76 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. 80 81 -h --help 82 83 Print this usage message and exit. 84 85 -i --interactive 86 87 Force interactive mode. 88 89 -L --no-line-length 90 91 Disable line length checking. 92 93 -l --mathlib 94 95 Use predefined math routines: 96 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 103 104 This bc may load more functions with these options. See the manpage or 105 online documentation for details. 106 107 -P --no-prompt 108 109 Disable the prompts in interactive mode. 110 111 -R --no-read-prompt 112 113 Disable the read prompt in interactive mode. 114 115 -r keyword --redefine=keyword 116 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. 120 121 Only keywords that are not in the POSIX bc spec may be redefined. 122 123 It is a fatal error to attempt to redefine a keyword that cannot be 124 redefined or does not exist. 125 126 -q --quiet 127 128 Don't print version and copyright. 129 130 -s --standard 131 132 Error if any non-POSIX extensions are used. 133 134 -w --warn 135 136 Warn if any non-POSIX extensions are used. 137 138 -v --version 139 140 Print version information and copyright and exit. 141 142 -z --leading-zeroes 143 144 Enable leading zeroes on numbers greater than -1 and less than 1. 145 146Environment variables: 147 148 POSIXLY_CORRECT 149 150 Error if any non-POSIX extensions are used. 151 152 BC_ENV_ARGS 153 154 Command-line arguments to use on every run. 155 156 BC_LINE_LENGTH 157 158 If an integer, the number of characters to print on a line before 159 wrapping. Using 0 will disable line length checking. 160 161 BC_BANNER 162 163 If an integer and non-zero, display the copyright banner in interactive 164 mode. 165 166 Overrides the default, which is %s print the banner. 167 168 BC_SIGINT_RESET 169 170 If an integer and non-zero, reset on SIGINT, rather than exit, when in 171 interactive mode. 172 173 Overrides the default, which is %s. 174 175 BC_TTY_MODE 176 177 If an integer and non-zero, enable TTY mode when it is available. 178 179 Overrides the default, which is TTY mode %s. 180 181 BC_PROMPT 182 183 If an integer and non-zero, enable prompt when TTY mode is possible. 184 185 Overrides the default, which is prompt %s. 186