aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Eßer <se@FreeBSD.org>2020-12-27 20:53:09 +0000
committerStefan Eßer <se@FreeBSD.org>2021-03-21 15:53:30 +0000
commit92db69bf876227ae9bf97874404a156bb5926334 (patch)
treeededa9e4b77f303566e30435c7ad8985acae11f2
parent2b61bda2c75f30f6eadd18fb891fd885e4c8d19d (diff)
bc: Upgrade to version 3.2.4
This update changes the behavior of "-e" or "-f" in BC_ENV_ARGS: Use of these options on the command line makes bc exit after executing the given commands. These options will not cause bc to exit when passed via the environment (but EOF in STDIN or -e or -f on the command line will make bc exit as before). The same applies to DC_ENV_ARGS with regard to the dc program. Make length(0) and length(0.0) return 1 for compatibility with GNU bc and the traditional FreeBSD bc. Fix a potential division by zero error in a non-standard (extended) math library function. (cherry picked from commit e458944cf9deec51d03ec751050a58ddf43e796f) (cherry picked from commit 9a995fe186257315e7b3d01e24c55d86bb18fd32) (cherry picked from commit 4aa71da8dc004aa5027836259433e5bff3cd9104) (cherry picked from commit 028616d0dd69a3da7a30cb94d35f040bf2ced6b9) (cherry picked from commit f165641df4da1752f8bb1f55c1e602cdb657fba4) (cherry picked from commit 893ecb52db5ed47d6c1e8698334d34e0df651612)
-rw-r--r--contrib/bc/.gitignore9
-rw-r--r--contrib/bc/.travis.yml42
-rw-r--r--contrib/bc/LICENSE.md52
-rw-r--r--contrib/bc/Makefile.in122
-rw-r--r--contrib/bc/NEWS.md97
-rw-r--r--contrib/bc/NOTICE.md2
-rw-r--r--contrib/bc/README.md21
-rw-r--r--contrib/bc/codecov.yml3
-rwxr-xr-xcontrib/bc/configure.sh345
-rwxr-xr-xcontrib/bc/exec-install.sh2
-rwxr-xr-xcontrib/bc/functions.sh90
-rw-r--r--contrib/bc/gen/bc_help.txt2
-rw-r--r--contrib/bc/gen/dc_help.txt2
-rw-r--r--contrib/bc/gen/lib.bc2
-rw-r--r--contrib/bc/gen/lib2.bc4
-rw-r--r--contrib/bc/gen/strgen.c4
-rwxr-xr-xcontrib/bc/gen/strgen.sh4
-rw-r--r--contrib/bc/include/args.h4
-rw-r--r--contrib/bc/include/bc.h2
-rw-r--r--contrib/bc/include/bcl.h2
-rw-r--r--contrib/bc/include/dc.h2
-rw-r--r--contrib/bc/include/file.h2
-rw-r--r--contrib/bc/include/history.h2
-rw-r--r--contrib/bc/include/lang.h2
-rw-r--r--contrib/bc/include/lex.h2
-rw-r--r--contrib/bc/include/library.h2
-rw-r--r--contrib/bc/include/num.h4
-rw-r--r--contrib/bc/include/opt.h2
-rw-r--r--contrib/bc/include/parse.h2
-rw-r--r--contrib/bc/include/program.h2
-rw-r--r--contrib/bc/include/rand.h31
-rw-r--r--contrib/bc/include/read.h2
-rw-r--r--contrib/bc/include/status.h22
-rw-r--r--contrib/bc/include/vector.h3
-rw-r--r--contrib/bc/include/vm.h20
-rwxr-xr-xcontrib/bc/karatsuba.py12
-rwxr-xr-xcontrib/bc/link.sh2
-rwxr-xr-xcontrib/bc/locale_install.sh2
-rwxr-xr-xcontrib/bc/locale_uninstall.sh2
-rw-r--r--contrib/bc/locales/de_DE.ISO8859-1.msg2
-rw-r--r--contrib/bc/locales/de_DE.UTF-8.msg2
-rw-r--r--contrib/bc/locales/en_US.msg2
-rw-r--r--contrib/bc/locales/es_ES.ISO8859-1.msg2
-rw-r--r--contrib/bc/locales/es_ES.UTF-8.msg2
-rw-r--r--contrib/bc/locales/fr_FR.ISO8859-1.msg2
-rw-r--r--contrib/bc/locales/fr_FR.UTF-8.msg2
-rw-r--r--contrib/bc/locales/ja_JP.UTF-8.msg2
-rw-r--r--contrib/bc/locales/ja_JP.eucJP.msg2
-rw-r--r--contrib/bc/locales/nl_NL.ISO8859-1.msg2
-rw-r--r--contrib/bc/locales/nl_NL.UTF-8.msg2
-rw-r--r--contrib/bc/locales/pl_PL.ISO8859-2.msg2
-rw-r--r--contrib/bc/locales/pl_PL.UTF-8.msg2
-rw-r--r--contrib/bc/locales/pt_PT.ISO8859-1.msg2
-rw-r--r--contrib/bc/locales/pt_PT.UTF-8.msg2
-rw-r--r--contrib/bc/locales/ru_RU.CP1251.msg2
-rw-r--r--contrib/bc/locales/ru_RU.CP866.msg2
-rw-r--r--contrib/bc/locales/ru_RU.ISO8859-5.msg2
-rw-r--r--contrib/bc/locales/ru_RU.KOI8-R.msg2
-rw-r--r--contrib/bc/locales/ru_RU.UTF-8.msg2
-rw-r--r--contrib/bc/locales/zh_CN.GB18030.msg2
-rw-r--r--contrib/bc/locales/zh_CN.GB2312.msg2
-rw-r--r--contrib/bc/locales/zh_CN.GBK.msg2
-rw-r--r--contrib/bc/locales/zh_CN.UTF-8.msg2
-rw-r--r--contrib/bc/locales/zh_CN.eucCN.msg2
-rwxr-xr-xcontrib/bc/manpage.sh2
-rw-r--r--contrib/bc/manuals/bc.1.md.in81
-rw-r--r--contrib/bc/manuals/bc/A.192
-rw-r--r--contrib/bc/manuals/bc/A.1.md79
-rw-r--r--contrib/bc/manuals/bc/E.186
-rw-r--r--contrib/bc/manuals/bc/E.1.md70
-rw-r--r--contrib/bc/manuals/bc/EH.186
-rw-r--r--contrib/bc/manuals/bc/EH.1.md70
-rw-r--r--contrib/bc/manuals/bc/EHN.186
-rw-r--r--contrib/bc/manuals/bc/EHN.1.md70
-rw-r--r--contrib/bc/manuals/bc/EHNP.186
-rw-r--r--contrib/bc/manuals/bc/EHNP.1.md70
-rw-r--r--contrib/bc/manuals/bc/EHP.186
-rw-r--r--contrib/bc/manuals/bc/EHP.1.md70
-rw-r--r--contrib/bc/manuals/bc/EN.186
-rw-r--r--contrib/bc/manuals/bc/EN.1.md70
-rw-r--r--contrib/bc/manuals/bc/ENP.186
-rw-r--r--contrib/bc/manuals/bc/ENP.1.md70
-rw-r--r--contrib/bc/manuals/bc/EP.186
-rw-r--r--contrib/bc/manuals/bc/EP.1.md70
-rw-r--r--contrib/bc/manuals/bc/H.192
-rw-r--r--contrib/bc/manuals/bc/H.1.md79
-rw-r--r--contrib/bc/manuals/bc/HN.192
-rw-r--r--contrib/bc/manuals/bc/HN.1.md79
-rw-r--r--contrib/bc/manuals/bc/HNP.192
-rw-r--r--contrib/bc/manuals/bc/HNP.1.md79
-rw-r--r--contrib/bc/manuals/bc/HP.192
-rw-r--r--contrib/bc/manuals/bc/HP.1.md79
-rw-r--r--contrib/bc/manuals/bc/N.192
-rw-r--r--contrib/bc/manuals/bc/N.1.md79
-rw-r--r--contrib/bc/manuals/bc/NP.192
-rw-r--r--contrib/bc/manuals/bc/NP.1.md79
-rw-r--r--contrib/bc/manuals/bc/P.192
-rw-r--r--contrib/bc/manuals/bc/P.1.md79
-rw-r--r--contrib/bc/manuals/bcl.34
-rw-r--r--contrib/bc/manuals/bcl.3.md78
-rw-r--r--contrib/bc/manuals/build.md16
-rw-r--r--contrib/bc/manuals/dc.1.md.in60
-rw-r--r--contrib/bc/manuals/dc/A.178
-rw-r--r--contrib/bc/manuals/dc/A.1.md60
-rw-r--r--contrib/bc/manuals/dc/E.172
-rw-r--r--contrib/bc/manuals/dc/E.1.md55
-rw-r--r--contrib/bc/manuals/dc/EH.172
-rw-r--r--contrib/bc/manuals/dc/EH.1.md55
-rw-r--r--contrib/bc/manuals/dc/EHN.172
-rw-r--r--contrib/bc/manuals/dc/EHN.1.md55
-rw-r--r--contrib/bc/manuals/dc/EHNP.172
-rw-r--r--contrib/bc/manuals/dc/EHNP.1.md55
-rw-r--r--contrib/bc/manuals/dc/EHP.172
-rw-r--r--contrib/bc/manuals/dc/EHP.1.md55
-rw-r--r--contrib/bc/manuals/dc/EN.172
-rw-r--r--contrib/bc/manuals/dc/EN.1.md55
-rw-r--r--contrib/bc/manuals/dc/ENP.172
-rw-r--r--contrib/bc/manuals/dc/ENP.1.md55
-rw-r--r--contrib/bc/manuals/dc/EP.172
-rw-r--r--contrib/bc/manuals/dc/EP.1.md55
-rw-r--r--contrib/bc/manuals/dc/H.178
-rw-r--r--contrib/bc/manuals/dc/H.1.md60
-rw-r--r--contrib/bc/manuals/dc/HN.178
-rw-r--r--contrib/bc/manuals/dc/HN.1.md60
-rw-r--r--contrib/bc/manuals/dc/HNP.178
-rw-r--r--contrib/bc/manuals/dc/HNP.1.md60
-rw-r--r--contrib/bc/manuals/dc/HP.178
-rw-r--r--contrib/bc/manuals/dc/HP.1.md60
-rw-r--r--contrib/bc/manuals/dc/N.178
-rw-r--r--contrib/bc/manuals/dc/N.1.md60
-rw-r--r--contrib/bc/manuals/dc/NP.178
-rw-r--r--contrib/bc/manuals/dc/NP.1.md60
-rw-r--r--contrib/bc/manuals/dc/P.178
-rw-r--r--contrib/bc/manuals/dc/P.1.md60
-rw-r--r--contrib/bc/manuals/header.txt2
-rw-r--r--contrib/bc/manuals/header_bc.txt2
-rw-r--r--contrib/bc/manuals/header_bcl.txt2
-rw-r--r--contrib/bc/manuals/header_dc.txt2
-rwxr-xr-xcontrib/bc/release.sh24
-rw-r--r--contrib/bc/src/args.c6
-rw-r--r--contrib/bc/src/bc.c2
-rw-r--r--contrib/bc/src/bc_lex.c2
-rw-r--r--contrib/bc/src/bc_parse.c2
-rw-r--r--contrib/bc/src/data.c4
-rw-r--r--contrib/bc/src/dc.c2
-rw-r--r--contrib/bc/src/dc_lex.c6
-rw-r--r--contrib/bc/src/dc_parse.c2
-rw-r--r--contrib/bc/src/file.c4
-rw-r--r--contrib/bc/src/history.c15
-rw-r--r--contrib/bc/src/lang.c14
-rw-r--r--contrib/bc/src/lex.c4
-rw-r--r--contrib/bc/src/library.c12
-rw-r--r--contrib/bc/src/main.c13
-rw-r--r--contrib/bc/src/num.c12
-rw-r--r--contrib/bc/src/opt.c2
-rw-r--r--contrib/bc/src/parse.c8
-rw-r--r--contrib/bc/src/program.c35
-rw-r--r--contrib/bc/src/rand.c42
-rw-r--r--contrib/bc/src/read.c6
-rw-r--r--contrib/bc/src/vector.c8
-rw-r--r--contrib/bc/src/vm.c92
-rwxr-xr-xcontrib/bc/tests/afl.py22
-rwxr-xr-xcontrib/bc/tests/all.sh191
-rw-r--r--contrib/bc/tests/bc/all.txt6
-rw-r--r--contrib/bc/tests/bc/length.txt3
-rw-r--r--contrib/bc/tests/bc/length_results.txt5
-rw-r--r--contrib/bc/tests/bc/lib2.txt6
-rw-r--r--contrib/bc/tests/bc/lib2_results.txt6
-rw-r--r--contrib/bc/tests/bc/scripts/all.txt15
-rwxr-xr-xcontrib/bc/tests/bc/scripts/bessel.bc9
-rwxr-xr-xcontrib/bc/tests/bc/timeconst.sh9
-rw-r--r--contrib/bc/tests/bcl.c2
-rw-r--r--contrib/bc/tests/dc/all.txt1
-rw-r--r--contrib/bc/tests/dc/errors/30.txt1
-rw-r--r--contrib/bc/tests/dc/errors/31.txt1
-rw-r--r--contrib/bc/tests/dc/length.txt129
-rw-r--r--contrib/bc/tests/dc/length_results.txt129
-rw-r--r--contrib/bc/tests/dc/scripts/all.txt9
-rwxr-xr-xcontrib/bc/tests/diff.sh51
-rwxr-xr-xcontrib/bc/tests/errors.sh20
-rw-r--r--contrib/bc/tests/extra_required.txt7
-rw-r--r--contrib/bc/tests/fuzzing/bc.dict68
-rw-r--r--contrib/bc/tests/fuzzing/bc_inputs1/abs.txt7
-rw-r--r--contrib/bc/tests/fuzzing/bc_inputs1/add.txt146
-rw-r--r--contrib/bc/tests/fuzzing/bc_inputs1/arctangent.txt26
-rwxr-xr-xcontrib/bc/tests/fuzzing/bc_inputs1/array.bc60
-rw-r--r--contrib/bc/tests/fuzzing/bc_inputs1/arrays.txt10
-rw-r--r--contrib/bc/tests/fuzzing/bc_inputs1/assignments.txt122
-rw-r--r--contrib/bc/tests/fuzzing/bc_inputs1/basic.txt7
-rw-r--r--contrib/bc/tests/fuzzing/bc_inputs1/boolean.txt184
-rw-r--r--contrib/bc/tests/fuzzing/bc_inputs1/cosine.txt44
-rw-r--r--contrib/bc/tests/fuzzing/bc_inputs1/decimal.txt35
-rw-r--r--contrib/bc/tests/fuzzing/bc_inputs1/divide.txt31
-rw-r--r--contrib/bc/tests/fuzzing/bc_inputs1/engineering.txt19
-rw-r--r--contrib/bc/tests/fuzzing/bc_inputs1/exponent.txt22
-rw-r--r--contrib/bc/tests/fuzzing/bc_inputs1/functions.bc7
-rw-r--r--contrib/bc/tests/fuzzing/bc_inputs1/functions.txt13
-rw-r--r--contrib/bc/tests/fuzzing/bc_inputs1/globals.txt21
-rw-r--r--contrib/bc/tests/fuzzing/bc_inputs1/len.bc48
-rw-r--r--contrib/bc/tests/fuzzing/bc_inputs1/length.txt59
-rw-r--r--contrib/bc/tests/fuzzing/bc_inputs1/lib10.txt4
-rw-r--r--contrib/bc/tests/fuzzing/bc_inputs1/lib11.txt4
-rw-r--r--contrib/bc/tests/fuzzing/bc_inputs1/lib12.txt1
-rw-r--r--contrib/bc/tests/fuzzing/bc_inputs1/lib2.txt15
-rw-r--r--contrib/bc/tests/fuzzing/bc_inputs1/lib3.txt6
-rw-r--r--contrib/bc/tests/fuzzing/bc_inputs1/lib4.txt10
-rw-r--r--contrib/bc/tests/fuzzing/bc_inputs1/lib5.txt2
-rw-r--r--contrib/bc/tests/fuzzing/bc_inputs1/lib6.txt5
-rw-r--r--contrib/bc/tests/fuzzing/bc_inputs1/lib7.txt12
-rw-r--r--contrib/bc/tests/fuzzing/bc_inputs1/lib8.txt3
-rw-r--r--contrib/bc/tests/fuzzing/bc_inputs2/lib13.txt1
-rw-r--r--contrib/bc/tests/fuzzing/bc_inputs2/lib14.txt1
-rw-r--r--contrib/bc/tests/fuzzing/bc_inputs2/lib15.txt1
-rw-r--r--contrib/bc/tests/fuzzing/bc_inputs2/lib16.txt1
-rw-r--r--contrib/bc/tests/fuzzing/bc_inputs2/lib19.txt1
-rw-r--r--contrib/bc/tests/fuzzing/bc_inputs2/lib20.txt1
-rw-r--r--contrib/bc/tests/fuzzing/bc_inputs2/lib21.txt1
-rw-r--r--contrib/bc/tests/fuzzing/bc_inputs2/lib22.txt1
-rw-r--r--contrib/bc/tests/fuzzing/bc_inputs2/lib23.txt1
-rw-r--r--contrib/bc/tests/fuzzing/bc_inputs2/lib24.txt1
-rw-r--r--contrib/bc/tests/fuzzing/bc_inputs2/log.txt22
-rw-r--r--contrib/bc/tests/fuzzing/bc_inputs2/misc.txt13
-rw-r--r--contrib/bc/tests/fuzzing/bc_inputs2/misc1.txt76
-rw-r--r--contrib/bc/tests/fuzzing/bc_inputs2/misc2.txt110
-rw-r--r--contrib/bc/tests/fuzzing/bc_inputs2/misc3.txt12
-rw-r--r--contrib/bc/tests/fuzzing/bc_inputs2/modulus.txt69
-rw-r--r--contrib/bc/tests/fuzzing/bc_inputs2/multiply.txt40
-rw-r--r--contrib/bc/tests/fuzzing/bc_inputs2/pi.txt4
-rw-r--r--contrib/bc/tests/fuzzing/bc_inputs2/places.txt19
-rw-r--r--contrib/bc/tests/fuzzing/bc_inputs2/power.txt44
-rw-r--r--contrib/bc/tests/fuzzing/bc_inputs2/print2.txt194
-rwxr-xr-xcontrib/bc/tests/fuzzing/bc_inputs2/references.bc408
-rw-r--r--contrib/bc/tests/fuzzing/bc_inputs2/scale.txt57
-rw-r--r--contrib/bc/tests/fuzzing/bc_inputs2/scientific.txt51
-rw-r--r--contrib/bc/tests/fuzzing/bc_inputs2/shift.txt281
-rw-r--r--contrib/bc/tests/fuzzing/bc_inputs2/sine.txt207
-rw-r--r--contrib/bc/tests/fuzzing/bc_inputs3/01.txt339
-rw-r--r--contrib/bc/tests/fuzzing/bc_inputs3/02.txt1
-rw-r--r--contrib/bc/tests/fuzzing/bc_inputs3/03.txt2
-rw-r--r--contrib/bc/tests/fuzzing/bc_inputs3/04.txt1
-rw-r--r--contrib/bc/tests/fuzzing/bc_inputs3/05.txt1
-rw-r--r--contrib/bc/tests/fuzzing/bc_inputs3/06.txt1
-rw-r--r--contrib/bc/tests/fuzzing/bc_inputs3/07.txt8
-rw-r--r--contrib/bc/tests/fuzzing/bc_inputs3/08.txt3
-rw-r--r--contrib/bc/tests/fuzzing/bc_inputs3/09.txt11
-rw-r--r--contrib/bc/tests/fuzzing/bc_inputs3/10.txt1
-rw-r--r--contrib/bc/tests/fuzzing/bc_inputs3/11.txt99
-rw-r--r--contrib/bc/tests/fuzzing/bc_inputs3/12.txt2
-rw-r--r--contrib/bc/tests/fuzzing/bc_inputs3/13.txt56
-rw-r--r--contrib/bc/tests/fuzzing/bc_inputs3/14.txt1
-rw-r--r--contrib/bc/tests/fuzzing/bc_inputs3/15.txt3
-rw-r--r--contrib/bc/tests/fuzzing/bc_inputs3/16.txt1
-rw-r--r--contrib/bc/tests/fuzzing/bc_inputs3/17.txt11
-rw-r--r--contrib/bc/tests/fuzzing/bc_inputs3/18.txt3
-rw-r--r--contrib/bc/tests/fuzzing/bc_inputs3/19.txt5
-rw-r--r--contrib/bc/tests/fuzzing/bc_inputs3/20.txt51
-rw-r--r--contrib/bc/tests/fuzzing/bc_inputs3/21.txt10
-rw-r--r--contrib/bc/tests/fuzzing/bc_inputs3/22.txt2
-rw-r--r--contrib/bc/tests/fuzzing/bc_inputs3/23.txtbin0 -> 1024 bytes
-rw-r--r--contrib/bc/tests/fuzzing/bc_inputs3/24.txt4
-rw-r--r--contrib/bc/tests/fuzzing/bc_inputs3/sqrt.txt14
-rw-r--r--contrib/bc/tests/fuzzing/bc_inputs3/strings.txt12
-rw-r--r--contrib/bc/tests/fuzzing/bc_inputs3/subtract.txt153
-rw-r--r--contrib/bc/tests/fuzzing/bc_inputs3/trunc.txt15
-rw-r--r--contrib/bc/tests/fuzzing/bc_inputs3/void.txt20
-rw-r--r--contrib/bc/tests/fuzzing/dc_inputs/01.txt2
-rw-r--r--contrib/bc/tests/fuzzing/dc_inputs/02.txt5
-rw-r--r--contrib/bc/tests/fuzzing/dc_inputs/03.txt2
-rw-r--r--contrib/bc/tests/fuzzing/dc_inputs/04.txt9
-rw-r--r--contrib/bc/tests/fuzzing/dc_inputs/05.txt3
-rw-r--r--contrib/bc/tests/fuzzing/dc_inputs/06.txt1
-rw-r--r--contrib/bc/tests/fuzzing/dc_inputs/07.txt3
-rw-r--r--contrib/bc/tests/fuzzing/dc_inputs/08.txt1
-rw-r--r--contrib/bc/tests/fuzzing/dc_inputs/09.txt9
-rw-r--r--contrib/bc/tests/fuzzing/dc_inputs/10.txt11
-rw-r--r--contrib/bc/tests/fuzzing/dc_inputs/11.txt4
-rw-r--r--contrib/bc/tests/fuzzing/dc_inputs/12.txt2
-rw-r--r--contrib/bc/tests/fuzzing/dc_inputs/13.txt7
-rw-r--r--contrib/bc/tests/fuzzing/dc_inputs/14.txt7
-rw-r--r--contrib/bc/tests/fuzzing/dc_inputs/15.txt11
-rw-r--r--contrib/bc/tests/fuzzing/dc_inputs/16.txt1
-rw-r--r--contrib/bc/tests/fuzzing/dc_inputs/17.txt20
-rw-r--r--contrib/bc/tests/fuzzing/dc_inputs/18.txt3
-rw-r--r--contrib/bc/tests/fuzzing/dc_inputs/19.txt1
-rw-r--r--contrib/bc/tests/fuzzing/dc_inputs/20.txt3
-rw-r--r--contrib/bc/tests/fuzzing/dc_inputs/21.txt5
-rw-r--r--contrib/bc/tests/fuzzing/dc_inputs/22.txt36
-rw-r--r--contrib/bc/tests/fuzzing/dc_inputs/23.txt2
-rw-r--r--contrib/bc/tests/fuzzing/dc_inputs/24.txt1
-rw-r--r--contrib/bc/tests/fuzzing/dc_inputs/25.txt6
-rw-r--r--contrib/bc/tests/fuzzing/dc_inputs/26.txt155
-rw-r--r--contrib/bc/tests/fuzzing/dc_inputs/27.txt2
-rw-r--r--contrib/bc/tests/fuzzing/dc_inputs/28.txt1
-rw-r--r--contrib/bc/tests/fuzzing/dc_inputs/29.txt13
-rw-r--r--contrib/bc/tests/fuzzing/dc_inputs/30.txt1
-rw-r--r--contrib/bc/tests/fuzzing/dc_inputs/31.txt1
-rw-r--r--contrib/bc/tests/fuzzing/dc_inputs/abs.txt7
-rw-r--r--contrib/bc/tests/fuzzing/dc_inputs/add.txt33
-rw-r--r--contrib/bc/tests/fuzzing/dc_inputs/array.dc2
-rw-r--r--contrib/bc/tests/fuzzing/dc_inputs/boolean.txt80
-rw-r--r--contrib/bc/tests/fuzzing/dc_inputs/decimal.txt36
-rw-r--r--contrib/bc/tests/fuzzing/dc_inputs/divide.txt33
-rw-r--r--contrib/bc/tests/fuzzing/dc_inputs/divmod.txt64
-rw-r--r--contrib/bc/tests/fuzzing/dc_inputs/else.dc4
-rw-r--r--contrib/bc/tests/fuzzing/dc_inputs/engineering.txt19
-rw-r--r--contrib/bc/tests/fuzzing/dc_inputs/loop.dc3
-rw-r--r--contrib/bc/tests/fuzzing/dc_inputs/misc.txt1
-rw-r--r--contrib/bc/tests/fuzzing/dc_inputs/modexp.txt103
-rw-r--r--contrib/bc/tests/fuzzing/dc_inputs/modulus.txt70
-rw-r--r--contrib/bc/tests/fuzzing/dc_inputs/multiply.txt42
-rw-r--r--contrib/bc/tests/fuzzing/dc_inputs/places.txt14
-rw-r--r--contrib/bc/tests/fuzzing/dc_inputs/power.txt36
-rw-r--r--contrib/bc/tests/fuzzing/dc_inputs/quit.dc2
-rw-r--r--contrib/bc/tests/fuzzing/dc_inputs/scientific.txt51
-rw-r--r--contrib/bc/tests/fuzzing/dc_inputs/shift.txt42
-rw-r--r--contrib/bc/tests/fuzzing/dc_inputs/sqrt.txt14
-rw-r--r--contrib/bc/tests/fuzzing/dc_inputs/stdin.txt205
-rwxr-xr-xcontrib/bc/tests/fuzzing/dc_inputs/stream.dc2
-rw-r--r--contrib/bc/tests/fuzzing/dc_inputs/strings.txt50
-rw-r--r--contrib/bc/tests/fuzzing/dc_inputs/subtract.txt33
-rw-r--r--contrib/bc/tests/fuzzing/dc_inputs/trunc.txt11
-rw-r--r--contrib/bc/tests/fuzzing/dc_inputs/vars.txt2
-rw-r--r--contrib/bc/tests/fuzzing/dc_inputs/weird.dc2
-rwxr-xr-xcontrib/bc/tests/other.sh271
-rwxr-xr-xcontrib/bc/tests/radamsa.sh2
-rwxr-xr-xcontrib/bc/tests/randmath.py2
-rwxr-xr-xcontrib/bc/tests/read.sh23
-rwxr-xr-xcontrib/bc/tests/script.sh28
-rwxr-xr-xcontrib/bc/tests/scripts.sh9
-rwxr-xr-xcontrib/bc/tests/stdin.sh23
-rwxr-xr-xcontrib/bc/tests/test.sh32
331 files changed, 9268 insertions, 2752 deletions
diff --git a/contrib/bc/.gitignore b/contrib/bc/.gitignore
index fb9bc5ab6aa2..5c2bbae866c0 100644
--- a/contrib/bc/.gitignore
+++ b/contrib/bc/.gitignore
@@ -34,6 +34,13 @@ config.mak
timeconst.bc
Makefile
+tests/fuzzing/bc_outputs1/*
+tests/fuzzing/bc_outputs2/*
+tests/fuzzing/bc_outputs3/*
+tests/fuzzing/dc_outputs/*
+tests/bc_outputs/*
+tests/dc_outputs/*
+
.gdb_history
# Ignore the generated test files
@@ -57,5 +64,7 @@ perf.data.old
*.html
*.profraw
+core.*
+
cscope*.out
tags
diff --git a/contrib/bc/.travis.yml b/contrib/bc/.travis.yml
deleted file mode 100644
index 91694a821284..000000000000
--- a/contrib/bc/.travis.yml
+++ /dev/null
@@ -1,42 +0,0 @@
-dist: bionic
-
-language: c
-
-arch:
- - amd64
- - arm64
- - ppc64le
-
-compiler:
- - gcc
-
-env:
- global:
- - CODECOV_TOKEN="040ce7eb-5bc7-4040-8324-364f3ef4baa3"
- - CFLAGS="-coverage -DBC_RAND_BUILTIN=0"
- matrix:
- - CONFIGURE_ARGS=-fHNPOg GEN_HOST=1 LONG_BIT=64
- - CONFIGURE_ARGS=-bfHNPOg GEN_HOST=1 LONG_BIT=64
- - CONFIGURE_ARGS=-dfHNPOg GEN_HOST=1 LONG_BIT=64
- - CONFIGURE_ARGS=-fEHNPOg GEN_HOST=1 LONG_BIT=64
- - CONFIGURE_ARGS=-bfEHNPOg GEN_HOST=1 LONG_BIT=64
- - CONFIGURE_ARGS=-dfEHNPOg GEN_HOST=1 LONG_BIT=64
- - CONFIGURE_ARGS=-fHNPOg GEN_HOST=1 LONG_BIT=32
- - CONFIGURE_ARGS=-bfHNPOg GEN_HOST=1 LONG_BIT=32
- - CONFIGURE_ARGS=-dfHNPOg GEN_HOST=1 LONG_BIT=32
- - CONFIGURE_ARGS=-fEHNPOg GEN_HOST=1 LONG_BIT=32
- - CONFIGURE_ARGS=-bfEHNPOg GEN_HOST=1 LONG_BIT=32
- - CONFIGURE_ARGS=-dfEHNPOg GEN_HOST=1 LONG_BIT=32
-
-before_install:
- - sudo apt-get install -y dc
- - pip install --user codecov
-
-before_script:
- - curl -o tests/bc/scripts/timeconst.bc https://raw.githubusercontent.com/torvalds/linux/master/kernel/time/timeconst.bc
-
-after_success:
- - bash <(curl -s https://codecov.io/bash)
-
-script:
- - if [ "${COVERITY_SCAN_BRANCH}" != 1 ]; then ./configure.sh "$CONFIGURE_ARGS" && make -j4 && make -j4 test ; fi
diff --git a/contrib/bc/LICENSE.md b/contrib/bc/LICENSE.md
index 1681a053e0de..269e131cc81d 100644
--- a/contrib/bc/LICENSE.md
+++ b/contrib/bc/LICENSE.md
@@ -1,6 +1,6 @@
# License
-Copyright (c) 2018-2020 Gavin D. Howard <yzena.tech@gmail.com>
+Copyright (c) 2018-2021 Gavin D. Howard <yzena.tech@gmail.com>
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
@@ -31,7 +31,7 @@ copyrights and license:
Copyright (c) 2010-2014, Salvatore Sanfilippo <antirez at gmail dot com><br>
Copyright (c) 2010-2013, Pieter Noordhuis <pcnoordhuis at gmail dot com><br>
Copyright (c) 2018 rain-1 <rain1@openmailbox.org><br>
-Copyright (c) 2018-2020, Gavin D. Howard <yzena.tech@gmail.com>
+Copyright (c) 2018-2021, Gavin D. Howard <yzena.tech@gmail.com>
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
@@ -53,3 +53,51 @@ 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.
+
+## Rand
+
+The files `src/rand.c` and `include/rand.h` are under the following copyrights
+and license:
+
+Copyright (c) 2014-2017 Melissa O'Neill and PCG Project contributors
+Copyright (c) 2018-2021 Gavin D. Howard <yzena.tech@gmail.com>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+the Software, and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+## `safe-install.sh`
+
+The file `safe-install.sh` is under the following copyright and license:
+
+Copyright (c) 2021 Rich Felker
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the “Software”), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+the Software, and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/contrib/bc/Makefile.in b/contrib/bc/Makefile.in
index 968494e4a8a0..aab7f9b569e5 100644
--- a/contrib/bc/Makefile.in
+++ b/contrib/bc/Makefile.in
@@ -1,7 +1,7 @@
#
# SPDX-License-Identifier: BSD-2-Clause
#
-# Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+# Copyright (c) 2018-2021 Gavin D. Howard and contributors.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
@@ -29,7 +29,7 @@
#
.POSIX:
-VERSION = 3.2.3
+VERSION = 3.3.4
SRC = %%SRC%%
OBJ = %%OBJ%%
@@ -41,6 +41,13 @@ BC_ENABLED = %%BC_ENABLED%%
DC_ENABLED_NAME = DC_ENABLED
DC_ENABLED = %%DC_ENABLED%%
+HEADERS = include/args.h include/file.h include/lang.h include/lex.h include/num.h include/opt.h include/parse.h include/program.h include/read.h include/status.h include/vector.h include/vm.h
+BC_HEADERS = include/bc.h
+DC_HEADERS = include/dc.h
+HISTORY_HEADERS = include/history.h
+EXTRA_MATH_HEADERS = include/rand.h
+LIBRARY_HEADERS = include/bcl.h include/library.h
+
GEN_DIR = gen
GEN = %%GEN%%
GEN_EXEC = $(GEN_DIR)/$(GEN)
@@ -82,6 +89,11 @@ DC = dc
BC_EXEC = $(BIN)/$(EXEC_PREFIX)$(BC)
DC_EXEC = $(BIN)/$(EXEC_PREFIX)$(DC)
+BC_TEST_OUTPUTS = tests/bc_outputs
+BC_FUZZ_OUTPUTS = tests/fuzzing/bc_outputs1 tests/fuzzing/bc_outputs2 tests/fuzzing/bc_outputs3
+DC_TEST_OUTPUTS = tests/dc_outputs
+DC_FUZZ_OUTPUTS = tests/fuzzing/dc_outputs
+
LIB = libbcl
LIB_NAME = $(LIB).a
LIBBC = $(BIN)/$(LIB_NAME)
@@ -125,6 +137,9 @@ BC_ENABLE_NLS = %%NLS%%
BC_ENABLE_PROMPT = %%PROMPT%%
BC_LONG_BIT = %%LONG_BIT%%
+BC_ENABLE_AFL = %%FUZZ%%
+BC_ENABLE_MEMCHECK = %%MEMCHECK%%
+
RM = rm
MKDIR = mkdir
@@ -138,6 +153,8 @@ LOCALE_UNINSTALL = ./locale_uninstall.sh
VALGRIND_ARGS = --error-exitcode=100 --leak-check=full --show-leak-kinds=all --errors-for-leak-kinds=all
+TEST_STARS = "***********************************************************************"
+
BC_NUM_KARATSUBA_LEN = %%KARATSUBA_LEN%%
CPPFLAGS1 = -D$(BC_ENABLED_NAME)=$(BC_ENABLED) -D$(DC_ENABLED_NAME)=$(DC_ENABLED)
@@ -147,7 +164,8 @@ CPPFLAGS4 = $(CPPFLAGS3) -D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=700
CPPFLAGS5 = $(CPPFLAGS4) -DBC_NUM_KARATSUBA_LEN=$(BC_NUM_KARATSUBA_LEN)
CPPFLAGS6 = $(CPPFLAGS5) -DBC_ENABLE_NLS=$(BC_ENABLE_NLS) -DBC_ENABLE_PROMPT=$(BC_ENABLE_PROMPT)
CPPFLAGS7 = $(CPPFLAGS6) -D$(BC_ENABLE_EXTRA_MATH_NAME)=$(BC_ENABLE_EXTRA_MATH)
-CPPFLAGS = $(CPPFLAGS7) -DBC_ENABLE_HISTORY=$(BC_ENABLE_HISTORY) -DBC_ENABLE_LIBRARY=$(BC_ENABLE_LIBRARY)
+CPPFLAGS8 = $(CPPFLAGS7) -DBC_ENABLE_HISTORY=$(BC_ENABLE_HISTORY) -DBC_ENABLE_LIBRARY=$(BC_ENABLE_LIBRARY)
+CPPFLAGS = $(CPPFLAGS8) -DBC_ENABLE_MEMCHECK=$(BC_ENABLE_MEMCHECK) -DBC_ENABLE_AFL=$(BC_ENABLE_AFL)
CFLAGS = $(CPPFLAGS) %%CPPFLAGS%% %%CFLAGS%%
LDFLAGS = %%LDFLAGS%%
@@ -159,20 +177,15 @@ HOSTCC = %%HOSTCC%%
BC_LIB_C_ARGS = bc_lib bc_lib_name $(BC_ENABLED_NAME) 1
BC_LIB2_C_ARGS = bc_lib2 bc_lib2_name "$(BC_ENABLED_NAME) && $(BC_ENABLE_EXTRA_MATH_NAME)" 1
-OBJS = $(BC_HELP_O) $(DC_HELP_O) $(BC_LIB_O) $(BC_LIB2_O) $(OBJ)
-OBJ_TARGETS = $(DC_HELP_O) $(BC_HELP_O) $(BC_LIB_O) $(BC_LIB2_O) $(OBJ)
+OBJS = $(DC_HELP_O) $(BC_HELP_O) $(BC_LIB_O) $(BC_LIB2_O) $(OBJ)
-.c.o:
- $(CC) $(CFLAGS) -o $@ -c $<
-
-all: %%ALL_PREREQ%%
+all: %%DEFAULT_TARGET%%
-execs: make_bin $(OBJ_TARGETS)
- $(CC) $(CFLAGS) $(OBJS) $(LDFLAGS) -o $(EXEC)
- %%LINK%%
+%%DEFAULT_TARGET%%: %%DEFAULT_TARGET_PREREQS%%
+ %%DEFAULT_TARGET_CMD%%
-library: make_bin $(OBJ) $(BC_LIB_O) $(BC_LIB2_O)
- ar -r -cu $(LIBBC) $(BC_LIB_O) $(BC_LIB2_O) $(OBJ)
+%%SECOND_TARGET%%: %%SECOND_TARGET_PREREQS%%
+ %%SECOND_TARGET_CMD%%
$(GEN_EXEC):
%%GEN_EXEC_TARGET%%
@@ -180,18 +193,32 @@ $(GEN_EXEC):
$(BC_LIB_C): $(GEN_EXEC) $(BC_LIB)
$(GEN_EMU) $(GEN_EXEC) $(BC_LIB) $(BC_LIB_C) $(BC_LIB_C_ARGS)
+$(BC_LIB_O): $(BC_LIB_C)
+ $(CC) $(CFLAGS) -o $@ -c $<
+
$(BC_LIB2_C): $(GEN_EXEC) $(BC_LIB2)
$(GEN_EMU) $(GEN_EXEC) $(BC_LIB2) $(BC_LIB2_C) $(BC_LIB2_C_ARGS)
+$(BC_LIB2_O): $(BC_LIB2_C)
+ $(CC) $(CFLAGS) -o $@ -c $<
+
$(BC_HELP_C): $(GEN_EXEC) $(BC_HELP)
$(GEN_EMU) $(GEN_EXEC) $(BC_HELP) $(BC_HELP_C) bc_help "" $(BC_ENABLED_NAME)
+$(BC_HELP_O): $(BC_HELP_C)
+ $(CC) $(CFLAGS) -o $@ -c $<
+
$(DC_HELP_C): $(GEN_EXEC) $(DC_HELP)
$(GEN_EMU) $(GEN_EXEC) $(DC_HELP) $(DC_HELP_C) dc_help "" $(DC_ENABLED_NAME)
-make_bin:
+$(DC_HELP_O): $(DC_HELP_C)
+ $(CC) $(CFLAGS) -o $@ -c $<
+
+$(BIN):
$(MKDIR) -p $(BIN)
+headers: %%HEADERS%%
+
help:
@printf 'available targets:\n'
@printf '\n'
@@ -222,41 +249,68 @@ help:
@printf ' valgrind_dc runs the dc test suite, if dc has been built,\n'
@printf ' through valgrind\n'
+run_all_tests:
+ %%BC_ALL_TESTS%%
+ %%TIMECONST_ALL_TESTS%%
+ %%DC_ALL_TESTS%%
+
check: test
test: %%TESTS%%
-test_bc:
- %%BC_TEST%%
+test_bc: test_bc_header test_bc_tests test_bc_scripts test_bc_stdin test_bc_read test_bc_errors test_bc_other
+ @printf '\nAll bc tests passed.\n\n$(TEST_STARS)\n'
+
+test_bc_tests:%%BC_TESTS%%
+
+test_bc_scripts:%%BC_SCRIPT_TESTS%%
+
+test_bc_stdin:
+ @sh tests/stdin.sh bc %%BC_TEST_EXEC%%
+
+test_bc_read:
+ @sh tests/read.sh bc %%BC_TEST_EXEC%%
+
+test_bc_errors:
+ @sh tests/errors.sh bc %%BC_TEST_EXEC%%
+
+test_bc_other:
+ @sh tests/other.sh bc %%BC_TEST_EXEC%%
+
+test_bc_header:
+ @printf '$(TEST_STARS)\n\nRunning bc tests...\n\n'
-test_dc:
- %%DC_TEST%%
+test_dc: test_dc_header test_dc_tests test_dc_scripts test_dc_stdin test_dc_read test_dc_errors test_dc_other
+ @printf '\nAll dc tests passed.\n\n$(TEST_STARS)\n'
-time_test: time_test_bc timeconst time_test_dc
+test_dc_tests:%%DC_TESTS%%
-time_test_bc:
- %%BC_TIME_TEST%%
+test_dc_scripts:%%DC_SCRIPT_TESTS%%
-time_test_dc:
- %%DC_TIME_TEST%%
+test_dc_stdin:
+ @sh tests/stdin.sh dc %%DC_TEST_EXEC%%
+
+test_dc_read:
+ @sh tests/read.sh dc %%DC_TEST_EXEC%%
+
+test_dc_errors:
+ @sh tests/errors.sh dc %%DC_TEST_EXEC%%
+
+test_dc_other:
+ @sh tests/other.sh dc %%DC_TEST_EXEC%%
+
+test_dc_header:
+ @printf '$(TEST_STARS)\n\nRunning dc tests...\n\n'
timeconst:
%%TIMECONST%%
-library_test: library
+library_test: $(LIBBC)
$(CC) $(CFLAGS) $(BCL_TEST_C) $(LIBBC) -o $(BCL_TEST)
test_library: library_test
$(BCL_TEST)
-valgrind: valgrind_bc valgrind_dc
-
-valgrind_bc:
- %%VG_BC_TEST%%
-
-valgrind_dc:
- %%VG_DC_TEST%%
-
karatsuba:
%%KARATSUBA%%
@@ -296,6 +350,8 @@ clean:%%CLEAN_PREREQS%%
@$(RM) -f $(BC_LIB2_C) $(BC_LIB2_O)
@$(RM) -f $(BC_HELP_C) $(BC_HELP_O)
@$(RM) -f $(DC_HELP_C) $(DC_HELP_O)
+ @$(RM) -fr $(BC_TEST_OUTPUTS) $(DC_TEST_OUTPUTS)
+ @$(RM) -fr $(BC_FUZZ_OUTPUTS) $(DC_FUZZ_OUTPUTS)
clean_config: clean
@printf 'Cleaning config...\n'
diff --git a/contrib/bc/NEWS.md b/contrib/bc/NEWS.md
index db8448d48a86..3374ab57bc41 100644
--- a/contrib/bc/NEWS.md
+++ b/contrib/bc/NEWS.md
@@ -1,5 +1,102 @@
# News
+## 3.3.4
+
+This is a production release that fixes a small bug.
+
+The bug was that output was not flushed before a `read()` call, so prompts
+without a newline on the end were not flushed before the `read()` call.
+
+This is such a tiny bug that users only need to upgrade if they are affected.
+
+## 3.3.3
+
+This is a production release with one tweak and fixes for manuals.
+
+The tweak is that `length(0)` returns `1` instead of `0`. In `3.3.1`, I changed
+it so `length(0.x)`, where `x` could be any number of digits, returned the
+`scale`, but `length(0)` still returned `0` because I believe that `0` has `0`
+significant digits.
+
+After request of FreeBSD and considering the arguments of a mathematician,
+compatibility with other `bc`'s, and the expectations of users, I decided to
+make the change.
+
+The fixes for manuals fixed a bug where `--` was rendered as `-`.
+
+## 3.3.2
+
+This is a production release that fixes a divide-by-zero bug in `root()` in the
+[extended math library][16]. All previous versions with `root()` have the bug.
+
+## 3.3.1
+
+This is a production release that fixes a bug.
+
+The bug was in the reporting of number length when the value was 0.
+
+## 3.3.0
+
+This is a production release that changes one behavior and fixes documentation
+bugs.
+
+The changed behavior is the treatment of `-e` and `-f` when given through
+`BC_ENV_ARGS` or `DC_ENV_ARGS`. Now `bc` and `dc` do not exit when those options
+(or their equivalents) are given through those environment variables. However,
+`bc` and `dc` still exit when they or their equivalents are given on the
+command-line.
+
+## 3.2.7
+
+This is a production release that removes a small non-portable shell operation
+in `configure.sh`. This problem was only noticed on OpenBSD, not FreeBSD or
+Linux.
+
+Non-OpenBSD users do ***NOT*** need to upgrade, although NetBSD users may also
+need to upgrade.
+
+## 3.2.6
+
+This is a production release that fixes the build on FreeBSD.
+
+There was a syntax error in `configure.sh` that the Linux shell did not catch,
+and FreeBSD depends on the existence of `tests/all.sh`.
+
+All users that already upgraded to `3.2.5` should update to this release, with
+my apologies for the poor release of `3.2.5`. Other users should skip `3.2.5` in
+favor of this version.
+
+## 3.2.5
+
+This is a production release that fixes several bugs and adds a couple small
+things.
+
+The two most important bugs were bugs that causes `dc` to access memory
+out-of-bounds (crash in debug builds). This was found by upgrading to `afl++`
+from `afl`. Both were caused by a failure to distinguish between the same two
+cases.
+
+Another bug was the failure to put all of the licenses in the `LICENSE.md` file.
+
+Third, some warnings by `scan-build` were found and eliminated. This needed one
+big change: `bc` and `dc` now bail out as fast as possible on fatal errors
+instead of unwinding the stack.
+
+Fourth, the pseudo-random number now attempts to seed itself with `/dev/random`
+if `/dev/urandom` fails.
+
+Finally, this release has a few quality-of-life changes to the build system. The
+usage should not change at all; the only thing that changed was making sure the
+`Makefile.in` was written to rebuild properly when headers changed and to not
+rebuild when not necessary.
+
+## 3.2.4
+
+This is a production release that fixes a warning on `gcc` 6 or older, which
+does not have an attribute that is used.
+
+Users do ***NOT*** need to upgrade if they don't use `gcc` 6 or older.
+
## 3.2.3
This is a production release that fixes a bug in `gen/strgen.sh`. I recently
diff --git a/contrib/bc/NOTICE.md b/contrib/bc/NOTICE.md
index 92117daa9a6c..56d2935ab4b3 100644
--- a/contrib/bc/NOTICE.md
+++ b/contrib/bc/NOTICE.md
@@ -1,6 +1,6 @@
# Notice
-Copyright 2018-2020 Gavin D. Howard and contributors.
+Copyright 2018-2021 Gavin D. Howard and contributors.
## Contributors
diff --git a/contrib/bc/README.md b/contrib/bc/README.md
index cea5d877b95c..6a37a8bfb8da 100644
--- a/contrib/bc/README.md
+++ b/contrib/bc/README.md
@@ -1,7 +1,5 @@
# `bc`
-[![Build Status][13]][14]
-[![codecov][15]][16]
[![Coverity Scan Build Status][17]][18]
***WARNING: This project has moved to [https://git.yzena.com/][20] for [these
@@ -41,10 +39,10 @@ Systems that are known to work:
* Mac OSX
* Solaris* (as long as the Solaris version supports POSIX 2008)
* AIX
+* HP-UX* (except for history)
Please submit bug reports if this `bc` does not build out of the box on any
-system besides Windows. If Windows binaries are needed, they can be found at
-[xstatic][6].
+system besides Windows.
## Build
@@ -53,12 +51,6 @@ This `bc` should build unmodified on any POSIX-compliant system.
For more complex build requirements than the ones below, see the
[build manual][5].
-### Pre-built Binaries
-
-It is possible to download pre-compiled binaries for a wide list of platforms,
-including Linux- and Windows-based systems, from [xstatic][6]. This link always
-points to the latest release of `bc`.
-
### Default
For the default build with optimization, use the following commands in the root
@@ -302,8 +294,6 @@ tarballs.
Files:
.gitignore The git ignore file (maintainer use only).
- .travis.yml The Travis CI file (maintainer use only).
- codecov.yml The Codecov file (maintainer use only).
configure A symlink to configure.sh to make packaging easier.
configure.sh The configure script.
functions.sh A script with functions used by other scripts.
@@ -332,24 +322,19 @@ Folders:
[1]: https://www.gnu.org/software/bc/
[4]: ./LICENSE.md
[5]: ./manuals/build.md
-[6]: https://pkg.musl.cc/bc/
[7]: ./manuals/algorithms.md
[8]: https://git.busybox.net/busybox/tree/miscutils/bc.c
[9]: https://github.com/landley/toybox/blob/master/toys/pending/bc.c
[10]: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
[11]: http://semver.org/
[12]: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html
-[13]: https://travis-ci.com/gavinhoward/bc.svg?branch=master
-[14]: https://travis-ci.com/gavinhoward/bc
-[15]: https://codecov.io/gh/gavinhoward/bc/branch/master/graph/badge.svg
-[16]: https://codecov.io/gh/gavinhoward/bc
[17]: https://img.shields.io/coverity/scan/16609.svg
[18]: https://scan.coverity.com/projects/gavinhoward-bc
[19]: ./manuals/benchmarks.md
[20]: https://git.yzena.com/gavin/bc
[21]: https://gavinhoward.com/2020/04/i-am-moving-away-from-github/
[22]: https://www.deepl.com/translator
-[23]: https://svnweb.freebsd.org/base/head/contrib/bc/
+[23]: https://cgit.freebsd.org/src/tree/contrib/bc
[24]: https://bugs.freebsd.org/
[25]: https://reviews.freebsd.org/
[26]: ./manuals/bcl.3.md
diff --git a/contrib/bc/codecov.yml b/contrib/bc/codecov.yml
deleted file mode 100644
index 396c77d9c20a..000000000000
--- a/contrib/bc/codecov.yml
+++ /dev/null
@@ -1,3 +0,0 @@
-ignore:
- - "src/history/history.c"
- - "gen/strgen.c"
diff --git a/contrib/bc/configure.sh b/contrib/bc/configure.sh
index b6caf3debba3..310c26882906 100755
--- a/contrib/bc/configure.sh
+++ b/contrib/bc/configure.sh
@@ -2,7 +2,7 @@
#
# SPDX-License-Identifier: BSD-2-Clause
#
-# Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+# Copyright (c) 2018-2021 Gavin D. Howard and contributors.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
@@ -33,6 +33,8 @@ script=$(basename "$script")
. "$scriptdir/functions.sh"
+cd "$scriptdir"
+
usage() {
if [ $# -gt 0 ]; then
@@ -48,7 +50,7 @@ usage() {
printf 'usage:\n'
printf ' %s -h\n' "$script"
printf ' %s --help\n' "$script"
- printf ' %s [-a|-bD|-dB|-c] [-EfgGHlMNPT] [-O OPT_LEVEL] [-k KARATSUBA_LEN]\n' "$script"
+ printf ' %s [-a|-bD|-dB|-c] [-CEfgGHlmMNPtTvz] [-O OPT_LEVEL] [-k KARATSUBA_LEN]\n' "$script"
printf ' %s \\\n' "$script"
printf ' [--library|--bc-only --disable-dc|--dc-only --disable-bc|--coverage]\\\n'
printf ' [--force --debug --disable-extra-math --disable-generated-tests] \\\n'
@@ -73,6 +75,8 @@ usage() {
printf ' Generate test coverage code. Requires gcov and regcovr.\n'
printf ' It is an error if either "-b" ("-D") or "-d" ("-B") is specified.\n'
printf ' Requires a compiler that use gcc-compatible coverage options\n'
+ printf ' -C, --disable-clean\n'
+ printf ' Disable the clean that configure.sh does before configure.\n'
printf ' -d, --dc-only\n'
printf ' Build dc only. It is an error if "-b", "--bc-only", "-D", or\n'
printf ' "--disable-dc" are specified too.\n'
@@ -107,6 +111,8 @@ usage() {
printf ' Installs all locales, regardless of how many are on the system. This\n'
printf ' option is useful for package maintainers who want to make sure that\n'
printf ' a package contains all of the locales that end users might need.\n'
+ printf ' -m, --enable-memcheck\n'
+ printf ' Enable memcheck mode, to ensure no memory leaks. For development only.\n'
printf ' -M, --disable-man-pages\n'
printf ' Disable installing manpages.\n'
printf ' -N, --disable-nls\n'
@@ -119,9 +125,15 @@ usage() {
printf ' Disables the prompt in the built bc. The prompt will never show up,\n'
printf ' or in other words, it will be permanently disabled and cannot be\n'
printf ' enabled.\n'
+ printf ' -t, --enable-test-timing\n'
+ printf ' Enable the timing of tests. This is for development only.\n'
printf ' -T, --disable-strip\n'
printf ' Disable stripping symbols from the compiled binary or binaries.\n'
printf ' Stripping symbols only happens when debug mode is off.\n'
+ printf ' -v, --enable-valgrind\n'
+ printf ' Enable a build appropriate for valgrind. For development only.\n'
+ printf ' -z, --enable-fuzz-mode\n'
+ printf ' Enable fuzzing mode. THIS IS FOR DEVELOPMENT ONLY.\n'
printf ' --prefix PREFIX\n'
printf ' The prefix to install to. Overrides "$PREFIX" if it exists.\n'
printf ' If PREFIX is "/usr", install path will be "/usr/bin".\n'
@@ -241,7 +253,7 @@ replace_ext() {
_replace_ext_ext1="$2"
_replace_ext_ext2="$3"
- _replace_ext_result=${_replace_ext_file%.$_replace_ext_ext1}.$_replace_ext_ext2
+ _replace_ext_result="${_replace_ext_file%.$_replace_ext_ext1}.$_replace_ext_ext2"
printf '%s\n' "$_replace_ext_result"
}
@@ -277,6 +289,23 @@ replace() {
substring_replace "$_replace_str" "%%$_replace_needle%%" "$_replace_replacement"
}
+find_src_files() {
+
+ if [ "$#" -ge 1 ] && [ "$1" != "" ]; then
+
+ while [ "$#" -ge 1 ]; do
+ _find_src_files_a="${1## }"
+ shift
+ _find_src_files_args="$_find_src_files_args ! -path src/${_find_src_files_a}"
+ done
+
+ else
+ _find_src_files_args="-print"
+ fi
+
+ printf '%s\n' $(find src/ -depth -name "*.c" $_find_src_files_args)
+}
+
gen_file_list() {
if [ "$#" -lt 1 ]; then
@@ -291,15 +320,9 @@ gen_file_list() {
cd "$scriptdir"
if [ "$#" -ge 1 ]; then
-
- while [ "$#" -ge 1 ]; do
- a="$1"
- shift
- args="$args ! -path src/${a}"
- done
-
+ _gen_file_list_unneeded="$@"
else
- args="-print"
+ _gen_file_list_unneeded=""
fi
_gen_file_list_needle_src="SRC"
@@ -307,7 +330,7 @@ gen_file_list() {
_gen_file_list_needle_gcda="GCDA"
_gen_file_list_needle_gcno="GCNO"
- _gen_file_list_replacement=$(find src/ -depth -name "*.c" $args | tr '\n' ' ')
+ _gen_file_list_replacement=$(find_src_files $_gen_file_list_unneeded | tr '\n' ' ')
_gen_file_list_contents=$(replace "$_gen_file_list_contents" \
"$_gen_file_list_needle_src" "$_gen_file_list_replacement")
@@ -328,6 +351,101 @@ gen_file_list() {
printf '%s\n' "$_gen_file_list_contents"
}
+gen_tests() {
+
+ _gen_tests_name="$1"
+ shift
+
+ _gen_tests_uname="$1"
+ shift
+
+ _gen_tests_extra_math="$1"
+ shift
+
+ _gen_tests_time_tests="$1"
+ shift
+
+ _gen_tests_extra_required=$(cat tests/extra_required.txt)
+
+ for _gen_tests_t in $(cat "$scriptdir/tests/$_gen_tests_name/all.txt"); do
+
+ if [ "$_gen_tests_extra_math" -eq 0 ]; then
+
+ if [ -z "${_gen_tests_extra_required##*$_gen_tests_t*}" ]; then
+ printf 'test_%s_%s:\n\t@printf "Skipping %s %s\\n"\n\n' \
+ "$_gen_tests_name" "$_gen_tests_t" "$_gen_tests_name" \
+ "$_gen_tests_t" >> "$scriptdir/Makefile"
+ continue
+ fi
+
+ fi
+
+ printf 'test_%s_%s:\n\t@sh tests/test.sh %s %s %s %s %s\n\n' \
+ "$_gen_tests_name" "$_gen_tests_t" "$_gen_tests_name" \
+ "$_gen_tests_t" "$generate_tests" "$time_tests" \
+ "$*" >> "$scriptdir/Makefile"
+
+ done
+}
+
+gen_test_targets() {
+
+ _gen_test_targets_name="$1"
+ shift
+
+ _gen_test_targets_tests=$(cat "$scriptdir/tests/${_gen_test_targets_name}/all.txt")
+
+ for _gen_test_targets_t in $_gen_test_targets_tests; do
+ printf ' test_%s_%s' "$_gen_test_targets_name" "$_gen_test_targets_t"
+ done
+
+ printf '\n'
+}
+
+gen_script_tests() {
+
+ _gen_script_tests_name="$1"
+ shift
+
+ _gen_script_tests_extra_math="$1"
+ shift
+
+ _gen_script_tests_generate="$1"
+ shift
+
+ _gen_script_tests_time="$1"
+ shift
+
+ _gen_script_tests_tests=$(cat "$scriptdir/tests/$_gen_script_tests_name/scripts/all.txt")
+
+ for _gen_script_tests_f in $_gen_script_tests_tests; do
+
+ _gen_script_tests_b=$(basename "$_gen_script_tests_f" ".${_gen_script_tests_name}")
+
+ printf 'test_%s_script_%s:\n\t@sh tests/script.sh %s %s %s 1 %s %s %s\n\n' \
+ "$_gen_script_tests_name" "$_gen_script_tests_b" "$_gen_script_tests_name" \
+ "$_gen_script_tests_f" "$_gen_script_tests_extra_math" "$_gen_script_tests_generate" \
+ "$_gen_script_tests_time" "$*" >> "$scriptdir/Makefile"
+ done
+}
+
+gen_script_test_targets() {
+
+ _gen_script_test_targets_name="$1"
+ shift
+
+ _gen_script_test_targets_tests=$(cat "$scriptdir/tests/$_gen_script_test_targets_name/scripts/all.txt")
+
+ for _gen_script_test_targets_f in $_gen_script_test_targets_tests; do
+ _gen_script_test_targets_b=$(basename "$_gen_script_test_targets_f" \
+ ".$_gen_script_test_targets_name")
+ printf ' test_%s_script_%s' "$_gen_script_test_targets_name" \
+ "$_gen_script_test_targets_b"
+ done
+
+ printf '\n'
+}
+
bc_only=0
dc_only=0
coverage=0
@@ -344,14 +462,20 @@ force=0
strip_bin=1
all_locales=0
library=0
+fuzz=0
+time_tests=0
+vg=0
+memcheck=0
+clean=1
-while getopts "abBcdDEfgGhHk:lMNO:PST-" opt; do
+while getopts "abBcdDEfgGhHk:lMmNO:PStTvz-" opt; do
case "$opt" in
a) library=1 ;;
b) bc_only=1 ;;
B) dc_only=1 ;;
c) coverage=1 ;;
+ C) clean=0 ;;
d) dc_only=1 ;;
D) bc_only=1 ;;
E) extra_math=0 ;;
@@ -362,11 +486,15 @@ while getopts "abBcdDEfgGhHk:lMNO:PST-" opt; do
H) hist=0 ;;
k) karatsuba_len="$OPTARG" ;;
l) all_locales=1 ;;
+ m) memcheck=1 ;;
M) install_manpages=0 ;;
N) nls=0 ;;
O) optimization="$OPTARG" ;;
P) prompt=0 ;;
+ t) time_tests=1 ;;
T) strip_bin=0 ;;
+ v) vg=1 ;;
+ z) fuzz=1 ;;
-)
arg="$1"
arg="${arg#--}"
@@ -465,6 +593,7 @@ while getopts "abBcdDEfgGhHk:lMNO:PST-" opt; do
shift ;;
disable-bc) dc_only=1 ;;
disable-dc) bc_only=1 ;;
+ disable-clean) clean=0 ;;
disable-extra-math) extra_math=0 ;;
disable-generated-tests) generate_tests=0 ;;
disable-history) hist=0 ;;
@@ -472,16 +601,24 @@ while getopts "abBcdDEfgGhHk:lMNO:PST-" opt; do
disable-nls) nls=0 ;;
disable-prompt) prompt=0 ;;
disable-strip) strip_bin=0 ;;
+ enable-test-timing) time_tests=1 ;;
+ enable-valgrind) vg=1 ;;
+ enable-fuzz-mode) fuzz=1 ;;
+ enable-memcheck) memcheck=1 ;;
install-all-locales) all_locales=1 ;;
help* | bc-only* | dc-only* | coverage* | debug*)
usage "No arg allowed for --$arg option" ;;
- disable-bc* | disable-dc* | disable-extra-math*)
+ disable-bc* | disable-dc* | disable-clean*)
+ usage "No arg allowed for --$arg option" ;;
+ disable-extra-math*)
usage "No arg allowed for --$arg option" ;;
disable-generated-tests* | disable-history*)
usage "No arg allowed for --$arg option" ;;
disable-man-pages* | disable-nls* | disable-strip*)
usage "No arg allowed for --$arg option" ;;
- install-all-locales*)
+ enable-fuzz-mode* | enable-test-timing* | enable-valgrind*)
+ usage "No arg allowed for --$arg option" ;;
+ enable-memcheck* | install-all-locales*)
usage "No arg allowed for --$arg option" ;;
'') break ;; # "--" terminates argument processing
* ) usage "Invalid option $LONG_OPTARG" ;;
@@ -493,6 +630,12 @@ while getopts "abBcdDEfgGhHk:lMNO:PST-" opt; do
done
+if [ "$clean" -ne 0 ]; then
+ if [ -f ./Makefile ]; then
+ make clean_config > /dev/null
+ fi
+fi
+
if [ "$bc_only" -eq 1 ] && [ "$dc_only" -eq 1 ]; then
usage "Can only specify one of -b(-D) or -d(-B)"
fi
@@ -581,21 +724,19 @@ executable="BC_EXEC"
tests="test_bc timeconst test_dc"
bc_test="@tests/all.sh bc $extra_math 1 $generate_tests 0 \$(BC_EXEC)"
-bc_time_test="@tests/all.sh bc $extra_math 1 $generate_tests 1 \$(BC_EXEC)"
-
dc_test="@tests/all.sh dc $extra_math 1 $generate_tests 0 \$(DC_EXEC)"
-dc_time_test="@tests/all.sh dc $extra_math 1 $generate_tests 1 \$(DC_EXEC)"
timeconst="@tests/bc/timeconst.sh tests/bc/scripts/timeconst.bc \$(BC_EXEC)"
# In order to have cleanup at exit, we need to be in
# debug mode, so don't run valgrind without that.
-if [ "$debug" -ne 0 ]; then
- vg_bc_test="@tests/all.sh bc $extra_math 1 $generate_tests 0 valgrind \$(VALGRIND_ARGS) \$(BC_EXEC)"
- vg_dc_test="@tests/all.sh dc $extra_math 1 $generate_tests 0 valgrind \$(VALGRIND_ARGS) \$(DC_EXEC)"
+if [ "$vg" -ne 0 ]; then
+ debug=1
+ bc_test_exec='valgrind $(VALGRIND_ARGS) $(BC_EXEC)'
+ dc_test_exec='valgrind $(VALGRIND_ARGS) $(DC_EXEC)'
else
- vg_bc_test="@printf 'Cannot run valgrind without debug flags\\\\n'"
- vg_dc_test="@printf 'Cannot run valgrind without debug flags\\\\n'"
+ bc_test_exec='$(BC_EXEC)'
+ dc_test_exec='$(DC_EXEC)'
fi
karatsuba="@printf 'karatsuba cannot be run because one of bc or dc is not built\\\\n'"
@@ -605,7 +746,29 @@ bc_lib="\$(GEN_DIR)/lib.o"
bc_help="\$(GEN_DIR)/bc_help.o"
dc_help="\$(GEN_DIR)/dc_help.o"
-if [ "$bc_only" -eq 1 ]; then
+default_target_prereqs="\$(BIN) \$(OBJS)"
+default_target_cmd="\$(CC) \$(CFLAGS) \$(OBJS) \$(LDFLAGS) -o \$(EXEC)"
+default_target="\$(DC_EXEC)"
+
+second_target_prereqs=""
+second_target_cmd="$default_target_cmd"
+second_target="\$(BC_EXEC)"
+
+if [ "$library" -ne 0 ]; then
+
+ extra_math=1
+ nls=0
+ hist=0
+ prompt=0
+ bc=1
+ dc=1
+
+ default_target_prereqs="\$(BIN) \$(OBJ)"
+ default_target_cmd="ar -r -cu \$(LIBBC) \$(OBJ)"
+ default_target="\$(LIBBC)"
+ tests="test_library"
+
+elif [ "$bc_only" -eq 1 ]; then
bc=1
dc=0
@@ -615,14 +778,16 @@ if [ "$bc_only" -eq 1 ]; then
executables="bc"
dc_test="@printf 'No dc tests to run\\\\n'"
- dc_time_test="@printf 'No dc tests to run\\\\n'"
- vg_dc_test="@printf 'No dc tests to run\\\\n'"
install_prereqs=" install_execs"
install_man_prereqs=" install_bc_manpage"
uninstall_prereqs=" uninstall_bc"
uninstall_man_prereqs=" uninstall_bc_manpage"
+ default_target="\$(BC_EXEC)"
+ second_target="\$(DC_EXEC)"
+ tests="test_bc timeconst"
+
elif [ "$dc_only" -eq 1 ]; then
bc=0
@@ -637,8 +802,6 @@ elif [ "$dc_only" -eq 1 ]; then
executable="DC_EXEC"
bc_test="@printf 'No bc tests to run\\\\n'"
- bc_time_test="@printf 'No bc tests to run\\\\n'"
- vg_bc_test="@printf 'No bc tests to run\\\\n'"
timeconst="@printf 'timeconst cannot be run because bc is not built\\\\n'"
@@ -647,6 +810,8 @@ elif [ "$dc_only" -eq 1 ]; then
uninstall_prereqs=" uninstall_dc"
uninstall_man_prereqs=" uninstall_dc_manpage"
+ tests="test_dc"
+
else
bc=1
@@ -654,8 +819,6 @@ else
executables="bc and dc"
- link="\$(LINK) \$(BIN) \$(EXEC_PREFIX)\$(DC)"
-
karatsuba="@\$(KARATSUBA) 30 0 \$(BC_EXEC)"
karatsuba_test="@\$(KARATSUBA) 1 100 \$(BC_EXEC)"
@@ -672,6 +835,18 @@ else
tests="test_library"
fi
+ second_target_prereqs="$default_target_prereqs"
+ default_target_prereqs="$second_target"
+ default_target_cmd="\$(LINK) \$(BIN) \$(EXEC_PREFIX)\$(DC)"
+
+fi
+
+if [ "$fuzz" -ne 0 ]; then
+ debug=1
+ hist=0
+ prompt=0
+ nls=0
+ optimization="3"
fi
if [ "$debug" -eq 1 ]; then
@@ -763,16 +938,6 @@ else
uninstall_man_prereqs=""
fi
-if [ "$library" -ne 0 ]; then
- extra_math=1
- nls=0
- hist=0
- prompt=0
- ALL_PREREQ="library"
-else
- ALL_PREREQ="execs"
-fi
-
if [ "$nls" -ne 0 ]; then
set +e
@@ -913,13 +1078,21 @@ else
fi
manpage_args=""
+unneeded=""
+headers="\$(HEADERS)"
if [ "$extra_math" -eq 0 ]; then
manpage_args="E"
+ unneeded="$unneeded rand.c"
+else
+ headers="$headers \$(EXTRA_MATH_HEADERS)"
fi
if [ "$hist" -eq 0 ]; then
manpage_args="${manpage_args}H"
+ unneeded="$unneeded history.c"
+else
+ headers="$headers \$(HISTORY_HEADERS)"
fi
if [ "$nls" -eq 0 ]; then
@@ -930,26 +1103,16 @@ if [ "$prompt" -eq 0 ]; then
manpage_args="${manpage_args}P"
fi
-if [ "$manpage_args" = "" ]; then
- manpage_args="A"
-fi
-
-unneeded=""
-
-if [ "$hist" -eq 0 ]; then
- unneeded="$unneeded history.c"
-fi
-
if [ "$bc" -eq 0 ]; then
unneeded="$unneeded bc.c bc_lex.c bc_parse.c"
+else
+ headers="$headers \$(BC_HEADERS)"
fi
if [ "$dc" -eq 0 ]; then
unneeded="$unneeded dc.c dc_lex.c dc_parse.c"
-fi
-
-if [ "$extra_math" -eq 0 ]; then
- unneeded="$unneeded rand.c"
+else
+ headers="$headers \$(DC_HEADERS)"
fi
if [ "$library" -ne 0 ]; then
@@ -957,10 +1120,24 @@ if [ "$library" -ne 0 ]; then
unneeded="$unneeded lang.c lex.c parse.c program.c"
unneeded="$unneeded bc.c bc_lex.c bc_parse.c"
unneeded="$unneeded dc.c dc_lex.c dc_parse.c"
+ headers="$headers \$(LIBRARY_HEADERS)"
else
unneeded="$unneeded library.c"
fi
+if [ "$manpage_args" = "" ]; then
+ manpage_args="A"
+fi
+
+if [ "$vg" -ne 0 ]; then
+ memcheck=1
+fi
+
+bc_tests=$(gen_test_targets bc)
+bc_script_tests=$(gen_script_test_targets bc)
+dc_tests=$(gen_test_targets dc)
+dc_script_tests=$(gen_script_test_targets dc)
+
# Print out the values; this is for debugging.
if [ "$bc" -ne 0 ]; then
printf 'Building bc\n'
@@ -978,6 +1155,7 @@ printf 'BC_ENABLE_HISTORY=%s\n' "$hist"
printf 'BC_ENABLE_EXTRA_MATH=%s\n' "$extra_math"
printf 'BC_ENABLE_NLS=%s\n' "$nls"
printf 'BC_ENABLE_PROMPT=%s\n' "$prompt"
+printf 'BC_ENABLE_AFL=%s\n' "$fuzz"
printf '\n'
printf 'BC_NUM_KARATSUBA_LEN=%s\n' "$karatsuba_len"
printf '\n'
@@ -1012,20 +1190,45 @@ replacement='*** WARNING: Autogenerated from Makefile.in. DO NOT MODIFY ***'
contents=$(replace "$contents" "$needle" "$replacement")
if [ "$unneeded" = "" ]; then
- contents=$(gen_file_list "$contents" "library.c")
-else
- contents=$(gen_file_list "$contents" $unneeded)
+ unneeded="library.c"
fi
+contents=$(gen_file_list "$contents" $unneeded)
+
+SRC_TARGETS=""
+
+src_files=$(find_src_files $unneeded)
+
+for f in $src_files; do
+ o=$(replace_ext "$f" "c" "o")
+ SRC_TARGETS=$(printf '%s\n\n%s: %s %s\n\t$(CC) $(CFLAGS) -o %s -c %s\n' \
+ "$SRC_TARGETS" "$o" "$headers" "$f" "$o" "$f")
+done
+
+contents=$(replace "$contents" "HEADERS" "$headers")
+
contents=$(replace "$contents" "BC_ENABLED" "$bc")
contents=$(replace "$contents" "DC_ENABLED" "$dc")
-contents=$(replace "$contents" "LINK" "$link")
+
+contents=$(replace "$contents" "BC_ALL_TESTS" "$bc_test")
+contents=$(replace "$contents" "BC_TESTS" "$bc_tests")
+contents=$(replace "$contents" "BC_SCRIPT_TESTS" "$bc_script_tests")
+contents=$(replace "$contents" "BC_TEST_EXEC" "$bc_test_exec")
+contents=$(replace "$contents" "TIMECONST_ALL_TESTS" "$timeconst")
+
+contents=$(replace "$contents" "DC_ALL_TESTS" "$dc_test")
+contents=$(replace "$contents" "DC_TESTS" "$dc_tests")
+contents=$(replace "$contents" "DC_SCRIPT_TESTS" "$dc_script_tests")
+contents=$(replace "$contents" "DC_TEST_EXEC" "$dc_test_exec")
contents=$(replace "$contents" "LIBRARY" "$library")
contents=$(replace "$contents" "HISTORY" "$hist")
contents=$(replace "$contents" "EXTRA_MATH" "$extra_math")
contents=$(replace "$contents" "NLS" "$nls")
contents=$(replace "$contents" "PROMPT" "$prompt")
+contents=$(replace "$contents" "FUZZ" "$fuzz")
+contents=$(replace "$contents" "MEMCHECK" "$memcheck")
+
contents=$(replace "$contents" "BC_LIB_O" "$bc_lib")
contents=$(replace "$contents" "BC_HELP_O" "$bc_help")
contents=$(replace "$contents" "DC_HELP_O" "$dc_help")
@@ -1057,7 +1260,18 @@ contents=$(replace "$contents" "UNINSTALL_MAN_PREREQS" "$uninstall_man_prereqs")
contents=$(replace "$contents" "UNINSTALL_PREREQS" "$uninstall_prereqs")
contents=$(replace "$contents" "UNINSTALL_LOCALES_PREREQS" "$uninstall_locales_prereqs")
+contents=$(replace "$contents" "DEFAULT_TARGET" "$default_target")
+contents=$(replace "$contents" "DEFAULT_TARGET_PREREQS" "$default_target_prereqs")
+contents=$(replace "$contents" "DEFAULT_TARGET_CMD" "$default_target_cmd")
+contents=$(replace "$contents" "SECOND_TARGET" "$second_target")
+contents=$(replace "$contents" "SECOND_TARGET_PREREQS" "$second_target_prereqs")
+contents=$(replace "$contents" "SECOND_TARGET_CMD" "$second_target_cmd")
+
contents=$(replace "$contents" "ALL_PREREQ" "$ALL_PREREQ")
+contents=$(replace "$contents" "BC_EXEC_PREREQ" "$bc_exec_prereq")
+contents=$(replace "$contents" "BC_EXEC_CMD" "$bc_exec_cmd")
+contents=$(replace "$contents" "DC_EXEC_PREREQ" "$dc_exec_prereq")
+contents=$(replace "$contents" "DC_EXEC_CMD" "$dc_exec_cmd")
contents=$(replace "$contents" "EXECUTABLES" "$executables")
contents=$(replace "$contents" "MAIN_EXEC" "$main_exec")
@@ -1065,10 +1279,7 @@ contents=$(replace "$contents" "EXEC" "$executable")
contents=$(replace "$contents" "TESTS" "$tests")
contents=$(replace "$contents" "BC_TEST" "$bc_test")
-contents=$(replace "$contents" "BC_TIME_TEST" "$bc_time_test")
-
contents=$(replace "$contents" "DC_TEST" "$dc_test")
-contents=$(replace "$contents" "DC_TIME_TEST" "$dc_time_test")
contents=$(replace "$contents" "VG_BC_TEST" "$vg_bc_test")
contents=$(replace "$contents" "VG_DC_TEST" "$vg_dc_test")
@@ -1086,7 +1297,17 @@ contents=$(replace "$contents" "GEN_EXEC_TARGET" "$GEN_EXEC_TARGET")
contents=$(replace "$contents" "CLEAN_PREREQS" "$CLEAN_PREREQS")
contents=$(replace "$contents" "GEN_EMU" "$GEN_EMU")
-printf '%s\n' "$contents" > "$scriptdir/Makefile"
+printf '%s\n%s\n\n' "$contents" "$SRC_TARGETS" > "$scriptdir/Makefile"
+
+if [ "$bc" -ne 0 ]; then
+ gen_tests bc BC "$extra_math" "$time_tests" $bc_test_exec
+ gen_script_tests bc "$extra_math" "$generate_tests" "$time_tests" $bc_test_exec
+fi
+
+if [ "$dc" -ne 0 ]; then
+ gen_tests dc DC "$extra_math" "$time_tests" $dc_test_exec
+ gen_script_tests dc "$extra_math" "$generate_tests" "$time_tests" $dc_test_exec
+fi
cd "$scriptdir"
diff --git a/contrib/bc/exec-install.sh b/contrib/bc/exec-install.sh
index 6d1600330ba9..5905fd181d97 100755
--- a/contrib/bc/exec-install.sh
+++ b/contrib/bc/exec-install.sh
@@ -2,7 +2,7 @@
#
# SPDX-License-Identifier: BSD-2-Clause
#
-# Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+# Copyright (c) 2018-2021 Gavin D. Howard and contributors.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
diff --git a/contrib/bc/functions.sh b/contrib/bc/functions.sh
index 96afb059c951..87f3c85cb532 100755
--- a/contrib/bc/functions.sh
+++ b/contrib/bc/functions.sh
@@ -2,7 +2,7 @@
#
# SPDX-License-Identifier: BSD-2-Clause
#
-# Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+# Copyright (c) 2018-2021 Gavin D. Howard and contributors.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
@@ -59,10 +59,56 @@ err_exit() {
fi
printf '%s\n' "$1"
- printf '\nexiting...\n'
exit "$2"
}
+checktest_retcode() {
+
+ _checktest_retcode_d="$1"
+ shift
+
+ _checktest_retcode_err="$1"
+ shift
+
+ _checktest_retcode_name="$1"
+ shift
+
+ if [ "$_checktest_retcode_err" -ne 0 ]; then
+ printf 'FAIL!!!\n'
+ err_exit "$_checktest_retcode_d failed test '$_checktest_retcode_name' with error code $_checktest_retcode_err" 1
+ fi
+}
+
+checktest() {
+
+ _checktest_d="$1"
+ shift
+
+ _checktest_err="$1"
+ shift
+
+ _checktest_name="$1"
+ shift
+
+ _checktest_test_path="$1"
+ shift
+
+ _checktest_results_name="$1"
+ shift
+
+ checktest_retcode "$_checktest_d" "$_checktest_err" "$_checktest_name"
+
+ _checktest_diff=$(diff "$_checktest_test_path" "$_checktest_results_name")
+
+ _checktest_err="$?"
+
+ if [ "$_checktest_err" -ne 0 ]; then
+ printf 'FAIL!!!\n'
+ printf '%s\n' "$_checktest_diff"
+ err_exit "$_checktest_d failed test $_checktest_name" 1
+ fi
+}
+
die() {
_die_d="$1"
@@ -99,49 +145,49 @@ checkcrash() {
fi
}
-checktest()
+checkerrtest()
{
- _checktest_d="$1"
+ _checkerrtest_d="$1"
shift
- _checktest_error="$1"
+ _checkerrtest_error="$1"
shift
- _checktest_name="$1"
+ _checkerrtest_name="$1"
shift
- _checktest_out="$1"
+ _checkerrtest_out="$1"
shift
- _checktest_exebase="$1"
+ _checkerrtest_exebase="$1"
shift
- checkcrash "$_checktest_d" "$_checktest_error" "$_checktest_name"
+ checkcrash "$_checkerrtest_d" "$_checkerrtest_error" "$_checkerrtest_name"
- if [ "$_checktest_error" -eq 0 ]; then
- die "$_checktest_d" "returned no error" "$_checktest_name" 127
+ if [ "$_checkerrtest_error" -eq 0 ]; then
+ die "$_checkerrtest_d" "returned no error" "$_checkerrtest_name" 127
fi
- if [ "$_checktest_error" -eq 100 ]; then
+ if [ "$_checkerrtest_error" -eq 100 ]; then
- _checktest_output=$(cat "$_checktest_out")
- _checktest_fatal_error="Fatal error"
+ _checkerrtest_output=$(cat "$_checkerrtest_out")
+ _checkerrtest_fatal_error="Fatal error"
- if [ "${_checktest_output##*$_checktest_fatal_error*}" ]; then
- printf "%s\n" "$_checktest_output"
- die "$_checktest_d" "had memory errors on a non-fatal error" \
- "$_checktest_name" "$_checktest_error"
+ if [ "${_checkerrtest_output##*$_checkerrtest_fatal_error*}" ]; then
+ printf "%s\n" "$_checkerrtest_output"
+ die "$_checkerrtest_d" "had memory errors on a non-fatal error" \
+ "$_checkerrtest_name" "$_checkerrtest_error"
fi
fi
- if [ ! -s "$_checktest_out" ]; then
- die "$_checktest_d" "produced no error message" "$_checktest_name" "$_checktest_error"
+ if [ ! -s "$_checkerrtest_out" ]; then
+ die "$_checkerrtest_d" "produced no error message" "$_checkerrtest_name" "$_checkerrtest_error"
fi
# Display the error messages if not directly running exe.
# This allows the script to print valgrind output.
- if [ "$_checktest_exebase" != "bc" -a "$_checktest_exebase" != "dc" ]; then
- cat "$_checktest_out"
+ if [ "$_checkerrtest_exebase" != "bc" -a "$_checkerrtest_exebase" != "dc" ]; then
+ cat "$_checkerrtest_out"
fi
}
diff --git a/contrib/bc/gen/bc_help.txt b/contrib/bc/gen/bc_help.txt
index e013251b16bb..3f5aac892268 100644
--- a/contrib/bc/gen/bc_help.txt
+++ b/contrib/bc/gen/bc_help.txt
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
- * Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+ * Copyright (c) 2018-2021 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
diff --git a/contrib/bc/gen/dc_help.txt b/contrib/bc/gen/dc_help.txt
index 6a26ece26488..4b6a61c872f6 100644
--- a/contrib/bc/gen/dc_help.txt
+++ b/contrib/bc/gen/dc_help.txt
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
- * Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+ * Copyright (c) 2018-2021 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
diff --git a/contrib/bc/gen/lib.bc b/contrib/bc/gen/lib.bc
index 7768eb74bad1..2cd9256efa53 100644
--- a/contrib/bc/gen/lib.bc
+++ b/contrib/bc/gen/lib.bc
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
- * Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+ * Copyright (c) 2018-2021 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
diff --git a/contrib/bc/gen/lib2.bc b/contrib/bc/gen/lib2.bc
index 98baffdd30f6..399c7ad3d313 100644
--- a/contrib/bc/gen/lib2.bc
+++ b/contrib/bc/gen/lib2.bc
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
- * Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+ * Copyright (c) 2018-2021 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -110,7 +110,7 @@ define root(x,n){
if(n<0)sqrt(n)
n=n$
if(n==0)x/n
- if(n==1)return x
+ if(x==0||n==1)return x
if(n==2)return sqrt(x)
s=scale
scale=0
diff --git a/contrib/bc/gen/strgen.c b/contrib/bc/gen/strgen.c
index 0b2306152874..2d133ba51e68 100644
--- a/contrib/bc/gen/strgen.c
+++ b/contrib/bc/gen/strgen.c
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
- * Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+ * Copyright (c) 2018-2021 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -43,7 +43,7 @@
#include <libgen.h>
static const char* const bc_gen_header =
- "// Copyright (c) 2018-2020 Gavin D. Howard and contributors.\n"
+ "// Copyright (c) 2018-2021 Gavin D. Howard and contributors.\n"
"// Licensed under the 2-clause BSD license.\n"
"// *** AUTOMATICALLY GENERATED FROM %s. DO NOT MODIFY. ***\n\n";
diff --git a/contrib/bc/gen/strgen.sh b/contrib/bc/gen/strgen.sh
index 27edf9a1355d..0af6bdf65b5c 100755
--- a/contrib/bc/gen/strgen.sh
+++ b/contrib/bc/gen/strgen.sh
@@ -2,7 +2,7 @@
#
# SPDX-License-Identifier: BSD-2-Clause
#
-# Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+# Copyright (c) 2018-2021 Gavin D. Howard and contributors.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
@@ -64,7 +64,7 @@ if [ -n "$remove_tabs" ]; then
fi
cat<<EOF
-// Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+// Copyright (c) 2018-2021 Gavin D. Howard and contributors.
// Licensed under the 2-clause BSD license.
// *** AUTOMATICALLY GENERATED FROM ${input}. DO NOT MODIFY. ***
diff --git a/contrib/bc/include/args.h b/contrib/bc/include/args.h
index f2bc2d6bab05..d53785067237 100644
--- a/contrib/bc/include/args.h
+++ b/contrib/bc/include/args.h
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
- * Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+ * Copyright (c) 2018-2021 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -39,7 +39,7 @@
#include <status.h>
#include <vm.h>
-void bc_args(int argc, char *argv[]);
+void bc_args(int argc, char *argv[], bool exit_exprs);
extern const char* const bc_args_env_name;
diff --git a/contrib/bc/include/bc.h b/contrib/bc/include/bc.h
index 383e7e7ec562..f519d09c4838 100644
--- a/contrib/bc/include/bc.h
+++ b/contrib/bc/include/bc.h
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
- * Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+ * Copyright (c) 2018-2021 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
diff --git a/contrib/bc/include/bcl.h b/contrib/bc/include/bcl.h
index 05f1631e5534..3c67beb23122 100644
--- a/contrib/bc/include/bcl.h
+++ b/contrib/bc/include/bcl.h
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
- * Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+ * Copyright (c) 2018-2021 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
diff --git a/contrib/bc/include/dc.h b/contrib/bc/include/dc.h
index 07af135bc38f..315aeb78b1ad 100644
--- a/contrib/bc/include/dc.h
+++ b/contrib/bc/include/dc.h
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
- * Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+ * Copyright (c) 2018-2021 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
diff --git a/contrib/bc/include/file.h b/contrib/bc/include/file.h
index 6fa08b3f436c..1c3273b7a756 100644
--- a/contrib/bc/include/file.h
+++ b/contrib/bc/include/file.h
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
- * Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+ * Copyright (c) 2018-2021 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
diff --git a/contrib/bc/include/history.h b/contrib/bc/include/history.h
index c632bc81a2a0..d3622ae15a30 100644
--- a/contrib/bc/include/history.h
+++ b/contrib/bc/include/history.h
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
- * Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+ * Copyright (c) 2018-2021 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
diff --git a/contrib/bc/include/lang.h b/contrib/bc/include/lang.h
index a8ab08ad9bf4..7158f10dc0f4 100644
--- a/contrib/bc/include/lang.h
+++ b/contrib/bc/include/lang.h
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
- * Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+ * Copyright (c) 2018-2021 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
diff --git a/contrib/bc/include/lex.h b/contrib/bc/include/lex.h
index ff9592b6e928..2da42d432f1e 100644
--- a/contrib/bc/include/lex.h
+++ b/contrib/bc/include/lex.h
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
- * Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+ * Copyright (c) 2018-2021 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
diff --git a/contrib/bc/include/library.h b/contrib/bc/include/library.h
index 17c3f572caee..3b98091fa523 100644
--- a/contrib/bc/include/library.h
+++ b/contrib/bc/include/library.h
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
- * Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+ * Copyright (c) 2018-2021 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
diff --git a/contrib/bc/include/num.h b/contrib/bc/include/num.h
index 4868ae3de6a8..2104f8b8acad 100644
--- a/contrib/bc/include/num.h
+++ b/contrib/bc/include/num.h
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
- * Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+ * Copyright (c) 2018-2021 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -236,7 +236,9 @@ void bc_num_zero(BcNum *restrict n);
void bc_num_one(BcNum *restrict n);
ssize_t bc_num_cmpZero(const BcNum *n);
+#if !defined(NDEBUG) || BC_ENABLE_LIBRARY
bool bc_num_strValid(const char *restrict val);
+#endif // !defined(NDEBUG) || BC_ENABLE_LIBRARY
void bc_num_parse(BcNum *restrict n, const char *restrict val, BcBigDig base);
void bc_num_print(BcNum *restrict n, BcBigDig base, bool newline);
#if DC_ENABLED
diff --git a/contrib/bc/include/opt.h b/contrib/bc/include/opt.h
index eb3d5959adc0..e828a92c94df 100644
--- a/contrib/bc/include/opt.h
+++ b/contrib/bc/include/opt.h
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
- * Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+ * Copyright (c) 2018-2021 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
diff --git a/contrib/bc/include/parse.h b/contrib/bc/include/parse.h
index 7f59885346dc..36d6e8c60afd 100644
--- a/contrib/bc/include/parse.h
+++ b/contrib/bc/include/parse.h
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
- * Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+ * Copyright (c) 2018-2021 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
diff --git a/contrib/bc/include/program.h b/contrib/bc/include/program.h
index a9805fbfb316..ec31f3486270 100644
--- a/contrib/bc/include/program.h
+++ b/contrib/bc/include/program.h
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
- * Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+ * Copyright (c) 2018-2021 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
diff --git a/contrib/bc/include/rand.h b/contrib/bc/include/rand.h
index a2fb713803ee..77663d9e13d2 100644
--- a/contrib/bc/include/rand.h
+++ b/contrib/bc/include/rand.h
@@ -1,34 +1,6 @@
/*
* *****************************************************************************
*
- * SPDX-License-Identifier: BSD-2-Clause
- *
- * Copyright (c) 2018-2019 Gavin D. Howard and contributors.
- *
- * 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.
- *
- * *****************************************************************************
- *
* Parts of this code are adapted from the following:
*
* PCG, A Family of Better Random Number Generators.
@@ -38,9 +10,10 @@
*
* -----------------------------------------------------------------------------
*
- * Parts of this code are also under the following license:
+ * This code is under the following license:
*
* Copyright (c) 2014-2017 Melissa O'Neill and PCG Project contributors
+ * Copyright (c) 2018-2021 Gavin D. Howard and contributors.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/contrib/bc/include/read.h b/contrib/bc/include/read.h
index 664ff983e522..84d65063f14a 100644
--- a/contrib/bc/include/read.h
+++ b/contrib/bc/include/read.h
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
- * Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+ * Copyright (c) 2018-2021 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
diff --git a/contrib/bc/include/status.h b/contrib/bc/include/status.h
index 762ff3e25c36..cf41a3ce4670 100644
--- a/contrib/bc/include/status.h
+++ b/contrib/bc/include/status.h
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
- * Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+ * Copyright (c) 2018-2021 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -46,6 +46,16 @@
#define DC_ENABLED (1)
#endif // DC_ENABLED
+#if BC_ENABLE_AFL
+#ifndef __AFL_HAVE_MANUAL_CONTROL
+#error Must compile with afl-clang-fast for fuzzing
+#endif // __AFL_HAVE_MANUAL_CONTROL
+#endif // BC_ENABLE_AFL
+
+#ifndef BC_ENABLE_MEMCHECK
+#define BC_ENABLE_MEMCHECK (0)
+#endif // BC_ENABLE_MEMCHECK
+
#include <bcl.h>
typedef enum BcStatus {
@@ -166,10 +176,18 @@ typedef enum BcErr {
#endif // __STDC_VERSION__
#if defined(__clang__) || defined(__GNUC__)
+#if defined(__has_attribute)
+#if __has_attribute(fallthrough)
#define BC_FALLTHROUGH __attribute__((fallthrough));
+#else // __has_attribute(fallthrough)
+#define BC_FALLTHROUGH
+#endif // __has_attribute(fallthrough)
+#else // defined(__has_attribute)
+#define BC_FALLTHROUGH
+#endif // defined(__has_attribute)
#else // defined(__clang__) || defined(__GNUC__)
#define BC_FALLTHROUGH
-#endif //defined(__clang__) || defined(__GNUC__)
+#endif // defined(__clang__) || defined(__GNUC__)
// Workarounds for AIX's POSIX incompatibility.
#ifndef SIZE_MAX
diff --git a/contrib/bc/include/vector.h b/contrib/bc/include/vector.h
index fdfb85d58228..45398cba2eda 100644
--- a/contrib/bc/include/vector.h
+++ b/contrib/bc/include/vector.h
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
- * Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+ * Copyright (c) 2018-2021 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -91,6 +91,7 @@ bool bc_map_insert(BcVec *restrict v, const char *name,
size_t bc_map_index(const BcVec *restrict v, const char *name);
#define bc_vec_pop(v) (bc_vec_npop((v), 1))
+#define bc_vec_popAll(v) (bc_vec_npop((v), (v)->len))
#define bc_vec_top(v) (bc_vec_item_rev((v), 0))
#ifndef NDEBUG
diff --git a/contrib/bc/include/vm.h b/contrib/bc/include/vm.h
index 72a5150266a1..80a060edd42f 100644
--- a/contrib/bc/include/vm.h
+++ b/contrib/bc/include/vm.h
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
- * Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+ * Copyright (c) 2018-2021 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -318,7 +318,7 @@ typedef struct BcVm {
#if !BC_ENABLE_LIBRARY
BcParse prs;
BcProgram prog;
-#endif // BC_ENABLE_LIBRARY
+#endif // !BC_ENABLE_LIBRARY
BcVec jmp_bufs;
@@ -343,7 +343,7 @@ typedef struct BcVm {
const char* file;
const char *sigmsg;
-#endif // BC_ENABLE_LIBRARY
+#endif // !BC_ENABLE_LIBRARY
volatile sig_atomic_t sig_lock;
volatile sig_atomic_t sig;
#if !BC_ENABLE_LIBRARY
@@ -356,8 +356,9 @@ typedef struct BcVm {
uint16_t line_len;
bool no_exit_exprs;
+ bool exit_exprs;
bool eof;
-#endif // BC_ENABLE_LIBRARY
+#endif // !BC_ENABLE_LIBRARY
BcBigDig maxes[BC_PROG_GLOBALS_LEN + BC_ENABLE_EXTRA_MATH];
@@ -382,7 +383,7 @@ typedef struct BcVm {
const char *err_msgs[BC_ERR_NELEMS];
const char *locale;
-#endif // BC_ENABLE_LIBRARY
+#endif // !BC_ENABLE_LIBRARY
BcBigDig last_base;
BcBigDig last_pow;
@@ -392,7 +393,7 @@ typedef struct BcVm {
#if !BC_ENABLE_LIBRARY
char *env_args_buffer;
BcVec env_args;
-#endif // BC_ENABLE_LIBRARY
+#endif // !BC_ENABLE_LIBRARY
BcNum max;
BcNum max2;
@@ -436,8 +437,15 @@ void bc_vm_jmp(void);
#if BC_ENABLE_LIBRARY
void bc_vm_handleError(BcErr e);
+void bc_vm_fatalError(BcErr e);
+void bc_vm_atexit(void);
#else // BC_ENABLE_LIBRARY
void bc_vm_handleError(BcErr e, size_t line, ...);
+#if !BC_ENABLE_LIBRARY && !BC_ENABLE_MEMCHECK
+BC_NORETURN
+#endif // !BC_ENABLE_LIBRARY && !BC_ENABLE_MEMCHECK
+void bc_vm_fatalError(BcErr e);
+int bc_vm_atexit(int status);
#endif // BC_ENABLE_LIBRARY
extern const char bc_copyright[];
diff --git a/contrib/bc/karatsuba.py b/contrib/bc/karatsuba.py
index a3cc8e6eed40..cfab4c4f4fbf 100755
--- a/contrib/bc/karatsuba.py
+++ b/contrib/bc/karatsuba.py
@@ -2,7 +2,7 @@
#
# SPDX-License-Identifier: BSD-2-Clause
#
-# Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+# Copyright (c) 2018-2021 Gavin D. Howard and contributors.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
@@ -121,20 +121,20 @@ else:
p = run([ "make", "clean" ])
-print("Testing \"make -j4\"")
+print("Testing \"make -j12\"")
if p.returncode != 0:
print("make returned an error ({}); exiting...".format(p.returncode))
sys.exit(p.returncode)
-p = run([ "make", "-j4" ])
+p = run([ "make", "-j12" ])
if p.returncode == 0:
- makecmd = [ "make", "-j4" ]
- print("Using \"make -j4\"")
+ makecmd = [ "make", "-j12" ]
+ print("Using \"make -j12\"")
else:
makecmd = [ "make" ]
- print("Not using \"make -j4\"")
+ print("Not using \"make -j12\"")
if test_num != 0:
mx2 = test_num
diff --git a/contrib/bc/link.sh b/contrib/bc/link.sh
index 6f235c0920da..b983fa210876 100755
--- a/contrib/bc/link.sh
+++ b/contrib/bc/link.sh
@@ -2,7 +2,7 @@
#
# SPDX-License-Identifier: BSD-2-Clause
#
-# Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+# Copyright (c) 2018-2021 Gavin D. Howard and contributors.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
diff --git a/contrib/bc/locale_install.sh b/contrib/bc/locale_install.sh
index 38863d2b2969..6c9c292408d9 100755
--- a/contrib/bc/locale_install.sh
+++ b/contrib/bc/locale_install.sh
@@ -2,7 +2,7 @@
#
# SPDX-License-Identifier: BSD-2-Clause
#
-# Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+# Copyright (c) 2018-2021 Gavin D. Howard and contributors.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
diff --git a/contrib/bc/locale_uninstall.sh b/contrib/bc/locale_uninstall.sh
index d38a5470e791..d97fc759809c 100755
--- a/contrib/bc/locale_uninstall.sh
+++ b/contrib/bc/locale_uninstall.sh
@@ -2,7 +2,7 @@
#
# SPDX-License-Identifier: BSD-2-Clause
#
-# Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+# Copyright (c) 2018-2021 Gavin D. Howard and contributors.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
diff --git a/contrib/bc/locales/de_DE.ISO8859-1.msg b/contrib/bc/locales/de_DE.ISO8859-1.msg
index 518ddf0cf473..57e9673fcef1 100644
--- a/contrib/bc/locales/de_DE.ISO8859-1.msg
+++ b/contrib/bc/locales/de_DE.ISO8859-1.msg
@@ -1,7 +1,7 @@
$ $
$ SPDX-License-Identifier: BSD-2-Clause
$ $
-$ Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+$ Copyright (c) 2018-2021 Gavin D. Howard and contributors.
$ $
$ Redistribution and use in source and binary forms, with or without
$ modification, are permitted provided that the following conditions are met:
diff --git a/contrib/bc/locales/de_DE.UTF-8.msg b/contrib/bc/locales/de_DE.UTF-8.msg
index 2e3cd675b451..a0b75aa202b9 100644
--- a/contrib/bc/locales/de_DE.UTF-8.msg
+++ b/contrib/bc/locales/de_DE.UTF-8.msg
@@ -1,7 +1,7 @@
$ $
$ SPDX-License-Identifier: BSD-2-Clause
$ $
-$ Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+$ Copyright (c) 2018-2021 Gavin D. Howard and contributors.
$ $
$ Redistribution and use in source and binary forms, with or without
$ modification, are permitted provided that the following conditions are met:
diff --git a/contrib/bc/locales/en_US.msg b/contrib/bc/locales/en_US.msg
index 3d0ca99ac8cc..84288512ead2 100644
--- a/contrib/bc/locales/en_US.msg
+++ b/contrib/bc/locales/en_US.msg
@@ -1,7 +1,7 @@
$ $
$ SPDX-License-Identifier: BSD-2-Clause
$ $
-$ Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+$ Copyright (c) 2018-2021 Gavin D. Howard and contributors.
$ $
$ Redistribution and use in source and binary forms, with or without
$ modification, are permitted provided that the following conditions are met:
diff --git a/contrib/bc/locales/es_ES.ISO8859-1.msg b/contrib/bc/locales/es_ES.ISO8859-1.msg
index 5a66561e9758..ba4e924d17bf 100644
--- a/contrib/bc/locales/es_ES.ISO8859-1.msg
+++ b/contrib/bc/locales/es_ES.ISO8859-1.msg
@@ -1,7 +1,7 @@
$ $
$ SPDX-License-Identifier: BSD-2-Clause
$ $
-$ Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+$ Copyright (c) 2018-2021 Gavin D. Howard and contributors.
$ $
$ Redistribution and use in source and binary forms, with or without
$ modification, are permitted provided that the following conditions are met:
diff --git a/contrib/bc/locales/es_ES.UTF-8.msg b/contrib/bc/locales/es_ES.UTF-8.msg
index ab33b973f675..46a54bfbc3a7 100644
--- a/contrib/bc/locales/es_ES.UTF-8.msg
+++ b/contrib/bc/locales/es_ES.UTF-8.msg
@@ -1,7 +1,7 @@
$ $
$ SPDX-License-Identifier: BSD-2-Clause
$ $
-$ Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+$ Copyright (c) 2018-2021 Gavin D. Howard and contributors.
$ $
$ Redistribution and use in source and binary forms, with or without
$ modification, are permitted provided that the following conditions are met:
diff --git a/contrib/bc/locales/fr_FR.ISO8859-1.msg b/contrib/bc/locales/fr_FR.ISO8859-1.msg
index 42c3f26ca5b7..f0d435ade43b 100644
--- a/contrib/bc/locales/fr_FR.ISO8859-1.msg
+++ b/contrib/bc/locales/fr_FR.ISO8859-1.msg
@@ -1,7 +1,7 @@
$ $
$ SPDX-License-Identifier: BSD-2-Clause
$ $
-$ Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+$ Copyright (c) 2018-2021 Gavin D. Howard and contributors.
$ $
$ Redistribution and use in source and binary forms, with or without
$ modification, are permitted provided that the following conditions are met:
diff --git a/contrib/bc/locales/fr_FR.UTF-8.msg b/contrib/bc/locales/fr_FR.UTF-8.msg
index 42c3f26ca5b7..f0d435ade43b 100644
--- a/contrib/bc/locales/fr_FR.UTF-8.msg
+++ b/contrib/bc/locales/fr_FR.UTF-8.msg
@@ -1,7 +1,7 @@
$ $
$ SPDX-License-Identifier: BSD-2-Clause
$ $
-$ Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+$ Copyright (c) 2018-2021 Gavin D. Howard and contributors.
$ $
$ Redistribution and use in source and binary forms, with or without
$ modification, are permitted provided that the following conditions are met:
diff --git a/contrib/bc/locales/ja_JP.UTF-8.msg b/contrib/bc/locales/ja_JP.UTF-8.msg
index 587c84413aab..f55f27b4c72b 100644
--- a/contrib/bc/locales/ja_JP.UTF-8.msg
+++ b/contrib/bc/locales/ja_JP.UTF-8.msg
@@ -1,7 +1,7 @@
$ $
$ SPDX-License-Identifier: BSD-2-Clause
$ $
-$ Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+$ Copyright (c) 2018-2021 Gavin D. Howard and contributors.
$ $
$ Redistribution and use in source and binary forms, with or without
$ modification, are permitted provided that the following conditions are met:
diff --git a/contrib/bc/locales/ja_JP.eucJP.msg b/contrib/bc/locales/ja_JP.eucJP.msg
index 8229c8f5a665..61430cf3fd4a 100644
--- a/contrib/bc/locales/ja_JP.eucJP.msg
+++ b/contrib/bc/locales/ja_JP.eucJP.msg
@@ -1,7 +1,7 @@
$ $
$ SPDX-License-Identifier: BSD-2-Clause
$ $
-$ Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+$ Copyright (c) 2018-2021 Gavin D. Howard and contributors.
$ $
$ Redistribution and use in source and binary forms, with or without
$ modification, are permitted provided that the following conditions are met:
diff --git a/contrib/bc/locales/nl_NL.ISO8859-1.msg b/contrib/bc/locales/nl_NL.ISO8859-1.msg
index a291baa53963..04e35014f28f 100644
--- a/contrib/bc/locales/nl_NL.ISO8859-1.msg
+++ b/contrib/bc/locales/nl_NL.ISO8859-1.msg
@@ -1,7 +1,7 @@
$ $
$ SPDX-License-Identifier: BSD-2-Clause
$ $
-$ Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+$ Copyright (c) 2018-2021 Gavin D. Howard and contributors.
$ $
$ Redistribution and use in source and binary forms, with or without
$ modification, are permitted provided that the following conditions are met:
diff --git a/contrib/bc/locales/nl_NL.UTF-8.msg b/contrib/bc/locales/nl_NL.UTF-8.msg
index 07fdbf248815..5b318ecc7fe2 100644
--- a/contrib/bc/locales/nl_NL.UTF-8.msg
+++ b/contrib/bc/locales/nl_NL.UTF-8.msg
@@ -1,7 +1,7 @@
$ $
$ SPDX-License-Identifier: BSD-2-Clause
$ $
-$ Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+$ Copyright (c) 2018-2021 Gavin D. Howard and contributors.
$ $
$ Redistribution and use in source and binary forms, with or without
$ modification, are permitted provided that the following conditions are met:
diff --git a/contrib/bc/locales/pl_PL.ISO8859-2.msg b/contrib/bc/locales/pl_PL.ISO8859-2.msg
index b1bbca8054e9..bf993b82baba 100644
--- a/contrib/bc/locales/pl_PL.ISO8859-2.msg
+++ b/contrib/bc/locales/pl_PL.ISO8859-2.msg
@@ -1,7 +1,7 @@
$ $
$ SPDX-License-Identifier: BSD-2-Clause
$ $
-$ Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+$ Copyright (c) 2018-2021 Gavin D. Howard and contributors.
$ $
$ Redistribution and use in source and binary forms, with or without
$ modification, are permitted provided that the following conditions are met:
diff --git a/contrib/bc/locales/pl_PL.UTF-8.msg b/contrib/bc/locales/pl_PL.UTF-8.msg
index 58eee21267d1..c0a08211a709 100644
--- a/contrib/bc/locales/pl_PL.UTF-8.msg
+++ b/contrib/bc/locales/pl_PL.UTF-8.msg
@@ -1,7 +1,7 @@
$ $
$ SPDX-License-Identifier: BSD-2-Clause
$ $
-$ Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+$ Copyright (c) 2018-2021 Gavin D. Howard and contributors.
$ $
$ Redistribution and use in source and binary forms, with or without
$ modification, are permitted provided that the following conditions are met:
diff --git a/contrib/bc/locales/pt_PT.ISO8859-1.msg b/contrib/bc/locales/pt_PT.ISO8859-1.msg
index 055a8f48d47e..f8fb57199049 100644
--- a/contrib/bc/locales/pt_PT.ISO8859-1.msg
+++ b/contrib/bc/locales/pt_PT.ISO8859-1.msg
@@ -1,7 +1,7 @@
$ $
$ SPDX-License-Identifier: BSD-2-Clause
$ $
-$ Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+$ Copyright (c) 2018-2021 Gavin D. Howard and contributors.
$ $
$ Redistribution and use in source and binary forms, with or without
$ modification, are permitted provided that the following conditions are met:
diff --git a/contrib/bc/locales/pt_PT.UTF-8.msg b/contrib/bc/locales/pt_PT.UTF-8.msg
index b07e58228eb3..b41b3fa112b8 100644
--- a/contrib/bc/locales/pt_PT.UTF-8.msg
+++ b/contrib/bc/locales/pt_PT.UTF-8.msg
@@ -1,7 +1,7 @@
$ $
$ SPDX-License-Identifier: BSD-2-Clause
$ $
-$ Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+$ Copyright (c) 2018-2021 Gavin D. Howard and contributors.
$ $
$ Redistribution and use in source and binary forms, with or without
$ modification, are permitted provided that the following conditions are met:
diff --git a/contrib/bc/locales/ru_RU.CP1251.msg b/contrib/bc/locales/ru_RU.CP1251.msg
index d54a7bf51fda..b5c005aa972b 100644
--- a/contrib/bc/locales/ru_RU.CP1251.msg
+++ b/contrib/bc/locales/ru_RU.CP1251.msg
@@ -1,7 +1,7 @@
$ $
$ SPDX-License-Identifier: BSD-2-Clause
$ $
-$ Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+$ Copyright (c) 2018-2021 Gavin D. Howard and contributors.
$ $
$ Redistribution and use in source and binary forms, with or without
$ modification, are permitted provided that the following conditions are met:
diff --git a/contrib/bc/locales/ru_RU.CP866.msg b/contrib/bc/locales/ru_RU.CP866.msg
index 44325a832dcd..42faa494c66b 100644
--- a/contrib/bc/locales/ru_RU.CP866.msg
+++ b/contrib/bc/locales/ru_RU.CP866.msg
@@ -1,7 +1,7 @@
$ $
$ SPDX-License-Identifier: BSD-2-Clause
$ $
-$ Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+$ Copyright (c) 2018-2021 Gavin D. Howard and contributors.
$ $
$ Redistribution and use in source and binary forms, with or without
$ modification, are permitted provided that the following conditions are met:
diff --git a/contrib/bc/locales/ru_RU.ISO8859-5.msg b/contrib/bc/locales/ru_RU.ISO8859-5.msg
index c4f314c5c32b..7065c2f3b689 100644
--- a/contrib/bc/locales/ru_RU.ISO8859-5.msg
+++ b/contrib/bc/locales/ru_RU.ISO8859-5.msg
@@ -1,7 +1,7 @@
$ $
$ SPDX-License-Identifier: BSD-2-Clause
$ $
-$ Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+$ Copyright (c) 2018-2021 Gavin D. Howard and contributors.
$ $
$ Redistribution and use in source and binary forms, with or without
$ modification, are permitted provided that the following conditions are met:
diff --git a/contrib/bc/locales/ru_RU.KOI8-R.msg b/contrib/bc/locales/ru_RU.KOI8-R.msg
index 991845680d49..fbd23a68f990 100644
--- a/contrib/bc/locales/ru_RU.KOI8-R.msg
+++ b/contrib/bc/locales/ru_RU.KOI8-R.msg
@@ -1,7 +1,7 @@
$ $
$ SPDX-License-Identifier: BSD-2-Clause
$ $
-$ Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+$ Copyright (c) 2018-2021 Gavin D. Howard and contributors.
$ $
$ Redistribution and use in source and binary forms, with or without
$ modification, are permitted provided that the following conditions are met:
diff --git a/contrib/bc/locales/ru_RU.UTF-8.msg b/contrib/bc/locales/ru_RU.UTF-8.msg
index b0d8165554b2..2f3b6169486a 100644
--- a/contrib/bc/locales/ru_RU.UTF-8.msg
+++ b/contrib/bc/locales/ru_RU.UTF-8.msg
@@ -1,7 +1,7 @@
$ $
$ SPDX-License-Identifier: BSD-2-Clause
$ $
-$ Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+$ Copyright (c) 2018-2021 Gavin D. Howard and contributors.
$ $
$ Redistribution and use in source and binary forms, with or without
$ modification, are permitted provided that the following conditions are met:
diff --git a/contrib/bc/locales/zh_CN.GB18030.msg b/contrib/bc/locales/zh_CN.GB18030.msg
index 36b150b2bcbf..7ee01c7de5c8 100644
--- a/contrib/bc/locales/zh_CN.GB18030.msg
+++ b/contrib/bc/locales/zh_CN.GB18030.msg
@@ -1,7 +1,7 @@
$ $
$ SPDX-License-Identifier: BSD-2-Clause
$ $
-$ Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+$ Copyright (c) 2018-2021 Gavin D. Howard and contributors.
$ $
$ Redistribution and use in source and binary forms, with or without
$ modification, are permitted provided that the following conditions are met:
diff --git a/contrib/bc/locales/zh_CN.GB2312.msg b/contrib/bc/locales/zh_CN.GB2312.msg
index 36b150b2bcbf..7ee01c7de5c8 100644
--- a/contrib/bc/locales/zh_CN.GB2312.msg
+++ b/contrib/bc/locales/zh_CN.GB2312.msg
@@ -1,7 +1,7 @@
$ $
$ SPDX-License-Identifier: BSD-2-Clause
$ $
-$ Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+$ Copyright (c) 2018-2021 Gavin D. Howard and contributors.
$ $
$ Redistribution and use in source and binary forms, with or without
$ modification, are permitted provided that the following conditions are met:
diff --git a/contrib/bc/locales/zh_CN.GBK.msg b/contrib/bc/locales/zh_CN.GBK.msg
index 36b150b2bcbf..7ee01c7de5c8 100644
--- a/contrib/bc/locales/zh_CN.GBK.msg
+++ b/contrib/bc/locales/zh_CN.GBK.msg
@@ -1,7 +1,7 @@
$ $
$ SPDX-License-Identifier: BSD-2-Clause
$ $
-$ Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+$ Copyright (c) 2018-2021 Gavin D. Howard and contributors.
$ $
$ Redistribution and use in source and binary forms, with or without
$ modification, are permitted provided that the following conditions are met:
diff --git a/contrib/bc/locales/zh_CN.UTF-8.msg b/contrib/bc/locales/zh_CN.UTF-8.msg
index 4ca46786fc94..0600dd8c1f86 100644
--- a/contrib/bc/locales/zh_CN.UTF-8.msg
+++ b/contrib/bc/locales/zh_CN.UTF-8.msg
@@ -1,7 +1,7 @@
$ $
$ SPDX-License-Identifier: BSD-2-Clause
$ $
-$ Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+$ Copyright (c) 2018-2021 Gavin D. Howard and contributors.
$ $
$ Redistribution and use in source and binary forms, with or without
$ modification, are permitted provided that the following conditions are met:
diff --git a/contrib/bc/locales/zh_CN.eucCN.msg b/contrib/bc/locales/zh_CN.eucCN.msg
index 36b150b2bcbf..7ee01c7de5c8 100644
--- a/contrib/bc/locales/zh_CN.eucCN.msg
+++ b/contrib/bc/locales/zh_CN.eucCN.msg
@@ -1,7 +1,7 @@
$ $
$ SPDX-License-Identifier: BSD-2-Clause
$ $
-$ Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+$ Copyright (c) 2018-2021 Gavin D. Howard and contributors.
$ $
$ Redistribution and use in source and binary forms, with or without
$ modification, are permitted provided that the following conditions are met:
diff --git a/contrib/bc/manpage.sh b/contrib/bc/manpage.sh
index edde671da238..f774bfdb3b20 100755
--- a/contrib/bc/manpage.sh
+++ b/contrib/bc/manpage.sh
@@ -2,7 +2,7 @@
#
# SPDX-License-Identifier: BSD-2-Clause
#
-# Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+# Copyright (c) 2018-2021 Gavin D. Howard and contributors.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
diff --git a/contrib/bc/manuals/bc.1.md.in b/contrib/bc/manuals/bc.1.md.in
index efc0be037526..661fcdd45ae4 100644
--- a/contrib/bc/manuals/bc.1.md.in
+++ b/contrib/bc/manuals/bc.1.md.in
@@ -2,7 +2,7 @@
SPDX-License-Identifier: BSD-2-Clause
-Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+Copyright (c) 2018-2021 Gavin D. Howard and contributors.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
@@ -34,8 +34,7 @@ bc - arbitrary-precision decimal arithmetic language and calculator
# SYNOPSIS
-**bc** [**-ghilPqsvVw**] [**--global-stacks**] [**--help**] [**--interactive**] [**--mathlib**] [**--no-prompt**] [**--quiet**] [**--standard**] [**--warn**] [**--version**] [**-e** *expr*] [**--expression**=*expr*...] [**-f** *file*...] [**-file**=*file*...]
-[*file*...]
+**bc** [**-ghilPqsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@@ -61,7 +60,7 @@ especially) the GNU bc(1).
The following are the options that bc(1) accepts.
-**-g**, **--global-stacks**
+**-g**, **-\-global-stacks**
{{ A H N P HN HP NP HNP }}
: Turns the globals **ibase**, **obase**, **scale**, and **seed** into stacks.
@@ -152,17 +151,17 @@ The following are the options that bc(1) accepts.
This is a **non-portable extension**.
-**-h**, **--help**
+**-h**, **-\-help**
: Prints a usage message and quits.
-**-i**, **--interactive**
+**-i**, **-\-interactive**
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
This is a **non-portable extension**.
-**-l**, **--mathlib**
+**-l**, **-\-mathlib**
: Sets **scale** (see the **SYNTAX** section) to **20** and loads the included
{{ A H N P HN HP NP HNP }}
@@ -178,7 +177,7 @@ The following are the options that bc(1) accepts.
To learn what is in the library, see the **LIBRARY** section.
{{ end }}
-**-P**, **--no-prompt**
+**-P**, **-\-no-prompt**
{{ A E H N EH EN HN EHN }}
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
@@ -193,57 +192,64 @@ The following are the options that bc(1) accepts.
This is a **non-portable extension**.
-**-q**, **--quiet**
+**-q**, **-\-quiet**
: This option is for compatibility with the [GNU bc(1)][2]; it is a no-op.
Without this option, GNU bc(1) prints a copyright header. This bc(1) only
prints the copyright header if one or more of the **-v**, **-V**, or
- **--version** options are given.
+ **-\-version** options are given.
This is a **non-portable extension**.
-**-s**, **--standard**
+**-s**, **-\-standard**
: Process exactly the language defined by the [standard][1] and error if any
extensions are used.
This is a **non-portable extension**.
-**-v**, **-V**, **--version**
+**-v**, **-V**, **-\-version**
: Print the version information (copyright header) and exit.
This is a **non-portable extension**.
-**-w**, **--warn**
+**-w**, **-\-warn**
-: Like **-s** and **--standard**, except that warnings (and not errors) are
+: Like **-s** and **-\-standard**, except that warnings (and not errors) are
printed for non-standard extensions and execution continues normally.
This is a **non-portable extension**.
-**-e** *expr*, **--expression**=*expr*
+**-e** *expr*, **-\-expression**=*expr*
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
order. If files are given as well (see below), the expressions and files are
evaluated in the order given. This means that if a file is given before an
expression, the file is read in and evaluated first.
- After processing all expressions and files, bc(1) will exit, unless **-**
- (**stdin**) was given as an argument at least once to **-f** or **--file**.
- However, if any other **-e**, **--expression**, **-f**, or **--file**
- arguments are given after that, bc(1) will give a fatal error and exit.
+ If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
+ see the **ENVIRONMENT VARIABLES** section), then after processing all
+ expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
+ as an argument at least once to **-f** or **-\-file**, whether on the
+ command-line or in **BC_ENV_ARGS**. However, if any other **-e**,
+ **-\-expression**, **-f**, or **-\-file** arguments are given after **-f-**
+ or equivalent is given, bc(1) will give a fatal error and exit.
This is a **non-portable extension**.
-**-f** *file*, **--file**=*file*
+**-f** *file*, **-\-file**=*file*
: Reads in *file* and evaluates it, line by line, as though it were read
through **stdin**. If expressions are also given (see above), the
expressions are evaluated in the order given.
- After processing all expressions and files, bc(1) will exit, unless **-**
- (**stdin**) was given as an argument at least once to **-f** or **--file**.
+ If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
+ see the **ENVIRONMENT VARIABLES** section), then after processing all
+ expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
+ as an argument at least once to **-f** or **-\-file**. However, if any other
+ **-e**, **-\-expression**, **-f**, or **-\-file** arguments are given after
+ **-f-** or equivalent is given, bc(1) will give a fatal error and exit.
This is a **non-portable extension**.
@@ -251,7 +257,9 @@ All long options are **non-portable extensions**.
# STDOUT
-Any non-error output is written to **stdout**.
+Any non-error output is written to **stdout**. In addition, if history (see the
+**HISTORY** section) and the prompt (see the **TTY MODE** section) are enabled,
+both are output to **stdout**.
**Note**: Unlike other bc(1) implementations, this bc(1) will issue a fatal
error (see the **EXIT STATUS** section) if it cannot write to **stdout**, so if
@@ -295,8 +303,8 @@ Identifiers with more than one character (letter) are a
**ibase** is a global variable determining how to interpret constant numbers. It
is the "input" base, or the number base used for interpreting input numbers.
-**ibase** is initially **10**. If the **-s** (**--standard**) and **-w**
-(**--warn**) flags were not given on the command line, the max allowable value
+**ibase** is initially **10**. If the **-s** (**-\-standard**) and **-w**
+(**-\-warn**) flags were not given on the command line, the max allowable value
for **ibase** is **36**. Otherwise, it is **16**. The min allowable value for
**ibase** is **2**. The max allowable value for **ibase** can be queried in
bc(1) programs with the **maxibase()** built-in function.
@@ -459,7 +467,10 @@ generator.
**Note**: The values returned by the pseudo-random number generator with
**rand()** and **irand(E)** are guaranteed to *NOT* be cryptographically secure.
This is a consequence of using a seeded pseudo-random number generator. However,
-they *are* guaranteed to be reproducible with identical **seed** values.
+they *are* guaranteed to be reproducible with identical **seed** values. This
+means that the pseudo-random values from bc(1) should only be used where a
+reproducible stream of pseudo-random numbers is *ESSENTIAL*. In any other case,
+use a non-seeded pseudo-random number generator.
{{ end }}
## Numbers
@@ -500,7 +511,7 @@ The following arithmetic and logical operators can be used. They are listed in
order of decreasing precedence. Operators in the same group have the same
precedence.
-**++** **--**
+**++** **-\-**
: Type: Prefix and Postfix
@@ -605,7 +616,7 @@ precedence.
The operators will be described in more detail below.
-**++** **--**
+**++** **-\-**
: The prefix and postfix **increment** and **decrement** operators behave
exactly like they would in C. They require a named expression (see the
@@ -950,12 +961,12 @@ This is a **non-portable extension**.
{{ A H N P HN HP NP HNP }}
All of the functions below, including the functions in the extended math
library (see the *Extended Library* subsection below), are available when the
-**-l** or **--mathlib** command-line flags are given, except that the extended
+**-l** or **-\-mathlib** command-line flags are given, except that the extended
math library is not available when the **-s** option, the **-w** option, or
equivalents are given.
{{ end }}
{{ E EH EN EP EHN EHP ENP EHNP }}
-All of the functions below are available when the **-l** or **--mathlib**
+All of the functions below are available when the **-l** or **-\-mathlib**
command-line flags are given.
{{ end }}
@@ -1008,8 +1019,8 @@ The [standard][1] defines the following functions for the math library:
{{ A H N P HN HP NP HNP }}
## Extended Library
-The extended library is *not* loaded when the **-s**/**--standard** or
-**-w**/**--warn** options are given since they are not part of the library
+The extended library is *not* loaded when the **-s**/**-\-standard** or
+**-w**/**-\-warn** options are given since they are not part of the library
defined by the [standard][1].
The extended library is a **non-portable extension**.
@@ -1693,17 +1704,17 @@ The other statuses will only be returned when bc(1) is not in interactive mode
(see the **INTERACTIVE MODE** section), since bc(1) resets its state (see the
**RESET** section) and accepts more input when one of those errors occurs in
interactive mode. This is also the case when interactive mode is forced by the
-**-i** flag or **--interactive** option.
+**-i** flag or **-\-interactive** option.
These exit statuses allow bc(1) to be used in shell scripting with error
checking, and its normal behavior can be forced by using the **-i** flag or
-**--interactive** option.
+**-\-interactive** option.
# INTERACTIVE MODE
Per the [standard][1], bc(1) has an interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both **stdin** and **stdout**
-are hooked to a terminal, but the **-i** flag and **--interactive** option can
+are hooked to a terminal, but the **-i** flag and **-\-interactive** option can
turn it on in other cases.
In interactive mode, bc(1) attempts to recover from errors (see the **RESET**
diff --git a/contrib/bc/manuals/bc/A.1 b/contrib/bc/manuals/bc/A.1
index 2e2816290587..b38d8d35e71b 100644
--- a/contrib/bc/manuals/bc/A.1
+++ b/contrib/bc/manuals/bc/A.1
@@ -1,7 +1,7 @@
.\"
.\" SPDX-License-Identifier: BSD-2-Clause
.\"
-.\" Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+.\" Copyright (c) 2018-2021 Gavin D. Howard and contributors.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions are met:
@@ -25,19 +25,18 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.TH "BC" "1" "October 2020" "Gavin D. Howard" "General Commands Manual"
+.TH "BC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
.SH NAME
.PP
bc - arbitrary-precision decimal arithmetic language and calculator
.SH SYNOPSIS
.PP
-\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]\[en]global-stacks\f[R]]
-[\f[B]\[en]help\f[R]] [\f[B]\[en]interactive\f[R]]
-[\f[B]\[en]mathlib\f[R]] [\f[B]\[en]no-prompt\f[R]]
-[\f[B]\[en]quiet\f[R]] [\f[B]\[en]standard\f[R]] [\f[B]\[en]warn\f[R]]
-[\f[B]\[en]version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
-[\f[B]\[en]expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
-\f[I]file\f[R]\&...] [\f[B]-file\f[R]=\f[I]file\f[R]\&...]
+\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]--global-stacks\f[R]]
+[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--mathlib\f[R]]
+[\f[B]--no-prompt\f[R]] [\f[B]--quiet\f[R]] [\f[B]--standard\f[R]]
+[\f[B]--warn\f[R]] [\f[B]--version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
+[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
+\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
[\f[I]file\f[R]\&...]
.SH DESCRIPTION
.PP
@@ -60,7 +59,7 @@ implementations.
.PP
The following are the options that bc(1) accepts.
.TP
-\f[B]-g\f[R], \f[B]\[en]global-stacks\f[R]
+\f[B]-g\f[R], \f[B]--global-stacks\f[R]
Turns the globals \f[B]ibase\f[R], \f[B]obase\f[R], \f[B]scale\f[R], and
\f[B]seed\f[R] into stacks.
.RS
@@ -152,10 +151,10 @@ is ignored.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-h\f[R], \f[B]\[en]help\f[R]
+\f[B]-h\f[R], \f[B]--help\f[R]
Prints a usage message and quits.
.TP
-\f[B]-i\f[R], \f[B]\[en]interactive\f[R]
+\f[B]-i\f[R], \f[B]--interactive\f[R]
Forces interactive mode.
(See the \f[B]INTERACTIVE MODE\f[R] section.)
.RS
@@ -163,7 +162,7 @@ Forces interactive mode.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-l\f[R], \f[B]\[en]mathlib\f[R]
+\f[B]-l\f[R], \f[B]--mathlib\f[R]
Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to \f[B]20\f[R]
and loads the included math library and the extended math library before
running any code, including any expressions or files specified on the
@@ -173,7 +172,7 @@ command line.
To learn what is in the libraries, see the \f[B]LIBRARY\f[R] section.
.RE
.TP
-\f[B]-P\f[R], \f[B]\[en]no-prompt\f[R]
+\f[B]-P\f[R], \f[B]--no-prompt\f[R]
Disables the prompt in TTY mode.
(The prompt is only enabled in TTY mode.
See the \f[B]TTY MODE\f[R] section) This is mostly for those users that
@@ -185,18 +184,18 @@ Most of those users would want to put this option in
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-q\f[R], \f[B]\[en]quiet\f[R]
+\f[B]-q\f[R], \f[B]--quiet\f[R]
This option is for compatibility with the GNU
bc(1) (https://www.gnu.org/software/bc/); it is a no-op.
Without this option, GNU bc(1) prints a copyright header.
This bc(1) only prints the copyright header if one or more of the
-\f[B]-v\f[R], \f[B]-V\f[R], or \f[B]\[en]version\f[R] options are given.
+\f[B]-v\f[R], \f[B]-V\f[R], or \f[B]--version\f[R] options are given.
.RS
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-s\f[R], \f[B]\[en]standard\f[R]
+\f[B]-s\f[R], \f[B]--standard\f[R]
Process exactly the language defined by the
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
and error if any extensions are used.
@@ -205,15 +204,15 @@ and error if any extensions are used.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-v\f[R], \f[B]-V\f[R], \f[B]\[en]version\f[R]
+\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
Print the version information (copyright header) and exit.
.RS
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-w\f[R], \f[B]\[en]warn\f[R]
-Like \f[B]-s\f[R] and \f[B]\[en]standard\f[R], except that warnings (and
+\f[B]-w\f[R], \f[B]--warn\f[R]
+Like \f[B]-s\f[R] and \f[B]--standard\f[R], except that warnings (and
not errors) are printed for non-standard extensions and execution
continues normally.
.RS
@@ -221,7 +220,7 @@ continues normally.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-e\f[R] \f[I]expr\f[R], \f[B]\[en]expression\f[R]=\f[I]expr\f[R]
+\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
Evaluates \f[I]expr\f[R].
If multiple expressions are given, they are evaluated in order.
If files are given as well (see below), the expressions and files are
@@ -230,26 +229,36 @@ This means that if a file is given before an expression, the file is
read in and evaluated first.
.RS
.PP
-After processing all expressions and files, bc(1) will exit, unless
+If this option is given on the command-line (i.e., not in
+\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
+then after processing all expressions and files, bc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]\[en]file\f[R].
-However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
-\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after that,
-bc(1) will give a fatal error and exit.
+\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
+\f[B]BC_ENV_ARGS\f[R].
+However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
+\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
+\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
+exit.
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-f\f[R] \f[I]file\f[R], \f[B]\[en]file\f[R]=\f[I]file\f[R]
+\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
were read through \f[B]stdin\f[R].
If expressions are also given (see above), the expressions are evaluated
in the order given.
.RS
.PP
-After processing all expressions and files, bc(1) will exit, unless
+If this option is given on the command-line (i.e., not in
+\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
+then after processing all expressions and files, bc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]\[en]file\f[R].
+\f[B]-f\f[R] or \f[B]--file\f[R].
+However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
+\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
+\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
+exit.
.PP
This is a \f[B]non-portable extension\f[R].
.RE
@@ -258,6 +267,9 @@ All long options are \f[B]non-portable extensions\f[R].
.SH STDOUT
.PP
Any non-error output is written to \f[B]stdout\f[R].
+In addition, if history (see the \f[B]HISTORY\f[R] section) and the
+prompt (see the \f[B]TTY MODE\f[R] section) are enabled, both are output
+to \f[B]stdout\f[R].
.PP
\f[B]Note\f[R]: Unlike other bc(1) implementations, this bc(1) will
issue a fatal error (see the \f[B]EXIT STATUS\f[R] section) if it cannot
@@ -309,8 +321,8 @@ constant numbers.
It is the \[lq]input\[rq] base, or the number base used for interpreting
input numbers.
\f[B]ibase\f[R] is initially \f[B]10\f[R].
-If the \f[B]-s\f[R] (\f[B]\[en]standard\f[R]) and \f[B]-w\f[R]
-(\f[B]\[en]warn\f[R]) flags were not given on the command line, the max
+If the \f[B]-s\f[R] (\f[B]--standard\f[R]) and \f[B]-w\f[R]
+(\f[B]--warn\f[R]) flags were not given on the command line, the max
allowable value for \f[B]ibase\f[R] is \f[B]36\f[R].
Otherwise, it is \f[B]16\f[R].
The min allowable value for \f[B]ibase\f[R] is \f[B]2\f[R].
@@ -519,6 +531,10 @@ generator with \f[B]rand()\f[R] and \f[B]irand(E)\f[R] are guaranteed to
This is a consequence of using a seeded pseudo-random number generator.
However, they \f[I]are\f[R] guaranteed to be reproducible with identical
\f[B]seed\f[R] values.
+This means that the pseudo-random values from bc(1) should only be used
+where a reproducible stream of pseudo-random numbers is
+\f[I]ESSENTIAL\f[R].
+In any other case, use a non-seeded pseudo-random number generator.
.SS Numbers
.PP
Numbers are strings made up of digits, uppercase letters, and at most
@@ -565,7 +581,7 @@ The following arithmetic and logical operators can be used.
They are listed in order of decreasing precedence.
Operators in the same group have the same precedence.
.TP
-\f[B]++\f[R] \f[B]\[en]\f[R]
+\f[B]++\f[R] \f[B]--\f[R]
Type: Prefix and Postfix
.RS
.PP
@@ -675,7 +691,7 @@ Description: \f[B]boolean or\f[R]
.PP
The operators will be described in more detail below.
.TP
-\f[B]++\f[R] \f[B]\[en]\f[R]
+\f[B]++\f[R] \f[B]--\f[R]
The prefix and postfix \f[B]increment\f[R] and \f[B]decrement\f[R]
operators behave exactly like they would in C.
They require a named expression (see the \f[I]Named Expressions\f[R]
@@ -1121,7 +1137,7 @@ This is a \f[B]non-portable extension\f[R].
.PP
All of the functions below, including the functions in the extended math
library (see the \f[I]Extended Library\f[R] subsection below), are
-available when the \f[B]-l\f[R] or \f[B]\[en]mathlib\f[R] command-line
+available when the \f[B]-l\f[R] or \f[B]--mathlib\f[R] command-line
flags are given, except that the extended math library is not available
when the \f[B]-s\f[R] option, the \f[B]-w\f[R] option, or equivalents
are given.
@@ -1182,7 +1198,7 @@ Functions\f[R] subsection below).
.SS Extended Library
.PP
The extended library is \f[I]not\f[R] loaded when the
-\f[B]-s\f[R]/\f[B]\[en]standard\f[R] or \f[B]-w\f[R]/\f[B]\[en]warn\f[R]
+\f[B]-s\f[R]/\f[B]--standard\f[R] or \f[B]-w\f[R]/\f[B]--warn\f[R]
options are given since they are not part of the library defined by the
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html).
.PP
@@ -1940,11 +1956,11 @@ interactive mode (see the \f[B]INTERACTIVE MODE\f[R] section), since
bc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
more input when one of those errors occurs in interactive mode.
This is also the case when interactive mode is forced by the
-\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
+\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.PP
These exit statuses allow bc(1) to be used in shell scripting with error
checking, and its normal behavior can be forced by using the
-\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
+\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.SH INTERACTIVE MODE
.PP
Per the
@@ -1952,7 +1968,7 @@ standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html),
bc(1) has an interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both \f[B]stdin\f[R]
and \f[B]stdout\f[R] are hooked to a terminal, but the \f[B]-i\f[R] flag
-and \f[B]\[en]interactive\f[R] option can turn it on in other cases.
+and \f[B]--interactive\f[R] option can turn it on in other cases.
.PP
In interactive mode, bc(1) attempts to recover from errors (see the
\f[B]RESET\f[R] section), and in normal execution, flushes
diff --git a/contrib/bc/manuals/bc/A.1.md b/contrib/bc/manuals/bc/A.1.md
index 5e5b75bb3821..04f37c6bb724 100644
--- a/contrib/bc/manuals/bc/A.1.md
+++ b/contrib/bc/manuals/bc/A.1.md
@@ -2,7 +2,7 @@
SPDX-License-Identifier: BSD-2-Clause
-Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+Copyright (c) 2018-2021 Gavin D. Howard and contributors.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
@@ -34,8 +34,7 @@ bc - arbitrary-precision decimal arithmetic language and calculator
# SYNOPSIS
-**bc** [**-ghilPqsvVw**] [**--global-stacks**] [**--help**] [**--interactive**] [**--mathlib**] [**--no-prompt**] [**--quiet**] [**--standard**] [**--warn**] [**--version**] [**-e** *expr*] [**--expression**=*expr*...] [**-f** *file*...] [**-file**=*file*...]
-[*file*...]
+**bc** [**-ghilPqsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@@ -55,7 +54,7 @@ other implementations.
The following are the options that bc(1) accepts.
-**-g**, **--global-stacks**
+**-g**, **-\-global-stacks**
: Turns the globals **ibase**, **obase**, **scale**, and **seed** into stacks.
@@ -123,17 +122,17 @@ The following are the options that bc(1) accepts.
This is a **non-portable extension**.
-**-h**, **--help**
+**-h**, **-\-help**
: Prints a usage message and quits.
-**-i**, **--interactive**
+**-i**, **-\-interactive**
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
This is a **non-portable extension**.
-**-l**, **--mathlib**
+**-l**, **-\-mathlib**
: Sets **scale** (see the **SYNTAX** section) to **20** and loads the included
math library and the extended math library before running any code,
@@ -141,7 +140,7 @@ The following are the options that bc(1) accepts.
To learn what is in the libraries, see the **LIBRARY** section.
-**-P**, **--no-prompt**
+**-P**, **-\-no-prompt**
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
See the **TTY MODE** section) This is mostly for those users that do not
@@ -151,57 +150,64 @@ The following are the options that bc(1) accepts.
This is a **non-portable extension**.
-**-q**, **--quiet**
+**-q**, **-\-quiet**
: This option is for compatibility with the [GNU bc(1)][2]; it is a no-op.
Without this option, GNU bc(1) prints a copyright header. This bc(1) only
prints the copyright header if one or more of the **-v**, **-V**, or
- **--version** options are given.
+ **-\-version** options are given.
This is a **non-portable extension**.
-**-s**, **--standard**
+**-s**, **-\-standard**
: Process exactly the language defined by the [standard][1] and error if any
extensions are used.
This is a **non-portable extension**.
-**-v**, **-V**, **--version**
+**-v**, **-V**, **-\-version**
: Print the version information (copyright header) and exit.
This is a **non-portable extension**.
-**-w**, **--warn**
+**-w**, **-\-warn**
-: Like **-s** and **--standard**, except that warnings (and not errors) are
+: Like **-s** and **-\-standard**, except that warnings (and not errors) are
printed for non-standard extensions and execution continues normally.
This is a **non-portable extension**.
-**-e** *expr*, **--expression**=*expr*
+**-e** *expr*, **-\-expression**=*expr*
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
order. If files are given as well (see below), the expressions and files are
evaluated in the order given. This means that if a file is given before an
expression, the file is read in and evaluated first.
- After processing all expressions and files, bc(1) will exit, unless **-**
- (**stdin**) was given as an argument at least once to **-f** or **--file**.
- However, if any other **-e**, **--expression**, **-f**, or **--file**
- arguments are given after that, bc(1) will give a fatal error and exit.
+ If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
+ see the **ENVIRONMENT VARIABLES** section), then after processing all
+ expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
+ as an argument at least once to **-f** or **-\-file**, whether on the
+ command-line or in **BC_ENV_ARGS**. However, if any other **-e**,
+ **-\-expression**, **-f**, or **-\-file** arguments are given after **-f-**
+ or equivalent is given, bc(1) will give a fatal error and exit.
This is a **non-portable extension**.
-**-f** *file*, **--file**=*file*
+**-f** *file*, **-\-file**=*file*
: Reads in *file* and evaluates it, line by line, as though it were read
through **stdin**. If expressions are also given (see above), the
expressions are evaluated in the order given.
- After processing all expressions and files, bc(1) will exit, unless **-**
- (**stdin**) was given as an argument at least once to **-f** or **--file**.
+ If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
+ see the **ENVIRONMENT VARIABLES** section), then after processing all
+ expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
+ as an argument at least once to **-f** or **-\-file**. However, if any other
+ **-e**, **-\-expression**, **-f**, or **-\-file** arguments are given after
+ **-f-** or equivalent is given, bc(1) will give a fatal error and exit.
This is a **non-portable extension**.
@@ -209,7 +215,9 @@ All long options are **non-portable extensions**.
# STDOUT
-Any non-error output is written to **stdout**.
+Any non-error output is written to **stdout**. In addition, if history (see the
+**HISTORY** section) and the prompt (see the **TTY MODE** section) are enabled,
+both are output to **stdout**.
**Note**: Unlike other bc(1) implementations, this bc(1) will issue a fatal
error (see the **EXIT STATUS** section) if it cannot write to **stdout**, so if
@@ -253,8 +261,8 @@ Identifiers with more than one character (letter) are a
**ibase** is a global variable determining how to interpret constant numbers. It
is the "input" base, or the number base used for interpreting input numbers.
-**ibase** is initially **10**. If the **-s** (**--standard**) and **-w**
-(**--warn**) flags were not given on the command line, the max allowable value
+**ibase** is initially **10**. If the **-s** (**-\-standard**) and **-w**
+(**-\-warn**) flags were not given on the command line, the max allowable value
for **ibase** is **36**. Otherwise, it is **16**. The min allowable value for
**ibase** is **2**. The max allowable value for **ibase** can be queried in
bc(1) programs with the **maxibase()** built-in function.
@@ -403,7 +411,10 @@ generator.
**Note**: The values returned by the pseudo-random number generator with
**rand()** and **irand(E)** are guaranteed to *NOT* be cryptographically secure.
This is a consequence of using a seeded pseudo-random number generator. However,
-they *are* guaranteed to be reproducible with identical **seed** values.
+they *are* guaranteed to be reproducible with identical **seed** values. This
+means that the pseudo-random values from bc(1) should only be used where a
+reproducible stream of pseudo-random numbers is *ESSENTIAL*. In any other case,
+use a non-seeded pseudo-random number generator.
## Numbers
@@ -441,7 +452,7 @@ The following arithmetic and logical operators can be used. They are listed in
order of decreasing precedence. Operators in the same group have the same
precedence.
-**++** **--**
+**++** **-\-**
: Type: Prefix and Postfix
@@ -539,7 +550,7 @@ precedence.
The operators will be described in more detail below.
-**++** **--**
+**++** **-\-**
: The prefix and postfix **increment** and **decrement** operators behave
exactly like they would in C. They require a named expression (see the
@@ -870,7 +881,7 @@ This is a **non-portable extension**.
All of the functions below, including the functions in the extended math
library (see the *Extended Library* subsection below), are available when the
-**-l** or **--mathlib** command-line flags are given, except that the extended
+**-l** or **-\-mathlib** command-line flags are given, except that the extended
math library is not available when the **-s** option, the **-w** option, or
equivalents are given.
@@ -922,8 +933,8 @@ The [standard][1] defines the following functions for the math library:
## Extended Library
-The extended library is *not* loaded when the **-s**/**--standard** or
-**-w**/**--warn** options are given since they are not part of the library
+The extended library is *not* loaded when the **-s**/**-\-standard** or
+**-w**/**-\-warn** options are given since they are not part of the library
defined by the [standard][1].
The extended library is a **non-portable extension**.
@@ -1591,17 +1602,17 @@ The other statuses will only be returned when bc(1) is not in interactive mode
(see the **INTERACTIVE MODE** section), since bc(1) resets its state (see the
**RESET** section) and accepts more input when one of those errors occurs in
interactive mode. This is also the case when interactive mode is forced by the
-**-i** flag or **--interactive** option.
+**-i** flag or **-\-interactive** option.
These exit statuses allow bc(1) to be used in shell scripting with error
checking, and its normal behavior can be forced by using the **-i** flag or
-**--interactive** option.
+**-\-interactive** option.
# INTERACTIVE MODE
Per the [standard][1], bc(1) has an interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both **stdin** and **stdout**
-are hooked to a terminal, but the **-i** flag and **--interactive** option can
+are hooked to a terminal, but the **-i** flag and **-\-interactive** option can
turn it on in other cases.
In interactive mode, bc(1) attempts to recover from errors (see the **RESET**
diff --git a/contrib/bc/manuals/bc/E.1 b/contrib/bc/manuals/bc/E.1
index 6bacb680af67..9023b07c6b87 100644
--- a/contrib/bc/manuals/bc/E.1
+++ b/contrib/bc/manuals/bc/E.1
@@ -1,7 +1,7 @@
.\"
.\" SPDX-License-Identifier: BSD-2-Clause
.\"
-.\" Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+.\" Copyright (c) 2018-2021 Gavin D. Howard and contributors.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions are met:
@@ -25,19 +25,18 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.TH "BC" "1" "October 2020" "Gavin D. Howard" "General Commands Manual"
+.TH "BC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
.SH NAME
.PP
bc - arbitrary-precision decimal arithmetic language and calculator
.SH SYNOPSIS
.PP
-\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]\[en]global-stacks\f[R]]
-[\f[B]\[en]help\f[R]] [\f[B]\[en]interactive\f[R]]
-[\f[B]\[en]mathlib\f[R]] [\f[B]\[en]no-prompt\f[R]]
-[\f[B]\[en]quiet\f[R]] [\f[B]\[en]standard\f[R]] [\f[B]\[en]warn\f[R]]
-[\f[B]\[en]version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
-[\f[B]\[en]expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
-\f[I]file\f[R]\&...] [\f[B]-file\f[R]=\f[I]file\f[R]\&...]
+\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]--global-stacks\f[R]]
+[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--mathlib\f[R]]
+[\f[B]--no-prompt\f[R]] [\f[B]--quiet\f[R]] [\f[B]--standard\f[R]]
+[\f[B]--warn\f[R]] [\f[B]--version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
+[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
+\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
[\f[I]file\f[R]\&...]
.SH DESCRIPTION
.PP
@@ -58,7 +57,7 @@ This bc(1) is a drop-in replacement for \f[I]any\f[R] bc(1), including
.PP
The following are the options that bc(1) accepts.
.PP
-\f[B]-g\f[R], \f[B]\[en]global-stacks\f[R]
+\f[B]-g\f[R], \f[B]--global-stacks\f[R]
.IP
.nf
\f[C]
@@ -115,10 +114,10 @@ This is a **non-portable extension**.
\f[R]
.fi
.TP
-\f[B]-h\f[R], \f[B]\[en]help\f[R]
+\f[B]-h\f[R], \f[B]--help\f[R]
Prints a usage message and quits.
.TP
-\f[B]-i\f[R], \f[B]\[en]interactive\f[R]
+\f[B]-i\f[R], \f[B]--interactive\f[R]
Forces interactive mode.
(See the \f[B]INTERACTIVE MODE\f[R] section.)
.RS
@@ -126,7 +125,7 @@ Forces interactive mode.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-l\f[R], \f[B]\[en]mathlib\f[R]
+\f[B]-l\f[R], \f[B]--mathlib\f[R]
Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to \f[B]20\f[R]
and loads the included math library before running any code, including
any expressions or files specified on the command line.
@@ -135,7 +134,7 @@ any expressions or files specified on the command line.
To learn what is in the library, see the \f[B]LIBRARY\f[R] section.
.RE
.TP
-\f[B]-P\f[R], \f[B]\[en]no-prompt\f[R]
+\f[B]-P\f[R], \f[B]--no-prompt\f[R]
Disables the prompt in TTY mode.
(The prompt is only enabled in TTY mode.
See the \f[B]TTY MODE\f[R] section) This is mostly for those users that
@@ -147,18 +146,18 @@ Most of those users would want to put this option in
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-q\f[R], \f[B]\[en]quiet\f[R]
+\f[B]-q\f[R], \f[B]--quiet\f[R]
This option is for compatibility with the GNU
bc(1) (https://www.gnu.org/software/bc/); it is a no-op.
Without this option, GNU bc(1) prints a copyright header.
This bc(1) only prints the copyright header if one or more of the
-\f[B]-v\f[R], \f[B]-V\f[R], or \f[B]\[en]version\f[R] options are given.
+\f[B]-v\f[R], \f[B]-V\f[R], or \f[B]--version\f[R] options are given.
.RS
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-s\f[R], \f[B]\[en]standard\f[R]
+\f[B]-s\f[R], \f[B]--standard\f[R]
Process exactly the language defined by the
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
and error if any extensions are used.
@@ -167,15 +166,15 @@ and error if any extensions are used.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-v\f[R], \f[B]-V\f[R], \f[B]\[en]version\f[R]
+\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
Print the version information (copyright header) and exit.
.RS
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-w\f[R], \f[B]\[en]warn\f[R]
-Like \f[B]-s\f[R] and \f[B]\[en]standard\f[R], except that warnings (and
+\f[B]-w\f[R], \f[B]--warn\f[R]
+Like \f[B]-s\f[R] and \f[B]--standard\f[R], except that warnings (and
not errors) are printed for non-standard extensions and execution
continues normally.
.RS
@@ -183,7 +182,7 @@ continues normally.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-e\f[R] \f[I]expr\f[R], \f[B]\[en]expression\f[R]=\f[I]expr\f[R]
+\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
Evaluates \f[I]expr\f[R].
If multiple expressions are given, they are evaluated in order.
If files are given as well (see below), the expressions and files are
@@ -192,26 +191,36 @@ This means that if a file is given before an expression, the file is
read in and evaluated first.
.RS
.PP
-After processing all expressions and files, bc(1) will exit, unless
+If this option is given on the command-line (i.e., not in
+\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
+then after processing all expressions and files, bc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]\[en]file\f[R].
-However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
-\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after that,
-bc(1) will give a fatal error and exit.
+\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
+\f[B]BC_ENV_ARGS\f[R].
+However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
+\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
+\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
+exit.
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-f\f[R] \f[I]file\f[R], \f[B]\[en]file\f[R]=\f[I]file\f[R]
+\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
were read through \f[B]stdin\f[R].
If expressions are also given (see above), the expressions are evaluated
in the order given.
.RS
.PP
-After processing all expressions and files, bc(1) will exit, unless
+If this option is given on the command-line (i.e., not in
+\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
+then after processing all expressions and files, bc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]\[en]file\f[R].
+\f[B]-f\f[R] or \f[B]--file\f[R].
+However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
+\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
+\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
+exit.
.PP
This is a \f[B]non-portable extension\f[R].
.RE
@@ -220,6 +229,9 @@ All long options are \f[B]non-portable extensions\f[R].
.SH STDOUT
.PP
Any non-error output is written to \f[B]stdout\f[R].
+In addition, if history (see the \f[B]HISTORY\f[R] section) and the
+prompt (see the \f[B]TTY MODE\f[R] section) are enabled, both are output
+to \f[B]stdout\f[R].
.PP
\f[B]Note\f[R]: Unlike other bc(1) implementations, this bc(1) will
issue a fatal error (see the \f[B]EXIT STATUS\f[R] section) if it cannot
@@ -271,8 +283,8 @@ constant numbers.
It is the \[lq]input\[rq] base, or the number base used for interpreting
input numbers.
\f[B]ibase\f[R] is initially \f[B]10\f[R].
-If the \f[B]-s\f[R] (\f[B]\[en]standard\f[R]) and \f[B]-w\f[R]
-(\f[B]\[en]warn\f[R]) flags were not given on the command line, the max
+If the \f[B]-s\f[R] (\f[B]--standard\f[R]) and \f[B]-w\f[R]
+(\f[B]--warn\f[R]) flags were not given on the command line, the max
allowable value for \f[B]ibase\f[R] is \f[B]36\f[R].
Otherwise, it is \f[B]16\f[R].
The min allowable value for \f[B]ibase\f[R] is \f[B]2\f[R].
@@ -432,7 +444,7 @@ The following arithmetic and logical operators can be used.
They are listed in order of decreasing precedence.
Operators in the same group have the same precedence.
.TP
-\f[B]++\f[R] \f[B]\[en]\f[R]
+\f[B]++\f[R] \f[B]--\f[R]
Type: Prefix and Postfix
.RS
.PP
@@ -515,7 +527,7 @@ Description: \f[B]boolean or\f[R]
.PP
The operators will be described in more detail below.
.TP
-\f[B]++\f[R] \f[B]\[en]\f[R]
+\f[B]++\f[R] \f[B]--\f[R]
The prefix and postfix \f[B]increment\f[R] and \f[B]decrement\f[R]
operators behave exactly like they would in C.
They require a named expression (see the \f[I]Named Expressions\f[R]
@@ -895,7 +907,7 @@ This is a \f[B]non-portable extension\f[R].
.SH LIBRARY
.PP
All of the functions below are available when the \f[B]-l\f[R] or
-\f[B]\[en]mathlib\f[R] command-line flags are given.
+\f[B]--mathlib\f[R] command-line flags are given.
.SS Standard Library
.PP
The
@@ -1200,11 +1212,11 @@ interactive mode (see the \f[B]INTERACTIVE MODE\f[R] section), since
bc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
more input when one of those errors occurs in interactive mode.
This is also the case when interactive mode is forced by the
-\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
+\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.PP
These exit statuses allow bc(1) to be used in shell scripting with error
checking, and its normal behavior can be forced by using the
-\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
+\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.SH INTERACTIVE MODE
.PP
Per the
@@ -1212,7 +1224,7 @@ standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html),
bc(1) has an interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both \f[B]stdin\f[R]
and \f[B]stdout\f[R] are hooked to a terminal, but the \f[B]-i\f[R] flag
-and \f[B]\[en]interactive\f[R] option can turn it on in other cases.
+and \f[B]--interactive\f[R] option can turn it on in other cases.
.PP
In interactive mode, bc(1) attempts to recover from errors (see the
\f[B]RESET\f[R] section), and in normal execution, flushes
diff --git a/contrib/bc/manuals/bc/E.1.md b/contrib/bc/manuals/bc/E.1.md
index 3bec29912b77..589050cb89b5 100644
--- a/contrib/bc/manuals/bc/E.1.md
+++ b/contrib/bc/manuals/bc/E.1.md
@@ -2,7 +2,7 @@
SPDX-License-Identifier: BSD-2-Clause
-Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+Copyright (c) 2018-2021 Gavin D. Howard and contributors.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
@@ -34,8 +34,7 @@ bc - arbitrary-precision decimal arithmetic language and calculator
# SYNOPSIS
-**bc** [**-ghilPqsvVw**] [**--global-stacks**] [**--help**] [**--interactive**] [**--mathlib**] [**--no-prompt**] [**--quiet**] [**--standard**] [**--warn**] [**--version**] [**-e** *expr*] [**--expression**=*expr*...] [**-f** *file*...] [**-file**=*file*...]
-[*file*...]
+**bc** [**-ghilPqsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@@ -54,7 +53,7 @@ especially) the GNU bc(1).
The following are the options that bc(1) accepts.
-**-g**, **--global-stacks**
+**-g**, **-\-global-stacks**
Turns the globals **ibase**, **obase**, and **scale** into stacks.
@@ -107,17 +106,17 @@ The following are the options that bc(1) accepts.
This is a **non-portable extension**.
-**-h**, **--help**
+**-h**, **-\-help**
: Prints a usage message and quits.
-**-i**, **--interactive**
+**-i**, **-\-interactive**
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
This is a **non-portable extension**.
-**-l**, **--mathlib**
+**-l**, **-\-mathlib**
: Sets **scale** (see the **SYNTAX** section) to **20** and loads the included
math library before running any code, including any expressions or files
@@ -125,7 +124,7 @@ The following are the options that bc(1) accepts.
To learn what is in the library, see the **LIBRARY** section.
-**-P**, **--no-prompt**
+**-P**, **-\-no-prompt**
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
See the **TTY MODE** section) This is mostly for those users that do not
@@ -135,57 +134,64 @@ The following are the options that bc(1) accepts.
This is a **non-portable extension**.
-**-q**, **--quiet**
+**-q**, **-\-quiet**
: This option is for compatibility with the [GNU bc(1)][2]; it is a no-op.
Without this option, GNU bc(1) prints a copyright header. This bc(1) only
prints the copyright header if one or more of the **-v**, **-V**, or
- **--version** options are given.
+ **-\-version** options are given.
This is a **non-portable extension**.
-**-s**, **--standard**
+**-s**, **-\-standard**
: Process exactly the language defined by the [standard][1] and error if any
extensions are used.
This is a **non-portable extension**.
-**-v**, **-V**, **--version**
+**-v**, **-V**, **-\-version**
: Print the version information (copyright header) and exit.
This is a **non-portable extension**.
-**-w**, **--warn**
+**-w**, **-\-warn**
-: Like **-s** and **--standard**, except that warnings (and not errors) are
+: Like **-s** and **-\-standard**, except that warnings (and not errors) are
printed for non-standard extensions and execution continues normally.
This is a **non-portable extension**.
-**-e** *expr*, **--expression**=*expr*
+**-e** *expr*, **-\-expression**=*expr*
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
order. If files are given as well (see below), the expressions and files are
evaluated in the order given. This means that if a file is given before an
expression, the file is read in and evaluated first.
- After processing all expressions and files, bc(1) will exit, unless **-**
- (**stdin**) was given as an argument at least once to **-f** or **--file**.
- However, if any other **-e**, **--expression**, **-f**, or **--file**
- arguments are given after that, bc(1) will give a fatal error and exit.
+ If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
+ see the **ENVIRONMENT VARIABLES** section), then after processing all
+ expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
+ as an argument at least once to **-f** or **-\-file**, whether on the
+ command-line or in **BC_ENV_ARGS**. However, if any other **-e**,
+ **-\-expression**, **-f**, or **-\-file** arguments are given after **-f-**
+ or equivalent is given, bc(1) will give a fatal error and exit.
This is a **non-portable extension**.
-**-f** *file*, **--file**=*file*
+**-f** *file*, **-\-file**=*file*
: Reads in *file* and evaluates it, line by line, as though it were read
through **stdin**. If expressions are also given (see above), the
expressions are evaluated in the order given.
- After processing all expressions and files, bc(1) will exit, unless **-**
- (**stdin**) was given as an argument at least once to **-f** or **--file**.
+ If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
+ see the **ENVIRONMENT VARIABLES** section), then after processing all
+ expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
+ as an argument at least once to **-f** or **-\-file**. However, if any other
+ **-e**, **-\-expression**, **-f**, or **-\-file** arguments are given after
+ **-f-** or equivalent is given, bc(1) will give a fatal error and exit.
This is a **non-portable extension**.
@@ -193,7 +199,9 @@ All long options are **non-portable extensions**.
# STDOUT
-Any non-error output is written to **stdout**.
+Any non-error output is written to **stdout**. In addition, if history (see the
+**HISTORY** section) and the prompt (see the **TTY MODE** section) are enabled,
+both are output to **stdout**.
**Note**: Unlike other bc(1) implementations, this bc(1) will issue a fatal
error (see the **EXIT STATUS** section) if it cannot write to **stdout**, so if
@@ -237,8 +245,8 @@ Identifiers with more than one character (letter) are a
**ibase** is a global variable determining how to interpret constant numbers. It
is the "input" base, or the number base used for interpreting input numbers.
-**ibase** is initially **10**. If the **-s** (**--standard**) and **-w**
-(**--warn**) flags were not given on the command line, the max allowable value
+**ibase** is initially **10**. If the **-s** (**-\-standard**) and **-w**
+(**-\-warn**) flags were not given on the command line, the max allowable value
for **ibase** is **36**. Otherwise, it is **16**. The min allowable value for
**ibase** is **2**. The max allowable value for **ibase** can be queried in
bc(1) programs with the **maxibase()** built-in function.
@@ -357,7 +365,7 @@ The following arithmetic and logical operators can be used. They are listed in
order of decreasing precedence. Operators in the same group have the same
precedence.
-**++** **--**
+**++** **-\-**
: Type: Prefix and Postfix
@@ -431,7 +439,7 @@ precedence.
The operators will be described in more detail below.
-**++** **--**
+**++** **-\-**
: The prefix and postfix **increment** and **decrement** operators behave
exactly like they would in C. They require a named expression (see the
@@ -707,7 +715,7 @@ This is a **non-portable extension**.
# LIBRARY
-All of the functions below are available when the **-l** or **--mathlib**
+All of the functions below are available when the **-l** or **-\-mathlib**
command-line flags are given.
## Standard Library
@@ -983,17 +991,17 @@ The other statuses will only be returned when bc(1) is not in interactive mode
(see the **INTERACTIVE MODE** section), since bc(1) resets its state (see the
**RESET** section) and accepts more input when one of those errors occurs in
interactive mode. This is also the case when interactive mode is forced by the
-**-i** flag or **--interactive** option.
+**-i** flag or **-\-interactive** option.
These exit statuses allow bc(1) to be used in shell scripting with error
checking, and its normal behavior can be forced by using the **-i** flag or
-**--interactive** option.
+**-\-interactive** option.
# INTERACTIVE MODE
Per the [standard][1], bc(1) has an interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both **stdin** and **stdout**
-are hooked to a terminal, but the **-i** flag and **--interactive** option can
+are hooked to a terminal, but the **-i** flag and **-\-interactive** option can
turn it on in other cases.
In interactive mode, bc(1) attempts to recover from errors (see the **RESET**
diff --git a/contrib/bc/manuals/bc/EH.1 b/contrib/bc/manuals/bc/EH.1
index ed19e9769bd7..53f95b2f7c09 100644
--- a/contrib/bc/manuals/bc/EH.1
+++ b/contrib/bc/manuals/bc/EH.1
@@ -1,7 +1,7 @@
.\"
.\" SPDX-License-Identifier: BSD-2-Clause
.\"
-.\" Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+.\" Copyright (c) 2018-2021 Gavin D. Howard and contributors.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions are met:
@@ -25,19 +25,18 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.TH "BC" "1" "October 2020" "Gavin D. Howard" "General Commands Manual"
+.TH "BC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
.SH NAME
.PP
bc - arbitrary-precision decimal arithmetic language and calculator
.SH SYNOPSIS
.PP
-\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]\[en]global-stacks\f[R]]
-[\f[B]\[en]help\f[R]] [\f[B]\[en]interactive\f[R]]
-[\f[B]\[en]mathlib\f[R]] [\f[B]\[en]no-prompt\f[R]]
-[\f[B]\[en]quiet\f[R]] [\f[B]\[en]standard\f[R]] [\f[B]\[en]warn\f[R]]
-[\f[B]\[en]version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
-[\f[B]\[en]expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
-\f[I]file\f[R]\&...] [\f[B]-file\f[R]=\f[I]file\f[R]\&...]
+\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]--global-stacks\f[R]]
+[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--mathlib\f[R]]
+[\f[B]--no-prompt\f[R]] [\f[B]--quiet\f[R]] [\f[B]--standard\f[R]]
+[\f[B]--warn\f[R]] [\f[B]--version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
+[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
+\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
[\f[I]file\f[R]\&...]
.SH DESCRIPTION
.PP
@@ -55,7 +54,7 @@ the command line and executes them before reading from \f[B]stdin\f[R].
.PP
The following are the options that bc(1) accepts.
.PP
-\f[B]-g\f[R], \f[B]\[en]global-stacks\f[R]
+\f[B]-g\f[R], \f[B]--global-stacks\f[R]
.IP
.nf
\f[C]
@@ -112,10 +111,10 @@ This is a **non-portable extension**.
\f[R]
.fi
.TP
-\f[B]-h\f[R], \f[B]\[en]help\f[R]
+\f[B]-h\f[R], \f[B]--help\f[R]
Prints a usage message and quits.
.TP
-\f[B]-i\f[R], \f[B]\[en]interactive\f[R]
+\f[B]-i\f[R], \f[B]--interactive\f[R]
Forces interactive mode.
(See the \f[B]INTERACTIVE MODE\f[R] section.)
.RS
@@ -123,7 +122,7 @@ Forces interactive mode.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-l\f[R], \f[B]\[en]mathlib\f[R]
+\f[B]-l\f[R], \f[B]--mathlib\f[R]
Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to \f[B]20\f[R]
and loads the included math library before running any code, including
any expressions or files specified on the command line.
@@ -132,7 +131,7 @@ any expressions or files specified on the command line.
To learn what is in the library, see the \f[B]LIBRARY\f[R] section.
.RE
.TP
-\f[B]-P\f[R], \f[B]\[en]no-prompt\f[R]
+\f[B]-P\f[R], \f[B]--no-prompt\f[R]
Disables the prompt in TTY mode.
(The prompt is only enabled in TTY mode.
See the \f[B]TTY MODE\f[R] section) This is mostly for those users that
@@ -144,18 +143,18 @@ Most of those users would want to put this option in
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-q\f[R], \f[B]\[en]quiet\f[R]
+\f[B]-q\f[R], \f[B]--quiet\f[R]
This option is for compatibility with the GNU
bc(1) (https://www.gnu.org/software/bc/); it is a no-op.
Without this option, GNU bc(1) prints a copyright header.
This bc(1) only prints the copyright header if one or more of the
-\f[B]-v\f[R], \f[B]-V\f[R], or \f[B]\[en]version\f[R] options are given.
+\f[B]-v\f[R], \f[B]-V\f[R], or \f[B]--version\f[R] options are given.
.RS
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-s\f[R], \f[B]\[en]standard\f[R]
+\f[B]-s\f[R], \f[B]--standard\f[R]
Process exactly the language defined by the
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
and error if any extensions are used.
@@ -164,15 +163,15 @@ and error if any extensions are used.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-v\f[R], \f[B]-V\f[R], \f[B]\[en]version\f[R]
+\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
Print the version information (copyright header) and exit.
.RS
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-w\f[R], \f[B]\[en]warn\f[R]
-Like \f[B]-s\f[R] and \f[B]\[en]standard\f[R], except that warnings (and
+\f[B]-w\f[R], \f[B]--warn\f[R]
+Like \f[B]-s\f[R] and \f[B]--standard\f[R], except that warnings (and
not errors) are printed for non-standard extensions and execution
continues normally.
.RS
@@ -180,7 +179,7 @@ continues normally.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-e\f[R] \f[I]expr\f[R], \f[B]\[en]expression\f[R]=\f[I]expr\f[R]
+\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
Evaluates \f[I]expr\f[R].
If multiple expressions are given, they are evaluated in order.
If files are given as well (see below), the expressions and files are
@@ -189,26 +188,36 @@ This means that if a file is given before an expression, the file is
read in and evaluated first.
.RS
.PP
-After processing all expressions and files, bc(1) will exit, unless
+If this option is given on the command-line (i.e., not in
+\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
+then after processing all expressions and files, bc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]\[en]file\f[R].
-However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
-\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after that,
-bc(1) will give a fatal error and exit.
+\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
+\f[B]BC_ENV_ARGS\f[R].
+However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
+\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
+\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
+exit.
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-f\f[R] \f[I]file\f[R], \f[B]\[en]file\f[R]=\f[I]file\f[R]
+\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
were read through \f[B]stdin\f[R].
If expressions are also given (see above), the expressions are evaluated
in the order given.
.RS
.PP
-After processing all expressions and files, bc(1) will exit, unless
+If this option is given on the command-line (i.e., not in
+\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
+then after processing all expressions and files, bc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]\[en]file\f[R].
+\f[B]-f\f[R] or \f[B]--file\f[R].
+However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
+\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
+\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
+exit.
.PP
This is a \f[B]non-portable extension\f[R].
.RE
@@ -217,6 +226,9 @@ All long options are \f[B]non-portable extensions\f[R].
.SH STDOUT
.PP
Any non-error output is written to \f[B]stdout\f[R].
+In addition, if history (see the \f[B]HISTORY\f[R] section) and the
+prompt (see the \f[B]TTY MODE\f[R] section) are enabled, both are output
+to \f[B]stdout\f[R].
.PP
\f[B]Note\f[R]: Unlike other bc(1) implementations, this bc(1) will
issue a fatal error (see the \f[B]EXIT STATUS\f[R] section) if it cannot
@@ -268,8 +280,8 @@ constant numbers.
It is the \[lq]input\[rq] base, or the number base used for interpreting
input numbers.
\f[B]ibase\f[R] is initially \f[B]10\f[R].
-If the \f[B]-s\f[R] (\f[B]\[en]standard\f[R]) and \f[B]-w\f[R]
-(\f[B]\[en]warn\f[R]) flags were not given on the command line, the max
+If the \f[B]-s\f[R] (\f[B]--standard\f[R]) and \f[B]-w\f[R]
+(\f[B]--warn\f[R]) flags were not given on the command line, the max
allowable value for \f[B]ibase\f[R] is \f[B]36\f[R].
Otherwise, it is \f[B]16\f[R].
The min allowable value for \f[B]ibase\f[R] is \f[B]2\f[R].
@@ -429,7 +441,7 @@ The following arithmetic and logical operators can be used.
They are listed in order of decreasing precedence.
Operators in the same group have the same precedence.
.TP
-\f[B]++\f[R] \f[B]\[en]\f[R]
+\f[B]++\f[R] \f[B]--\f[R]
Type: Prefix and Postfix
.RS
.PP
@@ -512,7 +524,7 @@ Description: \f[B]boolean or\f[R]
.PP
The operators will be described in more detail below.
.TP
-\f[B]++\f[R] \f[B]\[en]\f[R]
+\f[B]++\f[R] \f[B]--\f[R]
The prefix and postfix \f[B]increment\f[R] and \f[B]decrement\f[R]
operators behave exactly like they would in C.
They require a named expression (see the \f[I]Named Expressions\f[R]
@@ -892,7 +904,7 @@ This is a \f[B]non-portable extension\f[R].
.SH LIBRARY
.PP
All of the functions below are available when the \f[B]-l\f[R] or
-\f[B]\[en]mathlib\f[R] command-line flags are given.
+\f[B]--mathlib\f[R] command-line flags are given.
.SS Standard Library
.PP
The
@@ -1197,11 +1209,11 @@ interactive mode (see the \f[B]INTERACTIVE MODE\f[R] section), since
bc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
more input when one of those errors occurs in interactive mode.
This is also the case when interactive mode is forced by the
-\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
+\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.PP
These exit statuses allow bc(1) to be used in shell scripting with error
checking, and its normal behavior can be forced by using the
-\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
+\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.SH INTERACTIVE MODE
.PP
Per the
@@ -1209,7 +1221,7 @@ standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html),
bc(1) has an interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both \f[B]stdin\f[R]
and \f[B]stdout\f[R] are hooked to a terminal, but the \f[B]-i\f[R] flag
-and \f[B]\[en]interactive\f[R] option can turn it on in other cases.
+and \f[B]--interactive\f[R] option can turn it on in other cases.
.PP
In interactive mode, bc(1) attempts to recover from errors (see the
\f[B]RESET\f[R] section), and in normal execution, flushes
diff --git a/contrib/bc/manuals/bc/EH.1.md b/contrib/bc/manuals/bc/EH.1.md
index 32d95f48fcee..bfd08efb3830 100644
--- a/contrib/bc/manuals/bc/EH.1.md
+++ b/contrib/bc/manuals/bc/EH.1.md
@@ -2,7 +2,7 @@
SPDX-License-Identifier: BSD-2-Clause
-Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+Copyright (c) 2018-2021 Gavin D. Howard and contributors.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
@@ -34,8 +34,7 @@ bc - arbitrary-precision decimal arithmetic language and calculator
# SYNOPSIS
-**bc** [**-ghilPqsvVw**] [**--global-stacks**] [**--help**] [**--interactive**] [**--mathlib**] [**--no-prompt**] [**--quiet**] [**--standard**] [**--warn**] [**--version**] [**-e** *expr*] [**--expression**=*expr*...] [**-f** *file*...] [**-file**=*file*...]
-[*file*...]
+**bc** [**-ghilPqsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@@ -51,7 +50,7 @@ command line and executes them before reading from **stdin**.
The following are the options that bc(1) accepts.
-**-g**, **--global-stacks**
+**-g**, **-\-global-stacks**
Turns the globals **ibase**, **obase**, and **scale** into stacks.
@@ -104,17 +103,17 @@ The following are the options that bc(1) accepts.
This is a **non-portable extension**.
-**-h**, **--help**
+**-h**, **-\-help**
: Prints a usage message and quits.
-**-i**, **--interactive**
+**-i**, **-\-interactive**
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
This is a **non-portable extension**.
-**-l**, **--mathlib**
+**-l**, **-\-mathlib**
: Sets **scale** (see the **SYNTAX** section) to **20** and loads the included
math library before running any code, including any expressions or files
@@ -122,7 +121,7 @@ The following are the options that bc(1) accepts.
To learn what is in the library, see the **LIBRARY** section.
-**-P**, **--no-prompt**
+**-P**, **-\-no-prompt**
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
See the **TTY MODE** section) This is mostly for those users that do not
@@ -132,57 +131,64 @@ The following are the options that bc(1) accepts.
This is a **non-portable extension**.
-**-q**, **--quiet**
+**-q**, **-\-quiet**
: This option is for compatibility with the [GNU bc(1)][2]; it is a no-op.
Without this option, GNU bc(1) prints a copyright header. This bc(1) only
prints the copyright header if one or more of the **-v**, **-V**, or
- **--version** options are given.
+ **-\-version** options are given.
This is a **non-portable extension**.
-**-s**, **--standard**
+**-s**, **-\-standard**
: Process exactly the language defined by the [standard][1] and error if any
extensions are used.
This is a **non-portable extension**.
-**-v**, **-V**, **--version**
+**-v**, **-V**, **-\-version**
: Print the version information (copyright header) and exit.
This is a **non-portable extension**.
-**-w**, **--warn**
+**-w**, **-\-warn**
-: Like **-s** and **--standard**, except that warnings (and not errors) are
+: Like **-s** and **-\-standard**, except that warnings (and not errors) are
printed for non-standard extensions and execution continues normally.
This is a **non-portable extension**.
-**-e** *expr*, **--expression**=*expr*
+**-e** *expr*, **-\-expression**=*expr*
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
order. If files are given as well (see below), the expressions and files are
evaluated in the order given. This means that if a file is given before an
expression, the file is read in and evaluated first.
- After processing all expressions and files, bc(1) will exit, unless **-**
- (**stdin**) was given as an argument at least once to **-f** or **--file**.
- However, if any other **-e**, **--expression**, **-f**, or **--file**
- arguments are given after that, bc(1) will give a fatal error and exit.
+ If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
+ see the **ENVIRONMENT VARIABLES** section), then after processing all
+ expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
+ as an argument at least once to **-f** or **-\-file**, whether on the
+ command-line or in **BC_ENV_ARGS**. However, if any other **-e**,
+ **-\-expression**, **-f**, or **-\-file** arguments are given after **-f-**
+ or equivalent is given, bc(1) will give a fatal error and exit.
This is a **non-portable extension**.
-**-f** *file*, **--file**=*file*
+**-f** *file*, **-\-file**=*file*
: Reads in *file* and evaluates it, line by line, as though it were read
through **stdin**. If expressions are also given (see above), the
expressions are evaluated in the order given.
- After processing all expressions and files, bc(1) will exit, unless **-**
- (**stdin**) was given as an argument at least once to **-f** or **--file**.
+ If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
+ see the **ENVIRONMENT VARIABLES** section), then after processing all
+ expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
+ as an argument at least once to **-f** or **-\-file**. However, if any other
+ **-e**, **-\-expression**, **-f**, or **-\-file** arguments are given after
+ **-f-** or equivalent is given, bc(1) will give a fatal error and exit.
This is a **non-portable extension**.
@@ -190,7 +196,9 @@ All long options are **non-portable extensions**.
# STDOUT
-Any non-error output is written to **stdout**.
+Any non-error output is written to **stdout**. In addition, if history (see the
+**HISTORY** section) and the prompt (see the **TTY MODE** section) are enabled,
+both are output to **stdout**.
**Note**: Unlike other bc(1) implementations, this bc(1) will issue a fatal
error (see the **EXIT STATUS** section) if it cannot write to **stdout**, so if
@@ -234,8 +242,8 @@ Identifiers with more than one character (letter) are a
**ibase** is a global variable determining how to interpret constant numbers. It
is the "input" base, or the number base used for interpreting input numbers.
-**ibase** is initially **10**. If the **-s** (**--standard**) and **-w**
-(**--warn**) flags were not given on the command line, the max allowable value
+**ibase** is initially **10**. If the **-s** (**-\-standard**) and **-w**
+(**-\-warn**) flags were not given on the command line, the max allowable value
for **ibase** is **36**. Otherwise, it is **16**. The min allowable value for
**ibase** is **2**. The max allowable value for **ibase** can be queried in
bc(1) programs with the **maxibase()** built-in function.
@@ -354,7 +362,7 @@ The following arithmetic and logical operators can be used. They are listed in
order of decreasing precedence. Operators in the same group have the same
precedence.
-**++** **--**
+**++** **-\-**
: Type: Prefix and Postfix
@@ -428,7 +436,7 @@ precedence.
The operators will be described in more detail below.
-**++** **--**
+**++** **-\-**
: The prefix and postfix **increment** and **decrement** operators behave
exactly like they would in C. They require a named expression (see the
@@ -704,7 +712,7 @@ This is a **non-portable extension**.
# LIBRARY
-All of the functions below are available when the **-l** or **--mathlib**
+All of the functions below are available when the **-l** or **-\-mathlib**
command-line flags are given.
## Standard Library
@@ -980,17 +988,17 @@ The other statuses will only be returned when bc(1) is not in interactive mode
(see the **INTERACTIVE MODE** section), since bc(1) resets its state (see the
**RESET** section) and accepts more input when one of those errors occurs in
interactive mode. This is also the case when interactive mode is forced by the
-**-i** flag or **--interactive** option.
+**-i** flag or **-\-interactive** option.
These exit statuses allow bc(1) to be used in shell scripting with error
checking, and its normal behavior can be forced by using the **-i** flag or
-**--interactive** option.
+**-\-interactive** option.
# INTERACTIVE MODE
Per the [standard][1], bc(1) has an interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both **stdin** and **stdout**
-are hooked to a terminal, but the **-i** flag and **--interactive** option can
+are hooked to a terminal, but the **-i** flag and **-\-interactive** option can
turn it on in other cases.
In interactive mode, bc(1) attempts to recover from errors (see the **RESET**
diff --git a/contrib/bc/manuals/bc/EHN.1 b/contrib/bc/manuals/bc/EHN.1
index 39846195d4b3..0870115dca2a 100644
--- a/contrib/bc/manuals/bc/EHN.1
+++ b/contrib/bc/manuals/bc/EHN.1
@@ -1,7 +1,7 @@
.\"
.\" SPDX-License-Identifier: BSD-2-Clause
.\"
-.\" Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+.\" Copyright (c) 2018-2021 Gavin D. Howard and contributors.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions are met:
@@ -25,19 +25,18 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.TH "BC" "1" "October 2020" "Gavin D. Howard" "General Commands Manual"
+.TH "BC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
.SH NAME
.PP
bc - arbitrary-precision decimal arithmetic language and calculator
.SH SYNOPSIS
.PP
-\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]\[en]global-stacks\f[R]]
-[\f[B]\[en]help\f[R]] [\f[B]\[en]interactive\f[R]]
-[\f[B]\[en]mathlib\f[R]] [\f[B]\[en]no-prompt\f[R]]
-[\f[B]\[en]quiet\f[R]] [\f[B]\[en]standard\f[R]] [\f[B]\[en]warn\f[R]]
-[\f[B]\[en]version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
-[\f[B]\[en]expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
-\f[I]file\f[R]\&...] [\f[B]-file\f[R]=\f[I]file\f[R]\&...]
+\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]--global-stacks\f[R]]
+[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--mathlib\f[R]]
+[\f[B]--no-prompt\f[R]] [\f[B]--quiet\f[R]] [\f[B]--standard\f[R]]
+[\f[B]--warn\f[R]] [\f[B]--version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
+[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
+\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
[\f[I]file\f[R]\&...]
.SH DESCRIPTION
.PP
@@ -55,7 +54,7 @@ the command line and executes them before reading from \f[B]stdin\f[R].
.PP
The following are the options that bc(1) accepts.
.PP
-\f[B]-g\f[R], \f[B]\[en]global-stacks\f[R]
+\f[B]-g\f[R], \f[B]--global-stacks\f[R]
.IP
.nf
\f[C]
@@ -112,10 +111,10 @@ This is a **non-portable extension**.
\f[R]
.fi
.TP
-\f[B]-h\f[R], \f[B]\[en]help\f[R]
+\f[B]-h\f[R], \f[B]--help\f[R]
Prints a usage message and quits.
.TP
-\f[B]-i\f[R], \f[B]\[en]interactive\f[R]
+\f[B]-i\f[R], \f[B]--interactive\f[R]
Forces interactive mode.
(See the \f[B]INTERACTIVE MODE\f[R] section.)
.RS
@@ -123,7 +122,7 @@ Forces interactive mode.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-l\f[R], \f[B]\[en]mathlib\f[R]
+\f[B]-l\f[R], \f[B]--mathlib\f[R]
Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to \f[B]20\f[R]
and loads the included math library before running any code, including
any expressions or files specified on the command line.
@@ -132,7 +131,7 @@ any expressions or files specified on the command line.
To learn what is in the library, see the \f[B]LIBRARY\f[R] section.
.RE
.TP
-\f[B]-P\f[R], \f[B]\[en]no-prompt\f[R]
+\f[B]-P\f[R], \f[B]--no-prompt\f[R]
Disables the prompt in TTY mode.
(The prompt is only enabled in TTY mode.
See the \f[B]TTY MODE\f[R] section) This is mostly for those users that
@@ -144,18 +143,18 @@ Most of those users would want to put this option in
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-q\f[R], \f[B]\[en]quiet\f[R]
+\f[B]-q\f[R], \f[B]--quiet\f[R]
This option is for compatibility with the GNU
bc(1) (https://www.gnu.org/software/bc/); it is a no-op.
Without this option, GNU bc(1) prints a copyright header.
This bc(1) only prints the copyright header if one or more of the
-\f[B]-v\f[R], \f[B]-V\f[R], or \f[B]\[en]version\f[R] options are given.
+\f[B]-v\f[R], \f[B]-V\f[R], or \f[B]--version\f[R] options are given.
.RS
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-s\f[R], \f[B]\[en]standard\f[R]
+\f[B]-s\f[R], \f[B]--standard\f[R]
Process exactly the language defined by the
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
and error if any extensions are used.
@@ -164,15 +163,15 @@ and error if any extensions are used.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-v\f[R], \f[B]-V\f[R], \f[B]\[en]version\f[R]
+\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
Print the version information (copyright header) and exit.
.RS
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-w\f[R], \f[B]\[en]warn\f[R]
-Like \f[B]-s\f[R] and \f[B]\[en]standard\f[R], except that warnings (and
+\f[B]-w\f[R], \f[B]--warn\f[R]
+Like \f[B]-s\f[R] and \f[B]--standard\f[R], except that warnings (and
not errors) are printed for non-standard extensions and execution
continues normally.
.RS
@@ -180,7 +179,7 @@ continues normally.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-e\f[R] \f[I]expr\f[R], \f[B]\[en]expression\f[R]=\f[I]expr\f[R]
+\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
Evaluates \f[I]expr\f[R].
If multiple expressions are given, they are evaluated in order.
If files are given as well (see below), the expressions and files are
@@ -189,26 +188,36 @@ This means that if a file is given before an expression, the file is
read in and evaluated first.
.RS
.PP
-After processing all expressions and files, bc(1) will exit, unless
+If this option is given on the command-line (i.e., not in
+\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
+then after processing all expressions and files, bc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]\[en]file\f[R].
-However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
-\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after that,
-bc(1) will give a fatal error and exit.
+\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
+\f[B]BC_ENV_ARGS\f[R].
+However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
+\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
+\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
+exit.
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-f\f[R] \f[I]file\f[R], \f[B]\[en]file\f[R]=\f[I]file\f[R]
+\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
were read through \f[B]stdin\f[R].
If expressions are also given (see above), the expressions are evaluated
in the order given.
.RS
.PP
-After processing all expressions and files, bc(1) will exit, unless
+If this option is given on the command-line (i.e., not in
+\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
+then after processing all expressions and files, bc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]\[en]file\f[R].
+\f[B]-f\f[R] or \f[B]--file\f[R].
+However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
+\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
+\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
+exit.
.PP
This is a \f[B]non-portable extension\f[R].
.RE
@@ -217,6 +226,9 @@ All long options are \f[B]non-portable extensions\f[R].
.SH STDOUT
.PP
Any non-error output is written to \f[B]stdout\f[R].
+In addition, if history (see the \f[B]HISTORY\f[R] section) and the
+prompt (see the \f[B]TTY MODE\f[R] section) are enabled, both are output
+to \f[B]stdout\f[R].
.PP
\f[B]Note\f[R]: Unlike other bc(1) implementations, this bc(1) will
issue a fatal error (see the \f[B]EXIT STATUS\f[R] section) if it cannot
@@ -268,8 +280,8 @@ constant numbers.
It is the \[lq]input\[rq] base, or the number base used for interpreting
input numbers.
\f[B]ibase\f[R] is initially \f[B]10\f[R].
-If the \f[B]-s\f[R] (\f[B]\[en]standard\f[R]) and \f[B]-w\f[R]
-(\f[B]\[en]warn\f[R]) flags were not given on the command line, the max
+If the \f[B]-s\f[R] (\f[B]--standard\f[R]) and \f[B]-w\f[R]
+(\f[B]--warn\f[R]) flags were not given on the command line, the max
allowable value for \f[B]ibase\f[R] is \f[B]36\f[R].
Otherwise, it is \f[B]16\f[R].
The min allowable value for \f[B]ibase\f[R] is \f[B]2\f[R].
@@ -429,7 +441,7 @@ The following arithmetic and logical operators can be used.
They are listed in order of decreasing precedence.
Operators in the same group have the same precedence.
.TP
-\f[B]++\f[R] \f[B]\[en]\f[R]
+\f[B]++\f[R] \f[B]--\f[R]
Type: Prefix and Postfix
.RS
.PP
@@ -512,7 +524,7 @@ Description: \f[B]boolean or\f[R]
.PP
The operators will be described in more detail below.
.TP
-\f[B]++\f[R] \f[B]\[en]\f[R]
+\f[B]++\f[R] \f[B]--\f[R]
The prefix and postfix \f[B]increment\f[R] and \f[B]decrement\f[R]
operators behave exactly like they would in C.
They require a named expression (see the \f[I]Named Expressions\f[R]
@@ -892,7 +904,7 @@ This is a \f[B]non-portable extension\f[R].
.SH LIBRARY
.PP
All of the functions below are available when the \f[B]-l\f[R] or
-\f[B]\[en]mathlib\f[R] command-line flags are given.
+\f[B]--mathlib\f[R] command-line flags are given.
.SS Standard Library
.PP
The
@@ -1197,11 +1209,11 @@ interactive mode (see the \f[B]INTERACTIVE MODE\f[R] section), since
bc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
more input when one of those errors occurs in interactive mode.
This is also the case when interactive mode is forced by the
-\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
+\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.PP
These exit statuses allow bc(1) to be used in shell scripting with error
checking, and its normal behavior can be forced by using the
-\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
+\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.SH INTERACTIVE MODE
.PP
Per the
@@ -1209,7 +1221,7 @@ standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html),
bc(1) has an interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both \f[B]stdin\f[R]
and \f[B]stdout\f[R] are hooked to a terminal, but the \f[B]-i\f[R] flag
-and \f[B]\[en]interactive\f[R] option can turn it on in other cases.
+and \f[B]--interactive\f[R] option can turn it on in other cases.
.PP
In interactive mode, bc(1) attempts to recover from errors (see the
\f[B]RESET\f[R] section), and in normal execution, flushes
diff --git a/contrib/bc/manuals/bc/EHN.1.md b/contrib/bc/manuals/bc/EHN.1.md
index 2eaf8145c90e..15b851ee19b0 100644
--- a/contrib/bc/manuals/bc/EHN.1.md
+++ b/contrib/bc/manuals/bc/EHN.1.md
@@ -2,7 +2,7 @@
SPDX-License-Identifier: BSD-2-Clause
-Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+Copyright (c) 2018-2021 Gavin D. Howard and contributors.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
@@ -34,8 +34,7 @@ bc - arbitrary-precision decimal arithmetic language and calculator
# SYNOPSIS
-**bc** [**-ghilPqsvVw**] [**--global-stacks**] [**--help**] [**--interactive**] [**--mathlib**] [**--no-prompt**] [**--quiet**] [**--standard**] [**--warn**] [**--version**] [**-e** *expr*] [**--expression**=*expr*...] [**-f** *file*...] [**-file**=*file*...]
-[*file*...]
+**bc** [**-ghilPqsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@@ -51,7 +50,7 @@ command line and executes them before reading from **stdin**.
The following are the options that bc(1) accepts.
-**-g**, **--global-stacks**
+**-g**, **-\-global-stacks**
Turns the globals **ibase**, **obase**, and **scale** into stacks.
@@ -104,17 +103,17 @@ The following are the options that bc(1) accepts.
This is a **non-portable extension**.
-**-h**, **--help**
+**-h**, **-\-help**
: Prints a usage message and quits.
-**-i**, **--interactive**
+**-i**, **-\-interactive**
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
This is a **non-portable extension**.
-**-l**, **--mathlib**
+**-l**, **-\-mathlib**
: Sets **scale** (see the **SYNTAX** section) to **20** and loads the included
math library before running any code, including any expressions or files
@@ -122,7 +121,7 @@ The following are the options that bc(1) accepts.
To learn what is in the library, see the **LIBRARY** section.
-**-P**, **--no-prompt**
+**-P**, **-\-no-prompt**
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
See the **TTY MODE** section) This is mostly for those users that do not
@@ -132,57 +131,64 @@ The following are the options that bc(1) accepts.
This is a **non-portable extension**.
-**-q**, **--quiet**
+**-q**, **-\-quiet**
: This option is for compatibility with the [GNU bc(1)][2]; it is a no-op.
Without this option, GNU bc(1) prints a copyright header. This bc(1) only
prints the copyright header if one or more of the **-v**, **-V**, or
- **--version** options are given.
+ **-\-version** options are given.
This is a **non-portable extension**.
-**-s**, **--standard**
+**-s**, **-\-standard**
: Process exactly the language defined by the [standard][1] and error if any
extensions are used.
This is a **non-portable extension**.
-**-v**, **-V**, **--version**
+**-v**, **-V**, **-\-version**
: Print the version information (copyright header) and exit.
This is a **non-portable extension**.
-**-w**, **--warn**
+**-w**, **-\-warn**
-: Like **-s** and **--standard**, except that warnings (and not errors) are
+: Like **-s** and **-\-standard**, except that warnings (and not errors) are
printed for non-standard extensions and execution continues normally.
This is a **non-portable extension**.
-**-e** *expr*, **--expression**=*expr*
+**-e** *expr*, **-\-expression**=*expr*
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
order. If files are given as well (see below), the expressions and files are
evaluated in the order given. This means that if a file is given before an
expression, the file is read in and evaluated first.
- After processing all expressions and files, bc(1) will exit, unless **-**
- (**stdin**) was given as an argument at least once to **-f** or **--file**.
- However, if any other **-e**, **--expression**, **-f**, or **--file**
- arguments are given after that, bc(1) will give a fatal error and exit.
+ If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
+ see the **ENVIRONMENT VARIABLES** section), then after processing all
+ expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
+ as an argument at least once to **-f** or **-\-file**, whether on the
+ command-line or in **BC_ENV_ARGS**. However, if any other **-e**,
+ **-\-expression**, **-f**, or **-\-file** arguments are given after **-f-**
+ or equivalent is given, bc(1) will give a fatal error and exit.
This is a **non-portable extension**.
-**-f** *file*, **--file**=*file*
+**-f** *file*, **-\-file**=*file*
: Reads in *file* and evaluates it, line by line, as though it were read
through **stdin**. If expressions are also given (see above), the
expressions are evaluated in the order given.
- After processing all expressions and files, bc(1) will exit, unless **-**
- (**stdin**) was given as an argument at least once to **-f** or **--file**.
+ If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
+ see the **ENVIRONMENT VARIABLES** section), then after processing all
+ expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
+ as an argument at least once to **-f** or **-\-file**. However, if any other
+ **-e**, **-\-expression**, **-f**, or **-\-file** arguments are given after
+ **-f-** or equivalent is given, bc(1) will give a fatal error and exit.
This is a **non-portable extension**.
@@ -190,7 +196,9 @@ All long options are **non-portable extensions**.
# STDOUT
-Any non-error output is written to **stdout**.
+Any non-error output is written to **stdout**. In addition, if history (see the
+**HISTORY** section) and the prompt (see the **TTY MODE** section) are enabled,
+both are output to **stdout**.
**Note**: Unlike other bc(1) implementations, this bc(1) will issue a fatal
error (see the **EXIT STATUS** section) if it cannot write to **stdout**, so if
@@ -234,8 +242,8 @@ Identifiers with more than one character (letter) are a
**ibase** is a global variable determining how to interpret constant numbers. It
is the "input" base, or the number base used for interpreting input numbers.
-**ibase** is initially **10**. If the **-s** (**--standard**) and **-w**
-(**--warn**) flags were not given on the command line, the max allowable value
+**ibase** is initially **10**. If the **-s** (**-\-standard**) and **-w**
+(**-\-warn**) flags were not given on the command line, the max allowable value
for **ibase** is **36**. Otherwise, it is **16**. The min allowable value for
**ibase** is **2**. The max allowable value for **ibase** can be queried in
bc(1) programs with the **maxibase()** built-in function.
@@ -354,7 +362,7 @@ The following arithmetic and logical operators can be used. They are listed in
order of decreasing precedence. Operators in the same group have the same
precedence.
-**++** **--**
+**++** **-\-**
: Type: Prefix and Postfix
@@ -428,7 +436,7 @@ precedence.
The operators will be described in more detail below.
-**++** **--**
+**++** **-\-**
: The prefix and postfix **increment** and **decrement** operators behave
exactly like they would in C. They require a named expression (see the
@@ -704,7 +712,7 @@ This is a **non-portable extension**.
# LIBRARY
-All of the functions below are available when the **-l** or **--mathlib**
+All of the functions below are available when the **-l** or **-\-mathlib**
command-line flags are given.
## Standard Library
@@ -980,17 +988,17 @@ The other statuses will only be returned when bc(1) is not in interactive mode
(see the **INTERACTIVE MODE** section), since bc(1) resets its state (see the
**RESET** section) and accepts more input when one of those errors occurs in
interactive mode. This is also the case when interactive mode is forced by the
-**-i** flag or **--interactive** option.
+**-i** flag or **-\-interactive** option.
These exit statuses allow bc(1) to be used in shell scripting with error
checking, and its normal behavior can be forced by using the **-i** flag or
-**--interactive** option.
+**-\-interactive** option.
# INTERACTIVE MODE
Per the [standard][1], bc(1) has an interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both **stdin** and **stdout**
-are hooked to a terminal, but the **-i** flag and **--interactive** option can
+are hooked to a terminal, but the **-i** flag and **-\-interactive** option can
turn it on in other cases.
In interactive mode, bc(1) attempts to recover from errors (see the **RESET**
diff --git a/contrib/bc/manuals/bc/EHNP.1 b/contrib/bc/manuals/bc/EHNP.1
index 231dc1d404c4..f6728d5b2221 100644
--- a/contrib/bc/manuals/bc/EHNP.1
+++ b/contrib/bc/manuals/bc/EHNP.1
@@ -1,7 +1,7 @@
.\"
.\" SPDX-License-Identifier: BSD-2-Clause
.\"
-.\" Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+.\" Copyright (c) 2018-2021 Gavin D. Howard and contributors.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions are met:
@@ -25,19 +25,18 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.TH "BC" "1" "October 2020" "Gavin D. Howard" "General Commands Manual"
+.TH "BC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
.SH NAME
.PP
bc - arbitrary-precision decimal arithmetic language and calculator
.SH SYNOPSIS
.PP
-\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]\[en]global-stacks\f[R]]
-[\f[B]\[en]help\f[R]] [\f[B]\[en]interactive\f[R]]
-[\f[B]\[en]mathlib\f[R]] [\f[B]\[en]no-prompt\f[R]]
-[\f[B]\[en]quiet\f[R]] [\f[B]\[en]standard\f[R]] [\f[B]\[en]warn\f[R]]
-[\f[B]\[en]version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
-[\f[B]\[en]expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
-\f[I]file\f[R]\&...] [\f[B]-file\f[R]=\f[I]file\f[R]\&...]
+\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]--global-stacks\f[R]]
+[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--mathlib\f[R]]
+[\f[B]--no-prompt\f[R]] [\f[B]--quiet\f[R]] [\f[B]--standard\f[R]]
+[\f[B]--warn\f[R]] [\f[B]--version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
+[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
+\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
[\f[I]file\f[R]\&...]
.SH DESCRIPTION
.PP
@@ -55,7 +54,7 @@ the command line and executes them before reading from \f[B]stdin\f[R].
.PP
The following are the options that bc(1) accepts.
.PP
-\f[B]-g\f[R], \f[B]\[en]global-stacks\f[R]
+\f[B]-g\f[R], \f[B]--global-stacks\f[R]
.IP
.nf
\f[C]
@@ -112,10 +111,10 @@ This is a **non-portable extension**.
\f[R]
.fi
.TP
-\f[B]-h\f[R], \f[B]\[en]help\f[R]
+\f[B]-h\f[R], \f[B]--help\f[R]
Prints a usage message and quits.
.TP
-\f[B]-i\f[R], \f[B]\[en]interactive\f[R]
+\f[B]-i\f[R], \f[B]--interactive\f[R]
Forces interactive mode.
(See the \f[B]INTERACTIVE MODE\f[R] section.)
.RS
@@ -123,7 +122,7 @@ Forces interactive mode.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-l\f[R], \f[B]\[en]mathlib\f[R]
+\f[B]-l\f[R], \f[B]--mathlib\f[R]
Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to \f[B]20\f[R]
and loads the included math library before running any code, including
any expressions or files specified on the command line.
@@ -132,25 +131,25 @@ any expressions or files specified on the command line.
To learn what is in the library, see the \f[B]LIBRARY\f[R] section.
.RE
.TP
-\f[B]-P\f[R], \f[B]\[en]no-prompt\f[R]
+\f[B]-P\f[R], \f[B]--no-prompt\f[R]
This option is a no-op.
.RS
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-q\f[R], \f[B]\[en]quiet\f[R]
+\f[B]-q\f[R], \f[B]--quiet\f[R]
This option is for compatibility with the GNU
bc(1) (https://www.gnu.org/software/bc/); it is a no-op.
Without this option, GNU bc(1) prints a copyright header.
This bc(1) only prints the copyright header if one or more of the
-\f[B]-v\f[R], \f[B]-V\f[R], or \f[B]\[en]version\f[R] options are given.
+\f[B]-v\f[R], \f[B]-V\f[R], or \f[B]--version\f[R] options are given.
.RS
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-s\f[R], \f[B]\[en]standard\f[R]
+\f[B]-s\f[R], \f[B]--standard\f[R]
Process exactly the language defined by the
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
and error if any extensions are used.
@@ -159,15 +158,15 @@ and error if any extensions are used.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-v\f[R], \f[B]-V\f[R], \f[B]\[en]version\f[R]
+\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
Print the version information (copyright header) and exit.
.RS
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-w\f[R], \f[B]\[en]warn\f[R]
-Like \f[B]-s\f[R] and \f[B]\[en]standard\f[R], except that warnings (and
+\f[B]-w\f[R], \f[B]--warn\f[R]
+Like \f[B]-s\f[R] and \f[B]--standard\f[R], except that warnings (and
not errors) are printed for non-standard extensions and execution
continues normally.
.RS
@@ -175,7 +174,7 @@ continues normally.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-e\f[R] \f[I]expr\f[R], \f[B]\[en]expression\f[R]=\f[I]expr\f[R]
+\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
Evaluates \f[I]expr\f[R].
If multiple expressions are given, they are evaluated in order.
If files are given as well (see below), the expressions and files are
@@ -184,26 +183,36 @@ This means that if a file is given before an expression, the file is
read in and evaluated first.
.RS
.PP
-After processing all expressions and files, bc(1) will exit, unless
+If this option is given on the command-line (i.e., not in
+\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
+then after processing all expressions and files, bc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]\[en]file\f[R].
-However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
-\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after that,
-bc(1) will give a fatal error and exit.
+\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
+\f[B]BC_ENV_ARGS\f[R].
+However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
+\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
+\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
+exit.
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-f\f[R] \f[I]file\f[R], \f[B]\[en]file\f[R]=\f[I]file\f[R]
+\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
were read through \f[B]stdin\f[R].
If expressions are also given (see above), the expressions are evaluated
in the order given.
.RS
.PP
-After processing all expressions and files, bc(1) will exit, unless
+If this option is given on the command-line (i.e., not in
+\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
+then after processing all expressions and files, bc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]\[en]file\f[R].
+\f[B]-f\f[R] or \f[B]--file\f[R].
+However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
+\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
+\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
+exit.
.PP
This is a \f[B]non-portable extension\f[R].
.RE
@@ -212,6 +221,9 @@ All long options are \f[B]non-portable extensions\f[R].
.SH STDOUT
.PP
Any non-error output is written to \f[B]stdout\f[R].
+In addition, if history (see the \f[B]HISTORY\f[R] section) and the
+prompt (see the \f[B]TTY MODE\f[R] section) are enabled, both are output
+to \f[B]stdout\f[R].
.PP
\f[B]Note\f[R]: Unlike other bc(1) implementations, this bc(1) will
issue a fatal error (see the \f[B]EXIT STATUS\f[R] section) if it cannot
@@ -263,8 +275,8 @@ constant numbers.
It is the \[lq]input\[rq] base, or the number base used for interpreting
input numbers.
\f[B]ibase\f[R] is initially \f[B]10\f[R].
-If the \f[B]-s\f[R] (\f[B]\[en]standard\f[R]) and \f[B]-w\f[R]
-(\f[B]\[en]warn\f[R]) flags were not given on the command line, the max
+If the \f[B]-s\f[R] (\f[B]--standard\f[R]) and \f[B]-w\f[R]
+(\f[B]--warn\f[R]) flags were not given on the command line, the max
allowable value for \f[B]ibase\f[R] is \f[B]36\f[R].
Otherwise, it is \f[B]16\f[R].
The min allowable value for \f[B]ibase\f[R] is \f[B]2\f[R].
@@ -424,7 +436,7 @@ The following arithmetic and logical operators can be used.
They are listed in order of decreasing precedence.
Operators in the same group have the same precedence.
.TP
-\f[B]++\f[R] \f[B]\[en]\f[R]
+\f[B]++\f[R] \f[B]--\f[R]
Type: Prefix and Postfix
.RS
.PP
@@ -507,7 +519,7 @@ Description: \f[B]boolean or\f[R]
.PP
The operators will be described in more detail below.
.TP
-\f[B]++\f[R] \f[B]\[en]\f[R]
+\f[B]++\f[R] \f[B]--\f[R]
The prefix and postfix \f[B]increment\f[R] and \f[B]decrement\f[R]
operators behave exactly like they would in C.
They require a named expression (see the \f[I]Named Expressions\f[R]
@@ -887,7 +899,7 @@ This is a \f[B]non-portable extension\f[R].
.SH LIBRARY
.PP
All of the functions below are available when the \f[B]-l\f[R] or
-\f[B]\[en]mathlib\f[R] command-line flags are given.
+\f[B]--mathlib\f[R] command-line flags are given.
.SS Standard Library
.PP
The
@@ -1192,11 +1204,11 @@ interactive mode (see the \f[B]INTERACTIVE MODE\f[R] section), since
bc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
more input when one of those errors occurs in interactive mode.
This is also the case when interactive mode is forced by the
-\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
+\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.PP
These exit statuses allow bc(1) to be used in shell scripting with error
checking, and its normal behavior can be forced by using the
-\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
+\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.SH INTERACTIVE MODE
.PP
Per the
@@ -1204,7 +1216,7 @@ standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html),
bc(1) has an interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both \f[B]stdin\f[R]
and \f[B]stdout\f[R] are hooked to a terminal, but the \f[B]-i\f[R] flag
-and \f[B]\[en]interactive\f[R] option can turn it on in other cases.
+and \f[B]--interactive\f[R] option can turn it on in other cases.
.PP
In interactive mode, bc(1) attempts to recover from errors (see the
\f[B]RESET\f[R] section), and in normal execution, flushes
diff --git a/contrib/bc/manuals/bc/EHNP.1.md b/contrib/bc/manuals/bc/EHNP.1.md
index 4138ffb98c5e..a0e1b71f8d38 100644
--- a/contrib/bc/manuals/bc/EHNP.1.md
+++ b/contrib/bc/manuals/bc/EHNP.1.md
@@ -2,7 +2,7 @@
SPDX-License-Identifier: BSD-2-Clause
-Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+Copyright (c) 2018-2021 Gavin D. Howard and contributors.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
@@ -34,8 +34,7 @@ bc - arbitrary-precision decimal arithmetic language and calculator
# SYNOPSIS
-**bc** [**-ghilPqsvVw**] [**--global-stacks**] [**--help**] [**--interactive**] [**--mathlib**] [**--no-prompt**] [**--quiet**] [**--standard**] [**--warn**] [**--version**] [**-e** *expr*] [**--expression**=*expr*...] [**-f** *file*...] [**-file**=*file*...]
-[*file*...]
+**bc** [**-ghilPqsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@@ -51,7 +50,7 @@ command line and executes them before reading from **stdin**.
The following are the options that bc(1) accepts.
-**-g**, **--global-stacks**
+**-g**, **-\-global-stacks**
Turns the globals **ibase**, **obase**, and **scale** into stacks.
@@ -104,17 +103,17 @@ The following are the options that bc(1) accepts.
This is a **non-portable extension**.
-**-h**, **--help**
+**-h**, **-\-help**
: Prints a usage message and quits.
-**-i**, **--interactive**
+**-i**, **-\-interactive**
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
This is a **non-portable extension**.
-**-l**, **--mathlib**
+**-l**, **-\-mathlib**
: Sets **scale** (see the **SYNTAX** section) to **20** and loads the included
math library before running any code, including any expressions or files
@@ -122,63 +121,70 @@ The following are the options that bc(1) accepts.
To learn what is in the library, see the **LIBRARY** section.
-**-P**, **--no-prompt**
+**-P**, **-\-no-prompt**
: This option is a no-op.
This is a **non-portable extension**.
-**-q**, **--quiet**
+**-q**, **-\-quiet**
: This option is for compatibility with the [GNU bc(1)][2]; it is a no-op.
Without this option, GNU bc(1) prints a copyright header. This bc(1) only
prints the copyright header if one or more of the **-v**, **-V**, or
- **--version** options are given.
+ **-\-version** options are given.
This is a **non-portable extension**.
-**-s**, **--standard**
+**-s**, **-\-standard**
: Process exactly the language defined by the [standard][1] and error if any
extensions are used.
This is a **non-portable extension**.
-**-v**, **-V**, **--version**
+**-v**, **-V**, **-\-version**
: Print the version information (copyright header) and exit.
This is a **non-portable extension**.
-**-w**, **--warn**
+**-w**, **-\-warn**
-: Like **-s** and **--standard**, except that warnings (and not errors) are
+: Like **-s** and **-\-standard**, except that warnings (and not errors) are
printed for non-standard extensions and execution continues normally.
This is a **non-portable extension**.
-**-e** *expr*, **--expression**=*expr*
+**-e** *expr*, **-\-expression**=*expr*
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
order. If files are given as well (see below), the expressions and files are
evaluated in the order given. This means that if a file is given before an
expression, the file is read in and evaluated first.
- After processing all expressions and files, bc(1) will exit, unless **-**
- (**stdin**) was given as an argument at least once to **-f** or **--file**.
- However, if any other **-e**, **--expression**, **-f**, or **--file**
- arguments are given after that, bc(1) will give a fatal error and exit.
+ If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
+ see the **ENVIRONMENT VARIABLES** section), then after processing all
+ expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
+ as an argument at least once to **-f** or **-\-file**, whether on the
+ command-line or in **BC_ENV_ARGS**. However, if any other **-e**,
+ **-\-expression**, **-f**, or **-\-file** arguments are given after **-f-**
+ or equivalent is given, bc(1) will give a fatal error and exit.
This is a **non-portable extension**.
-**-f** *file*, **--file**=*file*
+**-f** *file*, **-\-file**=*file*
: Reads in *file* and evaluates it, line by line, as though it were read
through **stdin**. If expressions are also given (see above), the
expressions are evaluated in the order given.
- After processing all expressions and files, bc(1) will exit, unless **-**
- (**stdin**) was given as an argument at least once to **-f** or **--file**.
+ If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
+ see the **ENVIRONMENT VARIABLES** section), then after processing all
+ expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
+ as an argument at least once to **-f** or **-\-file**. However, if any other
+ **-e**, **-\-expression**, **-f**, or **-\-file** arguments are given after
+ **-f-** or equivalent is given, bc(1) will give a fatal error and exit.
This is a **non-portable extension**.
@@ -186,7 +192,9 @@ All long options are **non-portable extensions**.
# STDOUT
-Any non-error output is written to **stdout**.
+Any non-error output is written to **stdout**. In addition, if history (see the
+**HISTORY** section) and the prompt (see the **TTY MODE** section) are enabled,
+both are output to **stdout**.
**Note**: Unlike other bc(1) implementations, this bc(1) will issue a fatal
error (see the **EXIT STATUS** section) if it cannot write to **stdout**, so if
@@ -230,8 +238,8 @@ Identifiers with more than one character (letter) are a
**ibase** is a global variable determining how to interpret constant numbers. It
is the "input" base, or the number base used for interpreting input numbers.
-**ibase** is initially **10**. If the **-s** (**--standard**) and **-w**
-(**--warn**) flags were not given on the command line, the max allowable value
+**ibase** is initially **10**. If the **-s** (**-\-standard**) and **-w**
+(**-\-warn**) flags were not given on the command line, the max allowable value
for **ibase** is **36**. Otherwise, it is **16**. The min allowable value for
**ibase** is **2**. The max allowable value for **ibase** can be queried in
bc(1) programs with the **maxibase()** built-in function.
@@ -350,7 +358,7 @@ The following arithmetic and logical operators can be used. They are listed in
order of decreasing precedence. Operators in the same group have the same
precedence.
-**++** **--**
+**++** **-\-**
: Type: Prefix and Postfix
@@ -424,7 +432,7 @@ precedence.
The operators will be described in more detail below.
-**++** **--**
+**++** **-\-**
: The prefix and postfix **increment** and **decrement** operators behave
exactly like they would in C. They require a named expression (see the
@@ -700,7 +708,7 @@ This is a **non-portable extension**.
# LIBRARY
-All of the functions below are available when the **-l** or **--mathlib**
+All of the functions below are available when the **-l** or **-\-mathlib**
command-line flags are given.
## Standard Library
@@ -976,17 +984,17 @@ The other statuses will only be returned when bc(1) is not in interactive mode
(see the **INTERACTIVE MODE** section), since bc(1) resets its state (see the
**RESET** section) and accepts more input when one of those errors occurs in
interactive mode. This is also the case when interactive mode is forced by the
-**-i** flag or **--interactive** option.
+**-i** flag or **-\-interactive** option.
These exit statuses allow bc(1) to be used in shell scripting with error
checking, and its normal behavior can be forced by using the **-i** flag or
-**--interactive** option.
+**-\-interactive** option.
# INTERACTIVE MODE
Per the [standard][1], bc(1) has an interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both **stdin** and **stdout**
-are hooked to a terminal, but the **-i** flag and **--interactive** option can
+are hooked to a terminal, but the **-i** flag and **-\-interactive** option can
turn it on in other cases.
In interactive mode, bc(1) attempts to recover from errors (see the **RESET**
diff --git a/contrib/bc/manuals/bc/EHP.1 b/contrib/bc/manuals/bc/EHP.1
index 7dcc83b7bddd..dc3476f68b92 100644
--- a/contrib/bc/manuals/bc/EHP.1
+++ b/contrib/bc/manuals/bc/EHP.1
@@ -1,7 +1,7 @@
.\"
.\" SPDX-License-Identifier: BSD-2-Clause
.\"
-.\" Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+.\" Copyright (c) 2018-2021 Gavin D. Howard and contributors.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions are met:
@@ -25,19 +25,18 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.TH "BC" "1" "October 2020" "Gavin D. Howard" "General Commands Manual"
+.TH "BC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
.SH NAME
.PP
bc - arbitrary-precision decimal arithmetic language and calculator
.SH SYNOPSIS
.PP
-\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]\[en]global-stacks\f[R]]
-[\f[B]\[en]help\f[R]] [\f[B]\[en]interactive\f[R]]
-[\f[B]\[en]mathlib\f[R]] [\f[B]\[en]no-prompt\f[R]]
-[\f[B]\[en]quiet\f[R]] [\f[B]\[en]standard\f[R]] [\f[B]\[en]warn\f[R]]
-[\f[B]\[en]version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
-[\f[B]\[en]expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
-\f[I]file\f[R]\&...] [\f[B]-file\f[R]=\f[I]file\f[R]\&...]
+\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]--global-stacks\f[R]]
+[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--mathlib\f[R]]
+[\f[B]--no-prompt\f[R]] [\f[B]--quiet\f[R]] [\f[B]--standard\f[R]]
+[\f[B]--warn\f[R]] [\f[B]--version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
+[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
+\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
[\f[I]file\f[R]\&...]
.SH DESCRIPTION
.PP
@@ -55,7 +54,7 @@ the command line and executes them before reading from \f[B]stdin\f[R].
.PP
The following are the options that bc(1) accepts.
.PP
-\f[B]-g\f[R], \f[B]\[en]global-stacks\f[R]
+\f[B]-g\f[R], \f[B]--global-stacks\f[R]
.IP
.nf
\f[C]
@@ -112,10 +111,10 @@ This is a **non-portable extension**.
\f[R]
.fi
.TP
-\f[B]-h\f[R], \f[B]\[en]help\f[R]
+\f[B]-h\f[R], \f[B]--help\f[R]
Prints a usage message and quits.
.TP
-\f[B]-i\f[R], \f[B]\[en]interactive\f[R]
+\f[B]-i\f[R], \f[B]--interactive\f[R]
Forces interactive mode.
(See the \f[B]INTERACTIVE MODE\f[R] section.)
.RS
@@ -123,7 +122,7 @@ Forces interactive mode.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-l\f[R], \f[B]\[en]mathlib\f[R]
+\f[B]-l\f[R], \f[B]--mathlib\f[R]
Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to \f[B]20\f[R]
and loads the included math library before running any code, including
any expressions or files specified on the command line.
@@ -132,25 +131,25 @@ any expressions or files specified on the command line.
To learn what is in the library, see the \f[B]LIBRARY\f[R] section.
.RE
.TP
-\f[B]-P\f[R], \f[B]\[en]no-prompt\f[R]
+\f[B]-P\f[R], \f[B]--no-prompt\f[R]
This option is a no-op.
.RS
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-q\f[R], \f[B]\[en]quiet\f[R]
+\f[B]-q\f[R], \f[B]--quiet\f[R]
This option is for compatibility with the GNU
bc(1) (https://www.gnu.org/software/bc/); it is a no-op.
Without this option, GNU bc(1) prints a copyright header.
This bc(1) only prints the copyright header if one or more of the
-\f[B]-v\f[R], \f[B]-V\f[R], or \f[B]\[en]version\f[R] options are given.
+\f[B]-v\f[R], \f[B]-V\f[R], or \f[B]--version\f[R] options are given.
.RS
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-s\f[R], \f[B]\[en]standard\f[R]
+\f[B]-s\f[R], \f[B]--standard\f[R]
Process exactly the language defined by the
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
and error if any extensions are used.
@@ -159,15 +158,15 @@ and error if any extensions are used.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-v\f[R], \f[B]-V\f[R], \f[B]\[en]version\f[R]
+\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
Print the version information (copyright header) and exit.
.RS
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-w\f[R], \f[B]\[en]warn\f[R]
-Like \f[B]-s\f[R] and \f[B]\[en]standard\f[R], except that warnings (and
+\f[B]-w\f[R], \f[B]--warn\f[R]
+Like \f[B]-s\f[R] and \f[B]--standard\f[R], except that warnings (and
not errors) are printed for non-standard extensions and execution
continues normally.
.RS
@@ -175,7 +174,7 @@ continues normally.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-e\f[R] \f[I]expr\f[R], \f[B]\[en]expression\f[R]=\f[I]expr\f[R]
+\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
Evaluates \f[I]expr\f[R].
If multiple expressions are given, they are evaluated in order.
If files are given as well (see below), the expressions and files are
@@ -184,26 +183,36 @@ This means that if a file is given before an expression, the file is
read in and evaluated first.
.RS
.PP
-After processing all expressions and files, bc(1) will exit, unless
+If this option is given on the command-line (i.e., not in
+\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
+then after processing all expressions and files, bc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]\[en]file\f[R].
-However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
-\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after that,
-bc(1) will give a fatal error and exit.
+\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
+\f[B]BC_ENV_ARGS\f[R].
+However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
+\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
+\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
+exit.
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-f\f[R] \f[I]file\f[R], \f[B]\[en]file\f[R]=\f[I]file\f[R]
+\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
were read through \f[B]stdin\f[R].
If expressions are also given (see above), the expressions are evaluated
in the order given.
.RS
.PP
-After processing all expressions and files, bc(1) will exit, unless
+If this option is given on the command-line (i.e., not in
+\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
+then after processing all expressions and files, bc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]\[en]file\f[R].
+\f[B]-f\f[R] or \f[B]--file\f[R].
+However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
+\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
+\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
+exit.
.PP
This is a \f[B]non-portable extension\f[R].
.RE
@@ -212,6 +221,9 @@ All long options are \f[B]non-portable extensions\f[R].
.SH STDOUT
.PP
Any non-error output is written to \f[B]stdout\f[R].
+In addition, if history (see the \f[B]HISTORY\f[R] section) and the
+prompt (see the \f[B]TTY MODE\f[R] section) are enabled, both are output
+to \f[B]stdout\f[R].
.PP
\f[B]Note\f[R]: Unlike other bc(1) implementations, this bc(1) will
issue a fatal error (see the \f[B]EXIT STATUS\f[R] section) if it cannot
@@ -263,8 +275,8 @@ constant numbers.
It is the \[lq]input\[rq] base, or the number base used for interpreting
input numbers.
\f[B]ibase\f[R] is initially \f[B]10\f[R].
-If the \f[B]-s\f[R] (\f[B]\[en]standard\f[R]) and \f[B]-w\f[R]
-(\f[B]\[en]warn\f[R]) flags were not given on the command line, the max
+If the \f[B]-s\f[R] (\f[B]--standard\f[R]) and \f[B]-w\f[R]
+(\f[B]--warn\f[R]) flags were not given on the command line, the max
allowable value for \f[B]ibase\f[R] is \f[B]36\f[R].
Otherwise, it is \f[B]16\f[R].
The min allowable value for \f[B]ibase\f[R] is \f[B]2\f[R].
@@ -424,7 +436,7 @@ The following arithmetic and logical operators can be used.
They are listed in order of decreasing precedence.
Operators in the same group have the same precedence.
.TP
-\f[B]++\f[R] \f[B]\[en]\f[R]
+\f[B]++\f[R] \f[B]--\f[R]
Type: Prefix and Postfix
.RS
.PP
@@ -507,7 +519,7 @@ Description: \f[B]boolean or\f[R]
.PP
The operators will be described in more detail below.
.TP
-\f[B]++\f[R] \f[B]\[en]\f[R]
+\f[B]++\f[R] \f[B]--\f[R]
The prefix and postfix \f[B]increment\f[R] and \f[B]decrement\f[R]
operators behave exactly like they would in C.
They require a named expression (see the \f[I]Named Expressions\f[R]
@@ -887,7 +899,7 @@ This is a \f[B]non-portable extension\f[R].
.SH LIBRARY
.PP
All of the functions below are available when the \f[B]-l\f[R] or
-\f[B]\[en]mathlib\f[R] command-line flags are given.
+\f[B]--mathlib\f[R] command-line flags are given.
.SS Standard Library
.PP
The
@@ -1192,11 +1204,11 @@ interactive mode (see the \f[B]INTERACTIVE MODE\f[R] section), since
bc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
more input when one of those errors occurs in interactive mode.
This is also the case when interactive mode is forced by the
-\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
+\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.PP
These exit statuses allow bc(1) to be used in shell scripting with error
checking, and its normal behavior can be forced by using the
-\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
+\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.SH INTERACTIVE MODE
.PP
Per the
@@ -1204,7 +1216,7 @@ standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html),
bc(1) has an interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both \f[B]stdin\f[R]
and \f[B]stdout\f[R] are hooked to a terminal, but the \f[B]-i\f[R] flag
-and \f[B]\[en]interactive\f[R] option can turn it on in other cases.
+and \f[B]--interactive\f[R] option can turn it on in other cases.
.PP
In interactive mode, bc(1) attempts to recover from errors (see the
\f[B]RESET\f[R] section), and in normal execution, flushes
diff --git a/contrib/bc/manuals/bc/EHP.1.md b/contrib/bc/manuals/bc/EHP.1.md
index c012f68fed43..976ae8eb11b7 100644
--- a/contrib/bc/manuals/bc/EHP.1.md
+++ b/contrib/bc/manuals/bc/EHP.1.md
@@ -2,7 +2,7 @@
SPDX-License-Identifier: BSD-2-Clause
-Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+Copyright (c) 2018-2021 Gavin D. Howard and contributors.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
@@ -34,8 +34,7 @@ bc - arbitrary-precision decimal arithmetic language and calculator
# SYNOPSIS
-**bc** [**-ghilPqsvVw**] [**--global-stacks**] [**--help**] [**--interactive**] [**--mathlib**] [**--no-prompt**] [**--quiet**] [**--standard**] [**--warn**] [**--version**] [**-e** *expr*] [**--expression**=*expr*...] [**-f** *file*...] [**-file**=*file*...]
-[*file*...]
+**bc** [**-ghilPqsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@@ -51,7 +50,7 @@ command line and executes them before reading from **stdin**.
The following are the options that bc(1) accepts.
-**-g**, **--global-stacks**
+**-g**, **-\-global-stacks**
Turns the globals **ibase**, **obase**, and **scale** into stacks.
@@ -104,17 +103,17 @@ The following are the options that bc(1) accepts.
This is a **non-portable extension**.
-**-h**, **--help**
+**-h**, **-\-help**
: Prints a usage message and quits.
-**-i**, **--interactive**
+**-i**, **-\-interactive**
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
This is a **non-portable extension**.
-**-l**, **--mathlib**
+**-l**, **-\-mathlib**
: Sets **scale** (see the **SYNTAX** section) to **20** and loads the included
math library before running any code, including any expressions or files
@@ -122,63 +121,70 @@ The following are the options that bc(1) accepts.
To learn what is in the library, see the **LIBRARY** section.
-**-P**, **--no-prompt**
+**-P**, **-\-no-prompt**
: This option is a no-op.
This is a **non-portable extension**.
-**-q**, **--quiet**
+**-q**, **-\-quiet**
: This option is for compatibility with the [GNU bc(1)][2]; it is a no-op.
Without this option, GNU bc(1) prints a copyright header. This bc(1) only
prints the copyright header if one or more of the **-v**, **-V**, or
- **--version** options are given.
+ **-\-version** options are given.
This is a **non-portable extension**.
-**-s**, **--standard**
+**-s**, **-\-standard**
: Process exactly the language defined by the [standard][1] and error if any
extensions are used.
This is a **non-portable extension**.
-**-v**, **-V**, **--version**
+**-v**, **-V**, **-\-version**
: Print the version information (copyright header) and exit.
This is a **non-portable extension**.
-**-w**, **--warn**
+**-w**, **-\-warn**
-: Like **-s** and **--standard**, except that warnings (and not errors) are
+: Like **-s** and **-\-standard**, except that warnings (and not errors) are
printed for non-standard extensions and execution continues normally.
This is a **non-portable extension**.
-**-e** *expr*, **--expression**=*expr*
+**-e** *expr*, **-\-expression**=*expr*
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
order. If files are given as well (see below), the expressions and files are
evaluated in the order given. This means that if a file is given before an
expression, the file is read in and evaluated first.
- After processing all expressions and files, bc(1) will exit, unless **-**
- (**stdin**) was given as an argument at least once to **-f** or **--file**.
- However, if any other **-e**, **--expression**, **-f**, or **--file**
- arguments are given after that, bc(1) will give a fatal error and exit.
+ If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
+ see the **ENVIRONMENT VARIABLES** section), then after processing all
+ expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
+ as an argument at least once to **-f** or **-\-file**, whether on the
+ command-line or in **BC_ENV_ARGS**. However, if any other **-e**,
+ **-\-expression**, **-f**, or **-\-file** arguments are given after **-f-**
+ or equivalent is given, bc(1) will give a fatal error and exit.
This is a **non-portable extension**.
-**-f** *file*, **--file**=*file*
+**-f** *file*, **-\-file**=*file*
: Reads in *file* and evaluates it, line by line, as though it were read
through **stdin**. If expressions are also given (see above), the
expressions are evaluated in the order given.
- After processing all expressions and files, bc(1) will exit, unless **-**
- (**stdin**) was given as an argument at least once to **-f** or **--file**.
+ If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
+ see the **ENVIRONMENT VARIABLES** section), then after processing all
+ expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
+ as an argument at least once to **-f** or **-\-file**. However, if any other
+ **-e**, **-\-expression**, **-f**, or **-\-file** arguments are given after
+ **-f-** or equivalent is given, bc(1) will give a fatal error and exit.
This is a **non-portable extension**.
@@ -186,7 +192,9 @@ All long options are **non-portable extensions**.
# STDOUT
-Any non-error output is written to **stdout**.
+Any non-error output is written to **stdout**. In addition, if history (see the
+**HISTORY** section) and the prompt (see the **TTY MODE** section) are enabled,
+both are output to **stdout**.
**Note**: Unlike other bc(1) implementations, this bc(1) will issue a fatal
error (see the **EXIT STATUS** section) if it cannot write to **stdout**, so if
@@ -230,8 +238,8 @@ Identifiers with more than one character (letter) are a
**ibase** is a global variable determining how to interpret constant numbers. It
is the "input" base, or the number base used for interpreting input numbers.
-**ibase** is initially **10**. If the **-s** (**--standard**) and **-w**
-(**--warn**) flags were not given on the command line, the max allowable value
+**ibase** is initially **10**. If the **-s** (**-\-standard**) and **-w**
+(**-\-warn**) flags were not given on the command line, the max allowable value
for **ibase** is **36**. Otherwise, it is **16**. The min allowable value for
**ibase** is **2**. The max allowable value for **ibase** can be queried in
bc(1) programs with the **maxibase()** built-in function.
@@ -350,7 +358,7 @@ The following arithmetic and logical operators can be used. They are listed in
order of decreasing precedence. Operators in the same group have the same
precedence.
-**++** **--**
+**++** **-\-**
: Type: Prefix and Postfix
@@ -424,7 +432,7 @@ precedence.
The operators will be described in more detail below.
-**++** **--**
+**++** **-\-**
: The prefix and postfix **increment** and **decrement** operators behave
exactly like they would in C. They require a named expression (see the
@@ -700,7 +708,7 @@ This is a **non-portable extension**.
# LIBRARY
-All of the functions below are available when the **-l** or **--mathlib**
+All of the functions below are available when the **-l** or **-\-mathlib**
command-line flags are given.
## Standard Library
@@ -976,17 +984,17 @@ The other statuses will only be returned when bc(1) is not in interactive mode
(see the **INTERACTIVE MODE** section), since bc(1) resets its state (see the
**RESET** section) and accepts more input when one of those errors occurs in
interactive mode. This is also the case when interactive mode is forced by the
-**-i** flag or **--interactive** option.
+**-i** flag or **-\-interactive** option.
These exit statuses allow bc(1) to be used in shell scripting with error
checking, and its normal behavior can be forced by using the **-i** flag or
-**--interactive** option.
+**-\-interactive** option.
# INTERACTIVE MODE
Per the [standard][1], bc(1) has an interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both **stdin** and **stdout**
-are hooked to a terminal, but the **-i** flag and **--interactive** option can
+are hooked to a terminal, but the **-i** flag and **-\-interactive** option can
turn it on in other cases.
In interactive mode, bc(1) attempts to recover from errors (see the **RESET**
diff --git a/contrib/bc/manuals/bc/EN.1 b/contrib/bc/manuals/bc/EN.1
index d11c6f7742a1..e6e7b3c5f145 100644
--- a/contrib/bc/manuals/bc/EN.1
+++ b/contrib/bc/manuals/bc/EN.1
@@ -1,7 +1,7 @@
.\"
.\" SPDX-License-Identifier: BSD-2-Clause
.\"
-.\" Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+.\" Copyright (c) 2018-2021 Gavin D. Howard and contributors.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions are met:
@@ -25,19 +25,18 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.TH "BC" "1" "October 2020" "Gavin D. Howard" "General Commands Manual"
+.TH "BC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
.SH NAME
.PP
bc - arbitrary-precision decimal arithmetic language and calculator
.SH SYNOPSIS
.PP
-\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]\[en]global-stacks\f[R]]
-[\f[B]\[en]help\f[R]] [\f[B]\[en]interactive\f[R]]
-[\f[B]\[en]mathlib\f[R]] [\f[B]\[en]no-prompt\f[R]]
-[\f[B]\[en]quiet\f[R]] [\f[B]\[en]standard\f[R]] [\f[B]\[en]warn\f[R]]
-[\f[B]\[en]version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
-[\f[B]\[en]expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
-\f[I]file\f[R]\&...] [\f[B]-file\f[R]=\f[I]file\f[R]\&...]
+\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]--global-stacks\f[R]]
+[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--mathlib\f[R]]
+[\f[B]--no-prompt\f[R]] [\f[B]--quiet\f[R]] [\f[B]--standard\f[R]]
+[\f[B]--warn\f[R]] [\f[B]--version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
+[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
+\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
[\f[I]file\f[R]\&...]
.SH DESCRIPTION
.PP
@@ -58,7 +57,7 @@ This bc(1) is a drop-in replacement for \f[I]any\f[R] bc(1), including
.PP
The following are the options that bc(1) accepts.
.PP
-\f[B]-g\f[R], \f[B]\[en]global-stacks\f[R]
+\f[B]-g\f[R], \f[B]--global-stacks\f[R]
.IP
.nf
\f[C]
@@ -115,10 +114,10 @@ This is a **non-portable extension**.
\f[R]
.fi
.TP
-\f[B]-h\f[R], \f[B]\[en]help\f[R]
+\f[B]-h\f[R], \f[B]--help\f[R]
Prints a usage message and quits.
.TP
-\f[B]-i\f[R], \f[B]\[en]interactive\f[R]
+\f[B]-i\f[R], \f[B]--interactive\f[R]
Forces interactive mode.
(See the \f[B]INTERACTIVE MODE\f[R] section.)
.RS
@@ -126,7 +125,7 @@ Forces interactive mode.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-l\f[R], \f[B]\[en]mathlib\f[R]
+\f[B]-l\f[R], \f[B]--mathlib\f[R]
Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to \f[B]20\f[R]
and loads the included math library before running any code, including
any expressions or files specified on the command line.
@@ -135,7 +134,7 @@ any expressions or files specified on the command line.
To learn what is in the library, see the \f[B]LIBRARY\f[R] section.
.RE
.TP
-\f[B]-P\f[R], \f[B]\[en]no-prompt\f[R]
+\f[B]-P\f[R], \f[B]--no-prompt\f[R]
Disables the prompt in TTY mode.
(The prompt is only enabled in TTY mode.
See the \f[B]TTY MODE\f[R] section) This is mostly for those users that
@@ -147,18 +146,18 @@ Most of those users would want to put this option in
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-q\f[R], \f[B]\[en]quiet\f[R]
+\f[B]-q\f[R], \f[B]--quiet\f[R]
This option is for compatibility with the GNU
bc(1) (https://www.gnu.org/software/bc/); it is a no-op.
Without this option, GNU bc(1) prints a copyright header.
This bc(1) only prints the copyright header if one or more of the
-\f[B]-v\f[R], \f[B]-V\f[R], or \f[B]\[en]version\f[R] options are given.
+\f[B]-v\f[R], \f[B]-V\f[R], or \f[B]--version\f[R] options are given.
.RS
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-s\f[R], \f[B]\[en]standard\f[R]
+\f[B]-s\f[R], \f[B]--standard\f[R]
Process exactly the language defined by the
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
and error if any extensions are used.
@@ -167,15 +166,15 @@ and error if any extensions are used.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-v\f[R], \f[B]-V\f[R], \f[B]\[en]version\f[R]
+\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
Print the version information (copyright header) and exit.
.RS
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-w\f[R], \f[B]\[en]warn\f[R]
-Like \f[B]-s\f[R] and \f[B]\[en]standard\f[R], except that warnings (and
+\f[B]-w\f[R], \f[B]--warn\f[R]
+Like \f[B]-s\f[R] and \f[B]--standard\f[R], except that warnings (and
not errors) are printed for non-standard extensions and execution
continues normally.
.RS
@@ -183,7 +182,7 @@ continues normally.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-e\f[R] \f[I]expr\f[R], \f[B]\[en]expression\f[R]=\f[I]expr\f[R]
+\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
Evaluates \f[I]expr\f[R].
If multiple expressions are given, they are evaluated in order.
If files are given as well (see below), the expressions and files are
@@ -192,26 +191,36 @@ This means that if a file is given before an expression, the file is
read in and evaluated first.
.RS
.PP
-After processing all expressions and files, bc(1) will exit, unless
+If this option is given on the command-line (i.e., not in
+\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
+then after processing all expressions and files, bc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]\[en]file\f[R].
-However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
-\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after that,
-bc(1) will give a fatal error and exit.
+\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
+\f[B]BC_ENV_ARGS\f[R].
+However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
+\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
+\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
+exit.
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-f\f[R] \f[I]file\f[R], \f[B]\[en]file\f[R]=\f[I]file\f[R]
+\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
were read through \f[B]stdin\f[R].
If expressions are also given (see above), the expressions are evaluated
in the order given.
.RS
.PP
-After processing all expressions and files, bc(1) will exit, unless
+If this option is given on the command-line (i.e., not in
+\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
+then after processing all expressions and files, bc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]\[en]file\f[R].
+\f[B]-f\f[R] or \f[B]--file\f[R].
+However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
+\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
+\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
+exit.
.PP
This is a \f[B]non-portable extension\f[R].
.RE
@@ -220,6 +229,9 @@ All long options are \f[B]non-portable extensions\f[R].
.SH STDOUT
.PP
Any non-error output is written to \f[B]stdout\f[R].
+In addition, if history (see the \f[B]HISTORY\f[R] section) and the
+prompt (see the \f[B]TTY MODE\f[R] section) are enabled, both are output
+to \f[B]stdout\f[R].
.PP
\f[B]Note\f[R]: Unlike other bc(1) implementations, this bc(1) will
issue a fatal error (see the \f[B]EXIT STATUS\f[R] section) if it cannot
@@ -271,8 +283,8 @@ constant numbers.
It is the \[lq]input\[rq] base, or the number base used for interpreting
input numbers.
\f[B]ibase\f[R] is initially \f[B]10\f[R].
-If the \f[B]-s\f[R] (\f[B]\[en]standard\f[R]) and \f[B]-w\f[R]
-(\f[B]\[en]warn\f[R]) flags were not given on the command line, the max
+If the \f[B]-s\f[R] (\f[B]--standard\f[R]) and \f[B]-w\f[R]
+(\f[B]--warn\f[R]) flags were not given on the command line, the max
allowable value for \f[B]ibase\f[R] is \f[B]36\f[R].
Otherwise, it is \f[B]16\f[R].
The min allowable value for \f[B]ibase\f[R] is \f[B]2\f[R].
@@ -432,7 +444,7 @@ The following arithmetic and logical operators can be used.
They are listed in order of decreasing precedence.
Operators in the same group have the same precedence.
.TP
-\f[B]++\f[R] \f[B]\[en]\f[R]
+\f[B]++\f[R] \f[B]--\f[R]
Type: Prefix and Postfix
.RS
.PP
@@ -515,7 +527,7 @@ Description: \f[B]boolean or\f[R]
.PP
The operators will be described in more detail below.
.TP
-\f[B]++\f[R] \f[B]\[en]\f[R]
+\f[B]++\f[R] \f[B]--\f[R]
The prefix and postfix \f[B]increment\f[R] and \f[B]decrement\f[R]
operators behave exactly like they would in C.
They require a named expression (see the \f[I]Named Expressions\f[R]
@@ -895,7 +907,7 @@ This is a \f[B]non-portable extension\f[R].
.SH LIBRARY
.PP
All of the functions below are available when the \f[B]-l\f[R] or
-\f[B]\[en]mathlib\f[R] command-line flags are given.
+\f[B]--mathlib\f[R] command-line flags are given.
.SS Standard Library
.PP
The
@@ -1200,11 +1212,11 @@ interactive mode (see the \f[B]INTERACTIVE MODE\f[R] section), since
bc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
more input when one of those errors occurs in interactive mode.
This is also the case when interactive mode is forced by the
-\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
+\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.PP
These exit statuses allow bc(1) to be used in shell scripting with error
checking, and its normal behavior can be forced by using the
-\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
+\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.SH INTERACTIVE MODE
.PP
Per the
@@ -1212,7 +1224,7 @@ standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html),
bc(1) has an interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both \f[B]stdin\f[R]
and \f[B]stdout\f[R] are hooked to a terminal, but the \f[B]-i\f[R] flag
-and \f[B]\[en]interactive\f[R] option can turn it on in other cases.
+and \f[B]--interactive\f[R] option can turn it on in other cases.
.PP
In interactive mode, bc(1) attempts to recover from errors (see the
\f[B]RESET\f[R] section), and in normal execution, flushes
diff --git a/contrib/bc/manuals/bc/EN.1.md b/contrib/bc/manuals/bc/EN.1.md
index e7ba17a98401..6dc19727c982 100644
--- a/contrib/bc/manuals/bc/EN.1.md
+++ b/contrib/bc/manuals/bc/EN.1.md
@@ -2,7 +2,7 @@
SPDX-License-Identifier: BSD-2-Clause
-Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+Copyright (c) 2018-2021 Gavin D. Howard and contributors.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
@@ -34,8 +34,7 @@ bc - arbitrary-precision decimal arithmetic language and calculator
# SYNOPSIS
-**bc** [**-ghilPqsvVw**] [**--global-stacks**] [**--help**] [**--interactive**] [**--mathlib**] [**--no-prompt**] [**--quiet**] [**--standard**] [**--warn**] [**--version**] [**-e** *expr*] [**--expression**=*expr*...] [**-f** *file*...] [**-file**=*file*...]
-[*file*...]
+**bc** [**-ghilPqsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@@ -54,7 +53,7 @@ especially) the GNU bc(1).
The following are the options that bc(1) accepts.
-**-g**, **--global-stacks**
+**-g**, **-\-global-stacks**
Turns the globals **ibase**, **obase**, and **scale** into stacks.
@@ -107,17 +106,17 @@ The following are the options that bc(1) accepts.
This is a **non-portable extension**.
-**-h**, **--help**
+**-h**, **-\-help**
: Prints a usage message and quits.
-**-i**, **--interactive**
+**-i**, **-\-interactive**
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
This is a **non-portable extension**.
-**-l**, **--mathlib**
+**-l**, **-\-mathlib**
: Sets **scale** (see the **SYNTAX** section) to **20** and loads the included
math library before running any code, including any expressions or files
@@ -125,7 +124,7 @@ The following are the options that bc(1) accepts.
To learn what is in the library, see the **LIBRARY** section.
-**-P**, **--no-prompt**
+**-P**, **-\-no-prompt**
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
See the **TTY MODE** section) This is mostly for those users that do not
@@ -135,57 +134,64 @@ The following are the options that bc(1) accepts.
This is a **non-portable extension**.
-**-q**, **--quiet**
+**-q**, **-\-quiet**
: This option is for compatibility with the [GNU bc(1)][2]; it is a no-op.
Without this option, GNU bc(1) prints a copyright header. This bc(1) only
prints the copyright header if one or more of the **-v**, **-V**, or
- **--version** options are given.
+ **-\-version** options are given.
This is a **non-portable extension**.
-**-s**, **--standard**
+**-s**, **-\-standard**
: Process exactly the language defined by the [standard][1] and error if any
extensions are used.
This is a **non-portable extension**.
-**-v**, **-V**, **--version**
+**-v**, **-V**, **-\-version**
: Print the version information (copyright header) and exit.
This is a **non-portable extension**.
-**-w**, **--warn**
+**-w**, **-\-warn**
-: Like **-s** and **--standard**, except that warnings (and not errors) are
+: Like **-s** and **-\-standard**, except that warnings (and not errors) are
printed for non-standard extensions and execution continues normally.
This is a **non-portable extension**.
-**-e** *expr*, **--expression**=*expr*
+**-e** *expr*, **-\-expression**=*expr*
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
order. If files are given as well (see below), the expressions and files are
evaluated in the order given. This means that if a file is given before an
expression, the file is read in and evaluated first.
- After processing all expressions and files, bc(1) will exit, unless **-**
- (**stdin**) was given as an argument at least once to **-f** or **--file**.
- However, if any other **-e**, **--expression**, **-f**, or **--file**
- arguments are given after that, bc(1) will give a fatal error and exit.
+ If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
+ see the **ENVIRONMENT VARIABLES** section), then after processing all
+ expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
+ as an argument at least once to **-f** or **-\-file**, whether on the
+ command-line or in **BC_ENV_ARGS**. However, if any other **-e**,
+ **-\-expression**, **-f**, or **-\-file** arguments are given after **-f-**
+ or equivalent is given, bc(1) will give a fatal error and exit.
This is a **non-portable extension**.
-**-f** *file*, **--file**=*file*
+**-f** *file*, **-\-file**=*file*
: Reads in *file* and evaluates it, line by line, as though it were read
through **stdin**. If expressions are also given (see above), the
expressions are evaluated in the order given.
- After processing all expressions and files, bc(1) will exit, unless **-**
- (**stdin**) was given as an argument at least once to **-f** or **--file**.
+ If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
+ see the **ENVIRONMENT VARIABLES** section), then after processing all
+ expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
+ as an argument at least once to **-f** or **-\-file**. However, if any other
+ **-e**, **-\-expression**, **-f**, or **-\-file** arguments are given after
+ **-f-** or equivalent is given, bc(1) will give a fatal error and exit.
This is a **non-portable extension**.
@@ -193,7 +199,9 @@ All long options are **non-portable extensions**.
# STDOUT
-Any non-error output is written to **stdout**.
+Any non-error output is written to **stdout**. In addition, if history (see the
+**HISTORY** section) and the prompt (see the **TTY MODE** section) are enabled,
+both are output to **stdout**.
**Note**: Unlike other bc(1) implementations, this bc(1) will issue a fatal
error (see the **EXIT STATUS** section) if it cannot write to **stdout**, so if
@@ -237,8 +245,8 @@ Identifiers with more than one character (letter) are a
**ibase** is a global variable determining how to interpret constant numbers. It
is the "input" base, or the number base used for interpreting input numbers.
-**ibase** is initially **10**. If the **-s** (**--standard**) and **-w**
-(**--warn**) flags were not given on the command line, the max allowable value
+**ibase** is initially **10**. If the **-s** (**-\-standard**) and **-w**
+(**-\-warn**) flags were not given on the command line, the max allowable value
for **ibase** is **36**. Otherwise, it is **16**. The min allowable value for
**ibase** is **2**. The max allowable value for **ibase** can be queried in
bc(1) programs with the **maxibase()** built-in function.
@@ -357,7 +365,7 @@ The following arithmetic and logical operators can be used. They are listed in
order of decreasing precedence. Operators in the same group have the same
precedence.
-**++** **--**
+**++** **-\-**
: Type: Prefix and Postfix
@@ -431,7 +439,7 @@ precedence.
The operators will be described in more detail below.
-**++** **--**
+**++** **-\-**
: The prefix and postfix **increment** and **decrement** operators behave
exactly like they would in C. They require a named expression (see the
@@ -707,7 +715,7 @@ This is a **non-portable extension**.
# LIBRARY
-All of the functions below are available when the **-l** or **--mathlib**
+All of the functions below are available when the **-l** or **-\-mathlib**
command-line flags are given.
## Standard Library
@@ -983,17 +991,17 @@ The other statuses will only be returned when bc(1) is not in interactive mode
(see the **INTERACTIVE MODE** section), since bc(1) resets its state (see the
**RESET** section) and accepts more input when one of those errors occurs in
interactive mode. This is also the case when interactive mode is forced by the
-**-i** flag or **--interactive** option.
+**-i** flag or **-\-interactive** option.
These exit statuses allow bc(1) to be used in shell scripting with error
checking, and its normal behavior can be forced by using the **-i** flag or
-**--interactive** option.
+**-\-interactive** option.
# INTERACTIVE MODE
Per the [standard][1], bc(1) has an interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both **stdin** and **stdout**
-are hooked to a terminal, but the **-i** flag and **--interactive** option can
+are hooked to a terminal, but the **-i** flag and **-\-interactive** option can
turn it on in other cases.
In interactive mode, bc(1) attempts to recover from errors (see the **RESET**
diff --git a/contrib/bc/manuals/bc/ENP.1 b/contrib/bc/manuals/bc/ENP.1
index 0240b22b495a..f96fe194cda1 100644
--- a/contrib/bc/manuals/bc/ENP.1
+++ b/contrib/bc/manuals/bc/ENP.1
@@ -1,7 +1,7 @@
.\"
.\" SPDX-License-Identifier: BSD-2-Clause
.\"
-.\" Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+.\" Copyright (c) 2018-2021 Gavin D. Howard and contributors.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions are met:
@@ -25,19 +25,18 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.TH "BC" "1" "October 2020" "Gavin D. Howard" "General Commands Manual"
+.TH "BC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
.SH NAME
.PP
bc - arbitrary-precision decimal arithmetic language and calculator
.SH SYNOPSIS
.PP
-\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]\[en]global-stacks\f[R]]
-[\f[B]\[en]help\f[R]] [\f[B]\[en]interactive\f[R]]
-[\f[B]\[en]mathlib\f[R]] [\f[B]\[en]no-prompt\f[R]]
-[\f[B]\[en]quiet\f[R]] [\f[B]\[en]standard\f[R]] [\f[B]\[en]warn\f[R]]
-[\f[B]\[en]version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
-[\f[B]\[en]expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
-\f[I]file\f[R]\&...] [\f[B]-file\f[R]=\f[I]file\f[R]\&...]
+\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]--global-stacks\f[R]]
+[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--mathlib\f[R]]
+[\f[B]--no-prompt\f[R]] [\f[B]--quiet\f[R]] [\f[B]--standard\f[R]]
+[\f[B]--warn\f[R]] [\f[B]--version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
+[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
+\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
[\f[I]file\f[R]\&...]
.SH DESCRIPTION
.PP
@@ -58,7 +57,7 @@ This bc(1) is a drop-in replacement for \f[I]any\f[R] bc(1), including
.PP
The following are the options that bc(1) accepts.
.PP
-\f[B]-g\f[R], \f[B]\[en]global-stacks\f[R]
+\f[B]-g\f[R], \f[B]--global-stacks\f[R]
.IP
.nf
\f[C]
@@ -115,10 +114,10 @@ This is a **non-portable extension**.
\f[R]
.fi
.TP
-\f[B]-h\f[R], \f[B]\[en]help\f[R]
+\f[B]-h\f[R], \f[B]--help\f[R]
Prints a usage message and quits.
.TP
-\f[B]-i\f[R], \f[B]\[en]interactive\f[R]
+\f[B]-i\f[R], \f[B]--interactive\f[R]
Forces interactive mode.
(See the \f[B]INTERACTIVE MODE\f[R] section.)
.RS
@@ -126,7 +125,7 @@ Forces interactive mode.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-l\f[R], \f[B]\[en]mathlib\f[R]
+\f[B]-l\f[R], \f[B]--mathlib\f[R]
Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to \f[B]20\f[R]
and loads the included math library before running any code, including
any expressions or files specified on the command line.
@@ -135,25 +134,25 @@ any expressions or files specified on the command line.
To learn what is in the library, see the \f[B]LIBRARY\f[R] section.
.RE
.TP
-\f[B]-P\f[R], \f[B]\[en]no-prompt\f[R]
+\f[B]-P\f[R], \f[B]--no-prompt\f[R]
This option is a no-op.
.RS
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-q\f[R], \f[B]\[en]quiet\f[R]
+\f[B]-q\f[R], \f[B]--quiet\f[R]
This option is for compatibility with the GNU
bc(1) (https://www.gnu.org/software/bc/); it is a no-op.
Without this option, GNU bc(1) prints a copyright header.
This bc(1) only prints the copyright header if one or more of the
-\f[B]-v\f[R], \f[B]-V\f[R], or \f[B]\[en]version\f[R] options are given.
+\f[B]-v\f[R], \f[B]-V\f[R], or \f[B]--version\f[R] options are given.
.RS
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-s\f[R], \f[B]\[en]standard\f[R]
+\f[B]-s\f[R], \f[B]--standard\f[R]
Process exactly the language defined by the
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
and error if any extensions are used.
@@ -162,15 +161,15 @@ and error if any extensions are used.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-v\f[R], \f[B]-V\f[R], \f[B]\[en]version\f[R]
+\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
Print the version information (copyright header) and exit.
.RS
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-w\f[R], \f[B]\[en]warn\f[R]
-Like \f[B]-s\f[R] and \f[B]\[en]standard\f[R], except that warnings (and
+\f[B]-w\f[R], \f[B]--warn\f[R]
+Like \f[B]-s\f[R] and \f[B]--standard\f[R], except that warnings (and
not errors) are printed for non-standard extensions and execution
continues normally.
.RS
@@ -178,7 +177,7 @@ continues normally.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-e\f[R] \f[I]expr\f[R], \f[B]\[en]expression\f[R]=\f[I]expr\f[R]
+\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
Evaluates \f[I]expr\f[R].
If multiple expressions are given, they are evaluated in order.
If files are given as well (see below), the expressions and files are
@@ -187,26 +186,36 @@ This means that if a file is given before an expression, the file is
read in and evaluated first.
.RS
.PP
-After processing all expressions and files, bc(1) will exit, unless
+If this option is given on the command-line (i.e., not in
+\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
+then after processing all expressions and files, bc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]\[en]file\f[R].
-However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
-\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after that,
-bc(1) will give a fatal error and exit.
+\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
+\f[B]BC_ENV_ARGS\f[R].
+However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
+\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
+\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
+exit.
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-f\f[R] \f[I]file\f[R], \f[B]\[en]file\f[R]=\f[I]file\f[R]
+\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
were read through \f[B]stdin\f[R].
If expressions are also given (see above), the expressions are evaluated
in the order given.
.RS
.PP
-After processing all expressions and files, bc(1) will exit, unless
+If this option is given on the command-line (i.e., not in
+\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
+then after processing all expressions and files, bc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]\[en]file\f[R].
+\f[B]-f\f[R] or \f[B]--file\f[R].
+However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
+\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
+\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
+exit.
.PP
This is a \f[B]non-portable extension\f[R].
.RE
@@ -215,6 +224,9 @@ All long options are \f[B]non-portable extensions\f[R].
.SH STDOUT
.PP
Any non-error output is written to \f[B]stdout\f[R].
+In addition, if history (see the \f[B]HISTORY\f[R] section) and the
+prompt (see the \f[B]TTY MODE\f[R] section) are enabled, both are output
+to \f[B]stdout\f[R].
.PP
\f[B]Note\f[R]: Unlike other bc(1) implementations, this bc(1) will
issue a fatal error (see the \f[B]EXIT STATUS\f[R] section) if it cannot
@@ -266,8 +278,8 @@ constant numbers.
It is the \[lq]input\[rq] base, or the number base used for interpreting
input numbers.
\f[B]ibase\f[R] is initially \f[B]10\f[R].
-If the \f[B]-s\f[R] (\f[B]\[en]standard\f[R]) and \f[B]-w\f[R]
-(\f[B]\[en]warn\f[R]) flags were not given on the command line, the max
+If the \f[B]-s\f[R] (\f[B]--standard\f[R]) and \f[B]-w\f[R]
+(\f[B]--warn\f[R]) flags were not given on the command line, the max
allowable value for \f[B]ibase\f[R] is \f[B]36\f[R].
Otherwise, it is \f[B]16\f[R].
The min allowable value for \f[B]ibase\f[R] is \f[B]2\f[R].
@@ -427,7 +439,7 @@ The following arithmetic and logical operators can be used.
They are listed in order of decreasing precedence.
Operators in the same group have the same precedence.
.TP
-\f[B]++\f[R] \f[B]\[en]\f[R]
+\f[B]++\f[R] \f[B]--\f[R]
Type: Prefix and Postfix
.RS
.PP
@@ -510,7 +522,7 @@ Description: \f[B]boolean or\f[R]
.PP
The operators will be described in more detail below.
.TP
-\f[B]++\f[R] \f[B]\[en]\f[R]
+\f[B]++\f[R] \f[B]--\f[R]
The prefix and postfix \f[B]increment\f[R] and \f[B]decrement\f[R]
operators behave exactly like they would in C.
They require a named expression (see the \f[I]Named Expressions\f[R]
@@ -890,7 +902,7 @@ This is a \f[B]non-portable extension\f[R].
.SH LIBRARY
.PP
All of the functions below are available when the \f[B]-l\f[R] or
-\f[B]\[en]mathlib\f[R] command-line flags are given.
+\f[B]--mathlib\f[R] command-line flags are given.
.SS Standard Library
.PP
The
@@ -1195,11 +1207,11 @@ interactive mode (see the \f[B]INTERACTIVE MODE\f[R] section), since
bc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
more input when one of those errors occurs in interactive mode.
This is also the case when interactive mode is forced by the
-\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
+\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.PP
These exit statuses allow bc(1) to be used in shell scripting with error
checking, and its normal behavior can be forced by using the
-\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
+\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.SH INTERACTIVE MODE
.PP
Per the
@@ -1207,7 +1219,7 @@ standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html),
bc(1) has an interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both \f[B]stdin\f[R]
and \f[B]stdout\f[R] are hooked to a terminal, but the \f[B]-i\f[R] flag
-and \f[B]\[en]interactive\f[R] option can turn it on in other cases.
+and \f[B]--interactive\f[R] option can turn it on in other cases.
.PP
In interactive mode, bc(1) attempts to recover from errors (see the
\f[B]RESET\f[R] section), and in normal execution, flushes
diff --git a/contrib/bc/manuals/bc/ENP.1.md b/contrib/bc/manuals/bc/ENP.1.md
index 8e5b6fbdd27c..20b60a7a9081 100644
--- a/contrib/bc/manuals/bc/ENP.1.md
+++ b/contrib/bc/manuals/bc/ENP.1.md
@@ -2,7 +2,7 @@
SPDX-License-Identifier: BSD-2-Clause
-Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+Copyright (c) 2018-2021 Gavin D. Howard and contributors.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
@@ -34,8 +34,7 @@ bc - arbitrary-precision decimal arithmetic language and calculator
# SYNOPSIS
-**bc** [**-ghilPqsvVw**] [**--global-stacks**] [**--help**] [**--interactive**] [**--mathlib**] [**--no-prompt**] [**--quiet**] [**--standard**] [**--warn**] [**--version**] [**-e** *expr*] [**--expression**=*expr*...] [**-f** *file*...] [**-file**=*file*...]
-[*file*...]
+**bc** [**-ghilPqsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@@ -54,7 +53,7 @@ especially) the GNU bc(1).
The following are the options that bc(1) accepts.
-**-g**, **--global-stacks**
+**-g**, **-\-global-stacks**
Turns the globals **ibase**, **obase**, and **scale** into stacks.
@@ -107,17 +106,17 @@ The following are the options that bc(1) accepts.
This is a **non-portable extension**.
-**-h**, **--help**
+**-h**, **-\-help**
: Prints a usage message and quits.
-**-i**, **--interactive**
+**-i**, **-\-interactive**
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
This is a **non-portable extension**.
-**-l**, **--mathlib**
+**-l**, **-\-mathlib**
: Sets **scale** (see the **SYNTAX** section) to **20** and loads the included
math library before running any code, including any expressions or files
@@ -125,63 +124,70 @@ The following are the options that bc(1) accepts.
To learn what is in the library, see the **LIBRARY** section.
-**-P**, **--no-prompt**
+**-P**, **-\-no-prompt**
: This option is a no-op.
This is a **non-portable extension**.
-**-q**, **--quiet**
+**-q**, **-\-quiet**
: This option is for compatibility with the [GNU bc(1)][2]; it is a no-op.
Without this option, GNU bc(1) prints a copyright header. This bc(1) only
prints the copyright header if one or more of the **-v**, **-V**, or
- **--version** options are given.
+ **-\-version** options are given.
This is a **non-portable extension**.
-**-s**, **--standard**
+**-s**, **-\-standard**
: Process exactly the language defined by the [standard][1] and error if any
extensions are used.
This is a **non-portable extension**.
-**-v**, **-V**, **--version**
+**-v**, **-V**, **-\-version**
: Print the version information (copyright header) and exit.
This is a **non-portable extension**.
-**-w**, **--warn**
+**-w**, **-\-warn**
-: Like **-s** and **--standard**, except that warnings (and not errors) are
+: Like **-s** and **-\-standard**, except that warnings (and not errors) are
printed for non-standard extensions and execution continues normally.
This is a **non-portable extension**.
-**-e** *expr*, **--expression**=*expr*
+**-e** *expr*, **-\-expression**=*expr*
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
order. If files are given as well (see below), the expressions and files are
evaluated in the order given. This means that if a file is given before an
expression, the file is read in and evaluated first.
- After processing all expressions and files, bc(1) will exit, unless **-**
- (**stdin**) was given as an argument at least once to **-f** or **--file**.
- However, if any other **-e**, **--expression**, **-f**, or **--file**
- arguments are given after that, bc(1) will give a fatal error and exit.
+ If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
+ see the **ENVIRONMENT VARIABLES** section), then after processing all
+ expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
+ as an argument at least once to **-f** or **-\-file**, whether on the
+ command-line or in **BC_ENV_ARGS**. However, if any other **-e**,
+ **-\-expression**, **-f**, or **-\-file** arguments are given after **-f-**
+ or equivalent is given, bc(1) will give a fatal error and exit.
This is a **non-portable extension**.
-**-f** *file*, **--file**=*file*
+**-f** *file*, **-\-file**=*file*
: Reads in *file* and evaluates it, line by line, as though it were read
through **stdin**. If expressions are also given (see above), the
expressions are evaluated in the order given.
- After processing all expressions and files, bc(1) will exit, unless **-**
- (**stdin**) was given as an argument at least once to **-f** or **--file**.
+ If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
+ see the **ENVIRONMENT VARIABLES** section), then after processing all
+ expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
+ as an argument at least once to **-f** or **-\-file**. However, if any other
+ **-e**, **-\-expression**, **-f**, or **-\-file** arguments are given after
+ **-f-** or equivalent is given, bc(1) will give a fatal error and exit.
This is a **non-portable extension**.
@@ -189,7 +195,9 @@ All long options are **non-portable extensions**.
# STDOUT
-Any non-error output is written to **stdout**.
+Any non-error output is written to **stdout**. In addition, if history (see the
+**HISTORY** section) and the prompt (see the **TTY MODE** section) are enabled,
+both are output to **stdout**.
**Note**: Unlike other bc(1) implementations, this bc(1) will issue a fatal
error (see the **EXIT STATUS** section) if it cannot write to **stdout**, so if
@@ -233,8 +241,8 @@ Identifiers with more than one character (letter) are a
**ibase** is a global variable determining how to interpret constant numbers. It
is the "input" base, or the number base used for interpreting input numbers.
-**ibase** is initially **10**. If the **-s** (**--standard**) and **-w**
-(**--warn**) flags were not given on the command line, the max allowable value
+**ibase** is initially **10**. If the **-s** (**-\-standard**) and **-w**
+(**-\-warn**) flags were not given on the command line, the max allowable value
for **ibase** is **36**. Otherwise, it is **16**. The min allowable value for
**ibase** is **2**. The max allowable value for **ibase** can be queried in
bc(1) programs with the **maxibase()** built-in function.
@@ -353,7 +361,7 @@ The following arithmetic and logical operators can be used. They are listed in
order of decreasing precedence. Operators in the same group have the same
precedence.
-**++** **--**
+**++** **-\-**
: Type: Prefix and Postfix
@@ -427,7 +435,7 @@ precedence.
The operators will be described in more detail below.
-**++** **--**
+**++** **-\-**
: The prefix and postfix **increment** and **decrement** operators behave
exactly like they would in C. They require a named expression (see the
@@ -703,7 +711,7 @@ This is a **non-portable extension**.
# LIBRARY
-All of the functions below are available when the **-l** or **--mathlib**
+All of the functions below are available when the **-l** or **-\-mathlib**
command-line flags are given.
## Standard Library
@@ -979,17 +987,17 @@ The other statuses will only be returned when bc(1) is not in interactive mode
(see the **INTERACTIVE MODE** section), since bc(1) resets its state (see the
**RESET** section) and accepts more input when one of those errors occurs in
interactive mode. This is also the case when interactive mode is forced by the
-**-i** flag or **--interactive** option.
+**-i** flag or **-\-interactive** option.
These exit statuses allow bc(1) to be used in shell scripting with error
checking, and its normal behavior can be forced by using the **-i** flag or
-**--interactive** option.
+**-\-interactive** option.
# INTERACTIVE MODE
Per the [standard][1], bc(1) has an interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both **stdin** and **stdout**
-are hooked to a terminal, but the **-i** flag and **--interactive** option can
+are hooked to a terminal, but the **-i** flag and **-\-interactive** option can
turn it on in other cases.
In interactive mode, bc(1) attempts to recover from errors (see the **RESET**
diff --git a/contrib/bc/manuals/bc/EP.1 b/contrib/bc/manuals/bc/EP.1
index 01f34378fd65..62ee57bfccc7 100644
--- a/contrib/bc/manuals/bc/EP.1
+++ b/contrib/bc/manuals/bc/EP.1
@@ -1,7 +1,7 @@
.\"
.\" SPDX-License-Identifier: BSD-2-Clause
.\"
-.\" Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+.\" Copyright (c) 2018-2021 Gavin D. Howard and contributors.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions are met:
@@ -25,19 +25,18 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.TH "BC" "1" "October 2020" "Gavin D. Howard" "General Commands Manual"
+.TH "BC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
.SH NAME
.PP
bc - arbitrary-precision decimal arithmetic language and calculator
.SH SYNOPSIS
.PP
-\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]\[en]global-stacks\f[R]]
-[\f[B]\[en]help\f[R]] [\f[B]\[en]interactive\f[R]]
-[\f[B]\[en]mathlib\f[R]] [\f[B]\[en]no-prompt\f[R]]
-[\f[B]\[en]quiet\f[R]] [\f[B]\[en]standard\f[R]] [\f[B]\[en]warn\f[R]]
-[\f[B]\[en]version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
-[\f[B]\[en]expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
-\f[I]file\f[R]\&...] [\f[B]-file\f[R]=\f[I]file\f[R]\&...]
+\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]--global-stacks\f[R]]
+[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--mathlib\f[R]]
+[\f[B]--no-prompt\f[R]] [\f[B]--quiet\f[R]] [\f[B]--standard\f[R]]
+[\f[B]--warn\f[R]] [\f[B]--version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
+[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
+\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
[\f[I]file\f[R]\&...]
.SH DESCRIPTION
.PP
@@ -58,7 +57,7 @@ This bc(1) is a drop-in replacement for \f[I]any\f[R] bc(1), including
.PP
The following are the options that bc(1) accepts.
.PP
-\f[B]-g\f[R], \f[B]\[en]global-stacks\f[R]
+\f[B]-g\f[R], \f[B]--global-stacks\f[R]
.IP
.nf
\f[C]
@@ -115,10 +114,10 @@ This is a **non-portable extension**.
\f[R]
.fi
.TP
-\f[B]-h\f[R], \f[B]\[en]help\f[R]
+\f[B]-h\f[R], \f[B]--help\f[R]
Prints a usage message and quits.
.TP
-\f[B]-i\f[R], \f[B]\[en]interactive\f[R]
+\f[B]-i\f[R], \f[B]--interactive\f[R]
Forces interactive mode.
(See the \f[B]INTERACTIVE MODE\f[R] section.)
.RS
@@ -126,7 +125,7 @@ Forces interactive mode.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-l\f[R], \f[B]\[en]mathlib\f[R]
+\f[B]-l\f[R], \f[B]--mathlib\f[R]
Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to \f[B]20\f[R]
and loads the included math library before running any code, including
any expressions or files specified on the command line.
@@ -135,25 +134,25 @@ any expressions or files specified on the command line.
To learn what is in the library, see the \f[B]LIBRARY\f[R] section.
.RE
.TP
-\f[B]-P\f[R], \f[B]\[en]no-prompt\f[R]
+\f[B]-P\f[R], \f[B]--no-prompt\f[R]
This option is a no-op.
.RS
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-q\f[R], \f[B]\[en]quiet\f[R]
+\f[B]-q\f[R], \f[B]--quiet\f[R]
This option is for compatibility with the GNU
bc(1) (https://www.gnu.org/software/bc/); it is a no-op.
Without this option, GNU bc(1) prints a copyright header.
This bc(1) only prints the copyright header if one or more of the
-\f[B]-v\f[R], \f[B]-V\f[R], or \f[B]\[en]version\f[R] options are given.
+\f[B]-v\f[R], \f[B]-V\f[R], or \f[B]--version\f[R] options are given.
.RS
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-s\f[R], \f[B]\[en]standard\f[R]
+\f[B]-s\f[R], \f[B]--standard\f[R]
Process exactly the language defined by the
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
and error if any extensions are used.
@@ -162,15 +161,15 @@ and error if any extensions are used.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-v\f[R], \f[B]-V\f[R], \f[B]\[en]version\f[R]
+\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
Print the version information (copyright header) and exit.
.RS
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-w\f[R], \f[B]\[en]warn\f[R]
-Like \f[B]-s\f[R] and \f[B]\[en]standard\f[R], except that warnings (and
+\f[B]-w\f[R], \f[B]--warn\f[R]
+Like \f[B]-s\f[R] and \f[B]--standard\f[R], except that warnings (and
not errors) are printed for non-standard extensions and execution
continues normally.
.RS
@@ -178,7 +177,7 @@ continues normally.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-e\f[R] \f[I]expr\f[R], \f[B]\[en]expression\f[R]=\f[I]expr\f[R]
+\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
Evaluates \f[I]expr\f[R].
If multiple expressions are given, they are evaluated in order.
If files are given as well (see below), the expressions and files are
@@ -187,26 +186,36 @@ This means that if a file is given before an expression, the file is
read in and evaluated first.
.RS
.PP
-After processing all expressions and files, bc(1) will exit, unless
+If this option is given on the command-line (i.e., not in
+\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
+then after processing all expressions and files, bc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]\[en]file\f[R].
-However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
-\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after that,
-bc(1) will give a fatal error and exit.
+\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
+\f[B]BC_ENV_ARGS\f[R].
+However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
+\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
+\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
+exit.
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-f\f[R] \f[I]file\f[R], \f[B]\[en]file\f[R]=\f[I]file\f[R]
+\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
were read through \f[B]stdin\f[R].
If expressions are also given (see above), the expressions are evaluated
in the order given.
.RS
.PP
-After processing all expressions and files, bc(1) will exit, unless
+If this option is given on the command-line (i.e., not in
+\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
+then after processing all expressions and files, bc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]\[en]file\f[R].
+\f[B]-f\f[R] or \f[B]--file\f[R].
+However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
+\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
+\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
+exit.
.PP
This is a \f[B]non-portable extension\f[R].
.RE
@@ -215,6 +224,9 @@ All long options are \f[B]non-portable extensions\f[R].
.SH STDOUT
.PP
Any non-error output is written to \f[B]stdout\f[R].
+In addition, if history (see the \f[B]HISTORY\f[R] section) and the
+prompt (see the \f[B]TTY MODE\f[R] section) are enabled, both are output
+to \f[B]stdout\f[R].
.PP
\f[B]Note\f[R]: Unlike other bc(1) implementations, this bc(1) will
issue a fatal error (see the \f[B]EXIT STATUS\f[R] section) if it cannot
@@ -266,8 +278,8 @@ constant numbers.
It is the \[lq]input\[rq] base, or the number base used for interpreting
input numbers.
\f[B]ibase\f[R] is initially \f[B]10\f[R].
-If the \f[B]-s\f[R] (\f[B]\[en]standard\f[R]) and \f[B]-w\f[R]
-(\f[B]\[en]warn\f[R]) flags were not given on the command line, the max
+If the \f[B]-s\f[R] (\f[B]--standard\f[R]) and \f[B]-w\f[R]
+(\f[B]--warn\f[R]) flags were not given on the command line, the max
allowable value for \f[B]ibase\f[R] is \f[B]36\f[R].
Otherwise, it is \f[B]16\f[R].
The min allowable value for \f[B]ibase\f[R] is \f[B]2\f[R].
@@ -427,7 +439,7 @@ The following arithmetic and logical operators can be used.
They are listed in order of decreasing precedence.
Operators in the same group have the same precedence.
.TP
-\f[B]++\f[R] \f[B]\[en]\f[R]
+\f[B]++\f[R] \f[B]--\f[R]
Type: Prefix and Postfix
.RS
.PP
@@ -510,7 +522,7 @@ Description: \f[B]boolean or\f[R]
.PP
The operators will be described in more detail below.
.TP
-\f[B]++\f[R] \f[B]\[en]\f[R]
+\f[B]++\f[R] \f[B]--\f[R]
The prefix and postfix \f[B]increment\f[R] and \f[B]decrement\f[R]
operators behave exactly like they would in C.
They require a named expression (see the \f[I]Named Expressions\f[R]
@@ -890,7 +902,7 @@ This is a \f[B]non-portable extension\f[R].
.SH LIBRARY
.PP
All of the functions below are available when the \f[B]-l\f[R] or
-\f[B]\[en]mathlib\f[R] command-line flags are given.
+\f[B]--mathlib\f[R] command-line flags are given.
.SS Standard Library
.PP
The
@@ -1195,11 +1207,11 @@ interactive mode (see the \f[B]INTERACTIVE MODE\f[R] section), since
bc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
more input when one of those errors occurs in interactive mode.
This is also the case when interactive mode is forced by the
-\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
+\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.PP
These exit statuses allow bc(1) to be used in shell scripting with error
checking, and its normal behavior can be forced by using the
-\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
+\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.SH INTERACTIVE MODE
.PP
Per the
@@ -1207,7 +1219,7 @@ standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html),
bc(1) has an interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both \f[B]stdin\f[R]
and \f[B]stdout\f[R] are hooked to a terminal, but the \f[B]-i\f[R] flag
-and \f[B]\[en]interactive\f[R] option can turn it on in other cases.
+and \f[B]--interactive\f[R] option can turn it on in other cases.
.PP
In interactive mode, bc(1) attempts to recover from errors (see the
\f[B]RESET\f[R] section), and in normal execution, flushes
diff --git a/contrib/bc/manuals/bc/EP.1.md b/contrib/bc/manuals/bc/EP.1.md
index a853961d683c..9a36b99bcb1c 100644
--- a/contrib/bc/manuals/bc/EP.1.md
+++ b/contrib/bc/manuals/bc/EP.1.md
@@ -2,7 +2,7 @@
SPDX-License-Identifier: BSD-2-Clause
-Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+Copyright (c) 2018-2021 Gavin D. Howard and contributors.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
@@ -34,8 +34,7 @@ bc - arbitrary-precision decimal arithmetic language and calculator
# SYNOPSIS
-**bc** [**-ghilPqsvVw**] [**--global-stacks**] [**--help**] [**--interactive**] [**--mathlib**] [**--no-prompt**] [**--quiet**] [**--standard**] [**--warn**] [**--version**] [**-e** *expr*] [**--expression**=*expr*...] [**-f** *file*...] [**-file**=*file*...]
-[*file*...]
+**bc** [**-ghilPqsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@@ -54,7 +53,7 @@ especially) the GNU bc(1).
The following are the options that bc(1) accepts.
-**-g**, **--global-stacks**
+**-g**, **-\-global-stacks**
Turns the globals **ibase**, **obase**, and **scale** into stacks.
@@ -107,17 +106,17 @@ The following are the options that bc(1) accepts.
This is a **non-portable extension**.
-**-h**, **--help**
+**-h**, **-\-help**
: Prints a usage message and quits.
-**-i**, **--interactive**
+**-i**, **-\-interactive**
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
This is a **non-portable extension**.
-**-l**, **--mathlib**
+**-l**, **-\-mathlib**
: Sets **scale** (see the **SYNTAX** section) to **20** and loads the included
math library before running any code, including any expressions or files
@@ -125,63 +124,70 @@ The following are the options that bc(1) accepts.
To learn what is in the library, see the **LIBRARY** section.
-**-P**, **--no-prompt**
+**-P**, **-\-no-prompt**
: This option is a no-op.
This is a **non-portable extension**.
-**-q**, **--quiet**
+**-q**, **-\-quiet**
: This option is for compatibility with the [GNU bc(1)][2]; it is a no-op.
Without this option, GNU bc(1) prints a copyright header. This bc(1) only
prints the copyright header if one or more of the **-v**, **-V**, or
- **--version** options are given.
+ **-\-version** options are given.
This is a **non-portable extension**.
-**-s**, **--standard**
+**-s**, **-\-standard**
: Process exactly the language defined by the [standard][1] and error if any
extensions are used.
This is a **non-portable extension**.
-**-v**, **-V**, **--version**
+**-v**, **-V**, **-\-version**
: Print the version information (copyright header) and exit.
This is a **non-portable extension**.
-**-w**, **--warn**
+**-w**, **-\-warn**
-: Like **-s** and **--standard**, except that warnings (and not errors) are
+: Like **-s** and **-\-standard**, except that warnings (and not errors) are
printed for non-standard extensions and execution continues normally.
This is a **non-portable extension**.
-**-e** *expr*, **--expression**=*expr*
+**-e** *expr*, **-\-expression**=*expr*
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
order. If files are given as well (see below), the expressions and files are
evaluated in the order given. This means that if a file is given before an
expression, the file is read in and evaluated first.
- After processing all expressions and files, bc(1) will exit, unless **-**
- (**stdin**) was given as an argument at least once to **-f** or **--file**.
- However, if any other **-e**, **--expression**, **-f**, or **--file**
- arguments are given after that, bc(1) will give a fatal error and exit.
+ If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
+ see the **ENVIRONMENT VARIABLES** section), then after processing all
+ expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
+ as an argument at least once to **-f** or **-\-file**, whether on the
+ command-line or in **BC_ENV_ARGS**. However, if any other **-e**,
+ **-\-expression**, **-f**, or **-\-file** arguments are given after **-f-**
+ or equivalent is given, bc(1) will give a fatal error and exit.
This is a **non-portable extension**.
-**-f** *file*, **--file**=*file*
+**-f** *file*, **-\-file**=*file*
: Reads in *file* and evaluates it, line by line, as though it were read
through **stdin**. If expressions are also given (see above), the
expressions are evaluated in the order given.
- After processing all expressions and files, bc(1) will exit, unless **-**
- (**stdin**) was given as an argument at least once to **-f** or **--file**.
+ If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
+ see the **ENVIRONMENT VARIABLES** section), then after processing all
+ expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
+ as an argument at least once to **-f** or **-\-file**. However, if any other
+ **-e**, **-\-expression**, **-f**, or **-\-file** arguments are given after
+ **-f-** or equivalent is given, bc(1) will give a fatal error and exit.
This is a **non-portable extension**.
@@ -189,7 +195,9 @@ All long options are **non-portable extensions**.
# STDOUT
-Any non-error output is written to **stdout**.
+Any non-error output is written to **stdout**. In addition, if history (see the
+**HISTORY** section) and the prompt (see the **TTY MODE** section) are enabled,
+both are output to **stdout**.
**Note**: Unlike other bc(1) implementations, this bc(1) will issue a fatal
error (see the **EXIT STATUS** section) if it cannot write to **stdout**, so if
@@ -233,8 +241,8 @@ Identifiers with more than one character (letter) are a
**ibase** is a global variable determining how to interpret constant numbers. It
is the "input" base, or the number base used for interpreting input numbers.
-**ibase** is initially **10**. If the **-s** (**--standard**) and **-w**
-(**--warn**) flags were not given on the command line, the max allowable value
+**ibase** is initially **10**. If the **-s** (**-\-standard**) and **-w**
+(**-\-warn**) flags were not given on the command line, the max allowable value
for **ibase** is **36**. Otherwise, it is **16**. The min allowable value for
**ibase** is **2**. The max allowable value for **ibase** can be queried in
bc(1) programs with the **maxibase()** built-in function.
@@ -353,7 +361,7 @@ The following arithmetic and logical operators can be used. They are listed in
order of decreasing precedence. Operators in the same group have the same
precedence.
-**++** **--**
+**++** **-\-**
: Type: Prefix and Postfix
@@ -427,7 +435,7 @@ precedence.
The operators will be described in more detail below.
-**++** **--**
+**++** **-\-**
: The prefix and postfix **increment** and **decrement** operators behave
exactly like they would in C. They require a named expression (see the
@@ -703,7 +711,7 @@ This is a **non-portable extension**.
# LIBRARY
-All of the functions below are available when the **-l** or **--mathlib**
+All of the functions below are available when the **-l** or **-\-mathlib**
command-line flags are given.
## Standard Library
@@ -979,17 +987,17 @@ The other statuses will only be returned when bc(1) is not in interactive mode
(see the **INTERACTIVE MODE** section), since bc(1) resets its state (see the
**RESET** section) and accepts more input when one of those errors occurs in
interactive mode. This is also the case when interactive mode is forced by the
-**-i** flag or **--interactive** option.
+**-i** flag or **-\-interactive** option.
These exit statuses allow bc(1) to be used in shell scripting with error
checking, and its normal behavior can be forced by using the **-i** flag or
-**--interactive** option.
+**-\-interactive** option.
# INTERACTIVE MODE
Per the [standard][1], bc(1) has an interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both **stdin** and **stdout**
-are hooked to a terminal, but the **-i** flag and **--interactive** option can
+are hooked to a terminal, but the **-i** flag and **-\-interactive** option can
turn it on in other cases.
In interactive mode, bc(1) attempts to recover from errors (see the **RESET**
diff --git a/contrib/bc/manuals/bc/H.1 b/contrib/bc/manuals/bc/H.1
index d6053feab4e8..fe9ac1556522 100644
--- a/contrib/bc/manuals/bc/H.1
+++ b/contrib/bc/manuals/bc/H.1
@@ -1,7 +1,7 @@
.\"
.\" SPDX-License-Identifier: BSD-2-Clause
.\"
-.\" Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+.\" Copyright (c) 2018-2021 Gavin D. Howard and contributors.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions are met:
@@ -25,19 +25,18 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.TH "BC" "1" "October 2020" "Gavin D. Howard" "General Commands Manual"
+.TH "BC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
.SH NAME
.PP
bc - arbitrary-precision decimal arithmetic language and calculator
.SH SYNOPSIS
.PP
-\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]\[en]global-stacks\f[R]]
-[\f[B]\[en]help\f[R]] [\f[B]\[en]interactive\f[R]]
-[\f[B]\[en]mathlib\f[R]] [\f[B]\[en]no-prompt\f[R]]
-[\f[B]\[en]quiet\f[R]] [\f[B]\[en]standard\f[R]] [\f[B]\[en]warn\f[R]]
-[\f[B]\[en]version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
-[\f[B]\[en]expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
-\f[I]file\f[R]\&...] [\f[B]-file\f[R]=\f[I]file\f[R]\&...]
+\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]--global-stacks\f[R]]
+[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--mathlib\f[R]]
+[\f[B]--no-prompt\f[R]] [\f[B]--quiet\f[R]] [\f[B]--standard\f[R]]
+[\f[B]--warn\f[R]] [\f[B]--version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
+[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
+\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
[\f[I]file\f[R]\&...]
.SH DESCRIPTION
.PP
@@ -55,7 +54,7 @@ the command line and executes them before reading from \f[B]stdin\f[R].
.PP
The following are the options that bc(1) accepts.
.TP
-\f[B]-g\f[R], \f[B]\[en]global-stacks\f[R]
+\f[B]-g\f[R], \f[B]--global-stacks\f[R]
Turns the globals \f[B]ibase\f[R], \f[B]obase\f[R], \f[B]scale\f[R], and
\f[B]seed\f[R] into stacks.
.RS
@@ -147,10 +146,10 @@ is ignored.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-h\f[R], \f[B]\[en]help\f[R]
+\f[B]-h\f[R], \f[B]--help\f[R]
Prints a usage message and quits.
.TP
-\f[B]-i\f[R], \f[B]\[en]interactive\f[R]
+\f[B]-i\f[R], \f[B]--interactive\f[R]
Forces interactive mode.
(See the \f[B]INTERACTIVE MODE\f[R] section.)
.RS
@@ -158,7 +157,7 @@ Forces interactive mode.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-l\f[R], \f[B]\[en]mathlib\f[R]
+\f[B]-l\f[R], \f[B]--mathlib\f[R]
Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to \f[B]20\f[R]
and loads the included math library and the extended math library before
running any code, including any expressions or files specified on the
@@ -168,7 +167,7 @@ command line.
To learn what is in the libraries, see the \f[B]LIBRARY\f[R] section.
.RE
.TP
-\f[B]-P\f[R], \f[B]\[en]no-prompt\f[R]
+\f[B]-P\f[R], \f[B]--no-prompt\f[R]
Disables the prompt in TTY mode.
(The prompt is only enabled in TTY mode.
See the \f[B]TTY MODE\f[R] section) This is mostly for those users that
@@ -180,18 +179,18 @@ Most of those users would want to put this option in
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-q\f[R], \f[B]\[en]quiet\f[R]
+\f[B]-q\f[R], \f[B]--quiet\f[R]
This option is for compatibility with the GNU
bc(1) (https://www.gnu.org/software/bc/); it is a no-op.
Without this option, GNU bc(1) prints a copyright header.
This bc(1) only prints the copyright header if one or more of the
-\f[B]-v\f[R], \f[B]-V\f[R], or \f[B]\[en]version\f[R] options are given.
+\f[B]-v\f[R], \f[B]-V\f[R], or \f[B]--version\f[R] options are given.
.RS
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-s\f[R], \f[B]\[en]standard\f[R]
+\f[B]-s\f[R], \f[B]--standard\f[R]
Process exactly the language defined by the
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
and error if any extensions are used.
@@ -200,15 +199,15 @@ and error if any extensions are used.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-v\f[R], \f[B]-V\f[R], \f[B]\[en]version\f[R]
+\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
Print the version information (copyright header) and exit.
.RS
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-w\f[R], \f[B]\[en]warn\f[R]
-Like \f[B]-s\f[R] and \f[B]\[en]standard\f[R], except that warnings (and
+\f[B]-w\f[R], \f[B]--warn\f[R]
+Like \f[B]-s\f[R] and \f[B]--standard\f[R], except that warnings (and
not errors) are printed for non-standard extensions and execution
continues normally.
.RS
@@ -216,7 +215,7 @@ continues normally.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-e\f[R] \f[I]expr\f[R], \f[B]\[en]expression\f[R]=\f[I]expr\f[R]
+\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
Evaluates \f[I]expr\f[R].
If multiple expressions are given, they are evaluated in order.
If files are given as well (see below), the expressions and files are
@@ -225,26 +224,36 @@ This means that if a file is given before an expression, the file is
read in and evaluated first.
.RS
.PP
-After processing all expressions and files, bc(1) will exit, unless
+If this option is given on the command-line (i.e., not in
+\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
+then after processing all expressions and files, bc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]\[en]file\f[R].
-However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
-\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after that,
-bc(1) will give a fatal error and exit.
+\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
+\f[B]BC_ENV_ARGS\f[R].
+However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
+\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
+\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
+exit.
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-f\f[R] \f[I]file\f[R], \f[B]\[en]file\f[R]=\f[I]file\f[R]
+\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
were read through \f[B]stdin\f[R].
If expressions are also given (see above), the expressions are evaluated
in the order given.
.RS
.PP
-After processing all expressions and files, bc(1) will exit, unless
+If this option is given on the command-line (i.e., not in
+\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
+then after processing all expressions and files, bc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]\[en]file\f[R].
+\f[B]-f\f[R] or \f[B]--file\f[R].
+However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
+\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
+\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
+exit.
.PP
This is a \f[B]non-portable extension\f[R].
.RE
@@ -253,6 +262,9 @@ All long options are \f[B]non-portable extensions\f[R].
.SH STDOUT
.PP
Any non-error output is written to \f[B]stdout\f[R].
+In addition, if history (see the \f[B]HISTORY\f[R] section) and the
+prompt (see the \f[B]TTY MODE\f[R] section) are enabled, both are output
+to \f[B]stdout\f[R].
.PP
\f[B]Note\f[R]: Unlike other bc(1) implementations, this bc(1) will
issue a fatal error (see the \f[B]EXIT STATUS\f[R] section) if it cannot
@@ -304,8 +316,8 @@ constant numbers.
It is the \[lq]input\[rq] base, or the number base used for interpreting
input numbers.
\f[B]ibase\f[R] is initially \f[B]10\f[R].
-If the \f[B]-s\f[R] (\f[B]\[en]standard\f[R]) and \f[B]-w\f[R]
-(\f[B]\[en]warn\f[R]) flags were not given on the command line, the max
+If the \f[B]-s\f[R] (\f[B]--standard\f[R]) and \f[B]-w\f[R]
+(\f[B]--warn\f[R]) flags were not given on the command line, the max
allowable value for \f[B]ibase\f[R] is \f[B]36\f[R].
Otherwise, it is \f[B]16\f[R].
The min allowable value for \f[B]ibase\f[R] is \f[B]2\f[R].
@@ -514,6 +526,10 @@ generator with \f[B]rand()\f[R] and \f[B]irand(E)\f[R] are guaranteed to
This is a consequence of using a seeded pseudo-random number generator.
However, they \f[I]are\f[R] guaranteed to be reproducible with identical
\f[B]seed\f[R] values.
+This means that the pseudo-random values from bc(1) should only be used
+where a reproducible stream of pseudo-random numbers is
+\f[I]ESSENTIAL\f[R].
+In any other case, use a non-seeded pseudo-random number generator.
.SS Numbers
.PP
Numbers are strings made up of digits, uppercase letters, and at most
@@ -560,7 +576,7 @@ The following arithmetic and logical operators can be used.
They are listed in order of decreasing precedence.
Operators in the same group have the same precedence.
.TP
-\f[B]++\f[R] \f[B]\[en]\f[R]
+\f[B]++\f[R] \f[B]--\f[R]
Type: Prefix and Postfix
.RS
.PP
@@ -670,7 +686,7 @@ Description: \f[B]boolean or\f[R]
.PP
The operators will be described in more detail below.
.TP
-\f[B]++\f[R] \f[B]\[en]\f[R]
+\f[B]++\f[R] \f[B]--\f[R]
The prefix and postfix \f[B]increment\f[R] and \f[B]decrement\f[R]
operators behave exactly like they would in C.
They require a named expression (see the \f[I]Named Expressions\f[R]
@@ -1116,7 +1132,7 @@ This is a \f[B]non-portable extension\f[R].
.PP
All of the functions below, including the functions in the extended math
library (see the \f[I]Extended Library\f[R] subsection below), are
-available when the \f[B]-l\f[R] or \f[B]\[en]mathlib\f[R] command-line
+available when the \f[B]-l\f[R] or \f[B]--mathlib\f[R] command-line
flags are given, except that the extended math library is not available
when the \f[B]-s\f[R] option, the \f[B]-w\f[R] option, or equivalents
are given.
@@ -1177,7 +1193,7 @@ Functions\f[R] subsection below).
.SS Extended Library
.PP
The extended library is \f[I]not\f[R] loaded when the
-\f[B]-s\f[R]/\f[B]\[en]standard\f[R] or \f[B]-w\f[R]/\f[B]\[en]warn\f[R]
+\f[B]-s\f[R]/\f[B]--standard\f[R] or \f[B]-w\f[R]/\f[B]--warn\f[R]
options are given since they are not part of the library defined by the
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html).
.PP
@@ -1935,11 +1951,11 @@ interactive mode (see the \f[B]INTERACTIVE MODE\f[R] section), since
bc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
more input when one of those errors occurs in interactive mode.
This is also the case when interactive mode is forced by the
-\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
+\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.PP
These exit statuses allow bc(1) to be used in shell scripting with error
checking, and its normal behavior can be forced by using the
-\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
+\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.SH INTERACTIVE MODE
.PP
Per the
@@ -1947,7 +1963,7 @@ standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html),
bc(1) has an interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both \f[B]stdin\f[R]
and \f[B]stdout\f[R] are hooked to a terminal, but the \f[B]-i\f[R] flag
-and \f[B]\[en]interactive\f[R] option can turn it on in other cases.
+and \f[B]--interactive\f[R] option can turn it on in other cases.
.PP
In interactive mode, bc(1) attempts to recover from errors (see the
\f[B]RESET\f[R] section), and in normal execution, flushes
diff --git a/contrib/bc/manuals/bc/H.1.md b/contrib/bc/manuals/bc/H.1.md
index f764e47cc0f4..5ba65ba1f5d6 100644
--- a/contrib/bc/manuals/bc/H.1.md
+++ b/contrib/bc/manuals/bc/H.1.md
@@ -2,7 +2,7 @@
SPDX-License-Identifier: BSD-2-Clause
-Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+Copyright (c) 2018-2021 Gavin D. Howard and contributors.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
@@ -34,8 +34,7 @@ bc - arbitrary-precision decimal arithmetic language and calculator
# SYNOPSIS
-**bc** [**-ghilPqsvVw**] [**--global-stacks**] [**--help**] [**--interactive**] [**--mathlib**] [**--no-prompt**] [**--quiet**] [**--standard**] [**--warn**] [**--version**] [**-e** *expr*] [**--expression**=*expr*...] [**-f** *file*...] [**-file**=*file*...]
-[*file*...]
+**bc** [**-ghilPqsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@@ -51,7 +50,7 @@ command line and executes them before reading from **stdin**.
The following are the options that bc(1) accepts.
-**-g**, **--global-stacks**
+**-g**, **-\-global-stacks**
: Turns the globals **ibase**, **obase**, **scale**, and **seed** into stacks.
@@ -119,17 +118,17 @@ The following are the options that bc(1) accepts.
This is a **non-portable extension**.
-**-h**, **--help**
+**-h**, **-\-help**
: Prints a usage message and quits.
-**-i**, **--interactive**
+**-i**, **-\-interactive**
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
This is a **non-portable extension**.
-**-l**, **--mathlib**
+**-l**, **-\-mathlib**
: Sets **scale** (see the **SYNTAX** section) to **20** and loads the included
math library and the extended math library before running any code,
@@ -137,7 +136,7 @@ The following are the options that bc(1) accepts.
To learn what is in the libraries, see the **LIBRARY** section.
-**-P**, **--no-prompt**
+**-P**, **-\-no-prompt**
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
See the **TTY MODE** section) This is mostly for those users that do not
@@ -147,57 +146,64 @@ The following are the options that bc(1) accepts.
This is a **non-portable extension**.
-**-q**, **--quiet**
+**-q**, **-\-quiet**
: This option is for compatibility with the [GNU bc(1)][2]; it is a no-op.
Without this option, GNU bc(1) prints a copyright header. This bc(1) only
prints the copyright header if one or more of the **-v**, **-V**, or
- **--version** options are given.
+ **-\-version** options are given.
This is a **non-portable extension**.
-**-s**, **--standard**
+**-s**, **-\-standard**
: Process exactly the language defined by the [standard][1] and error if any
extensions are used.
This is a **non-portable extension**.
-**-v**, **-V**, **--version**
+**-v**, **-V**, **-\-version**
: Print the version information (copyright header) and exit.
This is a **non-portable extension**.
-**-w**, **--warn**
+**-w**, **-\-warn**
-: Like **-s** and **--standard**, except that warnings (and not errors) are
+: Like **-s** and **-\-standard**, except that warnings (and not errors) are
printed for non-standard extensions and execution continues normally.
This is a **non-portable extension**.
-**-e** *expr*, **--expression**=*expr*
+**-e** *expr*, **-\-expression**=*expr*
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
order. If files are given as well (see below), the expressions and files are
evaluated in the order given. This means that if a file is given before an
expression, the file is read in and evaluated first.
- After processing all expressions and files, bc(1) will exit, unless **-**
- (**stdin**) was given as an argument at least once to **-f** or **--file**.
- However, if any other **-e**, **--expression**, **-f**, or **--file**
- arguments are given after that, bc(1) will give a fatal error and exit.
+ If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
+ see the **ENVIRONMENT VARIABLES** section), then after processing all
+ expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
+ as an argument at least once to **-f** or **-\-file**, whether on the
+ command-line or in **BC_ENV_ARGS**. However, if any other **-e**,
+ **-\-expression**, **-f**, or **-\-file** arguments are given after **-f-**
+ or equivalent is given, bc(1) will give a fatal error and exit.
This is a **non-portable extension**.
-**-f** *file*, **--file**=*file*
+**-f** *file*, **-\-file**=*file*
: Reads in *file* and evaluates it, line by line, as though it were read
through **stdin**. If expressions are also given (see above), the
expressions are evaluated in the order given.
- After processing all expressions and files, bc(1) will exit, unless **-**
- (**stdin**) was given as an argument at least once to **-f** or **--file**.
+ If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
+ see the **ENVIRONMENT VARIABLES** section), then after processing all
+ expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
+ as an argument at least once to **-f** or **-\-file**. However, if any other
+ **-e**, **-\-expression**, **-f**, or **-\-file** arguments are given after
+ **-f-** or equivalent is given, bc(1) will give a fatal error and exit.
This is a **non-portable extension**.
@@ -205,7 +211,9 @@ All long options are **non-portable extensions**.
# STDOUT
-Any non-error output is written to **stdout**.
+Any non-error output is written to **stdout**. In addition, if history (see the
+**HISTORY** section) and the prompt (see the **TTY MODE** section) are enabled,
+both are output to **stdout**.
**Note**: Unlike other bc(1) implementations, this bc(1) will issue a fatal
error (see the **EXIT STATUS** section) if it cannot write to **stdout**, so if
@@ -249,8 +257,8 @@ Identifiers with more than one character (letter) are a
**ibase** is a global variable determining how to interpret constant numbers. It
is the "input" base, or the number base used for interpreting input numbers.
-**ibase** is initially **10**. If the **-s** (**--standard**) and **-w**
-(**--warn**) flags were not given on the command line, the max allowable value
+**ibase** is initially **10**. If the **-s** (**-\-standard**) and **-w**
+(**-\-warn**) flags were not given on the command line, the max allowable value
for **ibase** is **36**. Otherwise, it is **16**. The min allowable value for
**ibase** is **2**. The max allowable value for **ibase** can be queried in
bc(1) programs with the **maxibase()** built-in function.
@@ -399,7 +407,10 @@ generator.
**Note**: The values returned by the pseudo-random number generator with
**rand()** and **irand(E)** are guaranteed to *NOT* be cryptographically secure.
This is a consequence of using a seeded pseudo-random number generator. However,
-they *are* guaranteed to be reproducible with identical **seed** values.
+they *are* guaranteed to be reproducible with identical **seed** values. This
+means that the pseudo-random values from bc(1) should only be used where a
+reproducible stream of pseudo-random numbers is *ESSENTIAL*. In any other case,
+use a non-seeded pseudo-random number generator.
## Numbers
@@ -437,7 +448,7 @@ The following arithmetic and logical operators can be used. They are listed in
order of decreasing precedence. Operators in the same group have the same
precedence.
-**++** **--**
+**++** **-\-**
: Type: Prefix and Postfix
@@ -535,7 +546,7 @@ precedence.
The operators will be described in more detail below.
-**++** **--**
+**++** **-\-**
: The prefix and postfix **increment** and **decrement** operators behave
exactly like they would in C. They require a named expression (see the
@@ -866,7 +877,7 @@ This is a **non-portable extension**.
All of the functions below, including the functions in the extended math
library (see the *Extended Library* subsection below), are available when the
-**-l** or **--mathlib** command-line flags are given, except that the extended
+**-l** or **-\-mathlib** command-line flags are given, except that the extended
math library is not available when the **-s** option, the **-w** option, or
equivalents are given.
@@ -918,8 +929,8 @@ The [standard][1] defines the following functions for the math library:
## Extended Library
-The extended library is *not* loaded when the **-s**/**--standard** or
-**-w**/**--warn** options are given since they are not part of the library
+The extended library is *not* loaded when the **-s**/**-\-standard** or
+**-w**/**-\-warn** options are given since they are not part of the library
defined by the [standard][1].
The extended library is a **non-portable extension**.
@@ -1587,17 +1598,17 @@ The other statuses will only be returned when bc(1) is not in interactive mode
(see the **INTERACTIVE MODE** section), since bc(1) resets its state (see the
**RESET** section) and accepts more input when one of those errors occurs in
interactive mode. This is also the case when interactive mode is forced by the
-**-i** flag or **--interactive** option.
+**-i** flag or **-\-interactive** option.
These exit statuses allow bc(1) to be used in shell scripting with error
checking, and its normal behavior can be forced by using the **-i** flag or
-**--interactive** option.
+**-\-interactive** option.
# INTERACTIVE MODE
Per the [standard][1], bc(1) has an interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both **stdin** and **stdout**
-are hooked to a terminal, but the **-i** flag and **--interactive** option can
+are hooked to a terminal, but the **-i** flag and **-\-interactive** option can
turn it on in other cases.
In interactive mode, bc(1) attempts to recover from errors (see the **RESET**
diff --git a/contrib/bc/manuals/bc/HN.1 b/contrib/bc/manuals/bc/HN.1
index 6a8dd876db65..fe6043eb69d1 100644
--- a/contrib/bc/manuals/bc/HN.1
+++ b/contrib/bc/manuals/bc/HN.1
@@ -1,7 +1,7 @@
.\"
.\" SPDX-License-Identifier: BSD-2-Clause
.\"
-.\" Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+.\" Copyright (c) 2018-2021 Gavin D. Howard and contributors.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions are met:
@@ -25,19 +25,18 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.TH "BC" "1" "October 2020" "Gavin D. Howard" "General Commands Manual"
+.TH "BC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
.SH NAME
.PP
bc - arbitrary-precision decimal arithmetic language and calculator
.SH SYNOPSIS
.PP
-\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]\[en]global-stacks\f[R]]
-[\f[B]\[en]help\f[R]] [\f[B]\[en]interactive\f[R]]
-[\f[B]\[en]mathlib\f[R]] [\f[B]\[en]no-prompt\f[R]]
-[\f[B]\[en]quiet\f[R]] [\f[B]\[en]standard\f[R]] [\f[B]\[en]warn\f[R]]
-[\f[B]\[en]version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
-[\f[B]\[en]expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
-\f[I]file\f[R]\&...] [\f[B]-file\f[R]=\f[I]file\f[R]\&...]
+\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]--global-stacks\f[R]]
+[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--mathlib\f[R]]
+[\f[B]--no-prompt\f[R]] [\f[B]--quiet\f[R]] [\f[B]--standard\f[R]]
+[\f[B]--warn\f[R]] [\f[B]--version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
+[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
+\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
[\f[I]file\f[R]\&...]
.SH DESCRIPTION
.PP
@@ -55,7 +54,7 @@ the command line and executes them before reading from \f[B]stdin\f[R].
.PP
The following are the options that bc(1) accepts.
.TP
-\f[B]-g\f[R], \f[B]\[en]global-stacks\f[R]
+\f[B]-g\f[R], \f[B]--global-stacks\f[R]
Turns the globals \f[B]ibase\f[R], \f[B]obase\f[R], \f[B]scale\f[R], and
\f[B]seed\f[R] into stacks.
.RS
@@ -147,10 +146,10 @@ is ignored.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-h\f[R], \f[B]\[en]help\f[R]
+\f[B]-h\f[R], \f[B]--help\f[R]
Prints a usage message and quits.
.TP
-\f[B]-i\f[R], \f[B]\[en]interactive\f[R]
+\f[B]-i\f[R], \f[B]--interactive\f[R]
Forces interactive mode.
(See the \f[B]INTERACTIVE MODE\f[R] section.)
.RS
@@ -158,7 +157,7 @@ Forces interactive mode.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-l\f[R], \f[B]\[en]mathlib\f[R]
+\f[B]-l\f[R], \f[B]--mathlib\f[R]
Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to \f[B]20\f[R]
and loads the included math library and the extended math library before
running any code, including any expressions or files specified on the
@@ -168,7 +167,7 @@ command line.
To learn what is in the libraries, see the \f[B]LIBRARY\f[R] section.
.RE
.TP
-\f[B]-P\f[R], \f[B]\[en]no-prompt\f[R]
+\f[B]-P\f[R], \f[B]--no-prompt\f[R]
Disables the prompt in TTY mode.
(The prompt is only enabled in TTY mode.
See the \f[B]TTY MODE\f[R] section) This is mostly for those users that
@@ -180,18 +179,18 @@ Most of those users would want to put this option in
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-q\f[R], \f[B]\[en]quiet\f[R]
+\f[B]-q\f[R], \f[B]--quiet\f[R]
This option is for compatibility with the GNU
bc(1) (https://www.gnu.org/software/bc/); it is a no-op.
Without this option, GNU bc(1) prints a copyright header.
This bc(1) only prints the copyright header if one or more of the
-\f[B]-v\f[R], \f[B]-V\f[R], or \f[B]\[en]version\f[R] options are given.
+\f[B]-v\f[R], \f[B]-V\f[R], or \f[B]--version\f[R] options are given.
.RS
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-s\f[R], \f[B]\[en]standard\f[R]
+\f[B]-s\f[R], \f[B]--standard\f[R]
Process exactly the language defined by the
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
and error if any extensions are used.
@@ -200,15 +199,15 @@ and error if any extensions are used.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-v\f[R], \f[B]-V\f[R], \f[B]\[en]version\f[R]
+\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
Print the version information (copyright header) and exit.
.RS
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-w\f[R], \f[B]\[en]warn\f[R]
-Like \f[B]-s\f[R] and \f[B]\[en]standard\f[R], except that warnings (and
+\f[B]-w\f[R], \f[B]--warn\f[R]
+Like \f[B]-s\f[R] and \f[B]--standard\f[R], except that warnings (and
not errors) are printed for non-standard extensions and execution
continues normally.
.RS
@@ -216,7 +215,7 @@ continues normally.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-e\f[R] \f[I]expr\f[R], \f[B]\[en]expression\f[R]=\f[I]expr\f[R]
+\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
Evaluates \f[I]expr\f[R].
If multiple expressions are given, they are evaluated in order.
If files are given as well (see below), the expressions and files are
@@ -225,26 +224,36 @@ This means that if a file is given before an expression, the file is
read in and evaluated first.
.RS
.PP
-After processing all expressions and files, bc(1) will exit, unless
+If this option is given on the command-line (i.e., not in
+\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
+then after processing all expressions and files, bc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]\[en]file\f[R].
-However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
-\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after that,
-bc(1) will give a fatal error and exit.
+\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
+\f[B]BC_ENV_ARGS\f[R].
+However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
+\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
+\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
+exit.
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-f\f[R] \f[I]file\f[R], \f[B]\[en]file\f[R]=\f[I]file\f[R]
+\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
were read through \f[B]stdin\f[R].
If expressions are also given (see above), the expressions are evaluated
in the order given.
.RS
.PP
-After processing all expressions and files, bc(1) will exit, unless
+If this option is given on the command-line (i.e., not in
+\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
+then after processing all expressions and files, bc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]\[en]file\f[R].
+\f[B]-f\f[R] or \f[B]--file\f[R].
+However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
+\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
+\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
+exit.
.PP
This is a \f[B]non-portable extension\f[R].
.RE
@@ -253,6 +262,9 @@ All long options are \f[B]non-portable extensions\f[R].
.SH STDOUT
.PP
Any non-error output is written to \f[B]stdout\f[R].
+In addition, if history (see the \f[B]HISTORY\f[R] section) and the
+prompt (see the \f[B]TTY MODE\f[R] section) are enabled, both are output
+to \f[B]stdout\f[R].
.PP
\f[B]Note\f[R]: Unlike other bc(1) implementations, this bc(1) will
issue a fatal error (see the \f[B]EXIT STATUS\f[R] section) if it cannot
@@ -304,8 +316,8 @@ constant numbers.
It is the \[lq]input\[rq] base, or the number base used for interpreting
input numbers.
\f[B]ibase\f[R] is initially \f[B]10\f[R].
-If the \f[B]-s\f[R] (\f[B]\[en]standard\f[R]) and \f[B]-w\f[R]
-(\f[B]\[en]warn\f[R]) flags were not given on the command line, the max
+If the \f[B]-s\f[R] (\f[B]--standard\f[R]) and \f[B]-w\f[R]
+(\f[B]--warn\f[R]) flags were not given on the command line, the max
allowable value for \f[B]ibase\f[R] is \f[B]36\f[R].
Otherwise, it is \f[B]16\f[R].
The min allowable value for \f[B]ibase\f[R] is \f[B]2\f[R].
@@ -514,6 +526,10 @@ generator with \f[B]rand()\f[R] and \f[B]irand(E)\f[R] are guaranteed to
This is a consequence of using a seeded pseudo-random number generator.
However, they \f[I]are\f[R] guaranteed to be reproducible with identical
\f[B]seed\f[R] values.
+This means that the pseudo-random values from bc(1) should only be used
+where a reproducible stream of pseudo-random numbers is
+\f[I]ESSENTIAL\f[R].
+In any other case, use a non-seeded pseudo-random number generator.
.SS Numbers
.PP
Numbers are strings made up of digits, uppercase letters, and at most
@@ -560,7 +576,7 @@ The following arithmetic and logical operators can be used.
They are listed in order of decreasing precedence.
Operators in the same group have the same precedence.
.TP
-\f[B]++\f[R] \f[B]\[en]\f[R]
+\f[B]++\f[R] \f[B]--\f[R]
Type: Prefix and Postfix
.RS
.PP
@@ -670,7 +686,7 @@ Description: \f[B]boolean or\f[R]
.PP
The operators will be described in more detail below.
.TP
-\f[B]++\f[R] \f[B]\[en]\f[R]
+\f[B]++\f[R] \f[B]--\f[R]
The prefix and postfix \f[B]increment\f[R] and \f[B]decrement\f[R]
operators behave exactly like they would in C.
They require a named expression (see the \f[I]Named Expressions\f[R]
@@ -1116,7 +1132,7 @@ This is a \f[B]non-portable extension\f[R].
.PP
All of the functions below, including the functions in the extended math
library (see the \f[I]Extended Library\f[R] subsection below), are
-available when the \f[B]-l\f[R] or \f[B]\[en]mathlib\f[R] command-line
+available when the \f[B]-l\f[R] or \f[B]--mathlib\f[R] command-line
flags are given, except that the extended math library is not available
when the \f[B]-s\f[R] option, the \f[B]-w\f[R] option, or equivalents
are given.
@@ -1177,7 +1193,7 @@ Functions\f[R] subsection below).
.SS Extended Library
.PP
The extended library is \f[I]not\f[R] loaded when the
-\f[B]-s\f[R]/\f[B]\[en]standard\f[R] or \f[B]-w\f[R]/\f[B]\[en]warn\f[R]
+\f[B]-s\f[R]/\f[B]--standard\f[R] or \f[B]-w\f[R]/\f[B]--warn\f[R]
options are given since they are not part of the library defined by the
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html).
.PP
@@ -1935,11 +1951,11 @@ interactive mode (see the \f[B]INTERACTIVE MODE\f[R] section), since
bc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
more input when one of those errors occurs in interactive mode.
This is also the case when interactive mode is forced by the
-\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
+\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.PP
These exit statuses allow bc(1) to be used in shell scripting with error
checking, and its normal behavior can be forced by using the
-\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
+\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.SH INTERACTIVE MODE
.PP
Per the
@@ -1947,7 +1963,7 @@ standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html),
bc(1) has an interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both \f[B]stdin\f[R]
and \f[B]stdout\f[R] are hooked to a terminal, but the \f[B]-i\f[R] flag
-and \f[B]\[en]interactive\f[R] option can turn it on in other cases.
+and \f[B]--interactive\f[R] option can turn it on in other cases.
.PP
In interactive mode, bc(1) attempts to recover from errors (see the
\f[B]RESET\f[R] section), and in normal execution, flushes
diff --git a/contrib/bc/manuals/bc/HN.1.md b/contrib/bc/manuals/bc/HN.1.md
index 9cc71c3be057..adf1ffcc29fb 100644
--- a/contrib/bc/manuals/bc/HN.1.md
+++ b/contrib/bc/manuals/bc/HN.1.md
@@ -2,7 +2,7 @@
SPDX-License-Identifier: BSD-2-Clause
-Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+Copyright (c) 2018-2021 Gavin D. Howard and contributors.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
@@ -34,8 +34,7 @@ bc - arbitrary-precision decimal arithmetic language and calculator
# SYNOPSIS
-**bc** [**-ghilPqsvVw**] [**--global-stacks**] [**--help**] [**--interactive**] [**--mathlib**] [**--no-prompt**] [**--quiet**] [**--standard**] [**--warn**] [**--version**] [**-e** *expr*] [**--expression**=*expr*...] [**-f** *file*...] [**-file**=*file*...]
-[*file*...]
+**bc** [**-ghilPqsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@@ -51,7 +50,7 @@ command line and executes them before reading from **stdin**.
The following are the options that bc(1) accepts.
-**-g**, **--global-stacks**
+**-g**, **-\-global-stacks**
: Turns the globals **ibase**, **obase**, **scale**, and **seed** into stacks.
@@ -119,17 +118,17 @@ The following are the options that bc(1) accepts.
This is a **non-portable extension**.
-**-h**, **--help**
+**-h**, **-\-help**
: Prints a usage message and quits.
-**-i**, **--interactive**
+**-i**, **-\-interactive**
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
This is a **non-portable extension**.
-**-l**, **--mathlib**
+**-l**, **-\-mathlib**
: Sets **scale** (see the **SYNTAX** section) to **20** and loads the included
math library and the extended math library before running any code,
@@ -137,7 +136,7 @@ The following are the options that bc(1) accepts.
To learn what is in the libraries, see the **LIBRARY** section.
-**-P**, **--no-prompt**
+**-P**, **-\-no-prompt**
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
See the **TTY MODE** section) This is mostly for those users that do not
@@ -147,57 +146,64 @@ The following are the options that bc(1) accepts.
This is a **non-portable extension**.
-**-q**, **--quiet**
+**-q**, **-\-quiet**
: This option is for compatibility with the [GNU bc(1)][2]; it is a no-op.
Without this option, GNU bc(1) prints a copyright header. This bc(1) only
prints the copyright header if one or more of the **-v**, **-V**, or
- **--version** options are given.
+ **-\-version** options are given.
This is a **non-portable extension**.
-**-s**, **--standard**
+**-s**, **-\-standard**
: Process exactly the language defined by the [standard][1] and error if any
extensions are used.
This is a **non-portable extension**.
-**-v**, **-V**, **--version**
+**-v**, **-V**, **-\-version**
: Print the version information (copyright header) and exit.
This is a **non-portable extension**.
-**-w**, **--warn**
+**-w**, **-\-warn**
-: Like **-s** and **--standard**, except that warnings (and not errors) are
+: Like **-s** and **-\-standard**, except that warnings (and not errors) are
printed for non-standard extensions and execution continues normally.
This is a **non-portable extension**.
-**-e** *expr*, **--expression**=*expr*
+**-e** *expr*, **-\-expression**=*expr*
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
order. If files are given as well (see below), the expressions and files are
evaluated in the order given. This means that if a file is given before an
expression, the file is read in and evaluated first.
- After processing all expressions and files, bc(1) will exit, unless **-**
- (**stdin**) was given as an argument at least once to **-f** or **--file**.
- However, if any other **-e**, **--expression**, **-f**, or **--file**
- arguments are given after that, bc(1) will give a fatal error and exit.
+ If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
+ see the **ENVIRONMENT VARIABLES** section), then after processing all
+ expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
+ as an argument at least once to **-f** or **-\-file**, whether on the
+ command-line or in **BC_ENV_ARGS**. However, if any other **-e**,
+ **-\-expression**, **-f**, or **-\-file** arguments are given after **-f-**
+ or equivalent is given, bc(1) will give a fatal error and exit.
This is a **non-portable extension**.
-**-f** *file*, **--file**=*file*
+**-f** *file*, **-\-file**=*file*
: Reads in *file* and evaluates it, line by line, as though it were read
through **stdin**. If expressions are also given (see above), the
expressions are evaluated in the order given.
- After processing all expressions and files, bc(1) will exit, unless **-**
- (**stdin**) was given as an argument at least once to **-f** or **--file**.
+ If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
+ see the **ENVIRONMENT VARIABLES** section), then after processing all
+ expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
+ as an argument at least once to **-f** or **-\-file**. However, if any other
+ **-e**, **-\-expression**, **-f**, or **-\-file** arguments are given after
+ **-f-** or equivalent is given, bc(1) will give a fatal error and exit.
This is a **non-portable extension**.
@@ -205,7 +211,9 @@ All long options are **non-portable extensions**.
# STDOUT
-Any non-error output is written to **stdout**.
+Any non-error output is written to **stdout**. In addition, if history (see the
+**HISTORY** section) and the prompt (see the **TTY MODE** section) are enabled,
+both are output to **stdout**.
**Note**: Unlike other bc(1) implementations, this bc(1) will issue a fatal
error (see the **EXIT STATUS** section) if it cannot write to **stdout**, so if
@@ -249,8 +257,8 @@ Identifiers with more than one character (letter) are a
**ibase** is a global variable determining how to interpret constant numbers. It
is the "input" base, or the number base used for interpreting input numbers.
-**ibase** is initially **10**. If the **-s** (**--standard**) and **-w**
-(**--warn**) flags were not given on the command line, the max allowable value
+**ibase** is initially **10**. If the **-s** (**-\-standard**) and **-w**
+(**-\-warn**) flags were not given on the command line, the max allowable value
for **ibase** is **36**. Otherwise, it is **16**. The min allowable value for
**ibase** is **2**. The max allowable value for **ibase** can be queried in
bc(1) programs with the **maxibase()** built-in function.
@@ -399,7 +407,10 @@ generator.
**Note**: The values returned by the pseudo-random number generator with
**rand()** and **irand(E)** are guaranteed to *NOT* be cryptographically secure.
This is a consequence of using a seeded pseudo-random number generator. However,
-they *are* guaranteed to be reproducible with identical **seed** values.
+they *are* guaranteed to be reproducible with identical **seed** values. This
+means that the pseudo-random values from bc(1) should only be used where a
+reproducible stream of pseudo-random numbers is *ESSENTIAL*. In any other case,
+use a non-seeded pseudo-random number generator.
## Numbers
@@ -437,7 +448,7 @@ The following arithmetic and logical operators can be used. They are listed in
order of decreasing precedence. Operators in the same group have the same
precedence.
-**++** **--**
+**++** **-\-**
: Type: Prefix and Postfix
@@ -535,7 +546,7 @@ precedence.
The operators will be described in more detail below.
-**++** **--**
+**++** **-\-**
: The prefix and postfix **increment** and **decrement** operators behave
exactly like they would in C. They require a named expression (see the
@@ -866,7 +877,7 @@ This is a **non-portable extension**.
All of the functions below, including the functions in the extended math
library (see the *Extended Library* subsection below), are available when the
-**-l** or **--mathlib** command-line flags are given, except that the extended
+**-l** or **-\-mathlib** command-line flags are given, except that the extended
math library is not available when the **-s** option, the **-w** option, or
equivalents are given.
@@ -918,8 +929,8 @@ The [standard][1] defines the following functions for the math library:
## Extended Library
-The extended library is *not* loaded when the **-s**/**--standard** or
-**-w**/**--warn** options are given since they are not part of the library
+The extended library is *not* loaded when the **-s**/**-\-standard** or
+**-w**/**-\-warn** options are given since they are not part of the library
defined by the [standard][1].
The extended library is a **non-portable extension**.
@@ -1587,17 +1598,17 @@ The other statuses will only be returned when bc(1) is not in interactive mode
(see the **INTERACTIVE MODE** section), since bc(1) resets its state (see the
**RESET** section) and accepts more input when one of those errors occurs in
interactive mode. This is also the case when interactive mode is forced by the
-**-i** flag or **--interactive** option.
+**-i** flag or **-\-interactive** option.
These exit statuses allow bc(1) to be used in shell scripting with error
checking, and its normal behavior can be forced by using the **-i** flag or
-**--interactive** option.
+**-\-interactive** option.
# INTERACTIVE MODE
Per the [standard][1], bc(1) has an interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both **stdin** and **stdout**
-are hooked to a terminal, but the **-i** flag and **--interactive** option can
+are hooked to a terminal, but the **-i** flag and **-\-interactive** option can
turn it on in other cases.
In interactive mode, bc(1) attempts to recover from errors (see the **RESET**
diff --git a/contrib/bc/manuals/bc/HNP.1 b/contrib/bc/manuals/bc/HNP.1
index 30a8b00a5009..f407050515b2 100644
--- a/contrib/bc/manuals/bc/HNP.1
+++ b/contrib/bc/manuals/bc/HNP.1
@@ -1,7 +1,7 @@
.\"
.\" SPDX-License-Identifier: BSD-2-Clause
.\"
-.\" Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+.\" Copyright (c) 2018-2021 Gavin D. Howard and contributors.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions are met:
@@ -25,19 +25,18 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.TH "BC" "1" "October 2020" "Gavin D. Howard" "General Commands Manual"
+.TH "BC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
.SH NAME
.PP
bc - arbitrary-precision decimal arithmetic language and calculator
.SH SYNOPSIS
.PP
-\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]\[en]global-stacks\f[R]]
-[\f[B]\[en]help\f[R]] [\f[B]\[en]interactive\f[R]]
-[\f[B]\[en]mathlib\f[R]] [\f[B]\[en]no-prompt\f[R]]
-[\f[B]\[en]quiet\f[R]] [\f[B]\[en]standard\f[R]] [\f[B]\[en]warn\f[R]]
-[\f[B]\[en]version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
-[\f[B]\[en]expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
-\f[I]file\f[R]\&...] [\f[B]-file\f[R]=\f[I]file\f[R]\&...]
+\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]--global-stacks\f[R]]
+[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--mathlib\f[R]]
+[\f[B]--no-prompt\f[R]] [\f[B]--quiet\f[R]] [\f[B]--standard\f[R]]
+[\f[B]--warn\f[R]] [\f[B]--version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
+[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
+\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
[\f[I]file\f[R]\&...]
.SH DESCRIPTION
.PP
@@ -55,7 +54,7 @@ the command line and executes them before reading from \f[B]stdin\f[R].
.PP
The following are the options that bc(1) accepts.
.TP
-\f[B]-g\f[R], \f[B]\[en]global-stacks\f[R]
+\f[B]-g\f[R], \f[B]--global-stacks\f[R]
Turns the globals \f[B]ibase\f[R], \f[B]obase\f[R], \f[B]scale\f[R], and
\f[B]seed\f[R] into stacks.
.RS
@@ -147,10 +146,10 @@ is ignored.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-h\f[R], \f[B]\[en]help\f[R]
+\f[B]-h\f[R], \f[B]--help\f[R]
Prints a usage message and quits.
.TP
-\f[B]-i\f[R], \f[B]\[en]interactive\f[R]
+\f[B]-i\f[R], \f[B]--interactive\f[R]
Forces interactive mode.
(See the \f[B]INTERACTIVE MODE\f[R] section.)
.RS
@@ -158,7 +157,7 @@ Forces interactive mode.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-l\f[R], \f[B]\[en]mathlib\f[R]
+\f[B]-l\f[R], \f[B]--mathlib\f[R]
Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to \f[B]20\f[R]
and loads the included math library and the extended math library before
running any code, including any expressions or files specified on the
@@ -168,25 +167,25 @@ command line.
To learn what is in the libraries, see the \f[B]LIBRARY\f[R] section.
.RE
.TP
-\f[B]-P\f[R], \f[B]\[en]no-prompt\f[R]
+\f[B]-P\f[R], \f[B]--no-prompt\f[R]
This option is a no-op.
.RS
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-q\f[R], \f[B]\[en]quiet\f[R]
+\f[B]-q\f[R], \f[B]--quiet\f[R]
This option is for compatibility with the GNU
bc(1) (https://www.gnu.org/software/bc/); it is a no-op.
Without this option, GNU bc(1) prints a copyright header.
This bc(1) only prints the copyright header if one or more of the
-\f[B]-v\f[R], \f[B]-V\f[R], or \f[B]\[en]version\f[R] options are given.
+\f[B]-v\f[R], \f[B]-V\f[R], or \f[B]--version\f[R] options are given.
.RS
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-s\f[R], \f[B]\[en]standard\f[R]
+\f[B]-s\f[R], \f[B]--standard\f[R]
Process exactly the language defined by the
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
and error if any extensions are used.
@@ -195,15 +194,15 @@ and error if any extensions are used.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-v\f[R], \f[B]-V\f[R], \f[B]\[en]version\f[R]
+\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
Print the version information (copyright header) and exit.
.RS
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-w\f[R], \f[B]\[en]warn\f[R]
-Like \f[B]-s\f[R] and \f[B]\[en]standard\f[R], except that warnings (and
+\f[B]-w\f[R], \f[B]--warn\f[R]
+Like \f[B]-s\f[R] and \f[B]--standard\f[R], except that warnings (and
not errors) are printed for non-standard extensions and execution
continues normally.
.RS
@@ -211,7 +210,7 @@ continues normally.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-e\f[R] \f[I]expr\f[R], \f[B]\[en]expression\f[R]=\f[I]expr\f[R]
+\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
Evaluates \f[I]expr\f[R].
If multiple expressions are given, they are evaluated in order.
If files are given as well (see below), the expressions and files are
@@ -220,26 +219,36 @@ This means that if a file is given before an expression, the file is
read in and evaluated first.
.RS
.PP
-After processing all expressions and files, bc(1) will exit, unless
+If this option is given on the command-line (i.e., not in
+\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
+then after processing all expressions and files, bc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]\[en]file\f[R].
-However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
-\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after that,
-bc(1) will give a fatal error and exit.
+\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
+\f[B]BC_ENV_ARGS\f[R].
+However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
+\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
+\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
+exit.
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-f\f[R] \f[I]file\f[R], \f[B]\[en]file\f[R]=\f[I]file\f[R]
+\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
were read through \f[B]stdin\f[R].
If expressions are also given (see above), the expressions are evaluated
in the order given.
.RS
.PP
-After processing all expressions and files, bc(1) will exit, unless
+If this option is given on the command-line (i.e., not in
+\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
+then after processing all expressions and files, bc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]\[en]file\f[R].
+\f[B]-f\f[R] or \f[B]--file\f[R].
+However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
+\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
+\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
+exit.
.PP
This is a \f[B]non-portable extension\f[R].
.RE
@@ -248,6 +257,9 @@ All long options are \f[B]non-portable extensions\f[R].
.SH STDOUT
.PP
Any non-error output is written to \f[B]stdout\f[R].
+In addition, if history (see the \f[B]HISTORY\f[R] section) and the
+prompt (see the \f[B]TTY MODE\f[R] section) are enabled, both are output
+to \f[B]stdout\f[R].
.PP
\f[B]Note\f[R]: Unlike other bc(1) implementations, this bc(1) will
issue a fatal error (see the \f[B]EXIT STATUS\f[R] section) if it cannot
@@ -299,8 +311,8 @@ constant numbers.
It is the \[lq]input\[rq] base, or the number base used for interpreting
input numbers.
\f[B]ibase\f[R] is initially \f[B]10\f[R].
-If the \f[B]-s\f[R] (\f[B]\[en]standard\f[R]) and \f[B]-w\f[R]
-(\f[B]\[en]warn\f[R]) flags were not given on the command line, the max
+If the \f[B]-s\f[R] (\f[B]--standard\f[R]) and \f[B]-w\f[R]
+(\f[B]--warn\f[R]) flags were not given on the command line, the max
allowable value for \f[B]ibase\f[R] is \f[B]36\f[R].
Otherwise, it is \f[B]16\f[R].
The min allowable value for \f[B]ibase\f[R] is \f[B]2\f[R].
@@ -509,6 +521,10 @@ generator with \f[B]rand()\f[R] and \f[B]irand(E)\f[R] are guaranteed to
This is a consequence of using a seeded pseudo-random number generator.
However, they \f[I]are\f[R] guaranteed to be reproducible with identical
\f[B]seed\f[R] values.
+This means that the pseudo-random values from bc(1) should only be used
+where a reproducible stream of pseudo-random numbers is
+\f[I]ESSENTIAL\f[R].
+In any other case, use a non-seeded pseudo-random number generator.
.SS Numbers
.PP
Numbers are strings made up of digits, uppercase letters, and at most
@@ -555,7 +571,7 @@ The following arithmetic and logical operators can be used.
They are listed in order of decreasing precedence.
Operators in the same group have the same precedence.
.TP
-\f[B]++\f[R] \f[B]\[en]\f[R]
+\f[B]++\f[R] \f[B]--\f[R]
Type: Prefix and Postfix
.RS
.PP
@@ -665,7 +681,7 @@ Description: \f[B]boolean or\f[R]
.PP
The operators will be described in more detail below.
.TP
-\f[B]++\f[R] \f[B]\[en]\f[R]
+\f[B]++\f[R] \f[B]--\f[R]
The prefix and postfix \f[B]increment\f[R] and \f[B]decrement\f[R]
operators behave exactly like they would in C.
They require a named expression (see the \f[I]Named Expressions\f[R]
@@ -1111,7 +1127,7 @@ This is a \f[B]non-portable extension\f[R].
.PP
All of the functions below, including the functions in the extended math
library (see the \f[I]Extended Library\f[R] subsection below), are
-available when the \f[B]-l\f[R] or \f[B]\[en]mathlib\f[R] command-line
+available when the \f[B]-l\f[R] or \f[B]--mathlib\f[R] command-line
flags are given, except that the extended math library is not available
when the \f[B]-s\f[R] option, the \f[B]-w\f[R] option, or equivalents
are given.
@@ -1172,7 +1188,7 @@ Functions\f[R] subsection below).
.SS Extended Library
.PP
The extended library is \f[I]not\f[R] loaded when the
-\f[B]-s\f[R]/\f[B]\[en]standard\f[R] or \f[B]-w\f[R]/\f[B]\[en]warn\f[R]
+\f[B]-s\f[R]/\f[B]--standard\f[R] or \f[B]-w\f[R]/\f[B]--warn\f[R]
options are given since they are not part of the library defined by the
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html).
.PP
@@ -1930,11 +1946,11 @@ interactive mode (see the \f[B]INTERACTIVE MODE\f[R] section), since
bc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
more input when one of those errors occurs in interactive mode.
This is also the case when interactive mode is forced by the
-\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
+\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.PP
These exit statuses allow bc(1) to be used in shell scripting with error
checking, and its normal behavior can be forced by using the
-\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
+\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.SH INTERACTIVE MODE
.PP
Per the
@@ -1942,7 +1958,7 @@ standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html),
bc(1) has an interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both \f[B]stdin\f[R]
and \f[B]stdout\f[R] are hooked to a terminal, but the \f[B]-i\f[R] flag
-and \f[B]\[en]interactive\f[R] option can turn it on in other cases.
+and \f[B]--interactive\f[R] option can turn it on in other cases.
.PP
In interactive mode, bc(1) attempts to recover from errors (see the
\f[B]RESET\f[R] section), and in normal execution, flushes
diff --git a/contrib/bc/manuals/bc/HNP.1.md b/contrib/bc/manuals/bc/HNP.1.md
index 0425073d1c08..cd6d2c4836e9 100644
--- a/contrib/bc/manuals/bc/HNP.1.md
+++ b/contrib/bc/manuals/bc/HNP.1.md
@@ -2,7 +2,7 @@
SPDX-License-Identifier: BSD-2-Clause
-Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+Copyright (c) 2018-2021 Gavin D. Howard and contributors.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
@@ -34,8 +34,7 @@ bc - arbitrary-precision decimal arithmetic language and calculator
# SYNOPSIS
-**bc** [**-ghilPqsvVw**] [**--global-stacks**] [**--help**] [**--interactive**] [**--mathlib**] [**--no-prompt**] [**--quiet**] [**--standard**] [**--warn**] [**--version**] [**-e** *expr*] [**--expression**=*expr*...] [**-f** *file*...] [**-file**=*file*...]
-[*file*...]
+**bc** [**-ghilPqsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@@ -51,7 +50,7 @@ command line and executes them before reading from **stdin**.
The following are the options that bc(1) accepts.
-**-g**, **--global-stacks**
+**-g**, **-\-global-stacks**
: Turns the globals **ibase**, **obase**, **scale**, and **seed** into stacks.
@@ -119,17 +118,17 @@ The following are the options that bc(1) accepts.
This is a **non-portable extension**.
-**-h**, **--help**
+**-h**, **-\-help**
: Prints a usage message and quits.
-**-i**, **--interactive**
+**-i**, **-\-interactive**
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
This is a **non-portable extension**.
-**-l**, **--mathlib**
+**-l**, **-\-mathlib**
: Sets **scale** (see the **SYNTAX** section) to **20** and loads the included
math library and the extended math library before running any code,
@@ -137,63 +136,70 @@ The following are the options that bc(1) accepts.
To learn what is in the libraries, see the **LIBRARY** section.
-**-P**, **--no-prompt**
+**-P**, **-\-no-prompt**
: This option is a no-op.
This is a **non-portable extension**.
-**-q**, **--quiet**
+**-q**, **-\-quiet**
: This option is for compatibility with the [GNU bc(1)][2]; it is a no-op.
Without this option, GNU bc(1) prints a copyright header. This bc(1) only
prints the copyright header if one or more of the **-v**, **-V**, or
- **--version** options are given.
+ **-\-version** options are given.
This is a **non-portable extension**.
-**-s**, **--standard**
+**-s**, **-\-standard**
: Process exactly the language defined by the [standard][1] and error if any
extensions are used.
This is a **non-portable extension**.
-**-v**, **-V**, **--version**
+**-v**, **-V**, **-\-version**
: Print the version information (copyright header) and exit.
This is a **non-portable extension**.
-**-w**, **--warn**
+**-w**, **-\-warn**
-: Like **-s** and **--standard**, except that warnings (and not errors) are
+: Like **-s** and **-\-standard**, except that warnings (and not errors) are
printed for non-standard extensions and execution continues normally.
This is a **non-portable extension**.
-**-e** *expr*, **--expression**=*expr*
+**-e** *expr*, **-\-expression**=*expr*
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
order. If files are given as well (see below), the expressions and files are
evaluated in the order given. This means that if a file is given before an
expression, the file is read in and evaluated first.
- After processing all expressions and files, bc(1) will exit, unless **-**
- (**stdin**) was given as an argument at least once to **-f** or **--file**.
- However, if any other **-e**, **--expression**, **-f**, or **--file**
- arguments are given after that, bc(1) will give a fatal error and exit.
+ If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
+ see the **ENVIRONMENT VARIABLES** section), then after processing all
+ expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
+ as an argument at least once to **-f** or **-\-file**, whether on the
+ command-line or in **BC_ENV_ARGS**. However, if any other **-e**,
+ **-\-expression**, **-f**, or **-\-file** arguments are given after **-f-**
+ or equivalent is given, bc(1) will give a fatal error and exit.
This is a **non-portable extension**.
-**-f** *file*, **--file**=*file*
+**-f** *file*, **-\-file**=*file*
: Reads in *file* and evaluates it, line by line, as though it were read
through **stdin**. If expressions are also given (see above), the
expressions are evaluated in the order given.
- After processing all expressions and files, bc(1) will exit, unless **-**
- (**stdin**) was given as an argument at least once to **-f** or **--file**.
+ If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
+ see the **ENVIRONMENT VARIABLES** section), then after processing all
+ expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
+ as an argument at least once to **-f** or **-\-file**. However, if any other
+ **-e**, **-\-expression**, **-f**, or **-\-file** arguments are given after
+ **-f-** or equivalent is given, bc(1) will give a fatal error and exit.
This is a **non-portable extension**.
@@ -201,7 +207,9 @@ All long options are **non-portable extensions**.
# STDOUT
-Any non-error output is written to **stdout**.
+Any non-error output is written to **stdout**. In addition, if history (see the
+**HISTORY** section) and the prompt (see the **TTY MODE** section) are enabled,
+both are output to **stdout**.
**Note**: Unlike other bc(1) implementations, this bc(1) will issue a fatal
error (see the **EXIT STATUS** section) if it cannot write to **stdout**, so if
@@ -245,8 +253,8 @@ Identifiers with more than one character (letter) are a
**ibase** is a global variable determining how to interpret constant numbers. It
is the "input" base, or the number base used for interpreting input numbers.
-**ibase** is initially **10**. If the **-s** (**--standard**) and **-w**
-(**--warn**) flags were not given on the command line, the max allowable value
+**ibase** is initially **10**. If the **-s** (**-\-standard**) and **-w**
+(**-\-warn**) flags were not given on the command line, the max allowable value
for **ibase** is **36**. Otherwise, it is **16**. The min allowable value for
**ibase** is **2**. The max allowable value for **ibase** can be queried in
bc(1) programs with the **maxibase()** built-in function.
@@ -395,7 +403,10 @@ generator.
**Note**: The values returned by the pseudo-random number generator with
**rand()** and **irand(E)** are guaranteed to *NOT* be cryptographically secure.
This is a consequence of using a seeded pseudo-random number generator. However,
-they *are* guaranteed to be reproducible with identical **seed** values.
+they *are* guaranteed to be reproducible with identical **seed** values. This
+means that the pseudo-random values from bc(1) should only be used where a
+reproducible stream of pseudo-random numbers is *ESSENTIAL*. In any other case,
+use a non-seeded pseudo-random number generator.
## Numbers
@@ -433,7 +444,7 @@ The following arithmetic and logical operators can be used. They are listed in
order of decreasing precedence. Operators in the same group have the same
precedence.
-**++** **--**
+**++** **-\-**
: Type: Prefix and Postfix
@@ -531,7 +542,7 @@ precedence.
The operators will be described in more detail below.
-**++** **--**
+**++** **-\-**
: The prefix and postfix **increment** and **decrement** operators behave
exactly like they would in C. They require a named expression (see the
@@ -862,7 +873,7 @@ This is a **non-portable extension**.
All of the functions below, including the functions in the extended math
library (see the *Extended Library* subsection below), are available when the
-**-l** or **--mathlib** command-line flags are given, except that the extended
+**-l** or **-\-mathlib** command-line flags are given, except that the extended
math library is not available when the **-s** option, the **-w** option, or
equivalents are given.
@@ -914,8 +925,8 @@ The [standard][1] defines the following functions for the math library:
## Extended Library
-The extended library is *not* loaded when the **-s**/**--standard** or
-**-w**/**--warn** options are given since they are not part of the library
+The extended library is *not* loaded when the **-s**/**-\-standard** or
+**-w**/**-\-warn** options are given since they are not part of the library
defined by the [standard][1].
The extended library is a **non-portable extension**.
@@ -1583,17 +1594,17 @@ The other statuses will only be returned when bc(1) is not in interactive mode
(see the **INTERACTIVE MODE** section), since bc(1) resets its state (see the
**RESET** section) and accepts more input when one of those errors occurs in
interactive mode. This is also the case when interactive mode is forced by the
-**-i** flag or **--interactive** option.
+**-i** flag or **-\-interactive** option.
These exit statuses allow bc(1) to be used in shell scripting with error
checking, and its normal behavior can be forced by using the **-i** flag or
-**--interactive** option.
+**-\-interactive** option.
# INTERACTIVE MODE
Per the [standard][1], bc(1) has an interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both **stdin** and **stdout**
-are hooked to a terminal, but the **-i** flag and **--interactive** option can
+are hooked to a terminal, but the **-i** flag and **-\-interactive** option can
turn it on in other cases.
In interactive mode, bc(1) attempts to recover from errors (see the **RESET**
diff --git a/contrib/bc/manuals/bc/HP.1 b/contrib/bc/manuals/bc/HP.1
index 2ece4e38cbd1..33293307f8f3 100644
--- a/contrib/bc/manuals/bc/HP.1
+++ b/contrib/bc/manuals/bc/HP.1
@@ -1,7 +1,7 @@
.\"
.\" SPDX-License-Identifier: BSD-2-Clause
.\"
-.\" Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+.\" Copyright (c) 2018-2021 Gavin D. Howard and contributors.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions are met:
@@ -25,19 +25,18 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.TH "BC" "1" "October 2020" "Gavin D. Howard" "General Commands Manual"
+.TH "BC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
.SH NAME
.PP
bc - arbitrary-precision decimal arithmetic language and calculator
.SH SYNOPSIS
.PP
-\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]\[en]global-stacks\f[R]]
-[\f[B]\[en]help\f[R]] [\f[B]\[en]interactive\f[R]]
-[\f[B]\[en]mathlib\f[R]] [\f[B]\[en]no-prompt\f[R]]
-[\f[B]\[en]quiet\f[R]] [\f[B]\[en]standard\f[R]] [\f[B]\[en]warn\f[R]]
-[\f[B]\[en]version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
-[\f[B]\[en]expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
-\f[I]file\f[R]\&...] [\f[B]-file\f[R]=\f[I]file\f[R]\&...]
+\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]--global-stacks\f[R]]
+[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--mathlib\f[R]]
+[\f[B]--no-prompt\f[R]] [\f[B]--quiet\f[R]] [\f[B]--standard\f[R]]
+[\f[B]--warn\f[R]] [\f[B]--version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
+[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
+\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
[\f[I]file\f[R]\&...]
.SH DESCRIPTION
.PP
@@ -55,7 +54,7 @@ the command line and executes them before reading from \f[B]stdin\f[R].
.PP
The following are the options that bc(1) accepts.
.TP
-\f[B]-g\f[R], \f[B]\[en]global-stacks\f[R]
+\f[B]-g\f[R], \f[B]--global-stacks\f[R]
Turns the globals \f[B]ibase\f[R], \f[B]obase\f[R], \f[B]scale\f[R], and
\f[B]seed\f[R] into stacks.
.RS
@@ -147,10 +146,10 @@ is ignored.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-h\f[R], \f[B]\[en]help\f[R]
+\f[B]-h\f[R], \f[B]--help\f[R]
Prints a usage message and quits.
.TP
-\f[B]-i\f[R], \f[B]\[en]interactive\f[R]
+\f[B]-i\f[R], \f[B]--interactive\f[R]
Forces interactive mode.
(See the \f[B]INTERACTIVE MODE\f[R] section.)
.RS
@@ -158,7 +157,7 @@ Forces interactive mode.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-l\f[R], \f[B]\[en]mathlib\f[R]
+\f[B]-l\f[R], \f[B]--mathlib\f[R]
Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to \f[B]20\f[R]
and loads the included math library and the extended math library before
running any code, including any expressions or files specified on the
@@ -168,25 +167,25 @@ command line.
To learn what is in the libraries, see the \f[B]LIBRARY\f[R] section.
.RE
.TP
-\f[B]-P\f[R], \f[B]\[en]no-prompt\f[R]
+\f[B]-P\f[R], \f[B]--no-prompt\f[R]
This option is a no-op.
.RS
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-q\f[R], \f[B]\[en]quiet\f[R]
+\f[B]-q\f[R], \f[B]--quiet\f[R]
This option is for compatibility with the GNU
bc(1) (https://www.gnu.org/software/bc/); it is a no-op.
Without this option, GNU bc(1) prints a copyright header.
This bc(1) only prints the copyright header if one or more of the
-\f[B]-v\f[R], \f[B]-V\f[R], or \f[B]\[en]version\f[R] options are given.
+\f[B]-v\f[R], \f[B]-V\f[R], or \f[B]--version\f[R] options are given.
.RS
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-s\f[R], \f[B]\[en]standard\f[R]
+\f[B]-s\f[R], \f[B]--standard\f[R]
Process exactly the language defined by the
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
and error if any extensions are used.
@@ -195,15 +194,15 @@ and error if any extensions are used.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-v\f[R], \f[B]-V\f[R], \f[B]\[en]version\f[R]
+\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
Print the version information (copyright header) and exit.
.RS
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-w\f[R], \f[B]\[en]warn\f[R]
-Like \f[B]-s\f[R] and \f[B]\[en]standard\f[R], except that warnings (and
+\f[B]-w\f[R], \f[B]--warn\f[R]
+Like \f[B]-s\f[R] and \f[B]--standard\f[R], except that warnings (and
not errors) are printed for non-standard extensions and execution
continues normally.
.RS
@@ -211,7 +210,7 @@ continues normally.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-e\f[R] \f[I]expr\f[R], \f[B]\[en]expression\f[R]=\f[I]expr\f[R]
+\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
Evaluates \f[I]expr\f[R].
If multiple expressions are given, they are evaluated in order.
If files are given as well (see below), the expressions and files are
@@ -220,26 +219,36 @@ This means that if a file is given before an expression, the file is
read in and evaluated first.
.RS
.PP
-After processing all expressions and files, bc(1) will exit, unless
+If this option is given on the command-line (i.e., not in
+\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
+then after processing all expressions and files, bc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]\[en]file\f[R].
-However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
-\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after that,
-bc(1) will give a fatal error and exit.
+\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
+\f[B]BC_ENV_ARGS\f[R].
+However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
+\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
+\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
+exit.
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-f\f[R] \f[I]file\f[R], \f[B]\[en]file\f[R]=\f[I]file\f[R]
+\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
were read through \f[B]stdin\f[R].
If expressions are also given (see above), the expressions are evaluated
in the order given.
.RS
.PP
-After processing all expressions and files, bc(1) will exit, unless
+If this option is given on the command-line (i.e., not in
+\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
+then after processing all expressions and files, bc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]\[en]file\f[R].
+\f[B]-f\f[R] or \f[B]--file\f[R].
+However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
+\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
+\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
+exit.
.PP
This is a \f[B]non-portable extension\f[R].
.RE
@@ -248,6 +257,9 @@ All long options are \f[B]non-portable extensions\f[R].
.SH STDOUT
.PP
Any non-error output is written to \f[B]stdout\f[R].
+In addition, if history (see the \f[B]HISTORY\f[R] section) and the
+prompt (see the \f[B]TTY MODE\f[R] section) are enabled, both are output
+to \f[B]stdout\f[R].
.PP
\f[B]Note\f[R]: Unlike other bc(1) implementations, this bc(1) will
issue a fatal error (see the \f[B]EXIT STATUS\f[R] section) if it cannot
@@ -299,8 +311,8 @@ constant numbers.
It is the \[lq]input\[rq] base, or the number base used for interpreting
input numbers.
\f[B]ibase\f[R] is initially \f[B]10\f[R].
-If the \f[B]-s\f[R] (\f[B]\[en]standard\f[R]) and \f[B]-w\f[R]
-(\f[B]\[en]warn\f[R]) flags were not given on the command line, the max
+If the \f[B]-s\f[R] (\f[B]--standard\f[R]) and \f[B]-w\f[R]
+(\f[B]--warn\f[R]) flags were not given on the command line, the max
allowable value for \f[B]ibase\f[R] is \f[B]36\f[R].
Otherwise, it is \f[B]16\f[R].
The min allowable value for \f[B]ibase\f[R] is \f[B]2\f[R].
@@ -509,6 +521,10 @@ generator with \f[B]rand()\f[R] and \f[B]irand(E)\f[R] are guaranteed to
This is a consequence of using a seeded pseudo-random number generator.
However, they \f[I]are\f[R] guaranteed to be reproducible with identical
\f[B]seed\f[R] values.
+This means that the pseudo-random values from bc(1) should only be used
+where a reproducible stream of pseudo-random numbers is
+\f[I]ESSENTIAL\f[R].
+In any other case, use a non-seeded pseudo-random number generator.
.SS Numbers
.PP
Numbers are strings made up of digits, uppercase letters, and at most
@@ -555,7 +571,7 @@ The following arithmetic and logical operators can be used.
They are listed in order of decreasing precedence.
Operators in the same group have the same precedence.
.TP
-\f[B]++\f[R] \f[B]\[en]\f[R]
+\f[B]++\f[R] \f[B]--\f[R]
Type: Prefix and Postfix
.RS
.PP
@@ -665,7 +681,7 @@ Description: \f[B]boolean or\f[R]
.PP
The operators will be described in more detail below.
.TP
-\f[B]++\f[R] \f[B]\[en]\f[R]
+\f[B]++\f[R] \f[B]--\f[R]
The prefix and postfix \f[B]increment\f[R] and \f[B]decrement\f[R]
operators behave exactly like they would in C.
They require a named expression (see the \f[I]Named Expressions\f[R]
@@ -1111,7 +1127,7 @@ This is a \f[B]non-portable extension\f[R].
.PP
All of the functions below, including the functions in the extended math
library (see the \f[I]Extended Library\f[R] subsection below), are
-available when the \f[B]-l\f[R] or \f[B]\[en]mathlib\f[R] command-line
+available when the \f[B]-l\f[R] or \f[B]--mathlib\f[R] command-line
flags are given, except that the extended math library is not available
when the \f[B]-s\f[R] option, the \f[B]-w\f[R] option, or equivalents
are given.
@@ -1172,7 +1188,7 @@ Functions\f[R] subsection below).
.SS Extended Library
.PP
The extended library is \f[I]not\f[R] loaded when the
-\f[B]-s\f[R]/\f[B]\[en]standard\f[R] or \f[B]-w\f[R]/\f[B]\[en]warn\f[R]
+\f[B]-s\f[R]/\f[B]--standard\f[R] or \f[B]-w\f[R]/\f[B]--warn\f[R]
options are given since they are not part of the library defined by the
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html).
.PP
@@ -1930,11 +1946,11 @@ interactive mode (see the \f[B]INTERACTIVE MODE\f[R] section), since
bc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
more input when one of those errors occurs in interactive mode.
This is also the case when interactive mode is forced by the
-\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
+\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.PP
These exit statuses allow bc(1) to be used in shell scripting with error
checking, and its normal behavior can be forced by using the
-\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
+\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.SH INTERACTIVE MODE
.PP
Per the
@@ -1942,7 +1958,7 @@ standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html),
bc(1) has an interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both \f[B]stdin\f[R]
and \f[B]stdout\f[R] are hooked to a terminal, but the \f[B]-i\f[R] flag
-and \f[B]\[en]interactive\f[R] option can turn it on in other cases.
+and \f[B]--interactive\f[R] option can turn it on in other cases.
.PP
In interactive mode, bc(1) attempts to recover from errors (see the
\f[B]RESET\f[R] section), and in normal execution, flushes
diff --git a/contrib/bc/manuals/bc/HP.1.md b/contrib/bc/manuals/bc/HP.1.md
index 482f1a482734..7273a346b758 100644
--- a/contrib/bc/manuals/bc/HP.1.md
+++ b/contrib/bc/manuals/bc/HP.1.md
@@ -2,7 +2,7 @@
SPDX-License-Identifier: BSD-2-Clause
-Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+Copyright (c) 2018-2021 Gavin D. Howard and contributors.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
@@ -34,8 +34,7 @@ bc - arbitrary-precision decimal arithmetic language and calculator
# SYNOPSIS
-**bc** [**-ghilPqsvVw**] [**--global-stacks**] [**--help**] [**--interactive**] [**--mathlib**] [**--no-prompt**] [**--quiet**] [**--standard**] [**--warn**] [**--version**] [**-e** *expr*] [**--expression**=*expr*...] [**-f** *file*...] [**-file**=*file*...]
-[*file*...]
+**bc** [**-ghilPqsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@@ -51,7 +50,7 @@ command line and executes them before reading from **stdin**.
The following are the options that bc(1) accepts.
-**-g**, **--global-stacks**
+**-g**, **-\-global-stacks**
: Turns the globals **ibase**, **obase**, **scale**, and **seed** into stacks.
@@ -119,17 +118,17 @@ The following are the options that bc(1) accepts.
This is a **non-portable extension**.
-**-h**, **--help**
+**-h**, **-\-help**
: Prints a usage message and quits.
-**-i**, **--interactive**
+**-i**, **-\-interactive**
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
This is a **non-portable extension**.
-**-l**, **--mathlib**
+**-l**, **-\-mathlib**
: Sets **scale** (see the **SYNTAX** section) to **20** and loads the included
math library and the extended math library before running any code,
@@ -137,63 +136,70 @@ The following are the options that bc(1) accepts.
To learn what is in the libraries, see the **LIBRARY** section.
-**-P**, **--no-prompt**
+**-P**, **-\-no-prompt**
: This option is a no-op.
This is a **non-portable extension**.
-**-q**, **--quiet**
+**-q**, **-\-quiet**
: This option is for compatibility with the [GNU bc(1)][2]; it is a no-op.
Without this option, GNU bc(1) prints a copyright header. This bc(1) only
prints the copyright header if one or more of the **-v**, **-V**, or
- **--version** options are given.
+ **-\-version** options are given.
This is a **non-portable extension**.
-**-s**, **--standard**
+**-s**, **-\-standard**
: Process exactly the language defined by the [standard][1] and error if any
extensions are used.
This is a **non-portable extension**.
-**-v**, **-V**, **--version**
+**-v**, **-V**, **-\-version**
: Print the version information (copyright header) and exit.
This is a **non-portable extension**.
-**-w**, **--warn**
+**-w**, **-\-warn**
-: Like **-s** and **--standard**, except that warnings (and not errors) are
+: Like **-s** and **-\-standard**, except that warnings (and not errors) are
printed for non-standard extensions and execution continues normally.
This is a **non-portable extension**.
-**-e** *expr*, **--expression**=*expr*
+**-e** *expr*, **-\-expression**=*expr*
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
order. If files are given as well (see below), the expressions and files are
evaluated in the order given. This means that if a file is given before an
expression, the file is read in and evaluated first.
- After processing all expressions and files, bc(1) will exit, unless **-**
- (**stdin**) was given as an argument at least once to **-f** or **--file**.
- However, if any other **-e**, **--expression**, **-f**, or **--file**
- arguments are given after that, bc(1) will give a fatal error and exit.
+ If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
+ see the **ENVIRONMENT VARIABLES** section), then after processing all
+ expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
+ as an argument at least once to **-f** or **-\-file**, whether on the
+ command-line or in **BC_ENV_ARGS**. However, if any other **-e**,
+ **-\-expression**, **-f**, or **-\-file** arguments are given after **-f-**
+ or equivalent is given, bc(1) will give a fatal error and exit.
This is a **non-portable extension**.
-**-f** *file*, **--file**=*file*
+**-f** *file*, **-\-file**=*file*
: Reads in *file* and evaluates it, line by line, as though it were read
through **stdin**. If expressions are also given (see above), the
expressions are evaluated in the order given.
- After processing all expressions and files, bc(1) will exit, unless **-**
- (**stdin**) was given as an argument at least once to **-f** or **--file**.
+ If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
+ see the **ENVIRONMENT VARIABLES** section), then after processing all
+ expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
+ as an argument at least once to **-f** or **-\-file**. However, if any other
+ **-e**, **-\-expression**, **-f**, or **-\-file** arguments are given after
+ **-f-** or equivalent is given, bc(1) will give a fatal error and exit.
This is a **non-portable extension**.
@@ -201,7 +207,9 @@ All long options are **non-portable extensions**.
# STDOUT
-Any non-error output is written to **stdout**.
+Any non-error output is written to **stdout**. In addition, if history (see the
+**HISTORY** section) and the prompt (see the **TTY MODE** section) are enabled,
+both are output to **stdout**.
**Note**: Unlike other bc(1) implementations, this bc(1) will issue a fatal
error (see the **EXIT STATUS** section) if it cannot write to **stdout**, so if
@@ -245,8 +253,8 @@ Identifiers with more than one character (letter) are a
**ibase** is a global variable determining how to interpret constant numbers. It
is the "input" base, or the number base used for interpreting input numbers.
-**ibase** is initially **10**. If the **-s** (**--standard**) and **-w**
-(**--warn**) flags were not given on the command line, the max allowable value
+**ibase** is initially **10**. If the **-s** (**-\-standard**) and **-w**
+(**-\-warn**) flags were not given on the command line, the max allowable value
for **ibase** is **36**. Otherwise, it is **16**. The min allowable value for
**ibase** is **2**. The max allowable value for **ibase** can be queried in
bc(1) programs with the **maxibase()** built-in function.
@@ -395,7 +403,10 @@ generator.
**Note**: The values returned by the pseudo-random number generator with
**rand()** and **irand(E)** are guaranteed to *NOT* be cryptographically secure.
This is a consequence of using a seeded pseudo-random number generator. However,
-they *are* guaranteed to be reproducible with identical **seed** values.
+they *are* guaranteed to be reproducible with identical **seed** values. This
+means that the pseudo-random values from bc(1) should only be used where a
+reproducible stream of pseudo-random numbers is *ESSENTIAL*. In any other case,
+use a non-seeded pseudo-random number generator.
## Numbers
@@ -433,7 +444,7 @@ The following arithmetic and logical operators can be used. They are listed in
order of decreasing precedence. Operators in the same group have the same
precedence.
-**++** **--**
+**++** **-\-**
: Type: Prefix and Postfix
@@ -531,7 +542,7 @@ precedence.
The operators will be described in more detail below.
-**++** **--**
+**++** **-\-**
: The prefix and postfix **increment** and **decrement** operators behave
exactly like they would in C. They require a named expression (see the
@@ -862,7 +873,7 @@ This is a **non-portable extension**.
All of the functions below, including the functions in the extended math
library (see the *Extended Library* subsection below), are available when the
-**-l** or **--mathlib** command-line flags are given, except that the extended
+**-l** or **-\-mathlib** command-line flags are given, except that the extended
math library is not available when the **-s** option, the **-w** option, or
equivalents are given.
@@ -914,8 +925,8 @@ The [standard][1] defines the following functions for the math library:
## Extended Library
-The extended library is *not* loaded when the **-s**/**--standard** or
-**-w**/**--warn** options are given since they are not part of the library
+The extended library is *not* loaded when the **-s**/**-\-standard** or
+**-w**/**-\-warn** options are given since they are not part of the library
defined by the [standard][1].
The extended library is a **non-portable extension**.
@@ -1583,17 +1594,17 @@ The other statuses will only be returned when bc(1) is not in interactive mode
(see the **INTERACTIVE MODE** section), since bc(1) resets its state (see the
**RESET** section) and accepts more input when one of those errors occurs in
interactive mode. This is also the case when interactive mode is forced by the
-**-i** flag or **--interactive** option.
+**-i** flag or **-\-interactive** option.
These exit statuses allow bc(1) to be used in shell scripting with error
checking, and its normal behavior can be forced by using the **-i** flag or
-**--interactive** option.
+**-\-interactive** option.
# INTERACTIVE MODE
Per the [standard][1], bc(1) has an interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both **stdin** and **stdout**
-are hooked to a terminal, but the **-i** flag and **--interactive** option can
+are hooked to a terminal, but the **-i** flag and **-\-interactive** option can
turn it on in other cases.
In interactive mode, bc(1) attempts to recover from errors (see the **RESET**
diff --git a/contrib/bc/manuals/bc/N.1 b/contrib/bc/manuals/bc/N.1
index 9250b028635a..faf35eb8b255 100644
--- a/contrib/bc/manuals/bc/N.1
+++ b/contrib/bc/manuals/bc/N.1
@@ -1,7 +1,7 @@
.\"
.\" SPDX-License-Identifier: BSD-2-Clause
.\"
-.\" Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+.\" Copyright (c) 2018-2021 Gavin D. Howard and contributors.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions are met:
@@ -25,19 +25,18 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.TH "BC" "1" "October 2020" "Gavin D. Howard" "General Commands Manual"
+.TH "BC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
.SH NAME
.PP
bc - arbitrary-precision decimal arithmetic language and calculator
.SH SYNOPSIS
.PP
-\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]\[en]global-stacks\f[R]]
-[\f[B]\[en]help\f[R]] [\f[B]\[en]interactive\f[R]]
-[\f[B]\[en]mathlib\f[R]] [\f[B]\[en]no-prompt\f[R]]
-[\f[B]\[en]quiet\f[R]] [\f[B]\[en]standard\f[R]] [\f[B]\[en]warn\f[R]]
-[\f[B]\[en]version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
-[\f[B]\[en]expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
-\f[I]file\f[R]\&...] [\f[B]-file\f[R]=\f[I]file\f[R]\&...]
+\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]--global-stacks\f[R]]
+[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--mathlib\f[R]]
+[\f[B]--no-prompt\f[R]] [\f[B]--quiet\f[R]] [\f[B]--standard\f[R]]
+[\f[B]--warn\f[R]] [\f[B]--version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
+[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
+\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
[\f[I]file\f[R]\&...]
.SH DESCRIPTION
.PP
@@ -60,7 +59,7 @@ implementations.
.PP
The following are the options that bc(1) accepts.
.TP
-\f[B]-g\f[R], \f[B]\[en]global-stacks\f[R]
+\f[B]-g\f[R], \f[B]--global-stacks\f[R]
Turns the globals \f[B]ibase\f[R], \f[B]obase\f[R], \f[B]scale\f[R], and
\f[B]seed\f[R] into stacks.
.RS
@@ -152,10 +151,10 @@ is ignored.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-h\f[R], \f[B]\[en]help\f[R]
+\f[B]-h\f[R], \f[B]--help\f[R]
Prints a usage message and quits.
.TP
-\f[B]-i\f[R], \f[B]\[en]interactive\f[R]
+\f[B]-i\f[R], \f[B]--interactive\f[R]
Forces interactive mode.
(See the \f[B]INTERACTIVE MODE\f[R] section.)
.RS
@@ -163,7 +162,7 @@ Forces interactive mode.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-l\f[R], \f[B]\[en]mathlib\f[R]
+\f[B]-l\f[R], \f[B]--mathlib\f[R]
Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to \f[B]20\f[R]
and loads the included math library and the extended math library before
running any code, including any expressions or files specified on the
@@ -173,7 +172,7 @@ command line.
To learn what is in the libraries, see the \f[B]LIBRARY\f[R] section.
.RE
.TP
-\f[B]-P\f[R], \f[B]\[en]no-prompt\f[R]
+\f[B]-P\f[R], \f[B]--no-prompt\f[R]
Disables the prompt in TTY mode.
(The prompt is only enabled in TTY mode.
See the \f[B]TTY MODE\f[R] section) This is mostly for those users that
@@ -185,18 +184,18 @@ Most of those users would want to put this option in
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-q\f[R], \f[B]\[en]quiet\f[R]
+\f[B]-q\f[R], \f[B]--quiet\f[R]
This option is for compatibility with the GNU
bc(1) (https://www.gnu.org/software/bc/); it is a no-op.
Without this option, GNU bc(1) prints a copyright header.
This bc(1) only prints the copyright header if one or more of the
-\f[B]-v\f[R], \f[B]-V\f[R], or \f[B]\[en]version\f[R] options are given.
+\f[B]-v\f[R], \f[B]-V\f[R], or \f[B]--version\f[R] options are given.
.RS
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-s\f[R], \f[B]\[en]standard\f[R]
+\f[B]-s\f[R], \f[B]--standard\f[R]
Process exactly the language defined by the
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
and error if any extensions are used.
@@ -205,15 +204,15 @@ and error if any extensions are used.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-v\f[R], \f[B]-V\f[R], \f[B]\[en]version\f[R]
+\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
Print the version information (copyright header) and exit.
.RS
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-w\f[R], \f[B]\[en]warn\f[R]
-Like \f[B]-s\f[R] and \f[B]\[en]standard\f[R], except that warnings (and
+\f[B]-w\f[R], \f[B]--warn\f[R]
+Like \f[B]-s\f[R] and \f[B]--standard\f[R], except that warnings (and
not errors) are printed for non-standard extensions and execution
continues normally.
.RS
@@ -221,7 +220,7 @@ continues normally.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-e\f[R] \f[I]expr\f[R], \f[B]\[en]expression\f[R]=\f[I]expr\f[R]
+\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
Evaluates \f[I]expr\f[R].
If multiple expressions are given, they are evaluated in order.
If files are given as well (see below), the expressions and files are
@@ -230,26 +229,36 @@ This means that if a file is given before an expression, the file is
read in and evaluated first.
.RS
.PP
-After processing all expressions and files, bc(1) will exit, unless
+If this option is given on the command-line (i.e., not in
+\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
+then after processing all expressions and files, bc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]\[en]file\f[R].
-However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
-\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after that,
-bc(1) will give a fatal error and exit.
+\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
+\f[B]BC_ENV_ARGS\f[R].
+However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
+\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
+\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
+exit.
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-f\f[R] \f[I]file\f[R], \f[B]\[en]file\f[R]=\f[I]file\f[R]
+\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
were read through \f[B]stdin\f[R].
If expressions are also given (see above), the expressions are evaluated
in the order given.
.RS
.PP
-After processing all expressions and files, bc(1) will exit, unless
+If this option is given on the command-line (i.e., not in
+\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
+then after processing all expressions and files, bc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]\[en]file\f[R].
+\f[B]-f\f[R] or \f[B]--file\f[R].
+However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
+\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
+\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
+exit.
.PP
This is a \f[B]non-portable extension\f[R].
.RE
@@ -258,6 +267,9 @@ All long options are \f[B]non-portable extensions\f[R].
.SH STDOUT
.PP
Any non-error output is written to \f[B]stdout\f[R].
+In addition, if history (see the \f[B]HISTORY\f[R] section) and the
+prompt (see the \f[B]TTY MODE\f[R] section) are enabled, both are output
+to \f[B]stdout\f[R].
.PP
\f[B]Note\f[R]: Unlike other bc(1) implementations, this bc(1) will
issue a fatal error (see the \f[B]EXIT STATUS\f[R] section) if it cannot
@@ -309,8 +321,8 @@ constant numbers.
It is the \[lq]input\[rq] base, or the number base used for interpreting
input numbers.
\f[B]ibase\f[R] is initially \f[B]10\f[R].
-If the \f[B]-s\f[R] (\f[B]\[en]standard\f[R]) and \f[B]-w\f[R]
-(\f[B]\[en]warn\f[R]) flags were not given on the command line, the max
+If the \f[B]-s\f[R] (\f[B]--standard\f[R]) and \f[B]-w\f[R]
+(\f[B]--warn\f[R]) flags were not given on the command line, the max
allowable value for \f[B]ibase\f[R] is \f[B]36\f[R].
Otherwise, it is \f[B]16\f[R].
The min allowable value for \f[B]ibase\f[R] is \f[B]2\f[R].
@@ -519,6 +531,10 @@ generator with \f[B]rand()\f[R] and \f[B]irand(E)\f[R] are guaranteed to
This is a consequence of using a seeded pseudo-random number generator.
However, they \f[I]are\f[R] guaranteed to be reproducible with identical
\f[B]seed\f[R] values.
+This means that the pseudo-random values from bc(1) should only be used
+where a reproducible stream of pseudo-random numbers is
+\f[I]ESSENTIAL\f[R].
+In any other case, use a non-seeded pseudo-random number generator.
.SS Numbers
.PP
Numbers are strings made up of digits, uppercase letters, and at most
@@ -565,7 +581,7 @@ The following arithmetic and logical operators can be used.
They are listed in order of decreasing precedence.
Operators in the same group have the same precedence.
.TP
-\f[B]++\f[R] \f[B]\[en]\f[R]
+\f[B]++\f[R] \f[B]--\f[R]
Type: Prefix and Postfix
.RS
.PP
@@ -675,7 +691,7 @@ Description: \f[B]boolean or\f[R]
.PP
The operators will be described in more detail below.
.TP
-\f[B]++\f[R] \f[B]\[en]\f[R]
+\f[B]++\f[R] \f[B]--\f[R]
The prefix and postfix \f[B]increment\f[R] and \f[B]decrement\f[R]
operators behave exactly like they would in C.
They require a named expression (see the \f[I]Named Expressions\f[R]
@@ -1121,7 +1137,7 @@ This is a \f[B]non-portable extension\f[R].
.PP
All of the functions below, including the functions in the extended math
library (see the \f[I]Extended Library\f[R] subsection below), are
-available when the \f[B]-l\f[R] or \f[B]\[en]mathlib\f[R] command-line
+available when the \f[B]-l\f[R] or \f[B]--mathlib\f[R] command-line
flags are given, except that the extended math library is not available
when the \f[B]-s\f[R] option, the \f[B]-w\f[R] option, or equivalents
are given.
@@ -1182,7 +1198,7 @@ Functions\f[R] subsection below).
.SS Extended Library
.PP
The extended library is \f[I]not\f[R] loaded when the
-\f[B]-s\f[R]/\f[B]\[en]standard\f[R] or \f[B]-w\f[R]/\f[B]\[en]warn\f[R]
+\f[B]-s\f[R]/\f[B]--standard\f[R] or \f[B]-w\f[R]/\f[B]--warn\f[R]
options are given since they are not part of the library defined by the
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html).
.PP
@@ -1940,11 +1956,11 @@ interactive mode (see the \f[B]INTERACTIVE MODE\f[R] section), since
bc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
more input when one of those errors occurs in interactive mode.
This is also the case when interactive mode is forced by the
-\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
+\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.PP
These exit statuses allow bc(1) to be used in shell scripting with error
checking, and its normal behavior can be forced by using the
-\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
+\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.SH INTERACTIVE MODE
.PP
Per the
@@ -1952,7 +1968,7 @@ standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html),
bc(1) has an interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both \f[B]stdin\f[R]
and \f[B]stdout\f[R] are hooked to a terminal, but the \f[B]-i\f[R] flag
-and \f[B]\[en]interactive\f[R] option can turn it on in other cases.
+and \f[B]--interactive\f[R] option can turn it on in other cases.
.PP
In interactive mode, bc(1) attempts to recover from errors (see the
\f[B]RESET\f[R] section), and in normal execution, flushes
diff --git a/contrib/bc/manuals/bc/N.1.md b/contrib/bc/manuals/bc/N.1.md
index 63a5acf8ab47..5c877ef79823 100644
--- a/contrib/bc/manuals/bc/N.1.md
+++ b/contrib/bc/manuals/bc/N.1.md
@@ -2,7 +2,7 @@
SPDX-License-Identifier: BSD-2-Clause
-Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+Copyright (c) 2018-2021 Gavin D. Howard and contributors.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
@@ -34,8 +34,7 @@ bc - arbitrary-precision decimal arithmetic language and calculator
# SYNOPSIS
-**bc** [**-ghilPqsvVw**] [**--global-stacks**] [**--help**] [**--interactive**] [**--mathlib**] [**--no-prompt**] [**--quiet**] [**--standard**] [**--warn**] [**--version**] [**-e** *expr*] [**--expression**=*expr*...] [**-f** *file*...] [**-file**=*file*...]
-[*file*...]
+**bc** [**-ghilPqsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@@ -55,7 +54,7 @@ other implementations.
The following are the options that bc(1) accepts.
-**-g**, **--global-stacks**
+**-g**, **-\-global-stacks**
: Turns the globals **ibase**, **obase**, **scale**, and **seed** into stacks.
@@ -123,17 +122,17 @@ The following are the options that bc(1) accepts.
This is a **non-portable extension**.
-**-h**, **--help**
+**-h**, **-\-help**
: Prints a usage message and quits.
-**-i**, **--interactive**
+**-i**, **-\-interactive**
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
This is a **non-portable extension**.
-**-l**, **--mathlib**
+**-l**, **-\-mathlib**
: Sets **scale** (see the **SYNTAX** section) to **20** and loads the included
math library and the extended math library before running any code,
@@ -141,7 +140,7 @@ The following are the options that bc(1) accepts.
To learn what is in the libraries, see the **LIBRARY** section.
-**-P**, **--no-prompt**
+**-P**, **-\-no-prompt**
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
See the **TTY MODE** section) This is mostly for those users that do not
@@ -151,57 +150,64 @@ The following are the options that bc(1) accepts.
This is a **non-portable extension**.
-**-q**, **--quiet**
+**-q**, **-\-quiet**
: This option is for compatibility with the [GNU bc(1)][2]; it is a no-op.
Without this option, GNU bc(1) prints a copyright header. This bc(1) only
prints the copyright header if one or more of the **-v**, **-V**, or
- **--version** options are given.
+ **-\-version** options are given.
This is a **non-portable extension**.
-**-s**, **--standard**
+**-s**, **-\-standard**
: Process exactly the language defined by the [standard][1] and error if any
extensions are used.
This is a **non-portable extension**.
-**-v**, **-V**, **--version**
+**-v**, **-V**, **-\-version**
: Print the version information (copyright header) and exit.
This is a **non-portable extension**.
-**-w**, **--warn**
+**-w**, **-\-warn**
-: Like **-s** and **--standard**, except that warnings (and not errors) are
+: Like **-s** and **-\-standard**, except that warnings (and not errors) are
printed for non-standard extensions and execution continues normally.
This is a **non-portable extension**.
-**-e** *expr*, **--expression**=*expr*
+**-e** *expr*, **-\-expression**=*expr*
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
order. If files are given as well (see below), the expressions and files are
evaluated in the order given. This means that if a file is given before an
expression, the file is read in and evaluated first.
- After processing all expressions and files, bc(1) will exit, unless **-**
- (**stdin**) was given as an argument at least once to **-f** or **--file**.
- However, if any other **-e**, **--expression**, **-f**, or **--file**
- arguments are given after that, bc(1) will give a fatal error and exit.
+ If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
+ see the **ENVIRONMENT VARIABLES** section), then after processing all
+ expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
+ as an argument at least once to **-f** or **-\-file**, whether on the
+ command-line or in **BC_ENV_ARGS**. However, if any other **-e**,
+ **-\-expression**, **-f**, or **-\-file** arguments are given after **-f-**
+ or equivalent is given, bc(1) will give a fatal error and exit.
This is a **non-portable extension**.
-**-f** *file*, **--file**=*file*
+**-f** *file*, **-\-file**=*file*
: Reads in *file* and evaluates it, line by line, as though it were read
through **stdin**. If expressions are also given (see above), the
expressions are evaluated in the order given.
- After processing all expressions and files, bc(1) will exit, unless **-**
- (**stdin**) was given as an argument at least once to **-f** or **--file**.
+ If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
+ see the **ENVIRONMENT VARIABLES** section), then after processing all
+ expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
+ as an argument at least once to **-f** or **-\-file**. However, if any other
+ **-e**, **-\-expression**, **-f**, or **-\-file** arguments are given after
+ **-f-** or equivalent is given, bc(1) will give a fatal error and exit.
This is a **non-portable extension**.
@@ -209,7 +215,9 @@ All long options are **non-portable extensions**.
# STDOUT
-Any non-error output is written to **stdout**.
+Any non-error output is written to **stdout**. In addition, if history (see the
+**HISTORY** section) and the prompt (see the **TTY MODE** section) are enabled,
+both are output to **stdout**.
**Note**: Unlike other bc(1) implementations, this bc(1) will issue a fatal
error (see the **EXIT STATUS** section) if it cannot write to **stdout**, so if
@@ -253,8 +261,8 @@ Identifiers with more than one character (letter) are a
**ibase** is a global variable determining how to interpret constant numbers. It
is the "input" base, or the number base used for interpreting input numbers.
-**ibase** is initially **10**. If the **-s** (**--standard**) and **-w**
-(**--warn**) flags were not given on the command line, the max allowable value
+**ibase** is initially **10**. If the **-s** (**-\-standard**) and **-w**
+(**-\-warn**) flags were not given on the command line, the max allowable value
for **ibase** is **36**. Otherwise, it is **16**. The min allowable value for
**ibase** is **2**. The max allowable value for **ibase** can be queried in
bc(1) programs with the **maxibase()** built-in function.
@@ -403,7 +411,10 @@ generator.
**Note**: The values returned by the pseudo-random number generator with
**rand()** and **irand(E)** are guaranteed to *NOT* be cryptographically secure.
This is a consequence of using a seeded pseudo-random number generator. However,
-they *are* guaranteed to be reproducible with identical **seed** values.
+they *are* guaranteed to be reproducible with identical **seed** values. This
+means that the pseudo-random values from bc(1) should only be used where a
+reproducible stream of pseudo-random numbers is *ESSENTIAL*. In any other case,
+use a non-seeded pseudo-random number generator.
## Numbers
@@ -441,7 +452,7 @@ The following arithmetic and logical operators can be used. They are listed in
order of decreasing precedence. Operators in the same group have the same
precedence.
-**++** **--**
+**++** **-\-**
: Type: Prefix and Postfix
@@ -539,7 +550,7 @@ precedence.
The operators will be described in more detail below.
-**++** **--**
+**++** **-\-**
: The prefix and postfix **increment** and **decrement** operators behave
exactly like they would in C. They require a named expression (see the
@@ -870,7 +881,7 @@ This is a **non-portable extension**.
All of the functions below, including the functions in the extended math
library (see the *Extended Library* subsection below), are available when the
-**-l** or **--mathlib** command-line flags are given, except that the extended
+**-l** or **-\-mathlib** command-line flags are given, except that the extended
math library is not available when the **-s** option, the **-w** option, or
equivalents are given.
@@ -922,8 +933,8 @@ The [standard][1] defines the following functions for the math library:
## Extended Library
-The extended library is *not* loaded when the **-s**/**--standard** or
-**-w**/**--warn** options are given since they are not part of the library
+The extended library is *not* loaded when the **-s**/**-\-standard** or
+**-w**/**-\-warn** options are given since they are not part of the library
defined by the [standard][1].
The extended library is a **non-portable extension**.
@@ -1591,17 +1602,17 @@ The other statuses will only be returned when bc(1) is not in interactive mode
(see the **INTERACTIVE MODE** section), since bc(1) resets its state (see the
**RESET** section) and accepts more input when one of those errors occurs in
interactive mode. This is also the case when interactive mode is forced by the
-**-i** flag or **--interactive** option.
+**-i** flag or **-\-interactive** option.
These exit statuses allow bc(1) to be used in shell scripting with error
checking, and its normal behavior can be forced by using the **-i** flag or
-**--interactive** option.
+**-\-interactive** option.
# INTERACTIVE MODE
Per the [standard][1], bc(1) has an interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both **stdin** and **stdout**
-are hooked to a terminal, but the **-i** flag and **--interactive** option can
+are hooked to a terminal, but the **-i** flag and **-\-interactive** option can
turn it on in other cases.
In interactive mode, bc(1) attempts to recover from errors (see the **RESET**
diff --git a/contrib/bc/manuals/bc/NP.1 b/contrib/bc/manuals/bc/NP.1
index 89377821b179..149037fd9705 100644
--- a/contrib/bc/manuals/bc/NP.1
+++ b/contrib/bc/manuals/bc/NP.1
@@ -1,7 +1,7 @@
.\"
.\" SPDX-License-Identifier: BSD-2-Clause
.\"
-.\" Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+.\" Copyright (c) 2018-2021 Gavin D. Howard and contributors.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions are met:
@@ -25,19 +25,18 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.TH "BC" "1" "October 2020" "Gavin D. Howard" "General Commands Manual"
+.TH "BC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
.SH NAME
.PP
bc - arbitrary-precision decimal arithmetic language and calculator
.SH SYNOPSIS
.PP
-\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]\[en]global-stacks\f[R]]
-[\f[B]\[en]help\f[R]] [\f[B]\[en]interactive\f[R]]
-[\f[B]\[en]mathlib\f[R]] [\f[B]\[en]no-prompt\f[R]]
-[\f[B]\[en]quiet\f[R]] [\f[B]\[en]standard\f[R]] [\f[B]\[en]warn\f[R]]
-[\f[B]\[en]version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
-[\f[B]\[en]expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
-\f[I]file\f[R]\&...] [\f[B]-file\f[R]=\f[I]file\f[R]\&...]
+\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]--global-stacks\f[R]]
+[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--mathlib\f[R]]
+[\f[B]--no-prompt\f[R]] [\f[B]--quiet\f[R]] [\f[B]--standard\f[R]]
+[\f[B]--warn\f[R]] [\f[B]--version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
+[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
+\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
[\f[I]file\f[R]\&...]
.SH DESCRIPTION
.PP
@@ -60,7 +59,7 @@ implementations.
.PP
The following are the options that bc(1) accepts.
.TP
-\f[B]-g\f[R], \f[B]\[en]global-stacks\f[R]
+\f[B]-g\f[R], \f[B]--global-stacks\f[R]
Turns the globals \f[B]ibase\f[R], \f[B]obase\f[R], \f[B]scale\f[R], and
\f[B]seed\f[R] into stacks.
.RS
@@ -152,10 +151,10 @@ is ignored.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-h\f[R], \f[B]\[en]help\f[R]
+\f[B]-h\f[R], \f[B]--help\f[R]
Prints a usage message and quits.
.TP
-\f[B]-i\f[R], \f[B]\[en]interactive\f[R]
+\f[B]-i\f[R], \f[B]--interactive\f[R]
Forces interactive mode.
(See the \f[B]INTERACTIVE MODE\f[R] section.)
.RS
@@ -163,7 +162,7 @@ Forces interactive mode.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-l\f[R], \f[B]\[en]mathlib\f[R]
+\f[B]-l\f[R], \f[B]--mathlib\f[R]
Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to \f[B]20\f[R]
and loads the included math library and the extended math library before
running any code, including any expressions or files specified on the
@@ -173,25 +172,25 @@ command line.
To learn what is in the libraries, see the \f[B]LIBRARY\f[R] section.
.RE
.TP
-\f[B]-P\f[R], \f[B]\[en]no-prompt\f[R]
+\f[B]-P\f[R], \f[B]--no-prompt\f[R]
This option is a no-op.
.RS
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-q\f[R], \f[B]\[en]quiet\f[R]
+\f[B]-q\f[R], \f[B]--quiet\f[R]
This option is for compatibility with the GNU
bc(1) (https://www.gnu.org/software/bc/); it is a no-op.
Without this option, GNU bc(1) prints a copyright header.
This bc(1) only prints the copyright header if one or more of the
-\f[B]-v\f[R], \f[B]-V\f[R], or \f[B]\[en]version\f[R] options are given.
+\f[B]-v\f[R], \f[B]-V\f[R], or \f[B]--version\f[R] options are given.
.RS
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-s\f[R], \f[B]\[en]standard\f[R]
+\f[B]-s\f[R], \f[B]--standard\f[R]
Process exactly the language defined by the
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
and error if any extensions are used.
@@ -200,15 +199,15 @@ and error if any extensions are used.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-v\f[R], \f[B]-V\f[R], \f[B]\[en]version\f[R]
+\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
Print the version information (copyright header) and exit.
.RS
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-w\f[R], \f[B]\[en]warn\f[R]
-Like \f[B]-s\f[R] and \f[B]\[en]standard\f[R], except that warnings (and
+\f[B]-w\f[R], \f[B]--warn\f[R]
+Like \f[B]-s\f[R] and \f[B]--standard\f[R], except that warnings (and
not errors) are printed for non-standard extensions and execution
continues normally.
.RS
@@ -216,7 +215,7 @@ continues normally.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-e\f[R] \f[I]expr\f[R], \f[B]\[en]expression\f[R]=\f[I]expr\f[R]
+\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
Evaluates \f[I]expr\f[R].
If multiple expressions are given, they are evaluated in order.
If files are given as well (see below), the expressions and files are
@@ -225,26 +224,36 @@ This means that if a file is given before an expression, the file is
read in and evaluated first.
.RS
.PP
-After processing all expressions and files, bc(1) will exit, unless
+If this option is given on the command-line (i.e., not in
+\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
+then after processing all expressions and files, bc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]\[en]file\f[R].
-However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
-\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after that,
-bc(1) will give a fatal error and exit.
+\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
+\f[B]BC_ENV_ARGS\f[R].
+However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
+\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
+\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
+exit.
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-f\f[R] \f[I]file\f[R], \f[B]\[en]file\f[R]=\f[I]file\f[R]
+\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
were read through \f[B]stdin\f[R].
If expressions are also given (see above), the expressions are evaluated
in the order given.
.RS
.PP
-After processing all expressions and files, bc(1) will exit, unless
+If this option is given on the command-line (i.e., not in
+\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
+then after processing all expressions and files, bc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]\[en]file\f[R].
+\f[B]-f\f[R] or \f[B]--file\f[R].
+However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
+\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
+\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
+exit.
.PP
This is a \f[B]non-portable extension\f[R].
.RE
@@ -253,6 +262,9 @@ All long options are \f[B]non-portable extensions\f[R].
.SH STDOUT
.PP
Any non-error output is written to \f[B]stdout\f[R].
+In addition, if history (see the \f[B]HISTORY\f[R] section) and the
+prompt (see the \f[B]TTY MODE\f[R] section) are enabled, both are output
+to \f[B]stdout\f[R].
.PP
\f[B]Note\f[R]: Unlike other bc(1) implementations, this bc(1) will
issue a fatal error (see the \f[B]EXIT STATUS\f[R] section) if it cannot
@@ -304,8 +316,8 @@ constant numbers.
It is the \[lq]input\[rq] base, or the number base used for interpreting
input numbers.
\f[B]ibase\f[R] is initially \f[B]10\f[R].
-If the \f[B]-s\f[R] (\f[B]\[en]standard\f[R]) and \f[B]-w\f[R]
-(\f[B]\[en]warn\f[R]) flags were not given on the command line, the max
+If the \f[B]-s\f[R] (\f[B]--standard\f[R]) and \f[B]-w\f[R]
+(\f[B]--warn\f[R]) flags were not given on the command line, the max
allowable value for \f[B]ibase\f[R] is \f[B]36\f[R].
Otherwise, it is \f[B]16\f[R].
The min allowable value for \f[B]ibase\f[R] is \f[B]2\f[R].
@@ -514,6 +526,10 @@ generator with \f[B]rand()\f[R] and \f[B]irand(E)\f[R] are guaranteed to
This is a consequence of using a seeded pseudo-random number generator.
However, they \f[I]are\f[R] guaranteed to be reproducible with identical
\f[B]seed\f[R] values.
+This means that the pseudo-random values from bc(1) should only be used
+where a reproducible stream of pseudo-random numbers is
+\f[I]ESSENTIAL\f[R].
+In any other case, use a non-seeded pseudo-random number generator.
.SS Numbers
.PP
Numbers are strings made up of digits, uppercase letters, and at most
@@ -560,7 +576,7 @@ The following arithmetic and logical operators can be used.
They are listed in order of decreasing precedence.
Operators in the same group have the same precedence.
.TP
-\f[B]++\f[R] \f[B]\[en]\f[R]
+\f[B]++\f[R] \f[B]--\f[R]
Type: Prefix and Postfix
.RS
.PP
@@ -670,7 +686,7 @@ Description: \f[B]boolean or\f[R]
.PP
The operators will be described in more detail below.
.TP
-\f[B]++\f[R] \f[B]\[en]\f[R]
+\f[B]++\f[R] \f[B]--\f[R]
The prefix and postfix \f[B]increment\f[R] and \f[B]decrement\f[R]
operators behave exactly like they would in C.
They require a named expression (see the \f[I]Named Expressions\f[R]
@@ -1116,7 +1132,7 @@ This is a \f[B]non-portable extension\f[R].
.PP
All of the functions below, including the functions in the extended math
library (see the \f[I]Extended Library\f[R] subsection below), are
-available when the \f[B]-l\f[R] or \f[B]\[en]mathlib\f[R] command-line
+available when the \f[B]-l\f[R] or \f[B]--mathlib\f[R] command-line
flags are given, except that the extended math library is not available
when the \f[B]-s\f[R] option, the \f[B]-w\f[R] option, or equivalents
are given.
@@ -1177,7 +1193,7 @@ Functions\f[R] subsection below).
.SS Extended Library
.PP
The extended library is \f[I]not\f[R] loaded when the
-\f[B]-s\f[R]/\f[B]\[en]standard\f[R] or \f[B]-w\f[R]/\f[B]\[en]warn\f[R]
+\f[B]-s\f[R]/\f[B]--standard\f[R] or \f[B]-w\f[R]/\f[B]--warn\f[R]
options are given since they are not part of the library defined by the
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html).
.PP
@@ -1935,11 +1951,11 @@ interactive mode (see the \f[B]INTERACTIVE MODE\f[R] section), since
bc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
more input when one of those errors occurs in interactive mode.
This is also the case when interactive mode is forced by the
-\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
+\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.PP
These exit statuses allow bc(1) to be used in shell scripting with error
checking, and its normal behavior can be forced by using the
-\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
+\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.SH INTERACTIVE MODE
.PP
Per the
@@ -1947,7 +1963,7 @@ standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html),
bc(1) has an interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both \f[B]stdin\f[R]
and \f[B]stdout\f[R] are hooked to a terminal, but the \f[B]-i\f[R] flag
-and \f[B]\[en]interactive\f[R] option can turn it on in other cases.
+and \f[B]--interactive\f[R] option can turn it on in other cases.
.PP
In interactive mode, bc(1) attempts to recover from errors (see the
\f[B]RESET\f[R] section), and in normal execution, flushes
diff --git a/contrib/bc/manuals/bc/NP.1.md b/contrib/bc/manuals/bc/NP.1.md
index 60d6a7e59b37..518d237020df 100644
--- a/contrib/bc/manuals/bc/NP.1.md
+++ b/contrib/bc/manuals/bc/NP.1.md
@@ -2,7 +2,7 @@
SPDX-License-Identifier: BSD-2-Clause
-Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+Copyright (c) 2018-2021 Gavin D. Howard and contributors.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
@@ -34,8 +34,7 @@ bc - arbitrary-precision decimal arithmetic language and calculator
# SYNOPSIS
-**bc** [**-ghilPqsvVw**] [**--global-stacks**] [**--help**] [**--interactive**] [**--mathlib**] [**--no-prompt**] [**--quiet**] [**--standard**] [**--warn**] [**--version**] [**-e** *expr*] [**--expression**=*expr*...] [**-f** *file*...] [**-file**=*file*...]
-[*file*...]
+**bc** [**-ghilPqsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@@ -55,7 +54,7 @@ other implementations.
The following are the options that bc(1) accepts.
-**-g**, **--global-stacks**
+**-g**, **-\-global-stacks**
: Turns the globals **ibase**, **obase**, **scale**, and **seed** into stacks.
@@ -123,17 +122,17 @@ The following are the options that bc(1) accepts.
This is a **non-portable extension**.
-**-h**, **--help**
+**-h**, **-\-help**
: Prints a usage message and quits.
-**-i**, **--interactive**
+**-i**, **-\-interactive**
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
This is a **non-portable extension**.
-**-l**, **--mathlib**
+**-l**, **-\-mathlib**
: Sets **scale** (see the **SYNTAX** section) to **20** and loads the included
math library and the extended math library before running any code,
@@ -141,63 +140,70 @@ The following are the options that bc(1) accepts.
To learn what is in the libraries, see the **LIBRARY** section.
-**-P**, **--no-prompt**
+**-P**, **-\-no-prompt**
: This option is a no-op.
This is a **non-portable extension**.
-**-q**, **--quiet**
+**-q**, **-\-quiet**
: This option is for compatibility with the [GNU bc(1)][2]; it is a no-op.
Without this option, GNU bc(1) prints a copyright header. This bc(1) only
prints the copyright header if one or more of the **-v**, **-V**, or
- **--version** options are given.
+ **-\-version** options are given.
This is a **non-portable extension**.
-**-s**, **--standard**
+**-s**, **-\-standard**
: Process exactly the language defined by the [standard][1] and error if any
extensions are used.
This is a **non-portable extension**.
-**-v**, **-V**, **--version**
+**-v**, **-V**, **-\-version**
: Print the version information (copyright header) and exit.
This is a **non-portable extension**.
-**-w**, **--warn**
+**-w**, **-\-warn**
-: Like **-s** and **--standard**, except that warnings (and not errors) are
+: Like **-s** and **-\-standard**, except that warnings (and not errors) are
printed for non-standard extensions and execution continues normally.
This is a **non-portable extension**.
-**-e** *expr*, **--expression**=*expr*
+**-e** *expr*, **-\-expression**=*expr*
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
order. If files are given as well (see below), the expressions and files are
evaluated in the order given. This means that if a file is given before an
expression, the file is read in and evaluated first.
- After processing all expressions and files, bc(1) will exit, unless **-**
- (**stdin**) was given as an argument at least once to **-f** or **--file**.
- However, if any other **-e**, **--expression**, **-f**, or **--file**
- arguments are given after that, bc(1) will give a fatal error and exit.
+ If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
+ see the **ENVIRONMENT VARIABLES** section), then after processing all
+ expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
+ as an argument at least once to **-f** or **-\-file**, whether on the
+ command-line or in **BC_ENV_ARGS**. However, if any other **-e**,
+ **-\-expression**, **-f**, or **-\-file** arguments are given after **-f-**
+ or equivalent is given, bc(1) will give a fatal error and exit.
This is a **non-portable extension**.
-**-f** *file*, **--file**=*file*
+**-f** *file*, **-\-file**=*file*
: Reads in *file* and evaluates it, line by line, as though it were read
through **stdin**. If expressions are also given (see above), the
expressions are evaluated in the order given.
- After processing all expressions and files, bc(1) will exit, unless **-**
- (**stdin**) was given as an argument at least once to **-f** or **--file**.
+ If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
+ see the **ENVIRONMENT VARIABLES** section), then after processing all
+ expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
+ as an argument at least once to **-f** or **-\-file**. However, if any other
+ **-e**, **-\-expression**, **-f**, or **-\-file** arguments are given after
+ **-f-** or equivalent is given, bc(1) will give a fatal error and exit.
This is a **non-portable extension**.
@@ -205,7 +211,9 @@ All long options are **non-portable extensions**.
# STDOUT
-Any non-error output is written to **stdout**.
+Any non-error output is written to **stdout**. In addition, if history (see the
+**HISTORY** section) and the prompt (see the **TTY MODE** section) are enabled,
+both are output to **stdout**.
**Note**: Unlike other bc(1) implementations, this bc(1) will issue a fatal
error (see the **EXIT STATUS** section) if it cannot write to **stdout**, so if
@@ -249,8 +257,8 @@ Identifiers with more than one character (letter) are a
**ibase** is a global variable determining how to interpret constant numbers. It
is the "input" base, or the number base used for interpreting input numbers.
-**ibase** is initially **10**. If the **-s** (**--standard**) and **-w**
-(**--warn**) flags were not given on the command line, the max allowable value
+**ibase** is initially **10**. If the **-s** (**-\-standard**) and **-w**
+(**-\-warn**) flags were not given on the command line, the max allowable value
for **ibase** is **36**. Otherwise, it is **16**. The min allowable value for
**ibase** is **2**. The max allowable value for **ibase** can be queried in
bc(1) programs with the **maxibase()** built-in function.
@@ -399,7 +407,10 @@ generator.
**Note**: The values returned by the pseudo-random number generator with
**rand()** and **irand(E)** are guaranteed to *NOT* be cryptographically secure.
This is a consequence of using a seeded pseudo-random number generator. However,
-they *are* guaranteed to be reproducible with identical **seed** values.
+they *are* guaranteed to be reproducible with identical **seed** values. This
+means that the pseudo-random values from bc(1) should only be used where a
+reproducible stream of pseudo-random numbers is *ESSENTIAL*. In any other case,
+use a non-seeded pseudo-random number generator.
## Numbers
@@ -437,7 +448,7 @@ The following arithmetic and logical operators can be used. They are listed in
order of decreasing precedence. Operators in the same group have the same
precedence.
-**++** **--**
+**++** **-\-**
: Type: Prefix and Postfix
@@ -535,7 +546,7 @@ precedence.
The operators will be described in more detail below.
-**++** **--**
+**++** **-\-**
: The prefix and postfix **increment** and **decrement** operators behave
exactly like they would in C. They require a named expression (see the
@@ -866,7 +877,7 @@ This is a **non-portable extension**.
All of the functions below, including the functions in the extended math
library (see the *Extended Library* subsection below), are available when the
-**-l** or **--mathlib** command-line flags are given, except that the extended
+**-l** or **-\-mathlib** command-line flags are given, except that the extended
math library is not available when the **-s** option, the **-w** option, or
equivalents are given.
@@ -918,8 +929,8 @@ The [standard][1] defines the following functions for the math library:
## Extended Library
-The extended library is *not* loaded when the **-s**/**--standard** or
-**-w**/**--warn** options are given since they are not part of the library
+The extended library is *not* loaded when the **-s**/**-\-standard** or
+**-w**/**-\-warn** options are given since they are not part of the library
defined by the [standard][1].
The extended library is a **non-portable extension**.
@@ -1587,17 +1598,17 @@ The other statuses will only be returned when bc(1) is not in interactive mode
(see the **INTERACTIVE MODE** section), since bc(1) resets its state (see the
**RESET** section) and accepts more input when one of those errors occurs in
interactive mode. This is also the case when interactive mode is forced by the
-**-i** flag or **--interactive** option.
+**-i** flag or **-\-interactive** option.
These exit statuses allow bc(1) to be used in shell scripting with error
checking, and its normal behavior can be forced by using the **-i** flag or
-**--interactive** option.
+**-\-interactive** option.
# INTERACTIVE MODE
Per the [standard][1], bc(1) has an interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both **stdin** and **stdout**
-are hooked to a terminal, but the **-i** flag and **--interactive** option can
+are hooked to a terminal, but the **-i** flag and **-\-interactive** option can
turn it on in other cases.
In interactive mode, bc(1) attempts to recover from errors (see the **RESET**
diff --git a/contrib/bc/manuals/bc/P.1 b/contrib/bc/manuals/bc/P.1
index 688d6cb612b3..cfe4afe1fdf3 100644
--- a/contrib/bc/manuals/bc/P.1
+++ b/contrib/bc/manuals/bc/P.1
@@ -1,7 +1,7 @@
.\"
.\" SPDX-License-Identifier: BSD-2-Clause
.\"
-.\" Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+.\" Copyright (c) 2018-2021 Gavin D. Howard and contributors.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions are met:
@@ -25,19 +25,18 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.TH "BC" "1" "October 2020" "Gavin D. Howard" "General Commands Manual"
+.TH "BC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
.SH NAME
.PP
bc - arbitrary-precision decimal arithmetic language and calculator
.SH SYNOPSIS
.PP
-\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]\[en]global-stacks\f[R]]
-[\f[B]\[en]help\f[R]] [\f[B]\[en]interactive\f[R]]
-[\f[B]\[en]mathlib\f[R]] [\f[B]\[en]no-prompt\f[R]]
-[\f[B]\[en]quiet\f[R]] [\f[B]\[en]standard\f[R]] [\f[B]\[en]warn\f[R]]
-[\f[B]\[en]version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
-[\f[B]\[en]expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
-\f[I]file\f[R]\&...] [\f[B]-file\f[R]=\f[I]file\f[R]\&...]
+\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]--global-stacks\f[R]]
+[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--mathlib\f[R]]
+[\f[B]--no-prompt\f[R]] [\f[B]--quiet\f[R]] [\f[B]--standard\f[R]]
+[\f[B]--warn\f[R]] [\f[B]--version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
+[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
+\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
[\f[I]file\f[R]\&...]
.SH DESCRIPTION
.PP
@@ -60,7 +59,7 @@ implementations.
.PP
The following are the options that bc(1) accepts.
.TP
-\f[B]-g\f[R], \f[B]\[en]global-stacks\f[R]
+\f[B]-g\f[R], \f[B]--global-stacks\f[R]
Turns the globals \f[B]ibase\f[R], \f[B]obase\f[R], \f[B]scale\f[R], and
\f[B]seed\f[R] into stacks.
.RS
@@ -152,10 +151,10 @@ is ignored.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-h\f[R], \f[B]\[en]help\f[R]
+\f[B]-h\f[R], \f[B]--help\f[R]
Prints a usage message and quits.
.TP
-\f[B]-i\f[R], \f[B]\[en]interactive\f[R]
+\f[B]-i\f[R], \f[B]--interactive\f[R]
Forces interactive mode.
(See the \f[B]INTERACTIVE MODE\f[R] section.)
.RS
@@ -163,7 +162,7 @@ Forces interactive mode.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-l\f[R], \f[B]\[en]mathlib\f[R]
+\f[B]-l\f[R], \f[B]--mathlib\f[R]
Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to \f[B]20\f[R]
and loads the included math library and the extended math library before
running any code, including any expressions or files specified on the
@@ -173,25 +172,25 @@ command line.
To learn what is in the libraries, see the \f[B]LIBRARY\f[R] section.
.RE
.TP
-\f[B]-P\f[R], \f[B]\[en]no-prompt\f[R]
+\f[B]-P\f[R], \f[B]--no-prompt\f[R]
This option is a no-op.
.RS
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-q\f[R], \f[B]\[en]quiet\f[R]
+\f[B]-q\f[R], \f[B]--quiet\f[R]
This option is for compatibility with the GNU
bc(1) (https://www.gnu.org/software/bc/); it is a no-op.
Without this option, GNU bc(1) prints a copyright header.
This bc(1) only prints the copyright header if one or more of the
-\f[B]-v\f[R], \f[B]-V\f[R], or \f[B]\[en]version\f[R] options are given.
+\f[B]-v\f[R], \f[B]-V\f[R], or \f[B]--version\f[R] options are given.
.RS
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-s\f[R], \f[B]\[en]standard\f[R]
+\f[B]-s\f[R], \f[B]--standard\f[R]
Process exactly the language defined by the
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
and error if any extensions are used.
@@ -200,15 +199,15 @@ and error if any extensions are used.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-v\f[R], \f[B]-V\f[R], \f[B]\[en]version\f[R]
+\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
Print the version information (copyright header) and exit.
.RS
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-w\f[R], \f[B]\[en]warn\f[R]
-Like \f[B]-s\f[R] and \f[B]\[en]standard\f[R], except that warnings (and
+\f[B]-w\f[R], \f[B]--warn\f[R]
+Like \f[B]-s\f[R] and \f[B]--standard\f[R], except that warnings (and
not errors) are printed for non-standard extensions and execution
continues normally.
.RS
@@ -216,7 +215,7 @@ continues normally.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-e\f[R] \f[I]expr\f[R], \f[B]\[en]expression\f[R]=\f[I]expr\f[R]
+\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
Evaluates \f[I]expr\f[R].
If multiple expressions are given, they are evaluated in order.
If files are given as well (see below), the expressions and files are
@@ -225,26 +224,36 @@ This means that if a file is given before an expression, the file is
read in and evaluated first.
.RS
.PP
-After processing all expressions and files, bc(1) will exit, unless
+If this option is given on the command-line (i.e., not in
+\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
+then after processing all expressions and files, bc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]\[en]file\f[R].
-However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
-\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after that,
-bc(1) will give a fatal error and exit.
+\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
+\f[B]BC_ENV_ARGS\f[R].
+However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
+\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
+\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
+exit.
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-f\f[R] \f[I]file\f[R], \f[B]\[en]file\f[R]=\f[I]file\f[R]
+\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
were read through \f[B]stdin\f[R].
If expressions are also given (see above), the expressions are evaluated
in the order given.
.RS
.PP
-After processing all expressions and files, bc(1) will exit, unless
+If this option is given on the command-line (i.e., not in
+\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
+then after processing all expressions and files, bc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]\[en]file\f[R].
+\f[B]-f\f[R] or \f[B]--file\f[R].
+However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
+\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
+\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
+exit.
.PP
This is a \f[B]non-portable extension\f[R].
.RE
@@ -253,6 +262,9 @@ All long options are \f[B]non-portable extensions\f[R].
.SH STDOUT
.PP
Any non-error output is written to \f[B]stdout\f[R].
+In addition, if history (see the \f[B]HISTORY\f[R] section) and the
+prompt (see the \f[B]TTY MODE\f[R] section) are enabled, both are output
+to \f[B]stdout\f[R].
.PP
\f[B]Note\f[R]: Unlike other bc(1) implementations, this bc(1) will
issue a fatal error (see the \f[B]EXIT STATUS\f[R] section) if it cannot
@@ -304,8 +316,8 @@ constant numbers.
It is the \[lq]input\[rq] base, or the number base used for interpreting
input numbers.
\f[B]ibase\f[R] is initially \f[B]10\f[R].
-If the \f[B]-s\f[R] (\f[B]\[en]standard\f[R]) and \f[B]-w\f[R]
-(\f[B]\[en]warn\f[R]) flags were not given on the command line, the max
+If the \f[B]-s\f[R] (\f[B]--standard\f[R]) and \f[B]-w\f[R]
+(\f[B]--warn\f[R]) flags were not given on the command line, the max
allowable value for \f[B]ibase\f[R] is \f[B]36\f[R].
Otherwise, it is \f[B]16\f[R].
The min allowable value for \f[B]ibase\f[R] is \f[B]2\f[R].
@@ -514,6 +526,10 @@ generator with \f[B]rand()\f[R] and \f[B]irand(E)\f[R] are guaranteed to
This is a consequence of using a seeded pseudo-random number generator.
However, they \f[I]are\f[R] guaranteed to be reproducible with identical
\f[B]seed\f[R] values.
+This means that the pseudo-random values from bc(1) should only be used
+where a reproducible stream of pseudo-random numbers is
+\f[I]ESSENTIAL\f[R].
+In any other case, use a non-seeded pseudo-random number generator.
.SS Numbers
.PP
Numbers are strings made up of digits, uppercase letters, and at most
@@ -560,7 +576,7 @@ The following arithmetic and logical operators can be used.
They are listed in order of decreasing precedence.
Operators in the same group have the same precedence.
.TP
-\f[B]++\f[R] \f[B]\[en]\f[R]
+\f[B]++\f[R] \f[B]--\f[R]
Type: Prefix and Postfix
.RS
.PP
@@ -670,7 +686,7 @@ Description: \f[B]boolean or\f[R]
.PP
The operators will be described in more detail below.
.TP
-\f[B]++\f[R] \f[B]\[en]\f[R]
+\f[B]++\f[R] \f[B]--\f[R]
The prefix and postfix \f[B]increment\f[R] and \f[B]decrement\f[R]
operators behave exactly like they would in C.
They require a named expression (see the \f[I]Named Expressions\f[R]
@@ -1116,7 +1132,7 @@ This is a \f[B]non-portable extension\f[R].
.PP
All of the functions below, including the functions in the extended math
library (see the \f[I]Extended Library\f[R] subsection below), are
-available when the \f[B]-l\f[R] or \f[B]\[en]mathlib\f[R] command-line
+available when the \f[B]-l\f[R] or \f[B]--mathlib\f[R] command-line
flags are given, except that the extended math library is not available
when the \f[B]-s\f[R] option, the \f[B]-w\f[R] option, or equivalents
are given.
@@ -1177,7 +1193,7 @@ Functions\f[R] subsection below).
.SS Extended Library
.PP
The extended library is \f[I]not\f[R] loaded when the
-\f[B]-s\f[R]/\f[B]\[en]standard\f[R] or \f[B]-w\f[R]/\f[B]\[en]warn\f[R]
+\f[B]-s\f[R]/\f[B]--standard\f[R] or \f[B]-w\f[R]/\f[B]--warn\f[R]
options are given since they are not part of the library defined by the
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html).
.PP
@@ -1935,11 +1951,11 @@ interactive mode (see the \f[B]INTERACTIVE MODE\f[R] section), since
bc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
more input when one of those errors occurs in interactive mode.
This is also the case when interactive mode is forced by the
-\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
+\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.PP
These exit statuses allow bc(1) to be used in shell scripting with error
checking, and its normal behavior can be forced by using the
-\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
+\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.SH INTERACTIVE MODE
.PP
Per the
@@ -1947,7 +1963,7 @@ standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html),
bc(1) has an interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both \f[B]stdin\f[R]
and \f[B]stdout\f[R] are hooked to a terminal, but the \f[B]-i\f[R] flag
-and \f[B]\[en]interactive\f[R] option can turn it on in other cases.
+and \f[B]--interactive\f[R] option can turn it on in other cases.
.PP
In interactive mode, bc(1) attempts to recover from errors (see the
\f[B]RESET\f[R] section), and in normal execution, flushes
diff --git a/contrib/bc/manuals/bc/P.1.md b/contrib/bc/manuals/bc/P.1.md
index af712806cfc7..489af865475c 100644
--- a/contrib/bc/manuals/bc/P.1.md
+++ b/contrib/bc/manuals/bc/P.1.md
@@ -2,7 +2,7 @@
SPDX-License-Identifier: BSD-2-Clause
-Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+Copyright (c) 2018-2021 Gavin D. Howard and contributors.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
@@ -34,8 +34,7 @@ bc - arbitrary-precision decimal arithmetic language and calculator
# SYNOPSIS
-**bc** [**-ghilPqsvVw**] [**--global-stacks**] [**--help**] [**--interactive**] [**--mathlib**] [**--no-prompt**] [**--quiet**] [**--standard**] [**--warn**] [**--version**] [**-e** *expr*] [**--expression**=*expr*...] [**-f** *file*...] [**-file**=*file*...]
-[*file*...]
+**bc** [**-ghilPqsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@@ -55,7 +54,7 @@ other implementations.
The following are the options that bc(1) accepts.
-**-g**, **--global-stacks**
+**-g**, **-\-global-stacks**
: Turns the globals **ibase**, **obase**, **scale**, and **seed** into stacks.
@@ -123,17 +122,17 @@ The following are the options that bc(1) accepts.
This is a **non-portable extension**.
-**-h**, **--help**
+**-h**, **-\-help**
: Prints a usage message and quits.
-**-i**, **--interactive**
+**-i**, **-\-interactive**
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
This is a **non-portable extension**.
-**-l**, **--mathlib**
+**-l**, **-\-mathlib**
: Sets **scale** (see the **SYNTAX** section) to **20** and loads the included
math library and the extended math library before running any code,
@@ -141,63 +140,70 @@ The following are the options that bc(1) accepts.
To learn what is in the libraries, see the **LIBRARY** section.
-**-P**, **--no-prompt**
+**-P**, **-\-no-prompt**
: This option is a no-op.
This is a **non-portable extension**.
-**-q**, **--quiet**
+**-q**, **-\-quiet**
: This option is for compatibility with the [GNU bc(1)][2]; it is a no-op.
Without this option, GNU bc(1) prints a copyright header. This bc(1) only
prints the copyright header if one or more of the **-v**, **-V**, or
- **--version** options are given.
+ **-\-version** options are given.
This is a **non-portable extension**.
-**-s**, **--standard**
+**-s**, **-\-standard**
: Process exactly the language defined by the [standard][1] and error if any
extensions are used.
This is a **non-portable extension**.
-**-v**, **-V**, **--version**
+**-v**, **-V**, **-\-version**
: Print the version information (copyright header) and exit.
This is a **non-portable extension**.
-**-w**, **--warn**
+**-w**, **-\-warn**
-: Like **-s** and **--standard**, except that warnings (and not errors) are
+: Like **-s** and **-\-standard**, except that warnings (and not errors) are
printed for non-standard extensions and execution continues normally.
This is a **non-portable extension**.
-**-e** *expr*, **--expression**=*expr*
+**-e** *expr*, **-\-expression**=*expr*
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
order. If files are given as well (see below), the expressions and files are
evaluated in the order given. This means that if a file is given before an
expression, the file is read in and evaluated first.
- After processing all expressions and files, bc(1) will exit, unless **-**
- (**stdin**) was given as an argument at least once to **-f** or **--file**.
- However, if any other **-e**, **--expression**, **-f**, or **--file**
- arguments are given after that, bc(1) will give a fatal error and exit.
+ If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
+ see the **ENVIRONMENT VARIABLES** section), then after processing all
+ expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
+ as an argument at least once to **-f** or **-\-file**, whether on the
+ command-line or in **BC_ENV_ARGS**. However, if any other **-e**,
+ **-\-expression**, **-f**, or **-\-file** arguments are given after **-f-**
+ or equivalent is given, bc(1) will give a fatal error and exit.
This is a **non-portable extension**.
-**-f** *file*, **--file**=*file*
+**-f** *file*, **-\-file**=*file*
: Reads in *file* and evaluates it, line by line, as though it were read
through **stdin**. If expressions are also given (see above), the
expressions are evaluated in the order given.
- After processing all expressions and files, bc(1) will exit, unless **-**
- (**stdin**) was given as an argument at least once to **-f** or **--file**.
+ If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
+ see the **ENVIRONMENT VARIABLES** section), then after processing all
+ expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
+ as an argument at least once to **-f** or **-\-file**. However, if any other
+ **-e**, **-\-expression**, **-f**, or **-\-file** arguments are given after
+ **-f-** or equivalent is given, bc(1) will give a fatal error and exit.
This is a **non-portable extension**.
@@ -205,7 +211,9 @@ All long options are **non-portable extensions**.
# STDOUT
-Any non-error output is written to **stdout**.
+Any non-error output is written to **stdout**. In addition, if history (see the
+**HISTORY** section) and the prompt (see the **TTY MODE** section) are enabled,
+both are output to **stdout**.
**Note**: Unlike other bc(1) implementations, this bc(1) will issue a fatal
error (see the **EXIT STATUS** section) if it cannot write to **stdout**, so if
@@ -249,8 +257,8 @@ Identifiers with more than one character (letter) are a
**ibase** is a global variable determining how to interpret constant numbers. It
is the "input" base, or the number base used for interpreting input numbers.
-**ibase** is initially **10**. If the **-s** (**--standard**) and **-w**
-(**--warn**) flags were not given on the command line, the max allowable value
+**ibase** is initially **10**. If the **-s** (**-\-standard**) and **-w**
+(**-\-warn**) flags were not given on the command line, the max allowable value
for **ibase** is **36**. Otherwise, it is **16**. The min allowable value for
**ibase** is **2**. The max allowable value for **ibase** can be queried in
bc(1) programs with the **maxibase()** built-in function.
@@ -399,7 +407,10 @@ generator.
**Note**: The values returned by the pseudo-random number generator with
**rand()** and **irand(E)** are guaranteed to *NOT* be cryptographically secure.
This is a consequence of using a seeded pseudo-random number generator. However,
-they *are* guaranteed to be reproducible with identical **seed** values.
+they *are* guaranteed to be reproducible with identical **seed** values. This
+means that the pseudo-random values from bc(1) should only be used where a
+reproducible stream of pseudo-random numbers is *ESSENTIAL*. In any other case,
+use a non-seeded pseudo-random number generator.
## Numbers
@@ -437,7 +448,7 @@ The following arithmetic and logical operators can be used. They are listed in
order of decreasing precedence. Operators in the same group have the same
precedence.
-**++** **--**
+**++** **-\-**
: Type: Prefix and Postfix
@@ -535,7 +546,7 @@ precedence.
The operators will be described in more detail below.
-**++** **--**
+**++** **-\-**
: The prefix and postfix **increment** and **decrement** operators behave
exactly like they would in C. They require a named expression (see the
@@ -866,7 +877,7 @@ This is a **non-portable extension**.
All of the functions below, including the functions in the extended math
library (see the *Extended Library* subsection below), are available when the
-**-l** or **--mathlib** command-line flags are given, except that the extended
+**-l** or **-\-mathlib** command-line flags are given, except that the extended
math library is not available when the **-s** option, the **-w** option, or
equivalents are given.
@@ -918,8 +929,8 @@ The [standard][1] defines the following functions for the math library:
## Extended Library
-The extended library is *not* loaded when the **-s**/**--standard** or
-**-w**/**--warn** options are given since they are not part of the library
+The extended library is *not* loaded when the **-s**/**-\-standard** or
+**-w**/**-\-warn** options are given since they are not part of the library
defined by the [standard][1].
The extended library is a **non-portable extension**.
@@ -1587,17 +1598,17 @@ The other statuses will only be returned when bc(1) is not in interactive mode
(see the **INTERACTIVE MODE** section), since bc(1) resets its state (see the
**RESET** section) and accepts more input when one of those errors occurs in
interactive mode. This is also the case when interactive mode is forced by the
-**-i** flag or **--interactive** option.
+**-i** flag or **-\-interactive** option.
These exit statuses allow bc(1) to be used in shell scripting with error
checking, and its normal behavior can be forced by using the **-i** flag or
-**--interactive** option.
+**-\-interactive** option.
# INTERACTIVE MODE
Per the [standard][1], bc(1) has an interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both **stdin** and **stdout**
-are hooked to a terminal, but the **-i** flag and **--interactive** option can
+are hooked to a terminal, but the **-i** flag and **-\-interactive** option can
turn it on in other cases.
In interactive mode, bc(1) attempts to recover from errors (see the **RESET**
diff --git a/contrib/bc/manuals/bcl.3 b/contrib/bc/manuals/bcl.3
index cb56f9dd8491..d83a2d3ad2e5 100644
--- a/contrib/bc/manuals/bcl.3
+++ b/contrib/bc/manuals/bcl.3
@@ -1,7 +1,7 @@
.\"
.\" SPDX-License-Identifier: BSD-2-Clause
.\"
-.\" Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+.\" Copyright (c) 2018-2021 Gavin D. Howard and contributors.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions are met:
@@ -25,7 +25,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.TH "BCL" "3" "October 2020" "Gavin D. Howard" "Libraries Manual"
+.TH "BCL" "3" "March 2021" "Gavin D. Howard" "Libraries Manual"
.SH NAME
.PP
bcl - library of arbitrary precision decimal arithmetic
diff --git a/contrib/bc/manuals/bcl.3.md b/contrib/bc/manuals/bcl.3.md
index 93c98923f083..76cd54de92a7 100644
--- a/contrib/bc/manuals/bcl.3.md
+++ b/contrib/bc/manuals/bcl.3.md
@@ -2,7 +2,7 @@
SPDX-License-Identifier: BSD-2-Clause
-Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+Copyright (c) 2018-2021 Gavin D. Howard and contributors.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
@@ -426,7 +426,7 @@ All procedures in this section require a valid current context.
bcl(3) will encode an error in the return value, if there was one. The error
can be queried with **bcl_err(BclNumber)**. Possible errors include:
- * **BCL_ERROR_INVALID_CONTEXT**
+ * **BCL_ERROR_INVALID_CONTEXT**
* **BCL_ERROR_FATAL_ALLOC_ERR**
**void bcl_num_free(BclNumber** *n***)**
@@ -487,7 +487,7 @@ subsection below.
can be queried with **bcl_err(BclNumber)**. Possible errors include:
* **BCL_ERROR_INVALID_NUM**
- * **BCL_ERROR_INVALID_CONTEXT**
+ * **BCL_ERROR_INVALID_CONTEXT**
* **BCL_ERROR_PARSE_INVALID_STR**
* **BCL_ERROR_FATAL_ALLOC_ERR**
@@ -524,7 +524,7 @@ subsection below.
bcl(3) will encode an error in the return value, if there was one. The error
can be queried with **bcl_err(BclNumber)**. Possible errors include:
- * **BCL_ERROR_INVALID_CONTEXT**
+ * **BCL_ERROR_INVALID_CONTEXT**
* **BCL_ERROR_FATAL_ALLOC_ERR**
## Math
@@ -551,7 +551,7 @@ All procedures in this section can return the following errors:
can be queried with **bcl_err(BclNumber)**. Possible errors include:
* **BCL_ERROR_INVALID_NUM**
- * **BCL_ERROR_INVALID_CONTEXT**
+ * **BCL_ERROR_INVALID_CONTEXT**
* **BCL_ERROR_FATAL_ALLOC_ERR**
**BclNumber bcl_sub(BclNumber** *a***, BclNumber** *b***)**
@@ -568,7 +568,7 @@ All procedures in this section can return the following errors:
can be queried with **bcl_err(BclNumber)**. Possible errors include:
* **BCL_ERROR_INVALID_NUM**
- * **BCL_ERROR_INVALID_CONTEXT**
+ * **BCL_ERROR_INVALID_CONTEXT**
* **BCL_ERROR_FATAL_ALLOC_ERR**
**BclNumber bcl_mul(BclNumber** *a***, BclNumber** *b***)**
@@ -587,7 +587,7 @@ All procedures in this section can return the following errors:
can be queried with **bcl_err(BclNumber)**. Possible errors include:
* **BCL_ERROR_INVALID_NUM**
- * **BCL_ERROR_INVALID_CONTEXT**
+ * **BCL_ERROR_INVALID_CONTEXT**
* **BCL_ERROR_FATAL_ALLOC_ERR**
**BclNumber bcl_div(BclNumber** *a***, BclNumber** *b***)**
@@ -606,8 +606,8 @@ All procedures in this section can return the following errors:
can be queried with **bcl_err(BclNumber)**. Possible errors include:
* **BCL_ERROR_INVALID_NUM**
- * **BCL_ERROR_INVALID_CONTEXT**
- * **BCL_ERROR_MATH_DIVIDE_BY_ZERO**
+ * **BCL_ERROR_INVALID_CONTEXT**
+ * **BCL_ERROR_MATH_DIVIDE_BY_ZERO**
* **BCL_ERROR_FATAL_ALLOC_ERR**
**BclNumber bcl_mod(BclNumber** *a***, BclNumber** *b***)**
@@ -626,8 +626,8 @@ All procedures in this section can return the following errors:
can be queried with **bcl_err(BclNumber)**. Possible errors include:
* **BCL_ERROR_INVALID_NUM**
- * **BCL_ERROR_INVALID_CONTEXT**
- * **BCL_ERROR_MATH_DIVIDE_BY_ZERO**
+ * **BCL_ERROR_INVALID_CONTEXT**
+ * **BCL_ERROR_MATH_DIVIDE_BY_ZERO**
* **BCL_ERROR_FATAL_ALLOC_ERR**
**BclNumber bcl_pow(BclNumber** *a***, BclNumber** *b***)**
@@ -649,10 +649,10 @@ All procedures in this section can return the following errors:
can be queried with **bcl_err(BclNumber)**. Possible errors include:
* **BCL_ERROR_INVALID_NUM**
- * **BCL_ERROR_INVALID_CONTEXT**
- * **BCL_ERROR_MATH_NON_INTEGER**
- * **BCL_ERROR_MATH_OVERFLOW**
- * **BCL_ERROR_MATH_DIVIDE_BY_ZERO**
+ * **BCL_ERROR_INVALID_CONTEXT**
+ * **BCL_ERROR_MATH_NON_INTEGER**
+ * **BCL_ERROR_MATH_OVERFLOW**
+ * **BCL_ERROR_MATH_DIVIDE_BY_ZERO**
* **BCL_ERROR_FATAL_ALLOC_ERR**
**BclNumber bcl_lshift(BclNumber** *a***, BclNumber** *b***)**
@@ -671,8 +671,8 @@ All procedures in this section can return the following errors:
can be queried with **bcl_err(BclNumber)**. Possible errors include:
* **BCL_ERROR_INVALID_NUM**
- * **BCL_ERROR_INVALID_CONTEXT**
- * **BCL_ERROR_MATH_NON_INTEGER**
+ * **BCL_ERROR_INVALID_CONTEXT**
+ * **BCL_ERROR_MATH_NON_INTEGER**
* **BCL_ERROR_FATAL_ALLOC_ERR**
**BclNumber bcl_rshift(BclNumber** *a***, BclNumber** *b***)**
@@ -691,8 +691,8 @@ All procedures in this section can return the following errors:
can be queried with **bcl_err(BclNumber)**. Possible errors include:
* **BCL_ERROR_INVALID_NUM**
- * **BCL_ERROR_INVALID_CONTEXT**
- * **BCL_ERROR_MATH_NON_INTEGER**
+ * **BCL_ERROR_INVALID_CONTEXT**
+ * **BCL_ERROR_MATH_NON_INTEGER**
* **BCL_ERROR_FATAL_ALLOC_ERR**
**BclNumber bcl_sqrt(BclNumber** *a***)**
@@ -709,8 +709,8 @@ All procedures in this section can return the following errors:
can be queried with **bcl_err(BclNumber)**. Possible errors include:
* **BCL_ERROR_INVALID_NUM**
- * **BCL_ERROR_INVALID_CONTEXT**
- * **BCL_ERROR_MATH_NEGATIVE**
+ * **BCL_ERROR_INVALID_CONTEXT**
+ * **BCL_ERROR_MATH_NEGATIVE**
* **BCL_ERROR_FATAL_ALLOC_ERR**
**BclError bcl_divmod(BclNumber** *a***, BclNumber** *b***, BclNumber \****c***, BclNumber \****d***)**
@@ -719,7 +719,7 @@ All procedures in this section can return the following errors:
into the space pointed to by *c*, and puts the modulus in a new number which
is put into the space pointed to by *d*.
- *b* cannot be **0**.
+ *b* cannot be **0**.
*a* and *b* are consumed; they cannot be used after the call. See the
**Consumption and Propagation** subsection below.
@@ -731,8 +731,8 @@ All procedures in this section can return the following errors:
function can return:
* **BCL_ERROR_INVALID_NUM**
- * **BCL_ERROR_INVALID_CONTEXT**
- * **BCL_ERROR_MATH_DIVIDE_BY_ZERO**
+ * **BCL_ERROR_INVALID_CONTEXT**
+ * **BCL_ERROR_MATH_DIVIDE_BY_ZERO**
* **BCL_ERROR_FATAL_ALLOC_ERR**
**BclNumber bcl_modexp(BclNumber** *a***, BclNumber** *b***, BclNumber** *c***)**
@@ -751,10 +751,10 @@ All procedures in this section can return the following errors:
can be queried with **bcl_err(BclNumber)**. Possible errors include:
* **BCL_ERROR_INVALID_NUM**
- * **BCL_ERROR_INVALID_CONTEXT**
- * **BCL_ERROR_MATH_NEGATIVE**
- * **BCL_ERROR_MATH_NON_INTEGER**
- * **BCL_ERROR_MATH_DIVIDE_BY_ZERO**
+ * **BCL_ERROR_INVALID_CONTEXT**
+ * **BCL_ERROR_MATH_NEGATIVE**
+ * **BCL_ERROR_MATH_NON_INTEGER**
+ * **BCL_ERROR_MATH_DIVIDE_BY_ZERO**
* **BCL_ERROR_FATAL_ALLOC_ERR**
## Miscellaneous
@@ -791,7 +791,7 @@ All procedures in this section can return the following errors:
can be queried with **bcl_err(BclNumber)**. Possible errors include:
* **BCL_ERROR_INVALID_NUM**
- * **BCL_ERROR_INVALID_CONTEXT**
+ * **BCL_ERROR_INVALID_CONTEXT**
* **BCL_ERROR_FATAL_ALLOC_ERR**
## Pseudo-Random Number Generator
@@ -852,9 +852,9 @@ procedures require a valid current context.
can be queried with **bcl_err(BclNumber)**. Possible errors include:
* **BCL_ERROR_INVALID_NUM**
- * **BCL_ERROR_INVALID_CONTEXT**
- * **BCL_ERROR_MATH_NEGATIVE**
- * **BCL_ERROR_MATH_NON_INTEGER**
+ * **BCL_ERROR_INVALID_CONTEXT**
+ * **BCL_ERROR_MATH_NEGATIVE**
+ * **BCL_ERROR_MATH_NON_INTEGER**
* **BCL_ERROR_FATAL_ALLOC_ERR**
**BclNumber bcl_frand(size_t** *places***)**
@@ -868,7 +868,7 @@ procedures require a valid current context.
bcl(3) will encode an error in the return value, if there was one. The error
can be queried with **bcl_err(BclNumber)**. Possible errors include:
- * **BCL_ERROR_INVALID_CONTEXT**
+ * **BCL_ERROR_INVALID_CONTEXT**
* **BCL_ERROR_FATAL_ALLOC_ERR**
**BclNumber bcl_ifrand(BclNumber** *a***, size_t** *places***)**
@@ -887,9 +887,9 @@ procedures require a valid current context.
can be queried with **bcl_err(BclNumber)**. Possible errors include:
* **BCL_ERROR_INVALID_NUM**
- * **BCL_ERROR_INVALID_CONTEXT**
- * **BCL_ERROR_MATH_NEGATIVE**
- * **BCL_ERROR_MATH_NON_INTEGER**
+ * **BCL_ERROR_INVALID_CONTEXT**
+ * **BCL_ERROR_MATH_NEGATIVE**
+ * **BCL_ERROR_MATH_NON_INTEGER**
* **BCL_ERROR_FATAL_ALLOC_ERR**
**BclError bcl_rand_seedWithNum(BclNumber** *n***)**
@@ -904,7 +904,7 @@ procedures require a valid current context.
function can return:
* **BCL_ERROR_INVALID_NUM**
- * **BCL_ERROR_INVALID_CONTEXT**
+ * **BCL_ERROR_INVALID_CONTEXT**
Note that if **bcl_rand_seed2num(***void***)** or
**bcl_rand_seed2num_err(BclNumber)** are called right after this function,
@@ -917,7 +917,7 @@ procedures require a valid current context.
If there was no error, **BCL_ERROR_NONE** is returned. Otherwise, this
function can return:
- * **BCL_ERROR_INVALID_CONTEXT**
+ * **BCL_ERROR_INVALID_CONTEXT**
**void bcl_rand_reseed(***void***)**
@@ -935,7 +935,7 @@ procedures require a valid current context.
bcl(3) will encode an error in the return value, if there was one. The error
can be queried with **bcl_err(BclNumber)**. Possible errors include:
- * **BCL_ERROR_INVALID_CONTEXT**
+ * **BCL_ERROR_INVALID_CONTEXT**
* **BCL_ERROR_FATAL_ALLOC_ERR**
**BclRandInt bcl_rand_int(***void***)**
diff --git a/contrib/bc/manuals/build.md b/contrib/bc/manuals/build.md
index 47fbabdfad7f..a58da6d427ed 100644
--- a/contrib/bc/manuals/build.md
+++ b/contrib/bc/manuals/build.md
@@ -164,6 +164,22 @@ Can be overridden by passing the `--bindir` option to `configure.sh`.
Defaults to `$PREFIX/bin`.
+### `INCLUDEDIR`
+
+The directory to install header files in.
+
+Can be overridden by passing the `--includedir` option to `configure.sh`.
+
+Defaults to `$PREFIX/include`.
+
+### `LIBDIR`
+
+The directory to install libraries in.
+
+Can be overridden by passing the `--libdir` option to `configure.sh`.
+
+Defaults to `$PREFIX/lib`.
+
### `DATAROOTDIR`
The root directory to install data files in.
diff --git a/contrib/bc/manuals/dc.1.md.in b/contrib/bc/manuals/dc.1.md.in
index 5308b1c604a5..c5c361fe271a 100644
--- a/contrib/bc/manuals/dc.1.md.in
+++ b/contrib/bc/manuals/dc.1.md.in
@@ -2,7 +2,7 @@
SPDX-License-Identifier: BSD-2-Clause
-Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+Copyright (c) 2018-2021 Gavin D. Howard and contributors.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
@@ -34,7 +34,7 @@ dc - arbitrary-precision decimal reverse-Polish notation calculator
# SYNOPSIS
-**dc** [**-hiPvVx**] [**--version**] [**--help**] [**--interactive**] [**--no-prompt**] [**--extended-register**] [**-e** *expr*] [**--expression**=*expr*...] [**-f** *file*...] [**-file**=*file*...] [*file*...]
+**dc** [**-hiPvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@@ -43,11 +43,11 @@ notation) to store numbers and results of computations. Arithmetic operations
pop arguments off of the stack and push the results.
If no files are given on the command-line as extra arguments (i.e., not as
-**-f** or **--file** arguments), then dc(1) reads from **stdin**. Otherwise,
+**-f** or **-\-file** arguments), then dc(1) reads from **stdin**. Otherwise,
those files are processed, and dc(1) will then exit.
This is different from the dc(1) on OpenBSD and possibly other dc(1)
-implementations, where **-e** (**--expression**) and **-f** (**--file**)
+implementations, where **-e** (**-\-expression**) and **-f** (**-\-file**)
arguments cause dc(1) to execute them and exit. The reason for this is that this
dc(1) allows users to set arguments in the environment variable **DC_ENV_ARGS**
(see the **ENVIRONMENT VARIABLES** section). Any expressions given on the
@@ -64,21 +64,21 @@ as the last command-line argument or define the environment variable
The following are the options that dc(1) accepts.
-**-h**, **--help**
+**-h**, **-\-help**
: Prints a usage message and quits.
-**-v**, **-V**, **--version**
+**-v**, **-V**, **-\-version**
: Print the version information (copyright header) and exit.
-**-i**, **--interactive**
+**-i**, **-\-interactive**
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
This is a **non-portable extension**.
-**-P**, **--no-prompt**
+**-P**, **-\-no-prompt**
{{ A E H N EH EN HN EHN }}
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
@@ -92,35 +92,42 @@ The following are the options that dc(1) accepts.
This is a **non-portable extension**.
-**-x** **--extended-register**
+**-x** **-\-extended-register**
: Enables extended register mode. See the *Extended Register Mode* subsection
of the **REGISTERS** section for more information.
This is a **non-portable extension**.
-**-e** *expr*, **--expression**=*expr*
+**-e** *expr*, **-\-expression**=*expr*
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
order. If files are given as well (see below), the expressions and files are
evaluated in the order given. This means that if a file is given before an
expression, the file is read in and evaluated first.
- After processing all expressions and files, dc(1) will exit, unless **-**
- (**stdin**) was given as an argument at least once to **-f** or **--file**.
+ If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
+ see the **ENVIRONMENT VARIABLES** section), then after processing all
+ expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
+ as an argument at least once to **-f** or **-\-file**, whether on the
+ command-line or in **DC_ENV_ARGS**. However, if any other **-e**,
+ **-\-expression**, **-f**, or **-\-file** arguments are given after **-f-**
+ or equivalent is given, dc(1) will give a fatal error and exit.
This is a **non-portable extension**.
-**-f** *file*, **--file**=*file*
+**-f** *file*, **-\-file**=*file*
: Reads in *file* and evaluates it, line by line, as though it were read
through **stdin**. If expressions are also given (see above), the
expressions are evaluated in the order given.
- After processing all expressions and files, dc(1) will exit, unless **-**
- (**stdin**) was given as an argument at least once to **-f** or **--file**.
- However, if any other **-e**, **--expression**, **-f**, or **--file**
- arguments are given after that, bc(1) will give a fatal error and exit.
+ If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
+ see the **ENVIRONMENT VARIABLES** section), then after processing all
+ expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
+ as an argument at least once to **-f** or **-\-file**. However, if any other
+ **-e**, **-\-expression**, **-f**, or **-\-file** arguments are given after
+ **-f-** or equivalent is given, dc(1) will give a fatal error and exit.
This is a **non-portable extension**.
@@ -128,7 +135,9 @@ All long options are **non-portable extensions**.
# STDOUT
-Any non-error output is written to **stdout**.
+Any non-error output is written to **stdout**. In addition, if history (see the
+**HISTORY** section) and the prompt (see the **TTY MODE** section) are enabled,
+both are output to **stdout**.
**Note**: Unlike other dc(1) implementations, this dc(1) will issue a fatal
error (see the **EXIT STATUS** section) if it cannot write to **stdout**, so if
@@ -208,7 +217,10 @@ command or the **"** command that does not get receive a value of **0** or
**Note**: The values returned by the pseudo-random number generator with the
**'** and **"** commands are guaranteed to **NOT** be cryptographically secure.
This is a consequence of using a seeded pseudo-random number generator. However,
-they **are** guaranteed to be reproducible with identical **seed** values.
+they *are* guaranteed to be reproducible with identical **seed** values. This
+means that the pseudo-random values from dc(1) should only be used where a
+reproducible stream of pseudo-random numbers is *ESSENTIAL*. In any other case,
+use a non-seeded pseudo-random number generator.
The pseudo-random number generator, **seed**, and all associated operations are
**non-portable extensions**.
@@ -935,7 +947,7 @@ follows any command that needs a register name. The only exception is a newline
Unlike most other dc(1) implentations, this dc(1) provides nearly unlimited
amounts of registers, if extended register mode is enabled.
-If extended register mode is enabled (**-x** or **--extended-register**
+If extended register mode is enabled (**-x** or **-\-extended-register**
command-line arguments are given), then normal single character registers are
used *unless* the character immediately following a command that needs a
register name is a space (according to **isspace()**) and not a newline
@@ -1070,7 +1082,7 @@ dc(1) recognizes the following environment variables:
The quote parsing will handle either kind of quotes, **'** or **"**. Thus,
if you have a file with any number of single quotes in the name, you can use
- double quotes as the outside quotes, as in **"some 'bc' file.bc"**, and vice
+ double quotes as the outside quotes, as in **"some 'dc' file.dc"**, and vice
versa if you have a file with double quotes. However, handling a file with
both kinds of quotes in **DC_ENV_ARGS** is not supported due to the
complexity of the parsing, though such files are still supported on the
@@ -1156,17 +1168,17 @@ The other statuses will only be returned when dc(1) is not in interactive mode
(see the **INTERACTIVE MODE** section), since dc(1) resets its state (see the
**RESET** section) and accepts more input when one of those errors occurs in
interactive mode. This is also the case when interactive mode is forced by the
-**-i** flag or **--interactive** option.
+**-i** flag or **-\-interactive** option.
These exit statuses allow dc(1) to be used in shell scripting with error
checking, and its normal behavior can be forced by using the **-i** flag or
-**--interactive** option.
+**-\-interactive** option.
# INTERACTIVE MODE
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both **stdin** and **stdout**
-are hooked to a terminal, but the **-i** flag and **--interactive** option can
+are hooked to a terminal, but the **-i** flag and **-\-interactive** option can
turn it on in other cases.
In interactive mode, dc(1) attempts to recover from errors (see the **RESET**
diff --git a/contrib/bc/manuals/dc/A.1 b/contrib/bc/manuals/dc/A.1
index c993afb1fd4e..7b91c02039e4 100644
--- a/contrib/bc/manuals/dc/A.1
+++ b/contrib/bc/manuals/dc/A.1
@@ -1,7 +1,7 @@
.\"
.\" SPDX-License-Identifier: BSD-2-Clause
.\"
-.\" Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+.\" Copyright (c) 2018-2021 Gavin D. Howard and contributors.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions are met:
@@ -25,18 +25,17 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.TH "DC" "1" "October 2020" "Gavin D. Howard" "General Commands Manual"
+.TH "DC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
.SH Name
.PP
dc - arbitrary-precision decimal reverse-Polish notation calculator
.SH SYNOPSIS
.PP
-\f[B]dc\f[R] [\f[B]-hiPvVx\f[R]] [\f[B]\[en]version\f[R]]
-[\f[B]\[en]help\f[R]] [\f[B]\[en]interactive\f[R]]
-[\f[B]\[en]no-prompt\f[R]] [\f[B]\[en]extended-register\f[R]]
-[\f[B]-e\f[R] \f[I]expr\f[R]]
-[\f[B]\[en]expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
-\f[I]file\f[R]\&...] [\f[B]-file\f[R]=\f[I]file\f[R]\&...]
+\f[B]dc\f[R] [\f[B]-hiPvVx\f[R]] [\f[B]--version\f[R]]
+[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--no-prompt\f[R]]
+[\f[B]--extended-register\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
+[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
+\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
[\f[I]file\f[R]\&...]
.SH DESCRIPTION
.PP
@@ -47,13 +46,13 @@ Arithmetic operations pop arguments off of the stack and push the
results.
.PP
If no files are given on the command-line as extra arguments (i.e., not
-as \f[B]-f\f[R] or \f[B]\[en]file\f[R] arguments), then dc(1) reads from
+as \f[B]-f\f[R] or \f[B]--file\f[R] arguments), then dc(1) reads from
\f[B]stdin\f[R].
Otherwise, those files are processed, and dc(1) will then exit.
.PP
This is different from the dc(1) on OpenBSD and possibly other dc(1)
-implementations, where \f[B]-e\f[R] (\f[B]\[en]expression\f[R]) and
-\f[B]-f\f[R] (\f[B]\[en]file\f[R]) arguments cause dc(1) to execute them
+implementations, where \f[B]-e\f[R] (\f[B]--expression\f[R]) and
+\f[B]-f\f[R] (\f[B]--file\f[R]) arguments cause dc(1) to execute them
and exit.
The reason for this is that this dc(1) allows users to set arguments in
the environment variable \f[B]DC_ENV_ARGS\f[R] (see the \f[B]ENVIRONMENT
@@ -72,13 +71,13 @@ argument or define the environment variable \f[B]DC_EXPR_EXIT\f[R].
.PP
The following are the options that dc(1) accepts.
.TP
-\f[B]-h\f[R], \f[B]\[en]help\f[R]
+\f[B]-h\f[R], \f[B]--help\f[R]
Prints a usage message and quits.
.TP
-\f[B]-v\f[R], \f[B]-V\f[R], \f[B]\[en]version\f[R]
+\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
Print the version information (copyright header) and exit.
.TP
-\f[B]-i\f[R], \f[B]\[en]interactive\f[R]
+\f[B]-i\f[R], \f[B]--interactive\f[R]
Forces interactive mode.
(See the \f[B]INTERACTIVE MODE\f[R] section.)
.RS
@@ -86,7 +85,7 @@ Forces interactive mode.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-P\f[R], \f[B]\[en]no-prompt\f[R]
+\f[B]-P\f[R], \f[B]--no-prompt\f[R]
Disables the prompt in TTY mode.
(The prompt is only enabled in TTY mode.
See the \f[B]TTY MODE\f[R] section) This is mostly for those users that
@@ -98,7 +97,7 @@ Most of those users would want to put this option in
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-x\f[R] \f[B]\[en]extended-register\f[R]
+\f[B]-x\f[R] \f[B]--extended-register\f[R]
Enables extended register mode.
See the \f[I]Extended Register Mode\f[R] subsection of the
\f[B]REGISTERS\f[R] section for more information.
@@ -107,7 +106,7 @@ See the \f[I]Extended Register Mode\f[R] subsection of the
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-e\f[R] \f[I]expr\f[R], \f[B]\[en]expression\f[R]=\f[I]expr\f[R]
+\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
Evaluates \f[I]expr\f[R].
If multiple expressions are given, they are evaluated in order.
If files are given as well (see below), the expressions and files are
@@ -116,26 +115,36 @@ This means that if a file is given before an expression, the file is
read in and evaluated first.
.RS
.PP
-After processing all expressions and files, dc(1) will exit, unless
+If this option is given on the command-line (i.e., not in
+\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
+then after processing all expressions and files, dc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]\[en]file\f[R].
+\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
+\f[B]DC_ENV_ARGS\f[R].
+However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
+\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
+\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
+exit.
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-f\f[R] \f[I]file\f[R], \f[B]\[en]file\f[R]=\f[I]file\f[R]
+\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
were read through \f[B]stdin\f[R].
If expressions are also given (see above), the expressions are evaluated
in the order given.
.RS
.PP
-After processing all expressions and files, dc(1) will exit, unless
+If this option is given on the command-line (i.e., not in
+\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
+then after processing all expressions and files, dc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]\[en]file\f[R].
-However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
-\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after that,
-bc(1) will give a fatal error and exit.
+\f[B]-f\f[R] or \f[B]--file\f[R].
+However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
+\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
+\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
+exit.
.PP
This is a \f[B]non-portable extension\f[R].
.RE
@@ -144,6 +153,9 @@ All long options are \f[B]non-portable extensions\f[R].
.SH STDOUT
.PP
Any non-error output is written to \f[B]stdout\f[R].
+In addition, if history (see the \f[B]HISTORY\f[R] section) and the
+prompt (see the \f[B]TTY MODE\f[R] section) are enabled, both are output
+to \f[B]stdout\f[R].
.PP
\f[B]Note\f[R]: Unlike other dc(1) implementations, this dc(1) will
issue a fatal error (see the \f[B]EXIT STATUS\f[R] section) if it cannot
@@ -233,8 +245,12 @@ queried with the \f[B]W\f[R] command.
generator with the \f[B]\[cq]\f[R] and \f[B]\[dq]\f[R] commands are
guaranteed to \f[B]NOT\f[R] be cryptographically secure.
This is a consequence of using a seeded pseudo-random number generator.
-However, they \f[B]are\f[R] guaranteed to be reproducible with identical
+However, they \f[I]are\f[R] guaranteed to be reproducible with identical
\f[B]seed\f[R] values.
+This means that the pseudo-random values from dc(1) should only be used
+where a reproducible stream of pseudo-random numbers is
+\f[I]ESSENTIAL\f[R].
+In any other case, use a non-seeded pseudo-random number generator.
.PP
The pseudo-random number generator, \f[B]seed\f[R], and all associated
operations are \f[B]non-portable extensions\f[R].
@@ -1020,7 +1036,7 @@ Unlike most other dc(1) implentations, this dc(1) provides nearly
unlimited amounts of registers, if extended register mode is enabled.
.PP
If extended register mode is enabled (\f[B]-x\f[R] or
-\f[B]\[en]extended-register\f[R] command-line arguments are given), then
+\f[B]--extended-register\f[R] command-line arguments are given), then
normal single character registers are used \f[I]unless\f[R] the
character immediately following a command that needs a register name is
a space (according to \f[B]isspace()\f[R]) and not a newline
@@ -1160,7 +1176,7 @@ will be correctly parsed, but the string \f[B]\[lq]/home/gavin/some
The quote parsing will handle either kind of quotes, \f[B]\[cq]\f[R] or
\f[B]\[lq]\f[R]. Thus, if you have a file with any number of single
quotes in the name, you can use double quotes as the outside quotes, as
-in \f[B]\[rq]some `bc' file.bc\[dq]\f[R], and vice versa if you have a
+in \f[B]\[rq]some `dc' file.dc\[dq]\f[R], and vice versa if you have a
file with double quotes.
However, handling a file with both kinds of quotes in
\f[B]DC_ENV_ARGS\f[R] is not supported due to the complexity of the
@@ -1243,17 +1259,17 @@ interactive mode (see the \f[B]INTERACTIVE MODE\f[R] section), since
dc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
more input when one of those errors occurs in interactive mode.
This is also the case when interactive mode is forced by the
-\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
+\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.PP
These exit statuses allow dc(1) to be used in shell scripting with error
checking, and its normal behavior can be forced by using the
-\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
+\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.SH INTERACTIVE MODE
.PP
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both \f[B]stdin\f[R]
and \f[B]stdout\f[R] are hooked to a terminal, but the \f[B]-i\f[R] flag
-and \f[B]\[en]interactive\f[R] option can turn it on in other cases.
+and \f[B]--interactive\f[R] option can turn it on in other cases.
.PP
In interactive mode, dc(1) attempts to recover from errors (see the
\f[B]RESET\f[R] section), and in normal execution, flushes
diff --git a/contrib/bc/manuals/dc/A.1.md b/contrib/bc/manuals/dc/A.1.md
index d48b2429aaa2..e53646c2fba3 100644
--- a/contrib/bc/manuals/dc/A.1.md
+++ b/contrib/bc/manuals/dc/A.1.md
@@ -2,7 +2,7 @@
SPDX-License-Identifier: BSD-2-Clause
-Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+Copyright (c) 2018-2021 Gavin D. Howard and contributors.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
@@ -34,7 +34,7 @@ dc - arbitrary-precision decimal reverse-Polish notation calculator
# SYNOPSIS
-**dc** [**-hiPvVx**] [**--version**] [**--help**] [**--interactive**] [**--no-prompt**] [**--extended-register**] [**-e** *expr*] [**--expression**=*expr*...] [**-f** *file*...] [**-file**=*file*...] [*file*...]
+**dc** [**-hiPvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@@ -43,11 +43,11 @@ notation) to store numbers and results of computations. Arithmetic operations
pop arguments off of the stack and push the results.
If no files are given on the command-line as extra arguments (i.e., not as
-**-f** or **--file** arguments), then dc(1) reads from **stdin**. Otherwise,
+**-f** or **-\-file** arguments), then dc(1) reads from **stdin**. Otherwise,
those files are processed, and dc(1) will then exit.
This is different from the dc(1) on OpenBSD and possibly other dc(1)
-implementations, where **-e** (**--expression**) and **-f** (**--file**)
+implementations, where **-e** (**-\-expression**) and **-f** (**-\-file**)
arguments cause dc(1) to execute them and exit. The reason for this is that this
dc(1) allows users to set arguments in the environment variable **DC_ENV_ARGS**
(see the **ENVIRONMENT VARIABLES** section). Any expressions given on the
@@ -64,21 +64,21 @@ as the last command-line argument or define the environment variable
The following are the options that dc(1) accepts.
-**-h**, **--help**
+**-h**, **-\-help**
: Prints a usage message and quits.
-**-v**, **-V**, **--version**
+**-v**, **-V**, **-\-version**
: Print the version information (copyright header) and exit.
-**-i**, **--interactive**
+**-i**, **-\-interactive**
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
This is a **non-portable extension**.
-**-P**, **--no-prompt**
+**-P**, **-\-no-prompt**
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
See the **TTY MODE** section) This is mostly for those users that do not
@@ -87,35 +87,42 @@ The following are the options that dc(1) accepts.
This is a **non-portable extension**.
-**-x** **--extended-register**
+**-x** **-\-extended-register**
: Enables extended register mode. See the *Extended Register Mode* subsection
of the **REGISTERS** section for more information.
This is a **non-portable extension**.
-**-e** *expr*, **--expression**=*expr*
+**-e** *expr*, **-\-expression**=*expr*
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
order. If files are given as well (see below), the expressions and files are
evaluated in the order given. This means that if a file is given before an
expression, the file is read in and evaluated first.
- After processing all expressions and files, dc(1) will exit, unless **-**
- (**stdin**) was given as an argument at least once to **-f** or **--file**.
+ If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
+ see the **ENVIRONMENT VARIABLES** section), then after processing all
+ expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
+ as an argument at least once to **-f** or **-\-file**, whether on the
+ command-line or in **DC_ENV_ARGS**. However, if any other **-e**,
+ **-\-expression**, **-f**, or **-\-file** arguments are given after **-f-**
+ or equivalent is given, dc(1) will give a fatal error and exit.
This is a **non-portable extension**.
-**-f** *file*, **--file**=*file*
+**-f** *file*, **-\-file**=*file*
: Reads in *file* and evaluates it, line by line, as though it were read
through **stdin**. If expressions are also given (see above), the
expressions are evaluated in the order given.
- After processing all expressions and files, dc(1) will exit, unless **-**
- (**stdin**) was given as an argument at least once to **-f** or **--file**.
- However, if any other **-e**, **--expression**, **-f**, or **--file**
- arguments are given after that, bc(1) will give a fatal error and exit.
+ If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
+ see the **ENVIRONMENT VARIABLES** section), then after processing all
+ expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
+ as an argument at least once to **-f** or **-\-file**. However, if any other
+ **-e**, **-\-expression**, **-f**, or **-\-file** arguments are given after
+ **-f-** or equivalent is given, dc(1) will give a fatal error and exit.
This is a **non-portable extension**.
@@ -123,7 +130,9 @@ All long options are **non-portable extensions**.
# STDOUT
-Any non-error output is written to **stdout**.
+Any non-error output is written to **stdout**. In addition, if history (see the
+**HISTORY** section) and the prompt (see the **TTY MODE** section) are enabled,
+both are output to **stdout**.
**Note**: Unlike other dc(1) implementations, this dc(1) will issue a fatal
error (see the **EXIT STATUS** section) if it cannot write to **stdout**, so if
@@ -197,7 +206,10 @@ command or the **"** command that does not get receive a value of **0** or
**Note**: The values returned by the pseudo-random number generator with the
**'** and **"** commands are guaranteed to **NOT** be cryptographically secure.
This is a consequence of using a seeded pseudo-random number generator. However,
-they **are** guaranteed to be reproducible with identical **seed** values.
+they *are* guaranteed to be reproducible with identical **seed** values. This
+means that the pseudo-random values from dc(1) should only be used where a
+reproducible stream of pseudo-random numbers is *ESSENTIAL*. In any other case,
+use a non-seeded pseudo-random number generator.
The pseudo-random number generator, **seed**, and all associated operations are
**non-portable extensions**.
@@ -897,7 +909,7 @@ follows any command that needs a register name. The only exception is a newline
Unlike most other dc(1) implentations, this dc(1) provides nearly unlimited
amounts of registers, if extended register mode is enabled.
-If extended register mode is enabled (**-x** or **--extended-register**
+If extended register mode is enabled (**-x** or **-\-extended-register**
command-line arguments are given), then normal single character registers are
used *unless* the character immediately following a command that needs a
register name is a space (according to **isspace()**) and not a newline
@@ -1030,7 +1042,7 @@ dc(1) recognizes the following environment variables:
The quote parsing will handle either kind of quotes, **'** or **"**. Thus,
if you have a file with any number of single quotes in the name, you can use
- double quotes as the outside quotes, as in **"some 'bc' file.bc"**, and vice
+ double quotes as the outside quotes, as in **"some 'dc' file.dc"**, and vice
versa if you have a file with double quotes. However, handling a file with
both kinds of quotes in **DC_ENV_ARGS** is not supported due to the
complexity of the parsing, though such files are still supported on the
@@ -1106,17 +1118,17 @@ The other statuses will only be returned when dc(1) is not in interactive mode
(see the **INTERACTIVE MODE** section), since dc(1) resets its state (see the
**RESET** section) and accepts more input when one of those errors occurs in
interactive mode. This is also the case when interactive mode is forced by the
-**-i** flag or **--interactive** option.
+**-i** flag or **-\-interactive** option.
These exit statuses allow dc(1) to be used in shell scripting with error
checking, and its normal behavior can be forced by using the **-i** flag or
-**--interactive** option.
+**-\-interactive** option.
# INTERACTIVE MODE
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both **stdin** and **stdout**
-are hooked to a terminal, but the **-i** flag and **--interactive** option can
+are hooked to a terminal, but the **-i** flag and **-\-interactive** option can
turn it on in other cases.
In interactive mode, dc(1) attempts to recover from errors (see the **RESET**
diff --git a/contrib/bc/manuals/dc/E.1 b/contrib/bc/manuals/dc/E.1
index 1e04920d51fd..ebe8db87e996 100644
--- a/contrib/bc/manuals/dc/E.1
+++ b/contrib/bc/manuals/dc/E.1
@@ -1,7 +1,7 @@
.\"
.\" SPDX-License-Identifier: BSD-2-Clause
.\"
-.\" Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+.\" Copyright (c) 2018-2021 Gavin D. Howard and contributors.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions are met:
@@ -25,18 +25,17 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.TH "DC" "1" "October 2020" "Gavin D. Howard" "General Commands Manual"
+.TH "DC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
.SH Name
.PP
dc - arbitrary-precision decimal reverse-Polish notation calculator
.SH SYNOPSIS
.PP
-\f[B]dc\f[R] [\f[B]-hiPvVx\f[R]] [\f[B]\[en]version\f[R]]
-[\f[B]\[en]help\f[R]] [\f[B]\[en]interactive\f[R]]
-[\f[B]\[en]no-prompt\f[R]] [\f[B]\[en]extended-register\f[R]]
-[\f[B]-e\f[R] \f[I]expr\f[R]]
-[\f[B]\[en]expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
-\f[I]file\f[R]\&...] [\f[B]-file\f[R]=\f[I]file\f[R]\&...]
+\f[B]dc\f[R] [\f[B]-hiPvVx\f[R]] [\f[B]--version\f[R]]
+[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--no-prompt\f[R]]
+[\f[B]--extended-register\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
+[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
+\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
[\f[I]file\f[R]\&...]
.SH DESCRIPTION
.PP
@@ -47,13 +46,13 @@ Arithmetic operations pop arguments off of the stack and push the
results.
.PP
If no files are given on the command-line as extra arguments (i.e., not
-as \f[B]-f\f[R] or \f[B]\[en]file\f[R] arguments), then dc(1) reads from
+as \f[B]-f\f[R] or \f[B]--file\f[R] arguments), then dc(1) reads from
\f[B]stdin\f[R].
Otherwise, those files are processed, and dc(1) will then exit.
.PP
This is different from the dc(1) on OpenBSD and possibly other dc(1)
-implementations, where \f[B]-e\f[R] (\f[B]\[en]expression\f[R]) and
-\f[B]-f\f[R] (\f[B]\[en]file\f[R]) arguments cause dc(1) to execute them
+implementations, where \f[B]-e\f[R] (\f[B]--expression\f[R]) and
+\f[B]-f\f[R] (\f[B]--file\f[R]) arguments cause dc(1) to execute them
and exit.
The reason for this is that this dc(1) allows users to set arguments in
the environment variable \f[B]DC_ENV_ARGS\f[R] (see the \f[B]ENVIRONMENT
@@ -72,13 +71,13 @@ argument or define the environment variable \f[B]DC_EXPR_EXIT\f[R].
.PP
The following are the options that dc(1) accepts.
.TP
-\f[B]-h\f[R], \f[B]\[en]help\f[R]
+\f[B]-h\f[R], \f[B]--help\f[R]
Prints a usage message and quits.
.TP
-\f[B]-v\f[R], \f[B]-V\f[R], \f[B]\[en]version\f[R]
+\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
Print the version information (copyright header) and exit.
.TP
-\f[B]-i\f[R], \f[B]\[en]interactive\f[R]
+\f[B]-i\f[R], \f[B]--interactive\f[R]
Forces interactive mode.
(See the \f[B]INTERACTIVE MODE\f[R] section.)
.RS
@@ -86,7 +85,7 @@ Forces interactive mode.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-P\f[R], \f[B]\[en]no-prompt\f[R]
+\f[B]-P\f[R], \f[B]--no-prompt\f[R]
Disables the prompt in TTY mode.
(The prompt is only enabled in TTY mode.
See the \f[B]TTY MODE\f[R] section) This is mostly for those users that
@@ -98,7 +97,7 @@ Most of those users would want to put this option in
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-x\f[R] \f[B]\[en]extended-register\f[R]
+\f[B]-x\f[R] \f[B]--extended-register\f[R]
Enables extended register mode.
See the \f[I]Extended Register Mode\f[R] subsection of the
\f[B]REGISTERS\f[R] section for more information.
@@ -107,7 +106,7 @@ See the \f[I]Extended Register Mode\f[R] subsection of the
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-e\f[R] \f[I]expr\f[R], \f[B]\[en]expression\f[R]=\f[I]expr\f[R]
+\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
Evaluates \f[I]expr\f[R].
If multiple expressions are given, they are evaluated in order.
If files are given as well (see below), the expressions and files are
@@ -116,26 +115,36 @@ This means that if a file is given before an expression, the file is
read in and evaluated first.
.RS
.PP
-After processing all expressions and files, dc(1) will exit, unless
+If this option is given on the command-line (i.e., not in
+\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
+then after processing all expressions and files, dc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]\[en]file\f[R].
+\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
+\f[B]DC_ENV_ARGS\f[R].
+However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
+\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
+\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
+exit.
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-f\f[R] \f[I]file\f[R], \f[B]\[en]file\f[R]=\f[I]file\f[R]
+\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
were read through \f[B]stdin\f[R].
If expressions are also given (see above), the expressions are evaluated
in the order given.
.RS
.PP
-After processing all expressions and files, dc(1) will exit, unless
+If this option is given on the command-line (i.e., not in
+\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
+then after processing all expressions and files, dc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]\[en]file\f[R].
-However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
-\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after that,
-bc(1) will give a fatal error and exit.
+\f[B]-f\f[R] or \f[B]--file\f[R].
+However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
+\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
+\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
+exit.
.PP
This is a \f[B]non-portable extension\f[R].
.RE
@@ -144,6 +153,9 @@ All long options are \f[B]non-portable extensions\f[R].
.SH STDOUT
.PP
Any non-error output is written to \f[B]stdout\f[R].
+In addition, if history (see the \f[B]HISTORY\f[R] section) and the
+prompt (see the \f[B]TTY MODE\f[R] section) are enabled, both are output
+to \f[B]stdout\f[R].
.PP
\f[B]Note\f[R]: Unlike other dc(1) implementations, this dc(1) will
issue a fatal error (see the \f[B]EXIT STATUS\f[R] section) if it cannot
@@ -824,7 +836,7 @@ Unlike most other dc(1) implentations, this dc(1) provides nearly
unlimited amounts of registers, if extended register mode is enabled.
.PP
If extended register mode is enabled (\f[B]-x\f[R] or
-\f[B]\[en]extended-register\f[R] command-line arguments are given), then
+\f[B]--extended-register\f[R] command-line arguments are given), then
normal single character registers are used \f[I]unless\f[R] the
character immediately following a command that needs a register name is
a space (according to \f[B]isspace()\f[R]) and not a newline
@@ -959,7 +971,7 @@ will be correctly parsed, but the string \f[B]\[lq]/home/gavin/some
The quote parsing will handle either kind of quotes, \f[B]\[cq]\f[R] or
\f[B]\[lq]\f[R]. Thus, if you have a file with any number of single
quotes in the name, you can use double quotes as the outside quotes, as
-in \f[B]\[rq]some `bc' file.bc\[dq]\f[R], and vice versa if you have a
+in \f[B]\[rq]some `dc' file.dc\[dq]\f[R], and vice versa if you have a
file with double quotes.
However, handling a file with both kinds of quotes in
\f[B]DC_ENV_ARGS\f[R] is not supported due to the complexity of the
@@ -1039,17 +1051,17 @@ interactive mode (see the \f[B]INTERACTIVE MODE\f[R] section), since
dc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
more input when one of those errors occurs in interactive mode.
This is also the case when interactive mode is forced by the
-\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
+\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.PP
These exit statuses allow dc(1) to be used in shell scripting with error
checking, and its normal behavior can be forced by using the
-\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
+\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.SH INTERACTIVE MODE
.PP
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both \f[B]stdin\f[R]
and \f[B]stdout\f[R] are hooked to a terminal, but the \f[B]-i\f[R] flag
-and \f[B]\[en]interactive\f[R] option can turn it on in other cases.
+and \f[B]--interactive\f[R] option can turn it on in other cases.
.PP
In interactive mode, dc(1) attempts to recover from errors (see the
\f[B]RESET\f[R] section), and in normal execution, flushes
diff --git a/contrib/bc/manuals/dc/E.1.md b/contrib/bc/manuals/dc/E.1.md
index 3ccf45a98ae3..5e0a85af9a90 100644
--- a/contrib/bc/manuals/dc/E.1.md
+++ b/contrib/bc/manuals/dc/E.1.md
@@ -2,7 +2,7 @@
SPDX-License-Identifier: BSD-2-Clause
-Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+Copyright (c) 2018-2021 Gavin D. Howard and contributors.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
@@ -34,7 +34,7 @@ dc - arbitrary-precision decimal reverse-Polish notation calculator
# SYNOPSIS
-**dc** [**-hiPvVx**] [**--version**] [**--help**] [**--interactive**] [**--no-prompt**] [**--extended-register**] [**-e** *expr*] [**--expression**=*expr*...] [**-f** *file*...] [**-file**=*file*...] [*file*...]
+**dc** [**-hiPvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@@ -43,11 +43,11 @@ notation) to store numbers and results of computations. Arithmetic operations
pop arguments off of the stack and push the results.
If no files are given on the command-line as extra arguments (i.e., not as
-**-f** or **--file** arguments), then dc(1) reads from **stdin**. Otherwise,
+**-f** or **-\-file** arguments), then dc(1) reads from **stdin**. Otherwise,
those files are processed, and dc(1) will then exit.
This is different from the dc(1) on OpenBSD and possibly other dc(1)
-implementations, where **-e** (**--expression**) and **-f** (**--file**)
+implementations, where **-e** (**-\-expression**) and **-f** (**-\-file**)
arguments cause dc(1) to execute them and exit. The reason for this is that this
dc(1) allows users to set arguments in the environment variable **DC_ENV_ARGS**
(see the **ENVIRONMENT VARIABLES** section). Any expressions given on the
@@ -64,21 +64,21 @@ as the last command-line argument or define the environment variable
The following are the options that dc(1) accepts.
-**-h**, **--help**
+**-h**, **-\-help**
: Prints a usage message and quits.
-**-v**, **-V**, **--version**
+**-v**, **-V**, **-\-version**
: Print the version information (copyright header) and exit.
-**-i**, **--interactive**
+**-i**, **-\-interactive**
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
This is a **non-portable extension**.
-**-P**, **--no-prompt**
+**-P**, **-\-no-prompt**
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
See the **TTY MODE** section) This is mostly for those users that do not
@@ -87,35 +87,42 @@ The following are the options that dc(1) accepts.
This is a **non-portable extension**.
-**-x** **--extended-register**
+**-x** **-\-extended-register**
: Enables extended register mode. See the *Extended Register Mode* subsection
of the **REGISTERS** section for more information.
This is a **non-portable extension**.
-**-e** *expr*, **--expression**=*expr*
+**-e** *expr*, **-\-expression**=*expr*
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
order. If files are given as well (see below), the expressions and files are
evaluated in the order given. This means that if a file is given before an
expression, the file is read in and evaluated first.
- After processing all expressions and files, dc(1) will exit, unless **-**
- (**stdin**) was given as an argument at least once to **-f** or **--file**.
+ If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
+ see the **ENVIRONMENT VARIABLES** section), then after processing all
+ expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
+ as an argument at least once to **-f** or **-\-file**, whether on the
+ command-line or in **DC_ENV_ARGS**. However, if any other **-e**,
+ **-\-expression**, **-f**, or **-\-file** arguments are given after **-f-**
+ or equivalent is given, dc(1) will give a fatal error and exit.
This is a **non-portable extension**.
-**-f** *file*, **--file**=*file*
+**-f** *file*, **-\-file**=*file*
: Reads in *file* and evaluates it, line by line, as though it were read
through **stdin**. If expressions are also given (see above), the
expressions are evaluated in the order given.
- After processing all expressions and files, dc(1) will exit, unless **-**
- (**stdin**) was given as an argument at least once to **-f** or **--file**.
- However, if any other **-e**, **--expression**, **-f**, or **--file**
- arguments are given after that, bc(1) will give a fatal error and exit.
+ If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
+ see the **ENVIRONMENT VARIABLES** section), then after processing all
+ expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
+ as an argument at least once to **-f** or **-\-file**. However, if any other
+ **-e**, **-\-expression**, **-f**, or **-\-file** arguments are given after
+ **-f-** or equivalent is given, dc(1) will give a fatal error and exit.
This is a **non-portable extension**.
@@ -123,7 +130,9 @@ All long options are **non-portable extensions**.
# STDOUT
-Any non-error output is written to **stdout**.
+Any non-error output is written to **stdout**. In addition, if history (see the
+**HISTORY** section) and the prompt (see the **TTY MODE** section) are enabled,
+both are output to **stdout**.
**Note**: Unlike other dc(1) implementations, this dc(1) will issue a fatal
error (see the **EXIT STATUS** section) if it cannot write to **stdout**, so if
@@ -740,7 +749,7 @@ follows any command that needs a register name. The only exception is a newline
Unlike most other dc(1) implentations, this dc(1) provides nearly unlimited
amounts of registers, if extended register mode is enabled.
-If extended register mode is enabled (**-x** or **--extended-register**
+If extended register mode is enabled (**-x** or **-\-extended-register**
command-line arguments are given), then normal single character registers are
used *unless* the character immediately following a command that needs a
register name is a space (according to **isspace()**) and not a newline
@@ -868,7 +877,7 @@ dc(1) recognizes the following environment variables:
The quote parsing will handle either kind of quotes, **'** or **"**. Thus,
if you have a file with any number of single quotes in the name, you can use
- double quotes as the outside quotes, as in **"some 'bc' file.bc"**, and vice
+ double quotes as the outside quotes, as in **"some 'dc' file.dc"**, and vice
versa if you have a file with double quotes. However, handling a file with
both kinds of quotes in **DC_ENV_ARGS** is not supported due to the
complexity of the parsing, though such files are still supported on the
@@ -942,17 +951,17 @@ The other statuses will only be returned when dc(1) is not in interactive mode
(see the **INTERACTIVE MODE** section), since dc(1) resets its state (see the
**RESET** section) and accepts more input when one of those errors occurs in
interactive mode. This is also the case when interactive mode is forced by the
-**-i** flag or **--interactive** option.
+**-i** flag or **-\-interactive** option.
These exit statuses allow dc(1) to be used in shell scripting with error
checking, and its normal behavior can be forced by using the **-i** flag or
-**--interactive** option.
+**-\-interactive** option.
# INTERACTIVE MODE
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both **stdin** and **stdout**
-are hooked to a terminal, but the **-i** flag and **--interactive** option can
+are hooked to a terminal, but the **-i** flag and **-\-interactive** option can
turn it on in other cases.
In interactive mode, dc(1) attempts to recover from errors (see the **RESET**
diff --git a/contrib/bc/manuals/dc/EH.1 b/contrib/bc/manuals/dc/EH.1
index 5ccc64ea725e..e8e4b9069506 100644
--- a/contrib/bc/manuals/dc/EH.1
+++ b/contrib/bc/manuals/dc/EH.1
@@ -1,7 +1,7 @@
.\"
.\" SPDX-License-Identifier: BSD-2-Clause
.\"
-.\" Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+.\" Copyright (c) 2018-2021 Gavin D. Howard and contributors.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions are met:
@@ -25,18 +25,17 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.TH "DC" "1" "October 2020" "Gavin D. Howard" "General Commands Manual"
+.TH "DC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
.SH Name
.PP
dc - arbitrary-precision decimal reverse-Polish notation calculator
.SH SYNOPSIS
.PP
-\f[B]dc\f[R] [\f[B]-hiPvVx\f[R]] [\f[B]\[en]version\f[R]]
-[\f[B]\[en]help\f[R]] [\f[B]\[en]interactive\f[R]]
-[\f[B]\[en]no-prompt\f[R]] [\f[B]\[en]extended-register\f[R]]
-[\f[B]-e\f[R] \f[I]expr\f[R]]
-[\f[B]\[en]expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
-\f[I]file\f[R]\&...] [\f[B]-file\f[R]=\f[I]file\f[R]\&...]
+\f[B]dc\f[R] [\f[B]-hiPvVx\f[R]] [\f[B]--version\f[R]]
+[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--no-prompt\f[R]]
+[\f[B]--extended-register\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
+[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
+\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
[\f[I]file\f[R]\&...]
.SH DESCRIPTION
.PP
@@ -47,13 +46,13 @@ Arithmetic operations pop arguments off of the stack and push the
results.
.PP
If no files are given on the command-line as extra arguments (i.e., not
-as \f[B]-f\f[R] or \f[B]\[en]file\f[R] arguments), then dc(1) reads from
+as \f[B]-f\f[R] or \f[B]--file\f[R] arguments), then dc(1) reads from
\f[B]stdin\f[R].
Otherwise, those files are processed, and dc(1) will then exit.
.PP
This is different from the dc(1) on OpenBSD and possibly other dc(1)
-implementations, where \f[B]-e\f[R] (\f[B]\[en]expression\f[R]) and
-\f[B]-f\f[R] (\f[B]\[en]file\f[R]) arguments cause dc(1) to execute them
+implementations, where \f[B]-e\f[R] (\f[B]--expression\f[R]) and
+\f[B]-f\f[R] (\f[B]--file\f[R]) arguments cause dc(1) to execute them
and exit.
The reason for this is that this dc(1) allows users to set arguments in
the environment variable \f[B]DC_ENV_ARGS\f[R] (see the \f[B]ENVIRONMENT
@@ -72,13 +71,13 @@ argument or define the environment variable \f[B]DC_EXPR_EXIT\f[R].
.PP
The following are the options that dc(1) accepts.
.TP
-\f[B]-h\f[R], \f[B]\[en]help\f[R]
+\f[B]-h\f[R], \f[B]--help\f[R]
Prints a usage message and quits.
.TP
-\f[B]-v\f[R], \f[B]-V\f[R], \f[B]\[en]version\f[R]
+\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
Print the version information (copyright header) and exit.
.TP
-\f[B]-i\f[R], \f[B]\[en]interactive\f[R]
+\f[B]-i\f[R], \f[B]--interactive\f[R]
Forces interactive mode.
(See the \f[B]INTERACTIVE MODE\f[R] section.)
.RS
@@ -86,7 +85,7 @@ Forces interactive mode.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-P\f[R], \f[B]\[en]no-prompt\f[R]
+\f[B]-P\f[R], \f[B]--no-prompt\f[R]
Disables the prompt in TTY mode.
(The prompt is only enabled in TTY mode.
See the \f[B]TTY MODE\f[R] section) This is mostly for those users that
@@ -98,7 +97,7 @@ Most of those users would want to put this option in
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-x\f[R] \f[B]\[en]extended-register\f[R]
+\f[B]-x\f[R] \f[B]--extended-register\f[R]
Enables extended register mode.
See the \f[I]Extended Register Mode\f[R] subsection of the
\f[B]REGISTERS\f[R] section for more information.
@@ -107,7 +106,7 @@ See the \f[I]Extended Register Mode\f[R] subsection of the
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-e\f[R] \f[I]expr\f[R], \f[B]\[en]expression\f[R]=\f[I]expr\f[R]
+\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
Evaluates \f[I]expr\f[R].
If multiple expressions are given, they are evaluated in order.
If files are given as well (see below), the expressions and files are
@@ -116,26 +115,36 @@ This means that if a file is given before an expression, the file is
read in and evaluated first.
.RS
.PP
-After processing all expressions and files, dc(1) will exit, unless
+If this option is given on the command-line (i.e., not in
+\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
+then after processing all expressions and files, dc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]\[en]file\f[R].
+\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
+\f[B]DC_ENV_ARGS\f[R].
+However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
+\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
+\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
+exit.
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-f\f[R] \f[I]file\f[R], \f[B]\[en]file\f[R]=\f[I]file\f[R]
+\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
were read through \f[B]stdin\f[R].
If expressions are also given (see above), the expressions are evaluated
in the order given.
.RS
.PP
-After processing all expressions and files, dc(1) will exit, unless
+If this option is given on the command-line (i.e., not in
+\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
+then after processing all expressions and files, dc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]\[en]file\f[R].
-However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
-\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after that,
-bc(1) will give a fatal error and exit.
+\f[B]-f\f[R] or \f[B]--file\f[R].
+However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
+\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
+\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
+exit.
.PP
This is a \f[B]non-portable extension\f[R].
.RE
@@ -144,6 +153,9 @@ All long options are \f[B]non-portable extensions\f[R].
.SH STDOUT
.PP
Any non-error output is written to \f[B]stdout\f[R].
+In addition, if history (see the \f[B]HISTORY\f[R] section) and the
+prompt (see the \f[B]TTY MODE\f[R] section) are enabled, both are output
+to \f[B]stdout\f[R].
.PP
\f[B]Note\f[R]: Unlike other dc(1) implementations, this dc(1) will
issue a fatal error (see the \f[B]EXIT STATUS\f[R] section) if it cannot
@@ -824,7 +836,7 @@ Unlike most other dc(1) implentations, this dc(1) provides nearly
unlimited amounts of registers, if extended register mode is enabled.
.PP
If extended register mode is enabled (\f[B]-x\f[R] or
-\f[B]\[en]extended-register\f[R] command-line arguments are given), then
+\f[B]--extended-register\f[R] command-line arguments are given), then
normal single character registers are used \f[I]unless\f[R] the
character immediately following a command that needs a register name is
a space (according to \f[B]isspace()\f[R]) and not a newline
@@ -959,7 +971,7 @@ will be correctly parsed, but the string \f[B]\[lq]/home/gavin/some
The quote parsing will handle either kind of quotes, \f[B]\[cq]\f[R] or
\f[B]\[lq]\f[R]. Thus, if you have a file with any number of single
quotes in the name, you can use double quotes as the outside quotes, as
-in \f[B]\[rq]some `bc' file.bc\[dq]\f[R], and vice versa if you have a
+in \f[B]\[rq]some `dc' file.dc\[dq]\f[R], and vice versa if you have a
file with double quotes.
However, handling a file with both kinds of quotes in
\f[B]DC_ENV_ARGS\f[R] is not supported due to the complexity of the
@@ -1039,17 +1051,17 @@ interactive mode (see the \f[B]INTERACTIVE MODE\f[R] section), since
dc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
more input when one of those errors occurs in interactive mode.
This is also the case when interactive mode is forced by the
-\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
+\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.PP
These exit statuses allow dc(1) to be used in shell scripting with error
checking, and its normal behavior can be forced by using the
-\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
+\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.SH INTERACTIVE MODE
.PP
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both \f[B]stdin\f[R]
and \f[B]stdout\f[R] are hooked to a terminal, but the \f[B]-i\f[R] flag
-and \f[B]\[en]interactive\f[R] option can turn it on in other cases.
+and \f[B]--interactive\f[R] option can turn it on in other cases.
.PP
In interactive mode, dc(1) attempts to recover from errors (see the
\f[B]RESET\f[R] section), and in normal execution, flushes
diff --git a/contrib/bc/manuals/dc/EH.1.md b/contrib/bc/manuals/dc/EH.1.md
index b59a5ef71a0c..6d1413d0dae4 100644
--- a/contrib/bc/manuals/dc/EH.1.md
+++ b/contrib/bc/manuals/dc/EH.1.md
@@ -2,7 +2,7 @@
SPDX-License-Identifier: BSD-2-Clause
-Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+Copyright (c) 2018-2021 Gavin D. Howard and contributors.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
@@ -34,7 +34,7 @@ dc - arbitrary-precision decimal reverse-Polish notation calculator
# SYNOPSIS
-**dc** [**-hiPvVx**] [**--version**] [**--help**] [**--interactive**] [**--no-prompt**] [**--extended-register**] [**-e** *expr*] [**--expression**=*expr*...] [**-f** *file*...] [**-file**=*file*...] [*file*...]
+**dc** [**-hiPvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@@ -43,11 +43,11 @@ notation) to store numbers and results of computations. Arithmetic operations
pop arguments off of the stack and push the results.
If no files are given on the command-line as extra arguments (i.e., not as
-**-f** or **--file** arguments), then dc(1) reads from **stdin**. Otherwise,
+**-f** or **-\-file** arguments), then dc(1) reads from **stdin**. Otherwise,
those files are processed, and dc(1) will then exit.
This is different from the dc(1) on OpenBSD and possibly other dc(1)
-implementations, where **-e** (**--expression**) and **-f** (**--file**)
+implementations, where **-e** (**-\-expression**) and **-f** (**-\-file**)
arguments cause dc(1) to execute them and exit. The reason for this is that this
dc(1) allows users to set arguments in the environment variable **DC_ENV_ARGS**
(see the **ENVIRONMENT VARIABLES** section). Any expressions given on the
@@ -64,21 +64,21 @@ as the last command-line argument or define the environment variable
The following are the options that dc(1) accepts.
-**-h**, **--help**
+**-h**, **-\-help**
: Prints a usage message and quits.
-**-v**, **-V**, **--version**
+**-v**, **-V**, **-\-version**
: Print the version information (copyright header) and exit.
-**-i**, **--interactive**
+**-i**, **-\-interactive**
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
This is a **non-portable extension**.
-**-P**, **--no-prompt**
+**-P**, **-\-no-prompt**
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
See the **TTY MODE** section) This is mostly for those users that do not
@@ -87,35 +87,42 @@ The following are the options that dc(1) accepts.
This is a **non-portable extension**.
-**-x** **--extended-register**
+**-x** **-\-extended-register**
: Enables extended register mode. See the *Extended Register Mode* subsection
of the **REGISTERS** section for more information.
This is a **non-portable extension**.
-**-e** *expr*, **--expression**=*expr*
+**-e** *expr*, **-\-expression**=*expr*
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
order. If files are given as well (see below), the expressions and files are
evaluated in the order given. This means that if a file is given before an
expression, the file is read in and evaluated first.
- After processing all expressions and files, dc(1) will exit, unless **-**
- (**stdin**) was given as an argument at least once to **-f** or **--file**.
+ If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
+ see the **ENVIRONMENT VARIABLES** section), then after processing all
+ expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
+ as an argument at least once to **-f** or **-\-file**, whether on the
+ command-line or in **DC_ENV_ARGS**. However, if any other **-e**,
+ **-\-expression**, **-f**, or **-\-file** arguments are given after **-f-**
+ or equivalent is given, dc(1) will give a fatal error and exit.
This is a **non-portable extension**.
-**-f** *file*, **--file**=*file*
+**-f** *file*, **-\-file**=*file*
: Reads in *file* and evaluates it, line by line, as though it were read
through **stdin**. If expressions are also given (see above), the
expressions are evaluated in the order given.
- After processing all expressions and files, dc(1) will exit, unless **-**
- (**stdin**) was given as an argument at least once to **-f** or **--file**.
- However, if any other **-e**, **--expression**, **-f**, or **--file**
- arguments are given after that, bc(1) will give a fatal error and exit.
+ If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
+ see the **ENVIRONMENT VARIABLES** section), then after processing all
+ expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
+ as an argument at least once to **-f** or **-\-file**. However, if any other
+ **-e**, **-\-expression**, **-f**, or **-\-file** arguments are given after
+ **-f-** or equivalent is given, dc(1) will give a fatal error and exit.
This is a **non-portable extension**.
@@ -123,7 +130,9 @@ All long options are **non-portable extensions**.
# STDOUT
-Any non-error output is written to **stdout**.
+Any non-error output is written to **stdout**. In addition, if history (see the
+**HISTORY** section) and the prompt (see the **TTY MODE** section) are enabled,
+both are output to **stdout**.
**Note**: Unlike other dc(1) implementations, this dc(1) will issue a fatal
error (see the **EXIT STATUS** section) if it cannot write to **stdout**, so if
@@ -740,7 +749,7 @@ follows any command that needs a register name. The only exception is a newline
Unlike most other dc(1) implentations, this dc(1) provides nearly unlimited
amounts of registers, if extended register mode is enabled.
-If extended register mode is enabled (**-x** or **--extended-register**
+If extended register mode is enabled (**-x** or **-\-extended-register**
command-line arguments are given), then normal single character registers are
used *unless* the character immediately following a command that needs a
register name is a space (according to **isspace()**) and not a newline
@@ -868,7 +877,7 @@ dc(1) recognizes the following environment variables:
The quote parsing will handle either kind of quotes, **'** or **"**. Thus,
if you have a file with any number of single quotes in the name, you can use
- double quotes as the outside quotes, as in **"some 'bc' file.bc"**, and vice
+ double quotes as the outside quotes, as in **"some 'dc' file.dc"**, and vice
versa if you have a file with double quotes. However, handling a file with
both kinds of quotes in **DC_ENV_ARGS** is not supported due to the
complexity of the parsing, though such files are still supported on the
@@ -942,17 +951,17 @@ The other statuses will only be returned when dc(1) is not in interactive mode
(see the **INTERACTIVE MODE** section), since dc(1) resets its state (see the
**RESET** section) and accepts more input when one of those errors occurs in
interactive mode. This is also the case when interactive mode is forced by the
-**-i** flag or **--interactive** option.
+**-i** flag or **-\-interactive** option.
These exit statuses allow dc(1) to be used in shell scripting with error
checking, and its normal behavior can be forced by using the **-i** flag or
-**--interactive** option.
+**-\-interactive** option.
# INTERACTIVE MODE
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both **stdin** and **stdout**
-are hooked to a terminal, but the **-i** flag and **--interactive** option can
+are hooked to a terminal, but the **-i** flag and **-\-interactive** option can
turn it on in other cases.
In interactive mode, dc(1) attempts to recover from errors (see the **RESET**
diff --git a/contrib/bc/manuals/dc/EHN.1 b/contrib/bc/manuals/dc/EHN.1
index bce6e577df6c..37f4a6656c65 100644
--- a/contrib/bc/manuals/dc/EHN.1
+++ b/contrib/bc/manuals/dc/EHN.1
@@ -1,7 +1,7 @@
.\"
.\" SPDX-License-Identifier: BSD-2-Clause
.\"
-.\" Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+.\" Copyright (c) 2018-2021 Gavin D. Howard and contributors.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions are met:
@@ -25,18 +25,17 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.TH "DC" "1" "October 2020" "Gavin D. Howard" "General Commands Manual"
+.TH "DC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
.SH Name
.PP
dc - arbitrary-precision decimal reverse-Polish notation calculator
.SH SYNOPSIS
.PP
-\f[B]dc\f[R] [\f[B]-hiPvVx\f[R]] [\f[B]\[en]version\f[R]]
-[\f[B]\[en]help\f[R]] [\f[B]\[en]interactive\f[R]]
-[\f[B]\[en]no-prompt\f[R]] [\f[B]\[en]extended-register\f[R]]
-[\f[B]-e\f[R] \f[I]expr\f[R]]
-[\f[B]\[en]expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
-\f[I]file\f[R]\&...] [\f[B]-file\f[R]=\f[I]file\f[R]\&...]
+\f[B]dc\f[R] [\f[B]-hiPvVx\f[R]] [\f[B]--version\f[R]]
+[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--no-prompt\f[R]]
+[\f[B]--extended-register\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
+[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
+\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
[\f[I]file\f[R]\&...]
.SH DESCRIPTION
.PP
@@ -47,13 +46,13 @@ Arithmetic operations pop arguments off of the stack and push the
results.
.PP
If no files are given on the command-line as extra arguments (i.e., not
-as \f[B]-f\f[R] or \f[B]\[en]file\f[R] arguments), then dc(1) reads from
+as \f[B]-f\f[R] or \f[B]--file\f[R] arguments), then dc(1) reads from
\f[B]stdin\f[R].
Otherwise, those files are processed, and dc(1) will then exit.
.PP
This is different from the dc(1) on OpenBSD and possibly other dc(1)
-implementations, where \f[B]-e\f[R] (\f[B]\[en]expression\f[R]) and
-\f[B]-f\f[R] (\f[B]\[en]file\f[R]) arguments cause dc(1) to execute them
+implementations, where \f[B]-e\f[R] (\f[B]--expression\f[R]) and
+\f[B]-f\f[R] (\f[B]--file\f[R]) arguments cause dc(1) to execute them
and exit.
The reason for this is that this dc(1) allows users to set arguments in
the environment variable \f[B]DC_ENV_ARGS\f[R] (see the \f[B]ENVIRONMENT
@@ -72,13 +71,13 @@ argument or define the environment variable \f[B]DC_EXPR_EXIT\f[R].
.PP
The following are the options that dc(1) accepts.
.TP
-\f[B]-h\f[R], \f[B]\[en]help\f[R]
+\f[B]-h\f[R], \f[B]--help\f[R]
Prints a usage message and quits.
.TP
-\f[B]-v\f[R], \f[B]-V\f[R], \f[B]\[en]version\f[R]
+\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
Print the version information (copyright header) and exit.
.TP
-\f[B]-i\f[R], \f[B]\[en]interactive\f[R]
+\f[B]-i\f[R], \f[B]--interactive\f[R]
Forces interactive mode.
(See the \f[B]INTERACTIVE MODE\f[R] section.)
.RS
@@ -86,7 +85,7 @@ Forces interactive mode.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-P\f[R], \f[B]\[en]no-prompt\f[R]
+\f[B]-P\f[R], \f[B]--no-prompt\f[R]
Disables the prompt in TTY mode.
(The prompt is only enabled in TTY mode.
See the \f[B]TTY MODE\f[R] section) This is mostly for those users that
@@ -98,7 +97,7 @@ Most of those users would want to put this option in
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-x\f[R] \f[B]\[en]extended-register\f[R]
+\f[B]-x\f[R] \f[B]--extended-register\f[R]
Enables extended register mode.
See the \f[I]Extended Register Mode\f[R] subsection of the
\f[B]REGISTERS\f[R] section for more information.
@@ -107,7 +106,7 @@ See the \f[I]Extended Register Mode\f[R] subsection of the
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-e\f[R] \f[I]expr\f[R], \f[B]\[en]expression\f[R]=\f[I]expr\f[R]
+\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
Evaluates \f[I]expr\f[R].
If multiple expressions are given, they are evaluated in order.
If files are given as well (see below), the expressions and files are
@@ -116,26 +115,36 @@ This means that if a file is given before an expression, the file is
read in and evaluated first.
.RS
.PP
-After processing all expressions and files, dc(1) will exit, unless
+If this option is given on the command-line (i.e., not in
+\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
+then after processing all expressions and files, dc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]\[en]file\f[R].
+\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
+\f[B]DC_ENV_ARGS\f[R].
+However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
+\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
+\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
+exit.
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-f\f[R] \f[I]file\f[R], \f[B]\[en]file\f[R]=\f[I]file\f[R]
+\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
were read through \f[B]stdin\f[R].
If expressions are also given (see above), the expressions are evaluated
in the order given.
.RS
.PP
-After processing all expressions and files, dc(1) will exit, unless
+If this option is given on the command-line (i.e., not in
+\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
+then after processing all expressions and files, dc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]\[en]file\f[R].
-However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
-\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after that,
-bc(1) will give a fatal error and exit.
+\f[B]-f\f[R] or \f[B]--file\f[R].
+However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
+\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
+\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
+exit.
.PP
This is a \f[B]non-portable extension\f[R].
.RE
@@ -144,6 +153,9 @@ All long options are \f[B]non-portable extensions\f[R].
.SH STDOUT
.PP
Any non-error output is written to \f[B]stdout\f[R].
+In addition, if history (see the \f[B]HISTORY\f[R] section) and the
+prompt (see the \f[B]TTY MODE\f[R] section) are enabled, both are output
+to \f[B]stdout\f[R].
.PP
\f[B]Note\f[R]: Unlike other dc(1) implementations, this dc(1) will
issue a fatal error (see the \f[B]EXIT STATUS\f[R] section) if it cannot
@@ -824,7 +836,7 @@ Unlike most other dc(1) implentations, this dc(1) provides nearly
unlimited amounts of registers, if extended register mode is enabled.
.PP
If extended register mode is enabled (\f[B]-x\f[R] or
-\f[B]\[en]extended-register\f[R] command-line arguments are given), then
+\f[B]--extended-register\f[R] command-line arguments are given), then
normal single character registers are used \f[I]unless\f[R] the
character immediately following a command that needs a register name is
a space (according to \f[B]isspace()\f[R]) and not a newline
@@ -959,7 +971,7 @@ will be correctly parsed, but the string \f[B]\[lq]/home/gavin/some
The quote parsing will handle either kind of quotes, \f[B]\[cq]\f[R] or
\f[B]\[lq]\f[R]. Thus, if you have a file with any number of single
quotes in the name, you can use double quotes as the outside quotes, as
-in \f[B]\[rq]some `bc' file.bc\[dq]\f[R], and vice versa if you have a
+in \f[B]\[rq]some `dc' file.dc\[dq]\f[R], and vice versa if you have a
file with double quotes.
However, handling a file with both kinds of quotes in
\f[B]DC_ENV_ARGS\f[R] is not supported due to the complexity of the
@@ -1039,17 +1051,17 @@ interactive mode (see the \f[B]INTERACTIVE MODE\f[R] section), since
dc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
more input when one of those errors occurs in interactive mode.
This is also the case when interactive mode is forced by the
-\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
+\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.PP
These exit statuses allow dc(1) to be used in shell scripting with error
checking, and its normal behavior can be forced by using the
-\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
+\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.SH INTERACTIVE MODE
.PP
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both \f[B]stdin\f[R]
and \f[B]stdout\f[R] are hooked to a terminal, but the \f[B]-i\f[R] flag
-and \f[B]\[en]interactive\f[R] option can turn it on in other cases.
+and \f[B]--interactive\f[R] option can turn it on in other cases.
.PP
In interactive mode, dc(1) attempts to recover from errors (see the
\f[B]RESET\f[R] section), and in normal execution, flushes
diff --git a/contrib/bc/manuals/dc/EHN.1.md b/contrib/bc/manuals/dc/EHN.1.md
index fd1a0251fd04..2e24a10a06dc 100644
--- a/contrib/bc/manuals/dc/EHN.1.md
+++ b/contrib/bc/manuals/dc/EHN.1.md
@@ -2,7 +2,7 @@
SPDX-License-Identifier: BSD-2-Clause
-Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+Copyright (c) 2018-2021 Gavin D. Howard and contributors.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
@@ -34,7 +34,7 @@ dc - arbitrary-precision decimal reverse-Polish notation calculator
# SYNOPSIS
-**dc** [**-hiPvVx**] [**--version**] [**--help**] [**--interactive**] [**--no-prompt**] [**--extended-register**] [**-e** *expr*] [**--expression**=*expr*...] [**-f** *file*...] [**-file**=*file*...] [*file*...]
+**dc** [**-hiPvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@@ -43,11 +43,11 @@ notation) to store numbers and results of computations. Arithmetic operations
pop arguments off of the stack and push the results.
If no files are given on the command-line as extra arguments (i.e., not as
-**-f** or **--file** arguments), then dc(1) reads from **stdin**. Otherwise,
+**-f** or **-\-file** arguments), then dc(1) reads from **stdin**. Otherwise,
those files are processed, and dc(1) will then exit.
This is different from the dc(1) on OpenBSD and possibly other dc(1)
-implementations, where **-e** (**--expression**) and **-f** (**--file**)
+implementations, where **-e** (**-\-expression**) and **-f** (**-\-file**)
arguments cause dc(1) to execute them and exit. The reason for this is that this
dc(1) allows users to set arguments in the environment variable **DC_ENV_ARGS**
(see the **ENVIRONMENT VARIABLES** section). Any expressions given on the
@@ -64,21 +64,21 @@ as the last command-line argument or define the environment variable
The following are the options that dc(1) accepts.
-**-h**, **--help**
+**-h**, **-\-help**
: Prints a usage message and quits.
-**-v**, **-V**, **--version**
+**-v**, **-V**, **-\-version**
: Print the version information (copyright header) and exit.
-**-i**, **--interactive**
+**-i**, **-\-interactive**
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
This is a **non-portable extension**.
-**-P**, **--no-prompt**
+**-P**, **-\-no-prompt**
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
See the **TTY MODE** section) This is mostly for those users that do not
@@ -87,35 +87,42 @@ The following are the options that dc(1) accepts.
This is a **non-portable extension**.
-**-x** **--extended-register**
+**-x** **-\-extended-register**
: Enables extended register mode. See the *Extended Register Mode* subsection
of the **REGISTERS** section for more information.
This is a **non-portable extension**.
-**-e** *expr*, **--expression**=*expr*
+**-e** *expr*, **-\-expression**=*expr*
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
order. If files are given as well (see below), the expressions and files are
evaluated in the order given. This means that if a file is given before an
expression, the file is read in and evaluated first.
- After processing all expressions and files, dc(1) will exit, unless **-**
- (**stdin**) was given as an argument at least once to **-f** or **--file**.
+ If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
+ see the **ENVIRONMENT VARIABLES** section), then after processing all
+ expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
+ as an argument at least once to **-f** or **-\-file**, whether on the
+ command-line or in **DC_ENV_ARGS**. However, if any other **-e**,
+ **-\-expression**, **-f**, or **-\-file** arguments are given after **-f-**
+ or equivalent is given, dc(1) will give a fatal error and exit.
This is a **non-portable extension**.
-**-f** *file*, **--file**=*file*
+**-f** *file*, **-\-file**=*file*
: Reads in *file* and evaluates it, line by line, as though it were read
through **stdin**. If expressions are also given (see above), the
expressions are evaluated in the order given.
- After processing all expressions and files, dc(1) will exit, unless **-**
- (**stdin**) was given as an argument at least once to **-f** or **--file**.
- However, if any other **-e**, **--expression**, **-f**, or **--file**
- arguments are given after that, bc(1) will give a fatal error and exit.
+ If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
+ see the **ENVIRONMENT VARIABLES** section), then after processing all
+ expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
+ as an argument at least once to **-f** or **-\-file**. However, if any other
+ **-e**, **-\-expression**, **-f**, or **-\-file** arguments are given after
+ **-f-** or equivalent is given, dc(1) will give a fatal error and exit.
This is a **non-portable extension**.
@@ -123,7 +130,9 @@ All long options are **non-portable extensions**.
# STDOUT
-Any non-error output is written to **stdout**.
+Any non-error output is written to **stdout**. In addition, if history (see the
+**HISTORY** section) and the prompt (see the **TTY MODE** section) are enabled,
+both are output to **stdout**.
**Note**: Unlike other dc(1) implementations, this dc(1) will issue a fatal
error (see the **EXIT STATUS** section) if it cannot write to **stdout**, so if
@@ -740,7 +749,7 @@ follows any command that needs a register name. The only exception is a newline
Unlike most other dc(1) implentations, this dc(1) provides nearly unlimited
amounts of registers, if extended register mode is enabled.
-If extended register mode is enabled (**-x** or **--extended-register**
+If extended register mode is enabled (**-x** or **-\-extended-register**
command-line arguments are given), then normal single character registers are
used *unless* the character immediately following a command that needs a
register name is a space (according to **isspace()**) and not a newline
@@ -868,7 +877,7 @@ dc(1) recognizes the following environment variables:
The quote parsing will handle either kind of quotes, **'** or **"**. Thus,
if you have a file with any number of single quotes in the name, you can use
- double quotes as the outside quotes, as in **"some 'bc' file.bc"**, and vice
+ double quotes as the outside quotes, as in **"some 'dc' file.dc"**, and vice
versa if you have a file with double quotes. However, handling a file with
both kinds of quotes in **DC_ENV_ARGS** is not supported due to the
complexity of the parsing, though such files are still supported on the
@@ -942,17 +951,17 @@ The other statuses will only be returned when dc(1) is not in interactive mode
(see the **INTERACTIVE MODE** section), since dc(1) resets its state (see the
**RESET** section) and accepts more input when one of those errors occurs in
interactive mode. This is also the case when interactive mode is forced by the
-**-i** flag or **--interactive** option.
+**-i** flag or **-\-interactive** option.
These exit statuses allow dc(1) to be used in shell scripting with error
checking, and its normal behavior can be forced by using the **-i** flag or
-**--interactive** option.
+**-\-interactive** option.
# INTERACTIVE MODE
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both **stdin** and **stdout**
-are hooked to a terminal, but the **-i** flag and **--interactive** option can
+are hooked to a terminal, but the **-i** flag and **-\-interactive** option can
turn it on in other cases.
In interactive mode, dc(1) attempts to recover from errors (see the **RESET**
diff --git a/contrib/bc/manuals/dc/EHNP.1 b/contrib/bc/manuals/dc/EHNP.1
index 98cdfd150436..f0ea848f819b 100644
--- a/contrib/bc/manuals/dc/EHNP.1
+++ b/contrib/bc/manuals/dc/EHNP.1
@@ -1,7 +1,7 @@
.\"
.\" SPDX-License-Identifier: BSD-2-Clause
.\"
-.\" Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+.\" Copyright (c) 2018-2021 Gavin D. Howard and contributors.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions are met:
@@ -25,18 +25,17 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.TH "DC" "1" "October 2020" "Gavin D. Howard" "General Commands Manual"
+.TH "DC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
.SH Name
.PP
dc - arbitrary-precision decimal reverse-Polish notation calculator
.SH SYNOPSIS
.PP
-\f[B]dc\f[R] [\f[B]-hiPvVx\f[R]] [\f[B]\[en]version\f[R]]
-[\f[B]\[en]help\f[R]] [\f[B]\[en]interactive\f[R]]
-[\f[B]\[en]no-prompt\f[R]] [\f[B]\[en]extended-register\f[R]]
-[\f[B]-e\f[R] \f[I]expr\f[R]]
-[\f[B]\[en]expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
-\f[I]file\f[R]\&...] [\f[B]-file\f[R]=\f[I]file\f[R]\&...]
+\f[B]dc\f[R] [\f[B]-hiPvVx\f[R]] [\f[B]--version\f[R]]
+[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--no-prompt\f[R]]
+[\f[B]--extended-register\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
+[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
+\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
[\f[I]file\f[R]\&...]
.SH DESCRIPTION
.PP
@@ -47,13 +46,13 @@ Arithmetic operations pop arguments off of the stack and push the
results.
.PP
If no files are given on the command-line as extra arguments (i.e., not
-as \f[B]-f\f[R] or \f[B]\[en]file\f[R] arguments), then dc(1) reads from
+as \f[B]-f\f[R] or \f[B]--file\f[R] arguments), then dc(1) reads from
\f[B]stdin\f[R].
Otherwise, those files are processed, and dc(1) will then exit.
.PP
This is different from the dc(1) on OpenBSD and possibly other dc(1)
-implementations, where \f[B]-e\f[R] (\f[B]\[en]expression\f[R]) and
-\f[B]-f\f[R] (\f[B]\[en]file\f[R]) arguments cause dc(1) to execute them
+implementations, where \f[B]-e\f[R] (\f[B]--expression\f[R]) and
+\f[B]-f\f[R] (\f[B]--file\f[R]) arguments cause dc(1) to execute them
and exit.
The reason for this is that this dc(1) allows users to set arguments in
the environment variable \f[B]DC_ENV_ARGS\f[R] (see the \f[B]ENVIRONMENT
@@ -72,13 +71,13 @@ argument or define the environment variable \f[B]DC_EXPR_EXIT\f[R].
.PP
The following are the options that dc(1) accepts.
.TP
-\f[B]-h\f[R], \f[B]\[en]help\f[R]
+\f[B]-h\f[R], \f[B]--help\f[R]
Prints a usage message and quits.
.TP
-\f[B]-v\f[R], \f[B]-V\f[R], \f[B]\[en]version\f[R]
+\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
Print the version information (copyright header) and exit.
.TP
-\f[B]-i\f[R], \f[B]\[en]interactive\f[R]
+\f[B]-i\f[R], \f[B]--interactive\f[R]
Forces interactive mode.
(See the \f[B]INTERACTIVE MODE\f[R] section.)
.RS
@@ -86,14 +85,14 @@ Forces interactive mode.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-P\f[R], \f[B]\[en]no-prompt\f[R]
+\f[B]-P\f[R], \f[B]--no-prompt\f[R]
This option is a no-op.
.RS
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-x\f[R] \f[B]\[en]extended-register\f[R]
+\f[B]-x\f[R] \f[B]--extended-register\f[R]
Enables extended register mode.
See the \f[I]Extended Register Mode\f[R] subsection of the
\f[B]REGISTERS\f[R] section for more information.
@@ -102,7 +101,7 @@ See the \f[I]Extended Register Mode\f[R] subsection of the
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-e\f[R] \f[I]expr\f[R], \f[B]\[en]expression\f[R]=\f[I]expr\f[R]
+\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
Evaluates \f[I]expr\f[R].
If multiple expressions are given, they are evaluated in order.
If files are given as well (see below), the expressions and files are
@@ -111,26 +110,36 @@ This means that if a file is given before an expression, the file is
read in and evaluated first.
.RS
.PP
-After processing all expressions and files, dc(1) will exit, unless
+If this option is given on the command-line (i.e., not in
+\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
+then after processing all expressions and files, dc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]\[en]file\f[R].
+\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
+\f[B]DC_ENV_ARGS\f[R].
+However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
+\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
+\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
+exit.
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-f\f[R] \f[I]file\f[R], \f[B]\[en]file\f[R]=\f[I]file\f[R]
+\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
were read through \f[B]stdin\f[R].
If expressions are also given (see above), the expressions are evaluated
in the order given.
.RS
.PP
-After processing all expressions and files, dc(1) will exit, unless
+If this option is given on the command-line (i.e., not in
+\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
+then after processing all expressions and files, dc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]\[en]file\f[R].
-However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
-\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after that,
-bc(1) will give a fatal error and exit.
+\f[B]-f\f[R] or \f[B]--file\f[R].
+However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
+\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
+\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
+exit.
.PP
This is a \f[B]non-portable extension\f[R].
.RE
@@ -139,6 +148,9 @@ All long options are \f[B]non-portable extensions\f[R].
.SH STDOUT
.PP
Any non-error output is written to \f[B]stdout\f[R].
+In addition, if history (see the \f[B]HISTORY\f[R] section) and the
+prompt (see the \f[B]TTY MODE\f[R] section) are enabled, both are output
+to \f[B]stdout\f[R].
.PP
\f[B]Note\f[R]: Unlike other dc(1) implementations, this dc(1) will
issue a fatal error (see the \f[B]EXIT STATUS\f[R] section) if it cannot
@@ -819,7 +831,7 @@ Unlike most other dc(1) implentations, this dc(1) provides nearly
unlimited amounts of registers, if extended register mode is enabled.
.PP
If extended register mode is enabled (\f[B]-x\f[R] or
-\f[B]\[en]extended-register\f[R] command-line arguments are given), then
+\f[B]--extended-register\f[R] command-line arguments are given), then
normal single character registers are used \f[I]unless\f[R] the
character immediately following a command that needs a register name is
a space (according to \f[B]isspace()\f[R]) and not a newline
@@ -954,7 +966,7 @@ will be correctly parsed, but the string \f[B]\[lq]/home/gavin/some
The quote parsing will handle either kind of quotes, \f[B]\[cq]\f[R] or
\f[B]\[lq]\f[R]. Thus, if you have a file with any number of single
quotes in the name, you can use double quotes as the outside quotes, as
-in \f[B]\[rq]some `bc' file.bc\[dq]\f[R], and vice versa if you have a
+in \f[B]\[rq]some `dc' file.dc\[dq]\f[R], and vice versa if you have a
file with double quotes.
However, handling a file with both kinds of quotes in
\f[B]DC_ENV_ARGS\f[R] is not supported due to the complexity of the
@@ -1034,17 +1046,17 @@ interactive mode (see the \f[B]INTERACTIVE MODE\f[R] section), since
dc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
more input when one of those errors occurs in interactive mode.
This is also the case when interactive mode is forced by the
-\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
+\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.PP
These exit statuses allow dc(1) to be used in shell scripting with error
checking, and its normal behavior can be forced by using the
-\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
+\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.SH INTERACTIVE MODE
.PP
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both \f[B]stdin\f[R]
and \f[B]stdout\f[R] are hooked to a terminal, but the \f[B]-i\f[R] flag
-and \f[B]\[en]interactive\f[R] option can turn it on in other cases.
+and \f[B]--interactive\f[R] option can turn it on in other cases.
.PP
In interactive mode, dc(1) attempts to recover from errors (see the
\f[B]RESET\f[R] section), and in normal execution, flushes
diff --git a/contrib/bc/manuals/dc/EHNP.1.md b/contrib/bc/manuals/dc/EHNP.1.md
index c1d7457770e8..5abed62294c2 100644
--- a/contrib/bc/manuals/dc/EHNP.1.md
+++ b/contrib/bc/manuals/dc/EHNP.1.md
@@ -2,7 +2,7 @@
SPDX-License-Identifier: BSD-2-Clause
-Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+Copyright (c) 2018-2021 Gavin D. Howard and contributors.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
@@ -34,7 +34,7 @@ dc - arbitrary-precision decimal reverse-Polish notation calculator
# SYNOPSIS
-**dc** [**-hiPvVx**] [**--version**] [**--help**] [**--interactive**] [**--no-prompt**] [**--extended-register**] [**-e** *expr*] [**--expression**=*expr*...] [**-f** *file*...] [**-file**=*file*...] [*file*...]
+**dc** [**-hiPvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@@ -43,11 +43,11 @@ notation) to store numbers and results of computations. Arithmetic operations
pop arguments off of the stack and push the results.
If no files are given on the command-line as extra arguments (i.e., not as
-**-f** or **--file** arguments), then dc(1) reads from **stdin**. Otherwise,
+**-f** or **-\-file** arguments), then dc(1) reads from **stdin**. Otherwise,
those files are processed, and dc(1) will then exit.
This is different from the dc(1) on OpenBSD and possibly other dc(1)
-implementations, where **-e** (**--expression**) and **-f** (**--file**)
+implementations, where **-e** (**-\-expression**) and **-f** (**-\-file**)
arguments cause dc(1) to execute them and exit. The reason for this is that this
dc(1) allows users to set arguments in the environment variable **DC_ENV_ARGS**
(see the **ENVIRONMENT VARIABLES** section). Any expressions given on the
@@ -64,55 +64,62 @@ as the last command-line argument or define the environment variable
The following are the options that dc(1) accepts.
-**-h**, **--help**
+**-h**, **-\-help**
: Prints a usage message and quits.
-**-v**, **-V**, **--version**
+**-v**, **-V**, **-\-version**
: Print the version information (copyright header) and exit.
-**-i**, **--interactive**
+**-i**, **-\-interactive**
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
This is a **non-portable extension**.
-**-P**, **--no-prompt**
+**-P**, **-\-no-prompt**
: This option is a no-op.
This is a **non-portable extension**.
-**-x** **--extended-register**
+**-x** **-\-extended-register**
: Enables extended register mode. See the *Extended Register Mode* subsection
of the **REGISTERS** section for more information.
This is a **non-portable extension**.
-**-e** *expr*, **--expression**=*expr*
+**-e** *expr*, **-\-expression**=*expr*
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
order. If files are given as well (see below), the expressions and files are
evaluated in the order given. This means that if a file is given before an
expression, the file is read in and evaluated first.
- After processing all expressions and files, dc(1) will exit, unless **-**
- (**stdin**) was given as an argument at least once to **-f** or **--file**.
+ If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
+ see the **ENVIRONMENT VARIABLES** section), then after processing all
+ expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
+ as an argument at least once to **-f** or **-\-file**, whether on the
+ command-line or in **DC_ENV_ARGS**. However, if any other **-e**,
+ **-\-expression**, **-f**, or **-\-file** arguments are given after **-f-**
+ or equivalent is given, dc(1) will give a fatal error and exit.
This is a **non-portable extension**.
-**-f** *file*, **--file**=*file*
+**-f** *file*, **-\-file**=*file*
: Reads in *file* and evaluates it, line by line, as though it were read
through **stdin**. If expressions are also given (see above), the
expressions are evaluated in the order given.
- After processing all expressions and files, dc(1) will exit, unless **-**
- (**stdin**) was given as an argument at least once to **-f** or **--file**.
- However, if any other **-e**, **--expression**, **-f**, or **--file**
- arguments are given after that, bc(1) will give a fatal error and exit.
+ If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
+ see the **ENVIRONMENT VARIABLES** section), then after processing all
+ expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
+ as an argument at least once to **-f** or **-\-file**. However, if any other
+ **-e**, **-\-expression**, **-f**, or **-\-file** arguments are given after
+ **-f-** or equivalent is given, dc(1) will give a fatal error and exit.
This is a **non-portable extension**.
@@ -120,7 +127,9 @@ All long options are **non-portable extensions**.
# STDOUT
-Any non-error output is written to **stdout**.
+Any non-error output is written to **stdout**. In addition, if history (see the
+**HISTORY** section) and the prompt (see the **TTY MODE** section) are enabled,
+both are output to **stdout**.
**Note**: Unlike other dc(1) implementations, this dc(1) will issue a fatal
error (see the **EXIT STATUS** section) if it cannot write to **stdout**, so if
@@ -737,7 +746,7 @@ follows any command that needs a register name. The only exception is a newline
Unlike most other dc(1) implentations, this dc(1) provides nearly unlimited
amounts of registers, if extended register mode is enabled.
-If extended register mode is enabled (**-x** or **--extended-register**
+If extended register mode is enabled (**-x** or **-\-extended-register**
command-line arguments are given), then normal single character registers are
used *unless* the character immediately following a command that needs a
register name is a space (according to **isspace()**) and not a newline
@@ -865,7 +874,7 @@ dc(1) recognizes the following environment variables:
The quote parsing will handle either kind of quotes, **'** or **"**. Thus,
if you have a file with any number of single quotes in the name, you can use
- double quotes as the outside quotes, as in **"some 'bc' file.bc"**, and vice
+ double quotes as the outside quotes, as in **"some 'dc' file.dc"**, and vice
versa if you have a file with double quotes. However, handling a file with
both kinds of quotes in **DC_ENV_ARGS** is not supported due to the
complexity of the parsing, though such files are still supported on the
@@ -939,17 +948,17 @@ The other statuses will only be returned when dc(1) is not in interactive mode
(see the **INTERACTIVE MODE** section), since dc(1) resets its state (see the
**RESET** section) and accepts more input when one of those errors occurs in
interactive mode. This is also the case when interactive mode is forced by the
-**-i** flag or **--interactive** option.
+**-i** flag or **-\-interactive** option.
These exit statuses allow dc(1) to be used in shell scripting with error
checking, and its normal behavior can be forced by using the **-i** flag or
-**--interactive** option.
+**-\-interactive** option.
# INTERACTIVE MODE
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both **stdin** and **stdout**
-are hooked to a terminal, but the **-i** flag and **--interactive** option can
+are hooked to a terminal, but the **-i** flag and **-\-interactive** option can
turn it on in other cases.
In interactive mode, dc(1) attempts to recover from errors (see the **RESET**
diff --git a/contrib/bc/manuals/dc/EHP.1 b/contrib/bc/manuals/dc/EHP.1
index 5f930f841aa4..654c24309c56 100644
--- a/contrib/bc/manuals/dc/EHP.1
+++ b/contrib/bc/manuals/dc/EHP.1
@@ -1,7 +1,7 @@
.\"
.\" SPDX-License-Identifier: BSD-2-Clause
.\"
-.\" Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+.\" Copyright (c) 2018-2021 Gavin D. Howard and contributors.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions are met:
@@ -25,18 +25,17 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.TH "DC" "1" "October 2020" "Gavin D. Howard" "General Commands Manual"
+.TH "DC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
.SH Name
.PP
dc - arbitrary-precision decimal reverse-Polish notation calculator
.SH SYNOPSIS
.PP
-\f[B]dc\f[R] [\f[B]-hiPvVx\f[R]] [\f[B]\[en]version\f[R]]
-[\f[B]\[en]help\f[R]] [\f[B]\[en]interactive\f[R]]
-[\f[B]\[en]no-prompt\f[R]] [\f[B]\[en]extended-register\f[R]]
-[\f[B]-e\f[R] \f[I]expr\f[R]]
-[\f[B]\[en]expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
-\f[I]file\f[R]\&...] [\f[B]-file\f[R]=\f[I]file\f[R]\&...]
+\f[B]dc\f[R] [\f[B]-hiPvVx\f[R]] [\f[B]--version\f[R]]
+[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--no-prompt\f[R]]
+[\f[B]--extended-register\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
+[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
+\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
[\f[I]file\f[R]\&...]
.SH DESCRIPTION
.PP
@@ -47,13 +46,13 @@ Arithmetic operations pop arguments off of the stack and push the
results.
.PP
If no files are given on the command-line as extra arguments (i.e., not
-as \f[B]-f\f[R] or \f[B]\[en]file\f[R] arguments), then dc(1) reads from
+as \f[B]-f\f[R] or \f[B]--file\f[R] arguments), then dc(1) reads from
\f[B]stdin\f[R].
Otherwise, those files are processed, and dc(1) will then exit.
.PP
This is different from the dc(1) on OpenBSD and possibly other dc(1)
-implementations, where \f[B]-e\f[R] (\f[B]\[en]expression\f[R]) and
-\f[B]-f\f[R] (\f[B]\[en]file\f[R]) arguments cause dc(1) to execute them
+implementations, where \f[B]-e\f[R] (\f[B]--expression\f[R]) and
+\f[B]-f\f[R] (\f[B]--file\f[R]) arguments cause dc(1) to execute them
and exit.
The reason for this is that this dc(1) allows users to set arguments in
the environment variable \f[B]DC_ENV_ARGS\f[R] (see the \f[B]ENVIRONMENT
@@ -72,13 +71,13 @@ argument or define the environment variable \f[B]DC_EXPR_EXIT\f[R].
.PP
The following are the options that dc(1) accepts.
.TP
-\f[B]-h\f[R], \f[B]\[en]help\f[R]
+\f[B]-h\f[R], \f[B]--help\f[R]
Prints a usage message and quits.
.TP
-\f[B]-v\f[R], \f[B]-V\f[R], \f[B]\[en]version\f[R]
+\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
Print the version information (copyright header) and exit.
.TP
-\f[B]-i\f[R], \f[B]\[en]interactive\f[R]
+\f[B]-i\f[R], \f[B]--interactive\f[R]
Forces interactive mode.
(See the \f[B]INTERACTIVE MODE\f[R] section.)
.RS
@@ -86,14 +85,14 @@ Forces interactive mode.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-P\f[R], \f[B]\[en]no-prompt\f[R]
+\f[B]-P\f[R], \f[B]--no-prompt\f[R]
This option is a no-op.
.RS
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-x\f[R] \f[B]\[en]extended-register\f[R]
+\f[B]-x\f[R] \f[B]--extended-register\f[R]
Enables extended register mode.
See the \f[I]Extended Register Mode\f[R] subsection of the
\f[B]REGISTERS\f[R] section for more information.
@@ -102,7 +101,7 @@ See the \f[I]Extended Register Mode\f[R] subsection of the
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-e\f[R] \f[I]expr\f[R], \f[B]\[en]expression\f[R]=\f[I]expr\f[R]
+\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
Evaluates \f[I]expr\f[R].
If multiple expressions are given, they are evaluated in order.
If files are given as well (see below), the expressions and files are
@@ -111,26 +110,36 @@ This means that if a file is given before an expression, the file is
read in and evaluated first.
.RS
.PP
-After processing all expressions and files, dc(1) will exit, unless
+If this option is given on the command-line (i.e., not in
+\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
+then after processing all expressions and files, dc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]\[en]file\f[R].
+\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
+\f[B]DC_ENV_ARGS\f[R].
+However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
+\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
+\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
+exit.
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-f\f[R] \f[I]file\f[R], \f[B]\[en]file\f[R]=\f[I]file\f[R]
+\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
were read through \f[B]stdin\f[R].
If expressions are also given (see above), the expressions are evaluated
in the order given.
.RS
.PP
-After processing all expressions and files, dc(1) will exit, unless
+If this option is given on the command-line (i.e., not in
+\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
+then after processing all expressions and files, dc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]\[en]file\f[R].
-However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
-\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after that,
-bc(1) will give a fatal error and exit.
+\f[B]-f\f[R] or \f[B]--file\f[R].
+However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
+\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
+\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
+exit.
.PP
This is a \f[B]non-portable extension\f[R].
.RE
@@ -139,6 +148,9 @@ All long options are \f[B]non-portable extensions\f[R].
.SH STDOUT
.PP
Any non-error output is written to \f[B]stdout\f[R].
+In addition, if history (see the \f[B]HISTORY\f[R] section) and the
+prompt (see the \f[B]TTY MODE\f[R] section) are enabled, both are output
+to \f[B]stdout\f[R].
.PP
\f[B]Note\f[R]: Unlike other dc(1) implementations, this dc(1) will
issue a fatal error (see the \f[B]EXIT STATUS\f[R] section) if it cannot
@@ -819,7 +831,7 @@ Unlike most other dc(1) implentations, this dc(1) provides nearly
unlimited amounts of registers, if extended register mode is enabled.
.PP
If extended register mode is enabled (\f[B]-x\f[R] or
-\f[B]\[en]extended-register\f[R] command-line arguments are given), then
+\f[B]--extended-register\f[R] command-line arguments are given), then
normal single character registers are used \f[I]unless\f[R] the
character immediately following a command that needs a register name is
a space (according to \f[B]isspace()\f[R]) and not a newline
@@ -954,7 +966,7 @@ will be correctly parsed, but the string \f[B]\[lq]/home/gavin/some
The quote parsing will handle either kind of quotes, \f[B]\[cq]\f[R] or
\f[B]\[lq]\f[R]. Thus, if you have a file with any number of single
quotes in the name, you can use double quotes as the outside quotes, as
-in \f[B]\[rq]some `bc' file.bc\[dq]\f[R], and vice versa if you have a
+in \f[B]\[rq]some `dc' file.dc\[dq]\f[R], and vice versa if you have a
file with double quotes.
However, handling a file with both kinds of quotes in
\f[B]DC_ENV_ARGS\f[R] is not supported due to the complexity of the
@@ -1034,17 +1046,17 @@ interactive mode (see the \f[B]INTERACTIVE MODE\f[R] section), since
dc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
more input when one of those errors occurs in interactive mode.
This is also the case when interactive mode is forced by the
-\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
+\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.PP
These exit statuses allow dc(1) to be used in shell scripting with error
checking, and its normal behavior can be forced by using the
-\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
+\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.SH INTERACTIVE MODE
.PP
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both \f[B]stdin\f[R]
and \f[B]stdout\f[R] are hooked to a terminal, but the \f[B]-i\f[R] flag
-and \f[B]\[en]interactive\f[R] option can turn it on in other cases.
+and \f[B]--interactive\f[R] option can turn it on in other cases.
.PP
In interactive mode, dc(1) attempts to recover from errors (see the
\f[B]RESET\f[R] section), and in normal execution, flushes
diff --git a/contrib/bc/manuals/dc/EHP.1.md b/contrib/bc/manuals/dc/EHP.1.md
index 2df787cef087..17ebe0420492 100644
--- a/contrib/bc/manuals/dc/EHP.1.md
+++ b/contrib/bc/manuals/dc/EHP.1.md
@@ -2,7 +2,7 @@
SPDX-License-Identifier: BSD-2-Clause
-Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+Copyright (c) 2018-2021 Gavin D. Howard and contributors.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
@@ -34,7 +34,7 @@ dc - arbitrary-precision decimal reverse-Polish notation calculator
# SYNOPSIS
-**dc** [**-hiPvVx**] [**--version**] [**--help**] [**--interactive**] [**--no-prompt**] [**--extended-register**] [**-e** *expr*] [**--expression**=*expr*...] [**-f** *file*...] [**-file**=*file*...] [*file*...]
+**dc** [**-hiPvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@@ -43,11 +43,11 @@ notation) to store numbers and results of computations. Arithmetic operations
pop arguments off of the stack and push the results.
If no files are given on the command-line as extra arguments (i.e., not as
-**-f** or **--file** arguments), then dc(1) reads from **stdin**. Otherwise,
+**-f** or **-\-file** arguments), then dc(1) reads from **stdin**. Otherwise,
those files are processed, and dc(1) will then exit.
This is different from the dc(1) on OpenBSD and possibly other dc(1)
-implementations, where **-e** (**--expression**) and **-f** (**--file**)
+implementations, where **-e** (**-\-expression**) and **-f** (**-\-file**)
arguments cause dc(1) to execute them and exit. The reason for this is that this
dc(1) allows users to set arguments in the environment variable **DC_ENV_ARGS**
(see the **ENVIRONMENT VARIABLES** section). Any expressions given on the
@@ -64,55 +64,62 @@ as the last command-line argument or define the environment variable
The following are the options that dc(1) accepts.
-**-h**, **--help**
+**-h**, **-\-help**
: Prints a usage message and quits.
-**-v**, **-V**, **--version**
+**-v**, **-V**, **-\-version**
: Print the version information (copyright header) and exit.
-**-i**, **--interactive**
+**-i**, **-\-interactive**
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
This is a **non-portable extension**.
-**-P**, **--no-prompt**
+**-P**, **-\-no-prompt**
: This option is a no-op.
This is a **non-portable extension**.
-**-x** **--extended-register**
+**-x** **-\-extended-register**
: Enables extended register mode. See the *Extended Register Mode* subsection
of the **REGISTERS** section for more information.
This is a **non-portable extension**.
-**-e** *expr*, **--expression**=*expr*
+**-e** *expr*, **-\-expression**=*expr*
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
order. If files are given as well (see below), the expressions and files are
evaluated in the order given. This means that if a file is given before an
expression, the file is read in and evaluated first.
- After processing all expressions and files, dc(1) will exit, unless **-**
- (**stdin**) was given as an argument at least once to **-f** or **--file**.
+ If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
+ see the **ENVIRONMENT VARIABLES** section), then after processing all
+ expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
+ as an argument at least once to **-f** or **-\-file**, whether on the
+ command-line or in **DC_ENV_ARGS**. However, if any other **-e**,
+ **-\-expression**, **-f**, or **-\-file** arguments are given after **-f-**
+ or equivalent is given, dc(1) will give a fatal error and exit.
This is a **non-portable extension**.
-**-f** *file*, **--file**=*file*
+**-f** *file*, **-\-file**=*file*
: Reads in *file* and evaluates it, line by line, as though it were read
through **stdin**. If expressions are also given (see above), the
expressions are evaluated in the order given.
- After processing all expressions and files, dc(1) will exit, unless **-**
- (**stdin**) was given as an argument at least once to **-f** or **--file**.
- However, if any other **-e**, **--expression**, **-f**, or **--file**
- arguments are given after that, bc(1) will give a fatal error and exit.
+ If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
+ see the **ENVIRONMENT VARIABLES** section), then after processing all
+ expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
+ as an argument at least once to **-f** or **-\-file**. However, if any other
+ **-e**, **-\-expression**, **-f**, or **-\-file** arguments are given after
+ **-f-** or equivalent is given, dc(1) will give a fatal error and exit.
This is a **non-portable extension**.
@@ -120,7 +127,9 @@ All long options are **non-portable extensions**.
# STDOUT
-Any non-error output is written to **stdout**.
+Any non-error output is written to **stdout**. In addition, if history (see the
+**HISTORY** section) and the prompt (see the **TTY MODE** section) are enabled,
+both are output to **stdout**.
**Note**: Unlike other dc(1) implementations, this dc(1) will issue a fatal
error (see the **EXIT STATUS** section) if it cannot write to **stdout**, so if
@@ -737,7 +746,7 @@ follows any command that needs a register name. The only exception is a newline
Unlike most other dc(1) implentations, this dc(1) provides nearly unlimited
amounts of registers, if extended register mode is enabled.
-If extended register mode is enabled (**-x** or **--extended-register**
+If extended register mode is enabled (**-x** or **-\-extended-register**
command-line arguments are given), then normal single character registers are
used *unless* the character immediately following a command that needs a
register name is a space (according to **isspace()**) and not a newline
@@ -865,7 +874,7 @@ dc(1) recognizes the following environment variables:
The quote parsing will handle either kind of quotes, **'** or **"**. Thus,
if you have a file with any number of single quotes in the name, you can use
- double quotes as the outside quotes, as in **"some 'bc' file.bc"**, and vice
+ double quotes as the outside quotes, as in **"some 'dc' file.dc"**, and vice
versa if you have a file with double quotes. However, handling a file with
both kinds of quotes in **DC_ENV_ARGS** is not supported due to the
complexity of the parsing, though such files are still supported on the
@@ -939,17 +948,17 @@ The other statuses will only be returned when dc(1) is not in interactive mode
(see the **INTERACTIVE MODE** section), since dc(1) resets its state (see the
**RESET** section) and accepts more input when one of those errors occurs in
interactive mode. This is also the case when interactive mode is forced by the
-**-i** flag or **--interactive** option.
+**-i** flag or **-\-interactive** option.
These exit statuses allow dc(1) to be used in shell scripting with error
checking, and its normal behavior can be forced by using the **-i** flag or
-**--interactive** option.
+**-\-interactive** option.
# INTERACTIVE MODE
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both **stdin** and **stdout**
-are hooked to a terminal, but the **-i** flag and **--interactive** option can
+are hooked to a terminal, but the **-i** flag and **-\-interactive** option can
turn it on in other cases.
In interactive mode, dc(1) attempts to recover from errors (see the **RESET**
diff --git a/contrib/bc/manuals/dc/EN.1 b/contrib/bc/manuals/dc/EN.1
index 561a0f665cfc..6d522efdde45 100644
--- a/contrib/bc/manuals/dc/EN.1
+++ b/contrib/bc/manuals/dc/EN.1
@@ -1,7 +1,7 @@
.\"
.\" SPDX-License-Identifier: BSD-2-Clause
.\"
-.\" Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+.\" Copyright (c) 2018-2021 Gavin D. Howard and contributors.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions are met:
@@ -25,18 +25,17 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.TH "DC" "1" "October 2020" "Gavin D. Howard" "General Commands Manual"
+.TH "DC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
.SH Name
.PP
dc - arbitrary-precision decimal reverse-Polish notation calculator
.SH SYNOPSIS
.PP
-\f[B]dc\f[R] [\f[B]-hiPvVx\f[R]] [\f[B]\[en]version\f[R]]
-[\f[B]\[en]help\f[R]] [\f[B]\[en]interactive\f[R]]
-[\f[B]\[en]no-prompt\f[R]] [\f[B]\[en]extended-register\f[R]]
-[\f[B]-e\f[R] \f[I]expr\f[R]]
-[\f[B]\[en]expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
-\f[I]file\f[R]\&...] [\f[B]-file\f[R]=\f[I]file\f[R]\&...]
+\f[B]dc\f[R] [\f[B]-hiPvVx\f[R]] [\f[B]--version\f[R]]
+[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--no-prompt\f[R]]
+[\f[B]--extended-register\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
+[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
+\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
[\f[I]file\f[R]\&...]
.SH DESCRIPTION
.PP
@@ -47,13 +46,13 @@ Arithmetic operations pop arguments off of the stack and push the
results.
.PP
If no files are given on the command-line as extra arguments (i.e., not
-as \f[B]-f\f[R] or \f[B]\[en]file\f[R] arguments), then dc(1) reads from
+as \f[B]-f\f[R] or \f[B]--file\f[R] arguments), then dc(1) reads from
\f[B]stdin\f[R].
Otherwise, those files are processed, and dc(1) will then exit.
.PP
This is different from the dc(1) on OpenBSD and possibly other dc(1)
-implementations, where \f[B]-e\f[R] (\f[B]\[en]expression\f[R]) and
-\f[B]-f\f[R] (\f[B]\[en]file\f[R]) arguments cause dc(1) to execute them
+implementations, where \f[B]-e\f[R] (\f[B]--expression\f[R]) and
+\f[B]-f\f[R] (\f[B]--file\f[R]) arguments cause dc(1) to execute them
and exit.
The reason for this is that this dc(1) allows users to set arguments in
the environment variable \f[B]DC_ENV_ARGS\f[R] (see the \f[B]ENVIRONMENT
@@ -72,13 +71,13 @@ argument or define the environment variable \f[B]DC_EXPR_EXIT\f[R].
.PP
The following are the options that dc(1) accepts.
.TP
-\f[B]-h\f[R], \f[B]\[en]help\f[R]
+\f[B]-h\f[R], \f[B]--help\f[R]
Prints a usage message and quits.
.TP
-\f[B]-v\f[R], \f[B]-V\f[R], \f[B]\[en]version\f[R]
+\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
Print the version information (copyright header) and exit.
.TP
-\f[B]-i\f[R], \f[B]\[en]interactive\f[R]
+\f[B]-i\f[R], \f[B]--interactive\f[R]
Forces interactive mode.
(See the \f[B]INTERACTIVE MODE\f[R] section.)
.RS
@@ -86,7 +85,7 @@ Forces interactive mode.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-P\f[R], \f[B]\[en]no-prompt\f[R]
+\f[B]-P\f[R], \f[B]--no-prompt\f[R]
Disables the prompt in TTY mode.
(The prompt is only enabled in TTY mode.
See the \f[B]TTY MODE\f[R] section) This is mostly for those users that
@@ -98,7 +97,7 @@ Most of those users would want to put this option in
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-x\f[R] \f[B]\[en]extended-register\f[R]
+\f[B]-x\f[R] \f[B]--extended-register\f[R]
Enables extended register mode.
See the \f[I]Extended Register Mode\f[R] subsection of the
\f[B]REGISTERS\f[R] section for more information.
@@ -107,7 +106,7 @@ See the \f[I]Extended Register Mode\f[R] subsection of the
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-e\f[R] \f[I]expr\f[R], \f[B]\[en]expression\f[R]=\f[I]expr\f[R]
+\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
Evaluates \f[I]expr\f[R].
If multiple expressions are given, they are evaluated in order.
If files are given as well (see below), the expressions and files are
@@ -116,26 +115,36 @@ This means that if a file is given before an expression, the file is
read in and evaluated first.
.RS
.PP
-After processing all expressions and files, dc(1) will exit, unless
+If this option is given on the command-line (i.e., not in
+\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
+then after processing all expressions and files, dc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]\[en]file\f[R].
+\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
+\f[B]DC_ENV_ARGS\f[R].
+However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
+\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
+\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
+exit.
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-f\f[R] \f[I]file\f[R], \f[B]\[en]file\f[R]=\f[I]file\f[R]
+\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
were read through \f[B]stdin\f[R].
If expressions are also given (see above), the expressions are evaluated
in the order given.
.RS
.PP
-After processing all expressions and files, dc(1) will exit, unless
+If this option is given on the command-line (i.e., not in
+\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
+then after processing all expressions and files, dc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]\[en]file\f[R].
-However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
-\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after that,
-bc(1) will give a fatal error and exit.
+\f[B]-f\f[R] or \f[B]--file\f[R].
+However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
+\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
+\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
+exit.
.PP
This is a \f[B]non-portable extension\f[R].
.RE
@@ -144,6 +153,9 @@ All long options are \f[B]non-portable extensions\f[R].
.SH STDOUT
.PP
Any non-error output is written to \f[B]stdout\f[R].
+In addition, if history (see the \f[B]HISTORY\f[R] section) and the
+prompt (see the \f[B]TTY MODE\f[R] section) are enabled, both are output
+to \f[B]stdout\f[R].
.PP
\f[B]Note\f[R]: Unlike other dc(1) implementations, this dc(1) will
issue a fatal error (see the \f[B]EXIT STATUS\f[R] section) if it cannot
@@ -824,7 +836,7 @@ Unlike most other dc(1) implentations, this dc(1) provides nearly
unlimited amounts of registers, if extended register mode is enabled.
.PP
If extended register mode is enabled (\f[B]-x\f[R] or
-\f[B]\[en]extended-register\f[R] command-line arguments are given), then
+\f[B]--extended-register\f[R] command-line arguments are given), then
normal single character registers are used \f[I]unless\f[R] the
character immediately following a command that needs a register name is
a space (according to \f[B]isspace()\f[R]) and not a newline
@@ -959,7 +971,7 @@ will be correctly parsed, but the string \f[B]\[lq]/home/gavin/some
The quote parsing will handle either kind of quotes, \f[B]\[cq]\f[R] or
\f[B]\[lq]\f[R]. Thus, if you have a file with any number of single
quotes in the name, you can use double quotes as the outside quotes, as
-in \f[B]\[rq]some `bc' file.bc\[dq]\f[R], and vice versa if you have a
+in \f[B]\[rq]some `dc' file.dc\[dq]\f[R], and vice versa if you have a
file with double quotes.
However, handling a file with both kinds of quotes in
\f[B]DC_ENV_ARGS\f[R] is not supported due to the complexity of the
@@ -1039,17 +1051,17 @@ interactive mode (see the \f[B]INTERACTIVE MODE\f[R] section), since
dc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
more input when one of those errors occurs in interactive mode.
This is also the case when interactive mode is forced by the
-\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
+\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.PP
These exit statuses allow dc(1) to be used in shell scripting with error
checking, and its normal behavior can be forced by using the
-\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
+\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.SH INTERACTIVE MODE
.PP
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both \f[B]stdin\f[R]
and \f[B]stdout\f[R] are hooked to a terminal, but the \f[B]-i\f[R] flag
-and \f[B]\[en]interactive\f[R] option can turn it on in other cases.
+and \f[B]--interactive\f[R] option can turn it on in other cases.
.PP
In interactive mode, dc(1) attempts to recover from errors (see the
\f[B]RESET\f[R] section), and in normal execution, flushes
diff --git a/contrib/bc/manuals/dc/EN.1.md b/contrib/bc/manuals/dc/EN.1.md
index 01c40a8e34dc..4c0297fdab7f 100644
--- a/contrib/bc/manuals/dc/EN.1.md
+++ b/contrib/bc/manuals/dc/EN.1.md
@@ -2,7 +2,7 @@
SPDX-License-Identifier: BSD-2-Clause
-Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+Copyright (c) 2018-2021 Gavin D. Howard and contributors.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
@@ -34,7 +34,7 @@ dc - arbitrary-precision decimal reverse-Polish notation calculator
# SYNOPSIS
-**dc** [**-hiPvVx**] [**--version**] [**--help**] [**--interactive**] [**--no-prompt**] [**--extended-register**] [**-e** *expr*] [**--expression**=*expr*...] [**-f** *file*...] [**-file**=*file*...] [*file*...]
+**dc** [**-hiPvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@@ -43,11 +43,11 @@ notation) to store numbers and results of computations. Arithmetic operations
pop arguments off of the stack and push the results.
If no files are given on the command-line as extra arguments (i.e., not as
-**-f** or **--file** arguments), then dc(1) reads from **stdin**. Otherwise,
+**-f** or **-\-file** arguments), then dc(1) reads from **stdin**. Otherwise,
those files are processed, and dc(1) will then exit.
This is different from the dc(1) on OpenBSD and possibly other dc(1)
-implementations, where **-e** (**--expression**) and **-f** (**--file**)
+implementations, where **-e** (**-\-expression**) and **-f** (**-\-file**)
arguments cause dc(1) to execute them and exit. The reason for this is that this
dc(1) allows users to set arguments in the environment variable **DC_ENV_ARGS**
(see the **ENVIRONMENT VARIABLES** section). Any expressions given on the
@@ -64,21 +64,21 @@ as the last command-line argument or define the environment variable
The following are the options that dc(1) accepts.
-**-h**, **--help**
+**-h**, **-\-help**
: Prints a usage message and quits.
-**-v**, **-V**, **--version**
+**-v**, **-V**, **-\-version**
: Print the version information (copyright header) and exit.
-**-i**, **--interactive**
+**-i**, **-\-interactive**
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
This is a **non-portable extension**.
-**-P**, **--no-prompt**
+**-P**, **-\-no-prompt**
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
See the **TTY MODE** section) This is mostly for those users that do not
@@ -87,35 +87,42 @@ The following are the options that dc(1) accepts.
This is a **non-portable extension**.
-**-x** **--extended-register**
+**-x** **-\-extended-register**
: Enables extended register mode. See the *Extended Register Mode* subsection
of the **REGISTERS** section for more information.
This is a **non-portable extension**.
-**-e** *expr*, **--expression**=*expr*
+**-e** *expr*, **-\-expression**=*expr*
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
order. If files are given as well (see below), the expressions and files are
evaluated in the order given. This means that if a file is given before an
expression, the file is read in and evaluated first.
- After processing all expressions and files, dc(1) will exit, unless **-**
- (**stdin**) was given as an argument at least once to **-f** or **--file**.
+ If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
+ see the **ENVIRONMENT VARIABLES** section), then after processing all
+ expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
+ as an argument at least once to **-f** or **-\-file**, whether on the
+ command-line or in **DC_ENV_ARGS**. However, if any other **-e**,
+ **-\-expression**, **-f**, or **-\-file** arguments are given after **-f-**
+ or equivalent is given, dc(1) will give a fatal error and exit.
This is a **non-portable extension**.
-**-f** *file*, **--file**=*file*
+**-f** *file*, **-\-file**=*file*
: Reads in *file* and evaluates it, line by line, as though it were read
through **stdin**. If expressions are also given (see above), the
expressions are evaluated in the order given.
- After processing all expressions and files, dc(1) will exit, unless **-**
- (**stdin**) was given as an argument at least once to **-f** or **--file**.
- However, if any other **-e**, **--expression**, **-f**, or **--file**
- arguments are given after that, bc(1) will give a fatal error and exit.
+ If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
+ see the **ENVIRONMENT VARIABLES** section), then after processing all
+ expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
+ as an argument at least once to **-f** or **-\-file**. However, if any other
+ **-e**, **-\-expression**, **-f**, or **-\-file** arguments are given after
+ **-f-** or equivalent is given, dc(1) will give a fatal error and exit.
This is a **non-portable extension**.
@@ -123,7 +130,9 @@ All long options are **non-portable extensions**.
# STDOUT
-Any non-error output is written to **stdout**.
+Any non-error output is written to **stdout**. In addition, if history (see the
+**HISTORY** section) and the prompt (see the **TTY MODE** section) are enabled,
+both are output to **stdout**.
**Note**: Unlike other dc(1) implementations, this dc(1) will issue a fatal
error (see the **EXIT STATUS** section) if it cannot write to **stdout**, so if
@@ -740,7 +749,7 @@ follows any command that needs a register name. The only exception is a newline
Unlike most other dc(1) implentations, this dc(1) provides nearly unlimited
amounts of registers, if extended register mode is enabled.
-If extended register mode is enabled (**-x** or **--extended-register**
+If extended register mode is enabled (**-x** or **-\-extended-register**
command-line arguments are given), then normal single character registers are
used *unless* the character immediately following a command that needs a
register name is a space (according to **isspace()**) and not a newline
@@ -868,7 +877,7 @@ dc(1) recognizes the following environment variables:
The quote parsing will handle either kind of quotes, **'** or **"**. Thus,
if you have a file with any number of single quotes in the name, you can use
- double quotes as the outside quotes, as in **"some 'bc' file.bc"**, and vice
+ double quotes as the outside quotes, as in **"some 'dc' file.dc"**, and vice
versa if you have a file with double quotes. However, handling a file with
both kinds of quotes in **DC_ENV_ARGS** is not supported due to the
complexity of the parsing, though such files are still supported on the
@@ -942,17 +951,17 @@ The other statuses will only be returned when dc(1) is not in interactive mode
(see the **INTERACTIVE MODE** section), since dc(1) resets its state (see the
**RESET** section) and accepts more input when one of those errors occurs in
interactive mode. This is also the case when interactive mode is forced by the
-**-i** flag or **--interactive** option.
+**-i** flag or **-\-interactive** option.
These exit statuses allow dc(1) to be used in shell scripting with error
checking, and its normal behavior can be forced by using the **-i** flag or
-**--interactive** option.
+**-\-interactive** option.
# INTERACTIVE MODE
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both **stdin** and **stdout**
-are hooked to a terminal, but the **-i** flag and **--interactive** option can
+are hooked to a terminal, but the **-i** flag and **-\-interactive** option can
turn it on in other cases.
In interactive mode, dc(1) attempts to recover from errors (see the **RESET**
diff --git a/contrib/bc/manuals/dc/ENP.1 b/contrib/bc/manuals/dc/ENP.1
index 77a94af08310..c9659423dc26 100644
--- a/contrib/bc/manuals/dc/ENP.1
+++ b/contrib/bc/manuals/dc/ENP.1
@@ -1,7 +1,7 @@
.\"
.\" SPDX-License-Identifier: BSD-2-Clause
.\"
-.\" Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+.\" Copyright (c) 2018-2021 Gavin D. Howard and contributors.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions are met:
@@ -25,18 +25,17 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.TH "DC" "1" "October 2020" "Gavin D. Howard" "General Commands Manual"
+.TH "DC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
.SH Name
.PP
dc - arbitrary-precision decimal reverse-Polish notation calculator
.SH SYNOPSIS
.PP
-\f[B]dc\f[R] [\f[B]-hiPvVx\f[R]] [\f[B]\[en]version\f[R]]
-[\f[B]\[en]help\f[R]] [\f[B]\[en]interactive\f[R]]
-[\f[B]\[en]no-prompt\f[R]] [\f[B]\[en]extended-register\f[R]]
-[\f[B]-e\f[R] \f[I]expr\f[R]]
-[\f[B]\[en]expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
-\f[I]file\f[R]\&...] [\f[B]-file\f[R]=\f[I]file\f[R]\&...]
+\f[B]dc\f[R] [\f[B]-hiPvVx\f[R]] [\f[B]--version\f[R]]
+[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--no-prompt\f[R]]
+[\f[B]--extended-register\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
+[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
+\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
[\f[I]file\f[R]\&...]
.SH DESCRIPTION
.PP
@@ -47,13 +46,13 @@ Arithmetic operations pop arguments off of the stack and push the
results.
.PP
If no files are given on the command-line as extra arguments (i.e., not
-as \f[B]-f\f[R] or \f[B]\[en]file\f[R] arguments), then dc(1) reads from
+as \f[B]-f\f[R] or \f[B]--file\f[R] arguments), then dc(1) reads from
\f[B]stdin\f[R].
Otherwise, those files are processed, and dc(1) will then exit.
.PP
This is different from the dc(1) on OpenBSD and possibly other dc(1)
-implementations, where \f[B]-e\f[R] (\f[B]\[en]expression\f[R]) and
-\f[B]-f\f[R] (\f[B]\[en]file\f[R]) arguments cause dc(1) to execute them
+implementations, where \f[B]-e\f[R] (\f[B]--expression\f[R]) and
+\f[B]-f\f[R] (\f[B]--file\f[R]) arguments cause dc(1) to execute them
and exit.
The reason for this is that this dc(1) allows users to set arguments in
the environment variable \f[B]DC_ENV_ARGS\f[R] (see the \f[B]ENVIRONMENT
@@ -72,13 +71,13 @@ argument or define the environment variable \f[B]DC_EXPR_EXIT\f[R].
.PP
The following are the options that dc(1) accepts.
.TP
-\f[B]-h\f[R], \f[B]\[en]help\f[R]
+\f[B]-h\f[R], \f[B]--help\f[R]
Prints a usage message and quits.
.TP
-\f[B]-v\f[R], \f[B]-V\f[R], \f[B]\[en]version\f[R]
+\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
Print the version information (copyright header) and exit.
.TP
-\f[B]-i\f[R], \f[B]\[en]interactive\f[R]
+\f[B]-i\f[R], \f[B]--interactive\f[R]
Forces interactive mode.
(See the \f[B]INTERACTIVE MODE\f[R] section.)
.RS
@@ -86,14 +85,14 @@ Forces interactive mode.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-P\f[R], \f[B]\[en]no-prompt\f[R]
+\f[B]-P\f[R], \f[B]--no-prompt\f[R]
This option is a no-op.
.RS
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-x\f[R] \f[B]\[en]extended-register\f[R]
+\f[B]-x\f[R] \f[B]--extended-register\f[R]
Enables extended register mode.
See the \f[I]Extended Register Mode\f[R] subsection of the
\f[B]REGISTERS\f[R] section for more information.
@@ -102,7 +101,7 @@ See the \f[I]Extended Register Mode\f[R] subsection of the
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-e\f[R] \f[I]expr\f[R], \f[B]\[en]expression\f[R]=\f[I]expr\f[R]
+\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
Evaluates \f[I]expr\f[R].
If multiple expressions are given, they are evaluated in order.
If files are given as well (see below), the expressions and files are
@@ -111,26 +110,36 @@ This means that if a file is given before an expression, the file is
read in and evaluated first.
.RS
.PP
-After processing all expressions and files, dc(1) will exit, unless
+If this option is given on the command-line (i.e., not in
+\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
+then after processing all expressions and files, dc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]\[en]file\f[R].
+\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
+\f[B]DC_ENV_ARGS\f[R].
+However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
+\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
+\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
+exit.
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-f\f[R] \f[I]file\f[R], \f[B]\[en]file\f[R]=\f[I]file\f[R]
+\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
were read through \f[B]stdin\f[R].
If expressions are also given (see above), the expressions are evaluated
in the order given.
.RS
.PP
-After processing all expressions and files, dc(1) will exit, unless
+If this option is given on the command-line (i.e., not in
+\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
+then after processing all expressions and files, dc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]\[en]file\f[R].
-However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
-\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after that,
-bc(1) will give a fatal error and exit.
+\f[B]-f\f[R] or \f[B]--file\f[R].
+However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
+\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
+\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
+exit.
.PP
This is a \f[B]non-portable extension\f[R].
.RE
@@ -139,6 +148,9 @@ All long options are \f[B]non-portable extensions\f[R].
.SH STDOUT
.PP
Any non-error output is written to \f[B]stdout\f[R].
+In addition, if history (see the \f[B]HISTORY\f[R] section) and the
+prompt (see the \f[B]TTY MODE\f[R] section) are enabled, both are output
+to \f[B]stdout\f[R].
.PP
\f[B]Note\f[R]: Unlike other dc(1) implementations, this dc(1) will
issue a fatal error (see the \f[B]EXIT STATUS\f[R] section) if it cannot
@@ -819,7 +831,7 @@ Unlike most other dc(1) implentations, this dc(1) provides nearly
unlimited amounts of registers, if extended register mode is enabled.
.PP
If extended register mode is enabled (\f[B]-x\f[R] or
-\f[B]\[en]extended-register\f[R] command-line arguments are given), then
+\f[B]--extended-register\f[R] command-line arguments are given), then
normal single character registers are used \f[I]unless\f[R] the
character immediately following a command that needs a register name is
a space (according to \f[B]isspace()\f[R]) and not a newline
@@ -954,7 +966,7 @@ will be correctly parsed, but the string \f[B]\[lq]/home/gavin/some
The quote parsing will handle either kind of quotes, \f[B]\[cq]\f[R] or
\f[B]\[lq]\f[R]. Thus, if you have a file with any number of single
quotes in the name, you can use double quotes as the outside quotes, as
-in \f[B]\[rq]some `bc' file.bc\[dq]\f[R], and vice versa if you have a
+in \f[B]\[rq]some `dc' file.dc\[dq]\f[R], and vice versa if you have a
file with double quotes.
However, handling a file with both kinds of quotes in
\f[B]DC_ENV_ARGS\f[R] is not supported due to the complexity of the
@@ -1034,17 +1046,17 @@ interactive mode (see the \f[B]INTERACTIVE MODE\f[R] section), since
dc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
more input when one of those errors occurs in interactive mode.
This is also the case when interactive mode is forced by the
-\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
+\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.PP
These exit statuses allow dc(1) to be used in shell scripting with error
checking, and its normal behavior can be forced by using the
-\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
+\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.SH INTERACTIVE MODE
.PP
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both \f[B]stdin\f[R]
and \f[B]stdout\f[R] are hooked to a terminal, but the \f[B]-i\f[R] flag
-and \f[B]\[en]interactive\f[R] option can turn it on in other cases.
+and \f[B]--interactive\f[R] option can turn it on in other cases.
.PP
In interactive mode, dc(1) attempts to recover from errors (see the
\f[B]RESET\f[R] section), and in normal execution, flushes
diff --git a/contrib/bc/manuals/dc/ENP.1.md b/contrib/bc/manuals/dc/ENP.1.md
index 9eb8696d1755..4025c643b956 100644
--- a/contrib/bc/manuals/dc/ENP.1.md
+++ b/contrib/bc/manuals/dc/ENP.1.md
@@ -2,7 +2,7 @@
SPDX-License-Identifier: BSD-2-Clause
-Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+Copyright (c) 2018-2021 Gavin D. Howard and contributors.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
@@ -34,7 +34,7 @@ dc - arbitrary-precision decimal reverse-Polish notation calculator
# SYNOPSIS
-**dc** [**-hiPvVx**] [**--version**] [**--help**] [**--interactive**] [**--no-prompt**] [**--extended-register**] [**-e** *expr*] [**--expression**=*expr*...] [**-f** *file*...] [**-file**=*file*...] [*file*...]
+**dc** [**-hiPvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@@ -43,11 +43,11 @@ notation) to store numbers and results of computations. Arithmetic operations
pop arguments off of the stack and push the results.
If no files are given on the command-line as extra arguments (i.e., not as
-**-f** or **--file** arguments), then dc(1) reads from **stdin**. Otherwise,
+**-f** or **-\-file** arguments), then dc(1) reads from **stdin**. Otherwise,
those files are processed, and dc(1) will then exit.
This is different from the dc(1) on OpenBSD and possibly other dc(1)
-implementations, where **-e** (**--expression**) and **-f** (**--file**)
+implementations, where **-e** (**-\-expression**) and **-f** (**-\-file**)
arguments cause dc(1) to execute them and exit. The reason for this is that this
dc(1) allows users to set arguments in the environment variable **DC_ENV_ARGS**
(see the **ENVIRONMENT VARIABLES** section). Any expressions given on the
@@ -64,55 +64,62 @@ as the last command-line argument or define the environment variable
The following are the options that dc(1) accepts.
-**-h**, **--help**
+**-h**, **-\-help**
: Prints a usage message and quits.
-**-v**, **-V**, **--version**
+**-v**, **-V**, **-\-version**
: Print the version information (copyright header) and exit.
-**-i**, **--interactive**
+**-i**, **-\-interactive**
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
This is a **non-portable extension**.
-**-P**, **--no-prompt**
+**-P**, **-\-no-prompt**
: This option is a no-op.
This is a **non-portable extension**.
-**-x** **--extended-register**
+**-x** **-\-extended-register**
: Enables extended register mode. See the *Extended Register Mode* subsection
of the **REGISTERS** section for more information.
This is a **non-portable extension**.
-**-e** *expr*, **--expression**=*expr*
+**-e** *expr*, **-\-expression**=*expr*
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
order. If files are given as well (see below), the expressions and files are
evaluated in the order given. This means that if a file is given before an
expression, the file is read in and evaluated first.
- After processing all expressions and files, dc(1) will exit, unless **-**
- (**stdin**) was given as an argument at least once to **-f** or **--file**.
+ If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
+ see the **ENVIRONMENT VARIABLES** section), then after processing all
+ expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
+ as an argument at least once to **-f** or **-\-file**, whether on the
+ command-line or in **DC_ENV_ARGS**. However, if any other **-e**,
+ **-\-expression**, **-f**, or **-\-file** arguments are given after **-f-**
+ or equivalent is given, dc(1) will give a fatal error and exit.
This is a **non-portable extension**.
-**-f** *file*, **--file**=*file*
+**-f** *file*, **-\-file**=*file*
: Reads in *file* and evaluates it, line by line, as though it were read
through **stdin**. If expressions are also given (see above), the
expressions are evaluated in the order given.
- After processing all expressions and files, dc(1) will exit, unless **-**
- (**stdin**) was given as an argument at least once to **-f** or **--file**.
- However, if any other **-e**, **--expression**, **-f**, or **--file**
- arguments are given after that, bc(1) will give a fatal error and exit.
+ If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
+ see the **ENVIRONMENT VARIABLES** section), then after processing all
+ expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
+ as an argument at least once to **-f** or **-\-file**. However, if any other
+ **-e**, **-\-expression**, **-f**, or **-\-file** arguments are given after
+ **-f-** or equivalent is given, dc(1) will give a fatal error and exit.
This is a **non-portable extension**.
@@ -120,7 +127,9 @@ All long options are **non-portable extensions**.
# STDOUT
-Any non-error output is written to **stdout**.
+Any non-error output is written to **stdout**. In addition, if history (see the
+**HISTORY** section) and the prompt (see the **TTY MODE** section) are enabled,
+both are output to **stdout**.
**Note**: Unlike other dc(1) implementations, this dc(1) will issue a fatal
error (see the **EXIT STATUS** section) if it cannot write to **stdout**, so if
@@ -737,7 +746,7 @@ follows any command that needs a register name. The only exception is a newline
Unlike most other dc(1) implentations, this dc(1) provides nearly unlimited
amounts of registers, if extended register mode is enabled.
-If extended register mode is enabled (**-x** or **--extended-register**
+If extended register mode is enabled (**-x** or **-\-extended-register**
command-line arguments are given), then normal single character registers are
used *unless* the character immediately following a command that needs a
register name is a space (according to **isspace()**) and not a newline
@@ -865,7 +874,7 @@ dc(1) recognizes the following environment variables:
The quote parsing will handle either kind of quotes, **'** or **"**. Thus,
if you have a file with any number of single quotes in the name, you can use
- double quotes as the outside quotes, as in **"some 'bc' file.bc"**, and vice
+ double quotes as the outside quotes, as in **"some 'dc' file.dc"**, and vice
versa if you have a file with double quotes. However, handling a file with
both kinds of quotes in **DC_ENV_ARGS** is not supported due to the
complexity of the parsing, though such files are still supported on the
@@ -939,17 +948,17 @@ The other statuses will only be returned when dc(1) is not in interactive mode
(see the **INTERACTIVE MODE** section), since dc(1) resets its state (see the
**RESET** section) and accepts more input when one of those errors occurs in
interactive mode. This is also the case when interactive mode is forced by the
-**-i** flag or **--interactive** option.
+**-i** flag or **-\-interactive** option.
These exit statuses allow dc(1) to be used in shell scripting with error
checking, and its normal behavior can be forced by using the **-i** flag or
-**--interactive** option.
+**-\-interactive** option.
# INTERACTIVE MODE
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both **stdin** and **stdout**
-are hooked to a terminal, but the **-i** flag and **--interactive** option can
+are hooked to a terminal, but the **-i** flag and **-\-interactive** option can
turn it on in other cases.
In interactive mode, dc(1) attempts to recover from errors (see the **RESET**
diff --git a/contrib/bc/manuals/dc/EP.1 b/contrib/bc/manuals/dc/EP.1
index 9a41956d67a5..1dd0da3235e7 100644
--- a/contrib/bc/manuals/dc/EP.1
+++ b/contrib/bc/manuals/dc/EP.1
@@ -1,7 +1,7 @@
.\"
.\" SPDX-License-Identifier: BSD-2-Clause
.\"
-.\" Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+.\" Copyright (c) 2018-2021 Gavin D. Howard and contributors.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions are met:
@@ -25,18 +25,17 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.TH "DC" "1" "October 2020" "Gavin D. Howard" "General Commands Manual"
+.TH "DC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
.SH Name
.PP
dc - arbitrary-precision decimal reverse-Polish notation calculator
.SH SYNOPSIS
.PP
-\f[B]dc\f[R] [\f[B]-hiPvVx\f[R]] [\f[B]\[en]version\f[R]]
-[\f[B]\[en]help\f[R]] [\f[B]\[en]interactive\f[R]]
-[\f[B]\[en]no-prompt\f[R]] [\f[B]\[en]extended-register\f[R]]
-[\f[B]-e\f[R] \f[I]expr\f[R]]
-[\f[B]\[en]expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
-\f[I]file\f[R]\&...] [\f[B]-file\f[R]=\f[I]file\f[R]\&...]
+\f[B]dc\f[R] [\f[B]-hiPvVx\f[R]] [\f[B]--version\f[R]]
+[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--no-prompt\f[R]]
+[\f[B]--extended-register\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
+[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
+\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
[\f[I]file\f[R]\&...]
.SH DESCRIPTION
.PP
@@ -47,13 +46,13 @@ Arithmetic operations pop arguments off of the stack and push the
results.
.PP
If no files are given on the command-line as extra arguments (i.e., not
-as \f[B]-f\f[R] or \f[B]\[en]file\f[R] arguments), then dc(1) reads from
+as \f[B]-f\f[R] or \f[B]--file\f[R] arguments), then dc(1) reads from
\f[B]stdin\f[R].
Otherwise, those files are processed, and dc(1) will then exit.
.PP
This is different from the dc(1) on OpenBSD and possibly other dc(1)
-implementations, where \f[B]-e\f[R] (\f[B]\[en]expression\f[R]) and
-\f[B]-f\f[R] (\f[B]\[en]file\f[R]) arguments cause dc(1) to execute them
+implementations, where \f[B]-e\f[R] (\f[B]--expression\f[R]) and
+\f[B]-f\f[R] (\f[B]--file\f[R]) arguments cause dc(1) to execute them
and exit.
The reason for this is that this dc(1) allows users to set arguments in
the environment variable \f[B]DC_ENV_ARGS\f[R] (see the \f[B]ENVIRONMENT
@@ -72,13 +71,13 @@ argument or define the environment variable \f[B]DC_EXPR_EXIT\f[R].
.PP
The following are the options that dc(1) accepts.
.TP
-\f[B]-h\f[R], \f[B]\[en]help\f[R]
+\f[B]-h\f[R], \f[B]--help\f[R]
Prints a usage message and quits.
.TP
-\f[B]-v\f[R], \f[B]-V\f[R], \f[B]\[en]version\f[R]
+\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
Print the version information (copyright header) and exit.
.TP
-\f[B]-i\f[R], \f[B]\[en]interactive\f[R]
+\f[B]-i\f[R], \f[B]--interactive\f[R]
Forces interactive mode.
(See the \f[B]INTERACTIVE MODE\f[R] section.)
.RS
@@ -86,14 +85,14 @@ Forces interactive mode.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-P\f[R], \f[B]\[en]no-prompt\f[R]
+\f[B]-P\f[R], \f[B]--no-prompt\f[R]
This option is a no-op.
.RS
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-x\f[R] \f[B]\[en]extended-register\f[R]
+\f[B]-x\f[R] \f[B]--extended-register\f[R]
Enables extended register mode.
See the \f[I]Extended Register Mode\f[R] subsection of the
\f[B]REGISTERS\f[R] section for more information.
@@ -102,7 +101,7 @@ See the \f[I]Extended Register Mode\f[R] subsection of the
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-e\f[R] \f[I]expr\f[R], \f[B]\[en]expression\f[R]=\f[I]expr\f[R]
+\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
Evaluates \f[I]expr\f[R].
If multiple expressions are given, they are evaluated in order.
If files are given as well (see below), the expressions and files are
@@ -111,26 +110,36 @@ This means that if a file is given before an expression, the file is
read in and evaluated first.
.RS
.PP
-After processing all expressions and files, dc(1) will exit, unless
+If this option is given on the command-line (i.e., not in
+\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
+then after processing all expressions and files, dc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]\[en]file\f[R].
+\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
+\f[B]DC_ENV_ARGS\f[R].
+However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
+\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
+\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
+exit.
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-f\f[R] \f[I]file\f[R], \f[B]\[en]file\f[R]=\f[I]file\f[R]
+\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
were read through \f[B]stdin\f[R].
If expressions are also given (see above), the expressions are evaluated
in the order given.
.RS
.PP
-After processing all expressions and files, dc(1) will exit, unless
+If this option is given on the command-line (i.e., not in
+\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
+then after processing all expressions and files, dc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]\[en]file\f[R].
-However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
-\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after that,
-bc(1) will give a fatal error and exit.
+\f[B]-f\f[R] or \f[B]--file\f[R].
+However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
+\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
+\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
+exit.
.PP
This is a \f[B]non-portable extension\f[R].
.RE
@@ -139,6 +148,9 @@ All long options are \f[B]non-portable extensions\f[R].
.SH STDOUT
.PP
Any non-error output is written to \f[B]stdout\f[R].
+In addition, if history (see the \f[B]HISTORY\f[R] section) and the
+prompt (see the \f[B]TTY MODE\f[R] section) are enabled, both are output
+to \f[B]stdout\f[R].
.PP
\f[B]Note\f[R]: Unlike other dc(1) implementations, this dc(1) will
issue a fatal error (see the \f[B]EXIT STATUS\f[R] section) if it cannot
@@ -819,7 +831,7 @@ Unlike most other dc(1) implentations, this dc(1) provides nearly
unlimited amounts of registers, if extended register mode is enabled.
.PP
If extended register mode is enabled (\f[B]-x\f[R] or
-\f[B]\[en]extended-register\f[R] command-line arguments are given), then
+\f[B]--extended-register\f[R] command-line arguments are given), then
normal single character registers are used \f[I]unless\f[R] the
character immediately following a command that needs a register name is
a space (according to \f[B]isspace()\f[R]) and not a newline
@@ -954,7 +966,7 @@ will be correctly parsed, but the string \f[B]\[lq]/home/gavin/some
The quote parsing will handle either kind of quotes, \f[B]\[cq]\f[R] or
\f[B]\[lq]\f[R]. Thus, if you have a file with any number of single
quotes in the name, you can use double quotes as the outside quotes, as
-in \f[B]\[rq]some `bc' file.bc\[dq]\f[R], and vice versa if you have a
+in \f[B]\[rq]some `dc' file.dc\[dq]\f[R], and vice versa if you have a
file with double quotes.
However, handling a file with both kinds of quotes in
\f[B]DC_ENV_ARGS\f[R] is not supported due to the complexity of the
@@ -1034,17 +1046,17 @@ interactive mode (see the \f[B]INTERACTIVE MODE\f[R] section), since
dc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
more input when one of those errors occurs in interactive mode.
This is also the case when interactive mode is forced by the
-\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
+\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.PP
These exit statuses allow dc(1) to be used in shell scripting with error
checking, and its normal behavior can be forced by using the
-\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
+\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.SH INTERACTIVE MODE
.PP
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both \f[B]stdin\f[R]
and \f[B]stdout\f[R] are hooked to a terminal, but the \f[B]-i\f[R] flag
-and \f[B]\[en]interactive\f[R] option can turn it on in other cases.
+and \f[B]--interactive\f[R] option can turn it on in other cases.
.PP
In interactive mode, dc(1) attempts to recover from errors (see the
\f[B]RESET\f[R] section), and in normal execution, flushes
diff --git a/contrib/bc/manuals/dc/EP.1.md b/contrib/bc/manuals/dc/EP.1.md
index f9333fd29e19..fcb15291262d 100644
--- a/contrib/bc/manuals/dc/EP.1.md
+++ b/contrib/bc/manuals/dc/EP.1.md
@@ -2,7 +2,7 @@
SPDX-License-Identifier: BSD-2-Clause
-Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+Copyright (c) 2018-2021 Gavin D. Howard and contributors.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
@@ -34,7 +34,7 @@ dc - arbitrary-precision decimal reverse-Polish notation calculator
# SYNOPSIS
-**dc** [**-hiPvVx**] [**--version**] [**--help**] [**--interactive**] [**--no-prompt**] [**--extended-register**] [**-e** *expr*] [**--expression**=*expr*...] [**-f** *file*...] [**-file**=*file*...] [*file*...]
+**dc** [**-hiPvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@@ -43,11 +43,11 @@ notation) to store numbers and results of computations. Arithmetic operations
pop arguments off of the stack and push the results.
If no files are given on the command-line as extra arguments (i.e., not as
-**-f** or **--file** arguments), then dc(1) reads from **stdin**. Otherwise,
+**-f** or **-\-file** arguments), then dc(1) reads from **stdin**. Otherwise,
those files are processed, and dc(1) will then exit.
This is different from the dc(1) on OpenBSD and possibly other dc(1)
-implementations, where **-e** (**--expression**) and **-f** (**--file**)
+implementations, where **-e** (**-\-expression**) and **-f** (**-\-file**)
arguments cause dc(1) to execute them and exit. The reason for this is that this
dc(1) allows users to set arguments in the environment variable **DC_ENV_ARGS**
(see the **ENVIRONMENT VARIABLES** section). Any expressions given on the
@@ -64,55 +64,62 @@ as the last command-line argument or define the environment variable
The following are the options that dc(1) accepts.
-**-h**, **--help**
+**-h**, **-\-help**
: Prints a usage message and quits.
-**-v**, **-V**, **--version**
+**-v**, **-V**, **-\-version**
: Print the version information (copyright header) and exit.
-**-i**, **--interactive**
+**-i**, **-\-interactive**
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
This is a **non-portable extension**.
-**-P**, **--no-prompt**
+**-P**, **-\-no-prompt**
: This option is a no-op.
This is a **non-portable extension**.
-**-x** **--extended-register**
+**-x** **-\-extended-register**
: Enables extended register mode. See the *Extended Register Mode* subsection
of the **REGISTERS** section for more information.
This is a **non-portable extension**.
-**-e** *expr*, **--expression**=*expr*
+**-e** *expr*, **-\-expression**=*expr*
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
order. If files are given as well (see below), the expressions and files are
evaluated in the order given. This means that if a file is given before an
expression, the file is read in and evaluated first.
- After processing all expressions and files, dc(1) will exit, unless **-**
- (**stdin**) was given as an argument at least once to **-f** or **--file**.
+ If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
+ see the **ENVIRONMENT VARIABLES** section), then after processing all
+ expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
+ as an argument at least once to **-f** or **-\-file**, whether on the
+ command-line or in **DC_ENV_ARGS**. However, if any other **-e**,
+ **-\-expression**, **-f**, or **-\-file** arguments are given after **-f-**
+ or equivalent is given, dc(1) will give a fatal error and exit.
This is a **non-portable extension**.
-**-f** *file*, **--file**=*file*
+**-f** *file*, **-\-file**=*file*
: Reads in *file* and evaluates it, line by line, as though it were read
through **stdin**. If expressions are also given (see above), the
expressions are evaluated in the order given.
- After processing all expressions and files, dc(1) will exit, unless **-**
- (**stdin**) was given as an argument at least once to **-f** or **--file**.
- However, if any other **-e**, **--expression**, **-f**, or **--file**
- arguments are given after that, bc(1) will give a fatal error and exit.
+ If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
+ see the **ENVIRONMENT VARIABLES** section), then after processing all
+ expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
+ as an argument at least once to **-f** or **-\-file**. However, if any other
+ **-e**, **-\-expression**, **-f**, or **-\-file** arguments are given after
+ **-f-** or equivalent is given, dc(1) will give a fatal error and exit.
This is a **non-portable extension**.
@@ -120,7 +127,9 @@ All long options are **non-portable extensions**.
# STDOUT
-Any non-error output is written to **stdout**.
+Any non-error output is written to **stdout**. In addition, if history (see the
+**HISTORY** section) and the prompt (see the **TTY MODE** section) are enabled,
+both are output to **stdout**.
**Note**: Unlike other dc(1) implementations, this dc(1) will issue a fatal
error (see the **EXIT STATUS** section) if it cannot write to **stdout**, so if
@@ -737,7 +746,7 @@ follows any command that needs a register name. The only exception is a newline
Unlike most other dc(1) implentations, this dc(1) provides nearly unlimited
amounts of registers, if extended register mode is enabled.
-If extended register mode is enabled (**-x** or **--extended-register**
+If extended register mode is enabled (**-x** or **-\-extended-register**
command-line arguments are given), then normal single character registers are
used *unless* the character immediately following a command that needs a
register name is a space (according to **isspace()**) and not a newline
@@ -865,7 +874,7 @@ dc(1) recognizes the following environment variables:
The quote parsing will handle either kind of quotes, **'** or **"**. Thus,
if you have a file with any number of single quotes in the name, you can use
- double quotes as the outside quotes, as in **"some 'bc' file.bc"**, and vice
+ double quotes as the outside quotes, as in **"some 'dc' file.dc"**, and vice
versa if you have a file with double quotes. However, handling a file with
both kinds of quotes in **DC_ENV_ARGS** is not supported due to the
complexity of the parsing, though such files are still supported on the
@@ -939,17 +948,17 @@ The other statuses will only be returned when dc(1) is not in interactive mode
(see the **INTERACTIVE MODE** section), since dc(1) resets its state (see the
**RESET** section) and accepts more input when one of those errors occurs in
interactive mode. This is also the case when interactive mode is forced by the
-**-i** flag or **--interactive** option.
+**-i** flag or **-\-interactive** option.
These exit statuses allow dc(1) to be used in shell scripting with error
checking, and its normal behavior can be forced by using the **-i** flag or
-**--interactive** option.
+**-\-interactive** option.
# INTERACTIVE MODE
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both **stdin** and **stdout**
-are hooked to a terminal, but the **-i** flag and **--interactive** option can
+are hooked to a terminal, but the **-i** flag and **-\-interactive** option can
turn it on in other cases.
In interactive mode, dc(1) attempts to recover from errors (see the **RESET**
diff --git a/contrib/bc/manuals/dc/H.1 b/contrib/bc/manuals/dc/H.1
index 78f0f55603aa..15fe0edb0d2d 100644
--- a/contrib/bc/manuals/dc/H.1
+++ b/contrib/bc/manuals/dc/H.1
@@ -1,7 +1,7 @@
.\"
.\" SPDX-License-Identifier: BSD-2-Clause
.\"
-.\" Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+.\" Copyright (c) 2018-2021 Gavin D. Howard and contributors.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions are met:
@@ -25,18 +25,17 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.TH "DC" "1" "October 2020" "Gavin D. Howard" "General Commands Manual"
+.TH "DC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
.SH Name
.PP
dc - arbitrary-precision decimal reverse-Polish notation calculator
.SH SYNOPSIS
.PP
-\f[B]dc\f[R] [\f[B]-hiPvVx\f[R]] [\f[B]\[en]version\f[R]]
-[\f[B]\[en]help\f[R]] [\f[B]\[en]interactive\f[R]]
-[\f[B]\[en]no-prompt\f[R]] [\f[B]\[en]extended-register\f[R]]
-[\f[B]-e\f[R] \f[I]expr\f[R]]
-[\f[B]\[en]expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
-\f[I]file\f[R]\&...] [\f[B]-file\f[R]=\f[I]file\f[R]\&...]
+\f[B]dc\f[R] [\f[B]-hiPvVx\f[R]] [\f[B]--version\f[R]]
+[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--no-prompt\f[R]]
+[\f[B]--extended-register\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
+[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
+\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
[\f[I]file\f[R]\&...]
.SH DESCRIPTION
.PP
@@ -47,13 +46,13 @@ Arithmetic operations pop arguments off of the stack and push the
results.
.PP
If no files are given on the command-line as extra arguments (i.e., not
-as \f[B]-f\f[R] or \f[B]\[en]file\f[R] arguments), then dc(1) reads from
+as \f[B]-f\f[R] or \f[B]--file\f[R] arguments), then dc(1) reads from
\f[B]stdin\f[R].
Otherwise, those files are processed, and dc(1) will then exit.
.PP
This is different from the dc(1) on OpenBSD and possibly other dc(1)
-implementations, where \f[B]-e\f[R] (\f[B]\[en]expression\f[R]) and
-\f[B]-f\f[R] (\f[B]\[en]file\f[R]) arguments cause dc(1) to execute them
+implementations, where \f[B]-e\f[R] (\f[B]--expression\f[R]) and
+\f[B]-f\f[R] (\f[B]--file\f[R]) arguments cause dc(1) to execute them
and exit.
The reason for this is that this dc(1) allows users to set arguments in
the environment variable \f[B]DC_ENV_ARGS\f[R] (see the \f[B]ENVIRONMENT
@@ -72,13 +71,13 @@ argument or define the environment variable \f[B]DC_EXPR_EXIT\f[R].
.PP
The following are the options that dc(1) accepts.
.TP
-\f[B]-h\f[R], \f[B]\[en]help\f[R]
+\f[B]-h\f[R], \f[B]--help\f[R]
Prints a usage message and quits.
.TP
-\f[B]-v\f[R], \f[B]-V\f[R], \f[B]\[en]version\f[R]
+\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
Print the version information (copyright header) and exit.
.TP
-\f[B]-i\f[R], \f[B]\[en]interactive\f[R]
+\f[B]-i\f[R], \f[B]--interactive\f[R]
Forces interactive mode.
(See the \f[B]INTERACTIVE MODE\f[R] section.)
.RS
@@ -86,7 +85,7 @@ Forces interactive mode.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-P\f[R], \f[B]\[en]no-prompt\f[R]
+\f[B]-P\f[R], \f[B]--no-prompt\f[R]
Disables the prompt in TTY mode.
(The prompt is only enabled in TTY mode.
See the \f[B]TTY MODE\f[R] section) This is mostly for those users that
@@ -98,7 +97,7 @@ Most of those users would want to put this option in
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-x\f[R] \f[B]\[en]extended-register\f[R]
+\f[B]-x\f[R] \f[B]--extended-register\f[R]
Enables extended register mode.
See the \f[I]Extended Register Mode\f[R] subsection of the
\f[B]REGISTERS\f[R] section for more information.
@@ -107,7 +106,7 @@ See the \f[I]Extended Register Mode\f[R] subsection of the
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-e\f[R] \f[I]expr\f[R], \f[B]\[en]expression\f[R]=\f[I]expr\f[R]
+\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
Evaluates \f[I]expr\f[R].
If multiple expressions are given, they are evaluated in order.
If files are given as well (see below), the expressions and files are
@@ -116,26 +115,36 @@ This means that if a file is given before an expression, the file is
read in and evaluated first.
.RS
.PP
-After processing all expressions and files, dc(1) will exit, unless
+If this option is given on the command-line (i.e., not in
+\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
+then after processing all expressions and files, dc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]\[en]file\f[R].
+\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
+\f[B]DC_ENV_ARGS\f[R].
+However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
+\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
+\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
+exit.
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-f\f[R] \f[I]file\f[R], \f[B]\[en]file\f[R]=\f[I]file\f[R]
+\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
were read through \f[B]stdin\f[R].
If expressions are also given (see above), the expressions are evaluated
in the order given.
.RS
.PP
-After processing all expressions and files, dc(1) will exit, unless
+If this option is given on the command-line (i.e., not in
+\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
+then after processing all expressions and files, dc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]\[en]file\f[R].
-However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
-\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after that,
-bc(1) will give a fatal error and exit.
+\f[B]-f\f[R] or \f[B]--file\f[R].
+However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
+\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
+\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
+exit.
.PP
This is a \f[B]non-portable extension\f[R].
.RE
@@ -144,6 +153,9 @@ All long options are \f[B]non-portable extensions\f[R].
.SH STDOUT
.PP
Any non-error output is written to \f[B]stdout\f[R].
+In addition, if history (see the \f[B]HISTORY\f[R] section) and the
+prompt (see the \f[B]TTY MODE\f[R] section) are enabled, both are output
+to \f[B]stdout\f[R].
.PP
\f[B]Note\f[R]: Unlike other dc(1) implementations, this dc(1) will
issue a fatal error (see the \f[B]EXIT STATUS\f[R] section) if it cannot
@@ -233,8 +245,12 @@ queried with the \f[B]W\f[R] command.
generator with the \f[B]\[cq]\f[R] and \f[B]\[dq]\f[R] commands are
guaranteed to \f[B]NOT\f[R] be cryptographically secure.
This is a consequence of using a seeded pseudo-random number generator.
-However, they \f[B]are\f[R] guaranteed to be reproducible with identical
+However, they \f[I]are\f[R] guaranteed to be reproducible with identical
\f[B]seed\f[R] values.
+This means that the pseudo-random values from dc(1) should only be used
+where a reproducible stream of pseudo-random numbers is
+\f[I]ESSENTIAL\f[R].
+In any other case, use a non-seeded pseudo-random number generator.
.PP
The pseudo-random number generator, \f[B]seed\f[R], and all associated
operations are \f[B]non-portable extensions\f[R].
@@ -1020,7 +1036,7 @@ Unlike most other dc(1) implentations, this dc(1) provides nearly
unlimited amounts of registers, if extended register mode is enabled.
.PP
If extended register mode is enabled (\f[B]-x\f[R] or
-\f[B]\[en]extended-register\f[R] command-line arguments are given), then
+\f[B]--extended-register\f[R] command-line arguments are given), then
normal single character registers are used \f[I]unless\f[R] the
character immediately following a command that needs a register name is
a space (according to \f[B]isspace()\f[R]) and not a newline
@@ -1160,7 +1176,7 @@ will be correctly parsed, but the string \f[B]\[lq]/home/gavin/some
The quote parsing will handle either kind of quotes, \f[B]\[cq]\f[R] or
\f[B]\[lq]\f[R]. Thus, if you have a file with any number of single
quotes in the name, you can use double quotes as the outside quotes, as
-in \f[B]\[rq]some `bc' file.bc\[dq]\f[R], and vice versa if you have a
+in \f[B]\[rq]some `dc' file.dc\[dq]\f[R], and vice versa if you have a
file with double quotes.
However, handling a file with both kinds of quotes in
\f[B]DC_ENV_ARGS\f[R] is not supported due to the complexity of the
@@ -1243,17 +1259,17 @@ interactive mode (see the \f[B]INTERACTIVE MODE\f[R] section), since
dc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
more input when one of those errors occurs in interactive mode.
This is also the case when interactive mode is forced by the
-\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
+\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.PP
These exit statuses allow dc(1) to be used in shell scripting with error
checking, and its normal behavior can be forced by using the
-\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
+\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.SH INTERACTIVE MODE
.PP
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both \f[B]stdin\f[R]
and \f[B]stdout\f[R] are hooked to a terminal, but the \f[B]-i\f[R] flag
-and \f[B]\[en]interactive\f[R] option can turn it on in other cases.
+and \f[B]--interactive\f[R] option can turn it on in other cases.
.PP
In interactive mode, dc(1) attempts to recover from errors (see the
\f[B]RESET\f[R] section), and in normal execution, flushes
diff --git a/contrib/bc/manuals/dc/H.1.md b/contrib/bc/manuals/dc/H.1.md
index 6542f63d4fdc..de83e3088f9c 100644
--- a/contrib/bc/manuals/dc/H.1.md
+++ b/contrib/bc/manuals/dc/H.1.md
@@ -2,7 +2,7 @@
SPDX-License-Identifier: BSD-2-Clause
-Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+Copyright (c) 2018-2021 Gavin D. Howard and contributors.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
@@ -34,7 +34,7 @@ dc - arbitrary-precision decimal reverse-Polish notation calculator
# SYNOPSIS
-**dc** [**-hiPvVx**] [**--version**] [**--help**] [**--interactive**] [**--no-prompt**] [**--extended-register**] [**-e** *expr*] [**--expression**=*expr*...] [**-f** *file*...] [**-file**=*file*...] [*file*...]
+**dc** [**-hiPvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@@ -43,11 +43,11 @@ notation) to store numbers and results of computations. Arithmetic operations
pop arguments off of the stack and push the results.
If no files are given on the command-line as extra arguments (i.e., not as
-**-f** or **--file** arguments), then dc(1) reads from **stdin**. Otherwise,
+**-f** or **-\-file** arguments), then dc(1) reads from **stdin**. Otherwise,
those files are processed, and dc(1) will then exit.
This is different from the dc(1) on OpenBSD and possibly other dc(1)
-implementations, where **-e** (**--expression**) and **-f** (**--file**)
+implementations, where **-e** (**-\-expression**) and **-f** (**-\-file**)
arguments cause dc(1) to execute them and exit. The reason for this is that this
dc(1) allows users to set arguments in the environment variable **DC_ENV_ARGS**
(see the **ENVIRONMENT VARIABLES** section). Any expressions given on the
@@ -64,21 +64,21 @@ as the last command-line argument or define the environment variable
The following are the options that dc(1) accepts.
-**-h**, **--help**
+**-h**, **-\-help**
: Prints a usage message and quits.
-**-v**, **-V**, **--version**
+**-v**, **-V**, **-\-version**
: Print the version information (copyright header) and exit.
-**-i**, **--interactive**
+**-i**, **-\-interactive**
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
This is a **non-portable extension**.
-**-P**, **--no-prompt**
+**-P**, **-\-no-prompt**
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
See the **TTY MODE** section) This is mostly for those users that do not
@@ -87,35 +87,42 @@ The following are the options that dc(1) accepts.
This is a **non-portable extension**.
-**-x** **--extended-register**
+**-x** **-\-extended-register**
: Enables extended register mode. See the *Extended Register Mode* subsection
of the **REGISTERS** section for more information.
This is a **non-portable extension**.
-**-e** *expr*, **--expression**=*expr*
+**-e** *expr*, **-\-expression**=*expr*
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
order. If files are given as well (see below), the expressions and files are
evaluated in the order given. This means that if a file is given before an
expression, the file is read in and evaluated first.
- After processing all expressions and files, dc(1) will exit, unless **-**
- (**stdin**) was given as an argument at least once to **-f** or **--file**.
+ If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
+ see the **ENVIRONMENT VARIABLES** section), then after processing all
+ expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
+ as an argument at least once to **-f** or **-\-file**, whether on the
+ command-line or in **DC_ENV_ARGS**. However, if any other **-e**,
+ **-\-expression**, **-f**, or **-\-file** arguments are given after **-f-**
+ or equivalent is given, dc(1) will give a fatal error and exit.
This is a **non-portable extension**.
-**-f** *file*, **--file**=*file*
+**-f** *file*, **-\-file**=*file*
: Reads in *file* and evaluates it, line by line, as though it were read
through **stdin**. If expressions are also given (see above), the
expressions are evaluated in the order given.
- After processing all expressions and files, dc(1) will exit, unless **-**
- (**stdin**) was given as an argument at least once to **-f** or **--file**.
- However, if any other **-e**, **--expression**, **-f**, or **--file**
- arguments are given after that, bc(1) will give a fatal error and exit.
+ If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
+ see the **ENVIRONMENT VARIABLES** section), then after processing all
+ expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
+ as an argument at least once to **-f** or **-\-file**. However, if any other
+ **-e**, **-\-expression**, **-f**, or **-\-file** arguments are given after
+ **-f-** or equivalent is given, dc(1) will give a fatal error and exit.
This is a **non-portable extension**.
@@ -123,7 +130,9 @@ All long options are **non-portable extensions**.
# STDOUT
-Any non-error output is written to **stdout**.
+Any non-error output is written to **stdout**. In addition, if history (see the
+**HISTORY** section) and the prompt (see the **TTY MODE** section) are enabled,
+both are output to **stdout**.
**Note**: Unlike other dc(1) implementations, this dc(1) will issue a fatal
error (see the **EXIT STATUS** section) if it cannot write to **stdout**, so if
@@ -197,7 +206,10 @@ command or the **"** command that does not get receive a value of **0** or
**Note**: The values returned by the pseudo-random number generator with the
**'** and **"** commands are guaranteed to **NOT** be cryptographically secure.
This is a consequence of using a seeded pseudo-random number generator. However,
-they **are** guaranteed to be reproducible with identical **seed** values.
+they *are* guaranteed to be reproducible with identical **seed** values. This
+means that the pseudo-random values from dc(1) should only be used where a
+reproducible stream of pseudo-random numbers is *ESSENTIAL*. In any other case,
+use a non-seeded pseudo-random number generator.
The pseudo-random number generator, **seed**, and all associated operations are
**non-portable extensions**.
@@ -897,7 +909,7 @@ follows any command that needs a register name. The only exception is a newline
Unlike most other dc(1) implentations, this dc(1) provides nearly unlimited
amounts of registers, if extended register mode is enabled.
-If extended register mode is enabled (**-x** or **--extended-register**
+If extended register mode is enabled (**-x** or **-\-extended-register**
command-line arguments are given), then normal single character registers are
used *unless* the character immediately following a command that needs a
register name is a space (according to **isspace()**) and not a newline
@@ -1030,7 +1042,7 @@ dc(1) recognizes the following environment variables:
The quote parsing will handle either kind of quotes, **'** or **"**. Thus,
if you have a file with any number of single quotes in the name, you can use
- double quotes as the outside quotes, as in **"some 'bc' file.bc"**, and vice
+ double quotes as the outside quotes, as in **"some 'dc' file.dc"**, and vice
versa if you have a file with double quotes. However, handling a file with
both kinds of quotes in **DC_ENV_ARGS** is not supported due to the
complexity of the parsing, though such files are still supported on the
@@ -1106,17 +1118,17 @@ The other statuses will only be returned when dc(1) is not in interactive mode
(see the **INTERACTIVE MODE** section), since dc(1) resets its state (see the
**RESET** section) and accepts more input when one of those errors occurs in
interactive mode. This is also the case when interactive mode is forced by the
-**-i** flag or **--interactive** option.
+**-i** flag or **-\-interactive** option.
These exit statuses allow dc(1) to be used in shell scripting with error
checking, and its normal behavior can be forced by using the **-i** flag or
-**--interactive** option.
+**-\-interactive** option.
# INTERACTIVE MODE
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both **stdin** and **stdout**
-are hooked to a terminal, but the **-i** flag and **--interactive** option can
+are hooked to a terminal, but the **-i** flag and **-\-interactive** option can
turn it on in other cases.
In interactive mode, dc(1) attempts to recover from errors (see the **RESET**
diff --git a/contrib/bc/manuals/dc/HN.1 b/contrib/bc/manuals/dc/HN.1
index 2c8bde98b88a..a617bb473ec1 100644
--- a/contrib/bc/manuals/dc/HN.1
+++ b/contrib/bc/manuals/dc/HN.1
@@ -1,7 +1,7 @@
.\"
.\" SPDX-License-Identifier: BSD-2-Clause
.\"
-.\" Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+.\" Copyright (c) 2018-2021 Gavin D. Howard and contributors.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions are met:
@@ -25,18 +25,17 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.TH "DC" "1" "October 2020" "Gavin D. Howard" "General Commands Manual"
+.TH "DC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
.SH Name
.PP
dc - arbitrary-precision decimal reverse-Polish notation calculator
.SH SYNOPSIS
.PP
-\f[B]dc\f[R] [\f[B]-hiPvVx\f[R]] [\f[B]\[en]version\f[R]]
-[\f[B]\[en]help\f[R]] [\f[B]\[en]interactive\f[R]]
-[\f[B]\[en]no-prompt\f[R]] [\f[B]\[en]extended-register\f[R]]
-[\f[B]-e\f[R] \f[I]expr\f[R]]
-[\f[B]\[en]expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
-\f[I]file\f[R]\&...] [\f[B]-file\f[R]=\f[I]file\f[R]\&...]
+\f[B]dc\f[R] [\f[B]-hiPvVx\f[R]] [\f[B]--version\f[R]]
+[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--no-prompt\f[R]]
+[\f[B]--extended-register\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
+[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
+\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
[\f[I]file\f[R]\&...]
.SH DESCRIPTION
.PP
@@ -47,13 +46,13 @@ Arithmetic operations pop arguments off of the stack and push the
results.
.PP
If no files are given on the command-line as extra arguments (i.e., not
-as \f[B]-f\f[R] or \f[B]\[en]file\f[R] arguments), then dc(1) reads from
+as \f[B]-f\f[R] or \f[B]--file\f[R] arguments), then dc(1) reads from
\f[B]stdin\f[R].
Otherwise, those files are processed, and dc(1) will then exit.
.PP
This is different from the dc(1) on OpenBSD and possibly other dc(1)
-implementations, where \f[B]-e\f[R] (\f[B]\[en]expression\f[R]) and
-\f[B]-f\f[R] (\f[B]\[en]file\f[R]) arguments cause dc(1) to execute them
+implementations, where \f[B]-e\f[R] (\f[B]--expression\f[R]) and
+\f[B]-f\f[R] (\f[B]--file\f[R]) arguments cause dc(1) to execute them
and exit.
The reason for this is that this dc(1) allows users to set arguments in
the environment variable \f[B]DC_ENV_ARGS\f[R] (see the \f[B]ENVIRONMENT
@@ -72,13 +71,13 @@ argument or define the environment variable \f[B]DC_EXPR_EXIT\f[R].
.PP
The following are the options that dc(1) accepts.
.TP
-\f[B]-h\f[R], \f[B]\[en]help\f[R]
+\f[B]-h\f[R], \f[B]--help\f[R]
Prints a usage message and quits.
.TP
-\f[B]-v\f[R], \f[B]-V\f[R], \f[B]\[en]version\f[R]
+\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
Print the version information (copyright header) and exit.
.TP
-\f[B]-i\f[R], \f[B]\[en]interactive\f[R]
+\f[B]-i\f[R], \f[B]--interactive\f[R]
Forces interactive mode.
(See the \f[B]INTERACTIVE MODE\f[R] section.)
.RS
@@ -86,7 +85,7 @@ Forces interactive mode.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-P\f[R], \f[B]\[en]no-prompt\f[R]
+\f[B]-P\f[R], \f[B]--no-prompt\f[R]
Disables the prompt in TTY mode.
(The prompt is only enabled in TTY mode.
See the \f[B]TTY MODE\f[R] section) This is mostly for those users that
@@ -98,7 +97,7 @@ Most of those users would want to put this option in
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-x\f[R] \f[B]\[en]extended-register\f[R]
+\f[B]-x\f[R] \f[B]--extended-register\f[R]
Enables extended register mode.
See the \f[I]Extended Register Mode\f[R] subsection of the
\f[B]REGISTERS\f[R] section for more information.
@@ -107,7 +106,7 @@ See the \f[I]Extended Register Mode\f[R] subsection of the
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-e\f[R] \f[I]expr\f[R], \f[B]\[en]expression\f[R]=\f[I]expr\f[R]
+\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
Evaluates \f[I]expr\f[R].
If multiple expressions are given, they are evaluated in order.
If files are given as well (see below), the expressions and files are
@@ -116,26 +115,36 @@ This means that if a file is given before an expression, the file is
read in and evaluated first.
.RS
.PP
-After processing all expressions and files, dc(1) will exit, unless
+If this option is given on the command-line (i.e., not in
+\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
+then after processing all expressions and files, dc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]\[en]file\f[R].
+\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
+\f[B]DC_ENV_ARGS\f[R].
+However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
+\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
+\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
+exit.
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-f\f[R] \f[I]file\f[R], \f[B]\[en]file\f[R]=\f[I]file\f[R]
+\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
were read through \f[B]stdin\f[R].
If expressions are also given (see above), the expressions are evaluated
in the order given.
.RS
.PP
-After processing all expressions and files, dc(1) will exit, unless
+If this option is given on the command-line (i.e., not in
+\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
+then after processing all expressions and files, dc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]\[en]file\f[R].
-However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
-\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after that,
-bc(1) will give a fatal error and exit.
+\f[B]-f\f[R] or \f[B]--file\f[R].
+However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
+\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
+\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
+exit.
.PP
This is a \f[B]non-portable extension\f[R].
.RE
@@ -144,6 +153,9 @@ All long options are \f[B]non-portable extensions\f[R].
.SH STDOUT
.PP
Any non-error output is written to \f[B]stdout\f[R].
+In addition, if history (see the \f[B]HISTORY\f[R] section) and the
+prompt (see the \f[B]TTY MODE\f[R] section) are enabled, both are output
+to \f[B]stdout\f[R].
.PP
\f[B]Note\f[R]: Unlike other dc(1) implementations, this dc(1) will
issue a fatal error (see the \f[B]EXIT STATUS\f[R] section) if it cannot
@@ -233,8 +245,12 @@ queried with the \f[B]W\f[R] command.
generator with the \f[B]\[cq]\f[R] and \f[B]\[dq]\f[R] commands are
guaranteed to \f[B]NOT\f[R] be cryptographically secure.
This is a consequence of using a seeded pseudo-random number generator.
-However, they \f[B]are\f[R] guaranteed to be reproducible with identical
+However, they \f[I]are\f[R] guaranteed to be reproducible with identical
\f[B]seed\f[R] values.
+This means that the pseudo-random values from dc(1) should only be used
+where a reproducible stream of pseudo-random numbers is
+\f[I]ESSENTIAL\f[R].
+In any other case, use a non-seeded pseudo-random number generator.
.PP
The pseudo-random number generator, \f[B]seed\f[R], and all associated
operations are \f[B]non-portable extensions\f[R].
@@ -1020,7 +1036,7 @@ Unlike most other dc(1) implentations, this dc(1) provides nearly
unlimited amounts of registers, if extended register mode is enabled.
.PP
If extended register mode is enabled (\f[B]-x\f[R] or
-\f[B]\[en]extended-register\f[R] command-line arguments are given), then
+\f[B]--extended-register\f[R] command-line arguments are given), then
normal single character registers are used \f[I]unless\f[R] the
character immediately following a command that needs a register name is
a space (according to \f[B]isspace()\f[R]) and not a newline
@@ -1160,7 +1176,7 @@ will be correctly parsed, but the string \f[B]\[lq]/home/gavin/some
The quote parsing will handle either kind of quotes, \f[B]\[cq]\f[R] or
\f[B]\[lq]\f[R]. Thus, if you have a file with any number of single
quotes in the name, you can use double quotes as the outside quotes, as
-in \f[B]\[rq]some `bc' file.bc\[dq]\f[R], and vice versa if you have a
+in \f[B]\[rq]some `dc' file.dc\[dq]\f[R], and vice versa if you have a
file with double quotes.
However, handling a file with both kinds of quotes in
\f[B]DC_ENV_ARGS\f[R] is not supported due to the complexity of the
@@ -1243,17 +1259,17 @@ interactive mode (see the \f[B]INTERACTIVE MODE\f[R] section), since
dc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
more input when one of those errors occurs in interactive mode.
This is also the case when interactive mode is forced by the
-\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
+\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.PP
These exit statuses allow dc(1) to be used in shell scripting with error
checking, and its normal behavior can be forced by using the
-\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
+\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.SH INTERACTIVE MODE
.PP
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both \f[B]stdin\f[R]
and \f[B]stdout\f[R] are hooked to a terminal, but the \f[B]-i\f[R] flag
-and \f[B]\[en]interactive\f[R] option can turn it on in other cases.
+and \f[B]--interactive\f[R] option can turn it on in other cases.
.PP
In interactive mode, dc(1) attempts to recover from errors (see the
\f[B]RESET\f[R] section), and in normal execution, flushes
diff --git a/contrib/bc/manuals/dc/HN.1.md b/contrib/bc/manuals/dc/HN.1.md
index b81a98ffbf4f..005579cd02c8 100644
--- a/contrib/bc/manuals/dc/HN.1.md
+++ b/contrib/bc/manuals/dc/HN.1.md
@@ -2,7 +2,7 @@
SPDX-License-Identifier: BSD-2-Clause
-Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+Copyright (c) 2018-2021 Gavin D. Howard and contributors.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
@@ -34,7 +34,7 @@ dc - arbitrary-precision decimal reverse-Polish notation calculator
# SYNOPSIS
-**dc** [**-hiPvVx**] [**--version**] [**--help**] [**--interactive**] [**--no-prompt**] [**--extended-register**] [**-e** *expr*] [**--expression**=*expr*...] [**-f** *file*...] [**-file**=*file*...] [*file*...]
+**dc** [**-hiPvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@@ -43,11 +43,11 @@ notation) to store numbers and results of computations. Arithmetic operations
pop arguments off of the stack and push the results.
If no files are given on the command-line as extra arguments (i.e., not as
-**-f** or **--file** arguments), then dc(1) reads from **stdin**. Otherwise,
+**-f** or **-\-file** arguments), then dc(1) reads from **stdin**. Otherwise,
those files are processed, and dc(1) will then exit.
This is different from the dc(1) on OpenBSD and possibly other dc(1)
-implementations, where **-e** (**--expression**) and **-f** (**--file**)
+implementations, where **-e** (**-\-expression**) and **-f** (**-\-file**)
arguments cause dc(1) to execute them and exit. The reason for this is that this
dc(1) allows users to set arguments in the environment variable **DC_ENV_ARGS**
(see the **ENVIRONMENT VARIABLES** section). Any expressions given on the
@@ -64,21 +64,21 @@ as the last command-line argument or define the environment variable
The following are the options that dc(1) accepts.
-**-h**, **--help**
+**-h**, **-\-help**
: Prints a usage message and quits.
-**-v**, **-V**, **--version**
+**-v**, **-V**, **-\-version**
: Print the version information (copyright header) and exit.
-**-i**, **--interactive**
+**-i**, **-\-interactive**
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
This is a **non-portable extension**.
-**-P**, **--no-prompt**
+**-P**, **-\-no-prompt**
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
See the **TTY MODE** section) This is mostly for those users that do not
@@ -87,35 +87,42 @@ The following are the options that dc(1) accepts.
This is a **non-portable extension**.
-**-x** **--extended-register**
+**-x** **-\-extended-register**
: Enables extended register mode. See the *Extended Register Mode* subsection
of the **REGISTERS** section for more information.
This is a **non-portable extension**.
-**-e** *expr*, **--expression**=*expr*
+**-e** *expr*, **-\-expression**=*expr*
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
order. If files are given as well (see below), the expressions and files are
evaluated in the order given. This means that if a file is given before an
expression, the file is read in and evaluated first.
- After processing all expressions and files, dc(1) will exit, unless **-**
- (**stdin**) was given as an argument at least once to **-f** or **--file**.
+ If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
+ see the **ENVIRONMENT VARIABLES** section), then after processing all
+ expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
+ as an argument at least once to **-f** or **-\-file**, whether on the
+ command-line or in **DC_ENV_ARGS**. However, if any other **-e**,
+ **-\-expression**, **-f**, or **-\-file** arguments are given after **-f-**
+ or equivalent is given, dc(1) will give a fatal error and exit.
This is a **non-portable extension**.
-**-f** *file*, **--file**=*file*
+**-f** *file*, **-\-file**=*file*
: Reads in *file* and evaluates it, line by line, as though it were read
through **stdin**. If expressions are also given (see above), the
expressions are evaluated in the order given.
- After processing all expressions and files, dc(1) will exit, unless **-**
- (**stdin**) was given as an argument at least once to **-f** or **--file**.
- However, if any other **-e**, **--expression**, **-f**, or **--file**
- arguments are given after that, bc(1) will give a fatal error and exit.
+ If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
+ see the **ENVIRONMENT VARIABLES** section), then after processing all
+ expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
+ as an argument at least once to **-f** or **-\-file**. However, if any other
+ **-e**, **-\-expression**, **-f**, or **-\-file** arguments are given after
+ **-f-** or equivalent is given, dc(1) will give a fatal error and exit.
This is a **non-portable extension**.
@@ -123,7 +130,9 @@ All long options are **non-portable extensions**.
# STDOUT
-Any non-error output is written to **stdout**.
+Any non-error output is written to **stdout**. In addition, if history (see the
+**HISTORY** section) and the prompt (see the **TTY MODE** section) are enabled,
+both are output to **stdout**.
**Note**: Unlike other dc(1) implementations, this dc(1) will issue a fatal
error (see the **EXIT STATUS** section) if it cannot write to **stdout**, so if
@@ -197,7 +206,10 @@ command or the **"** command that does not get receive a value of **0** or
**Note**: The values returned by the pseudo-random number generator with the
**'** and **"** commands are guaranteed to **NOT** be cryptographically secure.
This is a consequence of using a seeded pseudo-random number generator. However,
-they **are** guaranteed to be reproducible with identical **seed** values.
+they *are* guaranteed to be reproducible with identical **seed** values. This
+means that the pseudo-random values from dc(1) should only be used where a
+reproducible stream of pseudo-random numbers is *ESSENTIAL*. In any other case,
+use a non-seeded pseudo-random number generator.
The pseudo-random number generator, **seed**, and all associated operations are
**non-portable extensions**.
@@ -897,7 +909,7 @@ follows any command that needs a register name. The only exception is a newline
Unlike most other dc(1) implentations, this dc(1) provides nearly unlimited
amounts of registers, if extended register mode is enabled.
-If extended register mode is enabled (**-x** or **--extended-register**
+If extended register mode is enabled (**-x** or **-\-extended-register**
command-line arguments are given), then normal single character registers are
used *unless* the character immediately following a command that needs a
register name is a space (according to **isspace()**) and not a newline
@@ -1030,7 +1042,7 @@ dc(1) recognizes the following environment variables:
The quote parsing will handle either kind of quotes, **'** or **"**. Thus,
if you have a file with any number of single quotes in the name, you can use
- double quotes as the outside quotes, as in **"some 'bc' file.bc"**, and vice
+ double quotes as the outside quotes, as in **"some 'dc' file.dc"**, and vice
versa if you have a file with double quotes. However, handling a file with
both kinds of quotes in **DC_ENV_ARGS** is not supported due to the
complexity of the parsing, though such files are still supported on the
@@ -1106,17 +1118,17 @@ The other statuses will only be returned when dc(1) is not in interactive mode
(see the **INTERACTIVE MODE** section), since dc(1) resets its state (see the
**RESET** section) and accepts more input when one of those errors occurs in
interactive mode. This is also the case when interactive mode is forced by the
-**-i** flag or **--interactive** option.
+**-i** flag or **-\-interactive** option.
These exit statuses allow dc(1) to be used in shell scripting with error
checking, and its normal behavior can be forced by using the **-i** flag or
-**--interactive** option.
+**-\-interactive** option.
# INTERACTIVE MODE
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both **stdin** and **stdout**
-are hooked to a terminal, but the **-i** flag and **--interactive** option can
+are hooked to a terminal, but the **-i** flag and **-\-interactive** option can
turn it on in other cases.
In interactive mode, dc(1) attempts to recover from errors (see the **RESET**
diff --git a/contrib/bc/manuals/dc/HNP.1 b/contrib/bc/manuals/dc/HNP.1
index a777eaa81074..7eb4b8b19f3d 100644
--- a/contrib/bc/manuals/dc/HNP.1
+++ b/contrib/bc/manuals/dc/HNP.1
@@ -1,7 +1,7 @@
.\"
.\" SPDX-License-Identifier: BSD-2-Clause
.\"
-.\" Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+.\" Copyright (c) 2018-2021 Gavin D. Howard and contributors.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions are met:
@@ -25,18 +25,17 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.TH "DC" "1" "October 2020" "Gavin D. Howard" "General Commands Manual"
+.TH "DC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
.SH Name
.PP
dc - arbitrary-precision decimal reverse-Polish notation calculator
.SH SYNOPSIS
.PP
-\f[B]dc\f[R] [\f[B]-hiPvVx\f[R]] [\f[B]\[en]version\f[R]]
-[\f[B]\[en]help\f[R]] [\f[B]\[en]interactive\f[R]]
-[\f[B]\[en]no-prompt\f[R]] [\f[B]\[en]extended-register\f[R]]
-[\f[B]-e\f[R] \f[I]expr\f[R]]
-[\f[B]\[en]expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
-\f[I]file\f[R]\&...] [\f[B]-file\f[R]=\f[I]file\f[R]\&...]
+\f[B]dc\f[R] [\f[B]-hiPvVx\f[R]] [\f[B]--version\f[R]]
+[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--no-prompt\f[R]]
+[\f[B]--extended-register\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
+[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
+\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
[\f[I]file\f[R]\&...]
.SH DESCRIPTION
.PP
@@ -47,13 +46,13 @@ Arithmetic operations pop arguments off of the stack and push the
results.
.PP
If no files are given on the command-line as extra arguments (i.e., not
-as \f[B]-f\f[R] or \f[B]\[en]file\f[R] arguments), then dc(1) reads from
+as \f[B]-f\f[R] or \f[B]--file\f[R] arguments), then dc(1) reads from
\f[B]stdin\f[R].
Otherwise, those files are processed, and dc(1) will then exit.
.PP
This is different from the dc(1) on OpenBSD and possibly other dc(1)
-implementations, where \f[B]-e\f[R] (\f[B]\[en]expression\f[R]) and
-\f[B]-f\f[R] (\f[B]\[en]file\f[R]) arguments cause dc(1) to execute them
+implementations, where \f[B]-e\f[R] (\f[B]--expression\f[R]) and
+\f[B]-f\f[R] (\f[B]--file\f[R]) arguments cause dc(1) to execute them
and exit.
The reason for this is that this dc(1) allows users to set arguments in
the environment variable \f[B]DC_ENV_ARGS\f[R] (see the \f[B]ENVIRONMENT
@@ -72,13 +71,13 @@ argument or define the environment variable \f[B]DC_EXPR_EXIT\f[R].
.PP
The following are the options that dc(1) accepts.
.TP
-\f[B]-h\f[R], \f[B]\[en]help\f[R]
+\f[B]-h\f[R], \f[B]--help\f[R]
Prints a usage message and quits.
.TP
-\f[B]-v\f[R], \f[B]-V\f[R], \f[B]\[en]version\f[R]
+\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
Print the version information (copyright header) and exit.
.TP
-\f[B]-i\f[R], \f[B]\[en]interactive\f[R]
+\f[B]-i\f[R], \f[B]--interactive\f[R]
Forces interactive mode.
(See the \f[B]INTERACTIVE MODE\f[R] section.)
.RS
@@ -86,14 +85,14 @@ Forces interactive mode.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-P\f[R], \f[B]\[en]no-prompt\f[R]
+\f[B]-P\f[R], \f[B]--no-prompt\f[R]
This option is a no-op.
.RS
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-x\f[R] \f[B]\[en]extended-register\f[R]
+\f[B]-x\f[R] \f[B]--extended-register\f[R]
Enables extended register mode.
See the \f[I]Extended Register Mode\f[R] subsection of the
\f[B]REGISTERS\f[R] section for more information.
@@ -102,7 +101,7 @@ See the \f[I]Extended Register Mode\f[R] subsection of the
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-e\f[R] \f[I]expr\f[R], \f[B]\[en]expression\f[R]=\f[I]expr\f[R]
+\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
Evaluates \f[I]expr\f[R].
If multiple expressions are given, they are evaluated in order.
If files are given as well (see below), the expressions and files are
@@ -111,26 +110,36 @@ This means that if a file is given before an expression, the file is
read in and evaluated first.
.RS
.PP
-After processing all expressions and files, dc(1) will exit, unless
+If this option is given on the command-line (i.e., not in
+\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
+then after processing all expressions and files, dc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]\[en]file\f[R].
+\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
+\f[B]DC_ENV_ARGS\f[R].
+However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
+\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
+\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
+exit.
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-f\f[R] \f[I]file\f[R], \f[B]\[en]file\f[R]=\f[I]file\f[R]
+\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
were read through \f[B]stdin\f[R].
If expressions are also given (see above), the expressions are evaluated
in the order given.
.RS
.PP
-After processing all expressions and files, dc(1) will exit, unless
+If this option is given on the command-line (i.e., not in
+\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
+then after processing all expressions and files, dc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]\[en]file\f[R].
-However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
-\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after that,
-bc(1) will give a fatal error and exit.
+\f[B]-f\f[R] or \f[B]--file\f[R].
+However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
+\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
+\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
+exit.
.PP
This is a \f[B]non-portable extension\f[R].
.RE
@@ -139,6 +148,9 @@ All long options are \f[B]non-portable extensions\f[R].
.SH STDOUT
.PP
Any non-error output is written to \f[B]stdout\f[R].
+In addition, if history (see the \f[B]HISTORY\f[R] section) and the
+prompt (see the \f[B]TTY MODE\f[R] section) are enabled, both are output
+to \f[B]stdout\f[R].
.PP
\f[B]Note\f[R]: Unlike other dc(1) implementations, this dc(1) will
issue a fatal error (see the \f[B]EXIT STATUS\f[R] section) if it cannot
@@ -228,8 +240,12 @@ queried with the \f[B]W\f[R] command.
generator with the \f[B]\[cq]\f[R] and \f[B]\[dq]\f[R] commands are
guaranteed to \f[B]NOT\f[R] be cryptographically secure.
This is a consequence of using a seeded pseudo-random number generator.
-However, they \f[B]are\f[R] guaranteed to be reproducible with identical
+However, they \f[I]are\f[R] guaranteed to be reproducible with identical
\f[B]seed\f[R] values.
+This means that the pseudo-random values from dc(1) should only be used
+where a reproducible stream of pseudo-random numbers is
+\f[I]ESSENTIAL\f[R].
+In any other case, use a non-seeded pseudo-random number generator.
.PP
The pseudo-random number generator, \f[B]seed\f[R], and all associated
operations are \f[B]non-portable extensions\f[R].
@@ -1015,7 +1031,7 @@ Unlike most other dc(1) implentations, this dc(1) provides nearly
unlimited amounts of registers, if extended register mode is enabled.
.PP
If extended register mode is enabled (\f[B]-x\f[R] or
-\f[B]\[en]extended-register\f[R] command-line arguments are given), then
+\f[B]--extended-register\f[R] command-line arguments are given), then
normal single character registers are used \f[I]unless\f[R] the
character immediately following a command that needs a register name is
a space (according to \f[B]isspace()\f[R]) and not a newline
@@ -1155,7 +1171,7 @@ will be correctly parsed, but the string \f[B]\[lq]/home/gavin/some
The quote parsing will handle either kind of quotes, \f[B]\[cq]\f[R] or
\f[B]\[lq]\f[R]. Thus, if you have a file with any number of single
quotes in the name, you can use double quotes as the outside quotes, as
-in \f[B]\[rq]some `bc' file.bc\[dq]\f[R], and vice versa if you have a
+in \f[B]\[rq]some `dc' file.dc\[dq]\f[R], and vice versa if you have a
file with double quotes.
However, handling a file with both kinds of quotes in
\f[B]DC_ENV_ARGS\f[R] is not supported due to the complexity of the
@@ -1238,17 +1254,17 @@ interactive mode (see the \f[B]INTERACTIVE MODE\f[R] section), since
dc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
more input when one of those errors occurs in interactive mode.
This is also the case when interactive mode is forced by the
-\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
+\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.PP
These exit statuses allow dc(1) to be used in shell scripting with error
checking, and its normal behavior can be forced by using the
-\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
+\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.SH INTERACTIVE MODE
.PP
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both \f[B]stdin\f[R]
and \f[B]stdout\f[R] are hooked to a terminal, but the \f[B]-i\f[R] flag
-and \f[B]\[en]interactive\f[R] option can turn it on in other cases.
+and \f[B]--interactive\f[R] option can turn it on in other cases.
.PP
In interactive mode, dc(1) attempts to recover from errors (see the
\f[B]RESET\f[R] section), and in normal execution, flushes
diff --git a/contrib/bc/manuals/dc/HNP.1.md b/contrib/bc/manuals/dc/HNP.1.md
index c4431fd7a4b2..d099d6f9cdcf 100644
--- a/contrib/bc/manuals/dc/HNP.1.md
+++ b/contrib/bc/manuals/dc/HNP.1.md
@@ -2,7 +2,7 @@
SPDX-License-Identifier: BSD-2-Clause
-Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+Copyright (c) 2018-2021 Gavin D. Howard and contributors.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
@@ -34,7 +34,7 @@ dc - arbitrary-precision decimal reverse-Polish notation calculator
# SYNOPSIS
-**dc** [**-hiPvVx**] [**--version**] [**--help**] [**--interactive**] [**--no-prompt**] [**--extended-register**] [**-e** *expr*] [**--expression**=*expr*...] [**-f** *file*...] [**-file**=*file*...] [*file*...]
+**dc** [**-hiPvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@@ -43,11 +43,11 @@ notation) to store numbers and results of computations. Arithmetic operations
pop arguments off of the stack and push the results.
If no files are given on the command-line as extra arguments (i.e., not as
-**-f** or **--file** arguments), then dc(1) reads from **stdin**. Otherwise,
+**-f** or **-\-file** arguments), then dc(1) reads from **stdin**. Otherwise,
those files are processed, and dc(1) will then exit.
This is different from the dc(1) on OpenBSD and possibly other dc(1)
-implementations, where **-e** (**--expression**) and **-f** (**--file**)
+implementations, where **-e** (**-\-expression**) and **-f** (**-\-file**)
arguments cause dc(1) to execute them and exit. The reason for this is that this
dc(1) allows users to set arguments in the environment variable **DC_ENV_ARGS**
(see the **ENVIRONMENT VARIABLES** section). Any expressions given on the
@@ -64,55 +64,62 @@ as the last command-line argument or define the environment variable
The following are the options that dc(1) accepts.
-**-h**, **--help**
+**-h**, **-\-help**
: Prints a usage message and quits.
-**-v**, **-V**, **--version**
+**-v**, **-V**, **-\-version**
: Print the version information (copyright header) and exit.
-**-i**, **--interactive**
+**-i**, **-\-interactive**
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
This is a **non-portable extension**.
-**-P**, **--no-prompt**
+**-P**, **-\-no-prompt**
: This option is a no-op.
This is a **non-portable extension**.
-**-x** **--extended-register**
+**-x** **-\-extended-register**
: Enables extended register mode. See the *Extended Register Mode* subsection
of the **REGISTERS** section for more information.
This is a **non-portable extension**.
-**-e** *expr*, **--expression**=*expr*
+**-e** *expr*, **-\-expression**=*expr*
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
order. If files are given as well (see below), the expressions and files are
evaluated in the order given. This means that if a file is given before an
expression, the file is read in and evaluated first.
- After processing all expressions and files, dc(1) will exit, unless **-**
- (**stdin**) was given as an argument at least once to **-f** or **--file**.
+ If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
+ see the **ENVIRONMENT VARIABLES** section), then after processing all
+ expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
+ as an argument at least once to **-f** or **-\-file**, whether on the
+ command-line or in **DC_ENV_ARGS**. However, if any other **-e**,
+ **-\-expression**, **-f**, or **-\-file** arguments are given after **-f-**
+ or equivalent is given, dc(1) will give a fatal error and exit.
This is a **non-portable extension**.
-**-f** *file*, **--file**=*file*
+**-f** *file*, **-\-file**=*file*
: Reads in *file* and evaluates it, line by line, as though it were read
through **stdin**. If expressions are also given (see above), the
expressions are evaluated in the order given.
- After processing all expressions and files, dc(1) will exit, unless **-**
- (**stdin**) was given as an argument at least once to **-f** or **--file**.
- However, if any other **-e**, **--expression**, **-f**, or **--file**
- arguments are given after that, bc(1) will give a fatal error and exit.
+ If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
+ see the **ENVIRONMENT VARIABLES** section), then after processing all
+ expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
+ as an argument at least once to **-f** or **-\-file**. However, if any other
+ **-e**, **-\-expression**, **-f**, or **-\-file** arguments are given after
+ **-f-** or equivalent is given, dc(1) will give a fatal error and exit.
This is a **non-portable extension**.
@@ -120,7 +127,9 @@ All long options are **non-portable extensions**.
# STDOUT
-Any non-error output is written to **stdout**.
+Any non-error output is written to **stdout**. In addition, if history (see the
+**HISTORY** section) and the prompt (see the **TTY MODE** section) are enabled,
+both are output to **stdout**.
**Note**: Unlike other dc(1) implementations, this dc(1) will issue a fatal
error (see the **EXIT STATUS** section) if it cannot write to **stdout**, so if
@@ -194,7 +203,10 @@ command or the **"** command that does not get receive a value of **0** or
**Note**: The values returned by the pseudo-random number generator with the
**'** and **"** commands are guaranteed to **NOT** be cryptographically secure.
This is a consequence of using a seeded pseudo-random number generator. However,
-they **are** guaranteed to be reproducible with identical **seed** values.
+they *are* guaranteed to be reproducible with identical **seed** values. This
+means that the pseudo-random values from dc(1) should only be used where a
+reproducible stream of pseudo-random numbers is *ESSENTIAL*. In any other case,
+use a non-seeded pseudo-random number generator.
The pseudo-random number generator, **seed**, and all associated operations are
**non-portable extensions**.
@@ -894,7 +906,7 @@ follows any command that needs a register name. The only exception is a newline
Unlike most other dc(1) implentations, this dc(1) provides nearly unlimited
amounts of registers, if extended register mode is enabled.
-If extended register mode is enabled (**-x** or **--extended-register**
+If extended register mode is enabled (**-x** or **-\-extended-register**
command-line arguments are given), then normal single character registers are
used *unless* the character immediately following a command that needs a
register name is a space (according to **isspace()**) and not a newline
@@ -1027,7 +1039,7 @@ dc(1) recognizes the following environment variables:
The quote parsing will handle either kind of quotes, **'** or **"**. Thus,
if you have a file with any number of single quotes in the name, you can use
- double quotes as the outside quotes, as in **"some 'bc' file.bc"**, and vice
+ double quotes as the outside quotes, as in **"some 'dc' file.dc"**, and vice
versa if you have a file with double quotes. However, handling a file with
both kinds of quotes in **DC_ENV_ARGS** is not supported due to the
complexity of the parsing, though such files are still supported on the
@@ -1103,17 +1115,17 @@ The other statuses will only be returned when dc(1) is not in interactive mode
(see the **INTERACTIVE MODE** section), since dc(1) resets its state (see the
**RESET** section) and accepts more input when one of those errors occurs in
interactive mode. This is also the case when interactive mode is forced by the
-**-i** flag or **--interactive** option.
+**-i** flag or **-\-interactive** option.
These exit statuses allow dc(1) to be used in shell scripting with error
checking, and its normal behavior can be forced by using the **-i** flag or
-**--interactive** option.
+**-\-interactive** option.
# INTERACTIVE MODE
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both **stdin** and **stdout**
-are hooked to a terminal, but the **-i** flag and **--interactive** option can
+are hooked to a terminal, but the **-i** flag and **-\-interactive** option can
turn it on in other cases.
In interactive mode, dc(1) attempts to recover from errors (see the **RESET**
diff --git a/contrib/bc/manuals/dc/HP.1 b/contrib/bc/manuals/dc/HP.1
index 872e6ef3e40b..cea646c8a3f3 100644
--- a/contrib/bc/manuals/dc/HP.1
+++ b/contrib/bc/manuals/dc/HP.1
@@ -1,7 +1,7 @@
.\"
.\" SPDX-License-Identifier: BSD-2-Clause
.\"
-.\" Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+.\" Copyright (c) 2018-2021 Gavin D. Howard and contributors.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions are met:
@@ -25,18 +25,17 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.TH "DC" "1" "October 2020" "Gavin D. Howard" "General Commands Manual"
+.TH "DC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
.SH Name
.PP
dc - arbitrary-precision decimal reverse-Polish notation calculator
.SH SYNOPSIS
.PP
-\f[B]dc\f[R] [\f[B]-hiPvVx\f[R]] [\f[B]\[en]version\f[R]]
-[\f[B]\[en]help\f[R]] [\f[B]\[en]interactive\f[R]]
-[\f[B]\[en]no-prompt\f[R]] [\f[B]\[en]extended-register\f[R]]
-[\f[B]-e\f[R] \f[I]expr\f[R]]
-[\f[B]\[en]expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
-\f[I]file\f[R]\&...] [\f[B]-file\f[R]=\f[I]file\f[R]\&...]
+\f[B]dc\f[R] [\f[B]-hiPvVx\f[R]] [\f[B]--version\f[R]]
+[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--no-prompt\f[R]]
+[\f[B]--extended-register\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
+[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
+\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
[\f[I]file\f[R]\&...]
.SH DESCRIPTION
.PP
@@ -47,13 +46,13 @@ Arithmetic operations pop arguments off of the stack and push the
results.
.PP
If no files are given on the command-line as extra arguments (i.e., not
-as \f[B]-f\f[R] or \f[B]\[en]file\f[R] arguments), then dc(1) reads from
+as \f[B]-f\f[R] or \f[B]--file\f[R] arguments), then dc(1) reads from
\f[B]stdin\f[R].
Otherwise, those files are processed, and dc(1) will then exit.
.PP
This is different from the dc(1) on OpenBSD and possibly other dc(1)
-implementations, where \f[B]-e\f[R] (\f[B]\[en]expression\f[R]) and
-\f[B]-f\f[R] (\f[B]\[en]file\f[R]) arguments cause dc(1) to execute them
+implementations, where \f[B]-e\f[R] (\f[B]--expression\f[R]) and
+\f[B]-f\f[R] (\f[B]--file\f[R]) arguments cause dc(1) to execute them
and exit.
The reason for this is that this dc(1) allows users to set arguments in
the environment variable \f[B]DC_ENV_ARGS\f[R] (see the \f[B]ENVIRONMENT
@@ -72,13 +71,13 @@ argument or define the environment variable \f[B]DC_EXPR_EXIT\f[R].
.PP
The following are the options that dc(1) accepts.
.TP
-\f[B]-h\f[R], \f[B]\[en]help\f[R]
+\f[B]-h\f[R], \f[B]--help\f[R]
Prints a usage message and quits.
.TP
-\f[B]-v\f[R], \f[B]-V\f[R], \f[B]\[en]version\f[R]
+\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
Print the version information (copyright header) and exit.
.TP
-\f[B]-i\f[R], \f[B]\[en]interactive\f[R]
+\f[B]-i\f[R], \f[B]--interactive\f[R]
Forces interactive mode.
(See the \f[B]INTERACTIVE MODE\f[R] section.)
.RS
@@ -86,14 +85,14 @@ Forces interactive mode.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-P\f[R], \f[B]\[en]no-prompt\f[R]
+\f[B]-P\f[R], \f[B]--no-prompt\f[R]
This option is a no-op.
.RS
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-x\f[R] \f[B]\[en]extended-register\f[R]
+\f[B]-x\f[R] \f[B]--extended-register\f[R]
Enables extended register mode.
See the \f[I]Extended Register Mode\f[R] subsection of the
\f[B]REGISTERS\f[R] section for more information.
@@ -102,7 +101,7 @@ See the \f[I]Extended Register Mode\f[R] subsection of the
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-e\f[R] \f[I]expr\f[R], \f[B]\[en]expression\f[R]=\f[I]expr\f[R]
+\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
Evaluates \f[I]expr\f[R].
If multiple expressions are given, they are evaluated in order.
If files are given as well (see below), the expressions and files are
@@ -111,26 +110,36 @@ This means that if a file is given before an expression, the file is
read in and evaluated first.
.RS
.PP
-After processing all expressions and files, dc(1) will exit, unless
+If this option is given on the command-line (i.e., not in
+\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
+then after processing all expressions and files, dc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]\[en]file\f[R].
+\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
+\f[B]DC_ENV_ARGS\f[R].
+However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
+\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
+\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
+exit.
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-f\f[R] \f[I]file\f[R], \f[B]\[en]file\f[R]=\f[I]file\f[R]
+\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
were read through \f[B]stdin\f[R].
If expressions are also given (see above), the expressions are evaluated
in the order given.
.RS
.PP
-After processing all expressions and files, dc(1) will exit, unless
+If this option is given on the command-line (i.e., not in
+\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
+then after processing all expressions and files, dc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]\[en]file\f[R].
-However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
-\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after that,
-bc(1) will give a fatal error and exit.
+\f[B]-f\f[R] or \f[B]--file\f[R].
+However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
+\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
+\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
+exit.
.PP
This is a \f[B]non-portable extension\f[R].
.RE
@@ -139,6 +148,9 @@ All long options are \f[B]non-portable extensions\f[R].
.SH STDOUT
.PP
Any non-error output is written to \f[B]stdout\f[R].
+In addition, if history (see the \f[B]HISTORY\f[R] section) and the
+prompt (see the \f[B]TTY MODE\f[R] section) are enabled, both are output
+to \f[B]stdout\f[R].
.PP
\f[B]Note\f[R]: Unlike other dc(1) implementations, this dc(1) will
issue a fatal error (see the \f[B]EXIT STATUS\f[R] section) if it cannot
@@ -228,8 +240,12 @@ queried with the \f[B]W\f[R] command.
generator with the \f[B]\[cq]\f[R] and \f[B]\[dq]\f[R] commands are
guaranteed to \f[B]NOT\f[R] be cryptographically secure.
This is a consequence of using a seeded pseudo-random number generator.
-However, they \f[B]are\f[R] guaranteed to be reproducible with identical
+However, they \f[I]are\f[R] guaranteed to be reproducible with identical
\f[B]seed\f[R] values.
+This means that the pseudo-random values from dc(1) should only be used
+where a reproducible stream of pseudo-random numbers is
+\f[I]ESSENTIAL\f[R].
+In any other case, use a non-seeded pseudo-random number generator.
.PP
The pseudo-random number generator, \f[B]seed\f[R], and all associated
operations are \f[B]non-portable extensions\f[R].
@@ -1015,7 +1031,7 @@ Unlike most other dc(1) implentations, this dc(1) provides nearly
unlimited amounts of registers, if extended register mode is enabled.
.PP
If extended register mode is enabled (\f[B]-x\f[R] or
-\f[B]\[en]extended-register\f[R] command-line arguments are given), then
+\f[B]--extended-register\f[R] command-line arguments are given), then
normal single character registers are used \f[I]unless\f[R] the
character immediately following a command that needs a register name is
a space (according to \f[B]isspace()\f[R]) and not a newline
@@ -1155,7 +1171,7 @@ will be correctly parsed, but the string \f[B]\[lq]/home/gavin/some
The quote parsing will handle either kind of quotes, \f[B]\[cq]\f[R] or
\f[B]\[lq]\f[R]. Thus, if you have a file with any number of single
quotes in the name, you can use double quotes as the outside quotes, as
-in \f[B]\[rq]some `bc' file.bc\[dq]\f[R], and vice versa if you have a
+in \f[B]\[rq]some `dc' file.dc\[dq]\f[R], and vice versa if you have a
file with double quotes.
However, handling a file with both kinds of quotes in
\f[B]DC_ENV_ARGS\f[R] is not supported due to the complexity of the
@@ -1238,17 +1254,17 @@ interactive mode (see the \f[B]INTERACTIVE MODE\f[R] section), since
dc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
more input when one of those errors occurs in interactive mode.
This is also the case when interactive mode is forced by the
-\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
+\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.PP
These exit statuses allow dc(1) to be used in shell scripting with error
checking, and its normal behavior can be forced by using the
-\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
+\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.SH INTERACTIVE MODE
.PP
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both \f[B]stdin\f[R]
and \f[B]stdout\f[R] are hooked to a terminal, but the \f[B]-i\f[R] flag
-and \f[B]\[en]interactive\f[R] option can turn it on in other cases.
+and \f[B]--interactive\f[R] option can turn it on in other cases.
.PP
In interactive mode, dc(1) attempts to recover from errors (see the
\f[B]RESET\f[R] section), and in normal execution, flushes
diff --git a/contrib/bc/manuals/dc/HP.1.md b/contrib/bc/manuals/dc/HP.1.md
index ffc61e93247b..93938790f460 100644
--- a/contrib/bc/manuals/dc/HP.1.md
+++ b/contrib/bc/manuals/dc/HP.1.md
@@ -2,7 +2,7 @@
SPDX-License-Identifier: BSD-2-Clause
-Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+Copyright (c) 2018-2021 Gavin D. Howard and contributors.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
@@ -34,7 +34,7 @@ dc - arbitrary-precision decimal reverse-Polish notation calculator
# SYNOPSIS
-**dc** [**-hiPvVx**] [**--version**] [**--help**] [**--interactive**] [**--no-prompt**] [**--extended-register**] [**-e** *expr*] [**--expression**=*expr*...] [**-f** *file*...] [**-file**=*file*...] [*file*...]
+**dc** [**-hiPvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@@ -43,11 +43,11 @@ notation) to store numbers and results of computations. Arithmetic operations
pop arguments off of the stack and push the results.
If no files are given on the command-line as extra arguments (i.e., not as
-**-f** or **--file** arguments), then dc(1) reads from **stdin**. Otherwise,
+**-f** or **-\-file** arguments), then dc(1) reads from **stdin**. Otherwise,
those files are processed, and dc(1) will then exit.
This is different from the dc(1) on OpenBSD and possibly other dc(1)
-implementations, where **-e** (**--expression**) and **-f** (**--file**)
+implementations, where **-e** (**-\-expression**) and **-f** (**-\-file**)
arguments cause dc(1) to execute them and exit. The reason for this is that this
dc(1) allows users to set arguments in the environment variable **DC_ENV_ARGS**
(see the **ENVIRONMENT VARIABLES** section). Any expressions given on the
@@ -64,55 +64,62 @@ as the last command-line argument or define the environment variable
The following are the options that dc(1) accepts.
-**-h**, **--help**
+**-h**, **-\-help**
: Prints a usage message and quits.
-**-v**, **-V**, **--version**
+**-v**, **-V**, **-\-version**
: Print the version information (copyright header) and exit.
-**-i**, **--interactive**
+**-i**, **-\-interactive**
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
This is a **non-portable extension**.
-**-P**, **--no-prompt**
+**-P**, **-\-no-prompt**
: This option is a no-op.
This is a **non-portable extension**.
-**-x** **--extended-register**
+**-x** **-\-extended-register**
: Enables extended register mode. See the *Extended Register Mode* subsection
of the **REGISTERS** section for more information.
This is a **non-portable extension**.
-**-e** *expr*, **--expression**=*expr*
+**-e** *expr*, **-\-expression**=*expr*
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
order. If files are given as well (see below), the expressions and files are
evaluated in the order given. This means that if a file is given before an
expression, the file is read in and evaluated first.
- After processing all expressions and files, dc(1) will exit, unless **-**
- (**stdin**) was given as an argument at least once to **-f** or **--file**.
+ If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
+ see the **ENVIRONMENT VARIABLES** section), then after processing all
+ expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
+ as an argument at least once to **-f** or **-\-file**, whether on the
+ command-line or in **DC_ENV_ARGS**. However, if any other **-e**,
+ **-\-expression**, **-f**, or **-\-file** arguments are given after **-f-**
+ or equivalent is given, dc(1) will give a fatal error and exit.
This is a **non-portable extension**.
-**-f** *file*, **--file**=*file*
+**-f** *file*, **-\-file**=*file*
: Reads in *file* and evaluates it, line by line, as though it were read
through **stdin**. If expressions are also given (see above), the
expressions are evaluated in the order given.
- After processing all expressions and files, dc(1) will exit, unless **-**
- (**stdin**) was given as an argument at least once to **-f** or **--file**.
- However, if any other **-e**, **--expression**, **-f**, or **--file**
- arguments are given after that, bc(1) will give a fatal error and exit.
+ If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
+ see the **ENVIRONMENT VARIABLES** section), then after processing all
+ expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
+ as an argument at least once to **-f** or **-\-file**. However, if any other
+ **-e**, **-\-expression**, **-f**, or **-\-file** arguments are given after
+ **-f-** or equivalent is given, dc(1) will give a fatal error and exit.
This is a **non-portable extension**.
@@ -120,7 +127,9 @@ All long options are **non-portable extensions**.
# STDOUT
-Any non-error output is written to **stdout**.
+Any non-error output is written to **stdout**. In addition, if history (see the
+**HISTORY** section) and the prompt (see the **TTY MODE** section) are enabled,
+both are output to **stdout**.
**Note**: Unlike other dc(1) implementations, this dc(1) will issue a fatal
error (see the **EXIT STATUS** section) if it cannot write to **stdout**, so if
@@ -194,7 +203,10 @@ command or the **"** command that does not get receive a value of **0** or
**Note**: The values returned by the pseudo-random number generator with the
**'** and **"** commands are guaranteed to **NOT** be cryptographically secure.
This is a consequence of using a seeded pseudo-random number generator. However,
-they **are** guaranteed to be reproducible with identical **seed** values.
+they *are* guaranteed to be reproducible with identical **seed** values. This
+means that the pseudo-random values from dc(1) should only be used where a
+reproducible stream of pseudo-random numbers is *ESSENTIAL*. In any other case,
+use a non-seeded pseudo-random number generator.
The pseudo-random number generator, **seed**, and all associated operations are
**non-portable extensions**.
@@ -894,7 +906,7 @@ follows any command that needs a register name. The only exception is a newline
Unlike most other dc(1) implentations, this dc(1) provides nearly unlimited
amounts of registers, if extended register mode is enabled.
-If extended register mode is enabled (**-x** or **--extended-register**
+If extended register mode is enabled (**-x** or **-\-extended-register**
command-line arguments are given), then normal single character registers are
used *unless* the character immediately following a command that needs a
register name is a space (according to **isspace()**) and not a newline
@@ -1027,7 +1039,7 @@ dc(1) recognizes the following environment variables:
The quote parsing will handle either kind of quotes, **'** or **"**. Thus,
if you have a file with any number of single quotes in the name, you can use
- double quotes as the outside quotes, as in **"some 'bc' file.bc"**, and vice
+ double quotes as the outside quotes, as in **"some 'dc' file.dc"**, and vice
versa if you have a file with double quotes. However, handling a file with
both kinds of quotes in **DC_ENV_ARGS** is not supported due to the
complexity of the parsing, though such files are still supported on the
@@ -1103,17 +1115,17 @@ The other statuses will only be returned when dc(1) is not in interactive mode
(see the **INTERACTIVE MODE** section), since dc(1) resets its state (see the
**RESET** section) and accepts more input when one of those errors occurs in
interactive mode. This is also the case when interactive mode is forced by the
-**-i** flag or **--interactive** option.
+**-i** flag or **-\-interactive** option.
These exit statuses allow dc(1) to be used in shell scripting with error
checking, and its normal behavior can be forced by using the **-i** flag or
-**--interactive** option.
+**-\-interactive** option.
# INTERACTIVE MODE
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both **stdin** and **stdout**
-are hooked to a terminal, but the **-i** flag and **--interactive** option can
+are hooked to a terminal, but the **-i** flag and **-\-interactive** option can
turn it on in other cases.
In interactive mode, dc(1) attempts to recover from errors (see the **RESET**
diff --git a/contrib/bc/manuals/dc/N.1 b/contrib/bc/manuals/dc/N.1
index 590d563faa50..6f4f01c48354 100644
--- a/contrib/bc/manuals/dc/N.1
+++ b/contrib/bc/manuals/dc/N.1
@@ -1,7 +1,7 @@
.\"
.\" SPDX-License-Identifier: BSD-2-Clause
.\"
-.\" Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+.\" Copyright (c) 2018-2021 Gavin D. Howard and contributors.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions are met:
@@ -25,18 +25,17 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.TH "DC" "1" "October 2020" "Gavin D. Howard" "General Commands Manual"
+.TH "DC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
.SH Name
.PP
dc - arbitrary-precision decimal reverse-Polish notation calculator
.SH SYNOPSIS
.PP
-\f[B]dc\f[R] [\f[B]-hiPvVx\f[R]] [\f[B]\[en]version\f[R]]
-[\f[B]\[en]help\f[R]] [\f[B]\[en]interactive\f[R]]
-[\f[B]\[en]no-prompt\f[R]] [\f[B]\[en]extended-register\f[R]]
-[\f[B]-e\f[R] \f[I]expr\f[R]]
-[\f[B]\[en]expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
-\f[I]file\f[R]\&...] [\f[B]-file\f[R]=\f[I]file\f[R]\&...]
+\f[B]dc\f[R] [\f[B]-hiPvVx\f[R]] [\f[B]--version\f[R]]
+[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--no-prompt\f[R]]
+[\f[B]--extended-register\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
+[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
+\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
[\f[I]file\f[R]\&...]
.SH DESCRIPTION
.PP
@@ -47,13 +46,13 @@ Arithmetic operations pop arguments off of the stack and push the
results.
.PP
If no files are given on the command-line as extra arguments (i.e., not
-as \f[B]-f\f[R] or \f[B]\[en]file\f[R] arguments), then dc(1) reads from
+as \f[B]-f\f[R] or \f[B]--file\f[R] arguments), then dc(1) reads from
\f[B]stdin\f[R].
Otherwise, those files are processed, and dc(1) will then exit.
.PP
This is different from the dc(1) on OpenBSD and possibly other dc(1)
-implementations, where \f[B]-e\f[R] (\f[B]\[en]expression\f[R]) and
-\f[B]-f\f[R] (\f[B]\[en]file\f[R]) arguments cause dc(1) to execute them
+implementations, where \f[B]-e\f[R] (\f[B]--expression\f[R]) and
+\f[B]-f\f[R] (\f[B]--file\f[R]) arguments cause dc(1) to execute them
and exit.
The reason for this is that this dc(1) allows users to set arguments in
the environment variable \f[B]DC_ENV_ARGS\f[R] (see the \f[B]ENVIRONMENT
@@ -72,13 +71,13 @@ argument or define the environment variable \f[B]DC_EXPR_EXIT\f[R].
.PP
The following are the options that dc(1) accepts.
.TP
-\f[B]-h\f[R], \f[B]\[en]help\f[R]
+\f[B]-h\f[R], \f[B]--help\f[R]
Prints a usage message and quits.
.TP
-\f[B]-v\f[R], \f[B]-V\f[R], \f[B]\[en]version\f[R]
+\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
Print the version information (copyright header) and exit.
.TP
-\f[B]-i\f[R], \f[B]\[en]interactive\f[R]
+\f[B]-i\f[R], \f[B]--interactive\f[R]
Forces interactive mode.
(See the \f[B]INTERACTIVE MODE\f[R] section.)
.RS
@@ -86,7 +85,7 @@ Forces interactive mode.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-P\f[R], \f[B]\[en]no-prompt\f[R]
+\f[B]-P\f[R], \f[B]--no-prompt\f[R]
Disables the prompt in TTY mode.
(The prompt is only enabled in TTY mode.
See the \f[B]TTY MODE\f[R] section) This is mostly for those users that
@@ -98,7 +97,7 @@ Most of those users would want to put this option in
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-x\f[R] \f[B]\[en]extended-register\f[R]
+\f[B]-x\f[R] \f[B]--extended-register\f[R]
Enables extended register mode.
See the \f[I]Extended Register Mode\f[R] subsection of the
\f[B]REGISTERS\f[R] section for more information.
@@ -107,7 +106,7 @@ See the \f[I]Extended Register Mode\f[R] subsection of the
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-e\f[R] \f[I]expr\f[R], \f[B]\[en]expression\f[R]=\f[I]expr\f[R]
+\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
Evaluates \f[I]expr\f[R].
If multiple expressions are given, they are evaluated in order.
If files are given as well (see below), the expressions and files are
@@ -116,26 +115,36 @@ This means that if a file is given before an expression, the file is
read in and evaluated first.
.RS
.PP
-After processing all expressions and files, dc(1) will exit, unless
+If this option is given on the command-line (i.e., not in
+\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
+then after processing all expressions and files, dc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]\[en]file\f[R].
+\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
+\f[B]DC_ENV_ARGS\f[R].
+However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
+\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
+\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
+exit.
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-f\f[R] \f[I]file\f[R], \f[B]\[en]file\f[R]=\f[I]file\f[R]
+\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
were read through \f[B]stdin\f[R].
If expressions are also given (see above), the expressions are evaluated
in the order given.
.RS
.PP
-After processing all expressions and files, dc(1) will exit, unless
+If this option is given on the command-line (i.e., not in
+\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
+then after processing all expressions and files, dc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]\[en]file\f[R].
-However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
-\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after that,
-bc(1) will give a fatal error and exit.
+\f[B]-f\f[R] or \f[B]--file\f[R].
+However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
+\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
+\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
+exit.
.PP
This is a \f[B]non-portable extension\f[R].
.RE
@@ -144,6 +153,9 @@ All long options are \f[B]non-portable extensions\f[R].
.SH STDOUT
.PP
Any non-error output is written to \f[B]stdout\f[R].
+In addition, if history (see the \f[B]HISTORY\f[R] section) and the
+prompt (see the \f[B]TTY MODE\f[R] section) are enabled, both are output
+to \f[B]stdout\f[R].
.PP
\f[B]Note\f[R]: Unlike other dc(1) implementations, this dc(1) will
issue a fatal error (see the \f[B]EXIT STATUS\f[R] section) if it cannot
@@ -233,8 +245,12 @@ queried with the \f[B]W\f[R] command.
generator with the \f[B]\[cq]\f[R] and \f[B]\[dq]\f[R] commands are
guaranteed to \f[B]NOT\f[R] be cryptographically secure.
This is a consequence of using a seeded pseudo-random number generator.
-However, they \f[B]are\f[R] guaranteed to be reproducible with identical
+However, they \f[I]are\f[R] guaranteed to be reproducible with identical
\f[B]seed\f[R] values.
+This means that the pseudo-random values from dc(1) should only be used
+where a reproducible stream of pseudo-random numbers is
+\f[I]ESSENTIAL\f[R].
+In any other case, use a non-seeded pseudo-random number generator.
.PP
The pseudo-random number generator, \f[B]seed\f[R], and all associated
operations are \f[B]non-portable extensions\f[R].
@@ -1020,7 +1036,7 @@ Unlike most other dc(1) implentations, this dc(1) provides nearly
unlimited amounts of registers, if extended register mode is enabled.
.PP
If extended register mode is enabled (\f[B]-x\f[R] or
-\f[B]\[en]extended-register\f[R] command-line arguments are given), then
+\f[B]--extended-register\f[R] command-line arguments are given), then
normal single character registers are used \f[I]unless\f[R] the
character immediately following a command that needs a register name is
a space (according to \f[B]isspace()\f[R]) and not a newline
@@ -1160,7 +1176,7 @@ will be correctly parsed, but the string \f[B]\[lq]/home/gavin/some
The quote parsing will handle either kind of quotes, \f[B]\[cq]\f[R] or
\f[B]\[lq]\f[R]. Thus, if you have a file with any number of single
quotes in the name, you can use double quotes as the outside quotes, as
-in \f[B]\[rq]some `bc' file.bc\[dq]\f[R], and vice versa if you have a
+in \f[B]\[rq]some `dc' file.dc\[dq]\f[R], and vice versa if you have a
file with double quotes.
However, handling a file with both kinds of quotes in
\f[B]DC_ENV_ARGS\f[R] is not supported due to the complexity of the
@@ -1243,17 +1259,17 @@ interactive mode (see the \f[B]INTERACTIVE MODE\f[R] section), since
dc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
more input when one of those errors occurs in interactive mode.
This is also the case when interactive mode is forced by the
-\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
+\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.PP
These exit statuses allow dc(1) to be used in shell scripting with error
checking, and its normal behavior can be forced by using the
-\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
+\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.SH INTERACTIVE MODE
.PP
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both \f[B]stdin\f[R]
and \f[B]stdout\f[R] are hooked to a terminal, but the \f[B]-i\f[R] flag
-and \f[B]\[en]interactive\f[R] option can turn it on in other cases.
+and \f[B]--interactive\f[R] option can turn it on in other cases.
.PP
In interactive mode, dc(1) attempts to recover from errors (see the
\f[B]RESET\f[R] section), and in normal execution, flushes
diff --git a/contrib/bc/manuals/dc/N.1.md b/contrib/bc/manuals/dc/N.1.md
index ef94824c7a00..43876cfb24a6 100644
--- a/contrib/bc/manuals/dc/N.1.md
+++ b/contrib/bc/manuals/dc/N.1.md
@@ -2,7 +2,7 @@
SPDX-License-Identifier: BSD-2-Clause
-Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+Copyright (c) 2018-2021 Gavin D. Howard and contributors.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
@@ -34,7 +34,7 @@ dc - arbitrary-precision decimal reverse-Polish notation calculator
# SYNOPSIS
-**dc** [**-hiPvVx**] [**--version**] [**--help**] [**--interactive**] [**--no-prompt**] [**--extended-register**] [**-e** *expr*] [**--expression**=*expr*...] [**-f** *file*...] [**-file**=*file*...] [*file*...]
+**dc** [**-hiPvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@@ -43,11 +43,11 @@ notation) to store numbers and results of computations. Arithmetic operations
pop arguments off of the stack and push the results.
If no files are given on the command-line as extra arguments (i.e., not as
-**-f** or **--file** arguments), then dc(1) reads from **stdin**. Otherwise,
+**-f** or **-\-file** arguments), then dc(1) reads from **stdin**. Otherwise,
those files are processed, and dc(1) will then exit.
This is different from the dc(1) on OpenBSD and possibly other dc(1)
-implementations, where **-e** (**--expression**) and **-f** (**--file**)
+implementations, where **-e** (**-\-expression**) and **-f** (**-\-file**)
arguments cause dc(1) to execute them and exit. The reason for this is that this
dc(1) allows users to set arguments in the environment variable **DC_ENV_ARGS**
(see the **ENVIRONMENT VARIABLES** section). Any expressions given on the
@@ -64,21 +64,21 @@ as the last command-line argument or define the environment variable
The following are the options that dc(1) accepts.
-**-h**, **--help**
+**-h**, **-\-help**
: Prints a usage message and quits.
-**-v**, **-V**, **--version**
+**-v**, **-V**, **-\-version**
: Print the version information (copyright header) and exit.
-**-i**, **--interactive**
+**-i**, **-\-interactive**
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
This is a **non-portable extension**.
-**-P**, **--no-prompt**
+**-P**, **-\-no-prompt**
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
See the **TTY MODE** section) This is mostly for those users that do not
@@ -87,35 +87,42 @@ The following are the options that dc(1) accepts.
This is a **non-portable extension**.
-**-x** **--extended-register**
+**-x** **-\-extended-register**
: Enables extended register mode. See the *Extended Register Mode* subsection
of the **REGISTERS** section for more information.
This is a **non-portable extension**.
-**-e** *expr*, **--expression**=*expr*
+**-e** *expr*, **-\-expression**=*expr*
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
order. If files are given as well (see below), the expressions and files are
evaluated in the order given. This means that if a file is given before an
expression, the file is read in and evaluated first.
- After processing all expressions and files, dc(1) will exit, unless **-**
- (**stdin**) was given as an argument at least once to **-f** or **--file**.
+ If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
+ see the **ENVIRONMENT VARIABLES** section), then after processing all
+ expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
+ as an argument at least once to **-f** or **-\-file**, whether on the
+ command-line or in **DC_ENV_ARGS**. However, if any other **-e**,
+ **-\-expression**, **-f**, or **-\-file** arguments are given after **-f-**
+ or equivalent is given, dc(1) will give a fatal error and exit.
This is a **non-portable extension**.
-**-f** *file*, **--file**=*file*
+**-f** *file*, **-\-file**=*file*
: Reads in *file* and evaluates it, line by line, as though it were read
through **stdin**. If expressions are also given (see above), the
expressions are evaluated in the order given.
- After processing all expressions and files, dc(1) will exit, unless **-**
- (**stdin**) was given as an argument at least once to **-f** or **--file**.
- However, if any other **-e**, **--expression**, **-f**, or **--file**
- arguments are given after that, bc(1) will give a fatal error and exit.
+ If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
+ see the **ENVIRONMENT VARIABLES** section), then after processing all
+ expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
+ as an argument at least once to **-f** or **-\-file**. However, if any other
+ **-e**, **-\-expression**, **-f**, or **-\-file** arguments are given after
+ **-f-** or equivalent is given, dc(1) will give a fatal error and exit.
This is a **non-portable extension**.
@@ -123,7 +130,9 @@ All long options are **non-portable extensions**.
# STDOUT
-Any non-error output is written to **stdout**.
+Any non-error output is written to **stdout**. In addition, if history (see the
+**HISTORY** section) and the prompt (see the **TTY MODE** section) are enabled,
+both are output to **stdout**.
**Note**: Unlike other dc(1) implementations, this dc(1) will issue a fatal
error (see the **EXIT STATUS** section) if it cannot write to **stdout**, so if
@@ -197,7 +206,10 @@ command or the **"** command that does not get receive a value of **0** or
**Note**: The values returned by the pseudo-random number generator with the
**'** and **"** commands are guaranteed to **NOT** be cryptographically secure.
This is a consequence of using a seeded pseudo-random number generator. However,
-they **are** guaranteed to be reproducible with identical **seed** values.
+they *are* guaranteed to be reproducible with identical **seed** values. This
+means that the pseudo-random values from dc(1) should only be used where a
+reproducible stream of pseudo-random numbers is *ESSENTIAL*. In any other case,
+use a non-seeded pseudo-random number generator.
The pseudo-random number generator, **seed**, and all associated operations are
**non-portable extensions**.
@@ -897,7 +909,7 @@ follows any command that needs a register name. The only exception is a newline
Unlike most other dc(1) implentations, this dc(1) provides nearly unlimited
amounts of registers, if extended register mode is enabled.
-If extended register mode is enabled (**-x** or **--extended-register**
+If extended register mode is enabled (**-x** or **-\-extended-register**
command-line arguments are given), then normal single character registers are
used *unless* the character immediately following a command that needs a
register name is a space (according to **isspace()**) and not a newline
@@ -1030,7 +1042,7 @@ dc(1) recognizes the following environment variables:
The quote parsing will handle either kind of quotes, **'** or **"**. Thus,
if you have a file with any number of single quotes in the name, you can use
- double quotes as the outside quotes, as in **"some 'bc' file.bc"**, and vice
+ double quotes as the outside quotes, as in **"some 'dc' file.dc"**, and vice
versa if you have a file with double quotes. However, handling a file with
both kinds of quotes in **DC_ENV_ARGS** is not supported due to the
complexity of the parsing, though such files are still supported on the
@@ -1106,17 +1118,17 @@ The other statuses will only be returned when dc(1) is not in interactive mode
(see the **INTERACTIVE MODE** section), since dc(1) resets its state (see the
**RESET** section) and accepts more input when one of those errors occurs in
interactive mode. This is also the case when interactive mode is forced by the
-**-i** flag or **--interactive** option.
+**-i** flag or **-\-interactive** option.
These exit statuses allow dc(1) to be used in shell scripting with error
checking, and its normal behavior can be forced by using the **-i** flag or
-**--interactive** option.
+**-\-interactive** option.
# INTERACTIVE MODE
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both **stdin** and **stdout**
-are hooked to a terminal, but the **-i** flag and **--interactive** option can
+are hooked to a terminal, but the **-i** flag and **-\-interactive** option can
turn it on in other cases.
In interactive mode, dc(1) attempts to recover from errors (see the **RESET**
diff --git a/contrib/bc/manuals/dc/NP.1 b/contrib/bc/manuals/dc/NP.1
index 01c5f1e854f2..ad4a69957c1c 100644
--- a/contrib/bc/manuals/dc/NP.1
+++ b/contrib/bc/manuals/dc/NP.1
@@ -1,7 +1,7 @@
.\"
.\" SPDX-License-Identifier: BSD-2-Clause
.\"
-.\" Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+.\" Copyright (c) 2018-2021 Gavin D. Howard and contributors.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions are met:
@@ -25,18 +25,17 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.TH "DC" "1" "October 2020" "Gavin D. Howard" "General Commands Manual"
+.TH "DC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
.SH Name
.PP
dc - arbitrary-precision decimal reverse-Polish notation calculator
.SH SYNOPSIS
.PP
-\f[B]dc\f[R] [\f[B]-hiPvVx\f[R]] [\f[B]\[en]version\f[R]]
-[\f[B]\[en]help\f[R]] [\f[B]\[en]interactive\f[R]]
-[\f[B]\[en]no-prompt\f[R]] [\f[B]\[en]extended-register\f[R]]
-[\f[B]-e\f[R] \f[I]expr\f[R]]
-[\f[B]\[en]expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
-\f[I]file\f[R]\&...] [\f[B]-file\f[R]=\f[I]file\f[R]\&...]
+\f[B]dc\f[R] [\f[B]-hiPvVx\f[R]] [\f[B]--version\f[R]]
+[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--no-prompt\f[R]]
+[\f[B]--extended-register\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
+[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
+\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
[\f[I]file\f[R]\&...]
.SH DESCRIPTION
.PP
@@ -47,13 +46,13 @@ Arithmetic operations pop arguments off of the stack and push the
results.
.PP
If no files are given on the command-line as extra arguments (i.e., not
-as \f[B]-f\f[R] or \f[B]\[en]file\f[R] arguments), then dc(1) reads from
+as \f[B]-f\f[R] or \f[B]--file\f[R] arguments), then dc(1) reads from
\f[B]stdin\f[R].
Otherwise, those files are processed, and dc(1) will then exit.
.PP
This is different from the dc(1) on OpenBSD and possibly other dc(1)
-implementations, where \f[B]-e\f[R] (\f[B]\[en]expression\f[R]) and
-\f[B]-f\f[R] (\f[B]\[en]file\f[R]) arguments cause dc(1) to execute them
+implementations, where \f[B]-e\f[R] (\f[B]--expression\f[R]) and
+\f[B]-f\f[R] (\f[B]--file\f[R]) arguments cause dc(1) to execute them
and exit.
The reason for this is that this dc(1) allows users to set arguments in
the environment variable \f[B]DC_ENV_ARGS\f[R] (see the \f[B]ENVIRONMENT
@@ -72,13 +71,13 @@ argument or define the environment variable \f[B]DC_EXPR_EXIT\f[R].
.PP
The following are the options that dc(1) accepts.
.TP
-\f[B]-h\f[R], \f[B]\[en]help\f[R]
+\f[B]-h\f[R], \f[B]--help\f[R]
Prints a usage message and quits.
.TP
-\f[B]-v\f[R], \f[B]-V\f[R], \f[B]\[en]version\f[R]
+\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
Print the version information (copyright header) and exit.
.TP
-\f[B]-i\f[R], \f[B]\[en]interactive\f[R]
+\f[B]-i\f[R], \f[B]--interactive\f[R]
Forces interactive mode.
(See the \f[B]INTERACTIVE MODE\f[R] section.)
.RS
@@ -86,14 +85,14 @@ Forces interactive mode.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-P\f[R], \f[B]\[en]no-prompt\f[R]
+\f[B]-P\f[R], \f[B]--no-prompt\f[R]
This option is a no-op.
.RS
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-x\f[R] \f[B]\[en]extended-register\f[R]
+\f[B]-x\f[R] \f[B]--extended-register\f[R]
Enables extended register mode.
See the \f[I]Extended Register Mode\f[R] subsection of the
\f[B]REGISTERS\f[R] section for more information.
@@ -102,7 +101,7 @@ See the \f[I]Extended Register Mode\f[R] subsection of the
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-e\f[R] \f[I]expr\f[R], \f[B]\[en]expression\f[R]=\f[I]expr\f[R]
+\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
Evaluates \f[I]expr\f[R].
If multiple expressions are given, they are evaluated in order.
If files are given as well (see below), the expressions and files are
@@ -111,26 +110,36 @@ This means that if a file is given before an expression, the file is
read in and evaluated first.
.RS
.PP
-After processing all expressions and files, dc(1) will exit, unless
+If this option is given on the command-line (i.e., not in
+\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
+then after processing all expressions and files, dc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]\[en]file\f[R].
+\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
+\f[B]DC_ENV_ARGS\f[R].
+However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
+\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
+\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
+exit.
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-f\f[R] \f[I]file\f[R], \f[B]\[en]file\f[R]=\f[I]file\f[R]
+\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
were read through \f[B]stdin\f[R].
If expressions are also given (see above), the expressions are evaluated
in the order given.
.RS
.PP
-After processing all expressions and files, dc(1) will exit, unless
+If this option is given on the command-line (i.e., not in
+\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
+then after processing all expressions and files, dc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]\[en]file\f[R].
-However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
-\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after that,
-bc(1) will give a fatal error and exit.
+\f[B]-f\f[R] or \f[B]--file\f[R].
+However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
+\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
+\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
+exit.
.PP
This is a \f[B]non-portable extension\f[R].
.RE
@@ -139,6 +148,9 @@ All long options are \f[B]non-portable extensions\f[R].
.SH STDOUT
.PP
Any non-error output is written to \f[B]stdout\f[R].
+In addition, if history (see the \f[B]HISTORY\f[R] section) and the
+prompt (see the \f[B]TTY MODE\f[R] section) are enabled, both are output
+to \f[B]stdout\f[R].
.PP
\f[B]Note\f[R]: Unlike other dc(1) implementations, this dc(1) will
issue a fatal error (see the \f[B]EXIT STATUS\f[R] section) if it cannot
@@ -228,8 +240,12 @@ queried with the \f[B]W\f[R] command.
generator with the \f[B]\[cq]\f[R] and \f[B]\[dq]\f[R] commands are
guaranteed to \f[B]NOT\f[R] be cryptographically secure.
This is a consequence of using a seeded pseudo-random number generator.
-However, they \f[B]are\f[R] guaranteed to be reproducible with identical
+However, they \f[I]are\f[R] guaranteed to be reproducible with identical
\f[B]seed\f[R] values.
+This means that the pseudo-random values from dc(1) should only be used
+where a reproducible stream of pseudo-random numbers is
+\f[I]ESSENTIAL\f[R].
+In any other case, use a non-seeded pseudo-random number generator.
.PP
The pseudo-random number generator, \f[B]seed\f[R], and all associated
operations are \f[B]non-portable extensions\f[R].
@@ -1015,7 +1031,7 @@ Unlike most other dc(1) implentations, this dc(1) provides nearly
unlimited amounts of registers, if extended register mode is enabled.
.PP
If extended register mode is enabled (\f[B]-x\f[R] or
-\f[B]\[en]extended-register\f[R] command-line arguments are given), then
+\f[B]--extended-register\f[R] command-line arguments are given), then
normal single character registers are used \f[I]unless\f[R] the
character immediately following a command that needs a register name is
a space (according to \f[B]isspace()\f[R]) and not a newline
@@ -1155,7 +1171,7 @@ will be correctly parsed, but the string \f[B]\[lq]/home/gavin/some
The quote parsing will handle either kind of quotes, \f[B]\[cq]\f[R] or
\f[B]\[lq]\f[R]. Thus, if you have a file with any number of single
quotes in the name, you can use double quotes as the outside quotes, as
-in \f[B]\[rq]some `bc' file.bc\[dq]\f[R], and vice versa if you have a
+in \f[B]\[rq]some `dc' file.dc\[dq]\f[R], and vice versa if you have a
file with double quotes.
However, handling a file with both kinds of quotes in
\f[B]DC_ENV_ARGS\f[R] is not supported due to the complexity of the
@@ -1238,17 +1254,17 @@ interactive mode (see the \f[B]INTERACTIVE MODE\f[R] section), since
dc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
more input when one of those errors occurs in interactive mode.
This is also the case when interactive mode is forced by the
-\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
+\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.PP
These exit statuses allow dc(1) to be used in shell scripting with error
checking, and its normal behavior can be forced by using the
-\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
+\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.SH INTERACTIVE MODE
.PP
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both \f[B]stdin\f[R]
and \f[B]stdout\f[R] are hooked to a terminal, but the \f[B]-i\f[R] flag
-and \f[B]\[en]interactive\f[R] option can turn it on in other cases.
+and \f[B]--interactive\f[R] option can turn it on in other cases.
.PP
In interactive mode, dc(1) attempts to recover from errors (see the
\f[B]RESET\f[R] section), and in normal execution, flushes
diff --git a/contrib/bc/manuals/dc/NP.1.md b/contrib/bc/manuals/dc/NP.1.md
index e744a40c2474..b1f29d76f06e 100644
--- a/contrib/bc/manuals/dc/NP.1.md
+++ b/contrib/bc/manuals/dc/NP.1.md
@@ -2,7 +2,7 @@
SPDX-License-Identifier: BSD-2-Clause
-Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+Copyright (c) 2018-2021 Gavin D. Howard and contributors.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
@@ -34,7 +34,7 @@ dc - arbitrary-precision decimal reverse-Polish notation calculator
# SYNOPSIS
-**dc** [**-hiPvVx**] [**--version**] [**--help**] [**--interactive**] [**--no-prompt**] [**--extended-register**] [**-e** *expr*] [**--expression**=*expr*...] [**-f** *file*...] [**-file**=*file*...] [*file*...]
+**dc** [**-hiPvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@@ -43,11 +43,11 @@ notation) to store numbers and results of computations. Arithmetic operations
pop arguments off of the stack and push the results.
If no files are given on the command-line as extra arguments (i.e., not as
-**-f** or **--file** arguments), then dc(1) reads from **stdin**. Otherwise,
+**-f** or **-\-file** arguments), then dc(1) reads from **stdin**. Otherwise,
those files are processed, and dc(1) will then exit.
This is different from the dc(1) on OpenBSD and possibly other dc(1)
-implementations, where **-e** (**--expression**) and **-f** (**--file**)
+implementations, where **-e** (**-\-expression**) and **-f** (**-\-file**)
arguments cause dc(1) to execute them and exit. The reason for this is that this
dc(1) allows users to set arguments in the environment variable **DC_ENV_ARGS**
(see the **ENVIRONMENT VARIABLES** section). Any expressions given on the
@@ -64,55 +64,62 @@ as the last command-line argument or define the environment variable
The following are the options that dc(1) accepts.
-**-h**, **--help**
+**-h**, **-\-help**
: Prints a usage message and quits.
-**-v**, **-V**, **--version**
+**-v**, **-V**, **-\-version**
: Print the version information (copyright header) and exit.
-**-i**, **--interactive**
+**-i**, **-\-interactive**
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
This is a **non-portable extension**.
-**-P**, **--no-prompt**
+**-P**, **-\-no-prompt**
: This option is a no-op.
This is a **non-portable extension**.
-**-x** **--extended-register**
+**-x** **-\-extended-register**
: Enables extended register mode. See the *Extended Register Mode* subsection
of the **REGISTERS** section for more information.
This is a **non-portable extension**.
-**-e** *expr*, **--expression**=*expr*
+**-e** *expr*, **-\-expression**=*expr*
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
order. If files are given as well (see below), the expressions and files are
evaluated in the order given. This means that if a file is given before an
expression, the file is read in and evaluated first.
- After processing all expressions and files, dc(1) will exit, unless **-**
- (**stdin**) was given as an argument at least once to **-f** or **--file**.
+ If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
+ see the **ENVIRONMENT VARIABLES** section), then after processing all
+ expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
+ as an argument at least once to **-f** or **-\-file**, whether on the
+ command-line or in **DC_ENV_ARGS**. However, if any other **-e**,
+ **-\-expression**, **-f**, or **-\-file** arguments are given after **-f-**
+ or equivalent is given, dc(1) will give a fatal error and exit.
This is a **non-portable extension**.
-**-f** *file*, **--file**=*file*
+**-f** *file*, **-\-file**=*file*
: Reads in *file* and evaluates it, line by line, as though it were read
through **stdin**. If expressions are also given (see above), the
expressions are evaluated in the order given.
- After processing all expressions and files, dc(1) will exit, unless **-**
- (**stdin**) was given as an argument at least once to **-f** or **--file**.
- However, if any other **-e**, **--expression**, **-f**, or **--file**
- arguments are given after that, bc(1) will give a fatal error and exit.
+ If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
+ see the **ENVIRONMENT VARIABLES** section), then after processing all
+ expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
+ as an argument at least once to **-f** or **-\-file**. However, if any other
+ **-e**, **-\-expression**, **-f**, or **-\-file** arguments are given after
+ **-f-** or equivalent is given, dc(1) will give a fatal error and exit.
This is a **non-portable extension**.
@@ -120,7 +127,9 @@ All long options are **non-portable extensions**.
# STDOUT
-Any non-error output is written to **stdout**.
+Any non-error output is written to **stdout**. In addition, if history (see the
+**HISTORY** section) and the prompt (see the **TTY MODE** section) are enabled,
+both are output to **stdout**.
**Note**: Unlike other dc(1) implementations, this dc(1) will issue a fatal
error (see the **EXIT STATUS** section) if it cannot write to **stdout**, so if
@@ -194,7 +203,10 @@ command or the **"** command that does not get receive a value of **0** or
**Note**: The values returned by the pseudo-random number generator with the
**'** and **"** commands are guaranteed to **NOT** be cryptographically secure.
This is a consequence of using a seeded pseudo-random number generator. However,
-they **are** guaranteed to be reproducible with identical **seed** values.
+they *are* guaranteed to be reproducible with identical **seed** values. This
+means that the pseudo-random values from dc(1) should only be used where a
+reproducible stream of pseudo-random numbers is *ESSENTIAL*. In any other case,
+use a non-seeded pseudo-random number generator.
The pseudo-random number generator, **seed**, and all associated operations are
**non-portable extensions**.
@@ -894,7 +906,7 @@ follows any command that needs a register name. The only exception is a newline
Unlike most other dc(1) implentations, this dc(1) provides nearly unlimited
amounts of registers, if extended register mode is enabled.
-If extended register mode is enabled (**-x** or **--extended-register**
+If extended register mode is enabled (**-x** or **-\-extended-register**
command-line arguments are given), then normal single character registers are
used *unless* the character immediately following a command that needs a
register name is a space (according to **isspace()**) and not a newline
@@ -1027,7 +1039,7 @@ dc(1) recognizes the following environment variables:
The quote parsing will handle either kind of quotes, **'** or **"**. Thus,
if you have a file with any number of single quotes in the name, you can use
- double quotes as the outside quotes, as in **"some 'bc' file.bc"**, and vice
+ double quotes as the outside quotes, as in **"some 'dc' file.dc"**, and vice
versa if you have a file with double quotes. However, handling a file with
both kinds of quotes in **DC_ENV_ARGS** is not supported due to the
complexity of the parsing, though such files are still supported on the
@@ -1103,17 +1115,17 @@ The other statuses will only be returned when dc(1) is not in interactive mode
(see the **INTERACTIVE MODE** section), since dc(1) resets its state (see the
**RESET** section) and accepts more input when one of those errors occurs in
interactive mode. This is also the case when interactive mode is forced by the
-**-i** flag or **--interactive** option.
+**-i** flag or **-\-interactive** option.
These exit statuses allow dc(1) to be used in shell scripting with error
checking, and its normal behavior can be forced by using the **-i** flag or
-**--interactive** option.
+**-\-interactive** option.
# INTERACTIVE MODE
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both **stdin** and **stdout**
-are hooked to a terminal, but the **-i** flag and **--interactive** option can
+are hooked to a terminal, but the **-i** flag and **-\-interactive** option can
turn it on in other cases.
In interactive mode, dc(1) attempts to recover from errors (see the **RESET**
diff --git a/contrib/bc/manuals/dc/P.1 b/contrib/bc/manuals/dc/P.1
index a39132aea914..2bbe54c37604 100644
--- a/contrib/bc/manuals/dc/P.1
+++ b/contrib/bc/manuals/dc/P.1
@@ -1,7 +1,7 @@
.\"
.\" SPDX-License-Identifier: BSD-2-Clause
.\"
-.\" Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+.\" Copyright (c) 2018-2021 Gavin D. Howard and contributors.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions are met:
@@ -25,18 +25,17 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.TH "DC" "1" "October 2020" "Gavin D. Howard" "General Commands Manual"
+.TH "DC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
.SH Name
.PP
dc - arbitrary-precision decimal reverse-Polish notation calculator
.SH SYNOPSIS
.PP
-\f[B]dc\f[R] [\f[B]-hiPvVx\f[R]] [\f[B]\[en]version\f[R]]
-[\f[B]\[en]help\f[R]] [\f[B]\[en]interactive\f[R]]
-[\f[B]\[en]no-prompt\f[R]] [\f[B]\[en]extended-register\f[R]]
-[\f[B]-e\f[R] \f[I]expr\f[R]]
-[\f[B]\[en]expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
-\f[I]file\f[R]\&...] [\f[B]-file\f[R]=\f[I]file\f[R]\&...]
+\f[B]dc\f[R] [\f[B]-hiPvVx\f[R]] [\f[B]--version\f[R]]
+[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--no-prompt\f[R]]
+[\f[B]--extended-register\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
+[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
+\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
[\f[I]file\f[R]\&...]
.SH DESCRIPTION
.PP
@@ -47,13 +46,13 @@ Arithmetic operations pop arguments off of the stack and push the
results.
.PP
If no files are given on the command-line as extra arguments (i.e., not
-as \f[B]-f\f[R] or \f[B]\[en]file\f[R] arguments), then dc(1) reads from
+as \f[B]-f\f[R] or \f[B]--file\f[R] arguments), then dc(1) reads from
\f[B]stdin\f[R].
Otherwise, those files are processed, and dc(1) will then exit.
.PP
This is different from the dc(1) on OpenBSD and possibly other dc(1)
-implementations, where \f[B]-e\f[R] (\f[B]\[en]expression\f[R]) and
-\f[B]-f\f[R] (\f[B]\[en]file\f[R]) arguments cause dc(1) to execute them
+implementations, where \f[B]-e\f[R] (\f[B]--expression\f[R]) and
+\f[B]-f\f[R] (\f[B]--file\f[R]) arguments cause dc(1) to execute them
and exit.
The reason for this is that this dc(1) allows users to set arguments in
the environment variable \f[B]DC_ENV_ARGS\f[R] (see the \f[B]ENVIRONMENT
@@ -72,13 +71,13 @@ argument or define the environment variable \f[B]DC_EXPR_EXIT\f[R].
.PP
The following are the options that dc(1) accepts.
.TP
-\f[B]-h\f[R], \f[B]\[en]help\f[R]
+\f[B]-h\f[R], \f[B]--help\f[R]
Prints a usage message and quits.
.TP
-\f[B]-v\f[R], \f[B]-V\f[R], \f[B]\[en]version\f[R]
+\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
Print the version information (copyright header) and exit.
.TP
-\f[B]-i\f[R], \f[B]\[en]interactive\f[R]
+\f[B]-i\f[R], \f[B]--interactive\f[R]
Forces interactive mode.
(See the \f[B]INTERACTIVE MODE\f[R] section.)
.RS
@@ -86,14 +85,14 @@ Forces interactive mode.
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-P\f[R], \f[B]\[en]no-prompt\f[R]
+\f[B]-P\f[R], \f[B]--no-prompt\f[R]
This option is a no-op.
.RS
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-x\f[R] \f[B]\[en]extended-register\f[R]
+\f[B]-x\f[R] \f[B]--extended-register\f[R]
Enables extended register mode.
See the \f[I]Extended Register Mode\f[R] subsection of the
\f[B]REGISTERS\f[R] section for more information.
@@ -102,7 +101,7 @@ See the \f[I]Extended Register Mode\f[R] subsection of the
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-e\f[R] \f[I]expr\f[R], \f[B]\[en]expression\f[R]=\f[I]expr\f[R]
+\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
Evaluates \f[I]expr\f[R].
If multiple expressions are given, they are evaluated in order.
If files are given as well (see below), the expressions and files are
@@ -111,26 +110,36 @@ This means that if a file is given before an expression, the file is
read in and evaluated first.
.RS
.PP
-After processing all expressions and files, dc(1) will exit, unless
+If this option is given on the command-line (i.e., not in
+\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
+then after processing all expressions and files, dc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]\[en]file\f[R].
+\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
+\f[B]DC_ENV_ARGS\f[R].
+However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
+\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
+\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
+exit.
.PP
This is a \f[B]non-portable extension\f[R].
.RE
.TP
-\f[B]-f\f[R] \f[I]file\f[R], \f[B]\[en]file\f[R]=\f[I]file\f[R]
+\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
were read through \f[B]stdin\f[R].
If expressions are also given (see above), the expressions are evaluated
in the order given.
.RS
.PP
-After processing all expressions and files, dc(1) will exit, unless
+If this option is given on the command-line (i.e., not in
+\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
+then after processing all expressions and files, dc(1) will exit, unless
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]\[en]file\f[R].
-However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
-\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after that,
-bc(1) will give a fatal error and exit.
+\f[B]-f\f[R] or \f[B]--file\f[R].
+However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
+\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
+\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
+exit.
.PP
This is a \f[B]non-portable extension\f[R].
.RE
@@ -139,6 +148,9 @@ All long options are \f[B]non-portable extensions\f[R].
.SH STDOUT
.PP
Any non-error output is written to \f[B]stdout\f[R].
+In addition, if history (see the \f[B]HISTORY\f[R] section) and the
+prompt (see the \f[B]TTY MODE\f[R] section) are enabled, both are output
+to \f[B]stdout\f[R].
.PP
\f[B]Note\f[R]: Unlike other dc(1) implementations, this dc(1) will
issue a fatal error (see the \f[B]EXIT STATUS\f[R] section) if it cannot
@@ -228,8 +240,12 @@ queried with the \f[B]W\f[R] command.
generator with the \f[B]\[cq]\f[R] and \f[B]\[dq]\f[R] commands are
guaranteed to \f[B]NOT\f[R] be cryptographically secure.
This is a consequence of using a seeded pseudo-random number generator.
-However, they \f[B]are\f[R] guaranteed to be reproducible with identical
+However, they \f[I]are\f[R] guaranteed to be reproducible with identical
\f[B]seed\f[R] values.
+This means that the pseudo-random values from dc(1) should only be used
+where a reproducible stream of pseudo-random numbers is
+\f[I]ESSENTIAL\f[R].
+In any other case, use a non-seeded pseudo-random number generator.
.PP
The pseudo-random number generator, \f[B]seed\f[R], and all associated
operations are \f[B]non-portable extensions\f[R].
@@ -1015,7 +1031,7 @@ Unlike most other dc(1) implentations, this dc(1) provides nearly
unlimited amounts of registers, if extended register mode is enabled.
.PP
If extended register mode is enabled (\f[B]-x\f[R] or
-\f[B]\[en]extended-register\f[R] command-line arguments are given), then
+\f[B]--extended-register\f[R] command-line arguments are given), then
normal single character registers are used \f[I]unless\f[R] the
character immediately following a command that needs a register name is
a space (according to \f[B]isspace()\f[R]) and not a newline
@@ -1155,7 +1171,7 @@ will be correctly parsed, but the string \f[B]\[lq]/home/gavin/some
The quote parsing will handle either kind of quotes, \f[B]\[cq]\f[R] or
\f[B]\[lq]\f[R]. Thus, if you have a file with any number of single
quotes in the name, you can use double quotes as the outside quotes, as
-in \f[B]\[rq]some `bc' file.bc\[dq]\f[R], and vice versa if you have a
+in \f[B]\[rq]some `dc' file.dc\[dq]\f[R], and vice versa if you have a
file with double quotes.
However, handling a file with both kinds of quotes in
\f[B]DC_ENV_ARGS\f[R] is not supported due to the complexity of the
@@ -1238,17 +1254,17 @@ interactive mode (see the \f[B]INTERACTIVE MODE\f[R] section), since
dc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
more input when one of those errors occurs in interactive mode.
This is also the case when interactive mode is forced by the
-\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
+\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.PP
These exit statuses allow dc(1) to be used in shell scripting with error
checking, and its normal behavior can be forced by using the
-\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
+\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.SH INTERACTIVE MODE
.PP
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both \f[B]stdin\f[R]
and \f[B]stdout\f[R] are hooked to a terminal, but the \f[B]-i\f[R] flag
-and \f[B]\[en]interactive\f[R] option can turn it on in other cases.
+and \f[B]--interactive\f[R] option can turn it on in other cases.
.PP
In interactive mode, dc(1) attempts to recover from errors (see the
\f[B]RESET\f[R] section), and in normal execution, flushes
diff --git a/contrib/bc/manuals/dc/P.1.md b/contrib/bc/manuals/dc/P.1.md
index 65771f6c73e1..0101b68fb872 100644
--- a/contrib/bc/manuals/dc/P.1.md
+++ b/contrib/bc/manuals/dc/P.1.md
@@ -2,7 +2,7 @@
SPDX-License-Identifier: BSD-2-Clause
-Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+Copyright (c) 2018-2021 Gavin D. Howard and contributors.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
@@ -34,7 +34,7 @@ dc - arbitrary-precision decimal reverse-Polish notation calculator
# SYNOPSIS
-**dc** [**-hiPvVx**] [**--version**] [**--help**] [**--interactive**] [**--no-prompt**] [**--extended-register**] [**-e** *expr*] [**--expression**=*expr*...] [**-f** *file*...] [**-file**=*file*...] [*file*...]
+**dc** [**-hiPvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@@ -43,11 +43,11 @@ notation) to store numbers and results of computations. Arithmetic operations
pop arguments off of the stack and push the results.
If no files are given on the command-line as extra arguments (i.e., not as
-**-f** or **--file** arguments), then dc(1) reads from **stdin**. Otherwise,
+**-f** or **-\-file** arguments), then dc(1) reads from **stdin**. Otherwise,
those files are processed, and dc(1) will then exit.
This is different from the dc(1) on OpenBSD and possibly other dc(1)
-implementations, where **-e** (**--expression**) and **-f** (**--file**)
+implementations, where **-e** (**-\-expression**) and **-f** (**-\-file**)
arguments cause dc(1) to execute them and exit. The reason for this is that this
dc(1) allows users to set arguments in the environment variable **DC_ENV_ARGS**
(see the **ENVIRONMENT VARIABLES** section). Any expressions given on the
@@ -64,55 +64,62 @@ as the last command-line argument or define the environment variable
The following are the options that dc(1) accepts.
-**-h**, **--help**
+**-h**, **-\-help**
: Prints a usage message and quits.
-**-v**, **-V**, **--version**
+**-v**, **-V**, **-\-version**
: Print the version information (copyright header) and exit.
-**-i**, **--interactive**
+**-i**, **-\-interactive**
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
This is a **non-portable extension**.
-**-P**, **--no-prompt**
+**-P**, **-\-no-prompt**
: This option is a no-op.
This is a **non-portable extension**.
-**-x** **--extended-register**
+**-x** **-\-extended-register**
: Enables extended register mode. See the *Extended Register Mode* subsection
of the **REGISTERS** section for more information.
This is a **non-portable extension**.
-**-e** *expr*, **--expression**=*expr*
+**-e** *expr*, **-\-expression**=*expr*
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
order. If files are given as well (see below), the expressions and files are
evaluated in the order given. This means that if a file is given before an
expression, the file is read in and evaluated first.
- After processing all expressions and files, dc(1) will exit, unless **-**
- (**stdin**) was given as an argument at least once to **-f** or **--file**.
+ If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
+ see the **ENVIRONMENT VARIABLES** section), then after processing all
+ expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
+ as an argument at least once to **-f** or **-\-file**, whether on the
+ command-line or in **DC_ENV_ARGS**. However, if any other **-e**,
+ **-\-expression**, **-f**, or **-\-file** arguments are given after **-f-**
+ or equivalent is given, dc(1) will give a fatal error and exit.
This is a **non-portable extension**.
-**-f** *file*, **--file**=*file*
+**-f** *file*, **-\-file**=*file*
: Reads in *file* and evaluates it, line by line, as though it were read
through **stdin**. If expressions are also given (see above), the
expressions are evaluated in the order given.
- After processing all expressions and files, dc(1) will exit, unless **-**
- (**stdin**) was given as an argument at least once to **-f** or **--file**.
- However, if any other **-e**, **--expression**, **-f**, or **--file**
- arguments are given after that, bc(1) will give a fatal error and exit.
+ If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
+ see the **ENVIRONMENT VARIABLES** section), then after processing all
+ expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
+ as an argument at least once to **-f** or **-\-file**. However, if any other
+ **-e**, **-\-expression**, **-f**, or **-\-file** arguments are given after
+ **-f-** or equivalent is given, dc(1) will give a fatal error and exit.
This is a **non-portable extension**.
@@ -120,7 +127,9 @@ All long options are **non-portable extensions**.
# STDOUT
-Any non-error output is written to **stdout**.
+Any non-error output is written to **stdout**. In addition, if history (see the
+**HISTORY** section) and the prompt (see the **TTY MODE** section) are enabled,
+both are output to **stdout**.
**Note**: Unlike other dc(1) implementations, this dc(1) will issue a fatal
error (see the **EXIT STATUS** section) if it cannot write to **stdout**, so if
@@ -194,7 +203,10 @@ command or the **"** command that does not get receive a value of **0** or
**Note**: The values returned by the pseudo-random number generator with the
**'** and **"** commands are guaranteed to **NOT** be cryptographically secure.
This is a consequence of using a seeded pseudo-random number generator. However,
-they **are** guaranteed to be reproducible with identical **seed** values.
+they *are* guaranteed to be reproducible with identical **seed** values. This
+means that the pseudo-random values from dc(1) should only be used where a
+reproducible stream of pseudo-random numbers is *ESSENTIAL*. In any other case,
+use a non-seeded pseudo-random number generator.
The pseudo-random number generator, **seed**, and all associated operations are
**non-portable extensions**.
@@ -894,7 +906,7 @@ follows any command that needs a register name. The only exception is a newline
Unlike most other dc(1) implentations, this dc(1) provides nearly unlimited
amounts of registers, if extended register mode is enabled.
-If extended register mode is enabled (**-x** or **--extended-register**
+If extended register mode is enabled (**-x** or **-\-extended-register**
command-line arguments are given), then normal single character registers are
used *unless* the character immediately following a command that needs a
register name is a space (according to **isspace()**) and not a newline
@@ -1027,7 +1039,7 @@ dc(1) recognizes the following environment variables:
The quote parsing will handle either kind of quotes, **'** or **"**. Thus,
if you have a file with any number of single quotes in the name, you can use
- double quotes as the outside quotes, as in **"some 'bc' file.bc"**, and vice
+ double quotes as the outside quotes, as in **"some 'dc' file.dc"**, and vice
versa if you have a file with double quotes. However, handling a file with
both kinds of quotes in **DC_ENV_ARGS** is not supported due to the
complexity of the parsing, though such files are still supported on the
@@ -1103,17 +1115,17 @@ The other statuses will only be returned when dc(1) is not in interactive mode
(see the **INTERACTIVE MODE** section), since dc(1) resets its state (see the
**RESET** section) and accepts more input when one of those errors occurs in
interactive mode. This is also the case when interactive mode is forced by the
-**-i** flag or **--interactive** option.
+**-i** flag or **-\-interactive** option.
These exit statuses allow dc(1) to be used in shell scripting with error
checking, and its normal behavior can be forced by using the **-i** flag or
-**--interactive** option.
+**-\-interactive** option.
# INTERACTIVE MODE
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both **stdin** and **stdout**
-are hooked to a terminal, but the **-i** flag and **--interactive** option can
+are hooked to a terminal, but the **-i** flag and **-\-interactive** option can
turn it on in other cases.
In interactive mode, dc(1) attempts to recover from errors (see the **RESET**
diff --git a/contrib/bc/manuals/header.txt b/contrib/bc/manuals/header.txt
index 071157ebd135..d805e14ad691 100644
--- a/contrib/bc/manuals/header.txt
+++ b/contrib/bc/manuals/header.txt
@@ -1,7 +1,7 @@
.\"
.\" SPDX-License-Identifier: BSD-2-Clause
.\"
-.\" Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+.\" Copyright (c) 2018-2021 Gavin D. Howard and contributors.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions are met:
diff --git a/contrib/bc/manuals/header_bc.txt b/contrib/bc/manuals/header_bc.txt
index fa1a54f85693..e07d2e79a1ce 100644
--- a/contrib/bc/manuals/header_bc.txt
+++ b/contrib/bc/manuals/header_bc.txt
@@ -1 +1 @@
-.TH "BC" "1" "October 2020" "Gavin D. Howard" "General Commands Manual"
+.TH "BC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
diff --git a/contrib/bc/manuals/header_bcl.txt b/contrib/bc/manuals/header_bcl.txt
index ba9338aadad9..5933f01f2732 100644
--- a/contrib/bc/manuals/header_bcl.txt
+++ b/contrib/bc/manuals/header_bcl.txt
@@ -1 +1 @@
-.TH "BCL" "3" "October 2020" "Gavin D. Howard" "Libraries Manual"
+.TH "BCL" "3" "March 2021" "Gavin D. Howard" "Libraries Manual"
diff --git a/contrib/bc/manuals/header_dc.txt b/contrib/bc/manuals/header_dc.txt
index b0e8b204f4ee..227aac310a0e 100644
--- a/contrib/bc/manuals/header_dc.txt
+++ b/contrib/bc/manuals/header_dc.txt
@@ -1 +1 @@
-.TH "DC" "1" "October 2020" "Gavin D. Howard" "General Commands Manual"
+.TH "DC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
diff --git a/contrib/bc/release.sh b/contrib/bc/release.sh
index bd9c33e55da6..902f26ef4d33 100755
--- a/contrib/bc/release.sh
+++ b/contrib/bc/release.sh
@@ -2,7 +2,7 @@
#
# SPDX-License-Identifier: BSD-2-Clause
#
-# Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+# Copyright (c) 2018-2021 Gavin D. Howard and contributors.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
@@ -47,7 +47,7 @@ header() {
}
do_make() {
- make -j4 "$@"
+ make -j16 "$@"
}
configure() {
@@ -326,18 +326,18 @@ vg() {
_vg_bits=32
fi
- build "$debug" "gcc" "-O0 -g" "1" "$_vg_bits"
- runtest valgrind
+ build "$debug" "gcc" "-O0 -gv" "1" "$_vg_bits"
+ runtest test
do_make clean_config
- build "$debug" "gcc" "-O0 -gb" "1" "$_vg_bits"
- runtest valgrind
+ build "$debug" "gcc" "-O0 -gvb" "1" "$_vg_bits"
+ runtest test
do_make clean_config
- build "$debug" "gcc" "-O0 -gd" "1" "$_vg_bits"
- runtest valgrind
+ build "$debug" "gcc" "-O0 -gvd" "1" "$_vg_bits"
+ runtest test
do_make clean_config
}
@@ -514,7 +514,7 @@ else
defcc="c99"
fi
-export ASAN_OPTIONS="abort_on_error=1"
+export ASAN_OPTIONS="abort_on_error=1,allocator_may_return_null=1"
export UBSAN_OPTIONS="print_stack_trace=1,silence_unsigned_overflow=1"
build "$debug" "$defcc" "-g" "1" "$bits"
@@ -573,9 +573,9 @@ if [ "$run_tests" -ne 0 ]; then
printf '\n'
printf 'Then run the GitHub release script as follows:\n'
printf '\n'
- printf ' <github_release> %s .travis.yml codecov.yml release.sh \\\n' "$version"
- printf ' RELEASE.md tests/afl.py tests/radamsa.sh tests/radamsa.txt tests/randmath.py \\\n'
- printf ' tests/bc/scripts/timeconst.bc\n'
+ printf ' <github_release> %s release.sh RELEASE.md\\\n' "$version"
+ printf ' tests/afl.py tests/radamsa.sh tests/radamsa.txt tests/randmath.py \\\n'
+ printf ' tests/fuzzing/ tests/bc/scripts/timeconst.bc\n'
fi
diff --git a/contrib/bc/src/args.c b/contrib/bc/src/args.c
index 4c9ad3b95549..9c26b7c18790 100644
--- a/contrib/bc/src/args.c
+++ b/contrib/bc/src/args.c
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
- * Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+ * Copyright (c) 2018-2021 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -89,7 +89,7 @@ static void bc_args_file(const char *file) {
free(buf);
}
-void bc_args(int argc, char *argv[]) {
+void bc_args(int argc, char *argv[], bool exit_exprs) {
int c;
size_t i;
@@ -109,6 +109,7 @@ void bc_args(int argc, char *argv[]) {
if (vm.no_exit_exprs)
bc_vm_verr(BC_ERR_FATAL_OPTION, "-e (--expression)");
bc_args_exprs(opts.optarg);
+ vm.exit_exprs = (exit_exprs || vm.exit_exprs);
break;
}
@@ -119,6 +120,7 @@ void bc_args(int argc, char *argv[]) {
if (vm.no_exit_exprs)
bc_vm_verr(BC_ERR_FATAL_OPTION, "-f (--file)");
bc_args_file(opts.optarg);
+ vm.exit_exprs = (exit_exprs || vm.exit_exprs);
}
break;
}
diff --git a/contrib/bc/src/bc.c b/contrib/bc/src/bc.c
index cdf3cc9c3a28..36b64e17e8de 100644
--- a/contrib/bc/src/bc.c
+++ b/contrib/bc/src/bc.c
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
- * Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+ * Copyright (c) 2018-2021 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
diff --git a/contrib/bc/src/bc_lex.c b/contrib/bc/src/bc_lex.c
index 87475385fe70..159c583e4ae3 100644
--- a/contrib/bc/src/bc_lex.c
+++ b/contrib/bc/src/bc_lex.c
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
- * Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+ * Copyright (c) 2018-2021 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
diff --git a/contrib/bc/src/bc_parse.c b/contrib/bc/src/bc_parse.c
index 35d3e45c581c..ea311ab45703 100644
--- a/contrib/bc/src/bc_parse.c
+++ b/contrib/bc/src/bc_parse.c
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
- * Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+ * Copyright (c) 2018-2021 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
diff --git a/contrib/bc/src/data.c b/contrib/bc/src/data.c
index a3cf4dbda293..08b8b19b5692 100644
--- a/contrib/bc/src/data.c
+++ b/contrib/bc/src/data.c
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
- * Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+ * Copyright (c) 2018-2021 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -55,7 +55,7 @@ const uchar dc_sig_msg_len = (uchar) (sizeof(dc_sig_msg) - 1);
#endif // DC_ENABLED
const char bc_copyright[] =
- "Copyright (c) 2018-2020 Gavin D. Howard and contributors\n"
+ "Copyright (c) 2018-2021 Gavin D. Howard and contributors\n"
"Report bugs at: https://git.yzena.com/gavin/bc\n\n"
"This is free software with ABSOLUTELY NO WARRANTY.\n";
diff --git a/contrib/bc/src/dc.c b/contrib/bc/src/dc.c
index 41c49a08b367..7ea310562217 100644
--- a/contrib/bc/src/dc.c
+++ b/contrib/bc/src/dc.c
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
- * Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+ * Copyright (c) 2018-2021 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
diff --git a/contrib/bc/src/dc_lex.c b/contrib/bc/src/dc_lex.c
index e9a7d2ca1e4b..a0e7454394ec 100644
--- a/contrib/bc/src/dc_lex.c
+++ b/contrib/bc/src/dc_lex.c
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
- * Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+ * Copyright (c) 2018-2021 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -61,7 +61,7 @@ static void dc_lex_register(BcLex *l) {
bc_lex_name(l);
}
else {
- bc_vec_npop(&l->str, l->str.len);
+ bc_vec_popAll(&l->str);
bc_vec_pushByte(&l->str, (uchar) l->buf[l->i - 1]);
bc_vec_pushByte(&l->str, '\0');
l->t = BC_LEX_NAME;
@@ -74,7 +74,7 @@ static void dc_lex_string(BcLex *l) {
char c;
l->t = BC_LEX_STR;
- bc_vec_npop(&l->str, l->str.len);
+ bc_vec_popAll(&l->str);
for (; (c = l->buf[i]) && depth; ++i) {
diff --git a/contrib/bc/src/dc_parse.c b/contrib/bc/src/dc_parse.c
index 81191541fa83..c56d6330544f 100644
--- a/contrib/bc/src/dc_parse.c
+++ b/contrib/bc/src/dc_parse.c
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
- * Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+ * Copyright (c) 2018-2021 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
diff --git a/contrib/bc/src/file.c b/contrib/bc/src/file.c
index 1d4d390f89a4..e69092f6207a 100644
--- a/contrib/bc/src/file.c
+++ b/contrib/bc/src/file.c
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
- * Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+ * Copyright (c) 2018-2021 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -105,7 +105,7 @@ void bc_file_flush(BcFile *restrict f) {
vm.status = (sig_atomic_t) s;
BC_VM_JMP;
}
- else bc_vm_err(BC_ERR_FATAL_IO_ERR);
+ else bc_vm_fatalError(BC_ERR_FATAL_IO_ERR);
}
}
diff --git a/contrib/bc/src/history.c b/contrib/bc/src/history.c
index ae4b42d326c0..7c4f0ceb0f39 100644
--- a/contrib/bc/src/history.c
+++ b/contrib/bc/src/history.c
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
- * Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+ * Copyright (c) 2018-2021 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -383,7 +383,7 @@ static BcStatus bc_history_readCode(char *buf, size_t buf_len,
return BC_STATUS_SUCCESS;
err:
- if (BC_ERR(n < 0)) bc_vm_err(BC_ERR_FATAL_IO_ERR);
+ if (BC_ERR(n < 0)) bc_vm_fatalError(BC_ERR_FATAL_IO_ERR);
else *nread = (size_t) n;
return BC_STATUS_EOF;
}
@@ -441,7 +441,7 @@ static void bc_history_enableRaw(BcHistory *h) {
BC_SIG_LOCK;
if (BC_ERR(tcgetattr(STDIN_FILENO, &h->orig_termios) == -1))
- bc_vm_err(BC_ERR_FATAL_IO_ERR);
+ bc_vm_fatalError(BC_ERR_FATAL_IO_ERR);
BC_SIG_UNLOCK;
@@ -473,7 +473,7 @@ static void bc_history_enableRaw(BcHistory *h) {
BC_SIG_UNLOCK;
- if (BC_ERR(err < 0)) bc_vm_err(BC_ERR_FATAL_IO_ERR);
+ if (BC_ERR(err < 0)) bc_vm_fatalError(BC_ERR_FATAL_IO_ERR);
h->rawMode = true;
}
@@ -948,7 +948,8 @@ static void bc_history_escape(BcHistory *h) {
}
else {
- if (BC_ERR(BC_HIST_READ(seq + 1, 1))) bc_vm_err(BC_ERR_FATAL_IO_ERR);
+ if (BC_ERR(BC_HIST_READ(seq + 1, 1)))
+ bc_vm_fatalError(BC_ERR_FATAL_IO_ERR);
// ESC [ sequences.
if (c == '[') {
@@ -959,13 +960,13 @@ static void bc_history_escape(BcHistory *h) {
// Extended escape, read additional byte.
if (BC_ERR(BC_HIST_READ(seq + 2, 1)))
- bc_vm_err(BC_ERR_FATAL_IO_ERR);
+ bc_vm_fatalError(BC_ERR_FATAL_IO_ERR);
if (seq[2] == '~' && c == '3') bc_history_edit_delete(h);
else if(seq[2] == ';') {
if (BC_ERR(BC_HIST_READ(seq, 2)))
- bc_vm_err(BC_ERR_FATAL_IO_ERR);
+ bc_vm_fatalError(BC_ERR_FATAL_IO_ERR);
if (seq[0] != '5') return;
else if (seq[1] == 'C') bc_history_edit_wordEnd(h);
diff --git a/contrib/bc/src/lang.c b/contrib/bc/src/lang.c
index bc34e7c269f8..46d1968c5914 100644
--- a/contrib/bc/src/lang.c
+++ b/contrib/bc/src/lang.c
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
- * Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+ * Copyright (c) 2018-2021 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -119,17 +119,17 @@ void bc_func_reset(BcFunc *f) {
BC_SIG_ASSERT_LOCKED;
assert(f != NULL);
- bc_vec_npop(&f->code, f->code.len);
+ bc_vec_popAll(&f->code);
- bc_vec_npop(&f->consts, f->consts.len);
+ bc_vec_popAll(&f->consts);
#if BC_ENABLED
if (BC_IS_BC) {
- bc_vec_npop(&f->strs, f->strs.len);
+ bc_vec_popAll(&f->strs);
- bc_vec_npop(&f->autos, f->autos.len);
- bc_vec_npop(&f->labels, f->labels.len);
+ bc_vec_popAll(&f->autos);
+ bc_vec_popAll(&f->labels);
f->nparams = 0;
f->voidfn = false;
@@ -183,7 +183,7 @@ void bc_array_copy(BcVec *d, const BcVec *s) {
assert(d != NULL && s != NULL);
assert(d != s && d->size == s->size && d->dtor == s->dtor);
- bc_vec_npop(d, d->len);
+ bc_vec_popAll(d);
bc_vec_expand(d, s->cap);
d->len = s->len;
diff --git a/contrib/bc/src/lex.c b/contrib/bc/src/lex.c
index d6f09f995a6a..a229f1964d5c 100644
--- a/contrib/bc/src/lex.c
+++ b/contrib/bc/src/lex.c
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
- * Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+ * Copyright (c) 2018-2021 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -130,7 +130,7 @@ void bc_lex_number(BcLex *l, char start) {
l->t = BC_LEX_NUMBER;
- bc_vec_npop(&l->str, l->str.len);
+ bc_vec_popAll(&l->str);
bc_vec_push(&l->str, &start);
l->i += bc_lex_num(l, start, false);
diff --git a/contrib/bc/src/library.c b/contrib/bc/src/library.c
index 278b0f55a950..507e58c07d81 100644
--- a/contrib/bc/src/library.c
+++ b/contrib/bc/src/library.c
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
- * Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+ * Copyright (c) 2018-2021 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -151,9 +151,7 @@ void bcl_free(void) {
bc_vec_free(&vm.ctxts);
#endif // NDEBUG
- bc_vm_shutdown();
-
- bc_vec_free(&vm.jmp_bufs);
+ bc_vm_atexit();
BC_SIG_UNLOCK;
@@ -213,8 +211,8 @@ void bcl_ctxt_free(BclContext ctxt) {
}
void bcl_ctxt_freeNums(BclContext ctxt) {
- bc_vec_npop(&ctxt->nums, ctxt->nums.len);
- bc_vec_npop(&ctxt->free_nums, ctxt->free_nums.len);
+ bc_vec_popAll(&ctxt->nums);
+ bc_vec_popAll(&ctxt->free_nums);
}
size_t bcl_ctxt_scale(BclContext ctxt) {
@@ -891,7 +889,7 @@ char* bcl_string(BclNumber n) {
assert(nptr != NULL && nptr->num != NULL);
- bc_vec_npop(&vm.out, vm.out.len);
+ bc_vec_popAll(&vm.out);
bc_num_print(nptr, (BcBigDig) ctxt->obase, false);
bc_vec_pushByte(&vm.out, '\0');
diff --git a/contrib/bc/src/main.c b/contrib/bc/src/main.c
index 9c16e766e798..84a48ff7e301 100644
--- a/contrib/bc/src/main.c
+++ b/contrib/bc/src/main.c
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
- * Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+ * Copyright (c) 2018-2021 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -49,7 +49,6 @@
int main(int argc, char *argv[]) {
- int s;
char *name;
size_t len = strlen(BC_EXECPREFIX);
@@ -78,13 +77,5 @@ int main(int argc, char *argv[]) {
exit:
BC_SIG_MAYLOCK;
- s = !BC_STATUS_IS_ERROR(vm.status) ? BC_STATUS_SUCCESS : (int) vm.status;
-
- bc_vm_shutdown();
-
-#ifndef NDEBUG
- bc_vec_free(&vm.jmp_bufs);
-#endif // NDEBUG
-
- return s;
+ return bc_vm_atexit((int) vm.status);
}
diff --git a/contrib/bc/src/num.c b/contrib/bc/src/num.c
index 0b8823a3fec2..6131034ac535 100644
--- a/contrib/bc/src/num.c
+++ b/contrib/bc/src/num.c
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
- * Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+ * Copyright (c) 2018-2021 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -1588,9 +1588,9 @@ static void bc_num_parseBase(BcNum *restrict n, const char *restrict val,
bc_num_add(&mult1, &temp, n, 0);
}
- if (i == len && !(c = val[i])) goto int_err;
+ if (i == len && !val[i]) goto int_err;
- assert(c == '.');
+ assert(val[i] == '.');
BC_SIG_LOCK;
@@ -2138,7 +2138,7 @@ size_t bc_num_len(const BcNum *restrict n) {
size_t len = n->len;
- if (BC_NUM_ZERO(n)) return 0;
+ if (BC_NUM_ZERO(n)) return n->scale ? n->scale : 1;
if (BC_NUM_RDX_VAL(n) == len) {
@@ -2665,7 +2665,7 @@ void bc_num_rshift(BcNum *a, BcNum *b, BcNum *c, size_t scale) {
void bc_num_sqrt(BcNum *restrict a, BcNum *restrict b, size_t scale) {
BcNum num1, num2, half, f, fprime, *x0, *x1, *temp;
- size_t pow, len, rdx, req, digs, digs1, digs2, resscale;
+ size_t pow, len, rdx, req, resscale;
BcDig half_digs[1];
assert(a != NULL && b != NULL && a != b);
@@ -2736,7 +2736,7 @@ void bc_num_sqrt(BcNum *restrict a, BcNum *restrict b, size_t scale) {
}
// I can set the rdx here directly because neg should be false.
- x0->scale = x0->rdx = digs = digs1 = digs2 = 0;
+ x0->scale = x0->rdx = 0;
resscale = (scale + BC_BASE_DIGS) + 2;
while (bc_num_cmp(x1, x0)) {
diff --git a/contrib/bc/src/opt.c b/contrib/bc/src/opt.c
index 57cee759af5e..3f09afe3b57b 100644
--- a/contrib/bc/src/opt.c
+++ b/contrib/bc/src/opt.c
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
- * Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+ * Copyright (c) 2018-2021 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
diff --git a/contrib/bc/src/parse.c b/contrib/bc/src/parse.c
index 39b79efdd02f..2aeb4923135f 100644
--- a/contrib/bc/src/parse.c
+++ b/contrib/bc/src/parse.c
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
- * Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+ * Copyright (c) 2018-2021 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -159,9 +159,9 @@ void bc_parse_reset(BcParse *p) {
#if BC_ENABLED
if (BC_IS_BC) {
bc_vec_npop(&p->flags, p->flags.len - 1);
- bc_vec_npop(&p->exits, p->exits.len);
- bc_vec_npop(&p->conds, p->conds.len);
- bc_vec_npop(&p->ops, p->ops.len);
+ bc_vec_popAll(&p->exits);
+ bc_vec_popAll(&p->conds);
+ bc_vec_popAll(&p->ops);
}
#endif // BC_ENABLED
diff --git a/contrib/bc/src/program.c b/contrib/bc/src/program.c
index f0a67ee194c1..6ab794736f79 100644
--- a/contrib/bc/src/program.c
+++ b/contrib/bc/src/program.c
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
- * Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+ * Copyright (c) 2018-2021 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -454,7 +454,7 @@ static void bc_program_read(BcProgram *p) {
BC_SIG_UNLOCK;
bc_lex_file(&parse.l, bc_program_stdin_name);
- bc_vec_npop(&f->code, f->code.len);
+ bc_vec_popAll(&f->code);
s = bc_read_line(&buf, BC_IS_BC ? "read> " : "?> ");
if (s == BC_STATUS_EOF) bc_vm_err(BC_ERR_EXEC_READ_EXPR);
@@ -723,13 +723,13 @@ static void bc_program_logical(BcProgram *p, uchar inst) {
}
#if DC_ENABLED
-static void bc_program_assignStr(BcProgram *p, BcResult *r,
+static void bc_program_assignStr(BcProgram *p, size_t idx,
BcVec *v, bool push)
{
BcNum n2;
bc_num_clear(&n2);
- n2.scale = r->d.loc.loc;
+ n2.scale = idx;
assert(BC_PROG_STACK(&p->results, 1 + !push));
@@ -777,8 +777,13 @@ static void bc_program_copyToVar(BcProgram *p, size_t idx,
#if DC_ENABLED
if (BC_IS_DC && (ptr->t == BC_RESULT_STR || BC_PROG_STR(n))) {
+
+ size_t str_idx = ptr->t == BC_RESULT_STR ? ptr->d.loc.loc : n->scale;
+
if (BC_ERR(!var)) bc_vm_err(BC_ERR_EXEC_TYPE);
- bc_program_assignStr(p, ptr, vec, true);
+
+ bc_program_assignStr(p, str_idx, vec, true);
+
return;
}
#endif // DC_ENABLED
@@ -864,7 +869,7 @@ static void bc_program_assign(BcProgram *p, uchar inst) {
}
else {
BcVec *v = bc_program_vec(p, left->d.loc.loc, BC_TYPE_VAR);
- bc_program_assignStr(p, right, v, false);
+ bc_program_assignStr(p, idx, v, false);
}
return;
@@ -1249,8 +1254,10 @@ static void bc_program_builtin(BcProgram *p, uchar inst) {
{
#if DC_ENABLED
if (!BC_PROG_NUM(opd, num)) {
+
size_t idx;
char *str;
+
idx = opd->t == BC_RESULT_STR ? opd->d.loc.loc : num->scale;
str = *((char**) bc_vec_item(p->strs, idx));
val = (BcBigDig) strlen(str);
@@ -1578,7 +1585,7 @@ err:
BC_SIG_MAYLOCK;
bc_parse_free(&prs);
f = bc_vec_item(&p->fns, fidx);
- bc_vec_npop(&f->code, f->code.len);
+ bc_vec_popAll(&f->code);
exit:
bc_vec_pop(&p->results);
BC_LONGJMP_CONT;
@@ -1714,7 +1721,6 @@ void bc_program_init(BcProgram *p) {
BcInstPtr ip;
size_t i;
- BcBigDig val = BC_BASE;
BC_SIG_ASSERT_LOCKED;
@@ -1724,8 +1730,8 @@ void bc_program_init(BcProgram *p) {
memset(&ip, 0, sizeof(BcInstPtr));
for (i = 0; i < BC_PROG_GLOBALS_LEN; ++i) {
+ BcBigDig val = i == BC_PROG_GLOBALS_SCALE ? 0 : BC_BASE;
bc_vec_init(p->globals_v + i, sizeof(BcBigDig), NULL);
- val = i == BC_PROG_GLOBALS_SCALE ? 0 : val;
bc_vec_push(p->globals_v + i, &val);
p->globals[i] = val;
}
@@ -1788,16 +1794,17 @@ void bc_program_reset(BcProgram *p) {
BC_SIG_ASSERT_LOCKED;
bc_vec_npop(&p->stack, p->stack.len - 1);
- bc_vec_npop(&p->results, p->results.len);
+ bc_vec_popAll(&p->results);
#if BC_ENABLED
if (BC_G) bc_program_popGlobals(p, true);
#endif // BC_ENABLED
f = bc_vec_item(&p->fns, BC_PROG_MAIN);
+ bc_vec_npop(&f->code, f->code.len);
ip = bc_vec_top(&p->stack);
bc_program_setVecs(p, f);
- ip->idx = f->code.len;
+ memset(ip, 0, sizeof(BcInstPtr));
if (vm.sig) {
bc_file_write(&vm.fout, bc_program_ready_msg, bc_program_ready_msg_len);
@@ -1921,6 +1928,10 @@ void bc_program_exec(BcProgram *p) {
case BC_INST_READ:
{
+ // We want to flush output before
+ // this in case there is a prompt.
+ bc_file_flush(&vm.fout);
+
bc_program_read(p);
ip = bc_vec_top(&p->stack);
@@ -2145,7 +2156,7 @@ void bc_program_exec(BcProgram *p) {
case BC_INST_CLEAR_STACK:
{
- bc_vec_npop(&p->results, p->results.len);
+ bc_vec_popAll(&p->results);
break;
}
diff --git a/contrib/bc/src/rand.c b/contrib/bc/src/rand.c
index a66728246fbc..6b2ec7bdb30f 100644
--- a/contrib/bc/src/rand.c
+++ b/contrib/bc/src/rand.c
@@ -1,34 +1,6 @@
/*
* *****************************************************************************
*
- * SPDX-License-Identifier: BSD-2-Clause
- *
- * Copyright (c) 2018-2019 Gavin D. Howard and contributors.
- *
- * 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.
- *
- * *****************************************************************************
- *
* Parts of this code are adapted from the following:
*
* PCG, A Family of Better Random Number Generators.
@@ -38,9 +10,10 @@
*
* -----------------------------------------------------------------------------
*
- * Parts of this code are also under the following license:
+ * This code is under the following license:
*
* Copyright (c) 2014-2017 Melissa O'Neill and PCG Project contributors
+ * Copyright (c) 2018-2021 Gavin D. Howard and contributors.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -179,7 +152,7 @@ static ulong bc_rand_frand(void *ptr) {
nread = read(fd, buf, sizeof(ulong));
- if (BC_ERR(nread != sizeof(ulong))) bc_vm_err(BC_ERR_FATAL_IO_ERR);
+ if (BC_ERR(nread != sizeof(ulong))) bc_vm_fatalError(BC_ERR_FATAL_IO_ERR);
return *((ulong*) buf);
}
@@ -289,6 +262,15 @@ void bc_rand_srand(BcRNGData *rng) {
bc_rand_fill(rng, bc_rand_frand, &fd);
close(fd);
}
+ else {
+
+ fd = open("/dev/random", O_RDONLY);
+
+ if (BC_NO_ERR(fd >= 0)) {
+ bc_rand_fill(rng, bc_rand_frand, &fd);
+ close(fd);
+ }
+ }
while (BC_ERR(BC_RAND_ZERO(rng))) bc_rand_fill(rng, bc_rand_rand, NULL);
diff --git a/contrib/bc/src/read.c b/contrib/bc/src/read.c
index 45e868c927da..e593b3c2dedd 100644
--- a/contrib/bc/src/read.c
+++ b/contrib/bc/src/read.c
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
- * Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+ * Copyright (c) 2018-2021 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -96,7 +96,7 @@ BcStatus bc_read_chars(BcVec *vec, const char *prompt) {
BC_SIG_ASSERT_NOT_LOCKED;
- bc_vec_npop(vec, vec->len);
+ bc_vec_popAll(vec);
#if BC_ENABLE_PROMPT
if (BC_USE_PROMPT) {
@@ -143,7 +143,7 @@ BcStatus bc_read_chars(BcVec *vec, const char *prompt) {
BC_SIG_UNLOCK;
- bc_vm_err(BC_ERR_FATAL_IO_ERR);
+ bc_vm_fatalError(BC_ERR_FATAL_IO_ERR);
}
BC_SIG_UNLOCK;
diff --git a/contrib/bc/src/vector.c b/contrib/bc/src/vector.c
index df6936aaeb76..78dddb1d30fd 100644
--- a/contrib/bc/src/vector.c
+++ b/contrib/bc/src/vector.c
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
- * Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+ * Copyright (c) 2018-2021 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -203,7 +203,7 @@ void bc_vec_string(BcVec *restrict v, size_t len, const char *restrict str) {
BC_SIG_TRYLOCK(lock);
- bc_vec_npop(v, v->len);
+ bc_vec_popAll(v);
bc_vec_expand(v, bc_vm_growSize(len, 1));
memcpy(v->v, str, len);
v->len = len;
@@ -240,7 +240,7 @@ void bc_vec_empty(BcVec *restrict v) {
BC_SIG_TRYLOCK(lock);
- bc_vec_npop(v, v->len);
+ bc_vec_popAll(v);
bc_vec_pushByte(v, '\0');
BC_SIG_TRYUNLOCK(lock);
@@ -283,7 +283,7 @@ inline void bc_vec_clear(BcVec *restrict v) {
void bc_vec_free(void *vec) {
BcVec *v = (BcVec*) vec;
BC_SIG_ASSERT_LOCKED;
- bc_vec_npop(v, v->len);
+ bc_vec_popAll(v);
free(v->v);
}
diff --git a/contrib/bc/src/vm.c b/contrib/bc/src/vm.c
index 3922b088414f..87036c7b5c91 100644
--- a/contrib/bc/src/vm.c
+++ b/contrib/bc/src/vm.c
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
- * Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+ * Copyright (c) 2018-2021 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -138,6 +138,16 @@ void bc_vm_info(const char* const help) {
}
#endif // !BC_ENABLE_LIBRARY
+#if !BC_ENABLE_LIBRARY && !BC_ENABLE_MEMCHECK
+BC_NORETURN
+#endif // !BC_ENABLE_LIBRARY && !BC_ENABLE_MEMCHECK
+void bc_vm_fatalError(BcErr e) {
+ bc_vm_err(e);
+#if !BC_ENABLE_LIBRARY && !BC_ENABLE_MEMCHECK
+ abort();
+#endif // !BC_ENABLE_LIBRARY && !BC_ENABLE_MEMCHECK
+}
+
#if BC_ENABLE_LIBRARY
void bc_vm_handleError(BcErr e) {
@@ -229,8 +239,19 @@ void bc_vm_handleError(BcErr e, size_t line, ...) {
s = bc_file_flushErr(&vm.ferr);
- vm.status = s == BC_STATUS_ERROR_FATAL ?
- (sig_atomic_t) s : (sig_atomic_t) (uchar) (id + 1);
+#if !BC_ENABLE_MEMCHECK
+ // Because this function is called by a BC_NORETURN function when fatal
+ // errors happen, we need to make sure to exit on fatal errors. This will
+ // be faster anyway. This function *cannot jump when a fatal error occurs!*
+ if (BC_ERR(id == BC_ERR_IDX_FATAL || s == BC_STATUS_ERROR_FATAL))
+ exit(bc_vm_atexit((int) BC_STATUS_ERROR_FATAL));
+#else // !BC_ENABLE_MEMCHECK
+ if (BC_ERR(s == BC_STATUS_ERROR_FATAL)) vm.status = (sig_atomic_t) s;
+ else
+#endif // !BC_ENABLE_MEMCHECK
+ {
+ vm.status = (sig_atomic_t) (uchar) (id + 1);
+ }
if (BC_ERR(vm.status)) BC_VM_JMP;
@@ -294,7 +315,7 @@ static void bc_vm_envArgs(const char* const env_args_name) {
buf = NULL;
bc_vec_push(&vm.env_args, &buf);
- bc_args((int) vm.env_args.len - 1, bc_vec_item(&vm.env_args, 0));
+ bc_args((int) vm.env_args.len - 1, bc_vec_item(&vm.env_args, 0), false);
}
static size_t bc_vm_envLen(const char *var) {
@@ -367,14 +388,14 @@ void bc_vm_freeTemps(void) {
inline size_t bc_vm_arraySize(size_t n, size_t size) {
size_t res = n * size;
if (BC_ERR(res >= SIZE_MAX || (n != 0 && res / n != size)))
- bc_vm_err(BC_ERR_FATAL_ALLOC_ERR);
+ bc_vm_fatalError(BC_ERR_FATAL_ALLOC_ERR);
return res;
}
inline size_t bc_vm_growSize(size_t a, size_t b) {
size_t res = a + b;
if (BC_ERR(res >= SIZE_MAX || res < a || res < b))
- bc_vm_err(BC_ERR_FATAL_ALLOC_ERR);
+ bc_vm_fatalError(BC_ERR_FATAL_ALLOC_ERR);
return res;
}
@@ -386,7 +407,7 @@ void* bc_vm_malloc(size_t n) {
ptr = malloc(n);
- if (BC_ERR(ptr == NULL)) bc_vm_err(BC_ERR_FATAL_ALLOC_ERR);
+ if (BC_ERR(ptr == NULL)) bc_vm_fatalError(BC_ERR_FATAL_ALLOC_ERR);
return ptr;
}
@@ -399,7 +420,7 @@ void* bc_vm_realloc(void *ptr, size_t n) {
temp = realloc(ptr, n);
- if (BC_ERR(temp == NULL)) bc_vm_err(BC_ERR_FATAL_ALLOC_ERR);
+ if (BC_ERR(temp == NULL)) bc_vm_fatalError(BC_ERR_FATAL_ALLOC_ERR);
return temp;
}
@@ -412,7 +433,7 @@ char* bc_vm_strdup(const char *str) {
s = strdup(str);
- if (BC_ERR(!s)) bc_vm_err(BC_ERR_FATAL_ALLOC_ERR);
+ if (BC_ERR(s == NULL)) bc_vm_fatalError(BC_ERR_FATAL_ALLOC_ERR);
return s;
}
@@ -477,18 +498,18 @@ static void bc_vm_clean(void) {
#if BC_ENABLED
if (BC_IS_BC) {
- bc_vec_npop(&f->labels, f->labels.len);
- bc_vec_npop(&f->strs, f->strs.len);
- bc_vec_npop(&f->consts, f->consts.len);
+ bc_vec_popAll(&f->labels);
+ bc_vec_popAll(&f->strs);
+ bc_vec_popAll(&f->consts);
}
#endif // BC_ENABLED
#if DC_ENABLED
// Note to self: you cannot delete strings and functions. Deal with it.
- if (BC_IS_DC) bc_vec_npop(vm.prog.consts, vm.prog.consts->len);
+ if (BC_IS_DC) bc_vec_popAll(vm.prog.consts);
#endif // DC_ENABLED
- bc_vec_npop(&f->code, f->code.len);
+ bc_vec_popAll(&f->code);
ip->idx = 0;
}
@@ -659,9 +680,16 @@ err:
bc_vm_clean();
+#if !BC_ENABLE_MEMCHECK
+ assert(vm.status != BC_STATUS_ERROR_FATAL);
+
+ vm.status = vm.status == BC_STATUS_QUIT || !BC_I ?
+ vm.status : BC_STATUS_SUCCESS;
+#else // !BC_ENABLE_MEMCHECK
vm.status = vm.status == BC_STATUS_ERROR_FATAL ||
vm.status == BC_STATUS_QUIT || !BC_I ?
vm.status : BC_STATUS_SUCCESS;
+#endif // !BC_ENABLE_MEMCHECK
if (!vm.status && !vm.eof) {
bc_vec_empty(&buffer);
@@ -779,7 +807,7 @@ static void bc_vm_exec(void) {
bc_vec_pushByte(&buf, '\0');
bc_vm_process(buf.v);
- bc_vec_npop(&buf, buf.len);
+ bc_vec_popAll(&buf);
} while (more);
@@ -792,7 +820,7 @@ static void bc_vm_exec(void) {
BC_SIG_UNLOCK;
- if (!vm.no_exit_exprs) return;
+ if (!vm.no_exit_exprs && vm.exit_exprs) return;
}
for (i = 0; i < vm.files.len; ++i) {
@@ -802,10 +830,14 @@ static void bc_vm_exec(void) {
bc_vm_file(path);
}
+#if BC_ENABLE_AFL
+ __AFL_INIT();
+#endif // BC_ENABLE_AFL
+
if (BC_IS_BC || !has_file) bc_vm_stdin();
// These are all protected by ifndef NDEBUG because if these are needed, bc is
-// goingi to exit anyway, and I see no reason to include this code in a release
+// going to exit anyway, and I see no reason to include this code in a release
// build when the OS is going to free all of the resources anyway.
#ifndef NDEBUG
return;
@@ -873,7 +905,7 @@ void bc_vm_boot(int argc, char *argv[], const char *env_len,
#endif // BC_ENABLED
bc_vm_envArgs(env_args);
- bc_args(argc, argv);
+ bc_args(argc, argv, true);
#if BC_ENABLED
if (BC_IS_POSIX) vm.flags &= ~(BC_FLAG_G);
@@ -917,3 +949,27 @@ void bc_vm_init(void) {
}
#endif // BC_ENABLED
}
+
+#if BC_ENABLE_LIBRARY
+void bc_vm_atexit(void) {
+
+ bc_vm_shutdown();
+
+#ifndef NDEBUG
+ bc_vec_free(&vm.jmp_bufs);
+#endif // NDEBUG
+}
+#else // BC_ENABLE_LIBRARY
+int bc_vm_atexit(int status) {
+
+ int s = BC_STATUS_IS_ERROR(status) ? status : BC_STATUS_SUCCESS;
+
+ bc_vm_shutdown();
+
+#ifndef NDEBUG
+ bc_vec_free(&vm.jmp_bufs);
+#endif // NDEBUG
+
+ return s;
+}
+#endif // BC_ENABLE_LIBRARY
diff --git a/contrib/bc/tests/afl.py b/contrib/bc/tests/afl.py
index ff3b9229c1c2..a235ee5be176 100755
--- a/contrib/bc/tests/afl.py
+++ b/contrib/bc/tests/afl.py
@@ -2,7 +2,7 @@
#
# SPDX-License-Identifier: BSD-2-Clause
#
-# Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+# Copyright (c) 2018-2021 Gavin D. Howard and contributors.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
@@ -89,6 +89,10 @@ def get_children(dir, get_files):
dirs.sort()
return dirs
+
+def exe_name(d):
+ return "bc" if d == "bc1" or d == "bc2" or d == "bc3" else "dc"
+
script = sys.argv[0]
testdir = os.path.dirname(script)
@@ -112,18 +116,26 @@ if asan:
usage()
exedir = sys.argv[idx]
+print("exedir: {}".format(exedir))
+
if len(sys.argv) >= idx + 2:
resultsdir = sys.argv[idx + 1]
else:
- if exedir == "bc":
- resultsdir = testdir + "/../../results"
+ if exedir == "bc1":
+ resultsdir = testdir + "/fuzzing/bc_outputs1"
+ elif exedir == "bc2":
+ resultsdir = testdir + "/fuzzing/bc_outputs2"
+ elif exedir == "bc3":
+ resultsdir = testdir + "/fuzzing/bc_outputs3"
else:
- resultsdir = testdir + "/../../results_dc"
+ resultsdir = testdir + "/fuzzing/dc_outputs"
+
+print("resultsdir: {}".format(resultsdir))
if len(sys.argv) >= idx + 3:
exe = sys.argv[idx + 2]
else:
- exe = testdir + "/../bin/" + exedir
+ exe = testdir + "/../bin/" + exe_name(exedir)
exebase = os.path.basename(exe)
diff --git a/contrib/bc/tests/all.sh b/contrib/bc/tests/all.sh
index 07fd346f04c5..1f745cdff079 100755
--- a/contrib/bc/tests/all.sh
+++ b/contrib/bc/tests/all.sh
@@ -2,7 +2,7 @@
#
# SPDX-License-Identifier: BSD-2-Clause
#
-# Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+# Copyright (c) 2018-2021 Gavin D. Howard and contributors.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
@@ -110,195 +110,12 @@ done < "$testdir/$d/all.txt"
sh "$testdir/stdin.sh" "$d" "$exe" "$@"
-sh "$testdir/scripts.sh" "$d" "$extra" "$run_stack_tests" "$generate_tests" "$time_tests" "$exe" "$@"
+sh "$testdir/scripts.sh" "$d" "$extra" "$run_stack_tests" "$generate_tests" \
+ "$time_tests" "$exe" "$@"
sh "$testdir/read.sh" "$d" "$exe" "$@"
sh "$testdir/errors.sh" "$d" "$exe" "$@"
-num=100000000000000000000000000000000000000000000000000000000000000000000000000000
-numres="$num"
-num70="10000000000000000000000000000000000000000000000000000000000000000000\\
-0000000000"
-
-if [ "$d" = "bc" ]; then
- halt="halt"
- opt="x"
- lopt="extended-register"
- line_var="BC_LINE_LENGTH"
-else
- halt="q"
- opt="l"
- lopt="mathlib"
- line_var="DC_LINE_LENGTH"
- num="$num pR"
-fi
-
-printf '\nRunning %s quit test...' "$d"
-
-printf '%s\n' "$halt" | "$exe" "$@" > /dev/null 2>&1
-
-if [ "$d" = bc ]; then
- printf '%s\n' "quit" | "$exe" "$@" > /dev/null 2>&1
- two=$("$exe" "$@" -e 1+1 -e quit)
- if [ "$two" != "2" ]; then
- err_exit "$d failed a quit test" 1
- fi
-fi
-
-printf 'pass\n'
-
-base=$(basename "$exe")
-
-if [ "$base" != "bc" -a "$base" != "dc" ]; then
- exit 0
-fi
-
-printf 'Running %s environment var tests...' "$d"
-
-if [ "$d" = "bc" ]; then
- export BC_ENV_ARGS=" '-l' '' -q"
- export BC_EXPR_EXIT="1"
- printf 's(.02893)\n' | "$exe" "$@" > /dev/null
- "$exe" -e 4 "$@" > /dev/null
-else
- export DC_ENV_ARGS="'-x'"
- export DC_EXPR_EXIT="1"
- printf '4s stuff\n' | "$exe" "$@" > /dev/null
- "$exe" -e 4pR "$@" > /dev/null
-fi
-
-printf 'pass\n'
-
-out1="$testdir/../.log_$d.txt"
-out2="$testdir/../.log_${d}_test.txt"
-
-printf 'Running %s line length tests...' "$d"
-
-printf '%s\n' "$numres" > "$out1"
-
-export "$line_var"=80
-printf '%s\n' "$num" | "$exe" "$@" > "$out2"
-
-diff "$out1" "$out2"
-
-printf '%s\n' "$num70" > "$out1"
-
-export "$line_var"=2147483647
-printf '%s\n' "$num" | "$exe" "$@" > "$out2"
-
-diff "$out1" "$out2"
-
-printf 'pass\n'
-
-printf 'Running %s arg tests...' "$d"
-
-f="$testdir/$d/add.txt"
-exprs=$(cat "$f")
-results=$(cat "$testdir/$d/add_results.txt")
-
-printf '%s\n%s\n%s\n%s\n' "$results" "$results" "$results" "$results" > "$out1"
-
-"$exe" "$@" -e "$exprs" -f "$f" --expression "$exprs" --file "$f" -e "$halt" > "$out2"
-
-diff "$out1" "$out2"
-
-printf '%s\n' "$halt" | "$exe" "$@" -- "$f" "$f" "$f" "$f" > "$out2"
-
-diff "$out1" "$out2"
-
-if [ "$d" = "bc" ]; then
- printf '%s\n' "$halt" | "$exe" "$@" -i > /dev/null 2>&1
-fi
-
-printf '%s\n' "$halt" | "$exe" "$@" -h > /dev/null
-printf '%s\n' "$halt" | "$exe" "$@" -P > /dev/null
-printf '%s\n' "$halt" | "$exe" "$@" -v > /dev/null
-printf '%s\n' "$halt" | "$exe" "$@" -V > /dev/null
-
-set +e
-
-"$exe" "$@" -f "saotehasotnehasthistohntnsahxstnhalcrgxgrlpyasxtsaosysxsatnhoy.txt" > /dev/null 2> "$out2"
-err="$?"
-
-checktest "$d" "$err" "invalid file argument" "$out2" "$d"
-
-"$exe" "$@" "-$opt" -e "$exprs" > /dev/null 2> "$out2"
-err="$?"
-
-checktest "$d" "$err" "invalid option argument" "$out2" "$d"
-
-"$exe" "$@" "--$lopt" -e "$exprs" > /dev/null 2> "$out2"
-err="$?"
-
-checktest "$d" "$err" "invalid long option argument" "$out2" "$d"
-
-"$exe" "$@" "-u" -e "$exprs" > /dev/null 2> "$out2"
-err="$?"
-
-checktest "$d" "$err" "unrecognized option argument" "$out2" "$d"
-
-"$exe" "$@" "--uniform" -e "$exprs" > /dev/null 2> "$out2"
-err="$?"
-
-checktest "$d" "$err" "unrecognized long option argument" "$out2" "$d"
-
-"$exe" "$@" -f > /dev/null 2> "$out2"
-err="$?"
-
-checktest "$d" "$err" "missing required argument to short option" "$out2" "$d"
-
-"$exe" "$@" --file > /dev/null 2> "$out2"
-err="$?"
-
-checktest "$d" "$err" "missing required argument to long option" "$out2" "$d"
-
-"$exe" "$@" --version=5 > /dev/null 2> "$out2"
-err="$?"
-
-checktest "$d" "$err" "given argument to long option with no argument" "$out2" "$d"
-
-printf 'pass\n'
-
-printf 'Running %s directory test...' "$d"
-
-"$exe" "$@" "$testdir" > /dev/null 2> "$out2"
-err="$?"
-
-checktest "$d" "$err" "directory" "$out2" "$d"
-
-printf 'pass\n'
-
-printf 'Running %s binary file test...' "$d"
-
-bin="/bin/sh"
-
-"$exe" "$@" "$bin" > /dev/null 2> "$out2"
-err="$?"
-
-checktest "$d" "$err" "binary file" "$out2" "$d"
-
-printf 'pass\n'
-
-printf 'Running %s binary stdin test...' "$d"
-
-cat "$bin" | "$exe" "$@" > /dev/null 2> "$out2"
-err="$?"
-
-checktest "$d" "$err" "binary stdin" "$out2" "$d"
-
-printf 'pass\n'
-
-if [ "$d" = "bc" ]; then
-
- printf 'Running %s limits tests...' "$d"
- printf 'limits\n' | "$exe" "$@" > "$out2" /dev/null 2>&1
-
- if [ ! -s "$out2" ]; then
- err_exit "$d did not produce output on the limits test" 1
- fi
-
- printf 'pass\n'
-
-fi
+sh "$testdir/other.sh" "$d" "$exe" "$@"
printf '\nAll %s tests passed.\n' "$d"
diff --git a/contrib/bc/tests/bc/all.txt b/contrib/bc/tests/bc/all.txt
index b623e8a11b71..92cfee226758 100644
--- a/contrib/bc/tests/bc/all.txt
+++ b/contrib/bc/tests/bc/all.txt
@@ -1,4 +1,7 @@
decimal
+print
+print2
+parse
length
scale
shift
@@ -22,9 +25,6 @@ engineering
globals
strings
letters
-print
-print2
-parse
exponent
log
pi
diff --git a/contrib/bc/tests/bc/length.txt b/contrib/bc/tests/bc/length.txt
index 5461f76cbf59..feb4134ffabd 100644
--- a/contrib/bc/tests/bc/length.txt
+++ b/contrib/bc/tests/bc/length.txt
@@ -1,4 +1,7 @@
length(0)
+length(0.0000)
+length(0.00000000)
+length(0.00000000000)
length(1)
length(12)
length(123)
diff --git a/contrib/bc/tests/bc/length_results.txt b/contrib/bc/tests/bc/length_results.txt
index 53a58e2be678..3501dea2a063 100644
--- a/contrib/bc/tests/bc/length_results.txt
+++ b/contrib/bc/tests/bc/length_results.txt
@@ -1,4 +1,7 @@
-0
+1
+4
+8
+11
1
2
3
diff --git a/contrib/bc/tests/bc/lib2.txt b/contrib/bc/tests/bc/lib2.txt
index 9fdf50d06141..076e62b8ea61 100644
--- a/contrib/bc/tests/bc/lib2.txt
+++ b/contrib/bc/tests/bc/lib2.txt
@@ -84,6 +84,12 @@ cbrt(27)
cbrt(-27)
cbrt(4096)
cbrt(-4096)
+root(0, 3)
+root(0, 4)
+root(0, 5)
+root(0.0000000000000, 3)
+root(0.0000000000000, 4)
+root(0.0000000000000, 5)
root(16, 4)
root(3125, 5)
root(-3125, 5)
diff --git a/contrib/bc/tests/bc/lib2_results.txt b/contrib/bc/tests/bc/lib2_results.txt
index ca5a37cfce0a..ca790604e07b 100644
--- a/contrib/bc/tests/bc/lib2_results.txt
+++ b/contrib/bc/tests/bc/lib2_results.txt
@@ -84,6 +84,12 @@
-3.00000000000000000000
16.00000000000000000000
-16.00000000000000000000
+0
+0
+0
+0
+0
+0
2.00000000000000000000
5.00000000000000000000
-5.00000000000000000000
diff --git a/contrib/bc/tests/bc/scripts/all.txt b/contrib/bc/tests/bc/scripts/all.txt
new file mode 100644
index 000000000000..16f067c13b79
--- /dev/null
+++ b/contrib/bc/tests/bc/scripts/all.txt
@@ -0,0 +1,15 @@
+print.bc
+parse.bc
+add.bc
+subtract.bc
+multiply.bc
+divide.bc
+array.bc
+atan.bc
+bessel.bc
+functions.bc
+globals.bc
+len.bc
+rand.bc
+references.bc
+screen.bc
diff --git a/contrib/bc/tests/bc/scripts/bessel.bc b/contrib/bc/tests/bc/scripts/bessel.bc
index b82eee30d19e..c2229e50bc8e 100755
--- a/contrib/bc/tests/bc/scripts/bessel.bc
+++ b/contrib/bc/tests/bc/scripts/bessel.bc
@@ -15,8 +15,9 @@ t[11] = -1.74
t[12] = -2
t[13] = -3.2345
t[14] = -100
+t[15] = 0.0000000000000000
-l = 15
+l = 16
a[0] = t[0]
@@ -30,7 +31,11 @@ l -= 1
for (i = 0; i < l; ++i) {
for (j = 0; j < l; ++j) {
- print "j(", a[i], ", ", a[j], ")\n"
+ print "j(", a[i]
+ if (a[i] == 0 && scale(a[i]) > 0) print ".0000000000000000"
+ print ", ", a[j]
+ if (a[j] == 0 && scale(a[j]) > 0) print ".0000000000000000"
+ print ")\n"
}
}
diff --git a/contrib/bc/tests/bc/timeconst.sh b/contrib/bc/tests/bc/timeconst.sh
index 32e1e743d9e4..8cdc63a90e6b 100755
--- a/contrib/bc/tests/bc/timeconst.sh
+++ b/contrib/bc/tests/bc/timeconst.sh
@@ -1,6 +1,6 @@
#! /bin/sh
#
-# Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+# Copyright (c) 2018-2021 Gavin D. Howard and contributors.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
@@ -57,6 +57,11 @@ if [ ! -f "$timeconst" ]; then
exit 0
fi
+unset BC_ENV_ARGS
+unset BC_LINE_LENGTH
+unset DC_ENV_ARGS
+unset DC_LINE_LENGTH
+
printf 'Running %s...' "$base"
nums=$(printf 'for (i = 0; i <= 1000; ++i) { i }\n' | bc)
@@ -88,4 +93,4 @@ done
rm -f "$out1"
rm -f "$out2"
-printf 'pass\n'
+exec printf 'pass\n'
diff --git a/contrib/bc/tests/bcl.c b/contrib/bc/tests/bcl.c
index aab2c5d35e9b..5157890e9bb8 100644
--- a/contrib/bc/tests/bcl.c
+++ b/contrib/bc/tests/bcl.c
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
- * Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+ * Copyright (c) 2018-2021 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
diff --git a/contrib/bc/tests/dc/all.txt b/contrib/bc/tests/dc/all.txt
index 6879541f7f1a..ec637c346ceb 100644
--- a/contrib/bc/tests/dc/all.txt
+++ b/contrib/bc/tests/dc/all.txt
@@ -1,4 +1,5 @@
decimal
+length
add
subtract
multiply
diff --git a/contrib/bc/tests/dc/errors/30.txt b/contrib/bc/tests/dc/errors/30.txt
new file mode 100644
index 000000000000..e072e71617d8
--- /dev/null
+++ b/contrib/bc/tests/dc/errors/30.txt
@@ -0,0 +1 @@
+0;0[]0:b;bs0l0x;0
diff --git a/contrib/bc/tests/dc/errors/31.txt b/contrib/bc/tests/dc/errors/31.txt
new file mode 100644
index 000000000000..9bada9d07d0e
--- /dev/null
+++ b/contrib/bc/tests/dc/errors/31.txt
@@ -0,0 +1 @@
+0;0[]0:b;bS0l0x;0
diff --git a/contrib/bc/tests/dc/length.txt b/contrib/bc/tests/dc/length.txt
new file mode 100644
index 000000000000..daa960bed23b
--- /dev/null
+++ b/contrib/bc/tests/dc/length.txt
@@ -0,0 +1,129 @@
+0ZpR
+0.0000ZpR
+0.00000000ZpR
+0.00000000000ZpR
+1ZpR
+12ZpR
+123ZpR
+1234ZpR
+12345ZpR
+123456ZpR
+1234567ZpR
+12345678ZpR
+123456789ZpR
+1234567890ZpR
+1.0ZpR
+12.0ZpR
+123.0ZpR
+1234.0ZpR
+12345.0ZpR
+123456.0ZpR
+1234567.0ZpR
+12345678.0ZpR
+123456789.0ZpR
+1234567890.0ZpR
+.1ZpR
+.12ZpR
+.123ZpR
+.1234ZpR
+.12345ZpR
+.123456ZpR
+.1234567ZpR
+.12345678ZpR
+.123456789ZpR
+.1234567890ZpR
+.01ZpR
+.012ZpR
+.0123ZpR
+.01234ZpR
+.012345ZpR
+.0123456ZpR
+.01234567ZpR
+.012345678ZpR
+.0123456789ZpR
+.01234567890ZpR
+.001ZpR
+.0012ZpR
+.00123ZpR
+.001234ZpR
+.0012345ZpR
+.00123456ZpR
+.001234567ZpR
+.0012345678ZpR
+.00123456789ZpR
+.001234567890ZpR
+.0001ZpR
+.00012ZpR
+.000123ZpR
+.0001234ZpR
+.00012345ZpR
+.000123456ZpR
+.0001234567ZpR
+.00012345678ZpR
+.000123456789ZpR
+.0001234567890ZpR
+.00001ZpR
+.000012ZpR
+.0000123ZpR
+.00001234ZpR
+.000012345ZpR
+.0000123456ZpR
+.00001234567ZpR
+.000012345678ZpR
+.0000123456789ZpR
+.00001234567890ZpR
+.000001ZpR
+.0000012ZpR
+.00000123ZpR
+.000001234ZpR
+.0000012345ZpR
+.00000123456ZpR
+.000001234567ZpR
+.0000012345678ZpR
+.00000123456789ZpR
+.000001234567890ZpR
+.0000001ZpR
+.00000012ZpR
+.000000123ZpR
+.0000001234ZpR
+.00000012345ZpR
+.000000123456ZpR
+.0000001234567ZpR
+.00000012345678ZpR
+.000000123456789ZpR
+.0000001234567890ZpR
+.00000001ZpR
+.000000012ZpR
+.0000000123ZpR
+.00000001234ZpR
+.000000012345ZpR
+.0000000123456ZpR
+.00000001234567ZpR
+.000000012345678ZpR
+.0000000123456789ZpR
+.00000001234567890ZpR
+.000000001ZpR
+.0000000012ZpR
+.00000000123ZpR
+.000000001234ZpR
+.0000000012345ZpR
+.00000000123456ZpR
+.000000001234567ZpR
+.0000000012345678ZpR
+.00000000123456789ZpR
+.000000001234567890ZpR
+.0000000001ZpR
+.00000000012ZpR
+.000000000123ZpR
+.0000000001234ZpR
+.00000000012345ZpR
+.000000000123456ZpR
+.0000000001234567ZpR
+.00000000012345678ZpR
+.000000000123456789ZpR
+.0000000001234567890ZpR
+289.29837ZpR
+2893.00000ZpR
+289.0ZpR
+1802973.0000000238ZpR
+.000000000000000093182394080000000000ZpR
diff --git a/contrib/bc/tests/dc/length_results.txt b/contrib/bc/tests/dc/length_results.txt
new file mode 100644
index 000000000000..3a79696e38b7
--- /dev/null
+++ b/contrib/bc/tests/dc/length_results.txt
@@ -0,0 +1,129 @@
+1
+4
+8
+11
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+8
+9
+4
+17
+20
diff --git a/contrib/bc/tests/dc/scripts/all.txt b/contrib/bc/tests/dc/scripts/all.txt
new file mode 100644
index 000000000000..e15dae5e15ff
--- /dev/null
+++ b/contrib/bc/tests/dc/scripts/all.txt
@@ -0,0 +1,9 @@
+prime.dc
+asciify.dc
+stream.dc
+array.dc
+else.dc
+factorial.dc
+loop.dc
+quit.dc
+weird.dc
diff --git a/contrib/bc/tests/diff.sh b/contrib/bc/tests/diff.sh
new file mode 100755
index 000000000000..6d664a8a81b8
--- /dev/null
+++ b/contrib/bc/tests/diff.sh
@@ -0,0 +1,51 @@
+#! /bin/sh
+#
+# SPDX-License-Identifier: BSD-2-Clause
+#
+# Copyright (c) 2018-2021 Gavin D. Howard and contributors.
+#
+# 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.
+#
+
+set -e
+
+script="$0"
+
+testdir=$(dirname "$script")
+
+if [ "$#" -lt 2 ]; then
+ printf 'usage: %s dir test\n' "$0"
+ printf 'valid dirs are:\n'
+ printf '\n'
+ cat "$testdir/all.txt"
+ printf '\n'
+ exit 1
+fi
+
+d="$1"
+shift
+
+t="$1"
+shift
+
+exec diff "$testdir/$d/${t}_results.txt" "$testdir/${d}_outputs/${t}_results.txt"
diff --git a/contrib/bc/tests/errors.sh b/contrib/bc/tests/errors.sh
index 17c84ca24ef3..4654aed2f970 100755
--- a/contrib/bc/tests/errors.sh
+++ b/contrib/bc/tests/errors.sh
@@ -2,7 +2,7 @@
#
# SPDX-License-Identifier: BSD-2-Clause
#
-# Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+# Copyright (c) 2018-2021 Gavin D. Howard and contributors.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
@@ -49,7 +49,17 @@ else
shift
fi
-out="$testdir/../.log_${d}_test.txt"
+unset BC_ENV_ARGS
+unset BC_LINE_LENGTH
+unset DC_ENV_ARGS
+unset DC_LINE_LENGTH
+
+out="$testdir/${d}_outputs/errors_results.txt"
+outdir=$(dirname "$out")
+
+if [ ! -d "$outdir" ]; then
+ mkdir -p "$outdir"
+fi
exebase=$(basename "$exe")
@@ -83,7 +93,7 @@ for testfile in $testdir/$d/*errors.txt; do
die "$d" "returned an error ($err)" "POSIX warning" 1
fi
- checktest "$d" "1" "$line" "$out" "$exebase"
+ checkerrtest "$d" "1" "$line" "$out" "$exebase"
options="-ls"
else
@@ -101,7 +111,7 @@ for testfile in $testdir/$d/*errors.txt; do
printf '%s\n' "$line" | "$exe" "$@" "$options" 2> "$out" > /dev/null
err="$?"
- checktest "$d" "$err" "$line" "$out" "$exebase"
+ checkerrtest "$d" "$err" "$line" "$out" "$exebase"
done < "$testfile"
@@ -116,7 +126,7 @@ for testfile in $testdir/$d/errors/*.txt; do
printf '%s\n' "$halt" | "$exe" "$@" $opts "$testfile" 2> "$out" > /dev/null
err="$?"
- checktest "$d" "$err" "$testfile" "$out" "$exebase"
+ checkerrtest "$d" "$err" "$testfile" "$out" "$exebase"
printf 'pass\n'
diff --git a/contrib/bc/tests/extra_required.txt b/contrib/bc/tests/extra_required.txt
new file mode 100644
index 000000000000..a87a9a0aacf2
--- /dev/null
+++ b/contrib/bc/tests/extra_required.txt
@@ -0,0 +1,7 @@
+engineering
+lib2
+places
+rand
+scientific
+shift
+trunc
diff --git a/contrib/bc/tests/fuzzing/bc.dict b/contrib/bc/tests/fuzzing/bc.dict
new file mode 100644
index 000000000000..f4dc965844e1
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/bc.dict
@@ -0,0 +1,68 @@
+#
+# SPDX-License-Identifier: BSD-2-Clause
+#
+# Copyright (c) 2018-2021 Gavin D. Howard and contributors.
+#
+# 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.
+#
+# AFL dictionary for bc
+#
+
+keyword_abs="abs"
+keyword_auto="auto"
+keyword_break="break"
+keyword_continue="continue"
+keyword_define="define"
+keyword_else="else"
+keyword_for="for"
+keyword_halt="halt"
+keyword_ibase="ibase"
+keyword_if="if"
+keyword_irand="irand"
+keyword_last="last"
+keyword_length="length"
+keyword_limits="limits"
+keyword_maxibase="maxibase"
+keyword_maxobase="maxobase"
+keyword_maxrand="maxrand"
+keyword_maxscale="maxscale"
+keyword_obase="obase"
+keyword_print="print"
+keyword_quit="quit"
+keyword_rand="rand"
+keyword_read="read"
+keyword_return="return"
+keyword_scale="scale"
+keyword_seed="seed"
+keyword_sqrt="sqrt"
+keyword_while="while"
+
+"{"
+"}"
+","
+"["
+"]"
+"1"
+"1.234"
+"-3.2892"
+"3e4"
diff --git a/contrib/bc/tests/fuzzing/bc_inputs1/abs.txt b/contrib/bc/tests/fuzzing/bc_inputs1/abs.txt
new file mode 100644
index 000000000000..ffb7aba65c3b
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/bc_inputs1/abs.txt
@@ -0,0 +1,7 @@
+abs(0)
+abs(1)
+abs(.289365)
+abs(289.82937658)
+abs(-19)
+abs(-.2098180)
+abs(-198289.1098376)
diff --git a/contrib/bc/tests/fuzzing/bc_inputs1/add.txt b/contrib/bc/tests/fuzzing/bc_inputs1/add.txt
new file mode 100644
index 000000000000..647781732c63
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/bc_inputs1/add.txt
@@ -0,0 +1,146 @@
+0 + 0
+0 + 1
+1 + 1
+1 + 0
+2 + 5
+237 + 483
+999 + 999
+2374623 + 324869356734856
+2378639084586723980562 + 23468729367839
+37298367203972395108367910823465293084561329084561390845613409516734503870691837451 + 785621394067928346918023476190834672198467134908618723249671349062187346898241093486139046139084613490817356023871869102746182749061872609129847
+1.1 + 0
+0 + 1.1
+457283.731284923576 + 37842934672834.3874629385672354
+1.0 + 0.1
+3746289134067138046 + 0.138375863945672398456712389456273486293
+-1 + -1
+-4 + -15
+-1346782 + -1287904651762468913476
+99999999999999999999999999999999999999999999999999999999999.999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999 + 0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001
+99999999999999999999999999999999999999999999999999999999999.999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999995 + 0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005
+99999999999999999999999999999999999999999999999999999999999.999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999 + 0.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001
+99999999999999999999999999999999999999999999999999999999999.999999999999999999999999999999999999999999999999999999999899999999999999999999999999999999999999999999999999999999999999 + 0.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001
+99999999999999999999999999999999999989999999999999999999999.999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999 + 0.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001
+-1889985797 + 2012747315
+0 + -14338.391079082
+-2422297 + 1.3134942556
+182039471029834 + 282039471029834
+282039471029834 + 182039471029834
+182039471029834.2801722893 + 282039471029834
+282039471029834.2801722893 + 182039471029834
+182039471029834.2801722893 + 282039471029834.2838
+282039471029834.2801722893 + 182039471029834.2838
+182039471029834 + 282039471029834.2801722893
+282039471029834 + 182039471029834.2801722893
+182039471029834.8297282893 + 282039471029834.2801722893
+282039471029834.8297282893 + 182039471029834.2801722893
+471029834 + 282039471029834
+471029834 + 182039471029834
+471029834.2801722893 + 282039471029834
+471029834.2801722893 + 182039471029834
+471029834.2801722893 + 282039471029834.2838
+471029834.2801722893 + 182039471029834.2838
+471029834 + 282039471029834.2801722893
+471029834 + 182039471029834.2801722893
+471029834.8297282893 + 282039471029834.2801722893
+471029834.8297282893 + 182039471029834.2801722893
+182039471029834 + 471029834
+282039471029834 + 471029834
+182039471029834.2801722893 + 471029834
+282039471029834.2801722893 + 471029834
+182039471029834.2801722893 + 471029834.2838
+282039471029834.2801722893 + 471029834.2838
+182039471029834 + 471029834.2801722893
+282039471029834 + 471029834.2801722893
+182039471029834.8297282893 + 471029834.2801722893
+282039471029834.8297282893 + 471029834.2801722893
+-182039471029834 + 282039471029834
+-282039471029834 + 182039471029834
+-182039471029834.2801722893 + 282039471029834
+-282039471029834.2801722893 + 182039471029834
+-182039471029834.2801722893 + 282039471029834.2838
+-282039471029834.2801722893 + 182039471029834.2838
+-182039471029834 + 282039471029834.2801722893
+-282039471029834 + 182039471029834.2801722893
+-182039471029834.8297282893 + 282039471029834.2801722893
+-282039471029834.8297282893 + 182039471029834.2801722893
+-471029834 + 282039471029834
+-471029834 + 182039471029834
+-471029834.2801722893 + 282039471029834
+-471029834.2801722893 + 182039471029834
+-471029834.2801722893 + 282039471029834.2838
+-471029834.2801722893 + 182039471029834.2838
+-471029834 + 282039471029834.2801722893
+-471029834 + 182039471029834.2801722893
+-471029834.8297282893 + 282039471029834.2801722893
+-471029834.8297282893 + 182039471029834.2801722893
+-182039471029834 + 471029834
+-282039471029834 + 471029834
+-182039471029834.2801722893 + 471029834
+-282039471029834.2801722893 + 471029834
+-182039471029834.2801722893 + 471029834.2838
+-282039471029834.2801722893 + 471029834.2838
+-182039471029834 + 471029834.2801722893
+-282039471029834 + 471029834.2801722893
+-182039471029834.8297282893 + 471029834.2801722893
+-282039471029834.8297282893 + 471029834.2801722893
+182039471029834 + -282039471029834
+282039471029834 + -182039471029834
+182039471029834.2801722893 + -282039471029834
+282039471029834.2801722893 + -182039471029834
+182039471029834.2801722893 + -282039471029834.2838
+282039471029834.2801722893 + -182039471029834.2838
+182039471029834 + -282039471029834.2801722893
+282039471029834 + -182039471029834.2801722893
+182039471029834.8297282893 + -282039471029834.2801722893
+282039471029834.8297282893 + -182039471029834.2801722893
+471029834 + -282039471029834
+471029834 + -182039471029834
+471029834.2801722893 + -282039471029834
+471029834.2801722893 + -182039471029834
+471029834.2801722893 + -282039471029834.2838
+471029834.2801722893 + -182039471029834.2838
+471029834 + -282039471029834.2801722893
+471029834 + -182039471029834.2801722893
+471029834.8297282893 + -282039471029834.2801722893
+471029834.8297282893 + -182039471029834.2801722893
+182039471029834 + -471029834
+282039471029834 + -471029834
+182039471029834.2801722893 + -471029834
+282039471029834.2801722893 + -471029834
+182039471029834.2801722893 + -471029834.2838
+282039471029834.2801722893 + -471029834.2838
+182039471029834 + -471029834.2801722893
+282039471029834 + -471029834.2801722893
+182039471029834.8297282893 + -471029834.2801722893
+282039471029834.8297282893 + -471029834.2801722893
+-182039471029834 + -282039471029834
+-282039471029834 + -182039471029834
+-182039471029834.2801722893 + -282039471029834
+-282039471029834.2801722893 + -182039471029834
+-182039471029834.2801722893 + -282039471029834.2838
+-282039471029834.2801722893 + -182039471029834.2838
+-182039471029834 + -282039471029834.2801722893
+-282039471029834 + -182039471029834.2801722893
+-182039471029834.8297282893 + -282039471029834.2801722893
+-282039471029834.8297282893 + -182039471029834.2801722893
+-471029834 + -282039471029834
+-471029834 + -182039471029834
+-471029834.2801722893 + -282039471029834
+-471029834.2801722893 + -182039471029834
+-471029834.2801722893 + -282039471029834.2838
+-471029834.2801722893 + -182039471029834.2838
+-471029834 + -282039471029834.2801722893
+-471029834 + -182039471029834.2801722893
+-471029834.8297282893 + -282039471029834.2801722893
+-471029834.8297282893 + -182039471029834.2801722893
+-182039471029834 + -471029834
+-282039471029834 + -471029834
+-182039471029834.2801722893 + -471029834
+-282039471029834.2801722893 + -471029834
+-182039471029834.2801722893 + -471029834.2838
+-282039471029834.2801722893 + -471029834.2838
+-182039471029834 + -471029834.2801722893
+-282039471029834 + -471029834.2801722893
+-182039471029834.8297282893 + -471029834.2801722893
+-282039471029834.8297282893 + -471029834.2801722893
diff --git a/contrib/bc/tests/fuzzing/bc_inputs1/arctangent.txt b/contrib/bc/tests/fuzzing/bc_inputs1/arctangent.txt
new file mode 100644
index 000000000000..f665ea90b728
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/bc_inputs1/arctangent.txt
@@ -0,0 +1,26 @@
+a(.267)
+a(1)
+scale = 64
+a(.267)
+a(1)
+scale = 100
+a(.267)
+a(1)
+scale = 20
+a(0)
+a(.5)
+a(0.577350269189625764509148780501)
+a(1.5)
+a(1.7320508075688772935274463415)
+a(2)
+a(3)
+a(1000)
+a(-.5)
+a(-0.577350269189625764509148780501)
+a(-1.5)
+a(-1.7320508075688772935274463415)
+a(-2)
+a(-3)
+a(-1000)
+a(-3249917614.2821897119)
+a(-694706362.1974670468)
diff --git a/contrib/bc/tests/fuzzing/bc_inputs1/array.bc b/contrib/bc/tests/fuzzing/bc_inputs1/array.bc
new file mode 100755
index 000000000000..dac232804914
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/bc_inputs1/array.bc
@@ -0,0 +1,60 @@
+#! /usr/bin/bc -q
+
+define z(a[]) {
+ for (i = 0; i < l; ++i) {
+ a[i]
+ }
+}
+
+define x(a[]) {
+
+ # Test for separate vars and arrays.
+ auto a
+
+ for (a = 0; a < l; ++a) {
+ a[a] = -a
+ }
+
+ z(a[])
+}
+
+define g(x[], y[]) {
+ return x[0] - y[0]
+}
+
+define h(y[], x[]) {
+ return g(x[], y[])
+}
+
+define m(*x[], *y[]) {
+ return x[0] / y[0]
+}
+
+define n(*y[], *x[]) {
+ return m(x[], y[])
+}
+
+for (i = 0; i < 101; ++i) {
+ a[i] = i
+}
+
+a[104] = 204
+
+l = length(a[])
+
+for (i = 0; i <= l; ++i) {
+ a[i]
+}
+
+z(a[])
+x(a[])
+z(a[])
+l
+
+x[0] = 5
+y[0] = 4
+
+h(x[], y[])
+n(x[], y[])
+
+halt
diff --git a/contrib/bc/tests/fuzzing/bc_inputs1/arrays.txt b/contrib/bc/tests/fuzzing/bc_inputs1/arrays.txt
new file mode 100644
index 000000000000..26a284b8d814
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/bc_inputs1/arrays.txt
@@ -0,0 +1,10 @@
+a[0] = 1
+a[2-1] = 2
+
+a[0]+a[0]
+
+a[2-1]+a[2-1]
+
+a[5] = 2
+a[5.789]
+
diff --git a/contrib/bc/tests/fuzzing/bc_inputs1/assignments.txt b/contrib/bc/tests/fuzzing/bc_inputs1/assignments.txt
new file mode 100644
index 000000000000..6a776e7840ec
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/bc_inputs1/assignments.txt
@@ -0,0 +1,122 @@
+define x(x) {
+ return (i++ + x)
+}
+define y(x) {
+ return (++i + x)
+}
+define z(x) {
+ return (i *= 2) + x
+}
+
+i++
+i--
+++i
+--i
+
+(i++)
+(i--)
+(++i)
+(--i)
+
+i += 1
+i
+i -= -4
+i
+i *= 5
+i
+i /= 12.5
+i
+
+i = 0
+
+(i += 1)
+(i -= -4)
+(i *= 5)
+(i /= 12.5)
+
+i = 0
+
+a[i++] += ++i
+i--
+i--
+i
+a[i]
+
+a[i]++
+a[i]--
+++a[i]
+--a[i]
+
+i += 4
+i
+
+sqrt(i *= 4)
+i
+length(i /= 2)
+i
+
+i = 4
+scale(i /= 2)
+i
+
+i = -1
+
+abs(i--)
+abs(--i)
+abs(++i)
+abs(i++)
+
+i = -i
+
+a = 4
+
+x(a)
+i
+
+x(a *= 5)
+a
+i
+
+a = 4
+
+y(a)
+i
+
+y(a -= 2)
+a
+i
+
+a = 4
+
+z(a)
+i
+
+z(a /= 0.5)
+a
+i
+
+i = 1
+
+if (i -= 1) print "true\n"
+else print "false\n"
+
+if (i += 1) print "true\n"
+else print "false\n"
+
+i = 3
+
+while (i -= 2) print "i: ", i += 1, "\n"
+
+a = 5
+
+for (i = 5; i-= 1; --a) print "i: ", i, "; a: ", a, "\n"
+
+define void t(x, y) {
+ print "x: ", x, "; y: ", y, "\n"
+}
+
+t(i++, i++)
+i
+
+t(++i, ++i)
+i
diff --git a/contrib/bc/tests/fuzzing/bc_inputs1/basic.txt b/contrib/bc/tests/fuzzing/bc_inputs1/basic.txt
new file mode 100644
index 000000000000..f3d957a26635
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/bc_inputs1/basic.txt
@@ -0,0 +1,7 @@
+scale=10;123981239.981273987 * 12983791827398.29836472638
+scale=100;759634576394.3946587934658364895 / 9834759834895386.36459364958346
+34895734986539489834759837489573498573.398475984759837485734987598345 + 9823749832749872384234872934.28347982374987239847982374
+a=123123123.987239874; b=123123123.239479823748; a+b
+20347023.23498723984 - 28934723874.234720384
+scale=100;a=739534985.895347284957;b=238746782364.2374623784; c = a / b; c+0
+
diff --git a/contrib/bc/tests/fuzzing/bc_inputs1/boolean.txt b/contrib/bc/tests/fuzzing/bc_inputs1/boolean.txt
new file mode 100644
index 000000000000..e26ded34bd1d
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/bc_inputs1/boolean.txt
@@ -0,0 +1,184 @@
+!0
+!1
+!(-129)
+4 && 5
+4 && 0
+0 && 5
+4 && 5 && 7
+4 && 0 && 7
+0 && 5 && 7
+4 && 5 && 0
+0 && 0 && 7
+4 && 0 && 0
+0 && 5 && 0
+!4 && 5
+!4 && 0
+!0 && 5
+4 && !5
+4 && !0
+0 && !5
+!4 && 5 && 7
+!4 && 0 && 7
+!0 && 5 && 7
+!4 && 5 && 0
+!0 && 0 && 7
+!4 && 0 && 0
+!0 && 5 && 0
+4 && !5 && 7
+4 && !0 && 7
+0 && !5 && 7
+4 && !5 && 0
+0 && !0 && 7
+4 && !0 && 0
+0 && !5 && 0
+4 && 5 && !7
+4 && 0 && !7
+0 && 5 && !7
+4 && 5 && !0
+0 && 0 && !7
+4 && 0 && !0
+0 && 5 && !0
+!4 && !5 && 7
+!4 && !0 && 7
+!0 && !5 && 7
+!4 && !5 && 0
+!0 && !0 && 7
+!4 && !0 && 0
+!0 && !5 && 0
+!4 && 5 && !7
+!4 && 0 && !7
+!0 && 5 && !7
+!4 && 5 && !0
+!0 && 0 && !7
+!4 && 0 && !0
+!0 && 5 && !0
+4 && !5 && !7
+4 && !0 && !7
+0 && !5 && !7
+4 && !5 && !0
+0 && !0 && !7
+4 && !0 && !0
+0 && !5 && !0
+!4 && !5 && !7
+!4 && !0 && !7
+!0 && !5 && !7
+!4 && !5 && !0
+!0 && !0 && !7
+!4 && !0 && !0
+!0 && !5 && !0
+3 < 4 && 7
+3 && 4 >= 4
+3 > 4 && 7
+3 && 4 >= 5
+3 < 4 && 0
+0 && 4 >= 4
+3 > 4 && 0
+0 && 4 >= 5
+3 > 4 && 0
+0 && 4 < 4
+3 >= 4 && 0
+0 && 4 >= 5
+3 < 4 && 7
+3 && 4 >= 4
+3 > 4 && 7 > 4
+3 >= 2 && 4 >= 5
+3 < 4 && 0 > -1
+4 < 3 && 4 >= 4
+3 > 4 && 3 == 3
+3 != 3 && 4 >= 5
+3 > 4 && 0 > 1
+0 >= 0 && 4 < 4
+3 >= 4 && 0 >= 1
+0 <= -1 && 4 >= 5
+4 || 5
+4 || 0
+0 || 5
+4 || 5 || 7
+4 || 0 || 7
+0 || 5 || 7
+4 || 5 || 0
+0 || 0 || 7
+4 || 0 || 0
+0 || 5 || 0
+!4 || 5
+!4 || 0
+!0 || 5
+4 || !5
+4 || !0
+0 || !5
+!4 || 5 || 7
+!4 || 0 || 7
+!0 || 5 || 7
+!4 || 5 || 0
+!0 || 0 || 7
+!4 || 0 || 0
+!0 || 5 || 0
+4 || !5 || 7
+4 || !0 || 7
+0 || !5 || 7
+4 || !5 || 0
+0 || !0 || 7
+4 || !0 || 0
+0 || !5 || 0
+4 || 5 || !7
+4 || 0 || !7
+0 || 5 || !7
+4 || 5 || !0
+0 || 0 || !7
+4 || 0 || !0
+0 || 5 || !0
+!4 || !5 || 7
+!4 || !0 || 7
+!0 || !5 || 7
+!4 || !5 || 0
+!0 || !0 || 7
+!4 || !0 || 0
+!0 || !5 || 0
+!4 || 5 || !7
+!4 || 0 || !7
+!0 || 5 || !7
+!4 || 5 || !0
+!0 || 0 || !7
+!4 || 0 || !0
+!0 || 5 || !0
+4 || !5 || !7
+4 || !0 || !7
+0 || !5 || !7
+4 || !5 || !0
+0 || !0 || !7
+4 || !0 || !0
+0 || !5 || !0
+!4 || !5 || !7
+!4 || !0 || !7
+!0 || !5 || !7
+!4 || !5 || !0
+!0 || !0 || !7
+!4 || !0 || !0
+!0 || !5 || !0
+3 < 4 || 7
+3 || 4 >= 4
+3 > 4 || 7
+3 || 4 >= 5
+3 < 4 || 0
+0 || 4 >= 4
+3 > 4 || 0
+0 || 4 >= 5
+3 > 4 || 0
+0 || 4 < 4
+3 >= 4 || 0
+0 || 4 >= 5
+3 < 4 || 7
+3 || 4 >= 4
+3 > 4 || 7 > 4
+3 >= 2 || 4 >= 5
+3 < 4 || 0 > -1
+4 < 3 || 4 >= 4
+3 > 4 || 3 == 3
+3 != 3 || 4 >= 5
+3 > 4 || 0 > 1
+0 >= 0 || 4 < 4
+3 >= 4 || 0 >= 1
+0 <= -1 || 4 >= 5
+1 <= 0 && 1 <= 2 || 1 >= 0 && 1 == 2
+1 <= 0 && 1 <= 2 || 1 >= 0 && 1 != 2
+1 >= 0 && 1 <= 2 || 1 >= 0 && 1 == 2
diff --git a/contrib/bc/tests/fuzzing/bc_inputs1/cosine.txt b/contrib/bc/tests/fuzzing/bc_inputs1/cosine.txt
new file mode 100644
index 000000000000..9e67df4c6f69
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/bc_inputs1/cosine.txt
@@ -0,0 +1,44 @@
+scale = 25
+p = 4 * a(1)
+scale = 20
+c(0)
+c(0.5)
+c(1)
+c(2)
+c(3)
+c(-0.5)
+c(-1)
+c(-2)
+c(-3)
+c(p / 7)
+c(-p / 7)
+c(p / 4)
+c(-p / 4)
+c(p / 3)
+c(-p / 3)
+c(p / 2)
+c(-p / 2)
+c(3 * p / 4)
+c(3 * -p / 4)
+c(p)
+c(-p)
+c(3 * p / 2)
+c(3 * -p / 2)
+c(7 * p / 4)
+c(7 * -p / 4)
+c(13 * p / 4)
+c(13 * -p / 4)
+c(2 * p)
+c(2 * -p)
+c(131231)
+c(-131231)
+c(859799894.3562378245)
+c(859799894.3562378245)
+c(4307371)
+c(3522556.3323810191)
+c(44961070)
+c(6918619.1574479809)
+c(190836996.2180244164)
+c(34934)
+c(2483599)
+c(13720376)
diff --git a/contrib/bc/tests/fuzzing/bc_inputs1/decimal.txt b/contrib/bc/tests/fuzzing/bc_inputs1/decimal.txt
new file mode 100644
index 000000000000..5c6bd327c1a8
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/bc_inputs1/decimal.txt
@@ -0,0 +1,35 @@
+0
+0.0
+000000000000000000000000.00000000000000000000000
+000000000000000000000000000135482346782356
+000000000000000000000000002
+1
+11
+123
+7505
+1023468723275435238491972521917846
+4343472432431705867392073517038270398027352709027389273920739037937960379637893607893607893670530278200795207952702873892786172916728961783907893607418973587857386079679267926737520730925372983782793652793
+-1
+-203
+-57
+-18586
+-31378682943772818461924738352952347258
+-823945628745673589495067238723986520375698237620834674509627345273096287563846592384526349872634895763257893467523987578690283762897568459072348758071071087813501875908127359018715023841710239872301387278
+.123521346523546
+0.1245923756273856
+-.1024678456387
+-0.8735863475634587
+4.0
+-6.0
+234237468293576.000000000000000000000000000000
+23987623568943567.00000000000000000005677834650000000000000
+23856934568940675.000000000000000435676782300000000000000456784
+77567648698496.000000000000000000587674750000000000458563800000000000000
+2348672354968723.2374823546000000000003256987394502346892435623870000000034578
+-2354768.000000000000000000000000000000000000
+-96739874567.000000000347683456
+-3764568345.000000000004573845000000347683460
+-356784356.934568495770004586495678300000000
+74325437345273852773827101738273127312738521733017537073520735207307570358738257390761276072160719802671980267018728630178.7082681027680521760217867841276127681270867827821768173178207830710978017738178678012767377058785378278207385237085237803278203782037237582795870
+-756752732785273851273728537852738257837283678965738527385272983678372867327835672967385278372637862738627836279863782673862783670.71738178361738718367186378610738617836781603760178367018603760178107735278372832783728367826738627836278378260736270367362073867097307925
+9812734012837410982345719208345712908357412903587192048571920458712.23957182459817249058172945781
diff --git a/contrib/bc/tests/fuzzing/bc_inputs1/divide.txt b/contrib/bc/tests/fuzzing/bc_inputs1/divide.txt
new file mode 100644
index 000000000000..4d0caddc9b52
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/bc_inputs1/divide.txt
@@ -0,0 +1,31 @@
+0 / 1
+0 / 321566
+0 / 0.3984567238456
+1 / 1
+1 / 1287469297356
+1 / 0.2395672438567234
+1 / 237586239856.0293596728392360
+1249687284356 / 3027949207835207
+378617298617396719 / 35748521
+9348576237845624358 / 0.9857829375461
+35768293846193284 / 2374568947.045762839567823
+-78987234567812345 / 876542837618936
+-356789237555535468 / 0.3375273860984786903
+-5203475364850390 / 435742903748307.70869378534043296404530458
+-0.37861723347576903 / 7385770896
+-0.399454682043962 / 0.34824389304
+-0.6920414523873204 / 356489645223.76076045304879030
+-35872917389671.7573280963748 / 73924708
+-78375896314.4836709876983 / 0.78356798637817
+-2374123896417.143789621437581 / 347821469423789.1473856783960
+-896729350238549726 / -34976289345762
+-2374568293458762348596 / -0.8792370647234987679
+-237584692306721845726038 / -21783910782374529637.978102738746189024761
+-0.23457980123576298375682 / -1375486293874612
+-0.173897061862478951264 / -0.8179327486017634987516298745
+-0.9186739823576829347586 / -0.235678293458756239846
+-0.9375896183746982374568 / -13784962873546.0928729395476283745
+-2930754618923467.12323745862937465 / -734869238465
+-23745861923467.874675129834675 / -0.23542357869124756
+-3878923750692883.7238596702834756902 / -7384192674957215364986723.9738461923487621983
+1 / 0.00000000000000000000000000000000000000000002346728372937352457354204563027
diff --git a/contrib/bc/tests/fuzzing/bc_inputs1/engineering.txt b/contrib/bc/tests/fuzzing/bc_inputs1/engineering.txt
new file mode 100644
index 000000000000..cf9c0c1b0117
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/bc_inputs1/engineering.txt
@@ -0,0 +1,19 @@
+obase=1
+0
+1
+-34
+298
+-8933
+29488
+-148232
+8927559
+.2
+-.02
+.002
+-.0003
+.0000209310
+-.00000289362
+.000000859289
+-.02983672
+.20201296
+-.8907210897000000000000000000
diff --git a/contrib/bc/tests/fuzzing/bc_inputs1/exponent.txt b/contrib/bc/tests/fuzzing/bc_inputs1/exponent.txt
new file mode 100644
index 000000000000..40bcf3c5a585
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/bc_inputs1/exponent.txt
@@ -0,0 +1,22 @@
+e(0)
+e(0.5)
+e(1)
+e(1.5)
+e(1.74)
+e(2)
+e(3.2345)
+e(5.283957)
+e(13.23857)
+e(100)
+e(283.238957)
+e(-0.5)
+e(-1)
+e(-1.5)
+e(-1.74)
+e(-2)
+e(-3.2345)
+e(-5.283957)
+e(-13.23857)
+e(-100)
+e(-283.238957)
+e(142.749502399)
diff --git a/contrib/bc/tests/fuzzing/bc_inputs1/functions.bc b/contrib/bc/tests/fuzzing/bc_inputs1/functions.bc
new file mode 100644
index 000000000000..80d6d1623d8d
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/bc_inputs1/functions.bc
@@ -0,0 +1,7 @@
+e(0.5)
+
+define e(x) {
+ return x
+}
+
+e(0.5)
diff --git a/contrib/bc/tests/fuzzing/bc_inputs1/functions.txt b/contrib/bc/tests/fuzzing/bc_inputs1/functions.txt
new file mode 100644
index 000000000000..5e540ed66a11
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/bc_inputs1/functions.txt
@@ -0,0 +1,13 @@
+define x(x, y) {
+ return x - y + 5
+}
+
+define y(y, x) {
+ return x(y, x) + x(x, y)
+}
+
+y(1, 4)
+y(2, 4)
+y(3, 4)
+y(4, 3)
+y(3, 2)
diff --git a/contrib/bc/tests/fuzzing/bc_inputs1/globals.txt b/contrib/bc/tests/fuzzing/bc_inputs1/globals.txt
new file mode 100644
index 000000000000..4b20f5725864
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/bc_inputs1/globals.txt
@@ -0,0 +1,21 @@
+define i(x) {
+ ibase=x
+ return ibase
+}
+
+define o(x) {
+ obase=x
+ return obase
+}
+
+define r(x) {
+ scale=x
+ return scale
+}
+
+i(11)
+ibase
+o(12)
+obase
+r(15)
+scale
diff --git a/contrib/bc/tests/fuzzing/bc_inputs1/len.bc b/contrib/bc/tests/fuzzing/bc_inputs1/len.bc
new file mode 100644
index 000000000000..ec931f2386a5
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/bc_inputs1/len.bc
@@ -0,0 +1,48 @@
+define fast_gcd(a, b) {
+
+ if (a == b) return a;
+ if (a > b) return fast_gcd(a - b, b)
+
+ return fast_gcd(a, b - a);
+}
+
+define void r_reduce(*r[]) {
+
+ auto g,s;
+
+ if (length(r[]) != 2) sqrt(-1);
+ if (scale(r[0])) 2^r[0];
+ if (scale(r[1])) 2^r[1];
+
+ if (r[0] >= 0 && r[1] >= 0) g = fast_gcd(r[0], r[1]);
+ else g = gcd(r[0], r[1]);
+
+ s = scale;
+ scale = 0;
+
+ r[0] /= g;
+ r[1] /= g;
+
+ scale = s;
+}
+
+define void r_init(*r[], a, b) {
+ r[0] = a;
+ r[1] = b;
+ r_reduce(r[]);
+}
+
+define void r_initi(*r[], i, a, b) {
+
+ length(r[]);
+
+ r[0] = i * b + a;
+ r[1] = b;
+
+ length(r[]);
+
+ r_reduce(r[]);
+}
+
+length(a[])
+r_initi(a[], 5, 63, 94);
diff --git a/contrib/bc/tests/fuzzing/bc_inputs1/length.txt b/contrib/bc/tests/fuzzing/bc_inputs1/length.txt
new file mode 100644
index 000000000000..48f83c95cf55
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/bc_inputs1/length.txt
@@ -0,0 +1,59 @@
+length(0)
+length(1)
+length(12)
+length(123)
+length(1234)
+length(12345)
+length(123456)
+length(1234567)
+length(12345678)
+length(123456789)
+length(1234567890)
+length(1.0)
+length(12.0)
+length(123.0)
+length(1234.0)
+length(12345.0)
+length(123456.0)
+length(1234567.0)
+length(12345678.0)
+length(123456789.0)
+length(1234567890.0)
+length(.1)
+length(.12)
+length(.123)
+length(.1234)
+length(.12345)
+length(.123456)
+length(.1234567)
+length(.12345678)
+length(.123456789)
+length(.1234567890)
+length(.01)
+length(.012)
+length(.0123)
+length(.01234)
+length(.012345)
+length(.0123456)
+length(.01234567)
+length(.012345678)
+length(.0123456789)
+length(.01234567890)
+length(.0000000001)
+length(.00000000012)
+length(.000000000123)
+length(.0000000001234)
+length(.00000000012345)
+length(.000000000123456)
+length(.0000000001234567)
+length(.00000000012345678)
+length(.000000000123456789)
+length(.0000000001234567890)
+length(289.29837)
+length(2893.00000)
+length(289.0)
+length(1802973.0000000238)
+length(.000000000000000093182394080000000000)
+a[0] = 0
+a[5] = 0
+length(a[])
diff --git a/contrib/bc/tests/fuzzing/bc_inputs1/lib10.txt b/contrib/bc/tests/fuzzing/bc_inputs1/lib10.txt
new file mode 100644
index 000000000000..7aa3fda19cc7
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/bc_inputs1/lib10.txt
@@ -0,0 +1,4 @@
+l10(0)
+l10(99)
+l10(100)
+l10(-100)
diff --git a/contrib/bc/tests/fuzzing/bc_inputs1/lib11.txt b/contrib/bc/tests/fuzzing/bc_inputs1/lib11.txt
new file mode 100644
index 000000000000..5bb262bd2668
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/bc_inputs1/lib11.txt
@@ -0,0 +1,4 @@
+perm(10, 2)
+comb(10, 2)
+perm(6, 2)
+comb(6, 2)
diff --git a/contrib/bc/tests/fuzzing/bc_inputs1/lib12.txt b/contrib/bc/tests/fuzzing/bc_inputs1/lib12.txt
new file mode 100644
index 000000000000..7d70e1ccdd5e
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/bc_inputs1/lib12.txt
@@ -0,0 +1 @@
+uint(0)
diff --git a/contrib/bc/tests/fuzzing/bc_inputs1/lib2.txt b/contrib/bc/tests/fuzzing/bc_inputs1/lib2.txt
new file mode 100644
index 000000000000..f345bd1669cb
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/bc_inputs1/lib2.txt
@@ -0,0 +1,15 @@
+r(0, 0)
+r(0, 1)
+r(0, 100)
+r(1, 0)
+r(1, 3)
+r(1.4, 0)
+r(1.5, 0)
+r(34.45, 2)
+r(64.1223, 4)
+r(-1, 0)
+r(-1, 3)
+r(-1.4, 0)
+r(-1.5, 0)
+r(-34.45, 2)
+r(-64.1223, 4)
diff --git a/contrib/bc/tests/fuzzing/bc_inputs1/lib3.txt b/contrib/bc/tests/fuzzing/bc_inputs1/lib3.txt
new file mode 100644
index 000000000000..1da42385ea44
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/bc_inputs1/lib3.txt
@@ -0,0 +1,6 @@
+f(0)
+f(1)
+f(2)
+f(3)
+f(4)
+f(5)
diff --git a/contrib/bc/tests/fuzzing/bc_inputs1/lib4.txt b/contrib/bc/tests/fuzzing/bc_inputs1/lib4.txt
new file mode 100644
index 000000000000..9f5323375d30
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/bc_inputs1/lib4.txt
@@ -0,0 +1,10 @@
+binary(0)
+hex(0)
+binary(1)
+hex(1)
+binary(2)
+hex(2)
+binary(15)
+hex(15)
+binary(16)
+hex(16)
diff --git a/contrib/bc/tests/fuzzing/bc_inputs1/lib5.txt b/contrib/bc/tests/fuzzing/bc_inputs1/lib5.txt
new file mode 100644
index 000000000000..c69a49167292
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/bc_inputs1/lib5.txt
@@ -0,0 +1,2 @@
+uint32(2147483647)
+int32(2147483647)
diff --git a/contrib/bc/tests/fuzzing/bc_inputs1/lib6.txt b/contrib/bc/tests/fuzzing/bc_inputs1/lib6.txt
new file mode 100644
index 000000000000..260e159f9fb6
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/bc_inputs1/lib6.txt
@@ -0,0 +1,5 @@
+pi(5)
+p=pi(scale)
+r2d(-p)
+d2r(180)
+d2r(-180)
diff --git a/contrib/bc/tests/fuzzing/bc_inputs1/lib7.txt b/contrib/bc/tests/fuzzing/bc_inputs1/lib7.txt
new file mode 100644
index 000000000000..edd66a40e83a
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/bc_inputs1/lib7.txt
@@ -0,0 +1,12 @@
+ubytes(0)
+ubytes(1)
+ubytes(2)
+sbytes(0)
+sbytes(1)
+sbytes(-1)
+sbytes(2)
+sbytes(127)
+sbytes(128)
+sbytes(254)
+sbytes(255)
+sbytes(256)
diff --git a/contrib/bc/tests/fuzzing/bc_inputs1/lib8.txt b/contrib/bc/tests/fuzzing/bc_inputs1/lib8.txt
new file mode 100644
index 000000000000..a4cc720c4754
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/bc_inputs1/lib8.txt
@@ -0,0 +1,3 @@
+l2(0)
+l2(8)
+l2(-8)
diff --git a/contrib/bc/tests/fuzzing/bc_inputs2/lib13.txt b/contrib/bc/tests/fuzzing/bc_inputs2/lib13.txt
new file mode 100644
index 000000000000..f7957ddc81fb
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/bc_inputs2/lib13.txt
@@ -0,0 +1 @@
+uint(-3)
diff --git a/contrib/bc/tests/fuzzing/bc_inputs2/lib14.txt b/contrib/bc/tests/fuzzing/bc_inputs2/lib14.txt
new file mode 100644
index 000000000000..a07d4730c269
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/bc_inputs2/lib14.txt
@@ -0,0 +1 @@
+uint64(2147483647)
diff --git a/contrib/bc/tests/fuzzing/bc_inputs2/lib15.txt b/contrib/bc/tests/fuzzing/bc_inputs2/lib15.txt
new file mode 100644
index 000000000000..13be33145ba3
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/bc_inputs2/lib15.txt
@@ -0,0 +1 @@
+uint(1)
diff --git a/contrib/bc/tests/fuzzing/bc_inputs2/lib16.txt b/contrib/bc/tests/fuzzing/bc_inputs2/lib16.txt
new file mode 100644
index 000000000000..de8dff5e7fee
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/bc_inputs2/lib16.txt
@@ -0,0 +1 @@
+uint(2147483647)
diff --git a/contrib/bc/tests/fuzzing/bc_inputs2/lib19.txt b/contrib/bc/tests/fuzzing/bc_inputs2/lib19.txt
new file mode 100644
index 000000000000..95fdd40264fa
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/bc_inputs2/lib19.txt
@@ -0,0 +1 @@
+int(4294967296)
diff --git a/contrib/bc/tests/fuzzing/bc_inputs2/lib20.txt b/contrib/bc/tests/fuzzing/bc_inputs2/lib20.txt
new file mode 100644
index 000000000000..8872f9b5f8e1
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/bc_inputs2/lib20.txt
@@ -0,0 +1 @@
+int(-4294967296)
diff --git a/contrib/bc/tests/fuzzing/bc_inputs2/lib21.txt b/contrib/bc/tests/fuzzing/bc_inputs2/lib21.txt
new file mode 100644
index 000000000000..82693695945d
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/bc_inputs2/lib21.txt
@@ -0,0 +1 @@
+int(1)
diff --git a/contrib/bc/tests/fuzzing/bc_inputs2/lib22.txt b/contrib/bc/tests/fuzzing/bc_inputs2/lib22.txt
new file mode 100644
index 000000000000..438575ef5b7c
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/bc_inputs2/lib22.txt
@@ -0,0 +1 @@
+int(-1)
diff --git a/contrib/bc/tests/fuzzing/bc_inputs2/lib23.txt b/contrib/bc/tests/fuzzing/bc_inputs2/lib23.txt
new file mode 100644
index 000000000000..df3d64009e79
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/bc_inputs2/lib23.txt
@@ -0,0 +1 @@
+uint(3.928375)
diff --git a/contrib/bc/tests/fuzzing/bc_inputs2/lib24.txt b/contrib/bc/tests/fuzzing/bc_inputs2/lib24.txt
new file mode 100644
index 000000000000..01c7181e5133
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/bc_inputs2/lib24.txt
@@ -0,0 +1 @@
+int(4.000000)
diff --git a/contrib/bc/tests/fuzzing/bc_inputs2/log.txt b/contrib/bc/tests/fuzzing/bc_inputs2/log.txt
new file mode 100644
index 000000000000..54115e380ec7
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/bc_inputs2/log.txt
@@ -0,0 +1,22 @@
+l(0)
+l(0.5)
+l(1)
+l(1.5)
+l(1.74)
+l(2)
+l(3.2345)
+l(5.283957)
+l(13.23857)
+l(100)
+l(283.238957)
+l(-0.5)
+l(-1)
+l(-1.5)
+l(-1.74)
+l(-2)
+l(-3.2345)
+l(-5.283957)
+l(-13.23857)
+l(-100)
+l(-283.238957)
+l(10430710.3325472917)
diff --git a/contrib/bc/tests/fuzzing/bc_inputs2/misc.txt b/contrib/bc/tests/fuzzing/bc_inputs2/misc.txt
new file mode 100644
index 000000000000..571f4a87e262
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/bc_inputs2/misc.txt
@@ -0,0 +1,13 @@
+4.1*1.-13^ - 74 - 1284597623841*1.-13^ - 757
+4.1*1.\
+-1\
+3^ - 74 - 1284597623841*1.\
+-1\
+3^ - 757
+obase = 9
+4.1*1.-13^ - 74 - 1284597623841*1.-13^ - 757
+4.1*1.\
+-1\
+3^ - 74 - 1284597623841*1.\
+-1\
+3^ - 757
diff --git a/contrib/bc/tests/fuzzing/bc_inputs2/misc1.txt b/contrib/bc/tests/fuzzing/bc_inputs2/misc1.txt
new file mode 100644
index 000000000000..7e9d9660457f
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/bc_inputs2/misc1.txt
@@ -0,0 +1,76 @@
+define x(x) {
+ return(x)
+}
+define y() {
+ return;
+}
+define z() {
+ return ();
+}
+scale = 0
+x=2
+x[0]=3
+x
+x[0]
+scale
+ibase
+obase
+x ( 7 )
+x + x( 8 )
+x - x[0]
+321 * x
+2 ^ x[0]
+x++
+--x
+x += 9
+x
+length(2381)
+sqrt(9)
+scale(238.1)
+x=2
+x[0]=3
+(x)
+(x[0])
+(scale)
+(ibase)
+(obase)
+(x ( 7 ))
+(x + x( 8 ))
+(x - x[0])
+(321 * x)
+(2 ^ x[0])
+(x++)
+(--x)
+(x += 9)
+(length(2381))
+(sqrt(9))
+(scale(238.1))
+(scale = 0)
+(x = 10)
+(x += 100)
+(x -= 10)
+(x *= 10)
+(x /= 100)
+(x ^= 10)
+(x = sqrt(x))
+(x[1 - 1])
+x[(1 - 1)]
+2 + \
+3
+++ibase
+--ibase
+++obase
+--obase
+++last
+--last
+last
+last = 100
+last
+. = 150
+.
+++scale
+--scale
+y()
+z()
+2 + /*
+*/3
diff --git a/contrib/bc/tests/fuzzing/bc_inputs2/misc2.txt b/contrib/bc/tests/fuzzing/bc_inputs2/misc2.txt
new file mode 100644
index 000000000000..3b3aa683402c
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/bc_inputs2/misc2.txt
@@ -0,0 +1,110 @@
+define w() { auto z; return 1; }
+define x() {
+ "x"
+ return (1)
+}
+define y() {
+ "y"
+ return (2)
+}
+define z() {
+ "z"
+ return (3)
+}
+
+define v() { return }
+
+v()
+
+w()
+
+if (x() == y()) { 1 }
+1
+if (x() <= y()) { 2 }
+if (y() >= x()) { 3 }
+if (x() != y()) { 4 }
+if (x() < y()) { 5 }
+if (y() > x()) { 6 }
+
+if (x() == z()) { 11 }
+11
+if (x() <= z()) { 12 }
+if (z() >= x()) { 13 }
+if (x() != z()) { 14 }
+if (x() < z()) { 15 }
+if (z() > x()) { 16 }
+
+x = -10
+while (x <= 0) {
+ x
+ if (x == -5) break;
+ x += 1
+}
+
+define u() {
+ auto a[];
+ return a[0]
+}
+
+u()
+
+if (x == -4) x
+else x - 4
+
+x = 1
+
+if (x == 1) 1 else 2
+if (x == 0) 1 else 2
+
+if (x == 1) 1 else if (x == 0) 2 else 3
+if (x == 0) 1 else if (x == 1) 2 else 3
+if (x == -1) 1 else if (x == 0) 2 else 3
+
+if (x == 1) if (x != 0) 1 else 2 else 3
+if (x == 1) if (x == 0) 1 else 2 else 3
+if (x != 1) if (x == 0) 1 else 2 else 3
+
+if (x == 1) while (x > 0) { x ; x -= 1 } else 0
+x = 1
+if (x == 0) while (x > 0) { x ; x -= 1 } else 0
+
+if(x == 1) {
+ 11
+ while(x == 1) {
+ 21
+ while(x == 1) {
+ 31
+ break
+ 32
+ }
+ 22
+ break
+ 23
+ }
+ 12
+}
+99
+
+for (;;) { 123 ; break; }
+for (i = 0;; ++i) { i ; if (i == 2) break; else i; }
+for (i = 0;;!++i) { i ; if (i == 2) break; else i; }
+for (i = 0;; ++i) { i ; if (i != 2) i else break }
+
+while (i > 0) if (i == 1) break else i--
+while (i < 3) if (i != 2) i++ else break
+
+for(i=1; i<=3; i++) { i; if(i==2) continue; print i,i,"\n" }
+
+print 1,2,3
+print "\n"
+
+ifz = 1
+ifz
+++ifz
+ifz++
+ifz
+
+{
+ 4
+ 5
+}
diff --git a/contrib/bc/tests/fuzzing/bc_inputs2/misc3.txt b/contrib/bc/tests/fuzzing/bc_inputs2/misc3.txt
new file mode 100644
index 000000000000..7aad374c4ef6
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/bc_inputs2/misc3.txt
@@ -0,0 +1,12 @@
+for (i = 0; i < A; ++i)
+{print "n"
+if(1)if(1){3
+}
+if(0)if(1){3
+}
+else 4
+if(0){if(1){3
+}}
+else 5
+{i}
+}
diff --git a/contrib/bc/tests/fuzzing/bc_inputs2/modulus.txt b/contrib/bc/tests/fuzzing/bc_inputs2/modulus.txt
new file mode 100644
index 000000000000..965600c18a1d
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/bc_inputs2/modulus.txt
@@ -0,0 +1,69 @@
+1 % 1
+2 % 1
+16 % 4
+15 % 4
+17 % 4
+2389473 % 5
+39240687239 % 1
+346728934 % 23958
+3496723859067234 % 298375462837546928347623059375486
+-1 % 1
+-2 % 1
+-47589634875689345 % 37869235
+-1274852934765 % 2387628935486273546
+-6324758963 % 237854962
+1 % -1
+2 % -1
+2 % -2
+2 % -3
+16 % 5
+15 % 5
+14 % 5
+89237423 % -237856923854
+123647238946 % -12467
+-1 % -1
+-2 % -1
+-2 % -2
+-2 % -3
+-13 % -7
+-14 % -7
+-15 % -7
+-12784956 % -32746
+-127849612 % -23712347682193
+scale = 0
+1 % 1
+2 % 1
+16 % 4
+15 % 4
+17 % 4
+2389473 % 5
+39240687239 % 1
+346728934 % 23958
+3496723859067234 % 298375462837546928347623059375486
+-1 % 1
+-2 % 1
+-47589634875689345 % 37869235
+-1274852934765 % 2387628935486273546
+-6324758963 % 237854962
+1 % -1
+2 % -1
+2 % -2
+2 % -3
+16 % 5
+15 % 5
+14 % 5
+89237423 % -237856923854
+123647238946 % -12467
+-1 % -1
+-2 % -1
+-2 % -2
+-2 % -3
+-13 % -7
+-14 % -7
+-15 % -7
+-12784956 % -32746
+-127849612 % -23712347682193
+-3191280681 % 641165986
+scale = 0; -899510228 % -2448300078.40314
+scale = 0; -7424863 % -207.2609738667
+scale = 0; 3769798918 % 0.6
diff --git a/contrib/bc/tests/fuzzing/bc_inputs2/multiply.txt b/contrib/bc/tests/fuzzing/bc_inputs2/multiply.txt
new file mode 100644
index 000000000000..f5efed91b17f
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/bc_inputs2/multiply.txt
@@ -0,0 +1,40 @@
+0 * 0
+1 * 0
+0 * 1
+0 * 2498752389672835476
+873246913745129084576134 * 0
+1 * 472638590273489273456
+12374861230476103672835496 * 1
+1 * 1
+2 * 1
+1 * 2
+2 * 2
+3 * 14
+17 * 8
+1892467513846753 * 1872439821374591038746
+328962735862.2973546835638947635 * 1728465791348762356
+38745962374538.387427384672934867234 * 0.1932476528394672837568923754
+9878894576289457634856.2738627161689017387608947567654 * 37842939768237596237854203.29874372139852739126739621793162
+-1 * 1
+-1 * 2
+78893457 * -34876238956
+235678324957634 * -0.2349578349672389576
+-12849567821934 * 12738462937681
+1274861293467.927843682937462 * -28935678239
+2936077239872.12937462836 * -0.012842357682435762
+2387692387566.2378569237546 * -272189345628.123875629835876
+0.012348629356782835962 * -23487692356
+0.4768349567348675934 * -0.23756834576934857638495
+0.98748395367485962735486 * -4675839462354867.376834956738456
+-321784627934586 * -235762378596
+-32578623567892356 * -0.32567384579638456
+-35768232346876 * -2348672935602387620.28375682349576237856
+-0.2356728394765234 * -238759624356978
+-0.2345768212346780 * -0.235768124697074385948943532045
+-0.370873860736785306278630 * -7835678398607.7086378076867096270
+-78365713707.7089637863786730 * -738580798679306780
+-73867038956790490258249 * -0.7379862716391723672803679
+-378621971598721837710387 * -98465373878350798.09743896037963078560
+37164201 * 2931559660
+679468076118972457796560530571.46287161642138401685 * 93762.2836
+.000000000000000000000000001 * .0000000000000000000000001
diff --git a/contrib/bc/tests/fuzzing/bc_inputs2/pi.txt b/contrib/bc/tests/fuzzing/bc_inputs2/pi.txt
new file mode 100644
index 000000000000..775545c873a8
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/bc_inputs2/pi.txt
@@ -0,0 +1,4 @@
+for (i = 0; i <= 20; ++i) {
+ scale = i
+ 4 * a(1)
+}
diff --git a/contrib/bc/tests/fuzzing/bc_inputs2/places.txt b/contrib/bc/tests/fuzzing/bc_inputs2/places.txt
new file mode 100644
index 000000000000..d6f20a46462f
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/bc_inputs2/places.txt
@@ -0,0 +1,19 @@
+0 @ 0
+1 @ 0
+2 @ 0
+0.0023896 @ 0
+1.298346 @ 0
+2.00000000 @ 0
+0.0023896 @ 3
+1.298346 @ 4
+2.00000000 @ 5
+289 @ 3
+18.34 @ 6
+-183.1 @ 0
+-23.238 @ 8
+-343.23 @ 2
+x = 89136.892348976
+x @= 7
+x
+-.1897263 @ 0
+.1982365 @ 0
diff --git a/contrib/bc/tests/fuzzing/bc_inputs2/power.txt b/contrib/bc/tests/fuzzing/bc_inputs2/power.txt
new file mode 100644
index 000000000000..5657cdd7b7d9
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/bc_inputs2/power.txt
@@ -0,0 +1,44 @@
+0 ^ 0
+0 ^ 1
+0 ^ 1894
+1 ^ 0
+39746823 ^ 0
+0.238672983047682 ^ 0
+18394762374689237468.97354862973846 ^ 0
+1 ^ 1
+2 ^ 1
+18927361346 ^ 1
+0.23523785962738592635777 ^ 1
+328956734869213746.89782398457234 ^ 1
+8937 ^ 98
+0.124876812394 ^ 2396
+93762.2836 ^ 13
+1 ^ -1
+2 ^ -1
+10 ^ -1
+683734768 ^ -1
+38579623756.897937568235 ^ -1
+1 ^ -32467
+2 ^ -53
+23897 ^ -213
+-1 ^ 1
+-1 ^ 2
+-2 ^ 1
+-2 ^ 2
+-237 ^ 294
+-3746 ^ 28
+-0.3548 ^ 35
+-4267.234 ^ 37
+-326.3246 ^ 78
+-1 ^ -1
+-1 ^ -2
+-2 ^ -1
+-2 ^ -2
+-237 ^ -293
+-784 ^ -23
+-86 ^ -7
+-0.23424398 ^ -781
+-178.234786 ^ -879
+-1274.346 ^ -768
+0 ^ -251
+-0.2959371298 ^ 227
diff --git a/contrib/bc/tests/fuzzing/bc_inputs2/print2.txt b/contrib/bc/tests/fuzzing/bc_inputs2/print2.txt
new file mode 100644
index 000000000000..7f65fbe4c106
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/bc_inputs2/print2.txt
@@ -0,0 +1,194 @@
+define prnt(i) {
+
+ obase = i - 1
+ a
+ b
+ c
+
+ obase = i
+ a
+ b
+ c
+
+ return i
+}
+
+define prnt2(i) {
+
+ obase = i + 1
+ a
+ b
+ c
+
+ print "\n"
+
+ return i * 10
+}
+
+a = 999999999999999999999999999999999999
+b = a + 1
+c = b + 1
+
+i = 100
+i = prnt(i)
+
+if (i + 1 <= maxobase()) {
+ i = prnt2(i)
+}
+else {
+ print " 084 044 021 047 096 073 015 052 088 014 072 097 047 021 094 051 083\e\n 000\n"
+ print " 084 044 021 047 096 073 015 052 088 014 072 097 047 021 094 051 083\e\n 001\n"
+ print " 084 044 021 047 096 073 015 052 088 014 072 097 047 021 094 051 083\e\n 002\n"
+ print "\n"
+ i *= 10
+}
+
+if (i <= maxobase()) {
+ i = prnt(i)
+}
+else {
+ print " 001 012 066 220 495 792 924 792 495 220 066 012 000\n"
+ print " 001 012 066 220 495 792 924 792 495 220 066 012 001\n"
+ print " 001 012 066 220 495 792 924 792 495 220 066 012 002\n"
+ print " 999 999 999 999 999 999 999 999 999 999 999 999\n"
+ print " 001 000 000 000 000 000 000 000 000 000 000 000 000\n"
+ print " 001 000 000 000 000 000 000 000 000 000 000 000 001\n"
+}
+
+if (i + 1 <= maxobase()) {
+ i = prnt2(i)
+}
+else {
+ print " 0989 0065 0781 0494 0209 0923 0209 0494 0781 0065 0989 0000\n"
+ print " 0989 0065 0781 0494 0209 0923 0209 0494 0781 0065 0989 0001\n"
+ print " 0989 0065 0781 0494 0209 0923 0209 0494 0781 0065 0989 0002\n"
+ print "\n"
+ i *= 10
+}
+
+if (i <= maxobase()) {
+ i = prnt(i)
+}
+else {
+ print " 0001 0009 0036 0084 0126 0126 0084 0036 0009 0000\n"
+ print " 0001 0009 0036 0084 0126 0126 0084 0036 0009 0001\n"
+ print " 0001 0009 0036 0084 0126 0126 0084 0036 0009 0002\n"
+ print " 9999 9999 9999 9999 9999 9999 9999 9999 9999\n"
+ print " 0001 0000 0000 0000 0000 0000 0000 0000 0000 0000\n"
+ print " 0001 0000 0000 0000 0000 0000 0000 0000 0000 0001\n"
+}
+
+if (i + 1 <= maxobase()) {
+ i = prnt2(i)
+}
+else {
+ print " 09992 00035 09917 00125 09875 00083 09965 00008 09999\n"
+ print " 09992 00035 09917 00125 09875 00083 09965 00008 10000\n"
+ print " 09992 00035 09917 00125 09875 00083 09965 00009 00000\n"
+ print "\n"
+ i *= 10
+}
+
+if (i <= maxobase()) {
+ i = prnt(i)
+}
+else {
+ print " 00010 00070 00210 00350 00350 00210 00070 00009\n"
+ print " 00010 00070 00210 00350 00350 00210 00070 00010\n"
+ print " 00010 00070 00210 00350 00350 00210 00070 00011\n"
+ print " 00009 99999 99999 99999 99999 99999 99999 99999\n"
+ print " 00010 00000 00000 00000 00000 00000 00000 00000\n"
+ print " 00010 00000 00000 00000 00000 00000 00000 00001\n"
+}
+
+if (i + 1 <= maxobase()) {
+ i = prnt2(i)
+}
+else {
+ print " 000009 099931 000209 099651 000349 099791 000069 099990\n"
+ print " 000009 099931 000209 099651 000349 099791 000069 099991\n"
+ print " 000009 099931 000209 099651 000349 099791 000069 099992\n"
+ print "\n"
+ i *= 10
+}
+
+if (i <= maxobase()) {
+ i = prnt(i)
+}
+else {
+ print " 000001 000006 000015 000020 000015 000006 000000\n"
+ print " 000001 000006 000015 000020 000015 000006 000001\n"
+ print " 000001 000006 000015 000020 000015 000006 000002\n"
+ print " 999999 999999 999999 999999 999999 999999\n"
+ print " 000001 000000 000000 000000 000000 000000 000000\n"
+ print " 000001 000000 000000 000000 000000 000000 000001\n"
+}
+
+if (i + 1 <= maxobase()) {
+ i = prnt2(i)
+}
+else {
+ print " 0999995 0000014 0999981 0000014 0999995 0000000\n"
+ print " 0999995 0000014 0999981 0000014 0999995 0000001\n"
+ print " 0999995 0000014 0999981 0000014 0999995 0000002\n"
+ print "\n"
+ i *= 10
+}
+
+if (i <= maxobase()) {
+ i = prnt(i)
+}
+else {
+ print " 0000010 0000050 0000100 0000100 0000050 0000009\n"
+ print " 0000010 0000050 0000100 0000100 0000050 0000010\n"
+ print " 0000010 0000050 0000100 0000100 0000050 0000011\n"
+ print " 0000009 9999999 9999999 9999999 9999999 9999999\n"
+ print " 0000010 0000000 0000000 0000000 0000000 0000000\n"
+ print " 0000010 0000000 0000000 0000000 0000000 0000001\n"
+}
+
+if (i + 1 <= maxobase()) {
+ i = prnt2(i)
+}
+else {
+ print " 00000009 09999951 00000099 09999901 00000049 09999990\n"
+ print " 00000009 09999951 00000099 09999901 00000049 09999991\n"
+ print " 00000009 09999951 00000099 09999901 00000049 09999992\n"
+ print "\n"
+ i *= 10
+}
+
+if (i <= maxobase()) {
+ i = prnt(i)
+}
+else {
+ print " 00010000 00040000 00060000 00040000 00009999\n"
+ print " 00010000 00040000 00060000 00040000 00010000\n"
+ print " 00010000 00040000 00060000 00040000 00010001\n"
+ print " 00009999 99999999 99999999 99999999 99999999\n"
+ print " 00010000 00000000 00000000 00000000 00000000\n"
+ print " 00010000 00000000 00000000 00000000 00000001\n"
+}
+
+if (i + 1 <= maxobase()) {
+ i = prnt2(i)
+}
+else {
+ print " 000009999 099960001 000059999 099960001 000009999\n"
+ print " 000009999 099960001 000059999 099960001 000010000\n"
+ print " 000009999 099960001 000059999 099960001 000010001\n"
+ print "\n"
+ i *= 10
+}
+
+if (i <= maxobase()) {
+ i = prnt(i)
+}
+else {
+ print " 000000001 000000004 000000006 000000004 000000000\n"
+ print " 000000001 000000004 000000006 000000004 000000001\n"
+ print " 000000001 000000004 000000006 000000004 000000002\n"
+ print " 999999999 999999999 999999999 999999999\n"
+ print " 000000001 000000000 000000000 000000000 000000000\n"
+ print " 000000001 000000000 000000000 000000000 000000001\n"
+}
diff --git a/contrib/bc/tests/fuzzing/bc_inputs2/references.bc b/contrib/bc/tests/fuzzing/bc_inputs2/references.bc
new file mode 100755
index 000000000000..8188f17aa017
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/bc_inputs2/references.bc
@@ -0,0 +1,408 @@
+#! /usr/bin/bc -q
+
+define printarray(a[], len) {
+
+ auto i
+
+ for (i = 0; i < len; ++i) {
+ a[i]
+ }
+}
+
+define a2(a[], len) {
+
+ auto i
+
+ for (i = 0; i < len; ++i) {
+ a[i] = a[i] * a[i]
+ }
+
+ printarray(a[], len)
+}
+
+define a4(a__[], len) {
+
+ auto i
+
+ for (i = 0; i < len; ++i) {
+ a__[i] = a__[i] * a__[i]
+ }
+
+ printarray(a__[], len)
+}
+
+define a6(*a__[], len) {
+
+ auto i
+
+ for (i = 0; i < len; ++i) {
+ a__[i] = a__[i] * a__[i]
+ }
+
+ printarray(a__[], len)
+}
+
+define a1(*a[], len) {
+
+ auto i
+
+ for (i = 0; i < len; ++i) {
+ a[i] = i
+ }
+
+ a2(a[], len)
+
+ printarray(a[], len)
+}
+
+define a3(*a__[], len) {
+
+ auto i
+
+ for (i = 0; i < len; ++i) {
+ a__[i] = i
+ }
+
+ a4(a__[], len)
+
+ printarray(a__[], len)
+}
+
+define a5(*a__[], len) {
+
+ auto i
+
+ for (i = 0; i < len; ++i) {
+ a__[i] = i
+ }
+
+ a2(a__[], len)
+
+ printarray(a__[], len)
+}
+
+define a7(*a__[], len) {
+
+ auto i
+
+ for (i = 0; i < len; ++i) {
+ a__[i] = i
+ }
+
+ a6(a__[], len)
+
+ printarray(a__[], len)
+}
+
+len = 16
+
+a1(a[], len)
+printarray(a[], len)
+a3(a[], len)
+printarray(a[], len)
+a5(a[], len)
+printarray(a[], len)
+a7(a[], len)
+printarray(a[], len)
+
+a1(b[], len)
+printarray(b[], len)
+a3(b[], len)
+printarray(b[], len)
+a5(b[], len)
+printarray(b[], len)
+a7(b[], len)
+printarray(b[], len)
+
+a1[0] = 0
+a2[0] = 0
+a3[0] = 0
+a4[0] = 0
+a5[0] = 0
+a6[0] = 0
+a7[0] = 0
+a8[0] = 0
+a9[0] = 0
+a10[0] = 0
+a11[0] = 0
+a12[0] = 0
+a13[0] = 0
+a14[0] = 0
+a15[0] = 0
+a16[0] = 0
+a17[0] = 0
+a18[0] = 0
+a19[0] = 0
+a20[0] = 0
+a21[0] = 0
+a22[0] = 0
+a23[0] = 0
+a24[0] = 0
+a25[0] = 0
+a26[0] = 0
+a27[0] = 0
+a28[0] = 0
+a29[0] = 0
+a30[0] = 0
+a31[0] = 0
+a32[0] = 0
+a33[0] = 0
+a34[0] = 0
+a35[0] = 0
+a36[0] = 0
+a37[0] = 0
+a38[0] = 0
+a39[0] = 0
+a40[0] = 0
+a41[0] = 0
+a42[0] = 0
+a43[0] = 0
+a44[0] = 0
+a45[0] = 0
+a46[0] = 0
+a47[0] = 0
+a48[0] = 0
+a49[0] = 0
+a50[0] = 0
+a51[0] = 0
+a52[0] = 0
+a53[0] = 0
+a54[0] = 0
+a55[0] = 0
+a56[0] = 0
+a57[0] = 0
+a58[0] = 0
+a59[0] = 0
+a60[0] = 0
+a61[0] = 0
+a62[0] = 0
+a63[0] = 0
+a64[0] = 0
+a65[0] = 0
+a66[0] = 0
+a67[0] = 0
+a68[0] = 0
+a69[0] = 0
+a70[0] = 0
+a71[0] = 0
+a72[0] = 0
+a73[0] = 0
+a74[0] = 0
+a75[0] = 0
+a76[0] = 0
+a77[0] = 0
+a78[0] = 0
+a79[0] = 0
+a80[0] = 0
+a81[0] = 0
+a82[0] = 0
+a83[0] = 0
+a84[0] = 0
+a85[0] = 0
+a86[0] = 0
+a87[0] = 0
+a88[0] = 0
+a89[0] = 0
+a90[0] = 0
+a91[0] = 0
+a92[0] = 0
+a93[0] = 0
+a94[0] = 0
+a95[0] = 0
+a96[0] = 0
+a97[0] = 0
+a98[0] = 0
+a99[0] = 0
+a100[0] = 0
+a101[0] = 0
+a102[0] = 0
+a103[0] = 0
+a104[0] = 0
+a105[0] = 0
+a106[0] = 0
+a107[0] = 0
+a108[0] = 0
+a109[0] = 0
+a110[0] = 0
+a111[0] = 0
+a112[0] = 0
+a113[0] = 0
+a114[0] = 0
+a115[0] = 0
+a116[0] = 0
+a117[0] = 0
+a118[0] = 0
+a119[0] = 0
+a120[0] = 0
+a121[0] = 0
+a122[0] = 0
+a123[0] = 0
+a124[0] = 0
+a125[0] = 0
+a126[0] = 0
+a127[0] = 0
+a128[0] = 0
+a129[0] = 0
+a130[0] = 0
+a131[0] = 0
+a132[0] = 0
+a133[0] = 0
+a134[0] = 0
+a135[0] = 0
+a136[0] = 0
+a137[0] = 0
+a138[0] = 0
+a139[0] = 0
+a140[0] = 0
+a141[0] = 0
+a142[0] = 0
+a143[0] = 0
+a144[0] = 0
+a145[0] = 0
+a146[0] = 0
+a147[0] = 0
+a148[0] = 0
+a149[0] = 0
+a150[0] = 0
+a151[0] = 0
+a152[0] = 0
+a153[0] = 0
+a154[0] = 0
+a155[0] = 0
+a156[0] = 0
+a157[0] = 0
+a158[0] = 0
+a159[0] = 0
+a160[0] = 0
+a161[0] = 0
+a162[0] = 0
+a163[0] = 0
+a164[0] = 0
+a165[0] = 0
+a166[0] = 0
+a167[0] = 0
+a168[0] = 0
+a169[0] = 0
+a170[0] = 0
+a171[0] = 0
+a172[0] = 0
+a173[0] = 0
+a174[0] = 0
+a175[0] = 0
+a176[0] = 0
+a177[0] = 0
+a178[0] = 0
+a179[0] = 0
+a180[0] = 0
+a181[0] = 0
+a182[0] = 0
+a183[0] = 0
+a184[0] = 0
+a185[0] = 0
+a186[0] = 0
+a187[0] = 0
+a188[0] = 0
+a189[0] = 0
+a190[0] = 0
+a191[0] = 0
+a192[0] = 0
+a193[0] = 0
+a194[0] = 0
+a195[0] = 0
+a196[0] = 0
+a197[0] = 0
+a198[0] = 0
+a199[0] = 0
+a200[0] = 0
+a201[0] = 0
+a202[0] = 0
+a203[0] = 0
+a204[0] = 0
+a205[0] = 0
+a206[0] = 0
+a207[0] = 0
+a208[0] = 0
+a209[0] = 0
+a210[0] = 0
+a211[0] = 0
+a212[0] = 0
+a213[0] = 0
+a214[0] = 0
+a215[0] = 0
+a216[0] = 0
+a217[0] = 0
+a218[0] = 0
+a219[0] = 0
+a220[0] = 0
+a221[0] = 0
+a222[0] = 0
+a223[0] = 0
+a224[0] = 0
+a225[0] = 0
+a226[0] = 0
+a227[0] = 0
+a228[0] = 0
+a229[0] = 0
+a230[0] = 0
+a231[0] = 0
+a232[0] = 0
+a233[0] = 0
+a234[0] = 0
+a235[0] = 0
+a236[0] = 0
+a237[0] = 0
+a238[0] = 0
+a239[0] = 0
+a240[0] = 0
+a241[0] = 0
+a242[0] = 0
+a243[0] = 0
+a244[0] = 0
+a245[0] = 0
+a246[0] = 0
+a247[0] = 0
+a248[0] = 0
+a249[0] = 0
+a250[0] = 0
+a251[0] = 0
+a252[0] = 0
+a253[0] = 0
+a254[0] = 0
+a255[0] = 0
+a256[0] = 0
+
+a1(a253[], len)
+printarray(a253[], len)
+a3(a253[], len)
+printarray(a253[], len)
+a5(a253[], len)
+printarray(a253[], len)
+a7(a253[], len)
+printarray(a253[], len)
+
+a1(a254[], len)
+printarray(a254[], len)
+a3(a254[], len)
+printarray(a254[], len)
+a5(a254[], len)
+printarray(a254[], len)
+a7(a254[], len)
+printarray(a254[], len)
+
+a1(a255[], len)
+printarray(a255[], len)
+a3(a255[], len)
+printarray(a255[], len)
+a5(a255[], len)
+printarray(a255[], len)
+a7(a255[], len)
+printarray(a255[], len)
+
+a1(a256[], len)
+printarray(a256[], len)
+a3(a256[], len)
+printarray(a256[], len)
+a5(a256[], len)
+printarray(a256[], len)
+a7(a256[], len)
+printarray(a256[], len)
diff --git a/contrib/bc/tests/fuzzing/bc_inputs2/scale.txt b/contrib/bc/tests/fuzzing/bc_inputs2/scale.txt
new file mode 100644
index 000000000000..e8bee791bce7
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/bc_inputs2/scale.txt
@@ -0,0 +1,57 @@
+scale(0)
+scale(1)
+scale(12)
+scale(123)
+scale(1234)
+scale(12345)
+scale(123456)
+scale(1234567)
+scale(12345678)
+scale(123456789)
+scale(1234567890)
+scale(1.0)
+scale(12.0)
+scale(123.0)
+scale(1234.0)
+scale(12345.0)
+scale(123456.0)
+scale(1234567.0)
+scale(12345678.0)
+scale(123456789.0)
+scale(1234567890.0)
+scale(.1)
+scale(.12)
+scale(.123)
+scale(.1234)
+scale(.12345)
+scale(.123456)
+scale(.1234567)
+scale(.12345678)
+scale(.123456789)
+scale(.1234567890)
+scale(.01)
+scale(.012)
+scale(.0123)
+scale(.01234)
+scale(.012345)
+scale(.0123456)
+scale(.01234567)
+scale(.012345678)
+scale(.0123456789)
+scale(.01234567890)
+scale(.0000000001)
+scale(.00000000012)
+scale(.000000000123)
+scale(.0000000001234)
+scale(.00000000012345)
+scale(.000000000123456)
+scale(.0000000001234567)
+scale(.00000000012345678)
+scale(.000000000123456789)
+scale(.0000000001234567890)
+scale(289.29837)
+scale(2893.00000)
+scale(289.0)
+scale(1802973.0000000238)
+scale(.000000000000000093182394080000000000)
+scale(0.00000000000000000000)
diff --git a/contrib/bc/tests/fuzzing/bc_inputs2/scientific.txt b/contrib/bc/tests/fuzzing/bc_inputs2/scientific.txt
new file mode 100644
index 000000000000..bd04562a8df3
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/bc_inputs2/scientific.txt
@@ -0,0 +1,51 @@
+0e0
+0e1
+0e5
+0e-2
+0e-100
+1e0
+-1e1
+1e9
+-1e21
+1e-1
+-1e-2
+1e-5
+4.92837e5
+-3.28971028e20
+6.2e3
+-8.289371e2
+5.9817280937e8
+-3.28977e-1
+8.8927891e-20
+-7.98239e-4
+4.4892e-4
+-18937e0
+198273e10
+-18927e-4
+28937e-5
+-891072e-7
+.28972e0
+-.891273e-1
+.8928397e1
+-.0002983172e5
+.00022e3
+-.00022e4
+.0000328937e8
+obase=0
+0
+1
+10
+-289
+2894
+-89434
+894370
+-1239839
+28931708
+-8052098.8029731809
+.1
+-.01
+.001
+-.00038
+.0000483
+-.0002894378190
+.2893712083
diff --git a/contrib/bc/tests/fuzzing/bc_inputs2/shift.txt b/contrib/bc/tests/fuzzing/bc_inputs2/shift.txt
new file mode 100644
index 000000000000..0b4d07b5bfd0
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/bc_inputs2/shift.txt
@@ -0,0 +1,281 @@
+0 << 0
+1 << 0
+2 << 0
+0.0023896 << 0
+1.298346 << 0
+2.00000000 << 0
+0.0023896 << 3
+1.298346 << 4
+2.00000000 << 5
+x = 89136.892348976
+x <<= 7
+x
+x = 1892634051829351283289298
+x <<= 24
+x
+0 >> 0
+1 >> 0
+2 >> 0
+0.0023896 >> 0
+1.298346 >> 0
+2.00000000 >> 0
+0.0023896 >> 3
+1.298346 >> 4
+2.00000000 >> 5
+x = 89136.892348976
+x >>= 7
+x
+x = 1892634051829351283289298
+x >>= 24
+x
+-1 << 0
+-2 << 0
+-0.0023896 << 0
+-1.298346 << 0
+-2.00000000 << 0
+-0.0023896 << 3
+-1.298346 << 4
+-2.00000000 << 5
+x = -89136.892348976
+x <<= 7
+x
+x = -1892634051829351283289298
+x <<= 24
+x
+-1 >> 0
+-2 >> 0
+-0.0023896 >> 0
+-1.298346 >> 0
+-2.00000000 >> 0
+-0.0023896 >> 3
+-1.298346 >> 4
+-2.00000000 >> 5
+x = -89136.892348976
+x >>= 7
+x
+-x
+x = -1892634051829351283289298
+x >>= 24
+x
+-x
+(0 >> 12) / 2
+10000000000 >> 0
+10000000000 >> 1
+10000000000 >> 2
+10000000000 >> 3
+10000000000 >> 4
+10000000000 >> 5
+10000000000 >> 6
+10000000000 >> 7
+10000000000 >> 8
+10000000000 >> 9
+10000000000 >> 10
+10000000000 >> 11
+10000000000 >> 12
+10000000000 >> 13
+10000000000 >> 14
+10000000000 >> 15
+10000000000 >> 16
+10000000000 >> 17
+10000000000 >> 18
+10000000000 >> 19
+10000000000.1 >> 0
+10000000000.1 >> 1
+10000000000.1 >> 2
+10000000000.1 >> 3
+10000000000.1 >> 4
+10000000000.1 >> 5
+10000000000.1 >> 6
+10000000000.1 >> 7
+10000000000.1 >> 8
+10000000000.1 >> 9
+10000000000.1 >> 10
+10000000000.1 >> 11
+10000000000.1 >> 12
+10000000000.1 >> 13
+10000000000.1 >> 14
+10000000000.1 >> 15
+10000000000.1 >> 16
+10000000000.1 >> 17
+10000000000.1 >> 18
+10000000000.1 >> 19
+10000000000.01 >> 0
+10000000000.01 >> 1
+10000000000.01 >> 2
+10000000000.01 >> 3
+10000000000.01 >> 4
+10000000000.01 >> 5
+10000000000.01 >> 6
+10000000000.01 >> 7
+10000000000.01 >> 8
+10000000000.01 >> 9
+10000000000.01 >> 10
+10000000000.01 >> 11
+10000000000.01 >> 12
+10000000000.01 >> 13
+10000000000.01 >> 14
+10000000000.01 >> 15
+10000000000.01 >> 16
+10000000000.01 >> 17
+10000000000.01 >> 18
+10000000000.01 >> 19
+10000000000.001 >> 0
+10000000000.001 >> 1
+10000000000.001 >> 2
+10000000000.001 >> 3
+10000000000.001 >> 4
+10000000000.001 >> 5
+10000000000.001 >> 6
+10000000000.001 >> 7
+10000000000.001 >> 8
+10000000000.001 >> 9
+10000000000.001 >> 10
+10000000000.001 >> 11
+10000000000.001 >> 12
+10000000000.001 >> 13
+10000000000.001 >> 14
+10000000000.001 >> 15
+10000000000.001 >> 16
+10000000000.001 >> 17
+10000000000.001 >> 18
+10000000000.001 >> 19
+10000000000.0001 >> 0
+10000000000.0001 >> 1
+10000000000.0001 >> 2
+10000000000.0001 >> 3
+10000000000.0001 >> 4
+10000000000.0001 >> 5
+10000000000.0001 >> 6
+10000000000.0001 >> 7
+10000000000.0001 >> 8
+10000000000.0001 >> 9
+10000000000.0001 >> 10
+10000000000.0001 >> 11
+10000000000.0001 >> 12
+10000000000.0001 >> 13
+10000000000.0001 >> 14
+10000000000.0001 >> 15
+10000000000.0001 >> 16
+10000000000.0001 >> 17
+10000000000.0001 >> 18
+10000000000.0001 >> 19
+10000000000.00001 >> 0
+10000000000.00001 >> 1
+10000000000.00001 >> 2
+10000000000.00001 >> 3
+10000000000.00001 >> 4
+10000000000.00001 >> 5
+10000000000.00001 >> 6
+10000000000.00001 >> 7
+10000000000.00001 >> 8
+10000000000.00001 >> 9
+10000000000.00001 >> 10
+10000000000.00001 >> 11
+10000000000.00001 >> 12
+10000000000.00001 >> 13
+10000000000.00001 >> 14
+10000000000.00001 >> 15
+10000000000.00001 >> 16
+10000000000.00001 >> 17
+10000000000.00001 >> 18
+10000000000.00001 >> 19
+10000000000.000001 >> 0
+10000000000.000001 >> 1
+10000000000.000001 >> 2
+10000000000.000001 >> 3
+10000000000.000001 >> 4
+10000000000.000001 >> 5
+10000000000.000001 >> 6
+10000000000.000001 >> 7
+10000000000.000001 >> 8
+10000000000.000001 >> 9
+10000000000.000001 >> 10
+10000000000.000001 >> 11
+10000000000.000001 >> 12
+10000000000.000001 >> 13
+10000000000.000001 >> 14
+10000000000.000001 >> 15
+10000000000.000001 >> 16
+10000000000.000001 >> 17
+10000000000.000001 >> 18
+10000000000.000001 >> 19
+10000000000.0000001 >> 0
+10000000000.0000001 >> 1
+10000000000.0000001 >> 2
+10000000000.0000001 >> 3
+10000000000.0000001 >> 4
+10000000000.0000001 >> 5
+10000000000.0000001 >> 6
+10000000000.0000001 >> 7
+10000000000.0000001 >> 8
+10000000000.0000001 >> 9
+10000000000.0000001 >> 10
+10000000000.0000001 >> 11
+10000000000.0000001 >> 12
+10000000000.0000001 >> 13
+10000000000.0000001 >> 14
+10000000000.0000001 >> 15
+10000000000.0000001 >> 16
+10000000000.0000001 >> 17
+10000000000.0000001 >> 18
+10000000000.0000001 >> 19
+10000000000.00000001 >> 0
+10000000000.00000001 >> 1
+10000000000.00000001 >> 2
+10000000000.00000001 >> 3
+10000000000.00000001 >> 4
+10000000000.00000001 >> 5
+10000000000.00000001 >> 6
+10000000000.00000001 >> 7
+10000000000.00000001 >> 8
+10000000000.00000001 >> 9
+10000000000.00000001 >> 10
+10000000000.00000001 >> 11
+10000000000.00000001 >> 12
+10000000000.00000001 >> 13
+10000000000.00000001 >> 14
+10000000000.00000001 >> 15
+10000000000.00000001 >> 16
+10000000000.00000001 >> 17
+10000000000.00000001 >> 18
+10000000000.00000001 >> 19
+10000000000.000000001 >> 0
+10000000000.000000001 >> 1
+10000000000.000000001 >> 2
+10000000000.000000001 >> 3
+10000000000.000000001 >> 4
+10000000000.000000001 >> 5
+10000000000.000000001 >> 6
+10000000000.000000001 >> 7
+10000000000.000000001 >> 8
+10000000000.000000001 >> 9
+10000000000.000000001 >> 10
+10000000000.000000001 >> 11
+10000000000.000000001 >> 12
+10000000000.000000001 >> 13
+10000000000.000000001 >> 14
+10000000000.000000001 >> 15
+10000000000.000000001 >> 16
+10000000000.000000001 >> 17
+10000000000.000000001 >> 18
+10000000000.000000001 >> 19
+10000000000.0000000001 >> 0
+10000000000.0000000001 >> 1
+10000000000.0000000001 >> 2
+10000000000.0000000001 >> 3
+10000000000.0000000001 >> 4
+10000000000.0000000001 >> 5
+10000000000.0000000001 >> 6
+10000000000.0000000001 >> 7
+10000000000.0000000001 >> 8
+10000000000.0000000001 >> 9
+10000000000.0000000001 >> 10
+10000000000.0000000001 >> 11
+10000000000.0000000001 >> 12
+10000000000.0000000001 >> 13
+10000000000.0000000001 >> 14
+10000000000.0000000001 >> 15
+10000000000.0000000001 >> 16
+10000000000.0000000001 >> 17
+10000000000.0000000001 >> 18
+10000000000.0000000001 >> 19
diff --git a/contrib/bc/tests/fuzzing/bc_inputs2/sine.txt b/contrib/bc/tests/fuzzing/bc_inputs2/sine.txt
new file mode 100644
index 000000000000..d3a547bcd796
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/bc_inputs2/sine.txt
@@ -0,0 +1,207 @@
+scale = 25
+p = 4 * a(1)
+scale = 20
+s(0)
+s(0.5)
+s(1)
+s(2)
+s(3)
+s(-0.5)
+s(-1)
+s(-2)
+s(-3)
+s(p / 7)
+s(-p / 7)
+s(p / 4)
+s(-p / 4)
+s(p / 3)
+s(-p / 3)
+s(p / 2)
+s(-p / 2)
+s(3 * p / 4)
+s(3 * -p / 4)
+s(p)
+s(-p)
+s(3 * p / 2)
+s(3 * -p / 2)
+s(7 * p / 4)
+s(7 * -p / 4)
+s(13 * p / 4)
+s(13 * -p / 4)
+s(2 * p)
+s(2 * -p)
+s(131231)
+s(-131231)
+s(69.1967507777)
+s(10828)
+s(-16248506.847013148)
+s(2050281000)
+s(8224939)
+s(11334231.1154662464)
+s(-4109411249.2986954846)
+s(-2395915402.13984)
+s(-2795874313)
+s(-2262647256)
+s(3323158182.1239222084)
+s(99901384)
+s(-4202726050.2780080957)
+s(2870000621.3228830588)
+s(-4230239450.981045150)
+s(-1517506941.2678857223)
+s(4004582176)
+s(-4193724543.1108508063)
+s(-3432511261)
+s(1804484812)
+s(3229084127)
+s(-3565317246.583937244)
+s(3503281621)
+s(-3469146313.1766891244)
+s(-2257308049.307721068)
+s(-3978441809)
+s(3431564304.3752537)
+s(1249644440.2464914559)
+s(2395558891.1188487974)
+s(-2607820706.4079280116)
+s(1208310007)
+s(-3758597557.863203175)
+s(1186920672)
+s(-3988103872)
+s(-4280635328.4194857577)
+s(1051748072)
+s(-1884006279)
+s(-1046568719.2698663389)
+s(2482991410)
+s(-2106101268.1154045959)
+s(3530359346.77217900)
+s(-3373362543)
+s(2601598062)
+s(2987020862)
+s(-12033356.2057140648)
+s(-3721760707)
+s(2842387705.4145759704)
+s(3515832681.1808393297)
+s(-3658522034.16149)
+s(3963658030.2860423992)
+s(2977802215.597946655)
+s(-4271392570.4091498761)
+s(2378692585)
+s(-3545193743.629374782)
+s(-1762458738)
+s(-1174277828.4264040126)
+s(-1724994857)
+s(2802750230.1783499408)
+s(-3068133550)
+s(3324811474.621822235)
+s(2873024984)
+s(-3509056632.3888206298)
+s(1772903162.647192879)
+s(2836543102)
+s(4117858580.186)
+s(2988632386.4063754522)
+s(-4256784971.1770067447)
+s(2280820447)
+s(-2865200306)
+s(-3329592486)
+s(519126268)
+s(-2452430452)
+s(-2693220186.62104082)
+s(-3796811992.14485798)
+s(3619792326)
+s(2697791049.3038381550)
+s(3751267834.2808166557)
+s(-3761719074)
+s(-3824087631)
+s(2119301150)
+s(1398148974)
+s(-3386564819.1351816969)
+s(-3171483098)
+s(3688944941.3273318162)
+s(3060521119)
+s(-3527110404)
+s(3699631193)
+s(3872838898)
+s(3880350192)
+s(-4109411249.2986954846)
+s(-2395915402.13984)
+s(-2795874313)
+s(-2262647256)
+s(3323158182.1239222084)
+s(99901384)
+s(-4202726050.2780080957)
+s(2870000621.3228830588)
+s(-4230239450.981045150)
+s(-1517506941.2678857223)
+s(4004582176)
+s(-4193724543.1108508063)
+s(-3432511261)
+s(1804484812)
+s(3229084127)
+s(-3565317246.583937244)
+s(3503281621)
+s(-3469146313.1766891244)
+s(-2257308049.307721068)
+s(-3978441809)
+s(3431564304.3752537)
+s(1249644440.2464914559)
+s(2395558891.1188487974)
+s(-2607820706.4079280116)
+s(1208310007)
+s(-3758597557.863203175)
+s(1186920672)
+s(-3988103872)
+s(-4280635328.4194857577)
+s(1051748072)
+s(-1884006279)
+s(-1046568719.2698663389)
+s(2482991410)
+s(-2106101268.1154045959)
+s(3530359346.77217900)
+s(-3373362543)
+s(2601598062)
+s(2576349783.2446436039)
+s(2987020862)
+s(-12033356.2057140648)
+s(-3721760707)
+s(2842387705.4145759704)
+s(3515832681.1808393297)
+s(-3658522034.16149)
+s(3963658030.2860423992)
+s(2977802215.597946655)
+s(-4271392570.4091498761)
+s(2378692585)
+s(-3545193743.629374782)
+s(-1762458738)
+s(-1174277828.4264040126)
+s(-1724994857)
+s(2802750230.1783499408)
+s(-3068133550)
+s(3324811474.621822235)
+s(2873024984)
+s(-3509056632.3888206298)
+s(1772903162.647192879)
+s(2836543102)
+s(4117858580.186)
+s(2988632386.4063754522)
+s(-4256784971.1770067447)
+s(2280820447)
+s(-2865200306)
+s(-3329592486)
+s(519126268)
+s(-2452430452)
+s(-2693220186.62104082)
+s(-3796811992.14485798)
+s(3619792326)
+s(2697791049.3038381550)
+s(3751267834.2808166557)
+s(-3761719074)
+s(-3824087631)
+s(2119301150)
+s(1398148974)
+s(-3386564819.1351816969)
+s(-3171483098)
+s(3688944941.3273318162)
+s(3060521119)
+s(-3527110404)
+s(3699631193)
+s(3872838898)
+s(3880350192)
diff --git a/contrib/bc/tests/fuzzing/bc_inputs3/01.txt b/contrib/bc/tests/fuzzing/bc_inputs3/01.txt
new file mode 100644
index 000000000000..c016263a9381
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/bc_inputs3/01.txt
@@ -0,0 +1,339 @@
+a(s001020001l[ba])
+scal[ ca]
+a
+a
+e
+cs
+c
+
+a
+s(scal[ ba])
+scal[ ca]
+u
+a
+e
+cs
+c
+
+a
+s(scal[ ba])
+scal[ ca]
+u
+a
+s
+c = l[ ca]
+a
+a
+sa
+e
+cs
+c
+
+a(s001020001l[ ba])
+scal[ ca]
+a
+a
+e
+cs
+c
+
+a
+s(scal[ ba])
+scal[ ca]
+a
+a
+s
+c = l[ ca]
+a
+s
+c = l[ ca]
+a(s001020001l[ ba])
+a
+e
+cs
+c
+
+a
+s(scal[ ba])
+scal[ ca]
+u
+a
+s
+c = l[ ca]
+a
+a
+sa
+e
+cs
+c
+
+a(s001020001l[ ba])
+scal[ ca]
+a
+a*e
+cs
+c
+
+a
+s(scal[ ba])
+scal[ ca]
+a
+a
+s
+c = l[ ca]
+a
+a
+sa
+e
+css
+c = c[ ca]
+a
+a
+sa
+e
+cs
+a
+a
+sa
+e
+cs
+c
+
+a(s001020001l[ ba])
+ cs
+c = l[ ca]
+a
+a
+sa
+e
+cs
+c
+
+a(s001020001l[ ba])
+scal[ ca]
+a
+a
+e
+cs
+c
+
+a
+s(scal[ ba])
+scal[ ca]
+a
+a
+s
+c = l[ ca]
+a
+a
+sa
+e
+css
+c = l[ ca]
+a
+a
+sa
+e
+cs
+a
+b
+sa
+e
+cs
+c
+
+a(s001020001l[ ba])
+scal[ ca]
+a
+a
+e
+cs
+
+scal[ ca]
+a
+a
+e
+cs
+c
+
+a
+s(scal[ ba])
+scal[ ca]
+u
+a
+s
+c = l[ ca]
+a
+a
+sa
+e
+cs
+c
+
+a(s001020001l[ ba])
+scal[ ca]
+a
+a
+e
+cs
+c
+
+a
+s(scal[ ba])
+scal[ ca]
+a
+a
+s
+c = l[ ca]
+a
+a
+sa
+e
+css
+c = l[ ca]
+a
+a
+sa
+e
+cs
+a
+a
+sa
+e
+cs
+c
+
+a(s001020001l[ ba])
+sc0
+c = l[ ca]
+a
+a
+sa
+e
+cs
+c
+
+a(s001020001l[ ba])
+scal[ ca]
+a
+a
+e
+cs
+c
+
+a
+s(scal[ ba])
+s(1)
+sd= 20
+a(0)
+a=i-=se-=as0-=se-=as0-=i-=s-=se-=xse!=e-=as=ase-=se-=as-=ase-=se-=as-=se-=a(1)
+s0000^aaaaaaaaaaaaaaa20
+a(0)
+a=i-=se-=ase-=se-=ase-=i-=s-=se-=xse!=e-=as=ase-=se-=as-=a00-=se-=as-=se-=axse!=e-=ase-=i-=se-=ase-=se-=se-=ase-=se-=as-=e-=as=ase-=se-=as-=as=i-=se-=ase-=se-=se-=ase-=se-=as-=e-=as=ase-=se-=as-=ase-=se-=as-=se-=a(1)
+scscales=ase-=se-=as-=ase-=se-=as-=se-=a(1)
+scscale ==se-=a(1)
+sd= 20
+a(0)
+a=i-=se-=ase-=se-=ase-=i-=s-=se-=xse!=e-=as=ase-=se-=as-=ase-=se-=as-=se-=a(1)
+scale ==se-=a(1)
+scale = 20
+a(0)
+a==se-=as+=ase-=se8=as-=se-=a(1)
+s ==se-=a(1)
+scale = 20
+a(0)
+a=i-=se-=ase-=se-=ase-=i-=se-=xse!=e-=ase-=i-=se-=ase-=se-=se-=ase-=se-=as-=e-=as=ase-=se-=as-=ase-=se-=as-=se-=a(1)
+scscale ==se-=a(1)
+scale = 20
+a(0)
+a=i-=se-=ase-=se-=ase-=i-=s-=se-=xse!=e-=se-=a(1)
+scale = 20
+a(0)
+a=i-=se-=ase-=se-=ase-=i-=s-=se-=xse!=e-=a0=as-=ase-=se-=se0=ase-=se-=as-=e-=as=ae-=a(1)
+sc= 20
+a(0)
+a=i-=se-=ase-=se-=ase-=i-=se-=xse!=e-=ase-=i-=se-=ase-=se-=se-=ase-=se-=as-=e-=as=ase-=se-=as-=ase-=se-=as-=se-=a(1)
+scscale ==se-=a(1)
+sd= 20
+a(0)
+a=i-=se-=ase-=se-=ase-=i-=s-=se-=xse!=e-=as=ase = 20
+a(0)
+a=i-=se-=ase-=se-=ase-=s-=e-=as=ase-=se-=as-=ase-=se-=as-=se-=a(1)
+scscale ==se-=a(1)
+scale = 20
+a(0)
+a=i-=se-=ase-=se-=ase-=i-=s-=se-=xse!=e-=a0=as-=ase-=se-=se0=ase-=se-=as-=e-=as=ase-=se-=as-=ase-=se-=as-=se-=a(1)
+scscale ==se-=a(1)
+scale = 20
+a(0)
+a=i-=se-=ase-=se-=ase-=i-=s-=se-=xse!=e-=a0=ase-=se-=as-=ase-=se-=as-=se-=a(1)
+scale ==se-=a(1)
+scale = 20
+a(0)
+a=i-=se-=ase-=se-=ase-=i-=se-=xse!=e-=ase-=i-=se-=ase-=se-=se-=ase-=se-=as*=e-=as=aaaaaaaaaaaaaaaaaaaaaaa^aaaaaaaaaaaaaaa20
+a(0)
+a=i-=se-=ase-=se-=as0-=i-=s-=se-=xse!=e-=as=ase-=se-=as-=as0-=se-=as-=se-=axse!=e-=ase-=i-=se-=as0-=se-=se-=ase-=se-=as-=e-=as=ase-=se-=a0-=a0=i-=se-=as0-=se-=se-=ase-=se-=as-=e-=as=as0-=se-=as-=ase-=se-=as-=se-=a(1)
+scscale ==ss0-=ase-=s-=e-=as=ase-=se-=as-=ase-=se-=as-=se-=a(1)
+scscale ==se-=a(1)
+scale = 20
+a(0)
+a=i-=se-=ase-=se-=ase-=i-=s-=se-=xse!=e-=as=as-=ase-=se-=se0=ase-=se-=as-=e-=as=a000=se-=as-=ase-=se-=as-=se-=a(1)
+scscale ==se-=a(1)
+scale = 20
+a(0)
+a=i-=se-=as0-=se-=as0-=i-=s-=se-=xse!=e-=a0=ase-=se-=as-=ase-=se-=as-=se-=a(1)
+scale ==se-=a(1)
+scale = 20
+a(0)
+a=i-=se-=ase-=se-=ase-=i-=se-=xse!=e-=ase-=i-=se-=ase-=se-=se-=ase-=se-=a0-=e-=as=aaaaaaaaaaaaaaaaaaaaaaa^aaaaaaaaaaaaaaa20
+a(0)
+a=i-=se-=ase-=se-=ase-=i-=s-=se-=xse!=e-=as=ase-=se-=as-=ase-=se-=as-=se-=axse!=e-=ase-=i-=se-=as0-=se-=se-=ase-=se-=as-=e-=as=as0-=se-=as-=as=i-=se-=ase-=se-=se-=ase-=se-=as-=e-=as=ase-=se-=as-=ase-=se-=as-=se-=a(1)
+scscale ==se-=a(1)
+scale = 20
+a(0)
+a=i-=se-=as0-=se-=ase-=i-=s-=se-=xse!=e-=as=ase-=se-=as-=ase-=se-=as-=se-=a(1)
+scale ==se-=a(1)
+scale = 20
+a(0)
+a=i-=se-=as0-=as-=as0-=se-=as-=as0
+a(0)
+a=i-=se-=as0-=se-=as0-=i-=s-=se-=xse!=e-=as=as0-=se-=as-=ase-=se-=as-=se-=a(1)
+scale ==se-=a(1)
+scale = 20
+a(0)
+a=i-=se-=as0-=se-=ase-=i-=se-=xse!=e-=ase-=i-=se-=as0-=se-=se-=as0-=a0a^aaaaaaaaaaaaaaa20
+a(0)
+a=i-=se-=ase-=se-=ase-=i-=s-=se-=xse!=e-=as=ase-=se-=as-=ase-=se-=as-=se-=axse!=e-=ase-=i-=se-=ase-=se-=se-=ase-=se-=a0-=e-=as=ase-=se-=as-=as=i-=se-=ase-=se-=se-=ase-=se-=as-=e-=as=ase-=se-=as-=ase-=se-=as-=se-=a(1)
+scscales=ase-=se-=as-=ase-=se-=as-=se-=a(1)
+scscale ==se-=a(1)
+sd= 20
+a(0)
+a=i-=se-=ase-=se-=ase-=i-=s-=se-=xse!=e-=as=ase-=se-=as-=ase-=se-=as-=se-=a(1)
+de ==se-=a(1)
+scale = 20
+a(0)
+a==se-=as-=ase-=se0=as-=se-=a(1)
+s ==se-=a(1)
+scale = 20
+a(0)
+a=i-=se-=ase-=se-=ase-=i-=se-=xse!=e-=ase-=i-=se-=ase-=se-=se-=ase-=se-=as-=e-=as=ase-=se-=as-=ase-=se-=as-=se-=a(1)
+scscale ==se-=a(1)
+scale = 20
+a(0)
+a=i-=se-=ase-=se-=ase-=i-=s-=se-=xse!=e-=se-=a(1)
+scale = 20
+a(0)
+a=i-=se-=ase-=se-=ase-=i-=s-=se-=xse!=e-=as=as-=ase-=se-=se0=ase-=se-=as-=e-=as=ae-=a(1)
+sc= 20
+a(0)
+a=i-=se-=ase-=se-=ase-=i-=se-=xse!=e-=ase-=i-=se-=ase-=se-=se-=ase-=se-=as-=e-=as=ase-=se-=as-=ase-=se-=as-=se-=a(1)
+scscale ==se-=a(1)
+sd= 20
+a(0)
+a=i-=se-=ase-=se-=ase-=i-=s-=se-=xse!=e-=as=ase = 20
+a(0)
+a0i-=se-=ase-=se-=ase-=s-=e-=as=ase-=se-=as-=ase-=se-=as-=se-=a(1)
+scscale ==se-=a(1)
+scale = 20
+a(0)
+a=i-=se-=ase-=se-=ase-=i-=s-=se-=xse!=c-=a0=as-se-=se-=se0=ase-=se-=as-=e-=as=ase-=se-=as-=ase-=se-=as-=se-=a(1)
diff --git a/contrib/bc/tests/fuzzing/bc_inputs3/02.txt b/contrib/bc/tests/fuzzing/bc_inputs3/02.txt
new file mode 100644
index 000000000000..8cf0f3e6fec1
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/bc_inputs3/02.txt
@@ -0,0 +1 @@
+obase^= 20-f-b-4^-f-4-4^-f-4^-d
diff --git a/contrib/bc/tests/fuzzing/bc_inputs3/03.txt b/contrib/bc/tests/fuzzing/bc_inputs3/03.txt
new file mode 100644
index 000000000000..d0fc50564b6d
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/bc_inputs3/03.txt
@@ -0,0 +1,2 @@
+for (i = 0; ; )
+for (i = 0; ;(ssqrt()-p(srt(0-s(t(0-p(sstss(ssqrt()-p(ssssq(ssqrt()-p(ssqrt()-sst()-p(qrt()-p(s()-p(sq(ssqrt()-p(ssqrt()-sst()-p(qrt()-p(s(ssqrt()-p(t()-p(sstp(ssqrt()-sst()-p(qrt()-p(s()-p(srt()-s(ssqrt()-v(qrt(ssqrt()-p(ssqrt()-s(ssqrt()-p(ssssq(ssqrt()-p(ssq(ssqrt()-p(t()-sst(prt()-s(ssqrt()-p(q(ssqrt()-p(ssqrt()-sst()-ssqrt()-t(ss(s()-p(srt()-s(ssqrt()-p(s(ssqrtt()-p(ssqrt()-sst()-p(qrt()-p(s()-p(srt()-s(ssqrt()-p(sstss(ssqrt()-p(qr (itt()-p(q(s(ssqrt()-t(ss(ssqrt()-p(srt()-s(ssqrt()-p(sstss(ssqrt()-p(sstsq(ssqrt()-p(ssqrt()-sst()-p(qrt()-p(s()-p(srt()-s(ssqrt()-p(sstss(ssqrt()-p(sstsq(ssqrt()-p(ssqrt()-sst()-p(qrt()-p(s(ssqrt()-p(t()-p(sstp(ssqrt()-sst()-p(qrt()-p(s()-p(srt()-s(ssqrt()-p(sstss(ssqrt()-p(qr (itt()-p(q(s(ssqrt()-t(ss(ssqrt()-p(srt()-s(ssqrt()-p(sstss(ssqrt()-p(sstsq(ssqrt()-p(ssqrt()-sst()-p(qrt()-p(s()-p(srt()-s(ssqrt()-p(sstss(osqrt()-p(sstsq(ssqrt()-p(ssqrt()-sst()-p(qrt()-p(s(ssqrt()-p(ssqrt()-sstfor (itt()-p(q(s(ssqrt()-t(ss(ssqrt()-p(srt()-s(ssqrt()-p(sstss(sssq(ssqrt()-p(ssqrt()-sst()-prt()-s(ssqrt()-p(q(ssqrt()-ssqrt(qrt()-p(s()-p(srt(s(ssqrt()-p(q(ssqrt()-p(ssqrt()-sst()-p(qrt()-p(s(ssqrt()-p(ssqrt()-sst()-p(ssqrt()-ssq(ssqrt()-p(ssqrt()-sst()-p(qrt()-p(s-t()-s(ssurt()-p(sstss(ssqrt()-p(qr (itt()-p(q(s(ssqrt()-t(ss(ssqrt()-p(srt()-s(ssqrt()-p(sstss(ssqrt()-p(sstsq(ssqrt()-p(ssqrt()-sst()-p(qrt()-p(s()-p(srt()-s(ssqrt()-p(sstss(osqrt()-p(sstsq(ssqrt()-p(ssqrt()-sst()-p(qrt()-p(s(ssqrt()-p(ssqrt()-sstfor (itt()-p(q(s(ssqrt()-t(ss(ssqrt()-p(srt()-s(ssqrt()-p(sstss(sssq(ssqrt()-p(ssqrt()-sst()-prt()-s(ssqrt()-p(q(ssqrt()-ssqrt(qrt()-p(s()-p(srt(s(ssqrt()-p(q(ssqrt()-p(ssqrt()-sst()-p(qrt()-p(s(ssqrt()-p(ssqrt()-sst()-p(ssqrt()-ssq(ssqrt()-p(ssqrt()-sst()-p(qrt()-p(s-p(ssqrt()-sst()-p(qrt()-p(s(st()-p(srt()-s(ssqrt()-p(sstss(ssqrt()-p(ssssq(ssqrt()-p(ssqrt()-sst()-p(qrt()-p(s()-p(srt()-s(ssqrt()-p(sstss(ssqrt()-p(ssssq(ssqrt()-p(ssqrt()-sst()-p(qrtrrrrr()-p(s(ssqrt()-p(ssqrt()-sst()-p(ssqrt(qrt(ssqrt()-p(ssqrt()-s(ssqrt()-p(ssssq(ssqrt()-p(ssq(ssqrt()-p(ssqrt()-sst()-prt()-s(ssqrt()-p(q(ssqrt()-p(ssqrt()-sst()-ssqrt()-t(ss(s()-p(srt()-s(ssqrt()-p(s(ssqrtt()-p()))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000#000
diff --git a/contrib/bc/tests/fuzzing/bc_inputs3/04.txt b/contrib/bc/tests/fuzzing/bc_inputs3/04.txt
new file mode 100644
index 000000000000..c0965de53faf
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/bc_inputs3/04.txt
@@ -0,0 +1 @@
+"000000
diff --git a/contrib/bc/tests/fuzzing/bc_inputs3/05.txt b/contrib/bc/tests/fuzzing/bc_inputs3/05.txt
new file mode 100644
index 000000000000..99148974ea07
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/bc_inputs3/05.txt
@@ -0,0 +1 @@
+/*00000000
diff --git a/contrib/bc/tests/fuzzing/bc_inputs3/06.txt b/contrib/bc/tests/fuzzing/bc_inputs3/06.txt
new file mode 100644
index 000000000000..29fe6be37021
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/bc_inputs3/06.txt
@@ -0,0 +1 @@
+while (i == 0) {
diff --git a/contrib/bc/tests/fuzzing/bc_inputs3/07.txt b/contrib/bc/tests/fuzzing/bc_inputs3/07.txt
new file mode 100644
index 000000000000..e899d8547868
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/bc_inputs3/07.txt
@@ -0,0 +1,8 @@
+for(q=F;i<=020; ++i) #00
+{print "0"
+if(6)if(6){3
+ }
+{pr0n}
+"" }
+{pr0n}
+{print "" ""
diff --git a/contrib/bc/tests/fuzzing/bc_inputs3/08.txt b/contrib/bc/tests/fuzzing/bc_inputs3/08.txt
new file mode 100644
index 000000000000..8c5afd789bfa
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/bc_inputs3/08.txt
@@ -0,0 +1,3 @@
+define i(x){
+c0
+if(6)}
diff --git a/contrib/bc/tests/fuzzing/bc_inputs3/09.txt b/contrib/bc/tests/fuzzing/bc_inputs3/09.txt
new file mode 100644
index 000000000000..f7a347557d83
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/bc_inputs3/09.txt
@@ -0,0 +1,11 @@
+e
+-1\
+#00000
+{print"0"
+if(1)if(1)#0
+}
+if(0)if(0){3
+}
+else 4\
+#00000000000000000000000000
+}
diff --git a/contrib/bc/tests/fuzzing/bc_inputs3/10.txt b/contrib/bc/tests/fuzzing/bc_inputs3/10.txt
new file mode 100644
index 000000000000..23fb8689f598
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/bc_inputs3/10.txt
@@ -0,0 +1 @@
+d000$++
diff --git a/contrib/bc/tests/fuzzing/bc_inputs3/11.txt b/contrib/bc/tests/fuzzing/bc_inputs3/11.txt
new file mode 100644
index 000000000000..19e7e87b2d65
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/bc_inputs3/11.txt
@@ -0,0 +1,99 @@
+#0000000000000000
+
+define printarray(a[],len){
+
+auto i
+
+for(i=0; i < n; ++i) {
+ a[i]
+ }
+}
+
+define a2(a[], len) {
+
+ auto i
+
+ for (i = 0; i < len; ++i) {
+ a[i] = a[i] * a[i]
+ }
+
+ printarray(len, n)
+}
+
+define a4(a00[], l) {
+
+ auto i
+
+ for (i = 0; i < l; ++i) {
+ a[i] = a00[i] * a[i]
+ }
+
+ printarray(a00[], l)
+}
+
+define a6(*a00[], len) {
+
+ auto i
+
+ for (i = 0; i < len; ++i) {
+ a00[i] = a00[i] * a00[i]
+ }
+
+ printarray(a00[], len)
+}
+
+define a1(*a[], len) {
+
+ auto i
+
+ for (i = 0; i < len; ++i) {
+ a[i] = i
+ }
+
+ a2(a[], len)
+
+ printarray(a[], len)
+}
+
+define a0(*a00[], len) {
+
+ auto i
+
+ for (i = 0; i < len; ++i) {
+ a00[i] = i
+ }
+
+ a0(a00[], len)
+
+ printarray(a00[], len)
+}
+
+define a5(*a00[], len) {
+
+ auto i
+
+ for (i = 0; i < len; ++i) {
+ a00[i] = i
+ }
+
+ a0(a00[], len)
+
+ printarray(a, len)
+}
+
+define a7(*a00[], len) {
+
+ auto i
+
+ for (i = 0; i < len; ++i) {
+ a00[i] = i
+ }
+
+ a0(a00[], len)
+
+ printarray(a00[], len)
+}
+
+len = 16
+
+a1(a[], len)
diff --git a/contrib/bc/tests/fuzzing/bc_inputs3/12.txt b/contrib/bc/tests/fuzzing/bc_inputs3/12.txt
new file mode 100644
index 000000000000..143bb71deeda
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/bc_inputs3/12.txt
@@ -0,0 +1,2 @@
+for (v ;!j -90-90; ++i)
+a= ibase ++;0
diff --git a/contrib/bc/tests/fuzzing/bc_inputs3/13.txt b/contrib/bc/tests/fuzzing/bc_inputs3/13.txt
new file mode 100644
index 000000000000..5628ba703cde
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/bc_inputs3/13.txt
@@ -0,0 +1,56 @@
+#0
+
+define z(a[]) {for (i = 0; i < l; ++i) {
+ a[i]
+ }
+}
+
+define x(a[]) {
+
+ #00000000000000000000000000000000000
+ auto a
+
+ for (a = 0; a < l; ++a) {
+ a[a] = -a
+ }
+
+ z(a[])
+}
+
+define g(x[], y[]) {
+ return x[0] - y[0]
+}
+
+define h(u000 x[]) {
+ return g(x[], y[])
+}
+
+define m(*x[], *y[]) {
+ return x[0] / y[0]
+}
+
+define n(*y[], *x[]) {
+ return m(x[], y[])
+}
+
+for (i = 0; i < 101; ++i) {
+ a[i] = i
+}
+
+a[104] = 200
+
+l = length(a[])
+
+for (i = 0; i <= l; ++i) {
+ a[i]
+}
+
+z(a[])
+x(a[])
+z(a[])
+l
+
+x[0] = 5
+y[0] = 4
+
+h(x[], y[])
diff --git a/contrib/bc/tests/fuzzing/bc_inputs3/14.txt b/contrib/bc/tests/fuzzing/bc_inputs3/14.txt
new file mode 100644
index 000000000000..2487d82acd48
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/bc_inputs3/14.txt
@@ -0,0 +1 @@
+a(int32(O100000000))
diff --git a/contrib/bc/tests/fuzzing/bc_inputs3/15.txt b/contrib/bc/tests/fuzzing/bc_inputs3/15.txt
new file mode 100644
index 000000000000..cf1f81dfb005
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/bc_inputs3/15.txt
@@ -0,0 +1,3 @@
+for (i = 0; int32(29834); ++i) {
+ i
+}
diff --git a/contrib/bc/tests/fuzzing/bc_inputs3/16.txt b/contrib/bc/tests/fuzzing/bc_inputs3/16.txt
new file mode 100644
index 000000000000..977569bda330
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/bc_inputs3/16.txt
@@ -0,0 +1 @@
+"0 \ No newline at end of file
diff --git a/contrib/bc/tests/fuzzing/bc_inputs3/17.txt b/contrib/bc/tests/fuzzing/bc_inputs3/17.txt
new file mode 100644
index 000000000000..f158be7e5f48
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/bc_inputs3/17.txt
@@ -0,0 +1,11 @@
+print "000000000000000000\n"
+
+s = s0
+
+m = 0
+
+for (i = 0; i < 100; ++i) {
+ a[i] =d()
+ s= a[i]
+ b[i] = irand(u0)
+}
diff --git a/contrib/bc/tests/fuzzing/bc_inputs3/18.txt b/contrib/bc/tests/fuzzing/bc_inputs3/18.txt
new file mode 100644
index 000000000000..9f338c1f5a65
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/bc_inputs3/18.txt
@@ -0,0 +1,3 @@
+while(0){
+
+define
diff --git a/contrib/bc/tests/fuzzing/bc_inputs3/19.txt b/contrib/bc/tests/fuzzing/bc_inputs3/19.txt
new file mode 100644
index 000000000000..1edb8c62d49a
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/bc_inputs3/19.txt
@@ -0,0 +1,5 @@
+define i(x){
+
+i(10)
+ibase
+o(10)`0000
diff --git a/contrib/bc/tests/fuzzing/bc_inputs3/20.txt b/contrib/bc/tests/fuzzing/bc_inputs3/20.txt
new file mode 100644
index 000000000000..465146d458fd
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/bc_inputs3/20.txt
@@ -0,0 +1,51 @@
+define w() { auto z; return 1; }
+define x() {
+"0"
+return (1)
+}
+define y() {
+"0"
+ return (2)
+}
+define z() {
+ "0"
+ return (3)
+}
+define v() { return }
+
+v()
+
+w()
+
+if (x() == y()) { 0 }
+1
+if (x() <= y()) { 2 }
+if (y() >= x()) { 3 }
+if (x() != y()) { 4 }
+if (x() < y()) { 5 }
+if (y() > x()) { 6 }
+
+if (x() == z()) { 100}
+10
+if (x() <= z()) { 10 }
+if (z() >= x()) { 10 }
+if (x() != z()) { 10 }
+if (x() < z()) { 10 }
+if (z() > x()) { 10 }
+
+x = -10
+while (x <= 0) {
+ x
+ if (x == -5) break;
+ x += 1
+}
+
+define u() {
+ auto a[];
+ return a[H]
+}
+
+u()
+
+if (x == -4) x
+000000000000000000000000
diff --git a/contrib/bc/tests/fuzzing/bc_inputs3/21.txt b/contrib/bc/tests/fuzzing/bc_inputs3/21.txt
new file mode 100644
index 000000000000..531705b29237
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/bc_inputs3/21.txt
@@ -0,0 +1,10 @@
+define i(x) {
+ ibase=x
+ s0=x
+ return 74; b=100.000000000000;e
+}
+
+i(11)
+ibase
+o0
+0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
diff --git a/contrib/bc/tests/fuzzing/bc_inputs3/22.txt b/contrib/bc/tests/fuzzing/bc_inputs3/22.txt
new file mode 100644
index 000000000000..f7a91f0b7774
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/bc_inputs3/22.txt
@@ -0,0 +1,2 @@
+#00000000000000 0
+ for(i = 0; i < M; ++i) l000000000000= length(a00000000iii= l[]0
diff --git a/contrib/bc/tests/fuzzing/bc_inputs3/23.txt b/contrib/bc/tests/fuzzing/bc_inputs3/23.txt
new file mode 100644
index 000000000000..15045f277e00
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/bc_inputs3/23.txt
Binary files differ
diff --git a/contrib/bc/tests/fuzzing/bc_inputs3/24.txt b/contrib/bc/tests/fuzzing/bc_inputs3/24.txt
new file mode 100644
index 000000000000..25f98c159d4f
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/bc_inputs3/24.txt
@@ -0,0 +1,4 @@
+perm(10,2)
+comb(10,2)
+perm(6,2)
+b(6,++i[]
diff --git a/contrib/bc/tests/fuzzing/bc_inputs3/sqrt.txt b/contrib/bc/tests/fuzzing/bc_inputs3/sqrt.txt
new file mode 100644
index 000000000000..07cdee66492c
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/bc_inputs3/sqrt.txt
@@ -0,0 +1,14 @@
+scale = 20
+sqrt(0)
+sqrt(2)
+sqrt(4)
+sqrt(9)
+sqrt(16)
+sqrt(25)
+sqrt(121)
+sqrt(48765)
+sqrt(9287356207356)
+sqrt(0.189274385967238956872354)
+sqrt(12389467137496823.134567829387456283946)
+sqrt(.0000000000000000000000000000123)
+sqrt(1)
diff --git a/contrib/bc/tests/fuzzing/bc_inputs3/strings.txt b/contrib/bc/tests/fuzzing/bc_inputs3/strings.txt
new file mode 100644
index 000000000000..1cb7d6a61c54
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/bc_inputs3/strings.txt
@@ -0,0 +1,12 @@
+"string"
+"another string"
+"yet
+another
+string"
+"noescapes\n"
+"newline
+"
+print "string"
+print "newline\n"
+
+print "\\\e\n"
diff --git a/contrib/bc/tests/fuzzing/bc_inputs3/subtract.txt b/contrib/bc/tests/fuzzing/bc_inputs3/subtract.txt
new file mode 100644
index 000000000000..e3ea1ced9ec5
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/bc_inputs3/subtract.txt
@@ -0,0 +1,153 @@
+0 - 0
+0 - 1
+1 - 0
+1 - 1
+5 - 2
+2 - 9
+321974 - 12845976238457
+2874519803456710938465 - 384723854
+10000000000000000000000000000000000000000 - 999999999999999999999999999999999999999
+10000000000000000000000000000000000000000 - 9999999999999999999999999999999999999999
+10000000000000000000000000000000000000000 - 999999999999999999999999999999999999999.99999999999999999999999999999999999
+10000000000000000000000000000000000000000 - 9999999999999999999999999999999999999999.9999999999999999999999999999999999
+10000000000000000000000000000000000000000 - 0.00000000000000000000000000000000000000000000000000000000000000000000000000000000000001
+10000000000000000000000000000000000000001 - 0.00000000000000000000000000000000000000000000000000000000000000000000000000000000000001
+10000000000000000000000000000000000000000.0000000001 - 0.0000000000000000000000000000000000000000000000000000000000000000000000000001
+-2 - 6
+-23784692345 - 182934721309467230894628735496027345
+-224352354962873059862 - -1245723576829456278354960278345
+-3468273598 - -12354243
+-0.92345768293 - -2354768923
+-712384634.123476823 - -24768293376
+-1879234638 - -0.917234869234
+-0.9172438692134 - -0.971284967124
+-0.1283475123465 - -0.937462346
+-124765829346.2837468293562 - -0.923467829346
+-12476829385769 - -1928476259034.8378629356
+-0.38476284395876345 - -94875394587623.2357869324857
+-4674596708467.34754789403674343567 - -48672394852354698.237548629345
+979519669 - 3018100865
+929002449 - 3280677283
+0 - -525898
+3- - -3
+18297034019823741908237410928374.81920734712098347109281029873 - 182907.12809
+182039471029834 - 282039471029834
+282039471029834 - 182039471029834
+182039471029834.2801722893 - 282039471029834
+282039471029834.2801722893 - 182039471029834
+182039471029834.2801722893 - 282039471029834.2838
+282039471029834.2801722893 - 182039471029834.2838
+182039471029834 - 282039471029834.2801722893
+282039471029834 - 182039471029834.2801722893
+182039471029834.8297282893 - 282039471029834.2801722893
+282039471029834.8297282893 - 182039471029834.2801722893
+471029834 - 282039471029834
+471029834 - 182039471029834
+471029834.2801722893 - 282039471029834
+471029834.2801722893 - 182039471029834
+471029834.2801722893 - 282039471029834.2838
+471029834.2801722893 - 182039471029834.2838
+471029834 - 282039471029834.2801722893
+471029834 - 182039471029834.2801722893
+471029834.8297282893 - 282039471029834.2801722893
+471029834.8297282893 - 182039471029834.2801722893
+182039471029834 - 471029834
+282039471029834 - 471029834
+182039471029834.2801722893 - 471029834
+282039471029834.2801722893 - 471029834
+182039471029834.2801722893 - 471029834.2838
+282039471029834.2801722893 - 471029834.2838
+182039471029834 - 471029834.2801722893
+282039471029834 - 471029834.2801722893
+182039471029834.8297282893 - 471029834.2801722893
+282039471029834.8297282893 - 471029834.2801722893
+-182039471029834 - 282039471029834
+-282039471029834 - 182039471029834
+-182039471029834.2801722893 - 282039471029834
+-282039471029834.2801722893 - 182039471029834
+-182039471029834.2801722893 - 282039471029834.2838
+-282039471029834.2801722893 - 182039471029834.2838
+-182039471029834 - 282039471029834.2801722893
+-282039471029834 - 182039471029834.2801722893
+-182039471029834.8297282893 - 282039471029834.2801722893
+-282039471029834.8297282893 - 182039471029834.2801722893
+-471029834 - 282039471029834
+-471029834 - 182039471029834
+-471029834.2801722893 - 282039471029834
+-471029834.2801722893 - 182039471029834
+-471029834.2801722893 - 282039471029834.2838
+-471029834.2801722893 - 182039471029834.2838
+-471029834 - 282039471029834.2801722893
+-471029834 - 182039471029834.2801722893
+-471029834.8297282893 - 282039471029834.2801722893
+-471029834.8297282893 - 182039471029834.2801722893
+-182039471029834 - 471029834
+-282039471029834 - 471029834
+-182039471029834.2801722893 - 471029834
+-282039471029834.2801722893 - 471029834
+-182039471029834.2801722893 - 471029834.2838
+-282039471029834.2801722893 - 471029834.2838
+-182039471029834 - 471029834.2801722893
+-282039471029834 - 471029834.2801722893
+-182039471029834.8297282893 - 471029834.2801722893
+-282039471029834.8297282893 - 471029834.2801722893
+182039471029834 - -282039471029834
+282039471029834 - -182039471029834
+182039471029834.2801722893 - -282039471029834
+282039471029834.2801722893 - -182039471029834
+182039471029834.2801722893 - -282039471029834.2838
+282039471029834.2801722893 - -182039471029834.2838
+182039471029834 - -282039471029834.2801722893
+282039471029834 - -182039471029834.2801722893
+182039471029834.8297282893 - -282039471029834.2801722893
+282039471029834.8297282893 - -182039471029834.2801722893
+471029834 - -282039471029834
+471029834 - -182039471029834
+471029834.2801722893 - -282039471029834
+471029834.2801722893 - -182039471029834
+471029834.2801722893 - -282039471029834.2838
+471029834.2801722893 - -182039471029834.2838
+471029834 - -282039471029834.2801722893
+471029834 - -182039471029834.2801722893
+471029834.8297282893 - -282039471029834.2801722893
+471029834.8297282893 - -182039471029834.2801722893
+182039471029834 - -471029834
+282039471029834 - -471029834
+182039471029834.2801722893 - -471029834
+282039471029834.2801722893 - -471029834
+182039471029834.2801722893 - -471029834.2838
+282039471029834.2801722893 - -471029834.2838
+182039471029834 - -471029834.2801722893
+282039471029834 - -471029834.2801722893
+182039471029834.8297282893 - -471029834.2801722893
+282039471029834.8297282893 - -471029834.2801722893
+-182039471029834 - -282039471029834
+-282039471029834 - -182039471029834
+-182039471029834.2801722893 - -282039471029834
+-282039471029834.2801722893 - -182039471029834
+-182039471029834.2801722893 - -282039471029834.2838
+-282039471029834.2801722893 - -182039471029834.2838
+-182039471029834 - -282039471029834.2801722893
+-282039471029834 - -182039471029834.2801722893
+-182039471029834.8297282893 - -282039471029834.2801722893
+-282039471029834.8297282893 - -182039471029834.2801722893
+-471029834 - -282039471029834
+-471029834 - -182039471029834
+-471029834.2801722893 - -282039471029834
+-471029834.2801722893 - -182039471029834
+-471029834.2801722893 - -282039471029834.2838
+-471029834.2801722893 - -182039471029834.2838
+-471029834 - -282039471029834.2801722893
+-471029834 - -182039471029834.2801722893
+-471029834.8297282893 - -282039471029834.2801722893
+-471029834.8297282893 - -182039471029834.2801722893
+-182039471029834 - -471029834
+-282039471029834 - -471029834
+-182039471029834.2801722893 - -471029834
+-282039471029834.2801722893 - -471029834
+-182039471029834.2801722893 - -471029834.2838
+-282039471029834.2801722893 - -471029834.2838
+-182039471029834 - -471029834.2801722893
+-282039471029834 - -471029834.2801722893
+-182039471029834.8297282893 - -471029834.2801722893
+-282039471029834.8297282893 - -471029834.2801722893
diff --git a/contrib/bc/tests/fuzzing/bc_inputs3/trunc.txt b/contrib/bc/tests/fuzzing/bc_inputs3/trunc.txt
new file mode 100644
index 000000000000..364bb224a2e3
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/bc_inputs3/trunc.txt
@@ -0,0 +1,15 @@
+0$
+1$
+2$
+0.8249167203486$
+1.28937150237$
+2.0$
+28937.92837605126$
+2890.000000000$
+-1$
+-1.128973$
+-9812387.28910273$
+x = 83.298
+x$
+x = -1893.19
+(x)$
diff --git a/contrib/bc/tests/fuzzing/bc_inputs3/void.txt b/contrib/bc/tests/fuzzing/bc_inputs3/void.txt
new file mode 100644
index 000000000000..b85d70c8590a
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/bc_inputs3/void.txt
@@ -0,0 +1,20 @@
+define void stuff(x) {
+ print "x: ", x, "\n"
+}
+
+define void(x) {
+ return x
+}
+
+stuff(0)
+stuff(1)
+stuff(2.2839)
+stuff(-9.9289389)
+
+void(0)
+void(1)
+void(2.9823)
+void(-3.5982)
+
+void = .198389
+void + 10
diff --git a/contrib/bc/tests/fuzzing/dc_inputs/01.txt b/contrib/bc/tests/fuzzing/dc_inputs/01.txt
new file mode 100644
index 000000000000..9622de95a241
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/dc_inputs/01.txt
@@ -0,0 +1,2 @@
+[[000000000
+00000]
diff --git a/contrib/bc/tests/fuzzing/dc_inputs/02.txt b/contrib/bc/tests/fuzzing/dc_inputs/02.txt
new file mode 100644
index 000000000000..79565935cf23
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/dc_inputs/02.txt
@@ -0,0 +1,5 @@
+0 R
+2 1
+1 0+pRpp
+30.x
+[00000000]ip1+pR
diff --git a/contrib/bc/tests/fuzzing/dc_inputs/03.txt b/contrib/bc/tests/fuzzing/dc_inputs/03.txt
new file mode 100644
index 000000000000..ecede2e05629
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/dc_inputs/03.txt
@@ -0,0 +1,2 @@
+0 lip1-si0l0+200sx_9lq+pR 30.x
+[li100L0dp1+s+sX10lM<0]sL0sJlLx
diff --git a/contrib/bc/tests/fuzzing/dc_inputs/04.txt b/contrib/bc/tests/fuzzing/dc_inputs/04.txt
new file mode 100644
index 000000000000..209f50c16d52
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/dc_inputs/04.txt
@@ -0,0 +1,9 @@
+zp100000000.000004p1+pR
+0 1 1+kpR
+1 1+pR
+1 0IpR
+2 9+iR
+037 483+pR
+999 999+pR
+237467456283846vpR
+.0000000ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddsdddddddddddddddddddddddddddddddddddddddddddddddddddddsdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd/ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfddddddddddddddddddddddddddddddddddddddddddddddddddddddcdddddddddddd9000000000000000000
diff --git a/contrib/bc/tests/fuzzing/dc_inputs/05.txt b/contrib/bc/tests/fuzzing/dc_inputs/05.txt
new file mode 100644
index 000000000000..bf2ca982ed2b
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/dc_inputs/05.txt
@@ -0,0 +1,3 @@
+04000000000000300sx_9000.00000syzpRlxlq+pR
+30.x
+[li1000000sxL0LLLL900000.00000sLLL]sL0s0lLx
diff --git a/contrib/bc/tests/fuzzing/dc_inputs/06.txt b/contrib/bc/tests/fuzzing/dc_inputs/06.txt
new file mode 100644
index 000000000000..eff417eb55b4
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/dc_inputs/06.txt
@@ -0,0 +1 @@
+00Q;pd60 p d9S06+00I;pd60Q2 0^pR
diff --git a/contrib/bc/tests/fuzzing/dc_inputs/07.txt b/contrib/bc/tests/fuzzing/dc_inputs/07.txt
new file mode 100644
index 000000000000..8a09152faf58
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/dc_inputs/07.txt
@@ -0,0 +1,3 @@
+1 0 1|dR
+1 [li0L]SL10sildR
+1 [li0L]sL10|Lx
diff --git a/contrib/bc/tests/fuzzing/dc_inputs/08.txt b/contrib/bc/tests/fuzzing/dc_inputs/08.txt
new file mode 100644
index 000000000000..156de2f536b6
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/dc_inputs/08.txt
@@ -0,0 +1 @@
+0 2+p[lip1-si0li!=0^di>0]S098sil0x
diff --git a/contrib/bc/tests/fuzzing/dc_inputs/09.txt b/contrib/bc/tests/fuzzing/dc_inputs/09.txt
new file mode 100644
index 000000000000..ffc3a08908d4
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/dc_inputs/09.txt
@@ -0,0 +1,9 @@
+#00000
+0sm[Nx]0s0[]0s0x[]zs0x[]0s0[]zs0c
+0s0[Nx]0s0[]zs0x[]zs0x[Nx]0s0[]zs0#000000000
+0s0[Nx]0s_[]zs0x[li]zs^x[l0000000]0sm[]zs0x[liNx]zs0x[li;0lilix]
+x[liN]zsWx[liN]zs0x[li;0lilix]
+x[liNzs0x#000000000
+*sm[Nx]0sm[]zs0x[li]zs0x[Nx]0sm[]zsdc
+0sm[Nx]0sm[]zs0x[li]zs0x[Nx]0sm[]x]zsxx#000000000
+*s0[Nx]0sm[]0s00[00]zs0x[Nx]0sm[]z0dc
diff --git a/contrib/bc/tests/fuzzing/dc_inputs/10.txt b/contrib/bc/tests/fuzzing/dc_inputs/10.txt
new file mode 100644
index 000000000000..0fade4bb899f
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/dc_inputs/10.txt
@@ -0,0 +1,11 @@
+#0000
+0sm[Nx]0sm[]0s0x[li]0s0x[Nfvfff[]0sm[]zs0x[li]zs0x[Nx]0sm[]zs0c
+0sm[Nx]0sm[]x[li]zs0x[Nx]0sm[]zs0c
+0sm[Nx]0sm[]zs0x[li]zs0x[Nx]0sm[]zs0c
+0sm[Nx]0sm[]zs0x[li]zs0x[Nx]0sm[]zs0#000000000
+0sm[Nx]0s0[]zs0x[li]zs0x[0000000000]0sm[]zs0x[liNx]zs0x[li;0l0l0x]
+x[liNx]zs0x#000000000
+0sm[Nx]0sm[]zs0x[li]zs0x[000]0sm[]x[li]zs0x[Nx]0sm[]zs0c
+0sm[Nx]0sm[]zs0x[li]zs0x[Nx]0sm[]zs0#0000
+0sm[Nx]0sm[]zs0x[li]zs0x[Nx]0sm[]zs0#000000000
+0sm[Nx]0s_@]zs0x[li]s^x[0000000000]0s0[]zsW[0000]zsxx[000000000]
diff --git a/contrib/bc/tests/fuzzing/dc_inputs/11.txt b/contrib/bc/tests/fuzzing/dc_inputs/11.txt
new file mode 100644
index 000000000000..73bbc7d88f1c
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/dc_inputs/11.txt
@@ -0,0 +1,4 @@
+#00000000
+[[00000]aa]sM[lip1-si0li>0eM]s010sil0x
+[[0000]00]sM[]s010sil0x
+[R]sM[lip=000]s0;0
diff --git a/contrib/bc/tests/fuzzing/dc_inputs/12.txt b/contrib/bc/tests/fuzzing/dc_inputs/12.txt
new file mode 100644
index 000000000000..aff25e7381cd
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/dc_inputs/12.txt
@@ -0,0 +1,2 @@
+1;09R0si[lii000000000000000000000000000000000000000000]li1000 2346dvdddd;ddddddddddddd?-sdddddddddd0+dd0 1+pR
+0dvdddd;ddSddddddddddd 0si[lid1+sil0sili10li?-s0]dsxx[00000000]li1000 2000dvddddddddddddddddddddddddd0 0+ddd 1+pR
diff --git a/contrib/bc/tests/fuzzing/dc_inputs/13.txt b/contrib/bc/tests/fuzzing/dc_inputs/13.txt
new file mode 100644
index 000000000000..e6af9463e38c
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/dc_inputs/13.txt
@@ -0,0 +1,7 @@
+zp10[00000000\00]pppppppppppppppR
+_1 _1(pR
+_1 _2(pR
+2 1{pR
+_1 1{pR 990+pR
+2000000 300000300000000+pR
+2070000000aaaaaaaaaaaaaaxaaaaaaaaaaaaR
diff --git a/contrib/bc/tests/fuzzing/dc_inputs/14.txt b/contrib/bc/tests/fuzzing/dc_inputs/14.txt
new file mode 100644
index 000000000000..741f3bfd7704
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/dc_inputs/14.txt
@@ -0,0 +1,7 @@
+0bpR
+1bpR
+.200000bpR
+100000.0000600bpR
+_10bpR
+_.1000000bpR
+_30000.00bpR: \ No newline at end of file
diff --git a/contrib/bc/tests/fuzzing/dc_inputs/15.txt b/contrib/bc/tests/fuzzing/dc_inputs/15.txt
new file mode 100644
index 000000000000..828e8204a2aa
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/dc_inputs/15.txt
@@ -0,0 +1,11 @@
+0bpax1bpR
+1bpR
+.30b900pR
+_10bp/90
+_30_.1/10bp30_.1/90
+_300.1/90/90
+_30_.1/90
+_30000.1/90
+90
+_30000.1/90
+70.000 70u
diff --git a/contrib/bc/tests/fuzzing/dc_inputs/16.txt b/contrib/bc/tests/fuzzing/dc_inputs/16.txt
new file mode 100644
index 000000000000..b021dd66d7ff
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/dc_inputs/16.txt
@@ -0,0 +1 @@
+0 0;^dddddRps0R@s016dddRRd^2ddRZ(b-P;;$p;;;;;;9;;;;;;$ppppppppppppp30
diff --git a/contrib/bc/tests/fuzzing/dc_inputs/17.txt b/contrib/bc/tests/fuzzing/dc_inputs/17.txt
new file mode 100644
index 000000000000..fb46510fc3e3
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/dc_inputs/17.txt
@@ -0,0 +1,20 @@
+0 1(pR
+1;;;;;pR
+1
+0 18d[0000000
+000000000000000000000000000000]sM[liv1-si0li!<0pR
+_1 0{pR
+_1 _1{pR
+_1 f0070000000000.0000000000000_10000000000006.00000000000005~pRpR
+_23745860900000.070000000000000 _0.20542357869124050~pRpR
+_3000000000000000.0000000700000006002 _7000000000000005000000000.000F000000000000003~pRpR20000000 300000000003.00000000000000030~pRpR
+_30000000000000000000000000
+1 0.001.00000000030
+1 0.000000000000000000000000000000000000000000000000000000000000000000002x30000000000000000000000000000000000000$80000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000<0800000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000.000F000000000000003~pRpR20000000 300000000003.00000000000000030~pRpR
+_30000000000000.00000000000
+1 0.070.70000000000
+1 0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000$80000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000<080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000S8800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000Z800000000000
+_10pR
+=390NpR
+_2000
+40000 5000C 2i>0eM]s01@sil0x
diff --git a/contrib/bc/tests/fuzzing/dc_inputs/18.txt b/contrib/bc/tests/fuzzing/dc_inputs/18.txt
new file mode 100644
index 000000000000..ed2659d097c2
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/dc_inputs/18.txt
@@ -0,0 +1,3 @@
+1oVVf[li;WORli1S0Zli1;rORli1dH|2li@d-NliO+rK28729@9547628O745/pR
+_29307546189299999999999999999999999999999999999995 0.00000000000000000000000000009999999999999999999+99$9999999999.999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999995 0.0000000000000000000000000000000000R0000000000000000000000000000000000000+0000000000000000-0000000000000000000005+pR
+99999999999999999999999999999999999999999999999999999999999.999999999999999999999.99999999999999999999999999999999999999999900000000000000000000000R0000000000000000000000000000000000000+0000000000000000-0000000000000000000005+pR999999999999999999999999999999999999999999 0.00000000000000000000000000000000000000000000000000000000000C0020P00000000000000000000000000000000000007fli1+7fli1+si;d7dli1+si;0=Rls1d:0li +i100>x]dsxx[0000000]dsxx[p000]l010000000 00000000000pR
diff --git a/contrib/bc/tests/fuzzing/dc_inputs/19.txt b/contrib/bc/tests/fuzzing/dc_inputs/19.txt
new file mode 100644
index 000000000000..df417b4ab6d3
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/dc_inputs/19.txt
@@ -0,0 +1 @@
+0000000000000000000000000000000
diff --git a/contrib/bc/tests/fuzzing/dc_inputs/20.txt b/contrib/bc/tests/fuzzing/dc_inputs/20.txt
new file mode 100644
index 000000000000..aa7752a85c67
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/dc_inputs/20.txt
@@ -0,0 +1,3 @@
+#0000
+I20PPrP PPPP PPs0daP1:0pR
+ PPP1d:0pRR
diff --git a/contrib/bc/tests/fuzzing/dc_inputs/21.txt b/contrib/bc/tests/fuzzing/dc_inputs/21.txt
new file mode 100644
index 000000000000..01707d8256b6
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/dc_inputs/21.txt
@@ -0,0 +1,5 @@
+0bpR
+1bpR
+.200000bpR
+100000.0000600bpR
+S09bpR
diff --git a/contrib/bc/tests/fuzzing/dc_inputs/22.txt b/contrib/bc/tests/fuzzing/dc_inputs/22.txt
new file mode 100644
index 000000000000..898184649926
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/dc_inputs/22.txt
@@ -0,0 +1,36 @@
+[0000000000000]ZpR
+[He00
+[0000000\00000000]00
+[0000000\00000000]000
+[0000000\00000000]00
+[0000]
+00000]
+[28pR]
+[27pR]
+[26pR]
+[25pR]
+[24pR]
+[23pR]
+[22pR]
+[21pR]
+[20pR]
+[19pR]
+[18pR]
+[17pR]
+[16pR]
+[15pR]
+[14pR]
+[13pR]
+[12pR]
+[11pR]
+[10pR]
+[9pR]
+[8pR]
+[7pR]
+[6pR]
+[5pR]
+[4pR]
+[3pR]
+[2pR]
+[1pR]
+[xz0<x]dsxx
diff --git a/contrib/bc/tests/fuzzing/dc_inputs/23.txt b/contrib/bc/tests/fuzzing/dc_inputs/23.txt
new file mode 100644
index 000000000000..1897dfbbb0aa
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/dc_inputs/23.txt
@@ -0,0 +1,2 @@
+#00000000
+[[0000 ]00]SM[l0p1-s00l0`000]s010sil0x
diff --git a/contrib/bc/tests/fuzzing/dc_inputs/24.txt b/contrib/bc/tests/fuzzing/dc_inputs/24.txt
new file mode 100644
index 000000000000..fb9b04f7f5b8
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/dc_inputs/24.txt
@@ -0,0 +1 @@
+ [] 0:xX:0 0:0X:0n/dc.000C00}pR
diff --git a/contrib/bc/tests/fuzzing/dc_inputs/25.txt b/contrib/bc/tests/fuzzing/dc_inputs/25.txt
new file mode 100644
index 000000000000..d48a9b2e83fd
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/dc_inputs/25.txt
@@ -0,0 +1,6 @@
+#00000000
+0s0[l0d:0l01;0d:0l01;0pRl01+s0l010>x]dsxx0sx0s0
+1 2
+s0[l0d:0l01;0d:0l01;0pRl01+s0l010>x]dsxx0sx0s0
+1 2
+
diff --git a/contrib/bc/tests/fuzzing/dc_inputs/26.txt b/contrib/bc/tests/fuzzing/dc_inputs/26.txt
new file mode 100644
index 000000000000..731d3969ac3b
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/dc_inputs/26.txt
@@ -0,0 +1,155 @@
+0bpR
+1bp0
+.20bpR
+100000.0000005bpR
+_10bpR
+_.1000[l0;0;rpRl01+s0l010>x]dsxx0sx0s0
+1 2+p+p
+3+p
+4+p
+5+p
+6+p
+7+p
+8+p
+9+p
+10+p
+11+p
+12+p
+13+p
+14+p
+15+p
+16+p
+17+p
+18+p
+19+p
+20+p
+21+0+p
+71+o
+70+p
+70+p
+70+p
+70+p
+22+p
+20+p
+20+p
+20+p
+20+p
+20+p
+20+p
+20+p
+30+p
+30+p
+30+p
+30+p
+30+p
+30+p
+30+p
+30+p
+30+p
+30+p
+40+1+p
+40+p
+40+p
+40+p
+40+p
+40+p
+40+p
+40+p
+40+p
+50+p
+50+p
+50+p
+50+p
+50+p
+50+p
+50+p
+50+p
+50+p
+50+p
+60+p
+60+p
+60bpR
+1bp0
+.20bpR
+100000.0070000bpR
+_10bpR
+_.1000[l0;0;rpRl01+s0l010>x]dsxx0sx0s0
+1 2+p+p
+3+p
+4+p
+5+p
+6+p
+7+p
+8+p
+9+p
+10+p
+11+p
+12+p
+13+p
+14+p
+15+p
+16+p
+17+p
+18+p
+19+p
+20+p
+21+0+p
+71+o
+70+p
+70+p
+70+p
+70+p
+22+p
+20+p
+20+p
+20+p
+20+p
+20+p
+20+p
+20+p
+30+p
+30+p
+30+p
+30+p
+30+p
+30+p
+30+p
+30+p
+30+p
+30+p
+40+1+p
+40+p
+40+p
+40+p
+40+p
+40+p
+40+p
+40+p
+40+p
+50+p
+50+p
+50+p
+50+p
+50+p
+50+p
+50+p
+50+p
+50+p
+50+p
+60+p
+60+p
+60+p
+60+p
+60+p
+60+p
+60+p
+60
+70+p
+70+p
+70+p
+70+p
+70+p
+70+p
+70+p
+80+p
+
diff --git a/contrib/bc/tests/fuzzing/dc_inputs/27.txt b/contrib/bc/tests/fuzzing/dc_inputs/27.txt
new file mode 100644
index 000000000000..69745b952afc
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/dc_inputs/27.txt
@@ -0,0 +1,2 @@
+"0000000\
+
diff --git a/contrib/bc/tests/fuzzing/dc_inputs/28.txt b/contrib/bc/tests/fuzzing/dc_inputs/28.txt
new file mode 100644
index 000000000000..fe81732b3e38
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/dc_inputs/28.txt
@@ -0,0 +1 @@
+10 4%0:i[000] 1:b 0;0 p 1;b0:b [000] 1:b 0;b p 1;b~b 0;b p 0;b~~~0k
diff --git a/contrib/bc/tests/fuzzing/dc_inputs/29.txt b/contrib/bc/tests/fuzzing/dc_inputs/29.txt
new file mode 100644
index 000000000000..886eb8ee0a8e
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/dc_inputs/29.txt
@@ -0,0 +1,13 @@
+10 4%0:b [200] 1:b 0;b 1;b X
+ 2000 1%p0
+3460:b [200] 1:b 0;b p bp0
+.2 1%pR
+6 4%pR
+10 4%0:b [200] 1:b 0;b p 1;b X
+ 20000 1%pR
+b 0;b p 0;b2
+1bpb [200] 1:u 0;b p 1;b X
+ 2
+[000] 0:b [200] 0:b 0;b p S0b p
+[s0]XpR
+
diff --git a/contrib/bc/tests/fuzzing/dc_inputs/30.txt b/contrib/bc/tests/fuzzing/dc_inputs/30.txt
new file mode 100644
index 000000000000..e072e71617d8
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/dc_inputs/30.txt
@@ -0,0 +1 @@
+0;0[]0:b;bs0l0x;0
diff --git a/contrib/bc/tests/fuzzing/dc_inputs/31.txt b/contrib/bc/tests/fuzzing/dc_inputs/31.txt
new file mode 100644
index 000000000000..9bada9d07d0e
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/dc_inputs/31.txt
@@ -0,0 +1 @@
+0;0[]0:b;bS0l0x;0
diff --git a/contrib/bc/tests/fuzzing/dc_inputs/abs.txt b/contrib/bc/tests/fuzzing/dc_inputs/abs.txt
new file mode 100644
index 000000000000..9907dfc6679d
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/dc_inputs/abs.txt
@@ -0,0 +1,7 @@
+0bpR
+1bpR
+.218933bpR
+138963.9873645bpR
+_19bpR
+_.1298376bpR
+_3892173.289375bpR
diff --git a/contrib/bc/tests/fuzzing/dc_inputs/add.txt b/contrib/bc/tests/fuzzing/dc_inputs/add.txt
new file mode 100644
index 000000000000..42da2f1f309c
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/dc_inputs/add.txt
@@ -0,0 +1,33 @@
+0 0+pR
+0 0 0++pR
+0 1+pR
+0 1 1++pR
+1 1+pR
+1 0+pR
+2 5+pR
+237 483+pR
+999 999+pR
+2374623 324869356734856+pR
+2378639084586723980562 23468729367839+pR
+37298367203972395108367910823465293084561329084561390845613409516734503870691837451 785621394067928346918023476190834672198467134908618723249671349062187346898241093486139046139084613490817356023871869102746182749061872609129847+pR
+1.1 0+pR
+0 1.1+pR
+457283.731284923576 37842934672834.3874629385672354+pR
+1.0 0.1+pR
+3746289134067138046 0.138375863945672398456712389456273486293+pR
+_1 _1+pR
+_4 _15+pR
+_1346782 _1287904651762468913476+pR
+99999999999999999999999999999999999999999999999999999999999.999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999 0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001+pR
+99999999999999999999999999999999999999999999999999999999999.999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999995 0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005+pR
+99999999999999999999999999999999999999999999999999999999999.999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999 0.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001+pR
+99999999999999999999999999999999999999999999999999999999999.999999999999999999999999999999999999999999999999999999999899999999999999999999999999999999999999999999999999999999999999 0.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001+pR
+99999999999999999999999999999999999989999999999999999999999.999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999 0.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001+pR
+_1889985797 2012747315+pR
+0 _14338.391079082+pR
+_2422297 1.3134942556+pR
+_1289374 1289374.2893417 0.238971 28937.28971+++pR
+1289374 1289374.2893417 _0.238971 28937.28971+++pR
+1289374 1289374.2893417 0.238971 _28937.28971+++pR
+1289374 1289374.2893417 _0.238971 _28937.28971+++pR
+1289374 _1289374.2893417 _0.238971 _28937.28971+++pR
diff --git a/contrib/bc/tests/fuzzing/dc_inputs/array.dc b/contrib/bc/tests/fuzzing/dc_inputs/array.dc
new file mode 100644
index 000000000000..970f29a68768
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/dc_inputs/array.dc
@@ -0,0 +1,2 @@
+#! /usr/bin/dc
+0si[lid:rli1+sili100>x]dsxx[li;rpRli1-sili100!>x]li1+[li;rpRli1+sili100>x]
diff --git a/contrib/bc/tests/fuzzing/dc_inputs/boolean.txt b/contrib/bc/tests/fuzzing/dc_inputs/boolean.txt
new file mode 100644
index 000000000000..815100f0d085
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/dc_inputs/boolean.txt
@@ -0,0 +1,80 @@
+0 1(pR
+1 1(pR
+2 1(pR
+_1 1(pR
+_1 0(pR
+_1 _1(pR
+_1 _2(pR
+0 1{pR
+1 1{pR
+2 1{pR
+_1 1{pR
+_1 0{pR
+_1 _1{pR
+_1 _2{pR
+0 1)pR
+1 1)pR
+2 1)pR
+_1 1)pR
+_1 0)pR
+_1 _1)pR
+_1 _2)pR
+0 1}pR
+1 1}pR
+2 1}pR
+_1 1}pR
+_1 0}pR
+_1 _1}pR
+_1 _2}pR
+0 0GpR
+0 1GpR
+1 0GpR
+_1 _1GpR
+0 _1GpR
+_1 0GpR
+1 1GpR
+238 2GpR
+0NpR
+1NpR
+_1NpR
+2398NpR
+_2983.2389NpR
+0 0MpR
+1 0MpR
+0 1MpR
+1 1MpR
+128973240 0MpR
+0 2893712MpR
+1982 28937MpR
+_2938 0MpR
+0 _1023.298037MpR
+0.283917 0MpR
+2389 _1208.28937MpR
+0 289.289372MpR
+_298.29387 0MpR
+_2983.28973 82937MpR
+0 _2938.320837MpR
+_2089.2308 0MpR
+_0.2893 _2938.28973MpR
+0.00000 1892MpR
+1289.023 .0000MpR
+0 0mpR
+1 0mpR
+0 1mpR
+1 1mpR
+128973240 0mpR
+0 2893712mpR
+1982 28937mpR
+_2938 0mpR
+0 _1023.298037mpR
+0.283917 0mpR
+2389 _1208.28937mpR
+0 289.289372mpR
+_298.29387 0mpR
+_2983.28973 82937mpR
+0 _2938.320837mpR
+_2089.2308 0mpR
+_0.2893 _2938.28973mpR
+0.00000 1892mpR
+1289.023 .0000mpR
+0.0000 .00000mpR
diff --git a/contrib/bc/tests/fuzzing/dc_inputs/decimal.txt b/contrib/bc/tests/fuzzing/dc_inputs/decimal.txt
new file mode 100644
index 000000000000..ebbb2dc91b3a
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/dc_inputs/decimal.txt
@@ -0,0 +1,36 @@
+0pR
+0.0pR
+.0000pR
+000000000000000000000000.00000000000000000000000pR
+000000000000000000000000000135482346782356pR
+000000000000000000000000002pR
+1pR
+11pR
+123pR
+7505pR
+1023468723275435238491972521917846pR
+4343472432431705867392073517038270398027352709027389273920739037937960379637893607893607893670530278200795207952702873892786172916728961783907893607418973587857386079679267926737520730925372983782793652793pR
+_1pR
+_203pR
+_57pR
+_18586pR
+_31378682943772818461924738352952347258pR
+_823945628745673589495067238723986520375698237620834674509627345273096287563846592384526349872634895763257893467523987578690283762897568459072348758071071087813501875908127359018715023841710239872301387278pR
+.123521346523546pR
+0.1245923756273856pR
+_.1024678456387pR
+_0.8735863475634587pR
+4.0pR
+_6.0pR
+234237468293576.000000000000000000000000000000pR
+23987623568943567.00000000000000000005677834650000000000000pR
+23856934568940675.000000000000000435676782300000000000000456784pR
+77567648698496.000000000000000000587674750000000000458563800000000000000pR
+2348672354968723.2374823546000000000003256987394502346892435623870000000034578pR
+_2354768.000000000000000000000000000000000000pR
+_96739874567.000000000347683456pR
+_3764568345.000000000004573845000000347683460pR
+_356784356.934568495770004586495678300000000pR
+74325437345273852773827101738273127312738521733017537073520735207307570358738257390761276072160719802671980267018728630178.7082681027680521760217867841276127681270867827821768173178207830710978017738178678012767377058785378278207385237085237803278203782037237582795870pR
+_756752732785273851273728537852738257837283678965738527385272983678372867327835672967385278372637862738627836279863782673862783670.71738178361738718367186378610738617836781603760178367018603760178107735278372832783728367826738627836278378260736270367362073867097307925pR
+9812734012837410982345719208345712908357412903587192048571920458712.23957182459817249058172945781pR
diff --git a/contrib/bc/tests/fuzzing/dc_inputs/divide.txt b/contrib/bc/tests/fuzzing/dc_inputs/divide.txt
new file mode 100644
index 000000000000..38b874e9f175
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/dc_inputs/divide.txt
@@ -0,0 +1,33 @@
+20k
+0 1/pR
+0 321566/pR
+0 0.3984567238456/pR
+1 1/pR
+1 1287469297356/pR
+1 0.2395672438567234/pR
+1 237586239856.0293596728392360/pR
+1249687284356 3027949207835207/pR
+378617298617396719 35748521/pR
+9348576237845624358 0.9857829375461/pR
+35768293846193284 2374568947.045762839567823/pR
+_78987234567812345 876542837618936/pR
+_356789237555535468 0.3375273860984786903/pR
+_5203475364850390 435742903748307.70869378534043296404530458/pR
+_0.37861723347576903 7385770896/pR
+_0.399454682043962 0.34824389304/pR
+_0.6920414523873204 356489645223.76076045304879030/pR
+_35872917389671.7573280963748 73924708/pR
+_78375896314.4836709876983 0.78356798637817/pR
+_2374123896417.143789621437581 347821469423789.1473856783960/pR
+_896729350238549726 _34976289345762/pR
+_2374568293458762348596 _0.8792370647234987679/pR
+_237584692306721845726038 _21783910782374529637.978102738746189024761/pR
+_0.23457980123576298375682 _1375486293874612/pR
+_0.173897061862478951264 _0.8179327486017634987516298745/pR
+_0.9186739823576829347586 _0.235678293458756239846/pR
+_0.9375896183746982374568 _13784962873546.0928729395476283745/pR
+_2930754618923467.12323745862937465 _734869238465/pR
+_23745861923467.874675129834675 _0.23542357869124756/pR
+_3878923750692883.7238596702834756902 _7384192674957215364986723.9738461923487621983/pR
+1 0.00000000000000000000000000000000000000000002346728372937352457354204563027/pR
+239854711289345712 2891374 182 .2893 ///pR
diff --git a/contrib/bc/tests/fuzzing/dc_inputs/divmod.txt b/contrib/bc/tests/fuzzing/dc_inputs/divmod.txt
new file mode 100644
index 000000000000..1633203ff99f
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/dc_inputs/divmod.txt
@@ -0,0 +1,64 @@
+20k
+0 1~pRpR
+0 321566~pRpR
+0 0.3984567238456~pRpR
+1 1~pRpR
+1 1287469297356~pRpR
+1 0.2395672438567234~pRpR
+1 237586239856.0293596728392360~pRpR
+1249687284356 3027949207835207~pRpR
+378617298617396719 35748521~pRpR
+9348576237845624358 0.9857829375461~pRpR
+35768293846193284 2374568947.045762839567823~pRpR
+_78987234567812345 876542837618936~pRpR
+_356789237555535468 0.3375273860984786903~pRpR
+_5203475364850390 435742903748307.70869378534043296404530458~pRpR
+_0.37861723347576903 7385770896~pRpR
+_0.399454682043962 0.34824389304~pRpR
+_0.6920414523873204 356489645223.76076045304879030~pRpR
+_35872917389671.7573280963748 73924708~pRpR
+_78375896314.4836709876983 0.78356798637817~pRpR
+_2374123896417.143789621437581 347821469423789.1473856783960~pRpR
+_896729350238549726 _34976289345762~pRpR
+_2374568293458762348596 _0.8792370647234987679~pRpR
+_237584692306721845726038 _21783910782374529637.978102738746189024761~pRpR
+_0.23457980123576298375682 _1375486293874612~pRpR
+_0.173897061862478951264 _0.8179327486017634987516298745~pRpR
+_0.9186739823576829347586 _0.235678293458756239846~pRpR
+_0.9375896183746982374568 _13784962873546.0928729395476283745~pRpR
+_2930754618923467.12323745862937465 _734869238465~pRpR
+_23745861923467.874675129834675 _0.23542357869124756~pRpR
+_3878923750692883.7238596702834756902 _7384192674957215364986723.9738461923487621983~pRpR
+1 0.00000000000000000000000000000000000000000002346728372937352457354204563027~pRpR
+0k
+0 1~pRpR
+0 321566~pRpR
+0 0.3984567238456~pRpR
+1 1~pRpR
+1 1287469297356~pRpR
+1 0.2395672438567234~pRpR
+1 237586239856.0293596728392360~pRpR
+1249687284356 3027949207835207~pRpR
+378617298617396719 35748521~pRpR
+9348576237845624358 0.9857829375461~pRpR
+35768293846193284 2374568947.045762839567823~pRpR
+_78987234567812345 876542837618936~pRpR
+_356789237555535468 0.3375273860984786903~pRpR
+_5203475364850390 435742903748307.70869378534043296404530458~pRpR
+_0.37861723347576903 7385770896~pRpR
+_0.399454682043962 0.34824389304~pRpR
+_0.6920414523873204 356489645223.76076045304879030~pRpR
+_35872917389671.7573280963748 73924708~pRpR
+_78375896314.4836709876983 0.78356798637817~pRpR
+_2374123896417.143789621437581 347821469423789.1473856783960~pRpR
+_896729350238549726 _34976289345762~pRpR
+_2374568293458762348596 _0.8792370647234987679~pRpR
+_237584692306721845726038 _21783910782374529637.978102738746189024761~pRpR
+_0.23457980123576298375682 _1375486293874612~pRpR
+_0.173897061862478951264 _0.8179327486017634987516298745~pRpR
+_0.9186739823576829347586 _0.235678293458756239846~pRpR
+_0.9375896183746982374568 _13784962873546.0928729395476283745~pRpR
+_2930754618923467.12323745862937465 _734869238465~pRpR
+_23745861923467.874675129834675 _0.23542357869124756~pRpR
+_3878923750692883.7238596702834756902 _7384192674957215364986723.9738461923487621983~pRpR
+1 0.00000000000000000000000000000000000000000002346728372937352457354204563027~pRpR
diff --git a/contrib/bc/tests/fuzzing/dc_inputs/else.dc b/contrib/bc/tests/fuzzing/dc_inputs/else.dc
new file mode 100644
index 000000000000..84deb8754e9f
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/dc_inputs/else.dc
@@ -0,0 +1,4 @@
+#! /usr/bin/dc
+[[Done!]pR]sM[lip1-si0li>LeM]sL10silLx
+[[Done!]pR]sM[lip1-si0li!<LeM]sL10silLx
+[[Done!]pR]sM[lip1-si0li!=LeM]sL10silLx
diff --git a/contrib/bc/tests/fuzzing/dc_inputs/engineering.txt b/contrib/bc/tests/fuzzing/dc_inputs/engineering.txt
new file mode 100644
index 000000000000..90a35052b3cb
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/dc_inputs/engineering.txt
@@ -0,0 +1,19 @@
+1o
+0pR
+1pR
+_34pR
+298pR
+_8933pR
+29488pR
+_148232pR
+8927559pR
+.2pR
+_.02pR
+.002pR
+_.0003pR
+.0000209310pR
+_.00000289362pR
+.000000859289pR
+_.02983672pR
+.20201296pR
+_.8907210897000000000000000000pR
diff --git a/contrib/bc/tests/fuzzing/dc_inputs/loop.dc b/contrib/bc/tests/fuzzing/dc_inputs/loop.dc
new file mode 100644
index 000000000000..26cec23818df
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/dc_inputs/loop.dc
@@ -0,0 +1,3 @@
+#! /usr/bin/dc
+[lip1-si0li>L]sL10silLx
+[lip1+si10li<L]sL0silLx
diff --git a/contrib/bc/tests/fuzzing/dc_inputs/misc.txt b/contrib/bc/tests/fuzzing/dc_inputs/misc.txt
new file mode 100644
index 000000000000..222a3ad265d2
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/dc_inputs/misc.txt
@@ -0,0 +1 @@
+zp198202389.289374pzp[Hello, World!]pzpzpfrfczpfR
diff --git a/contrib/bc/tests/fuzzing/dc_inputs/modexp.txt b/contrib/bc/tests/fuzzing/dc_inputs/modexp.txt
new file mode 100644
index 000000000000..a6afb998558e
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/dc_inputs/modexp.txt
@@ -0,0 +1,103 @@
+0 0 1|pR
+1 0 1|pR
+1 0 2|pR
+0 10 1|pR
+1 293 1|pR
+1 2789365 2|pR
+100 8 7|pR
+10922384 15031007 201|pR
+3346529 189 254|pR
+4113416930 197 14|pR
+7709 5887 111|pR
+5487406 3252 128|pR
+2080527 2279453822 219|pR
+48895 50678 232|pR
+1535808383 2902995144 18|pR
+8437837 2882198 69|pR
+35363 25806 2|pR
+3221177403 1560419989 189|pR
+227 42775 163|pR
+2811398069 37500 173|pR
+15046850 3859895697 195|pR
+15770756 3621999893 119|pR
+6937927 3719297189 183|pR
+12573 43819 209|pR
+42098463 7584603 136|pR
+8656683 1328292415 226|pR
+209 81 157|pR
+141 13317429 26|pR
+809485795 60745 101|pR
+4882 1388217898 38|pR
+750704 78 119|pR
+668879580 2888860497 179|pR
+1152725844 15295742 154|pR
+16160694 8981529 154|pR
+216 102 3|pR
+3691227289 5344109 232|pR
+2195559299 61 222|pR
+2478990626 13007440 30|pR
+45083 44 117|pR
+224 55824 53|pR
+1372700133 89 94|pR
+205 10422 48|pR
+11887 12 73|pR
+5955 24353 114|pR
+1201697310 789722419 6|pR
+56577 231 229|pR
+96 38841 189|pR
+6529661 5636520 209|pR
+11005 15955685 27|pR
+9709 231 132|pR
+59790 1034579699 166|pR
+47892 14536879 79|pR
+48 208 21|pR
+33036 3877 65|pR
+164 6527085 249|pR
+12146850 224 37|pR
+218 16425679 62|pR
+51 27641 95|pR
+3076735605 49154 32|pR
+515652717 4117874315 143|pR
+300672671 720768884 110|pR
+9422066 206 5|pR
+43 97 13|pR
+545174510 65319 126|pR
+3317462730 704990271 51|pR
+47316 23231 202|pR
+7236571 4379567 106|pR
+2584584521 2459274189 29|pR
+61562 5035178 178|pR
+65302 112 151|pR
+63040 2168854052 213|pR
+9039611 2370306559 62|pR
+16414384 1020652061 83|pR
+7491 3853569905 172|pR
+1180322494 46670 84|pR
+3823343557 3865107254 127|pR
+6240872 55335 39|pR
+2281401897 1098411 251|pR
+61 2949190429 231|pR
+8981024 162 43|pR
+1 3568883218 212|pR
+4217100969 3471787779 8|pR
+3232237 13 243|pR
+29280 3972452706 100|pR
+13077 6431923 216|pR
+104 3098510775 140|pR
+9503298 174 242|pR
+3424695712 12184 23|pR
+184 15066347 151|pR
+2935856 14003205 184|pR
+1386637762 2128151420 71|pR
+154 11960656 12|pR
+743976432 4004778779 136|pR
+3909160595 3575680922 21|pR
+26133 3580 147|pR
+409154 170 68|pR
+149 55629 40|pR
+5753 13776176 32|pR
+3831447473 658273178 98|pR
+1527252003 2300622 207|pR
+3363824553 8244645 215|pR
+20 145 101|pR
+4005077294 2196555621 94|pR
diff --git a/contrib/bc/tests/fuzzing/dc_inputs/modulus.txt b/contrib/bc/tests/fuzzing/dc_inputs/modulus.txt
new file mode 100644
index 000000000000..613944b2001a
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/dc_inputs/modulus.txt
@@ -0,0 +1,70 @@
+20k
+1 1%pR
+2 1%pR
+16 4%pR
+15 4%pR
+17 4%pR
+2389473 5%pR
+39240687239 1%pR
+346728934 23958%pR
+3496723859067234 298375462837546928347623059375486%pR
+_1 1%pR
+_2 1%pR
+_47589634875689345 37869235%pR
+_1274852934765 2387628935486273546%pR
+_6324758963 237854962%pR
+1 _1%pR
+2 _1%pR
+2 _2%pR
+2 _3%pR
+16 5%pR
+15 5%pR
+14 5%pR
+89237423 _237856923854%pR
+123647238946 _12467%pR
+_1 _1%pR
+_2 _1%pR
+_2 _2%pR
+_2 _3%pR
+_13 _7%pR
+_14 _7%pR
+_15 _7%pR
+_12784956 _32746%pR
+_127849612 _23712347682193%pR
+0k
+1 1%pR
+2 1%pR
+16 4%pR
+15 4%pR
+17 4%pR
+2389473 5%pR
+39240687239 1%pR
+346728934 23958%pR
+3496723859067234 298375462837546928347623059375486%pR
+_1 1%pR
+_2 1%pR
+_47589634875689345 37869235%pR
+_1274852934765 2387628935486273546%pR
+_6324758963 237854962%pR
+1 _1%pR
+2 _1%pR
+2 _2%pR
+2 _3%pR
+16 5%pR
+15 5%pR
+14 5%pR
+89237423 _237856923854%pR
+123647238946 _12467%pR
+_1 _1%pR
+_2 _1%pR
+_2 _2%pR
+_2 _3%pR
+_13 _7%pR
+_14 _7%pR
+_15 _7%pR
+_12784956 _32746%pR
+_127849612 _23712347682193%pR
+_3191280681 641165986%pR
+0k _899510228 _2448300078.40314%pR
+0k _7424863 _207.2609738667%pR
+0k 3769798918 0.6%pR
diff --git a/contrib/bc/tests/fuzzing/dc_inputs/multiply.txt b/contrib/bc/tests/fuzzing/dc_inputs/multiply.txt
new file mode 100644
index 000000000000..1f9041d06ea7
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/dc_inputs/multiply.txt
@@ -0,0 +1,42 @@
+0 0*pR
+0.000 0*pR
+1 0*pR
+0 1*pR
+0 2498752389672835476*pR
+873246913745129084576134 0*pR
+1 472638590273489273456*pR
+12374861230476103672835496 1*pR
+1 1*pR
+2 1*pR
+1 2*pR
+2 2*pR
+3 14*pR
+17 8*pR
+1892467513846753 1872439821374591038746*pR
+328962735862.2973546835638947635 1728465791348762356*pR
+38745962374538.387427384672934867234 0.1932476528394672837568923754*pR
+9878894576289457634856.2738627161689017387608947567654 37842939768237596237854203.29874372139852739126739621793162*pR
+_1 1*pR
+_1 2*pR
+78893457 _34876238956*pR
+235678324957634 _0.2349578349672389576*pR
+_12849567821934 12738462937681*pR
+1274861293467.927843682937462 _28935678239*pR
+2936077239872.12937462836 _0.012842357682435762*pR
+2387692387566.2378569237546 _272189345628.123875629835876*pR
+0.012348629356782835962 _23487692356*pR
+0.4768349567348675934 _0.23756834576934857638495*pR
+0.98748395367485962735486 _4675839462354867.376834956738456*pR
+_321784627934586 _235762378596*pR
+_32578623567892356 _0.32567384579638456*pR
+_35768232346876 _2348672935602387620.28375682349576237856*pR
+_0.2356728394765234 _238759624356978*pR
+_0.2345768212346780 _0.235768124697074385948943532045*pR
+_0.370873860736785306278630 _7835678398607.7086378076867096270*pR
+_78365713707.7089637863786730 _738580798679306780*pR
+_73867038956790490258249 _0.7379862716391723672803679*pR
+_378621971598721837710387 _98465373878350798.09743896037963078560*pR
+37164201 2931559660*pR
+679468076118972457796560530571.46287161642138401685 93762.2836*pR
+.000000000000000000000000001 .0000000000000000000000001*pR
+239 289 _98 .8937 _.1893 28937*****pR
diff --git a/contrib/bc/tests/fuzzing/dc_inputs/places.txt b/contrib/bc/tests/fuzzing/dc_inputs/places.txt
new file mode 100644
index 000000000000..308ff1373d64
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/dc_inputs/places.txt
@@ -0,0 +1,14 @@
+0 0@pR
+1 0@pR
+2 0@pR
+0.0023896 0@pR
+1.298346 0@pR
+2.00000000 0@pR
+0.0023896 3@pR
+1.298346 4@pR
+2.00000000 5@pR
+289 3@pR
+18.34 6@pR
+_183.1 0@pR
+_23.238 8@pR
+_343.23 2@pR
diff --git a/contrib/bc/tests/fuzzing/dc_inputs/power.txt b/contrib/bc/tests/fuzzing/dc_inputs/power.txt
new file mode 100644
index 000000000000..955e42557a15
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/dc_inputs/power.txt
@@ -0,0 +1,36 @@
+20k
+0 0^pR
+0 1^pR
+0 1894^pR
+1 0^pR
+39746823 0^pR
+0.238672983047682 0^pR
+18394762374689237468.97354862973846 0^pR
+1 1^pR
+2 1^pR
+18927361346 1^pR
+0.23523785962738592635777 1^pR
+328956734869213746.89782398457234 1^pR
+8937 8^pR
+93762.2836 3^pR
+1 _1^pR
+2 _1^pR
+10 _1^pR
+683734768 _1^pR
+38579623756.897937568235 _1^pR
+1 _32467^pR
+2 _53^pR
+_1 1^pR
+_1 2^pR
+_2 1^pR
+_2 2^pR
+_237 294^pR
+_3746 28^pR
+_0.3548 35^pR
+_1 _1^pR
+_1 _2^pR
+_2 _1^pR
+_2 _2^pR
+_86 _7^pR
+0 _251^pR
+_0.2959371298 27^pR
diff --git a/contrib/bc/tests/fuzzing/dc_inputs/quit.dc b/contrib/bc/tests/fuzzing/dc_inputs/quit.dc
new file mode 100644
index 000000000000..81e6289af25b
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/dc_inputs/quit.dc
@@ -0,0 +1,2 @@
+1se [li p 1+si le li !=lem]sl [lk p 1+sk le lk !=o]so [0sk lox leQ 0sk lox le 3*1+Q 0sk lox]sm [0si llx le 1+se 10 le !=n]dsnx
+1si [li p 1+si 10 li !=set]ss [1000Q]st lsx
diff --git a/contrib/bc/tests/fuzzing/dc_inputs/scientific.txt b/contrib/bc/tests/fuzzing/dc_inputs/scientific.txt
new file mode 100644
index 000000000000..59a78dbb3a6c
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/dc_inputs/scientific.txt
@@ -0,0 +1,51 @@
+0e0pR
+0e1pR
+0e5pR
+0e_2pR
+0e_100pR
+1e0pR
+_1e1pR
+1e9pR
+_1e21pR
+1e_1pR
+_1e_2pR
+1e_5pR
+4.92837e5pR
+_3.28971028e20pR
+6.2e3pR
+_8.289371e2pR
+5.9817280937e8pR
+_3.28977e_1pR
+8.8927891e_20pR
+_7.98239e_4pR
+4.4892e_4pR
+_18937e0pR
+198273e10pR
+_18927e_4pR
+28937e_5pR
+_891072e_7pR
+.28972e0pR
+_.891273e_1pR
+.8928397e1pR
+_.0002983172e5pR
+.00022e3pR
+_.00022e4pR
+.0000328937e8pR
+0o
+0pR
+1pR
+10pR
+_289pR
+2894pR
+_89434pR
+894370pR
+_1239839pR
+28931708pR
+_8052098.8029731809pR
+.1pR
+_.01pR
+.001pR
+_.00038pR
+.0000483pR
+_.0002894378190pR
+.2893712083pR
diff --git a/contrib/bc/tests/fuzzing/dc_inputs/shift.txt b/contrib/bc/tests/fuzzing/dc_inputs/shift.txt
new file mode 100644
index 000000000000..628b0a5bf6fe
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/dc_inputs/shift.txt
@@ -0,0 +1,42 @@
+0 0HpR
+1 0HpR
+2 0HpR
+0.0023896 0HpR
+1.298346 0HpR
+2.00000000 0HpR
+0.0023896 3HpR
+1.298346 4HpR
+2.00000000 5HpR
+89136.892348976 7HpR
+1892634051829351283289298 24HpR
+0 0hpR
+1 0hpR
+2 0hpR
+0.0023896 0hpR
+1.298346 0hpR
+2.00000000 0hpR
+0.0023896 3hpR
+1.298346 4hpR
+2.00000000 5hpR
+89136.892348976 7hpR
+1892634051829351283289298 24hpR
+_1 0HpR
+_2 0HpR
+_0.0023896 0HpR
+_1.298346 0HpR
+_2.00000000 0HpR
+_0.0023896 3HpR
+_1.298346 4HpR
+_2.00000000 5HpR
+_89136.892348976 7HpR
+_1892634051829351283289298 24HpR
+_1 0hpR
+_2 0hpR
+_0.0023896 0hpR
+_1.298346 0hpR
+_2.00000000 0hpR
+_0.0023896 3hpR
+_1.298346 4hpR
+_2.00000000 5hpR
+_89136.892348976 7hpR
+_1892634051829351283289298 24hpR
diff --git a/contrib/bc/tests/fuzzing/dc_inputs/sqrt.txt b/contrib/bc/tests/fuzzing/dc_inputs/sqrt.txt
new file mode 100644
index 000000000000..7c13fdd0bb5d
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/dc_inputs/sqrt.txt
@@ -0,0 +1,14 @@
+20k
+0vpR
+2vpR
+4vpR
+9vpR
+16vpR
+25vpR
+121vpR
+48765vpR
+9287356207356vpR
+0.189274385967238956872354vpR
+12389467137496823.134567829387456283946vpR
+.0000000000000000000000000000123vpR
+1vpR
diff --git a/contrib/bc/tests/fuzzing/dc_inputs/stdin.txt b/contrib/bc/tests/fuzzing/dc_inputs/stdin.txt
new file mode 100644
index 000000000000..7bf8316b99af
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/dc_inputs/stdin.txt
@@ -0,0 +1,205 @@
+0si[lid:rli1+sili10>x]dsxxli1-si[li;rpRli1-sili0!>x]dsxxli1+si[li;rpRli1+sili10>x]dsxx0sx0si
+1 2+p
+[foo]
+0
+1+p
+2+p
+3+p
+4+p
+5+p
+6+p
+7+p
+8+p
+9+p
+10+p
+11+p
+12+p
+13+p
+14+p
+15+p
+16+p
+17+p
+18+p
+19+p
+20+p
+21+p
+22+p
+23+p
+24+p
+25+p
+26+p
+27+p
+28+p
+29+p
+30+p
+31+p
+32+p
+33+p
+34+p
+35+p
+36+p
+37+p
+38+p
+39+p
+40+p
+41+p
+42+p
+43+p
+44+p
+45+p
+46+p
+47+p
+48+p
+49+p
+50+p
+51+p
+52+p
+53+p
+54+p
+55+p
+56+p
+57+p
+58+p
+59+p
+60+p
+61+p
+62+p
+63+p
+64+p
+65+p
+66+p
+67+p
+68+p
+69+p
+70+p
+71+p
+72+p
+73+p
+74+p
+75+p
+76+p
+77+p
+78+p
+79+p
+80+p
+81+p
+82+p
+83+p
+84+p
+85+p
+86+p
+87+p
+88+p
+89+p
+90+p
+91+p
+92+p
+93+p
+94+p
+95+p
+96+p
+97+p
+98+p
+99+p
+100+p
+101+p
+102+p
+103+p
+104+p
+105+p
+106+p
+107+p
+108+p
+109+p
+110+p
+111+p
+112+p
+113+p
+114+p
+115+p
+116+p
+117+p
+118+p
+119+p
+120+p
+121+p
+122+p
+123+p
+124+p
+125+p
+126+p
+127+p
+128+p
+129+p
+130+p
+131+p
+132+p
+133+p
+134+p
+135+p
+136+p
+137+p
+138+p
+139+p
+140+p
+141+p
+142+p
+143+p
+144+p
+145+p
+146+p
+147+p
+148+p
+149+p
+150+p
+151+p
+152+p
+153+p
+154+p
+155+p
+156+p
+157+p
+158+p
+159+p
+160+p
+161+p
+162+p
+163+p
+164+p
+165+p
+166+p
+167+p
+168+p
+169+p
+170+p
+171+p
+172+p
+173+p
+174+p
+175+p
+176+p
+177+p
+178+p
+179+p
+180+p
+181+p
+182+p
+183+p
+184+p
+185+p
+186+p
+187+p
+188+p
+189+p
+190+p
+191+p
+192+p
+193+p
+194+p
+195+p
+196+p
+197+p
+198+p
+199+p
+200+p
+p
diff --git a/contrib/bc/tests/fuzzing/dc_inputs/stream.dc b/contrib/bc/tests/fuzzing/dc_inputs/stream.dc
new file mode 100755
index 000000000000..5c61e7c931f9
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/dc_inputs/stream.dc
@@ -0,0 +1,2 @@
+#! /usr/bin/dc
+0si[liPlid1+sili4096>x]ddsxPx
diff --git a/contrib/bc/tests/fuzzing/dc_inputs/strings.txt b/contrib/bc/tests/fuzzing/dc_inputs/strings.txt
new file mode 100644
index 000000000000..369d8e1dd842
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/dc_inputs/strings.txt
@@ -0,0 +1,50 @@
+[Hello, World!]ZpR
+[Hello, World!]pR
+[Hello, \[ World!]ZpR
+[Hello, \[ World!]pR
+[Hello, \] World!]ZpR
+[Hello, \] World!]pR
+[30pR]
+[29pR]
+[28pR]
+[27pR]
+[26pR]
+[25pR]
+[24pR]
+[23pR]
+[22pR]
+[21pR]
+[20pR]
+[19pR]
+[18pR]
+[17pR]
+[16pR]
+[15pR]
+[14pR]
+[13pR]
+[12pR]
+[11pR]
+[10pR]
+[9pR]
+[8pR]
+[7pR]
+[6pR]
+[5pR]
+[4pR]
+[3pR]
+[2pR]
+[1pR]
+[xz0<x]dsxx
+[\\]pR
+[\[\]]pR
+1xpR
+[1st] 0:b [2nd] 1:b 0;b p 1;b p
+[string]XpR
+[3 4^pR]silix
+[[[q 1 3+pR]x]x]x4 5^pR
+4xpR
+5 112ax 90ax 112ax 82ax
+[\q] pR
+[q\\] pR
+[\\] pR
+92 a pR
diff --git a/contrib/bc/tests/fuzzing/dc_inputs/subtract.txt b/contrib/bc/tests/fuzzing/dc_inputs/subtract.txt
new file mode 100644
index 000000000000..2cb4104fb717
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/dc_inputs/subtract.txt
@@ -0,0 +1,33 @@
+0 0-pR
+0 1-pR
+1 0-pR
+1 1-pR
+5 2-pR
+2 9-pR
+321974 12845976238457-pR
+2874519803456710938465 384723854-pR
+10000000000000000000000000000000000000000 999999999999999999999999999999999999999-pR
+10000000000000000000000000000000000000000 9999999999999999999999999999999999999999-pR
+10000000000000000000000000000000000000000 999999999999999999999999999999999999999.99999999999999999999999999999999999-pR
+10000000000000000000000000000000000000000 9999999999999999999999999999999999999999.9999999999999999999999999999999999-pR
+10000000000000000000000000000000000000000 0.00000000000000000000000000000000000000000000000000000000000000000000000000000000000001-pR
+10000000000000000000000000000000000000001 0.00000000000000000000000000000000000000000000000000000000000000000000000000000000000001-pR
+10000000000000000000000000000000000000000.0000000001 0.0000000000000000000000000000000000000000000000000000000000000000000000000001-pR
+_2 6-pR
+_23784692345 182934721309467230894628735496027345-pR
+_224352354962873059862 _1245723576829456278354960278345-pR
+_3468273598 _12354243-pR
+_0.92345768293 _2354768923-pR
+_712384634.123476823 _24768293376-pR
+_1879234638 _0.917234869234-pR
+_0.9172438692134 _0.971284967124-pR
+_0.1283475123465 _0.937462346-pR
+_124765829346.2837468293562 _0.923467829346-pR
+_12476829385769 _1928476259034.8378629356-pR
+_0.38476284395876345 _94875394587623.2357869324857-pR
+_4674596708467.34754789403674343567 _48672394852354698.237548629345-pR
+979519669 3018100865-pR
+929002449 3280677283-pR
+0 _525898-pR
+3 _3-pR
+2 _1 2893714 _2189367411289 _.8921374 3.9201384----pR
diff --git a/contrib/bc/tests/fuzzing/dc_inputs/trunc.txt b/contrib/bc/tests/fuzzing/dc_inputs/trunc.txt
new file mode 100644
index 000000000000..684752e065dd
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/dc_inputs/trunc.txt
@@ -0,0 +1,11 @@
+0$pR
+1$pR
+2$pR
+0.8249167203486$pR
+1.28937150237$pR
+2.0$pR
+28937.92837605126$pR
+2890.000000000$pR
+_1$pR
+_1.128973$pR
+_9812387.28910273$pR
diff --git a/contrib/bc/tests/fuzzing/dc_inputs/vars.txt b/contrib/bc/tests/fuzzing/dc_inputs/vars.txt
new file mode 100644
index 000000000000..bbe73b47d81f
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/dc_inputs/vars.txt
@@ -0,0 +1,2 @@
+298734.8921702348sx_928374892.28937syzpRlxly+pR
+298734.8921702348S xotj _928374892.28937S yotp zpRl xotj l yotp-pRzpR L xotj L yotp-pR
diff --git a/contrib/bc/tests/fuzzing/dc_inputs/weird.dc b/contrib/bc/tests/fuzzing/dc_inputs/weird.dc
new file mode 100644
index 000000000000..391ec05d6282
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/dc_inputs/weird.dc
@@ -0,0 +1,2 @@
+#! /usr/bin/dc
+zp198202389.289374pzp[He World!]SzpzXfrfxzpfR
diff --git a/contrib/bc/tests/other.sh b/contrib/bc/tests/other.sh
new file mode 100755
index 000000000000..8c56e25d2395
--- /dev/null
+++ b/contrib/bc/tests/other.sh
@@ -0,0 +1,271 @@
+#! /bin/sh
+#
+# SPDX-License-Identifier: BSD-2-Clause
+#
+# Copyright (c) 2018-2021 Gavin D. Howard and contributors.
+#
+# 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.
+#
+
+set -e
+
+script="$0"
+testdir=$(dirname "$script")
+
+. "$testdir/../functions.sh"
+
+if [ "$#" -ge 1 ]; then
+ d="$1"
+ shift
+else
+ err_exit "usage: $script dir [exec args...]" 1
+fi
+
+if [ "$#" -lt 1 ]; then
+ exe="$testdir/../bin/$d"
+else
+ exe="$1"
+ shift
+fi
+
+if [ "$d" = "bc" ]; then
+ halt="quit"
+else
+ halt="q"
+fi
+
+num=100000000000000000000000000000000000000000000000000000000000000000000000000000
+numres="$num"
+num70="10000000000000000000000000000000000000000000000000000000000000000000\\
+0000000000"
+
+if [ "$d" = "bc" ]; then
+ halt="halt"
+ opt="x"
+ lopt="extended-register"
+ line_var="BC_LINE_LENGTH"
+else
+ halt="q"
+ opt="l"
+ lopt="mathlib"
+ line_var="DC_LINE_LENGTH"
+ num="$num pR"
+fi
+
+set +e
+
+printf '\nRunning %s quit test...' "$d"
+
+printf '%s\n' "$halt" | "$exe" "$@" > /dev/null 2>&1
+
+checktest_retcode "$d" "$?" "quit"
+
+if [ "$d" = bc ]; then
+
+ printf '%s\n' "quit" | "$exe" "$@" > /dev/null 2>&1
+
+ checktest_retcode "$d" "$?" quit
+
+ two=$("$exe" "$@" -e 1+1 -e quit)
+
+ checktest_retcode "$d" "$?" quit
+
+ if [ "$two" != "2" ]; then
+ err_exit "$d failed test quit" 1
+ fi
+fi
+
+printf 'pass\n'
+
+base=$(basename "$exe")
+
+if [ "$base" != "bc" -a "$base" != "dc" ]; then
+ exit 0
+fi
+
+printf 'Running %s environment var tests...' "$d"
+
+if [ "$d" = "bc" ]; then
+
+ export BC_ENV_ARGS=" '-l' '' -q"
+ export BC_EXPR_EXIT="1"
+
+ printf 's(.02893)\n' | "$exe" "$@" > /dev/null
+
+ checktest_retcode "$d" "$?" "environment var"
+
+ "$exe" -e 4 "$@" > /dev/null
+
+ err="$?"
+ checktest_retcode "$d" "$?" "environment var"
+else
+
+ export DC_ENV_ARGS="'-x'"
+ export DC_EXPR_EXIT="1"
+
+ printf '4s stuff\n' | "$exe" "$@" > /dev/null
+
+ checktest_retcode "$d" "$?" "environment var"
+
+ "$exe" -e 4pR "$@" > /dev/null
+
+ checktest_retcode "$d" "$?" "environment var"
+fi
+
+printf 'pass\n'
+
+out1="$testdir/../.log_$d.txt"
+out2="$testdir/../.log_${d}_test.txt"
+
+printf 'Running %s line length tests...' "$d"
+
+printf '%s\n' "$numres" > "$out1"
+
+export "$line_var"=80
+printf '%s\n' "$num" | "$exe" "$@" > "$out2"
+
+checktest "$d" "$?" "environment var" "$out1" "$out2"
+
+printf '%s\n' "$num70" > "$out1"
+
+export "$line_var"=2147483647
+printf '%s\n' "$num" | "$exe" "$@" > "$out2"
+
+checktest "$d" "$?" "environment var" "$out1" "$out2"
+
+printf 'pass\n'
+
+printf 'Running %s arg tests...' "$d"
+
+f="$testdir/$d/add.txt"
+exprs=$(cat "$f")
+results=$(cat "$testdir/$d/add_results.txt")
+
+printf '%s\n%s\n%s\n%s\n' "$results" "$results" "$results" "$results" > "$out1"
+
+"$exe" "$@" -e "$exprs" -f "$f" --expression "$exprs" --file "$f" -e "$halt" > "$out2"
+
+checktest "$d" "$?" "arg" "$out1" "$out2"
+
+printf '%s\n' "$halt" | "$exe" "$@" -- "$f" "$f" "$f" "$f" > "$out2"
+
+checktest "$d" "$?" "arg" "$out1" "$out2"
+
+if [ "$d" = "bc" ]; then
+ printf '%s\n' "$halt" | "$exe" "$@" -i > /dev/null 2>&1
+fi
+
+printf '%s\n' "$halt" | "$exe" "$@" -h > /dev/null
+checktest_retcode "$d" "$?" "arg"
+printf '%s\n' "$halt" | "$exe" "$@" -P > /dev/null
+checktest_retcode "$d" "$?" "arg"
+printf '%s\n' "$halt" | "$exe" "$@" -v > /dev/null
+checktest_retcode "$d" "$?" "arg"
+printf '%s\n' "$halt" | "$exe" "$@" -V > /dev/null
+checktest_retcode "$d" "$?" "arg"
+
+"$exe" "$@" -f "saotehasotnehasthistohntnsahxstnhalcrgxgrlpyasxtsaosysxsatnhoy.txt" > /dev/null 2> "$out2"
+err="$?"
+
+checkerrtest "$d" "$err" "invalid file argument" "$out2" "$d"
+
+"$exe" "$@" "-$opt" -e "$exprs" > /dev/null 2> "$out2"
+err="$?"
+
+checkerrtest "$d" "$err" "invalid option argument" "$out2" "$d"
+
+"$exe" "$@" "--$lopt" -e "$exprs" > /dev/null 2> "$out2"
+err="$?"
+
+checkerrtest "$d" "$err" "invalid long option argument" "$out2" "$d"
+
+"$exe" "$@" "-u" -e "$exprs" > /dev/null 2> "$out2"
+err="$?"
+
+checkerrtest "$d" "$err" "unrecognized option argument" "$out2" "$d"
+
+"$exe" "$@" "--uniform" -e "$exprs" > /dev/null 2> "$out2"
+err="$?"
+
+checkerrtest "$d" "$err" "unrecognized long option argument" "$out2" "$d"
+
+"$exe" "$@" -f > /dev/null 2> "$out2"
+err="$?"
+
+checkerrtest "$d" "$err" "missing required argument to short option" "$out2" "$d"
+
+"$exe" "$@" --file > /dev/null 2> "$out2"
+err="$?"
+
+checkerrtest "$d" "$err" "missing required argument to long option" "$out2" "$d"
+
+"$exe" "$@" --version=5 > /dev/null 2> "$out2"
+err="$?"
+
+checkerrtest "$d" "$err" "given argument to long option with no argument" "$out2" "$d"
+
+printf 'pass\n'
+
+printf 'Running %s directory test...' "$d"
+
+"$exe" "$@" "$testdir" > /dev/null 2> "$out2"
+err="$?"
+
+checkerrtest "$d" "$err" "directory" "$out2" "$d"
+
+printf 'pass\n'
+
+printf 'Running %s binary file test...' "$d"
+
+bin="/bin/sh"
+
+"$exe" "$@" "$bin" > /dev/null 2> "$out2"
+err="$?"
+
+checkerrtest "$d" "$err" "binary file" "$out2" "$d"
+
+printf 'pass\n'
+
+printf 'Running %s binary stdin test...' "$d"
+
+cat "$bin" | "$exe" "$@" > /dev/null 2> "$out2"
+err="$?"
+
+checkerrtest "$d" "$err" "binary stdin" "$out2" "$d"
+
+printf 'pass\n'
+
+if [ "$d" = "bc" ]; then
+
+ printf 'Running %s limits tests...' "$d"
+ printf 'limits\n' | "$exe" "$@" > "$out2" /dev/null 2>&1
+
+ checktest_retcode "$d" "$?" "limits"
+
+ if [ ! -s "$out2" ]; then
+ err_exit "$d did not produce output on the limits test" 1
+ fi
+
+ exec printf 'pass\n'
+
+fi
diff --git a/contrib/bc/tests/radamsa.sh b/contrib/bc/tests/radamsa.sh
index 537ee10255c3..236953ae888e 100755
--- a/contrib/bc/tests/radamsa.sh
+++ b/contrib/bc/tests/radamsa.sh
@@ -2,7 +2,7 @@
#
# SPDX-License-Identifier: BSD-2-Clause
#
-# Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+# Copyright (c) 2018-2021 Gavin D. Howard and contributors.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
diff --git a/contrib/bc/tests/randmath.py b/contrib/bc/tests/randmath.py
index 7f14a345be3e..ca226324a8dc 100755
--- a/contrib/bc/tests/randmath.py
+++ b/contrib/bc/tests/randmath.py
@@ -2,7 +2,7 @@
#
# SPDX-License-Identifier: BSD-2-Clause
#
-# Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+# Copyright (c) 2018-2021 Gavin D. Howard and contributors.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
diff --git a/contrib/bc/tests/read.sh b/contrib/bc/tests/read.sh
index 0440a078d36c..e9d306858ec3 100755
--- a/contrib/bc/tests/read.sh
+++ b/contrib/bc/tests/read.sh
@@ -2,7 +2,7 @@
#
# SPDX-License-Identifier: BSD-2-Clause
#
-# Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+# Copyright (c) 2018-2021 Gavin D. Howard and contributors.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
@@ -57,7 +57,12 @@ name="$testdir/$d/read.txt"
results="$testdir/$d/read_results.txt"
errors="$testdir/$d/read_errors.txt"
-out="$testdir/../.log_${d}_test.txt"
+out="$testdir/${d}_outputs/read_results.txt"
+outdir=$(dirname "$out")
+
+if [ ! -d "$outdir" ]; then
+ mkdir -p "$outdir"
+fi
exebase=$(basename "$exe")
@@ -79,17 +84,17 @@ fi
printf 'Running %s read...' "$d"
+set +e
+
while read line; do
printf '%s\n%s\n' "$read_call" "$line" | "$exe" "$@" "$options" > "$out"
- diff "$results" "$out"
+ checktest "$d" "$?" 'read' "$results" "$out"
done < "$name"
printf 'pass\n'
-set +e
-
printf 'Running %s read errors...' "$d"
while read line; do
@@ -97,7 +102,7 @@ while read line; do
printf '%s\n%s\n' "$read_call" "$line" | "$exe" "$@" "$options" 2> "$out" > /dev/null
err="$?"
- checktest "$d" "$err" "$line" "$out" "$exebase"
+ checkerrtest "$d" "$err" "$line" "$out" "$exebase"
done < "$errors"
@@ -110,7 +115,7 @@ read_test=$(printf '%s\n' "$read_call")
printf '%s\n' "$read_test" | "$exe" "$@" "$opts" 2> "$out" > /dev/null
err="$?"
-checktest "$d" "$err" "$read_test" "$out" "$exebase"
+checkerrtest "$d" "$err" "$read_test" "$out" "$exebase"
printf 'pass\n'
@@ -121,6 +126,6 @@ read_test=$(printf '%s' "$read_call")
printf '%s' "$read_test" | "$exe" "$@" "$opts" 2> "$out" > /dev/null
err="$?"
-checktest "$d" "$err" "$read_test" "$out" "$exebase"
+checkerrtest "$d" "$err" "$read_test" "$out" "$exebase"
-printf 'pass\n'
+exec printf 'pass\n'
diff --git a/contrib/bc/tests/script.sh b/contrib/bc/tests/script.sh
index 279295829f75..b7c707ac88bf 100755
--- a/contrib/bc/tests/script.sh
+++ b/contrib/bc/tests/script.sh
@@ -2,7 +2,7 @@
#
# SPDX-License-Identifier: BSD-2-Clause
#
-# Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+# Copyright (c) 2018-2021 Gavin D. Howard and contributors.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
@@ -33,6 +33,8 @@ script="$0"
testdir=$(dirname "${script}")
+. "$testdir/../functions.sh"
+
if [ "$#" -lt 2 ]; then
printf 'usage: %s dir script [run_extra_tests] [run_stack_tests] [generate_tests] [time_tests] [exec args...]\n' "$script"
exit 1
@@ -79,8 +81,6 @@ else
exe="$testdir/../bin/$d"
fi
-out="$testdir/../.log_${d}_test.txt"
-
if [ "$d" = "bc" ]; then
if [ "$run_stack_tests" -ne 0 ]; then
@@ -120,6 +120,18 @@ if [ "$run_stack_tests" -eq 0 ]; then
fi
+out="$testdir/${d}_outputs/${name}_script_results.txt"
+outdir=$(dirname "$out")
+
+if [ ! -d "$outdir" ]; then
+ mkdir -p "$outdir"
+fi
+
+unset BC_ENV_ARGS
+unset BC_LINE_LENGTH
+unset DC_ENV_ARGS
+unset DC_LINE_LENGTH
+
s="$scriptdir/$f"
orig="$testdir/$name.txt"
results="$scriptdir/$name.txt"
@@ -129,7 +141,7 @@ if [ -f "$orig" ]; then
elif [ -f "$results" ]; then
res="$results"
elif [ "$generate" -eq 0 ]; then
- printf 'Skipping %s script %s\n' "$d" "$s"
+ printf 'Skipping %s script %s\n' "$d" "$f"
exit 0
else
printf 'Generating %s results...' "$f"
@@ -138,18 +150,22 @@ else
res="$results"
fi
+set +e
+
printf 'Running %s script %s...' "$d" "$f"
if [ "$time_tests" -ne 0 ]; then
printf '\n'
printf '%s\n' "$halt" | /usr/bin/time -p "$exe" "$@" $options "$s" > "$out"
+ err="$?"
printf '\n'
else
printf '%s\n' "$halt" | "$exe" "$@" $options "$s" > "$out"
+ err="$?"
fi
-diff "$res" "$out"
+checktest "$d" "$err" "script $f" "$res" "$out"
rm -f "$out"
-printf 'pass\n'
+exec printf 'pass\n'
diff --git a/contrib/bc/tests/scripts.sh b/contrib/bc/tests/scripts.sh
index ff17260c909c..a0415ec7fffb 100755
--- a/contrib/bc/tests/scripts.sh
+++ b/contrib/bc/tests/scripts.sh
@@ -2,7 +2,7 @@
#
# SPDX-License-Identifier: BSD-2-Clause
#
-# Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+# Copyright (c) 2018-2021 Gavin D. Howard and contributors.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
@@ -78,9 +78,12 @@ fi
scriptdir="$testdir/$d/scripts"
-for s in $scriptdir/*.$d; do
+scripts=$(cat "$scriptdir/all.txt")
+
+for s in $scripts; do
f=$(basename "$s")
- sh "$testdir/script.sh" "$d" "$f" "$run_extra_tests" "$run_stack_tests" "$generate" "$time_tests" "$exe" "$@"
+ sh "$testdir/script.sh" "$d" "$f" "$run_extra_tests" "$run_stack_tests" \
+ "$generate" "$time_tests" "$exe" "$@"
done
diff --git a/contrib/bc/tests/stdin.sh b/contrib/bc/tests/stdin.sh
index f66019d5ae65..581a6df52d73 100755
--- a/contrib/bc/tests/stdin.sh
+++ b/contrib/bc/tests/stdin.sh
@@ -2,7 +2,7 @@
#
# SPDX-License-Identifier: BSD-2-Clause
#
-# Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+# Copyright (c) 2018-2021 Gavin D. Howard and contributors.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
@@ -33,6 +33,8 @@ script="$0"
testdir=$(dirname "$script")
+. "$testdir/../functions.sh"
+
if [ "$#" -lt 1 ]; then
printf 'usage: %s dir [exe [args...]]\n' "$0"
printf 'valid dirs are:\n'
@@ -52,7 +54,12 @@ else
exe="$testdir/../bin/$d"
fi
-out="$testdir/../.log_${d}_test.txt"
+out="$testdir/${d}_outputs/stdin_results.txt"
+outdir=$(dirname "$out")
+
+if [ ! -d "$outdir" ]; then
+ mkdir -p "$outdir"
+fi
if [ "$d" = "bc" ]; then
options="-ilq"
@@ -62,20 +69,22 @@ fi
rm -f "$out"
+set +e
+
printf 'Running %s stdin tests...' "$d"
cat "$testdir/$d/stdin.txt" | "$exe" "$@" "$options" > "$out" 2> /dev/null
-diff "$testdir/$d/stdin_results.txt" "$out"
+checktest "$d" "$?" "stdin" "$testdir/$d/stdin_results.txt" "$out"
if [ "$d" = "bc" ]; then
cat "$testdir/$d/stdin1.txt" | "$exe" "$@" "$options" > "$out" 2> /dev/null
- diff "$testdir/$d/stdin1_results.txt" "$out"
+ checktest "$d" "$?" "stdin" "$testdir/$d/stdin1_results.txt" "$out"
cat "$testdir/$d/stdin2.txt" | "$exe" "$@" "$options" > "$out" 2> /dev/null
- diff "$testdir/$d/stdin2_results.txt" "$out"
+ checktest "$d" "$?" "stdin" "$testdir/$d/stdin2_results.txt" "$out"
fi
-rm -f "$out1"
+rm -f "$out"
-printf 'pass\n'
+exec printf 'pass\n'
diff --git a/contrib/bc/tests/test.sh b/contrib/bc/tests/test.sh
index 20f95413597b..c6c4cc250ba3 100755
--- a/contrib/bc/tests/test.sh
+++ b/contrib/bc/tests/test.sh
@@ -2,7 +2,7 @@
#
# SPDX-License-Identifier: BSD-2-Clause
#
-# Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+# Copyright (c) 2018-2021 Gavin D. Howard and contributors.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
@@ -33,6 +33,8 @@ script="$0"
testdir=$(dirname "$script")
+. "$testdir/../functions.sh"
+
if [ "$#" -lt 2 ]; then
printf 'usage: %s dir test [generate_tests] [time_tests] [exe [args...]]\n' "$0"
printf 'valid dirs are:\n'
@@ -71,7 +73,17 @@ else
exe="$testdir/../bin/$d"
fi
-out="$testdir/../.log_${d}_test.txt"
+out="$testdir/${d}_outputs/${t}_results.txt"
+outdir=$(dirname "$out")
+
+if [ ! -d "$outdir" ]; then
+ mkdir -p "$outdir"
+fi
+
+unset BC_ENV_ARGS
+unset BC_LINE_LENGTH
+unset DC_ENV_ARGS
+unset DC_LINE_LENGTH
if [ "$d" = "bc" ]; then
options="-lq"
@@ -83,14 +95,6 @@ else
halt="q"
fi
-if [ "${exe#*toybox}" != "$exe" -o "${exe#*busybox}" != "$exe" ]; then
- if [ "$t" = "print2" -o "$t" = "misc4" ]; then
- base=$(basename "$exe")
- printf 'Skipping %s test for %s...\n' "$t" "$base"
- exit 0
- fi
-fi
-
if [ ! -f "$name" ]; then
if [ "$generate_tests" -eq 0 ]; then
@@ -115,18 +119,22 @@ fi
export $var=string
+set +e
+
printf 'Running %s %s...' "$d" "$t"
if [ "$time_tests" -ne 0 ]; then
printf '\n'
printf '%s\n' "$halt" | /usr/bin/time -p "$exe" "$@" $options "$name" > "$out"
+ err="$?"
printf '\n'
else
printf '%s\n' "$halt" | "$exe" "$@" $options "$name" > "$out"
+ err="$?"
fi
-diff "$results" "$out"
+checktest "$d" "$err" "$t" "$results" "$out"
rm -f "$out"
-printf 'pass\n'
+exec printf 'pass\n'