diff --git a/contrib/bc/LICENSE.md b/contrib/bc/LICENSE.md index 8e6b7e0b905..b65095edc26 100644 --- a/contrib/bc/LICENSE.md +++ b/contrib/bc/LICENSE.md @@ -1,6 +1,6 @@ # License -Copyright (c) 2018-2023 Gavin D. Howard +Copyright (c) 2018-2023 Gavin D. Howard 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
Copyright (c) 2010-2013, Pieter Noordhuis
Copyright (c) 2018 rain-1
-Copyright (c) 2018-2023, Gavin D. Howard +Copyright (c) 2018-2023, Gavin D. Howard 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 +Copyright (c) 2018-2023 Gavin D. Howard 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 36952fdaf58..4601db456f8 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 . + +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 438cab0d169..9d395f74718 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 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 f78ba9e71dd..c51ba186db1 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 8b313f8d9e0..7d9e7ec28d2 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 5ef66fb2d8c..a65e221ad0b 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 e1b72de90ee..6d8ddfea094 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 629cc32c4c6..b1996a1f282 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 and contributors. +Howard and contributors. diff --git a/contrib/bc/manuals/bc/A.1.md b/contrib/bc/manuals/bc/A.1.md index 40cfa5fcdad..e7b4c821219 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 and contributors. +Gavin D. Howard and contributors. diff --git a/contrib/bc/manuals/bc/E.1 b/contrib/bc/manuals/bc/E.1 index 89f95ef81cf..fea1cecdc4c 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 and contributors. +Howard and contributors. diff --git a/contrib/bc/manuals/bc/E.1.md b/contrib/bc/manuals/bc/E.1.md index 30451dabd64..3631267f2dc 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 and contributors. +Gavin D. Howard and contributors. diff --git a/contrib/bc/manuals/bc/EH.1 b/contrib/bc/manuals/bc/EH.1 index e006a5c41c8..2a36cab7f77 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 and contributors. +Howard and contributors. diff --git a/contrib/bc/manuals/bc/EH.1.md b/contrib/bc/manuals/bc/EH.1.md index 28f874c36eb..f2f49ea7694 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 and contributors. +Gavin D. Howard and contributors. diff --git a/contrib/bc/manuals/bc/EHN.1 b/contrib/bc/manuals/bc/EHN.1 index e7714871025..75768a03c14 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 and contributors. +Howard and contributors. diff --git a/contrib/bc/manuals/bc/EHN.1.md b/contrib/bc/manuals/bc/EHN.1.md index 09288c577a5..a38503cc8a2 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 and contributors. +Gavin D. Howard and contributors. diff --git a/contrib/bc/manuals/bc/EN.1 b/contrib/bc/manuals/bc/EN.1 index 99ecfd2056e..9c015858319 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 and contributors. +Howard and contributors. diff --git a/contrib/bc/manuals/bc/EN.1.md b/contrib/bc/manuals/bc/EN.1.md index 52bacfa5df6..28b558d8b21 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 and contributors. +Gavin D. Howard and contributors. diff --git a/contrib/bc/manuals/bc/H.1 b/contrib/bc/manuals/bc/H.1 index 856d2c604de..cbd93da0df8 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 and contributors. +Howard and contributors. diff --git a/contrib/bc/manuals/bc/H.1.md b/contrib/bc/manuals/bc/H.1.md index 4a1278dbec8..ac35def9019 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 and contributors. +Gavin D. Howard and contributors. diff --git a/contrib/bc/manuals/bc/HN.1 b/contrib/bc/manuals/bc/HN.1 index 5356950aa68..5893d2a7f9a 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 and contributors. +Howard and contributors. diff --git a/contrib/bc/manuals/bc/HN.1.md b/contrib/bc/manuals/bc/HN.1.md index 8dd0674512a..82a99addd34 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 and contributors. +Gavin D. Howard and contributors. diff --git a/contrib/bc/manuals/bc/N.1 b/contrib/bc/manuals/bc/N.1 index 517e403aa6c..791f4740700 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 and contributors. +Howard and contributors. diff --git a/contrib/bc/manuals/bc/N.1.md b/contrib/bc/manuals/bc/N.1.md index 2c85180f670..b8339ea31a5 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 and contributors. +Gavin D. Howard and contributors. diff --git a/contrib/bc/manuals/bcl.3 b/contrib/bc/manuals/bcl.3 index e066103d02f..6bebaa8f02c 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 and contributors. +Howard and contributors. diff --git a/contrib/bc/manuals/bcl.3.md b/contrib/bc/manuals/bcl.3.md index e2d92866ddb..6c6967b4477 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 and contributors. +Gavin D. Howard and contributors. diff --git a/contrib/bc/manuals/build.md b/contrib/bc/manuals/build.md index 5cec45f596b..d9c46ae2260 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 and GitHub. +from 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 6500bf9129e..13ed8c4cf80 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 and contributors. +Howard and contributors. diff --git a/contrib/bc/manuals/dc/A.1.md b/contrib/bc/manuals/dc/A.1.md index 4c40e38dcee..b656650cb82 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 and contributors. +Gavin D. Howard and contributors. diff --git a/contrib/bc/manuals/dc/E.1 b/contrib/bc/manuals/dc/E.1 index 7f2477f1077..3fb69dfe70d 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 and contributors. +Howard and contributors. diff --git a/contrib/bc/manuals/dc/E.1.md b/contrib/bc/manuals/dc/E.1.md index 437fc645937..0bbe9761288 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 and contributors. +Gavin D. Howard and contributors. diff --git a/contrib/bc/manuals/dc/EH.1 b/contrib/bc/manuals/dc/EH.1 index ba4e6750702..da7776edd53 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 and contributors. +Howard and contributors. diff --git a/contrib/bc/manuals/dc/EH.1.md b/contrib/bc/manuals/dc/EH.1.md index 6d1dd78985b..0751d3f78d2 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 and contributors. +Gavin D. Howard and contributors. diff --git a/contrib/bc/manuals/dc/EHN.1 b/contrib/bc/manuals/dc/EHN.1 index 5f454d01cc2..10ef283ea05 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 and contributors. +Howard and contributors. diff --git a/contrib/bc/manuals/dc/EHN.1.md b/contrib/bc/manuals/dc/EHN.1.md index e3786886a03..9ba7fe13e0a 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 and contributors. +Gavin D. Howard and contributors. diff --git a/contrib/bc/manuals/dc/EN.1 b/contrib/bc/manuals/dc/EN.1 index 6f08fc8d3c0..abdcbe8c63f 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 and contributors. +Howard and contributors. diff --git a/contrib/bc/manuals/dc/EN.1.md b/contrib/bc/manuals/dc/EN.1.md index b97e121e222..5c0590c53ae 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 and contributors. +Gavin D. Howard and contributors. diff --git a/contrib/bc/manuals/dc/H.1 b/contrib/bc/manuals/dc/H.1 index cc2f156205e..c96100e51bc 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 and contributors. +Howard and contributors. diff --git a/contrib/bc/manuals/dc/H.1.md b/contrib/bc/manuals/dc/H.1.md index b8ad29b28a8..0dddf66d700 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 and contributors. +Gavin D. Howard and contributors. diff --git a/contrib/bc/manuals/dc/HN.1 b/contrib/bc/manuals/dc/HN.1 index 8d16b10a23d..a6644ecd575 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 and contributors. +Howard and contributors. diff --git a/contrib/bc/manuals/dc/HN.1.md b/contrib/bc/manuals/dc/HN.1.md index d658409b836..d39a7497d3a 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 and contributors. +Gavin D. Howard and contributors. diff --git a/contrib/bc/manuals/dc/N.1 b/contrib/bc/manuals/dc/N.1 index 54fbadeed09..f9aeb1acfb6 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 and contributors. +Howard and contributors. diff --git a/contrib/bc/manuals/dc/N.1.md b/contrib/bc/manuals/dc/N.1.md index 35573c49da9..3c36661d390 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 and contributors. +Gavin D. Howard and contributors. diff --git a/contrib/bc/scripts/functions.sh b/contrib/bc/scripts/functions.sh index 98cb5cf7aae..8ae765859e5 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 a2d9ccda7ad..75534a735cd 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 1694bb68471..284d3de7b64 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 0ef8ae6cb49..099804777c1 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 3751700077f..fbd2909e099 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 27dfe34580e..1f8e7aa797f 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 35a6af0edf3..11d7a8126a2 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 5005f3e9aeb..11d03299b41 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 b9acf73cb58..ced05fe7219 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 ff4ffa562ca..e68d568dcec 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 fe228eec331..4f491a64c77 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 a5c66d9d4fe..d7be18fdcec 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 d720878fafa..460940a2138 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 ee21b2a9be6..5c3b6fc3d02 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 d8585052bf0..a650c5b996a 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 95606ded4f9..11c7e05f739 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" diff --git a/usr.bin/gh-bc/Makefile b/usr.bin/gh-bc/Makefile index a3e3bfd5aab..68725d420b2 100644 --- a/usr.bin/gh-bc/Makefile +++ b/usr.bin/gh-bc/Makefile @@ -120,10 +120,10 @@ lib2.c: lib2.bc Makefile cd ${BCDIR} && sh gen/strgen.sh gen/lib2.bc ${.OBJDIR}/lib2.c 0 bc_lib2 bc_lib2_name 1 1 bc_help.c: bc_help.txt Makefile - cd ${BCDIR} && sh gen/strgen.sh gen/bc_help.txt ${.OBJDIR}/bc_help.c 0 bc_help + cd ${BCDIR} && sh gen/strgen.sh gen/bc_help.txt ${.OBJDIR}/bc_help.c 0 bc_help "" 1 0 dc_help.c: dc_help.txt Makefile - cd ${BCDIR} && sh gen/strgen.sh gen/dc_help.txt ${.OBJDIR}/dc_help.c 0 dc_help + cd ${BCDIR} && sh gen/strgen.sh gen/dc_help.txt ${.OBJDIR}/dc_help.c 0 dc_help "" 1 0 bc.1: ${CP} ${BCDIR}/manuals/${MAN_SRC_BC} ${.OBJDIR}/bc.1