Commit Graph

13 Commits

Author SHA1 Message Date
Yoshihiro Takahashi
1da80a2c75 Sync with OpenBSD.
bc.y: Rev 1.50
- write parse errors to stderr, prompted by Martijn Dekker
- we're only interactive if stdout en stderr are a tty as well as stdin

PR:		234430
Obtained from:	OpenBSD
MFC after:	1 week
2019-01-12 12:35:02 +00:00
Pedro F. Giffuni
63433bc937 bc/dc/patch: make some use of reallocarray(3).
reallocarray(3) is a non portable extension from OpenBSD. Given that it is
already in FreeBSD, make easier future merges by adopting in some cases
where the code has some shared heritage with OpenBSD.

Obtained from:	OpenBSD
2017-03-05 16:10:35 +00:00
Pedro F. Giffuni
6659f97630 bc(1): Fix memory corruption issues
Fix crashes and hangs found by AFL.
Improve handling of non-ascii chars.

Obtained from:	OpenBSD (CVS rev 1.49)
2015-11-24 04:15:13 +00:00
Pedro F. Giffuni
bafb3a75ca bc: sync with OpenBSD
tty.c Rev. 1.3
Avoid unintended problems with operator precedence when doing an
assignment and comparison.

bc.1, Rev. 1.31, 1.32
'.Ql Quit' -> '.Ql quit' because only the lowercase command is valid.
Clarify sentence about `quit` in BUGS section.

extern.h, Rev. 1.12
whitespace

bc.y, Rev. 1.47
Prefer setvbuf() to setlinebuf() for portability

Obtained from:	OpenBSD
MFC after:	2 weeks
2015-11-22 02:43:14 +00:00
Xin LI
be848c7a13 Sync with OpenBSD.
MFC after:	2 weeks
2014-04-16 23:14:05 +00:00
Xin LI
c64c63b9dd Remove mention of the compatibility option 'q', which is
intentionally undocumented and its only purpose is that
we do not bail out when used as a drop-in replacement of
a different implementation.

PR:		docs/184550
MFC after:	2 weeks
2013-12-07 06:27:54 +00:00
Eitan Adler
ac1e7ba236 Make definition match declaration
Approved by:	cperciva
MFC after:	3 days
2012-11-15 15:06:00 +00:00
Baptiste Daroussin
5e2a209a27 Fix world after byacc import:
- old yacc(1) use to magicially append stdlib.h, while new one don't
- new yacc(1) do declare yyparse by itself, fix redundant declaration of
  'yyparse'

Approved by:	des (mentor)
2012-05-22 16:33:10 +00:00
Kevin Lo
741e1faf5c - Fix an erroneous invocation of the editline.
- Fix wrong scaling in the bc.library.
- Let length(0.000) conform to what gnu bc does.

PR:	bin/159227
Submitted by:	AIDA Shinra <shinra at j10n dot org>
2012-03-15 01:43:44 +00:00
Xin LI
4218135bf7 Use libedit when interacting with tty, which provided history
functionality, etc. as did by GNU bc.

This also fixes an issue where BSDL bc can not handle very long
line.

Reported by:	imp
Reviewed by:	imp
2010-02-04 18:43:05 +00:00
Gabor Kovesdan
7121df6349 - style(9)
Approved by:	delphij (mentor)
2010-02-03 21:06:13 +00:00
Xin LI
5690ece69f - Remove --debug option and intentionally undocument -d, which is only
kept for compatibility with 4.4BSD behavior.
 - Sync SYNOPSIS with usage().
 - Use an alternative way to represent short and long options which have
   same semantics.

Reviewed by:	gabor
2010-01-22 23:35:06 +00:00
Gabor Kovesdan
fdf1f88bce Replace GNU bc/dc with BSDL versions ported from OpenBSD. They have a good
compatibility level with the GNU counterparts and have shown to be mature
enough. For now, the GNU versions aren't removed from the tree, just detached
from the build.

Sponsored by:		Google Summer of Code 2008
Portbuild run by:	erwin
Approved by:		delphij
2010-01-20 21:30:52 +00:00