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 --mathlib 90 91 Use predefined math routines: 92 93 s(expr) = sine of expr in radians 94 c(expr) = cosine of expr in radians 95 a(expr) = arctangent of expr, returning radians 96 l(expr) = natural log of expr 97 e(expr) = raises e to the power of expr 98 j(n, x) = Bessel function of integer order n of x 99 100 This bc may load more functions with these options. See the manpage or 101 online documentation for details. 102 103 -P --no-prompt 104 105 Disable the prompts in interactive mode. 106 107 -R --no-read-prompt 108 109 Disable the read prompt in interactive mode. 110 111 -q --quiet 112 113 Don't print version and copyright. 114 115 -s --standard 116 117 Error if any non-POSIX extensions are used. 118 119 -w --warn 120 121 Warn if any non-POSIX extensions are used. 122 123 -v --version 124 125 Print version information and copyright and exit. 126