In the case of an end-of-file or other file error condition, the & and ~ both act like r.
However, when it comes to the & (Input Decimal) command, FBBI goes into an infinite loop in the case of an end-of-file.
The problem is the loop at the start of the fi_idec function which tries to skip over any non-digits in the input stream. On end-of-file, a digit is never encountered so the loop never ends.
That loop is also responsible for FBBI failing to read negative numbers correctly, because the sign of the number is dropped before it gets to the scanf call.
According to the specification:
However, when it comes to the
&
(Input Decimal) command, FBBI goes into an infinite loop in the case of an end-of-file.The problem is the loop at the start of the
fi_idec
function which tries to skip over any non-digits in the input stream. On end-of-file, a digit is never encountered so the loop never ends.That loop is also responsible for FBBI failing to read negative numbers correctly, because the sign of the number is dropped before it gets to the
scanf
call.