1/* 2 * ***************************************************************************** 3 * 4 * SPDX-License-Identifier: BSD-2-Clause 5 * 6 * Copyright (c) 2018-2020 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`. 40 41This bc is compatible with both the GNU bc and the POSIX bc spec. See the GNU bc 42manual (https://www.gnu.org/software/bc/manual/bc.html) and bc spec 43(http://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html) 44for details. 45 46This bc has three differences to the GNU bc: 47 48 1) Arrays can be passed to the builtin "length" function to get the number of 49 elements currently in the array. The following example prints "1": 50 51 a[0] = 0 52 length(a[]) 53 54 2) The precedence of the boolean "not" operator (!) is equal to that of the 55 unary minus (-), or negation, operator. This still allows POSIX-compliant 56 scripts to work while somewhat preserving expected behavior (versus C) and 57 making parsing easier. 58 3) This bc has many more extensions than the GNU bc does. For details, see the 59 man page. 60 61This bc also implements the dot (.) extension of the BSD bc. 62 63Options: 64 65 -e expr --expression=expr 66 67 Run "expr" and quit. If multiple expressions or files (see below) are 68 given, they are all run before executing from stdin. 69 70 -f file --file=file 71 72 Run the bc code in "file" and exit. See above as well. 73 74 -g --global-stacks 75 76 Turn scale, ibase, and obase into stacks. This makes the value of each be 77 be restored on returning from functions. See the man page for more 78 details. 79 80 -h --help 81 82 Print this usage message and exit. 83 84 -i --interactive 85 86 Force interactive mode. 87 88 -l --mathlib 89 90 Use predefined math routines: 91 92 s(expr) = sine of expr in radians 93 c(expr) = cosine of expr in radians 94 a(expr) = arctangent of expr, returning radians 95 l(expr) = natural log of expr 96 e(expr) = raises e to the power of expr 97 j(n, x) = Bessel function of integer order n of x 98 99 This bc may load more functions with these options. See the manpage for 100 details. 101 102 -P --no-prompt 103 104 Disable the prompt in interactive mode. 105 106 -q --quiet 107 108 Don't print version and copyright. 109 110 -s --standard 111 112 Error if any non-POSIX extensions are used. 113 114 -w --warn 115 116 Warn if any non-POSIX extensions are used. 117 118 -v --version 119 120 Print version information and copyright and exit. 121