1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-26 11:47:31 +00:00

vendor/bc: upgrade to version 7.0.2

This update fixes exiting from an interactive bc session with ^D on
FreeBSD and Linux when using editline.

This bug was caused by the macOS fix for editline in version 7.0.0,
which has been reverted in this version.

(cherry picked from commit c2c85f8890)

MFC after:	3 days
Reported by:	mack@macktronics.com
This commit is contained in:
Stefan Eßer 2024-09-18 07:55:46 +02:00
parent 3e614fb600
commit 9b04aee86c
16 changed files with 69 additions and 26 deletions

View File

@ -1,5 +1,13 @@
# News
## 7.0.2
This is a production release that fixes `Ctrl+d` on FreeBSD and Linux when using
`editline`.
This bug was caused by the macOS fix in `7.0.0`. Unfortunately, this means that
macOS does not respond properly to `Ctrl+d`.
## 7.0.1
This is a production release that fixes a warning using GCC on FreeBSD.

View File

@ -120,6 +120,30 @@ typedef struct BcHistory
extern const char bc_history_editrc[];
extern const size_t bc_history_editrc_len;
#ifdef __APPLE__
/**
* Returns true if the line is a valid line, false otherwise.
* @param line The line.
* @param len The length of the line.
* @return True if the line is valid, false otherwise.
*/
#define BC_HISTORY_INVALID_LINE(line, len) \
((line) == NULL && ((len) == -1 || errno == EINTR))
#else // __APPLE__
/**
* Returns true if the line is a valid line, false otherwise.
* @param line The line.
* @param len The length of the line.
* @return True if the line is valid, false otherwise.
*/
#define BC_HISTORY_INVALID_LINE(line, len) \
((line) == NULL && (len) == -1 && errno == EINTR)
#endif // __APPLE__
#else // BC_ENABLE_EDITLINE
#if BC_ENABLE_READLINE

View File

@ -37,6 +37,6 @@
#define BC_VERSION_H
/// The current version.
#define VERSION 7.0.1
#define VERSION 7.0.2
#endif // BC_VERSION_H

View File

@ -25,7 +25,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
.TH "BC" "1" "January 2024" "Gavin D. Howard" "General Commands Manual"
.TH "BC" "1" "August 2024" "Gavin D. Howard" "General Commands Manual"
.nh
.ad l
.SH NAME
@ -1731,7 +1731,7 @@ Functions\f[R] subsection below).
.RE
.TP
\f[B]frand(p)\f[R]
Generates a pseudo\-random integer between \f[B]0\f[R] (inclusive) and
Generates a pseudo\-random number between \f[B]0\f[R] (inclusive) and
\f[B]1\f[R] (exclusive) with the number of decimal digits after the
decimal point equal to the truncated absolute value of \f[B]p\f[R].
If \f[B]p\f[R] is not \f[B]0\f[R], then calling this function will
@ -1740,7 +1740,7 @@ If \f[B]p\f[R] is \f[B]0\f[R], then \f[B]0\f[R] is returned, and
\f[B]seed\f[R] is \f[I]not\f[R] changed.
.TP
\f[B]ifrand(i, p)\f[R]
Generates a pseudo\-random integer that is between \f[B]0\f[R]
Generates a pseudo\-random number that is between \f[B]0\f[R]
(inclusive) and the truncated absolute value of \f[B]i\f[R] (exclusive)
with the number of decimal digits after the decimal point equal to the
truncated absolute value of \f[B]p\f[R].

View File

@ -1433,7 +1433,7 @@ The extended library is a **non-portable extension**.
**frand(p)**
: Generates a pseudo-random integer between **0** (inclusive) and **1**
: Generates a pseudo-random number between **0** (inclusive) and **1**
(exclusive) with the number of decimal digits after the decimal point equal
to the truncated absolute value of **p**. If **p** is not **0**, then
calling this function will change the value of **seed**. If **p** is **0**,
@ -1441,7 +1441,7 @@ The extended library is a **non-portable extension**.
**ifrand(i, p)**
: Generates a pseudo-random integer that is between **0** (inclusive) and the
: Generates a pseudo-random number that is between **0** (inclusive) and the
truncated absolute value of **i** (exclusive) with the number of decimal
digits after the decimal point equal to the truncated absolute value of
**p**. If the absolute value of **i** is greater than or equal to **2**, and

View File

@ -25,7 +25,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
.TH "BC" "1" "January 2024" "Gavin D. Howard" "General Commands Manual"
.TH "BC" "1" "August 2024" "Gavin D. Howard" "General Commands Manual"
.nh
.ad l
.SH NAME

View File

@ -25,7 +25,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
.TH "BC" "1" "January 2024" "Gavin D. Howard" "General Commands Manual"
.TH "BC" "1" "August 2024" "Gavin D. Howard" "General Commands Manual"
.nh
.ad l
.SH NAME

View File

@ -25,7 +25,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
.TH "BC" "1" "January 2024" "Gavin D. Howard" "General Commands Manual"
.TH "BC" "1" "August 2024" "Gavin D. Howard" "General Commands Manual"
.nh
.ad l
.SH NAME

View File

@ -25,7 +25,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
.TH "BC" "1" "January 2024" "Gavin D. Howard" "General Commands Manual"
.TH "BC" "1" "August 2024" "Gavin D. Howard" "General Commands Manual"
.nh
.ad l
.SH NAME

View File

@ -25,7 +25,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
.TH "BC" "1" "January 2024" "Gavin D. Howard" "General Commands Manual"
.TH "BC" "1" "August 2024" "Gavin D. Howard" "General Commands Manual"
.nh
.ad l
.SH NAME
@ -1731,7 +1731,7 @@ Functions\f[R] subsection below).
.RE
.TP
\f[B]frand(p)\f[R]
Generates a pseudo\-random integer between \f[B]0\f[R] (inclusive) and
Generates a pseudo\-random number between \f[B]0\f[R] (inclusive) and
\f[B]1\f[R] (exclusive) with the number of decimal digits after the
decimal point equal to the truncated absolute value of \f[B]p\f[R].
If \f[B]p\f[R] is not \f[B]0\f[R], then calling this function will
@ -1740,7 +1740,7 @@ If \f[B]p\f[R] is \f[B]0\f[R], then \f[B]0\f[R] is returned, and
\f[B]seed\f[R] is \f[I]not\f[R] changed.
.TP
\f[B]ifrand(i, p)\f[R]
Generates a pseudo\-random integer that is between \f[B]0\f[R]
Generates a pseudo\-random number that is between \f[B]0\f[R]
(inclusive) and the truncated absolute value of \f[B]i\f[R] (exclusive)
with the number of decimal digits after the decimal point equal to the
truncated absolute value of \f[B]p\f[R].

View File

@ -1433,7 +1433,7 @@ The extended library is a **non-portable extension**.
**frand(p)**
: Generates a pseudo-random integer between **0** (inclusive) and **1**
: Generates a pseudo-random number between **0** (inclusive) and **1**
(exclusive) with the number of decimal digits after the decimal point equal
to the truncated absolute value of **p**. If **p** is not **0**, then
calling this function will change the value of **seed**. If **p** is **0**,
@ -1441,7 +1441,7 @@ The extended library is a **non-portable extension**.
**ifrand(i, p)**
: Generates a pseudo-random integer that is between **0** (inclusive) and the
: Generates a pseudo-random number that is between **0** (inclusive) and the
truncated absolute value of **i** (exclusive) with the number of decimal
digits after the decimal point equal to the truncated absolute value of
**p**. If the absolute value of **i** is greater than or equal to **2**, and

View File

@ -25,7 +25,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
.TH "BC" "1" "January 2024" "Gavin D. Howard" "General Commands Manual"
.TH "BC" "1" "August 2024" "Gavin D. Howard" "General Commands Manual"
.nh
.ad l
.SH NAME
@ -1731,7 +1731,7 @@ Functions\f[R] subsection below).
.RE
.TP
\f[B]frand(p)\f[R]
Generates a pseudo\-random integer between \f[B]0\f[R] (inclusive) and
Generates a pseudo\-random number between \f[B]0\f[R] (inclusive) and
\f[B]1\f[R] (exclusive) with the number of decimal digits after the
decimal point equal to the truncated absolute value of \f[B]p\f[R].
If \f[B]p\f[R] is not \f[B]0\f[R], then calling this function will
@ -1740,7 +1740,7 @@ If \f[B]p\f[R] is \f[B]0\f[R], then \f[B]0\f[R] is returned, and
\f[B]seed\f[R] is \f[I]not\f[R] changed.
.TP
\f[B]ifrand(i, p)\f[R]
Generates a pseudo\-random integer that is between \f[B]0\f[R]
Generates a pseudo\-random number that is between \f[B]0\f[R]
(inclusive) and the truncated absolute value of \f[B]i\f[R] (exclusive)
with the number of decimal digits after the decimal point equal to the
truncated absolute value of \f[B]p\f[R].

View File

@ -1433,7 +1433,7 @@ The extended library is a **non-portable extension**.
**frand(p)**
: Generates a pseudo-random integer between **0** (inclusive) and **1**
: Generates a pseudo-random number between **0** (inclusive) and **1**
(exclusive) with the number of decimal digits after the decimal point equal
to the truncated absolute value of **p**. If **p** is not **0**, then
calling this function will change the value of **seed**. If **p** is **0**,
@ -1441,7 +1441,7 @@ The extended library is a **non-portable extension**.
**ifrand(i, p)**
: Generates a pseudo-random integer that is between **0** (inclusive) and the
: Generates a pseudo-random number that is between **0** (inclusive) and the
truncated absolute value of **i** (exclusive) with the number of decimal
digits after the decimal point equal to the truncated absolute value of
**p**. If the absolute value of **i** is greater than or equal to **2**, and

View File

@ -25,7 +25,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
.TH "BC" "1" "January 2024" "Gavin D. Howard" "General Commands Manual"
.TH "BC" "1" "August 2024" "Gavin D. Howard" "General Commands Manual"
.nh
.ad l
.SH NAME
@ -1731,7 +1731,7 @@ Functions\f[R] subsection below).
.RE
.TP
\f[B]frand(p)\f[R]
Generates a pseudo\-random integer between \f[B]0\f[R] (inclusive) and
Generates a pseudo\-random number between \f[B]0\f[R] (inclusive) and
\f[B]1\f[R] (exclusive) with the number of decimal digits after the
decimal point equal to the truncated absolute value of \f[B]p\f[R].
If \f[B]p\f[R] is not \f[B]0\f[R], then calling this function will
@ -1740,7 +1740,7 @@ If \f[B]p\f[R] is \f[B]0\f[R], then \f[B]0\f[R] is returned, and
\f[B]seed\f[R] is \f[I]not\f[R] changed.
.TP
\f[B]ifrand(i, p)\f[R]
Generates a pseudo\-random integer that is between \f[B]0\f[R]
Generates a pseudo\-random number that is between \f[B]0\f[R]
(inclusive) and the truncated absolute value of \f[B]i\f[R] (exclusive)
with the number of decimal digits after the decimal point equal to the
truncated absolute value of \f[B]p\f[R].

View File

@ -1433,7 +1433,7 @@ The extended library is a **non-portable extension**.
**frand(p)**
: Generates a pseudo-random integer between **0** (inclusive) and **1**
: Generates a pseudo-random number between **0** (inclusive) and **1**
(exclusive) with the number of decimal digits after the decimal point equal
to the truncated absolute value of **p**. If **p** is not **0**, then
calling this function will change the value of **seed**. If **p** is **0**,
@ -1441,7 +1441,7 @@ The extended library is a **non-portable extension**.
**ifrand(i, p)**
: Generates a pseudo-random integer that is between **0** (inclusive) and the
: Generates a pseudo-random number that is between **0** (inclusive) and the
truncated absolute value of **i** (exclusive) with the number of decimal
digits after the decimal point equal to the truncated absolute value of
**p**. If the absolute value of **i** is greater than or equal to **2**, and

View File

@ -264,7 +264,18 @@ bc_history_line(BcHistory* h, BcVec* vec, const char* prompt)
errno = EINTR;
// Get the line.
while (line == NULL && (len == -1 || errno == EINTR))
//
// XXX: Why have a macro here? Because macOS needs to be special. Honestly,
// it's starting to feel special like Windows at this point. Anyway, the
// second SIGWINCH signal of multiple will return a valid line length on
// macOS, so we need to allow for that on macOS. However, FreeBSD's editline
// is different and will mess up the terminal if we do it that way.
//
// There is one limitation with this, however: Ctrl+D won't work on macOS.
// But it's because of macOS that this problem exists, and I can't really do
// anything about it. So macOS should fix their broken editline; once they
// do, I'll fix Ctrl+D on macOS.
while (BC_HISTORY_INVALID_LINE(line, len))
{
line = el_gets(h->el, &len);
bc_history_use_prompt = false;