Commit Graph

73 Commits

Author SHA1 Message Date
Stefan Eßer
76238846ad contrib/bc: upgrade to version 6.6.0
This update removes printing of a leading zero in scientific or
engineering output modes (which are an extended feature of this
implementation).

(cherry-picked from commit 8b83ef067441f6d3a4a55e92d1738724954a057c)

MFC after:	2 weeks
2023-05-25 17:55:31 +02:00
Stefan Eßer
8c48f4c537 contrib/bc: import version 6.5.0
This release that fixes an infinite loop bug in the (non-standard)
extended math library functions root() and cbrt(), fixes a bug with
BC_LINE_LENGTH=0, and adds the fib() function to the extended math
library to calculate Fibonacci numbers.

(cherry picked from commit 438a1101dc1f687928cdbe02cd7817a88a24f42f)

MFC after:      3 days
2023-04-30 20:28:21 +02:00
Stefan Eßer
175a4d1042 contrib/bc: update to version 6.4.0
This version contains a fix for an issue that can affect complex
bc scripts that use multiple read() functions that receive input from
an interactive user. The same value could be returned multiple times.

MFC after:	2 weeks
2023-03-10 11:33:33 +01:00
Stefan Eßer
103d7cdfb7 vendor/bc: import version 6.3.1
This version adds a command to dc to query whether extended registers
are enabled or not.

(cherry picked from commit 61e1a12bb6c3bfdb0a4e499c88e8eaa2b548e427)
2023-02-24 23:52:09 +01:00
Stefan Eßer
4fca8e0f65 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
2023-02-06 22:33:56 +01:00
Stefan Eßer
d101cdd6ed contrib/bc: merge from vendor release 6.2.2
This update fixes a few issues in history editing and the processing
of the "quit" function. The "quit" function will no longer cause bc
to exit when encountered in a script file (before any command from
the script has been executed).

New functions is_number(), is_string return 1 if the passed argument
is a number resp. a string. The asciify() function has been extended
to support the conversion of an array of numbers into a string.

Merge commit '1a63323d17fedb05b6962853e821c9d7c6b9853e'
2023-01-28 22:26:22 +01:00
Stefan Eßer
f6ed05f123 vendor/bc: update to upstream commit ca53adf83b7a
The filter_text function in scripts/functions.sh in version 5.3.3 had
commented out a "rm" command, probably for debugging purposes. This
caused temporary files to persist in /tmp when the bc program had been
built.

This commit fixes the build process with no change of the resulting
artefacts.

(cherry picked from commit 1576f66712)

MFC after:	3 days
2022-06-22 15:56:01 +02:00
Stefan Eßer
f53b5fe786 contrib/bc: merge from vendor release 5.3.3
This update fixes a build issue of release 5.3.2 on the FreeBSD base
system.

Merge commit '3f739b0595b7d6ac4bac9aaa1cae0910f11f92e2'

MFC after:	2 weeks
2022-06-15 11:55:27 +02:00
Stefan Eßer
78bc019d22 usr.bin/bc: update to version 5.3.1
This version adds support for command line editing and history using
the libedit or readline libraries in addition to the line editing
features available in previous versions.

The version in the base system is configured to use libedit.

This allows to choose between emacs and vi line editing commands and
to use command overrides via a ~/.editrc file.

Merge commit 'bd54318046bfee055b140705a5cfd4148e78da07'

PR:		264010

MFC after:	2 weeks
2022-06-11 13:14:37 +02:00
Stefan Eßer
bbd60e2c94 contrib/bc: update to version 5.2.5
This is a production release that fixes this bc's behavior on ^D to
match GNU bc.

Merge commit 'ed0603704174b01c25b49efc08c82e1532dc5622'

MFC after:	3 days
2022-05-10 15:16:19 +02:00
Stefan Eßer
aaa77b3a36 contrib/bc: revert commit f4ff1c300e
This commit was executed by accident while testing the new version.
2022-05-10 15:11:49 +02:00
Stefan Eßer
f4ff1c300e vendor/bc: import of version 5.2.5
This is a production release that fixes this bc's behavior on ^D to
match GNU bc.

(cherry picked from commit ed06037041)
2022-05-10 14:50:29 +02:00
Stefan Eßer
b85b9c88eb contrib/bc: import version 5.2.4
This update fixes an issue in input line editing: when going left to
the start of the line, the cursor would jump to the end of the line
instead.

Merge commit 'bc75dcc4ce682562390fa32e7cd63c08160e21b9'
2022-04-17 13:30:22 +02:00
Stefan Eßer
b66d67d97a contrib/bc: include assert.h when building with C11 or newer
This chunk should have been committed with the MFV commit
23210c9f42 but was missing for an unknown reasn.

MFC after:	3 days
2022-03-09 18:57:30 +01:00
Stefan Eßer
23210c9f42 contrib/bc: update to version 5.2.3
This version fixes a parse error when passing a file to bc using -f
if that file has a multiline comment or string in it.

Merge commit '3673adf1ee311d6f83176d3e43cf0efb314764e4'

MFC after:	3 days
2022-03-07 23:26:09 +01:00
Stefan Eßer
00698711de vendor/bc: import release 5.2.2
This release assigns a default value to the internal program name
variable in case the program is invoked with argv[0] == NULL.

There was no security issue: the prevuous program version would have
been immediately terminated due to a NULL dereference.
2022-02-05 22:39:59 +01:00
Stefan Eßer
10041e99a0 contrib/bc: merge version 5.2.1 from vendor branch
Merge commit 'e63540eed295749528548c2e3a90f5a6e57275c8'
2021-11-30 18:40:32 +01:00
Stefan Eßer
a30efc5ca7 contrib/bc: update to version 5.1.1
Merge commit '6f49f5cdde1c62c4e5a743e895f3afe592b5c0e5'
2021-10-06 23:30:59 +02:00
Stefan Eßer
d43fa8ef53 contrib/bc: merge version 5.1.0 from vendor branch
This version adds options and functions that allow to print numbers
in the open interval (-1 .. 1) with or without a leading 0 digit.

Additionally, an option has been added to prevent line wrap and
allows to print arbitrarily long results on a single line.

Merge commit '5d58a51571721190681c50d4bd3a1f45e6282d72'
2021-10-04 22:25:24 +02:00
Stefan Eßer
d6c323eda2 Remove files that were checked in with wrong .gitattributes
These files will be added back in updated form, but are only relevant
for the Windows platform, anyway.
2021-10-04 22:10:32 +02:00
Stefan Eßer
ea31d1a5c4 contrib/bc: remove files ommitted from the release
A number of files have been removed from the release distribution of
this bc implementation. They were mostly relevant for pre release
testing and benchmarking to identify regressions. The Markdown
sources of the man pages are only relevant for combinations of build
options not used in FreeBSD and need non-default conversion tools
(available as ports in FreeBSD).

All the omitted files can be found in the upstream git repository,
and they are fetched when building this software as a port. But they
have never been used in the FreeBSD base system.
2021-10-04 09:41:06 +02:00
Stefan Eßer
662087dfd0 vendor/bc: update to upstream version 5.0.2
(cherry picked from commit a60ef1802a)
2021-10-04 09:37:19 +02:00
Stefan Eßer
44d4804d19 usr.bin/ghä-bc, contrib/bc: update to version 5.0.0
Merge commit 2f57ecae4b

This is a new major release with a number of changes and extensions:

- Limited the number of temporary numbers and made the space for them
  static so that allocating more space for them cannot fail.
- Allowed integers with non-zero scale to be used with power, places,
  and shift operators.
- Added greatest common divisor and least common multiple to lib2.bc.
- Made bc and dc UTF-8 capable.
- Added the ability for users to have bc and dc quit on SIGINT.
- Added the ability for users to disable prompt and TTY mode by
  environment variables.
- Added the ability for users to redefine keywords.
- Added dc's modular exponentiation and divmod to bc.
- Added the ability to assign strings to variables and array elements
  and pass them to functions in bc.
- Added dc's asciify command and stream printing to bc.
- Added bitwise and, or, xor, left shift, right shift, reverse,
  left rotate, right rotate, and mod functions to lib2.bc.
- Added the functions s2u(x) and s2un(x,n), to lib2.bc.

MFC after:	1 week
2021-08-13 11:28:06 +02:00
Stefan Eßer
8c39e25220 contrib/bc: update to version 4.0.2
Merge commit '2858419a0ee2b8f5827de72c00618bcd69ebc5fc'

This update fixes the initialization of "scale" to 20 if started with
-l and the initial statement leads to an error (e.g. contains a syntax
error). Scale was initialized to 0 in that case.

Another change is the support of job control in interactive mode with
line editing enabled. The control characters have been interpreted as
editing commands only, prior to this version.

MFC after:	3 days
2021-05-12 07:50:59 +02:00
Stefan Eßer
e681dd3e2c Revert "Vendor import of Gavin D. Howard's bc version 4.0.2"
The update had been performed on a check-out of the vendor branch,
but the final push lacked the target designation vendor/bc.
2021-05-12 07:22:37 +02:00
Stefan Eßer
e5092308d9 Vendor import of Gavin D. Howard's bc version 4.0.2 2021-05-12 07:17:15 +02:00
Michael Gmelin
a0358e3d51 Synch index of contrib/bc with what is in workdir after cloning.
From a workdir perspective this should be a no-op.
See also:
https://lists.freebsd.org/pipermail/freebsd-current/2021-April/079569.html
2021-04-29 14:33:56 +02:00
Stefan Eßer
8ea9013512 Merge commit 'bd136720030ebb0b31e6d5a2236b9d0ddac71b94'
usr.bin/bc: update to version 4.0.1

This update adds a flush() of the output buffer to the bc print command.
2021-04-25 08:42:31 +02:00
Stefan Eßer
7e5c51e523 Merge commit '7a590c074ceede12b2b6e794f8703d6fa5749918'
Update to version 4.0.0

This version fixes an issue (missing pop of top-of-stack value in the
"P" command of the dc program).

This issue did not affect the bc program, since it does not use dc as
an back-end to actually perform the calculations as was the case with
the traditional bc and dc programs.

The major number has been bumped due to Windows support that has been
added to this version. It does not correspond to a major change that
might affect FreeBSD.
2021-04-06 10:48:09 +02:00
Stefan Eßer
9300e88039 bc: upgrade to version 3.3.4
This upgrade performs an implicit flush of the output if the script
funcion read() is called, to make sure a prompt that does not end in a
new-line is correctly displayed in line-buffered output mode.

Merge commit '893ecb52db5ed47d6c1e8698334d34e0df651612'
2021-03-19 09:46:12 +01:00
Stefan Eßer
028616d0dd bc: Vendor import new version 3.3.3 2021-03-05 12:33:01 +01:00
Stefan Eßer
9a995fe186 Upgrade to version 3.3.0
This update changes the behavior of "-e" or "-f" in BC_ENV_ARGS:

Use of these options on the command line makes bc exit after executing
the given commands. These options will not cause bc to exit when
passed via the environment (but EOF in STDIN or -e or -f on the
command line will make bc exit as before).

The same applies to DC_ENV_ARGS with regard to the dc program.
2021-02-17 23:02:01 +01:00
Stefan Eßer
10328f8b11 Merge commit '47a52dc4d48f259ab7d9f9ba6b65f4f2331a22dc'
Update to version 3.2.6

MFC after:	3 days
2021-01-31 21:07:42 +01:00
Stefan Eßer
e458944cf9 Import bc 3.2.4 2020-12-27 22:32:22 +01:00
Stefan Eßer
c6bfc8968d Upgrade to version 3.2.3 2020-12-06 11:49:21 +00:00
Stefan Eßer
50696a6e8c Update to version 3.2.0 2020-11-26 17:39:51 +00:00
Stefan Eßer
d213476d1c Upgrade to version 3.1.6
This upgrade addresses one (benign) compiler warning when building with
LLVM-12.
2020-10-01 15:45:07 +00:00
Stefan Eßer
119656bc26 Upgrade to version 3.1.5
This version fixes some entries in the chinese message catalogs which could
lead to program crashes when used.
2020-08-05 15:20:07 +00:00
Stefan Eßer
5d934bc0c5 Upgrade to version 3.1.4
This version omits the printing	of a copyright header in interactive mode
and the dc command now exits after	execution of	the commands passed via	-e
or -f instead of switching to interactive mode.	To pass	further	commands
via STDIN when dc has been invoked with	-e or -f, add "-f -" to	the
parameter list.
2020-08-03 19:20:26 +00:00
Adrian Chadd
14679cb2f3 [bc] Fix a "maybe uninitialized" compiler warning under mips-gcc-6.3.0.
I guess this didn't like the case statements.. ? But this does quieten
the compiler error.
2020-07-14 05:02:18 +00:00
Stefan Eßer
cf7becd216 Update to version 3.1.3
This version fixes the following evaluation, which lead to a parse error:

     echo "if (1 < 3) 1" | bc
2020-07-11 07:33:18 +00:00
Stefan Eßer
3aa99676b4 Update to version 3.1.1
This version fixes a regression with regard to tradtional behavior of the
non-standard FreeBSD option "-e". In the previous version "-e quit" caused
bc to exit before any computations had been performed, since all -e option
parameters were concatenated and parsed as a whole, with quit causing the
program to exit as soon as it was parsed. This version parses and executes
commands passed with -e one by one and only exits after all prior commands
have been executed.

This commit is not a SVN merge, since the vendor import had been performed
after the import to contrib. Instead the contents of contrib/bc has been
removed and the new version is copied over unchanged from vendor/bc/dist.
2020-07-07 07:51:09 +00:00
Stefan Eßer
252884ae7e Import new 2-clause BSD licenced implementation of the bc and dc commands
These implementations of the bc and dc programs offer a number of advantages
compared to the current implementations in the FreeBSD base system:

- They do not depend on external large number functions (i.e. no dependency
  on OpenSSL or any other large number library)

- They implements all features found in GNU bc/dc (with the exception of
  the forking of sub-processes, which the author of this version considers
  as a security issue).

- They are significantly faster than the current code in base (more than
  2 orders of magnitude in some of my tests, e.g. for 12345^100000).

- They should be fully compatible with all features and the behavior of the
  current implementations in FreeBSD (not formally verified).

- They support POSIX message catalogs and come with localized messages in
  Chinese, Dutch, English, French, German, Japanese, Polish, Portugueze,
  and Russian.

- They offer very detailed man-pages that provide far more information than
  the current ones.

The upstream sources contain a large number of tests, which are not
imported with this commit. They could be integrated into our test
framework at a latter time.

Installation of this version is controlled by the option "MK_GH_BC=yes".
This option will be set to yes by default in 13-CURRENT, but will be off
by default in 12-STABLE.

Approved by:	imp
Obtained from:	https://git.yzena.com/gavin/bc
MFC after:	4 weeks
Relnotes:	yes
Differential Revision:	https://reviews.freebsd.org/D19982
2020-06-27 12:02:01 +00:00
Gabor Kovesdan
5e72825fcd - Remove GNU bc/dc bits. There has not been any regressions seen after
BSD bc/dc import. It has been tested with make universe that this code
  is not used by anything any more.

Approved by:	delphij (mentor)
2010-02-21 14:28:03 +00:00
Brooks Davis
c283464ab7 s/predefine/predefined/
PR:		gnu/86627
Submitted by:	Arne Woerner <arne_woerner at yahoo dot com>
MFC After:	6 days
2006-01-24 06:38:35 +00:00
Brooks Davis
92b4183c54 s/routnes/routines/ in help message.
This file is already off the vendor branch and there hasn't been a bc
release in more than 4 years so I can't see any harm in fixing this.

Submitted by:	Arne Woerner <arne_woerner at yahoo dot com>
PR:		gnu/86627
2005-09-27 18:52:17 +00:00
Andrey A. Chernov
e7c820ec07 Remove files no longer needed 2004-02-17 01:04:18 +00:00
Andrey A. Chernov
0bd7aa5188 getopt_long() returned 0 (i.e. long options) case not handled, add it
(symptom: "bc --quiet" not works while "bc -q" works)
2004-02-17 00:53:50 +00:00
Sheldon Hearn
f93e740631 This commit was generated by cvs2svn to compensate for changes in r90238,
which included commits to RCS files with non-trunk default branches.
2002-02-05 09:17:24 +00:00
Sheldon Hearn
5fa4faea8e Fix obscure bug in code loading support that could cause parsing of
functions in multi-line files to fail, depending on the state of the
stack.  The fix is sanctioned by the vendor and will appear in bc-1.07.

PR:		bin/34601
Reported by:	mi
Obtained from:	Phil Nelson <phil@cs.wwu.edu>
2002-02-05 09:17:24 +00:00