aboutsummaryrefslogtreecommitdiff
path: root/contrib/bc
diff options
context:
space:
mode:
authorStefan Eßer <se@FreeBSD.org>2023-02-06 21:33:56 +0000
committerStefan Eßer <se@FreeBSD.org>2023-02-06 21:33:56 +0000
commit4fca8e0f65a8bbbd1242c1f7d8e33b77c479f5de (patch)
tree096eb93bb207750ac92f0c47384c0fc6dcd015e5 /contrib/bc
parentbbd354cb2382917a2cfbbc3e918ccfe342b645b4 (diff)
downloadsrc-4fca8e0f65a8bbbd1242c1f7d8e33b77c479f5de.tar.gz
src-4fca8e0f65a8bbbd1242c1f7d8e33b77c479f5de.zip
contrib/bc: uodate to version 6.2.4
This update contains only documentation changes (new main repository URL and changed mail address of the program author) and changes to the build system that do not affect the FreeBSD base system build. MFC after: 3 days
Diffstat (limited to 'contrib/bc')
-rw-r--r--contrib/bc/LICENSE.md6
-rw-r--r--contrib/bc/NEWS.md18
-rw-r--r--contrib/bc/README.md22
-rw-r--r--contrib/bc/gen/bc_help.txt2
-rw-r--r--contrib/bc/gen/dc_help.txt2
-rwxr-xr-xcontrib/bc/gen/strgen.sh16
-rw-r--r--contrib/bc/include/version.h2
-rw-r--r--contrib/bc/manuals/bc/A.14
-rw-r--r--contrib/bc/manuals/bc/A.1.md4
-rw-r--r--contrib/bc/manuals/bc/E.14
-rw-r--r--contrib/bc/manuals/bc/E.1.md4
-rw-r--r--contrib/bc/manuals/bc/EH.14
-rw-r--r--contrib/bc/manuals/bc/EH.1.md4
-rw-r--r--contrib/bc/manuals/bc/EHN.14
-rw-r--r--contrib/bc/manuals/bc/EHN.1.md4
-rw-r--r--contrib/bc/manuals/bc/EN.14
-rw-r--r--contrib/bc/manuals/bc/EN.1.md4
-rw-r--r--contrib/bc/manuals/bc/H.14
-rw-r--r--contrib/bc/manuals/bc/H.1.md4
-rw-r--r--contrib/bc/manuals/bc/HN.14
-rw-r--r--contrib/bc/manuals/bc/HN.1.md4
-rw-r--r--contrib/bc/manuals/bc/N.14
-rw-r--r--contrib/bc/manuals/bc/N.1.md4
-rw-r--r--contrib/bc/manuals/bcl.34
-rw-r--r--contrib/bc/manuals/bcl.3.md4
-rw-r--r--contrib/bc/manuals/build.md2
-rw-r--r--contrib/bc/manuals/dc/A.14
-rw-r--r--contrib/bc/manuals/dc/A.1.md4
-rw-r--r--contrib/bc/manuals/dc/E.14
-rw-r--r--contrib/bc/manuals/dc/E.1.md4
-rw-r--r--contrib/bc/manuals/dc/EH.14
-rw-r--r--contrib/bc/manuals/dc/EH.1.md4
-rw-r--r--contrib/bc/manuals/dc/EHN.14
-rw-r--r--contrib/bc/manuals/dc/EHN.1.md4
-rw-r--r--contrib/bc/manuals/dc/EN.14
-rw-r--r--contrib/bc/manuals/dc/EN.1.md4
-rw-r--r--contrib/bc/manuals/dc/H.14
-rw-r--r--contrib/bc/manuals/dc/H.1.md4
-rw-r--r--contrib/bc/manuals/dc/HN.14
-rw-r--r--contrib/bc/manuals/dc/HN.1.md4
-rw-r--r--contrib/bc/manuals/dc/N.14
-rw-r--r--contrib/bc/manuals/dc/N.1.md4
-rwxr-xr-xcontrib/bc/scripts/functions.sh82
-rwxr-xr-xcontrib/bc/scripts/locale_install.sh11
-rw-r--r--contrib/bc/src/data.c2
-rwxr-xr-xcontrib/bc/tests/all.sh27
-rwxr-xr-xcontrib/bc/tests/bc/timeconst.sh18
-rwxr-xr-xcontrib/bc/tests/dc/scripts/easter.sh50
-rwxr-xr-xcontrib/bc/tests/error.sh21
-rwxr-xr-xcontrib/bc/tests/errors.sh17
-rwxr-xr-xcontrib/bc/tests/history.py2
-rwxr-xr-xcontrib/bc/tests/history.sh18
-rwxr-xr-xcontrib/bc/tests/other.sh17
-rwxr-xr-xcontrib/bc/tests/read.sh19
-rwxr-xr-xcontrib/bc/tests/script.sh29
-rwxr-xr-xcontrib/bc/tests/scripts.sh25
-rwxr-xr-xcontrib/bc/tests/stdin.sh17
-rwxr-xr-xcontrib/bc/tests/test.sh23
58 files changed, 469 insertions, 115 deletions
diff --git a/contrib/bc/LICENSE.md b/contrib/bc/LICENSE.md
index 8e6b7e0b9051..b65095edc26c 100644
--- a/contrib/bc/LICENSE.md
+++ b/contrib/bc/LICENSE.md
@@ -1,6 +1,6 @@
# License
-Copyright (c) 2018-2023 Gavin D. Howard <gavin@yzena.com>
+Copyright (c) 2018-2023 Gavin D. Howard <gavin@gavinhoward.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-2023, Gavin D. Howard <gavin@yzena.com>
+Copyright (c) 2018-2023, Gavin D. Howard <gavin@gavinhoward.com>
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
@@ -60,7 +60,7 @@ 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-2023 Gavin D. Howard <gavin@yzena.com>
+Copyright (c) 2018-2023 Gavin D. Howard <gavin@gavinhoward.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
diff --git a/contrib/bc/NEWS.md b/contrib/bc/NEWS.md
index 36952fdaf582..4601db456f86 100644
--- a/contrib/bc/NEWS.md
+++ b/contrib/bc/NEWS.md
@@ -1,5 +1,23 @@
# News
+## 6.2.4
+
+This is a production release that fixes a test failure that happens when
+`tests/bc/scripts/timeconst.bc` doesn't exist. This should only affect
+packagers.
+
+This bug happened because I forgot something I added in the previous release:
+better error checking in tests to help packagers. Unfortunately, I was too
+zealous with the error checking.
+
+## 6.2.3
+
+This is a production release that moves `bc` to <https://git.gavinhoward.com>.
+
+That's all it does: update links. Users do ***NOT*** need to upgrade; there are
+redirects that will stay in place indefinitely. This release is only for new
+users.
+
## 6.2.2
This is a production release that fixes a bug.
diff --git a/contrib/bc/README.md b/contrib/bc/README.md
index 438cab0d1694..9d395f747185 100644
--- a/contrib/bc/README.md
+++ b/contrib/bc/README.md
@@ -1,12 +1,12 @@
# `bc`
-***WARNING: New user registration for https://git.yzena.com/ is disabled because
-of spam. If you need to report a bug with `bc`, email gavin at this site minus
-the `git.` part for an account, and I will create one for you. Or you can report
-an issue at [GitHub][29].***
+***WARNING: New user registration for <https://git.gavinhoward.com/> is disabled
+because of spam. If you need to report a bug with `bc`, email gavin at this site
+minus the `git.` part for an account, and I will create one for you. Or you can
+report an issue at [GitHub][29].***
-***WARNING: This project has moved to [https://git.yzena.com/][20] for [these
-reasons][21], though GitHub will remain a mirror.***
+***WARNING: This project has moved to [https://git.gavinhoward.com/][20] for
+[these reasons][21], though GitHub will remain a mirror.***
This is an implementation of the [POSIX `bc` calculator][12] that implements
[GNU `bc`][1] extensions, as well as the period (`.`) extension for the BSD
@@ -443,6 +443,10 @@ This `bc` uses the commit message guidelines laid out in [this blog post][10].
This `bc` uses [semantic versioning][11].
+## AI-Free
+
+This repository is 100% AI-Free code.
+
## Contents
Items labeled with `(maintainer use only)` are not included in release source
@@ -481,10 +485,10 @@ Folders:
[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
-[17]: https://git.yzena.com/gavin/vim-bc
-[18]: https://git.yzena.com/gavin/bc_libs
+[17]: https://git.gavinhoward.com/gavin/vim-bc
+[18]: https://git.gavinhoward.com/gavin/bc_libs
[19]: ./manuals/benchmarks.md
-[20]: https://git.yzena.com/gavin/bc
+[20]: https://git.gavinhoward.com/gavin/bc
[21]: https://gavinhoward.com/2020/04/i-am-moving-away-from-github/
[22]: https://www.deepl.com/translator
[23]: https://cgit.freebsd.org/src/tree/contrib/bc
diff --git a/contrib/bc/gen/bc_help.txt b/contrib/bc/gen/bc_help.txt
index f78ba9e71dd3..c51ba186db15 100644
--- a/contrib/bc/gen/bc_help.txt
+++ b/contrib/bc/gen/bc_help.txt
@@ -37,7 +37,7 @@ usage: %s [options] [file...]
bc is a command-line, arbitrary-precision calculator with a Turing-complete
language. For details, use `man %s` or see the online documentation at
-https://git.yzena.com/gavin/bc/src/tag/%s/manuals/bc/%s.1.md.
+https://git.gavinhoward.com/gavin/bc/src/tag/%s/manuals/bc/%s.1.md.
This bc is compatible with both the GNU bc and the POSIX bc spec. See the GNU bc
manual (https://www.gnu.org/software/bc/manual/bc.html) and bc spec
diff --git a/contrib/bc/gen/dc_help.txt b/contrib/bc/gen/dc_help.txt
index 8b313f8d9e07..7d9e7ec28d25 100644
--- a/contrib/bc/gen/dc_help.txt
+++ b/contrib/bc/gen/dc_help.txt
@@ -37,7 +37,7 @@ usage: %s [options] [file...]
dc is a reverse-polish notation command-line calculator which supports unlimited
precision arithmetic. For details, use `man %s` or see the online documentation
-at https://git.yzena.com/gavin/bc/src/tag/%s/manuals/bc/%s.1.md.
+at https://git.gavinhoward.com/gavin/bc/src/tag/%s/manuals/bc/%s.1.md.
This dc is (mostly) compatible with the OpenBSD dc and the GNU dc. See the
OpenBSD man page (http://man.openbsd.org/OpenBSD-current/man1/dc.1) and the GNU
diff --git a/contrib/bc/gen/strgen.sh b/contrib/bc/gen/strgen.sh
index 5ef66fb2d8c8..a65e221ad0b4 100755
--- a/contrib/bc/gen/strgen.sh
+++ b/contrib/bc/gen/strgen.sh
@@ -36,21 +36,33 @@ script="$0"
scriptdir=$(dirname "$script")
. "$scriptdir/../scripts/functions.sh"
+# Just print the usage and exit with an error. This can receive a message to
+# print.
+# @param 1 A message to print.
+usage() {
+ if [ $# -eq 1 ]; then
+ printf '%s\n\n' "$1"
+ fi
+ printf 'usage: %s input output exclude name [label [define [remove_tabs]]]\n' "$progname"
+ exit 1
+}
+
# See strgen.c comment on main() for what these mean. Note, however, that this
# script generates a string literal, not a char array. To understand the
# consequences of that, see manuals/development.md#strgenc.
if [ $# -lt 3 ]; then
- echo "usage: $progname input output exclude name [label [define [remove_tabs]]]"
- exit 1
+ usage "Not enough arguments"
fi
input="$1"
+check_file_arg "$input"
output="$2"
exclude="$3"
name="$4"
label="$5"
define="$6"
remove_tabs="$7"
+check_bool_arg "$remove_tabs"
tmpinput=$(mktemp -t "${input##*/}_XXXXXX")
diff --git a/contrib/bc/include/version.h b/contrib/bc/include/version.h
index e1b72de90eef..6d8ddfea0940 100644
--- a/contrib/bc/include/version.h
+++ b/contrib/bc/include/version.h
@@ -37,6 +37,6 @@
#define BC_VERSION_H
/// The current version.
-#define VERSION 6.2.2
+#define VERSION 6.2.4
#endif // BC_VERSION_H
diff --git a/contrib/bc/manuals/bc/A.1 b/contrib/bc/manuals/bc/A.1
index 629cc32c4c69..b1996a1f282e 100644
--- a/contrib/bc/manuals/bc/A.1
+++ b/contrib/bc/manuals/bc/A.1
@@ -2977,8 +2977,8 @@ Before version \f[B]6.1.0\f[R], this bc(1) had incorrect behavior for
the \f[B]quit\f[R] statement.
.PP
No other bugs are known.
-Report bugs at https://git.yzena.com/gavin/bc .
+Report bugs at https://git.gavinhoward.com/gavin/bc .
.SH AUTHORS
.PP
Gavin D.
-Howard <gavin@yzena.com> and contributors.
+Howard <gavin@gavinhoward.com> and contributors.
diff --git a/contrib/bc/manuals/bc/A.1.md b/contrib/bc/manuals/bc/A.1.md
index 40cfa5fcdad6..e7b4c8212190 100644
--- a/contrib/bc/manuals/bc/A.1.md
+++ b/contrib/bc/manuals/bc/A.1.md
@@ -2498,8 +2498,8 @@ This bc(1) supports error messages for different locales, and thus, it supports
Before version **6.1.0**, this bc(1) had incorrect behavior for the **quit**
statement.
-No other bugs are known. Report bugs at https://git.yzena.com/gavin/bc .
+No other bugs are known. Report bugs at https://git.gavinhoward.com/gavin/bc .
# AUTHORS
-Gavin D. Howard <gavin@yzena.com> and contributors.
+Gavin D. Howard <gavin@gavinhoward.com> and contributors.
diff --git a/contrib/bc/manuals/bc/E.1 b/contrib/bc/manuals/bc/E.1
index 89f95ef81cfa..fea1cecdc4c5 100644
--- a/contrib/bc/manuals/bc/E.1
+++ b/contrib/bc/manuals/bc/E.1
@@ -1810,8 +1810,8 @@ Before version \f[B]6.1.0\f[R], this bc(1) had incorrect behavior for
the \f[B]quit\f[R] statement.
.PP
No other bugs are known.
-Report bugs at https://git.yzena.com/gavin/bc .
+Report bugs at https://git.gavinhoward.com/gavin/bc .
.SH AUTHORS
.PP
Gavin D.
-Howard <gavin@yzena.com> and contributors.
+Howard <gavin@gavinhoward.com> and contributors.
diff --git a/contrib/bc/manuals/bc/E.1.md b/contrib/bc/manuals/bc/E.1.md
index 30451dabd64b..3631267f2dc9 100644
--- a/contrib/bc/manuals/bc/E.1.md
+++ b/contrib/bc/manuals/bc/E.1.md
@@ -1506,8 +1506,8 @@ This bc(1) supports error messages for different locales, and thus, it supports
Before version **6.1.0**, this bc(1) had incorrect behavior for the **quit**
statement.
-No other bugs are known. Report bugs at https://git.yzena.com/gavin/bc .
+No other bugs are known. Report bugs at https://git.gavinhoward.com/gavin/bc .
# AUTHORS
-Gavin D. Howard <gavin@yzena.com> and contributors.
+Gavin D. Howard <gavin@gavinhoward.com> and contributors.
diff --git a/contrib/bc/manuals/bc/EH.1 b/contrib/bc/manuals/bc/EH.1
index e006a5c41c84..2a36cab7f778 100644
--- a/contrib/bc/manuals/bc/EH.1
+++ b/contrib/bc/manuals/bc/EH.1
@@ -1781,8 +1781,8 @@ Before version \f[B]6.1.0\f[R], this bc(1) had incorrect behavior for
the \f[B]quit\f[R] statement.
.PP
No other bugs are known.
-Report bugs at https://git.yzena.com/gavin/bc .
+Report bugs at https://git.gavinhoward.com/gavin/bc .
.SH AUTHORS
.PP
Gavin D.
-Howard <gavin@yzena.com> and contributors.
+Howard <gavin@gavinhoward.com> and contributors.
diff --git a/contrib/bc/manuals/bc/EH.1.md b/contrib/bc/manuals/bc/EH.1.md
index 28f874c36ebe..f2f49ea76944 100644
--- a/contrib/bc/manuals/bc/EH.1.md
+++ b/contrib/bc/manuals/bc/EH.1.md
@@ -1480,8 +1480,8 @@ This bc(1) supports error messages for different locales, and thus, it supports
Before version **6.1.0**, this bc(1) had incorrect behavior for the **quit**
statement.
-No other bugs are known. Report bugs at https://git.yzena.com/gavin/bc .
+No other bugs are known. Report bugs at https://git.gavinhoward.com/gavin/bc .
# AUTHORS
-Gavin D. Howard <gavin@yzena.com> and contributors.
+Gavin D. Howard <gavin@gavinhoward.com> and contributors.
diff --git a/contrib/bc/manuals/bc/EHN.1 b/contrib/bc/manuals/bc/EHN.1
index e77148710255..75768a03c141 100644
--- a/contrib/bc/manuals/bc/EHN.1
+++ b/contrib/bc/manuals/bc/EHN.1
@@ -1774,8 +1774,8 @@ Before version \f[B]6.1.0\f[R], this bc(1) had incorrect behavior for
the \f[B]quit\f[R] statement.
.PP
No other bugs are known.
-Report bugs at https://git.yzena.com/gavin/bc .
+Report bugs at https://git.gavinhoward.com/gavin/bc .
.SH AUTHORS
.PP
Gavin D.
-Howard <gavin@yzena.com> and contributors.
+Howard <gavin@gavinhoward.com> and contributors.
diff --git a/contrib/bc/manuals/bc/EHN.1.md b/contrib/bc/manuals/bc/EHN.1.md
index 09288c577a5c..a38503cc8a24 100644
--- a/contrib/bc/manuals/bc/EHN.1.md
+++ b/contrib/bc/manuals/bc/EHN.1.md
@@ -1472,8 +1472,8 @@ use a period (**.**) as a radix point, regardless of the value of
Before version **6.1.0**, this bc(1) had incorrect behavior for the **quit**
statement.
-No other bugs are known. Report bugs at https://git.yzena.com/gavin/bc .
+No other bugs are known. Report bugs at https://git.gavinhoward.com/gavin/bc .
# AUTHORS
-Gavin D. Howard <gavin@yzena.com> and contributors.
+Gavin D. Howard <gavin@gavinhoward.com> and contributors.
diff --git a/contrib/bc/manuals/bc/EN.1 b/contrib/bc/manuals/bc/EN.1
index 99ecfd2056e2..9c0158583199 100644
--- a/contrib/bc/manuals/bc/EN.1
+++ b/contrib/bc/manuals/bc/EN.1
@@ -1803,8 +1803,8 @@ Before version \f[B]6.1.0\f[R], this bc(1) had incorrect behavior for
the \f[B]quit\f[R] statement.
.PP
No other bugs are known.
-Report bugs at https://git.yzena.com/gavin/bc .
+Report bugs at https://git.gavinhoward.com/gavin/bc .
.SH AUTHORS
.PP
Gavin D.
-Howard <gavin@yzena.com> and contributors.
+Howard <gavin@gavinhoward.com> and contributors.
diff --git a/contrib/bc/manuals/bc/EN.1.md b/contrib/bc/manuals/bc/EN.1.md
index 52bacfa5df63..28b558d8b21d 100644
--- a/contrib/bc/manuals/bc/EN.1.md
+++ b/contrib/bc/manuals/bc/EN.1.md
@@ -1498,8 +1498,8 @@ use a period (**.**) as a radix point, regardless of the value of
Before version **6.1.0**, this bc(1) had incorrect behavior for the **quit**
statement.
-No other bugs are known. Report bugs at https://git.yzena.com/gavin/bc .
+No other bugs are known. Report bugs at https://git.gavinhoward.com/gavin/bc .
# AUTHORS
-Gavin D. Howard <gavin@yzena.com> and contributors.
+Gavin D. Howard <gavin@gavinhoward.com> and contributors.
diff --git a/contrib/bc/manuals/bc/H.1 b/contrib/bc/manuals/bc/H.1
index 856d2c604dee..cbd93da0df81 100644
--- a/contrib/bc/manuals/bc/H.1
+++ b/contrib/bc/manuals/bc/H.1
@@ -2948,8 +2948,8 @@ Before version \f[B]6.1.0\f[R], this bc(1) had incorrect behavior for
the \f[B]quit\f[R] statement.
.PP
No other bugs are known.
-Report bugs at https://git.yzena.com/gavin/bc .
+Report bugs at https://git.gavinhoward.com/gavin/bc .
.SH AUTHORS
.PP
Gavin D.
-Howard <gavin@yzena.com> and contributors.
+Howard <gavin@gavinhoward.com> and contributors.
diff --git a/contrib/bc/manuals/bc/H.1.md b/contrib/bc/manuals/bc/H.1.md
index 4a1278dbec86..ac35def9019f 100644
--- a/contrib/bc/manuals/bc/H.1.md
+++ b/contrib/bc/manuals/bc/H.1.md
@@ -2472,8 +2472,8 @@ This bc(1) supports error messages for different locales, and thus, it supports
Before version **6.1.0**, this bc(1) had incorrect behavior for the **quit**
statement.
-No other bugs are known. Report bugs at https://git.yzena.com/gavin/bc .
+No other bugs are known. Report bugs at https://git.gavinhoward.com/gavin/bc .
# AUTHORS
-Gavin D. Howard <gavin@yzena.com> and contributors.
+Gavin D. Howard <gavin@gavinhoward.com> and contributors.
diff --git a/contrib/bc/manuals/bc/HN.1 b/contrib/bc/manuals/bc/HN.1
index 5356950aa68c..5893d2a7f9a9 100644
--- a/contrib/bc/manuals/bc/HN.1
+++ b/contrib/bc/manuals/bc/HN.1
@@ -2941,8 +2941,8 @@ Before version \f[B]6.1.0\f[R], this bc(1) had incorrect behavior for
the \f[B]quit\f[R] statement.
.PP
No other bugs are known.
-Report bugs at https://git.yzena.com/gavin/bc .
+Report bugs at https://git.gavinhoward.com/gavin/bc .
.SH AUTHORS
.PP
Gavin D.
-Howard <gavin@yzena.com> and contributors.
+Howard <gavin@gavinhoward.com> and contributors.
diff --git a/contrib/bc/manuals/bc/HN.1.md b/contrib/bc/manuals/bc/HN.1.md
index 8dd0674512ac..82a99addd344 100644
--- a/contrib/bc/manuals/bc/HN.1.md
+++ b/contrib/bc/manuals/bc/HN.1.md
@@ -2464,8 +2464,8 @@ use a period (**.**) as a radix point, regardless of the value of
Before version **6.1.0**, this bc(1) had incorrect behavior for the **quit**
statement.
-No other bugs are known. Report bugs at https://git.yzena.com/gavin/bc .
+No other bugs are known. Report bugs at https://git.gavinhoward.com/gavin/bc .
# AUTHORS
-Gavin D. Howard <gavin@yzena.com> and contributors.
+Gavin D. Howard <gavin@gavinhoward.com> and contributors.
diff --git a/contrib/bc/manuals/bc/N.1 b/contrib/bc/manuals/bc/N.1
index 517e403aa6ca..791f47407001 100644
--- a/contrib/bc/manuals/bc/N.1
+++ b/contrib/bc/manuals/bc/N.1
@@ -2970,8 +2970,8 @@ Before version \f[B]6.1.0\f[R], this bc(1) had incorrect behavior for
the \f[B]quit\f[R] statement.
.PP
No other bugs are known.
-Report bugs at https://git.yzena.com/gavin/bc .
+Report bugs at https://git.gavinhoward.com/gavin/bc .
.SH AUTHORS
.PP
Gavin D.
-Howard <gavin@yzena.com> and contributors.
+Howard <gavin@gavinhoward.com> and contributors.
diff --git a/contrib/bc/manuals/bc/N.1.md b/contrib/bc/manuals/bc/N.1.md
index 2c85180f670f..b8339ea31a5e 100644
--- a/contrib/bc/manuals/bc/N.1.md
+++ b/contrib/bc/manuals/bc/N.1.md
@@ -2490,8 +2490,8 @@ use a period (**.**) as a radix point, regardless of the value of
Before version **6.1.0**, this bc(1) had incorrect behavior for the **quit**
statement.
-No other bugs are known. Report bugs at https://git.yzena.com/gavin/bc .
+No other bugs are known. Report bugs at https://git.gavinhoward.com/gavin/bc .
# AUTHORS
-Gavin D. Howard <gavin@yzena.com> and contributors.
+Gavin D. Howard <gavin@gavinhoward.com> and contributors.
diff --git a/contrib/bc/manuals/bcl.3 b/contrib/bc/manuals/bcl.3
index e066103d02f4..6bebaa8f02cd 100644
--- a/contrib/bc/manuals/bcl.3
+++ b/contrib/bc/manuals/bcl.3
@@ -1446,8 +1446,8 @@ This is also true of bcl(3).
.SH BUGS
.PP
None are known.
-Report bugs at https://git.yzena.com/gavin/bc.
+Report bugs at https://git.gavinhoward.com/gavin/bc.
.SH AUTHORS
.PP
Gavin D.
-Howard <gavin@yzena.com> and contributors.
+Howard <gavin@gavinhoward.com> and contributors.
diff --git a/contrib/bc/manuals/bcl.3.md b/contrib/bc/manuals/bcl.3.md
index e2d92866ddbe..6c6967b44770 100644
--- a/contrib/bc/manuals/bcl.3.md
+++ b/contrib/bc/manuals/bcl.3.md
@@ -1230,8 +1230,8 @@ use a period (**.**) as a radix point, regardless of the value of
# BUGS
-None are known. Report bugs at https://git.yzena.com/gavin/bc.
+None are known. Report bugs at https://git.gavinhoward.com/gavin/bc.
# AUTHORS
-Gavin D. Howard <gavin@yzena.com> and contributors.
+Gavin D. Howard <gavin@gavinhoward.com> and contributors.
diff --git a/contrib/bc/manuals/build.md b/contrib/bc/manuals/build.md
index 5cec45f596b4..d9c46ae22602 100644
--- a/contrib/bc/manuals/build.md
+++ b/contrib/bc/manuals/build.md
@@ -40,7 +40,7 @@ accepted build options.
## Windows
For releases, Windows builds of `bc`, `dc`, and `bcl` are available for download
-from <https://git.yzena.com/gavin/bc> and GitHub.
+from <https://git.gavinhoward.com/gavin/bc> and GitHub.
However, if you wish to build it yourself, this `bc` can be built using Visual
Studio or MSBuild.
diff --git a/contrib/bc/manuals/dc/A.1 b/contrib/bc/manuals/dc/A.1
index 6500bf9129e2..13ed8c4cf808 100644
--- a/contrib/bc/manuals/dc/A.1
+++ b/contrib/bc/manuals/dc/A.1
@@ -1718,8 +1718,8 @@ https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html .
.SH BUGS
.PP
None are known.
-Report bugs at https://git.yzena.com/gavin/bc .
+Report bugs at https://git.gavinhoward.com/gavin/bc .
.SH AUTHOR
.PP
Gavin D.
-Howard <gavin@yzena.com> and contributors.
+Howard <gavin@gavinhoward.com> and contributors.
diff --git a/contrib/bc/manuals/dc/A.1.md b/contrib/bc/manuals/dc/A.1.md
index 4c40e38dcee8..b656650cb820 100644
--- a/contrib/bc/manuals/dc/A.1.md
+++ b/contrib/bc/manuals/dc/A.1.md
@@ -1517,8 +1517,8 @@ https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html .
# BUGS
-None are known. Report bugs at https://git.yzena.com/gavin/bc .
+None are known. Report bugs at https://git.gavinhoward.com/gavin/bc .
# AUTHOR
-Gavin D. Howard <gavin@yzena.com> and contributors.
+Gavin D. Howard <gavin@gavinhoward.com> and contributors.
diff --git a/contrib/bc/manuals/dc/E.1 b/contrib/bc/manuals/dc/E.1
index 7f2477f10772..3fb69dfe70da 100644
--- a/contrib/bc/manuals/dc/E.1
+++ b/contrib/bc/manuals/dc/E.1
@@ -1496,8 +1496,8 @@ https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html .
.SH BUGS
.PP
None are known.
-Report bugs at https://git.yzena.com/gavin/bc .
+Report bugs at https://git.gavinhoward.com/gavin/bc .
.SH AUTHOR
.PP
Gavin D.
-Howard <gavin@yzena.com> and contributors.
+Howard <gavin@gavinhoward.com> and contributors.
diff --git a/contrib/bc/manuals/dc/E.1.md b/contrib/bc/manuals/dc/E.1.md
index 437fc645937a..0bbe97612889 100644
--- a/contrib/bc/manuals/dc/E.1.md
+++ b/contrib/bc/manuals/dc/E.1.md
@@ -1341,8 +1341,8 @@ https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html .
# BUGS
-None are known. Report bugs at https://git.yzena.com/gavin/bc .
+None are known. Report bugs at https://git.gavinhoward.com/gavin/bc .
# AUTHOR
-Gavin D. Howard <gavin@yzena.com> and contributors.
+Gavin D. Howard <gavin@gavinhoward.com> and contributors.
diff --git a/contrib/bc/manuals/dc/EH.1 b/contrib/bc/manuals/dc/EH.1
index ba4e67507028..da7776edd538 100644
--- a/contrib/bc/manuals/dc/EH.1
+++ b/contrib/bc/manuals/dc/EH.1
@@ -1470,8 +1470,8 @@ https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html .
.SH BUGS
.PP
None are known.
-Report bugs at https://git.yzena.com/gavin/bc .
+Report bugs at https://git.gavinhoward.com/gavin/bc .
.SH AUTHOR
.PP
Gavin D.
-Howard <gavin@yzena.com> and contributors.
+Howard <gavin@gavinhoward.com> and contributors.
diff --git a/contrib/bc/manuals/dc/EH.1.md b/contrib/bc/manuals/dc/EH.1.md
index 6d1dd78985b2..0751d3f78d21 100644
--- a/contrib/bc/manuals/dc/EH.1.md
+++ b/contrib/bc/manuals/dc/EH.1.md
@@ -1318,8 +1318,8 @@ https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html .
# BUGS
-None are known. Report bugs at https://git.yzena.com/gavin/bc .
+None are known. Report bugs at https://git.gavinhoward.com/gavin/bc .
# AUTHOR
-Gavin D. Howard <gavin@yzena.com> and contributors.
+Gavin D. Howard <gavin@gavinhoward.com> and contributors.
diff --git a/contrib/bc/manuals/dc/EHN.1 b/contrib/bc/manuals/dc/EHN.1
index 5f454d01cc2e..10ef283ea056 100644
--- a/contrib/bc/manuals/dc/EHN.1
+++ b/contrib/bc/manuals/dc/EHN.1
@@ -1466,8 +1466,8 @@ https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html .
.SH BUGS
.PP
None are known.
-Report bugs at https://git.yzena.com/gavin/bc .
+Report bugs at https://git.gavinhoward.com/gavin/bc .
.SH AUTHOR
.PP
Gavin D.
-Howard <gavin@yzena.com> and contributors.
+Howard <gavin@gavinhoward.com> and contributors.
diff --git a/contrib/bc/manuals/dc/EHN.1.md b/contrib/bc/manuals/dc/EHN.1.md
index e3786886a035..9ba7fe13e0ad 100644
--- a/contrib/bc/manuals/dc/EHN.1.md
+++ b/contrib/bc/manuals/dc/EHN.1.md
@@ -1313,8 +1313,8 @@ https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html .
# BUGS
-None are known. Report bugs at https://git.yzena.com/gavin/bc .
+None are known. Report bugs at https://git.gavinhoward.com/gavin/bc .
# AUTHOR
-Gavin D. Howard <gavin@yzena.com> and contributors.
+Gavin D. Howard <gavin@gavinhoward.com> and contributors.
diff --git a/contrib/bc/manuals/dc/EN.1 b/contrib/bc/manuals/dc/EN.1
index 6f08fc8d3c0c..abdcbe8c63f8 100644
--- a/contrib/bc/manuals/dc/EN.1
+++ b/contrib/bc/manuals/dc/EN.1
@@ -1492,8 +1492,8 @@ https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html .
.SH BUGS
.PP
None are known.
-Report bugs at https://git.yzena.com/gavin/bc .
+Report bugs at https://git.gavinhoward.com/gavin/bc .
.SH AUTHOR
.PP
Gavin D.
-Howard <gavin@yzena.com> and contributors.
+Howard <gavin@gavinhoward.com> and contributors.
diff --git a/contrib/bc/manuals/dc/EN.1.md b/contrib/bc/manuals/dc/EN.1.md
index b97e121e2226..5c0590c53aee 100644
--- a/contrib/bc/manuals/dc/EN.1.md
+++ b/contrib/bc/manuals/dc/EN.1.md
@@ -1336,8 +1336,8 @@ https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html .
# BUGS
-None are known. Report bugs at https://git.yzena.com/gavin/bc .
+None are known. Report bugs at https://git.gavinhoward.com/gavin/bc .
# AUTHOR
-Gavin D. Howard <gavin@yzena.com> and contributors.
+Gavin D. Howard <gavin@gavinhoward.com> and contributors.
diff --git a/contrib/bc/manuals/dc/H.1 b/contrib/bc/manuals/dc/H.1
index cc2f156205e6..c96100e51bc5 100644
--- a/contrib/bc/manuals/dc/H.1
+++ b/contrib/bc/manuals/dc/H.1
@@ -1692,8 +1692,8 @@ https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html .
.SH BUGS
.PP
None are known.
-Report bugs at https://git.yzena.com/gavin/bc .
+Report bugs at https://git.gavinhoward.com/gavin/bc .
.SH AUTHOR
.PP
Gavin D.
-Howard <gavin@yzena.com> and contributors.
+Howard <gavin@gavinhoward.com> and contributors.
diff --git a/contrib/bc/manuals/dc/H.1.md b/contrib/bc/manuals/dc/H.1.md
index b8ad29b28a85..0dddf66d700a 100644
--- a/contrib/bc/manuals/dc/H.1.md
+++ b/contrib/bc/manuals/dc/H.1.md
@@ -1494,8 +1494,8 @@ https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html .
# BUGS
-None are known. Report bugs at https://git.yzena.com/gavin/bc .
+None are known. Report bugs at https://git.gavinhoward.com/gavin/bc .
# AUTHOR
-Gavin D. Howard <gavin@yzena.com> and contributors.
+Gavin D. Howard <gavin@gavinhoward.com> and contributors.
diff --git a/contrib/bc/manuals/dc/HN.1 b/contrib/bc/manuals/dc/HN.1
index 8d16b10a23de..a6644ecd575b 100644
--- a/contrib/bc/manuals/dc/HN.1
+++ b/contrib/bc/manuals/dc/HN.1
@@ -1688,8 +1688,8 @@ https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html .
.SH BUGS
.PP
None are known.
-Report bugs at https://git.yzena.com/gavin/bc .
+Report bugs at https://git.gavinhoward.com/gavin/bc .
.SH AUTHOR
.PP
Gavin D.
-Howard <gavin@yzena.com> and contributors.
+Howard <gavin@gavinhoward.com> and contributors.
diff --git a/contrib/bc/manuals/dc/HN.1.md b/contrib/bc/manuals/dc/HN.1.md
index d658409b8362..d39a7497d3ac 100644
--- a/contrib/bc/manuals/dc/HN.1.md
+++ b/contrib/bc/manuals/dc/HN.1.md
@@ -1489,8 +1489,8 @@ https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html .
# BUGS
-None are known. Report bugs at https://git.yzena.com/gavin/bc .
+None are known. Report bugs at https://git.gavinhoward.com/gavin/bc .
# AUTHOR
-Gavin D. Howard <gavin@yzena.com> and contributors.
+Gavin D. Howard <gavin@gavinhoward.com> and contributors.
diff --git a/contrib/bc/manuals/dc/N.1 b/contrib/bc/manuals/dc/N.1
index 54fbadeed09c..f9aeb1acfb6c 100644
--- a/contrib/bc/manuals/dc/N.1
+++ b/contrib/bc/manuals/dc/N.1
@@ -1714,8 +1714,8 @@ https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html .
.SH BUGS
.PP
None are known.
-Report bugs at https://git.yzena.com/gavin/bc .
+Report bugs at https://git.gavinhoward.com/gavin/bc .
.SH AUTHOR
.PP
Gavin D.
-Howard <gavin@yzena.com> and contributors.
+Howard <gavin@gavinhoward.com> and contributors.
diff --git a/contrib/bc/manuals/dc/N.1.md b/contrib/bc/manuals/dc/N.1.md
index 35573c49da90..3c36661d3902 100644
--- a/contrib/bc/manuals/dc/N.1.md
+++ b/contrib/bc/manuals/dc/N.1.md
@@ -1512,8 +1512,8 @@ https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html .
# BUGS
-None are known. Report bugs at https://git.yzena.com/gavin/bc .
+None are known. Report bugs at https://git.gavinhoward.com/gavin/bc .
# AUTHOR
-Gavin D. Howard <gavin@yzena.com> and contributors.
+Gavin D. Howard <gavin@gavinhoward.com> and contributors.
diff --git a/contrib/bc/scripts/functions.sh b/contrib/bc/scripts/functions.sh
index 98cb5cf7aae0..8ae765859e51 100755
--- a/contrib/bc/scripts/functions.sh
+++ b/contrib/bc/scripts/functions.sh
@@ -71,6 +71,88 @@ err_exit() {
exit "$2"
}
+# Function for checking the "d"/"dir" argument of scripts. This function expects
+# a usage() function to exist in the caller.
+# @param 1 The argument to check.
+check_d_arg() {
+
+ if [ "$#" -ne 1 ]; then
+ printf 'Invalid number of args to check_d_arg\n'
+ exit 1
+ fi
+
+ _check_d_arg_arg="$1"
+ shift
+
+ if [ "$_check_d_arg_arg" != "bc" ] && [ "$_check_d_arg_arg" != "dc" ]; then
+ _check_d_arg_msg=$(printf 'Invalid d arg: %s\nMust be either "bc" or "dc".\n\n' \
+ "$_check_d_arg_arg")
+ usage "$_check_d_arg_msg"
+ fi
+}
+
+# Function for checking the boolean arguments of scripts. This function expects
+# a usage() function to exist in the caller.
+# @param 1 The argument to check.
+check_bool_arg() {
+
+ if [ "$#" -ne 1 ]; then
+ printf 'Invalid number of args to check_bool_arg\n'
+ exit 1
+ fi
+
+ _check_bool_arg_arg="$1"
+ shift
+
+ if [ "$_check_bool_arg_arg" != "0" ] && [ "$_check_bool_arg_arg" != "1" ]; then
+ _check_bool_arg_msg=$(printf 'Invalid bool arg: %s\nMust be either "0" or "1".\n\n' \
+ "$_check_bool_arg_arg")
+ usage "$_check_bool_arg_msg"
+ fi
+}
+
+# Function for checking the executable arguments of scripts. This function
+# expects a usage() function to exist in the caller.
+# @param 1 The argument to check.
+check_exec_arg() {
+
+ if [ "$#" -ne 1 ]; then
+ printf 'Invalid number of args to check_exec_arg\n'
+ exit 1
+ fi
+
+ _check_exec_arg_arg="$1"
+ shift
+
+ if [ ! -x "$_check_exec_arg_arg" ]; then
+ if ! command -v "$_check_exec_arg_arg" >/dev/null 2>&1; then
+ _check_exec_arg_msg=$(printf 'Invalid exec arg: %s\nMust be an executable file.\n\n' \
+ "$_check_exec_arg_arg")
+ usage "$_check_exec_arg_msg"
+ fi
+ fi
+}
+
+# Function for checking the file arguments of scripts. This function expects a
+# usage() function to exist in the caller.
+# @param 1 The argument to check.
+check_file_arg() {
+
+ if [ "$#" -ne 1 ]; then
+ printf 'Invalid number of args to check_file_arg\n'
+ exit 1
+ fi
+
+ _check_file_arg_arg="$1"
+ shift
+
+ if [ ! -f "$_check_file_arg_arg" ]; then
+ _check_file_arg_msg=$(printf 'Invalid file arg: %s\nMust be a file.\n\n' \
+ "$_check_file_arg_arg")
+ usage "$_check_file_arg_msg"
+ fi
+}
+
# Check the return code on a test and exit with a fail if it's non-zero.
# @param d The calculator under test.
# @param err The return code.
diff --git a/contrib/bc/scripts/locale_install.sh b/contrib/bc/scripts/locale_install.sh
index a2d9ccda7ade..75534a735cdb 100755
--- a/contrib/bc/scripts/locale_install.sh
+++ b/contrib/bc/scripts/locale_install.sh
@@ -28,6 +28,7 @@
#
# Just print the usage and exit with an error.
+# @param 1 A message to print.
usage() {
if [ $# -eq 1 ]; then
printf '%s\n' "$1"
@@ -189,7 +190,7 @@ while getopts "l" opt; do
done
-test "$#" -ge 2 || usage
+test "$#" -ge 2 || usage "Must have at least two arguments"
nlspath="$1"
shift
@@ -240,11 +241,15 @@ for file in $locales_dir/*.msg; do
continue
fi
+ printf 'Installing %s...' "$locale"
+
# Generate the proper location for the cat file.
loc=$(gen_nlspath "$destdir/$nlspath" "$locale" "$main_exec")
gencatfile "$loc" "$file"
+ printf 'done\n'
+
done
# Now that we have done the non-symlinks, it's time to do the symlinks. Think
@@ -275,6 +280,8 @@ for file in $locales_dir/*.msg; do
# Make sure to skip non-symlinks; they are already done.
if [ -L "$file" ]; then
+ printf 'Linking %s...' "$locale"
+
# This song and dance is because we want to generate relative symlinks.
# They take less space, but also, they are more resilient to being
# moved.
@@ -294,6 +301,8 @@ for file in $locales_dir/*.msg; do
# Finally, symlink to the install of the generated cat file that
# corresponds to the correct msg file.
ln -fs "$rel" "$loc"
+
+ printf 'done\n'
fi
done
diff --git a/contrib/bc/src/data.c b/contrib/bc/src/data.c
index 1694bb684718..284d3de7b642 100644
--- a/contrib/bc/src/data.c
+++ b/contrib/bc/src/data.c
@@ -71,7 +71,7 @@ const uchar dc_sig_msg_len = (uchar) (sizeof(dc_sig_msg) - 1);
/// The copyright banner.
const char bc_copyright[] =
"Copyright (c) 2018-2023 Gavin D. Howard and contributors\n"
- "Report bugs at: https://git.yzena.com/gavin/bc\n\n"
+ "Report bugs at: https://git.gavinhoward.com/gavin/bc\n\n"
"This is free software with ABSOLUTELY NO WARRANTY.\n";
// clang-format on
diff --git a/contrib/bc/tests/all.sh b/contrib/bc/tests/all.sh
index 0ef8ae6cb49b..099804777c13 100755
--- a/contrib/bc/tests/all.sh
+++ b/contrib/bc/tests/all.sh
@@ -32,6 +32,18 @@ testdir=$(dirname "$script")
. "$testdir/../scripts/functions.sh"
+# Just print the usage and exit with an error. This can receive a message to
+# print.
+# @param 1 A message to print.
+usage() {
+ if [ $# -eq 1 ]; then
+ printf '%s\n\n' "$1"
+ fi
+ print 'usage: %s [-n] dir [run_extra_tests] [run_stack_tests] [gen_tests] [run_problematic_tests] [time_tests] [exec args...]\n' \
+ "$script"
+ exit 1
+}
+
# We need to figure out if we should run stuff in parallel.
pll=1
@@ -48,50 +60,63 @@ done
if [ "$#" -ge 1 ]; then
d="$1"
shift
+ check_d_arg "$d"
else
- err_exit "usage: $script [-n] dir [run_extra_tests] [run_stack_tests] [gen_tests] [run_problematic_tests] [time_tests] [exec args...]" 1
+ usage "Not enough arguments"
fi
if [ "$#" -lt 1 ]; then
extra=1
+ check_bool_arg "$extra"
else
extra="$1"
shift
+ check_bool_arg "$extra"
fi
if [ "$#" -lt 1 ]; then
run_stack_tests=1
+ check_bool_arg "$run_stack_tests"
else
run_stack_tests="$1"
shift
+ check_bool_arg "$run_stack_tests"
fi
if [ "$#" -lt 1 ]; then
generate_tests=1
+ check_bool_arg "$generate_tests"
else
generate_tests="$1"
shift
+ check_bool_arg "$generate_tests"
fi
if [ "$#" -lt 1 ]; then
problematic_tests=1
+ check_bool_arg "$problematic_tests"
else
problematic_tests="$1"
shift
+ check_bool_arg "$problematic_tests"
fi
if [ "$#" -lt 1 ]; then
time_tests=0
+ check_bool_arg "$time_tests"
else
time_tests="$1"
shift
+ check_bool_arg "$time_tests"
fi
if [ "$#" -lt 1 ]; then
exe="$testdir/../bin/$d"
+ check_exec_arg "$exe"
else
exe="$1"
shift
+ check_exec_arg "$exe"
fi
stars="***********************************************************************"
diff --git a/contrib/bc/tests/bc/timeconst.sh b/contrib/bc/tests/bc/timeconst.sh
index 3751700077f7..fbd2909e0992 100755
--- a/contrib/bc/tests/bc/timeconst.sh
+++ b/contrib/bc/tests/bc/timeconst.sh
@@ -34,7 +34,21 @@ testdir=$(dirname "$script")
outputdir=${BC_TEST_OUTPUT_DIR:-$testdir/..}
-# Gets the timeconst script, which could be a command-line argument.
+# Just print the usage and exit with an error. This can receive a message to
+# print.
+# @param 1 A message to print.
+usage() {
+ if [ $# -eq 1 ]; then
+ printf '%s\n\n' "$1"
+ fi
+ printf 'usage: %s [timeconst_script] [exec args...]\n' "$0"
+ exit 1
+}
+
+. "$testdir/../../scripts/functions.sh"
+
+# Gets the timeconst script, which could be a command-line argument. I don't
+# need to check for error because we just skip if it doesn't work.
if [ "$#" -gt 0 ]; then
timeconst="$1"
shift
@@ -46,8 +60,10 @@ fi
if [ "$#" -gt 0 ]; then
bc="$1"
shift
+ check_exec_arg "$bc"
else
bc="$testdir/../../bin/bc"
+ check_exec_arg "$bc"
fi
out1="$outputdir/bc_outputs/bc_timeconst.txt"
diff --git a/contrib/bc/tests/dc/scripts/easter.sh b/contrib/bc/tests/dc/scripts/easter.sh
index 27dfe34580ea..1f8e7aa797fb 100755
--- a/contrib/bc/tests/dc/scripts/easter.sh
+++ b/contrib/bc/tests/dc/scripts/easter.sh
@@ -1,13 +1,59 @@
#!/bin/sh
+#
+# SPDX-License-Identifier: BSD-2-Clause
+#
+# Copyright (c) 2018-2023 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}")
+
+# Just print the usage and exit with an error. This can receive a message to
+# print.
+# @param 1 A message to print.
+usage() {
+ if [ $# -eq 1 ]; then
+ printf '%s\n\n' "$1"
+ fi
+ printf 'usage: %s dc_exec year [options...]\n' "$script"
+ exit 1
+}
+
+. "$testdir/../../../scripts/functions.sh"
if test $# -lt 2
then
- echo usage: $0 dc_exec year [options...]
- exit 1
+ usage "Not enough arguments; need 2"
fi
dc_exec="$1"
shift
+check_exec_arg "$dc_exec"
year="$1"
shift
diff --git a/contrib/bc/tests/error.sh b/contrib/bc/tests/error.sh
index 35a6af0edf3f..11d7a8126a27 100755
--- a/contrib/bc/tests/error.sh
+++ b/contrib/bc/tests/error.sh
@@ -34,25 +34,38 @@ testdir=$(dirname "$script")
outputdir=${BC_TEST_OUTPUT_DIR:-$testdir}
-# Command-line processing.
-if [ "$#" -lt 2 ]; then
-
+# Just print the usage and exit with an error. This can receive a message to
+# print.
+# @param 1 A message to print.
+usage() {
+ if [ $# -eq 1 ]; then
+ printf '%s\n\n' "$1"
+ fi
printf 'usage: %s dir test problematic_tests [exec args...]\n' "$script"
exit 1
+}
+# Command-line processing.
+if [ "$#" -lt 3 ]; then
+ usage "Not enough arguments"
else
d="$1"
shift
+ check_d_arg "$d"
t="$1"
shift
problematic="$1"
shift
+ check_bool_arg "$problematic"
fi
+testfile="$testdir/$d/errors/$t"
+check_file_arg "$testfile"
+
if [ "$#" -lt 1 ]; then
exe="$testdir/../bin/$d"
else
@@ -94,8 +107,6 @@ else
halt="q"
fi
-testfile="$testdir/$d/errors/$t"
-
printf 'Running %s error file %s with clamping...' "$d" "$t"
printf '%s\n' "$halt" | "$exe" "$@" $opts -c "$testfile" 2> "$out" > /dev/null
diff --git a/contrib/bc/tests/errors.sh b/contrib/bc/tests/errors.sh
index 5005f3e9aeb1..11d03299b418 100755
--- a/contrib/bc/tests/errors.sh
+++ b/contrib/bc/tests/errors.sh
@@ -36,20 +36,33 @@ testdir=$(dirname "$script")
outputdir=${BC_TEST_OUTPUT_DIR:-$testdir}
-# Command-line processing.
-if [ "$#" -eq 0 ]; then
+# Just print the usage and exit with an error. This can receive a message to
+# print.
+# @param 1 A message to print.
+usage() {
+ if [ $# -eq 1 ]; then
+ printf '%s\n\n' "$1"
+ fi
printf 'usage: %s dir [exec args...]\n' "$script"
exit 1
+}
+
+# Command-line processing.
+if [ "$#" -eq 0 ]; then
+ usage "Not enough arguments"
else
d="$1"
shift
+ check_d_arg "$d"
fi
if [ "$#" -lt 1 ]; then
exe="$testdir/../bin/$d"
+ check_exec_arg "$exe"
else
exe="$1"
shift
+ check_exec_arg "$exe"
fi
# I use these, so unset them to make the tests work.
diff --git a/contrib/bc/tests/history.py b/contrib/bc/tests/history.py
index b9acf73cb58d..ced05fe7219f 100755
--- a/contrib/bc/tests/history.py
+++ b/contrib/bc/tests/history.py
@@ -128,7 +128,7 @@ def write_str(child, s):
def bc_banner(child):
bc_banner1 = "bc [0-9]+\.[0-9]+\.[0-9]+\r\n"
bc_banner2 = "Copyright \(c\) 2018-[2-9][0-9][0-9][0-9] Gavin D. Howard and contributors\r\n"
- bc_banner3 = "Report bugs at: https://git.yzena.com/gavin/bc\r\n\r\n"
+ bc_banner3 = "Report bugs at: https://git.gavinhoward.com/gavin/bc\r\n\r\n"
bc_banner4 = "This is free software with ABSOLUTELY NO WARRANTY.\r\n\r\n"
expect(child, bc_banner1)
expect(child, bc_banner2)
diff --git a/contrib/bc/tests/history.sh b/contrib/bc/tests/history.sh
index ff4ffa562ca8..e68d568dcec1 100755
--- a/contrib/bc/tests/history.sh
+++ b/contrib/bc/tests/history.sh
@@ -33,7 +33,16 @@ testdir=$(dirname "$script")
. "$testdir/../scripts/functions.sh"
-# usage: history.sh dir -a|idx [exe args...]
+# Just print the usage and exit with an error. This can receive a message to
+# print.
+# @param 1 A message to print.
+usage() {
+ if [ $# -eq 1 ]; then
+ printf '%s\n\n' "$1"
+ fi
+ printf 'usage: %s dir -a|idx [exe args...]\n' "$script"
+ exit 1
+}
# If Python does not exist, then just skip.
py=$(command -v python3)
@@ -51,9 +60,14 @@ if [ "$err" -ne 0 ]; then
fi
fi
+if [ "$#" -lt 2 ]; then
+ usage "Not enough arguments; expect 2 arguments"
+fi
+
# d is "bc" or "dc"
d="$1"
shift
+check_d_arg "$d"
# idx is either an index of the test to run or "-a". If it is "-a", then all
# tests are run.
@@ -65,9 +79,11 @@ if [ "$#" -gt 0 ]; then
# exe is the executable to run.
exe="$1"
shift
+ check_exec_arg "$exe"
else
exe="$testdir/../bin/$d"
+ check_exec_arg "$exe"
fi
if [ "$d" = "bc" ]; then
diff --git a/contrib/bc/tests/other.sh b/contrib/bc/tests/other.sh
index fe228eec3317..4f491a64c770 100755
--- a/contrib/bc/tests/other.sh
+++ b/contrib/bc/tests/other.sh
@@ -36,24 +36,39 @@ testdir=$(dirname "$script")
outputdir=${BC_TEST_OUTPUT_DIR:-$testdir}
+# Just print the usage and exit with an error. This can receive a message to
+# print.
+# @param 1 A message to print.
+usage() {
+ if [ $# -eq 1 ]; then
+ printf '%s\n\n' "$1"
+ fi
+ printf 'usage: %s dir extra_math [exec args...]\n' "$script"
+ exit 1
+}
+
# Command-line processing.
if [ "$#" -ge 2 ]; then
d="$1"
shift
+ check_d_arg "$d"
extra_math="$1"
shift
+ check_bool_arg "$extra_math"
else
- err_exit "usage: $script dir extra_math [exec args...]" 1
+ usage "Not enough arguments; need 2"
fi
if [ "$#" -lt 1 ]; then
exe="$testdir/../bin/$d"
+ check_exec_arg "$exe"
else
exe="$1"
shift
+ check_exec_arg "$exe"
fi
if [ "$d" = "bc" ]; then
diff --git a/contrib/bc/tests/read.sh b/contrib/bc/tests/read.sh
index a5c66d9d4fec..d7be18fdcecb 100755
--- a/contrib/bc/tests/read.sh
+++ b/contrib/bc/tests/read.sh
@@ -36,24 +36,37 @@ testdir=$(dirname "$script")
outputdir=${BC_TEST_OUTPUT_DIR:-$testdir}
-# Command-line processing.
-if [ "$#" -lt 1 ]; then
- printf 'usage: %s dir [exe [args...]]\n' "$0"
+# Just print the usage and exit with an error. This can receive a message to
+# print.
+# @param 1 A message to print.
+usage() {
+ if [ $# -eq 1 ]; then
+ printf '%s\n\n' "$1"
+ fi
+ printf 'usage: %s dir [exe [args...]]\n' "$script"
printf 'valid dirs are:\n'
printf '\n'
cat "$testdir/all.txt"
printf '\n'
exit 1
+}
+
+# Command-line processing.
+if [ "$#" -lt 1 ]; then
+ usage "Not enough arguments"
fi
d="$1"
shift
+check_d_arg "$d"
if [ "$#" -gt 0 ]; then
exe="$1"
shift
+ check_exec_arg "$exe"
else
exe="$testdir/../bin/$d"
+ check_exec_arg "$exe"
fi
name="$testdir/$d/read.txt"
diff --git a/contrib/bc/tests/script.sh b/contrib/bc/tests/script.sh
index d720878fafa3..460940a21388 100755
--- a/contrib/bc/tests/script.sh
+++ b/contrib/bc/tests/script.sh
@@ -37,49 +37,72 @@ testdir=$(dirname "${script}")
outputdir=${BC_TEST_OUTPUT_DIR:-$testdir}
-# Command-line processing.
-if [ "$#" -lt 2 ]; then
+# Just print the usage and exit with an error. This can receive a message to
+# print.
+# @param 1 A message to print.
+usage() {
+ if [ $# -eq 1 ]; then
+ printf '%s\n\n' "$1"
+ fi
printf 'usage: %s dir script [run_extra_tests] [run_stack_tests] [generate_tests] [time_tests] [exec args...]\n' "$script"
exit 1
+}
+
+# Command-line processing.
+if [ "$#" -lt 2 ]; then
+ usage "Not enough arguments; expect 2 arguments"
fi
d="$1"
shift
+check_d_arg "$d"
+
+scriptdir="$testdir/$d/scripts"
f="$1"
shift
+check_file_arg "$scriptdir/$f"
if [ "$#" -gt 0 ]; then
run_extra_tests="$1"
shift
+ check_bool_arg "$run_extra_tests"
else
run_extra_tests=1
+ check_bool_arg "$run_extra_tests"
fi
if [ "$#" -gt 0 ]; then
run_stack_tests="$1"
shift
+ check_bool_arg "$run_stack_tests"
else
run_stack_tests=1
+ check_bool_arg "$run_stack_tests"
fi
if [ "$#" -gt 0 ]; then
generate="$1"
shift
+ check_bool_arg "$generate"
else
generate=1
+ check_bool_arg "$generate"
fi
if [ "$#" -gt 0 ]; then
time_tests="$1"
shift
+ check_bool_arg "$time_tests"
else
time_tests=0
+ check_bool_arg "$generate"
fi
if [ "$#" -gt 0 ]; then
exe="$1"
shift
+ check_exec_arg "$exe"
else
exe="$testdir/../bin/$d"
fi
@@ -100,8 +123,6 @@ else
halt="q"
fi
-scriptdir="$testdir/$d/scripts"
-
name="${f%.*}"
# We specifically want to skip this because it is handled specially.
diff --git a/contrib/bc/tests/scripts.sh b/contrib/bc/tests/scripts.sh
index ee21b2a9be6d..5c3b6fc3d02c 100755
--- a/contrib/bc/tests/scripts.sh
+++ b/contrib/bc/tests/scripts.sh
@@ -31,6 +31,17 @@ script="$0"
testdir=$(dirname "${script}")
+# Just print the usage and exit with an error. This can receive a message to
+# print.
+# @param 1 A message to print.
+usage() {
+ if [ $# -eq 1 ]; then
+ printf '%s\n\n' "$1"
+ fi
+ printf 'usage: %s [-n] dir [run_extra_tests] [run_stack_tests] [generate_tests] [time_tests] [exec args...]\n' "$script"
+ exit 1
+}
+
pids=""
# We need to figure out if we should run stuff in parallel.
@@ -47,46 +58,56 @@ done
# Command-line processing.
if [ "$#" -eq 0 ]; then
- printf 'usage: %s [-n] dir [run_extra_tests] [run_stack_tests] [generate_tests] [time_tests] [exec args...]\n' "$script"
- exit 1
+ usage "Need at least 1 argument"
else
d="$1"
shift
+ check_d_arg "$d"
fi
if [ "$#" -gt 0 ]; then
run_extra_tests="$1"
shift
+ check_bool_arg "$run_extra_tests"
else
run_extra_tests=1
+ check_bool_arg "$run_extra_tests"
fi
if [ "$#" -gt 0 ]; then
run_stack_tests="$1"
shift
+ check_bool_arg "$run_stack_tests"
else
run_stack_tests=1
+ check_bool_arg "$run_stack_tests"
fi
if [ "$#" -gt 0 ]; then
generate="$1"
shift
+ check_bool_arg "$generate"
else
generate=1
+ check_bool_arg "$generate"
fi
if [ "$#" -gt 0 ]; then
time_tests="$1"
shift
+ check_bool_arg "$time_tests"
else
time_tests=0
+ check_bool_arg "$time_tests"
fi
if [ "$#" -gt 0 ]; then
exe="$1"
shift
+ check_exec_arg "$exe"
else
exe="$testdir/../bin/$d"
+ check_exec_arg "$exe"
fi
scriptdir="$testdir/$d/scripts"
diff --git a/contrib/bc/tests/stdin.sh b/contrib/bc/tests/stdin.sh
index d8585052bf04..a650c5b996a6 100755
--- a/contrib/bc/tests/stdin.sh
+++ b/contrib/bc/tests/stdin.sh
@@ -37,24 +37,37 @@ testdir=$(dirname "$script")
outputdir=${BC_TEST_OUTPUT_DIR:-$testdir}
-# Command-line processing.
-if [ "$#" -lt 1 ]; then
+# Just print the usage and exit with an error. This can receive a message to
+# print.
+# @param 1 A message to print.
+usage() {
+ if [ $# -eq 1 ]; then
+ printf '%s\n\n' "$1"
+ fi
printf 'usage: %s dir [exe [args...]]\n' "$0"
printf 'valid dirs are:\n'
printf '\n'
cat "$testdir/all.txt"
printf '\n'
exit 1
+}
+
+# Command-line processing.
+if [ "$#" -lt 1 ]; then
+ usage "Not enough arguments"
fi
d="$1"
shift
+check_d_arg "$d"
if [ "$#" -gt 0 ]; then
exe="$1"
shift
+ check_exec_arg "$exe"
else
exe="$testdir/../bin/$d"
+ check_exec_arg "$exe"
fi
out="$outputdir/${d}_outputs/stdin_results.txt"
diff --git a/contrib/bc/tests/test.sh b/contrib/bc/tests/test.sh
index 95606ded4f9e..11c7e05f739a 100755
--- a/contrib/bc/tests/test.sh
+++ b/contrib/bc/tests/test.sh
@@ -37,19 +37,32 @@ testdir=$(dirname "$script")
outputdir=${BC_TEST_OUTPUT_DIR:-$testdir}
-# Command-line processing.
-if [ "$#" -lt 2 ]; then
+# Just print the usage and exit with an error. This can receive a message to
+# print.
+# @param 1 A message to print.
+usage() {
+ if [ $# -eq 1 ]; then
+ printf '%s\n\n' "$1"
+ fi
printf 'usage: %s dir test [generate_tests] [time_tests] [exe [args...]]\n' "$0"
printf 'valid dirs are:\n'
printf '\n'
cat "$testdir/all.txt"
printf '\n'
exit 1
+}
+
+# Command-line processing.
+if [ "$#" -lt 2 ]; then
+ usage "Need at least 2 arguments"
fi
d="$1"
shift
+check_d_arg "$d"
+# We don't use check_file_arg on the test or the result because they might be
+# generated.
t="$1"
name="$testdir/$d/$t.txt"
results="$testdir/$d/${t}_results.txt"
@@ -58,22 +71,28 @@ shift
if [ "$#" -gt 0 ]; then
generate_tests="$1"
shift
+ check_bool_arg "$generate_tests"
else
generate_tests=1
+ check_bool_arg "$generate_tests"
fi
if [ "$#" -gt 0 ]; then
time_tests="$1"
shift
+ check_bool_arg "$time_tests"
else
time_tests=0
+ check_bool_arg "$time_tests"
fi
if [ "$#" -gt 0 ]; then
exe="$1"
shift
+ check_exec_arg "$exe"
else
exe="$testdir/../bin/$d"
+ check_exec_arg "$exe"
fi
out="$outputdir/${d}_outputs/${t}_results.txt"