Commit 3960d892 authored by Stefan Eßer's avatar Stefan Eßer
Browse files

Update to release 3.1.1

This release fixes a regression from traditional bc behavior in FreeBSD
with regard to "-e quit" being passed on the command line and add Spanish
message catalogs.
parent 1f958cfa
......@@ -17,6 +17,12 @@ bc.old
.math.txt
.results.txt
.ops.txt
manuals/bc.1
manuals/bc.1.ronn
manuals/bc.1.md
manuals/dc.1
manuals/dc.1.ronn
manuals/dc.1.md
gen/strgen
lib.c
lib2.c
......
......@@ -2,8 +2,6 @@
Copyright (c) 2018-2020 Gavin D. Howard <yzena.tech@gmail.com>
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
......@@ -35,8 +33,6 @@ Copyright (c) 2010-2013, Pieter Noordhuis <pcnoordhuis at gmail dot com><br>
Copyright (c) 2018 rain-1 <rain1@openmailbox.org><br>
Copyright (c) 2018-2020, Gavin D. Howard <yzena.tech@gmail.com>
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
......
#
# Copyright (c) 2018-2020 Gavin D. Howard and contributors.
# SPDX-License-Identifier: BSD-2-Clause
#
# All rights reserved.
# Copyright (c) 2018-2020 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:
......@@ -29,7 +29,7 @@
#
.POSIX:
VERSION = 3.0.2
VERSION = 3.1.1
SRC = %%SRC%%
OBJ = %%OBJ%%
......@@ -105,10 +105,10 @@ DC_EXEC = $(BIN)/$(EXEC_PREFIX)$(DC)
MANUALS = manuals
BC_MANPAGE_NAME = $(EXEC_PREFIX)$(BC)$(EXEC_SUFFIX).1
BC_MANPAGE = $(MANUALS)/$(BC).1
BC_RONN = $(BC_MANPAGE).ronn
BC_MD = $(BC_MANPAGE).md
DC_MANPAGE_NAME = $(EXEC_PREFIX)$(DC)$(EXEC_SUFFIX).1
DC_MANPAGE = $(MANUALS)/$(DC).1
DC_RONN = $(DC_MANPAGE).ronn
DC_MD = $(DC_MANPAGE).md
MANPAGE_INSTALL_ARGS = -Dm644
......@@ -270,8 +270,8 @@ extra_math:
@printf '%s' "$(BC_ENABLE_EXTRA_MATH)"
manpages:
$(MANPAGE) $(BC_RONN) $(BC_MANPAGE)
$(MANPAGE) $(DC_RONN) $(DC_MANPAGE)
$(MANPAGE) bc
$(MANPAGE) dc
clean_gen:
@$(RM) -f $(GEN_EXEC)
......@@ -295,6 +295,8 @@ clean:%%CLEAN_PREREQS%%
clean_config: clean
@printf 'Cleaning config...\n'
@$(RM) -f Makefile
@$(RM) -f $(BC_MD) $(DC_MD)
@$(RM) -f $(BC_MANPAGE) $(DC_MANPAGE)
clean_coverage:
@printf 'Cleaning coverage files...\n'
......
# News
## 3.1.1
This is a production release that adds two Spanish locales. Users do ***NOT***
need to upgrade, unless they want those locales.
## 3.1.0
This is a production release that adjusts one behavior, fixes eight bugs, and
improves manpages for FreeBSD. Because this release fixes bugs, **users and
package maintainers should update to this version as soon as possible**.
The behavior that was adjusted was how code from the `-e` and `-f` arguments
(and equivalents) were executed. They used to be executed as one big chunk, but
in this release, they are now executed line-by-line.
The first bug fix in how output to `stdout` was handled in `SIGINT`. If a
`SIGINT` came in, the `stdout` buffer was not correctly flushed. In fact, a
clean-up function was not getting called. This release fixes that bug.
The second bug is in how `dc` handled input from `stdin`. This affected `bc` as
well since it was a mishandling of the `stdin` buffer.
The third fixed bug was that `bc` and `dc` could `abort()` (in debug mode) when
receiving a `SIGTERM`. This one was a race condition with pushing and popping
items onto and out of vectors.
The fourth bug fixed was that `bc` could leave extra items on the stack and
thus, not properly clean up some memory. (The memory would still get
`free()`'ed, but it would not be `free()`'ed when it could have been.)
The next two bugs were bugs in `bc`'s parser that caused crashes when executing
the resulting code.
The last two bugs were crashes in `dc` that resulted from mishandling of
strings.
The manpage improvement was done by switching from [ronn][20] to [Pandoc][21] to
generate manpages. Pandoc generates much cleaner manpages and doesn't leave
blank lines where they shouldn't be.
## 3.0.3
This is a production release that adds one new feature: specific manpages.
Before this release, `bc` and `dc` only used one manpage each that referred to
various build options. This release changes it so there is one manpage set per
relevant build type. Each manual only has information about its particular
build, and `configure.sh` selects the correct set for install.
## 3.0.2
This is a production release that adds `utf8` locale symlinks and removes an
......@@ -32,8 +81,9 @@ global ones that are already installed, so it will use the previous ones while
running tests during install. **If `bc` segfaults while running arg tests when
updating, it is because the global locale files have not been replaced. Make
sure to either prevent the test suite from running on update or remove the old
locale files before updating.** Once this is done, `bc` should install without
problems.*
locale files before updating.** (Removing the locale files can be done with
`make uninstall` or by running the `locale_uninstall.sh` script.) Once this is
done, `bc` should install without problems.*
*Second, **the option to build without signal support has been removed**. See
below for the reasons why.*
......@@ -811,14 +861,16 @@ not thoroughly tested.
[6]: ./configure.sh
[7]: https://github.com/rain-1/linenoise-mob
[8]: https://github.com/antirez/linenoise
[9]: ./manuals/bc.1.ronn
[10]: ./manuals/dc.1.ronn
[9]: ./manuals/bc/A.1.md
[10]: ./manuals/dc/A.1.md
[11]: https://scan.coverity.com/projects/gavinhoward-bc
[12]: ./locale_install.sh
[13]: ./manuals/build.md
[14]: https://github.com/stesser
[15]: https://github.com/bugcrazy
[16]: ./manuals/bc.1.ronn#extended-library
[16]: ./manuals/bc/A.1.md#extended-library
[17]: https://github.com/skeeto/optparse
[18]: https://www.deepl.com/translator
[19]: ./manuals/benchmarks.md
[20]: https://github.com/apjanke/ronn-ng
[21]: https://pandoc.org/
......@@ -11,7 +11,7 @@ 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
flavor of `bc`.
For more information, see this `bc`'s [full manual][2].
For more information, see this `bc`'s full manual.
This `bc` also includes an implementation of `dc` in the same binary, accessible
via a symbolic link, which implements all FreeBSD and GNU extensions. (If a
......@@ -19,7 +19,7 @@ standalone `dc` binary is desired, `bc` can be copied and renamed to `dc`.) The
`!` command is omitted; I believe this poses security concerns and that such
functionality is unnecessary.
For more information, see the `dc`'s [full manual][3].
For more information, see the `dc`'s full manual.
This `bc` is Free and Open Source Software (FOSS). It is offered under the BSD
2-clause License. Full license text may be found in the [`LICENSE.md`][4] file.
......@@ -39,7 +39,7 @@ Systems that are known to work:
* OpenBSD
* NetBSD
* Mac OSX
* Solaris
* Solaris* (as long as the Solaris version supports POSIX 2008)
* AIX
Please submit bug reports if this `bc` does not build out of the box on any
......@@ -261,6 +261,10 @@ Other projects based on this bc are:
* [toybox `bc`][9]. The maintainer has also made his own changes, so bugs in the
toybox `bc` should be reported there.
* [FreeBSD `bc`][23]. While the `bc` in FreeBSD is kept up-to-date, it is better
to report bugs there, and the maintainers of the package will contact me if
necessary.
## Language
This `bc` is written in pure ISO C99, using POSIX 2008 APIs.
......@@ -293,7 +297,7 @@ Files:
locale_install.sh A script to install locales, if desired.
locale_uninstall.sh A script to uninstall locales.
Makefile.in The Makefile template.
manpage.sh Script to generate man pages from ronn files.
manpage.sh Script to generate man pages from markdown files.
NOTICE.md List of contributors and copyright owners.
RELEASE.md A checklist for making a release (maintainer use only).
release.sh A script to test for release (maintainer use only).
......@@ -309,8 +313,6 @@ Folders:
tests All tests.
[1]: https://www.gnu.org/software/bc/
[2]: ./manuals/bc.md
[3]: ./manuals/dc.md
[4]: ./LICENSE.md
[5]: ./manuals/build.md
[6]: https://pkg.musl.cc/bc/
......@@ -330,3 +332,4 @@ Folders:
[20]: https://git.yzena.com/gavin/bc
[21]: https://gavinhoward.com/2020/04/i-am-moving-away-from-github/
[22]: https://www.deepl.com/translator
[23]: https://github.com/freebsd/freebsd/tree/master/contrib/bc
# TODO
* Rerun benchmarks.
* Redo executable size (with static binaries).
* Redo Karatsuba number and update NEWS if necessary.
#! /bin/sh
#
# Copyright (c) 2018-2020 Gavin D. Howard and contributors.
# SPDX-License-Identifier: BSD-2-Clause
#
# All rights reserved.
# Copyright (c) 2018-2020 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:
......@@ -808,6 +808,28 @@ else
fi
fi
manpage_args=""
if [ "$extra_math" -eq 0 ]; then
manpage_args="E"
fi
if [ "$hist" -eq 0 ]; then
manpage_args="${manpage_args}H"
fi
if [ "$nls" -eq 0 ]; then
manpage_args="${manpage_args}N"
fi
if [ "$prompt" -eq 0 ]; then
manpage_args="${manpage_args}P"
fi
if [ "$manpage_args" = "" ]; then
manpage_args="A"
fi
# Print out the values; this is for debugging.
if [ "$bc" -ne 0 ]; then
printf 'Building bc\n'
......@@ -924,4 +946,9 @@ printf '%s\n' "$contents" > "$scriptdir/Makefile"
cd "$scriptdir"
cp -f manuals/bc/$manpage_args.1.md manuals/bc.1.md
cp -f manuals/bc/$manpage_args.1 manuals/bc.1
cp -f manuals/dc/$manpage_args.1.md manuals/dc.1.md
cp -f manuals/dc/$manpage_args.1 manuals/dc.1
make clean > /dev/null
#! /bin/sh
#
# Copyright (c) 2018-2020 Gavin D. Howard and contributors.
# SPDX-License-Identifier: BSD-2-Clause
#
# All rights reserved.
# Copyright (c) 2018-2020 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:
......
/*
* *****************************************************************************
*
* Copyright (c) 2018-2020 Gavin D. Howard and contributors.
* SPDX-License-Identifier: BSD-2-Clause
*
* All rights reserved.
* Copyright (c) 2018-2020 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:
......@@ -58,6 +58,8 @@ This bc has three differences to the GNU bc:
3) This bc has many more extensions than the GNU bc does. For details, see the
man page.
This bc also implements the dot (.) extension of the BSD bc.
Options:
-e expr --expression=expr
......@@ -94,6 +96,9 @@ Options:
e(expr) = raises e to the power of expr
j(n, x) = Bessel function of integer order n of x
This bc may load more functions with these options. See the manpage for
details.
-P --no-prompt
Disable the prompt in interactive mode.
......
/*
* *****************************************************************************
*
* Copyright (c) 2018-2020 Gavin D. Howard and contributors.
* SPDX-License-Identifier: BSD-2-Clause
*
* All rights reserved.
* Copyright (c) 2018-2020 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:
......
/*
* *****************************************************************************
*
* Copyright (c) 2018-2020 Gavin D. Howard and contributors.
* SPDX-License-Identifier: BSD-2-Clause
*
* All rights reserved.
* Copyright (c) 2018-2020 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:
......
/*
* *****************************************************************************
*
* Copyright (c) 2018-2020 Gavin D. Howard and contributors.
* SPDX-License-Identifier: BSD-2-Clause
*
* All rights reserved.
* Copyright (c) 2018-2020 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:
......
/*
* *****************************************************************************
*
* Copyright (c) 2018-2020 Gavin D. Howard and contributors.
* SPDX-License-Identifier: BSD-2-Clause
*
* All rights reserved.
* Copyright (c) 2018-2020 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:
......
#! /bin/sh
#
# Copyright (c) 2018-2020 Gavin D. Howard and contributors.
# SPDX-License-Identifier: BSD-2-Clause
#
# All rights reserved.
# Copyright (c) 2018-2020 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:
......
/*
* *****************************************************************************
*
* Copyright (c) 2018-2020 Gavin D. Howard and contributors.
* SPDX-License-Identifier: BSD-2-Clause
*
* All rights reserved.
* Copyright (c) 2018-2020 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:
......
/*
* *****************************************************************************
*
* Copyright (c) 2018-2020 Gavin D. Howard and contributors.
* SPDX-License-Identifier: BSD-2-Clause
*
* All rights reserved.
* Copyright (c) 2018-2020 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:
......@@ -130,13 +130,13 @@ void bc_lex_token(BcLex *l);
#define BC_PARSE_LEAF(prev, bin_last, rparen) \
(!(bin_last) && ((rparen) || bc_parse_inst_isLeaf(prev)))
#if BC_ENABLE_EXTRA_MATH
#if BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND
#define BC_PARSE_INST_VAR(t) \
((t) >= BC_INST_VAR && (t) <= BC_INST_SEED && (t) != BC_INST_ARRAY)
#else // BC_ENABLE_EXTRA_MATH
#else // BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND
#define BC_PARSE_INST_VAR(t) \
((t) >= BC_INST_VAR && (t) <= BC_INST_SCALE && (t) != BC_INST_ARRAY)
#endif // BC_ENABLE_EXTRA_MATH
#endif // BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND
#define BC_PARSE_PREV_PREFIX(p) \
((p) >= BC_INST_NEG && (p) <= BC_INST_BOOL_NOT)
......
/*
* *****************************************************************************
*
* Copyright (c) 2018-2020 Gavin D. Howard and contributors.
* SPDX-License-Identifier: BSD-2-Clause
*
* All rights reserved.
* Copyright (c) 2018-2020 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:
......@@ -36,10 +36,6 @@
#ifndef BC_DC_H
#define BC_DC_H
#ifndef DC_ENABLE_RAND
#define DC_ENABLE_RAND (1)
#endif // DC_ENABLE_RAND
#if DC_ENABLED
#include <status.h>
......
/*
* *****************************************************************************
*
* Copyright (c) 2018-2020 Gavin D. Howard and contributors.
* SPDX-License-Identifier: BSD-2-Clause
*
* All rights reserved.
* Copyright (c) 2018-2020 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:
......
/*
* *****************************************************************************
*
* Copyright (c) 2018-2020 Gavin D. Howard and contributors.
* SPDX-License-Identifier: BSD-2-Clause
*
* All rights reserved.
* Copyright (c) 2018-2020 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:
......@@ -47,8 +47,6 @@
* Copyright (c) 2010-2016, Salvatore Sanfilippo <antirez at gmail dot com>
* Copyright (c) 2010-2013, Pieter Noordhuis <pcnoordhuis at gmail dot com>
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
......
/*
* *****************************************************************************
*
* Copyright (c) 2018-2020 Gavin D. Howard and contributors.
* SPDX-License-Identifier: BSD-2-Clause
*
* All rights reserved.
* Copyright (c) 2018-2020 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:
......@@ -129,6 +129,7 @@ typedef enum BcInst {
BC_INST_ARRAY,
#endif // BC_ENABLED
BC_INST_ZERO,
BC_INST_ONE,
#if BC_ENABLED
......@@ -137,26 +138,26 @@ typedef enum BcInst {
BC_INST_IBASE,
BC_INST_OBASE,
BC_INST_SCALE,
#if BC_ENABLE_EXTRA_MATH
#if BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND
BC_INST_SEED,
#endif // BC_ENABLE_EXTRA_MATH
#endif // BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND
BC_INST_LENGTH,
BC_INST_SCALE_FUNC,
BC_INST_SQRT,
BC_INST_ABS,
#if BC_ENABLE_EXTRA_MATH
#if BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND
BC_INST_IRAND,
#endif // BC_ENABLE_EXTRA_MATH
#endif // BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND
BC_INST_READ,
#if BC_ENABLE_EXTRA_MATH
#if BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND
BC_INST_RAND,
#endif // BC_ENABLE_EXTRA_MATH
#endif // BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND
BC_INST_MAXIBASE,
BC_INST_MAXOBASE,
BC_INST_MAXSCALE,
#if BC_ENABLE_EXTRA_MATH
#if BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND
BC_INST_MAXRAND,
#endif // BC_ENABLE_EXTRA_MATH
#endif // BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND
BC_INST_PRINT,
BC_INST_PRINT_POP,
......@@ -252,9 +253,9 @@ typedef enum BcResultType {
BC_RESULT_STR,
BC_RESULT_CONSTANT,
BC_RESULT_TEMP,
BC_RESULT_ZERO,
BC_RESULT_ONE,
#if BC_ENABLED
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment