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
This commit is contained in:
Stefan Eßer 2023-02-06 22:33:56 +01:00
parent bbd354cb23
commit 4fca8e0f65
59 changed files with 471 additions and 117 deletions

View file

@ -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

View file

@ -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.

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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")

View file

@ -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

View file

@ -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.

View file

@ -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.

View file

@ -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.

View file

@ -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.

View file

@ -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.

View file

@ -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.

View file

@ -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.

View file

@ -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.

View file

@ -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.

View file

@ -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.

View file

@ -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.

View file

@ -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.

View file

@ -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.

View file

@ -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.

View file

@ -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.

View file

@ -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.

View file

@ -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.

View file

@ -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.

View file

@ -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.

View file

@ -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.

View file

@ -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.

View file

@ -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.

View file

@ -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.

View file

@ -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.

View file

@ -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.

View file

@ -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.

View file

@ -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.

View file

@ -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.

View file

@ -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.

View file

@ -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.

View file

@ -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.

View file

@ -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.

View file

@ -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.

View file

@ -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.

View file

@ -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.

View file

@ -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.

View file

@ -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

View file

@ -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

View file

@ -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="***********************************************************************"

View file

@ -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"

View file

@ -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

View file

@ -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

View file

@ -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.

View file

@ -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)

View file

@ -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

View file

@ -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

View file

@ -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"

View file

@ -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.

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -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