debian/0000775000000000000000000000000012312234432007164 5ustar debian/dc.examples0000664000000000000000000000002112141256361011310 0ustar debian/dc_factor debian/dc_factor0000664000000000000000000000067612135037754011057 0ustar #!/bin/sh # # Example taken from http://www.cs.unh.edu/~charpov/Programming/DC/ # and minimally modified to use dc -e '...' instead of echo '...' | dc # # Usage: # Invoke as 'dc_factor $ARG' and $ARG will be factored # Example: # $ ./dc_factor 123456789 # 3 # 3 # 3607 # 3803 # # Dirk Eddelbuettel 09 May 2003 dc -e "$1[p]s2[lip/dli%0=1dvsr]s12sid2%0=13sidvsr[dli%0=1lrli2+dsi!>.]ds.xd1<2" debian/dc.menu0000664000000000000000000000017212135037763010453 0ustar ?package(dc):needs="text" title="Dc" section="Applications/Science/Mathematics" hints="Calculators" command="/usr/bin/dc" debian/bc.docs0000664000000000000000000000004012141256361010421 0ustar NEWS README AUTHORS doc/bc.html debian/dc.info0000664000000000000000000000004212141256361010430 0ustar debian/tmp/usr/share/info/dc.info debian/menu.dc0000664000000000000000000000014012135037763010446 0ustar ?package(units):needs="text" section="Applications/Science/Mathematics" title="Dc" command="dc" debian/dc.install0000664000000000000000000000001312141256361011141 0ustar usr/bin/dc debian/bc.examples0000664000000000000000000000001312141256361011307 0ustar Examples/* debian/copyright0000664000000000000000000001414412141263012011117 0ustar Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: bc Source: ftp://ftp.gnu.org/gnu/bc/ Files: * Copyright: Copyright (C) 1989–2006 Free Software Foundation, Inc. License: GPL-2.0+ Comment: bc was written by Phil Nelson, Ken Pizzini wrote dc Files: doc/dc.info Copyright: Copyright (C) 1984, 1994, 1997, 1998, 2000, 2005, 2006 Free Software Foundation, Inc. License: permissive Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are preserved on all copies. . Permission is granted to copy and distribute modified versions of this manual under the conditions for verbatim copying, provided that the entire resulting derived work is distributed under the terms of a permission notice identical to this one. . Permission is granted to copy and distribute translations of this manual into another language, under the above conditions for modified versions, except that this permission notice may be stated in a translation approved by the Foundation. Files: doc/bc.texi Copyright: Copyright (C) 1991–1994, 1997, 2003, 2006 Free Software Foundation, Inc. License: permissive Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are preserved on all copies. . Permission is granted to process this file through TeX and print the results, provided the printed document carries copying permission notice identical to this one except for the removal of this paragraph (this paragraph not being relevant to the printed manual). . Permission is granted to copy and distribute modified versions of this manual under the conditions for verbatim copying, provided that the entire resulting derived work is distributed under the terms of a permission notice identical to this one. . Permission is granted to copy and distribute translations of this manual into another language, under the above conditions for modified versions, except that this permission notice may be stated in a translation approved by the Foundation. Files: doc/texinfo.tex Copyright: Copyright (C) 1985–1986, 1988, 1990–2005 Free Software Foundation, Inc. License: GPL-2.0+ with Texinfo exception This texinfo.tex file is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. . This texinfo.tex file is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. . You should have received a copy of the GNU General Public License along with this texinfo.tex file; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. . As a special exception, when this file is read by TeX when processing a Texinfo source document, you may use the result without restriction. (This has been our intent since Texinfo was invented.) Files: install-sh Copyright: Copyright (C) 1994 X Consortium Comment: This originates from X11R5 (mit/util/scripts/install.sh), which was later released in X11R6 (xc/config/util/install.sh) with the following copyright and license. License: X11 and public-domain Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: . The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. . THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. . Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other deal- ings in this Software without prior written authorization from the X Consor- tium. . FSF changes to this file are in the public domain. Files: debian/* Copyright: Copyright (C) 1997–1999 James Troup Copyright (C) 1999–2004 Dirk Eddelbuettel Copyright (C) 2005–2013 John Hasler Copyright (C) 2009 Francois Marier Copyright (C) 2013 Ryan Kavanagh License: GPL-2.0+ Comment: Bill Mitchell and Austin Donnelly maintained the package prior to James Troup's maintainership. The dates during which they maintained the package are lost to history. License: GPL-2.0+ This package is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. . This package is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. . You should have received a copy of the GNU General Public License along with this program. If not, see . On Debian systems, the complete text of the GNU General Public License version 2 can be found in "/usr/share/common-licenses/GPL-2". debian/dc.manpages0000664000000000000000000000004312141256361011271 0ustar debian/tmp/usr/share/man/man1/dc.1 debian/menu.bc0000664000000000000000000000014012135037763010444 0ustar ?package(units):needs="text" section="Applications/Science/Mathematics" title="Bc" command="bc" debian/bc.menu0000664000000000000000000000017212135037763010451 0ustar ?package(bc):needs="text" section="Applications/Science/Mathematics" title="Bc" hints="Calculators" command="/usr/bin/bc" debian/bc.install0000664000000000000000000000001312141256361011137 0ustar usr/bin/bc debian/bc.manpages0000664000000000000000000000004312141256361011267 0ustar debian/tmp/usr/share/man/man1/bc.1 debian/source/0000775000000000000000000000000012141256361010471 5ustar debian/source/format0000664000000000000000000000001412141256361011677 0ustar 3.0 (quilt) debian/bc.info0000664000000000000000000000004212141256361010426 0ustar debian/tmp/usr/share/info/bc.info debian/dc.doc-base0000664000000000000000000000117012135037764011164 0ustar Document: dc Title: The GNU DC arbitrary precision calculator Author: Ken Pizzini Abstract: GNU dc is a reverse-polish desk calculator which supports unlimited precision arithmetic. It also allows you to define and call macros. Normally DC reads from the standard input; if any command arguments are given to it, they are filenames, and DC reads and executes the contents of the files instead of reading from standard input. All normal output is to standard output; all error messages are written to standard error. Section: Science/Mathematics Format: HTML Index: /usr/share/doc/dc/dc.html Files: /usr/share/doc/dc/dc.html debian/changelog0000664000000000000000000004474312312234432011052 0ustar bc (1.06.95-8ubuntu1) trusty; urgency=medium * Remove ancient unnecessary install-info dependencies. -- Adam Conrad Wed, 19 Mar 2014 00:28:09 -0600 bc (1.06.95-8) unstable; urgency=low * Use makeinfo instead of obsoleted texi2html * Reintroduce patch reading ~/.dcrc file at dc start, 06_read_dcrc.diff (Closes: #582137) (LP: #918836) * Drop old-style 'Home page:' entries in long description * Added a gbp.conf to use pristine-tar and to sign tags -- Ryan Kavanagh Sun, 02 Jun 2013 20:43:53 -0400 bc (1.06.95-7) unstable; urgency=low * New maintainer (Closes: #705771) * Switch to Debian source format 3.0 (quilt) * Updated copyright file with missing licenses and holders. Now in DEP-5 format. * Bump standards version to 3.9.4 * Bump debhelper Build-Dependency to >= 9 and switch from old-style rules with manual calls to dh_* to modern style dh rules * Bump compat level to 9 * Drop libreadline5-dev from Build-Depends, it no longer exists in unstable * Add a doc-base file for bc * Fix a typo in bc, 01_typo_in_bc.diff * Fix hyphens used as minus signs in manpages, 02_hyphens_as_minus_in_man.diff * Fix array initialization bug, 03_array_initialize.diff (Closes: #671513, #586969) * Revert all inline patches and introduce them as logical quilt patches + Set the info dircategory to Math, 04_info_dircategory.diff + Notice read/write errors on input and output, 05_notice_read_write_errors.diff * clean target now conforms to Debian Policy §4.9, "must undo any effects that the build target may have had [...]" * Added Vcs-Git/Vcs-Browser entries to debian/control * Reintroduce the missing 1.06.94-3.1 changelog entry * Get rid of postinst/postrm files, they were unneeded -- Ryan Kavanagh Fri, 24 May 2013 07:26:52 -0400 bc (1.06.95-6) unstable; urgency=low * QA upload. * Make bc Multi-Arch: foreign, so that it can satisfy (build-)dependencies from other architectures (thanks, Sune Vuorela and Wookey; closes: #681784, LP: #1098408). * Add build-arch and build-indep targets. -- Colin Watson Tue, 30 Apr 2013 17:15:31 +0100 bc (1.06.95-5) unstable; urgency=low * Orphaned -- John G. Hasler Fri, 19 Apr 2013 14:14:48 -0500 bc (1.06.95-4) unstable; urgency=low * Added #!/bin/sh to scripts. Closes: #683571: postinst and postrm are not valid scripts -- John G. Hasler Wed, 01 Aug 2012 17:42:42 -0500 bc (1.06.95-3) unstable; urgency=low * Applied patch from Pádraig Brady. Closes: #608255: bc uses uninitialized memory * Applied patch from Paul Dwerryhouse. Closes: #472250: please return support for .dcrc file * Applied patch from Ian Jackson. Closes: #488735: notice read and write errors on input and output * Generated bc.html and dc.html but something is still wrong. * Added homepage field to debian/control. * I can't see the problem with hyphens. * Fixed doc-base white space. * Added watch file. * I believe that the above changes deal with 558188. Closes: #558188: Changes made in 1.06.94-3.1 NMU have been lost -- John G. Hasler Fri, 22 Jun 2012 21:00:45 -0500 bc (1.06.95-2) unstable; urgency=low * Fixed errors in debian/rules that prevented info files from being correctly generated. -- John G. Hasler Thu, 15 Oct 2009 12:17:23 -0500 bc (1.06.95-1) unstable; urgency=low * New upstream release Closes: #538419: New bc upstream version 1.06.95 Fixed libreadline build dependencies. -- John Hasler Sat, 03 Oct 2009 21:21:04 -0500 bc (1.06.94-3.1) unstable; urgency=low * Non-maintainer upload with John's permission. * Apply patch to restore the .dcrc config file (closes: #472250) * Merge patch from Ubuntu to notice read and write errors on input and output (closes: #488735) * Include the bc manual (HTML) in the bc binary package * Bump Standards Version to 3.8.1 * Bump debhelper compatibility to 7 * debian/rules: replace "dh_clean -k" with "dh_prep" * debian/control: Add homepage field * Fix hyphens in the bc and dc manpages * Add a watch file * debian/dc.doc-base: Remove leading whitespace * debian/dc.doc-base: Move to section Science/Mathematics -- Francois Marier Thu, 16 Apr 2009 10:23:39 +1200 bc (1.06.94-3) unstable; urgency=low * Added "-pbc" to dh_installdirs line for bc in debian/rules. Fixes build failure with "-j3". -- John Hasler Sun, 02 Dec 2007 14:46:56 -0600 bc (1.06.94-2) unstable; urgency=low * Uncommented dh_md5sums in debian/rules. * Corrected menu entries. -- John Hasler Fri, 05 Oct 2007 12:29:18 -0500 bc (1.06.94-1) unstable; urgency=low * New upstream release Code cleanup upstream has fixed these Closes: #357728: bc: Segfaults Closes: #221781: dc: precision >= 1000000000 does not work Closes: #429156: dc: segfaults when generating primes Closes: #296232: dc directory' should print an error Closes: #301921: 'man bc' typos: "environent", "specifing" * Patched use_quit() in main.c to run rl_initialize(). Closes: #287210: bc: Interrupt should reset the input line * BC_LINE_LENGTH=0 disables the multi-line feature. Closes: #245899: bc: BC_LINE_LENGTH=0 or similar for ``do never split'' should be added, or the manpage should be fixed * Upstream says this in correct POSIX behavior. Closes: #388487: bc: scale strangeness * Applied patch from Justin Pryzby. Closes: #374818: dc: maintscript prerm arguments * Remove '-s' from calls to install in debian/rules. Fixes both bc and dc. Closes: #436578: bc: not handling nostrip build option (policy 10.1) sid/i386 * Upstream has removed the '-E' option. Closes: #389345: dc: man page formatting bug * Added -DDONTEXIT to debian/rules as it is not the default. * Man page typos fixed upstream. * Added home page (such as it is) to descriptions. * Fixed make distclean call in debian/rules. -- John Hasler Thu, 23 Aug 2007 15:18:09 -0500 bc (1.06-20) unstable; urgency=low * Had already fixed menu titles but failed to close the bug. Closes: #320605: Conformance with menu policy * Also had fixed typos. Closes: #301921: 'man bc' typos: "environent", "specifing" -- John Hasler Sat, 7 Oct 2006 10:45:18 -0500 bc (1.06-19) unstable; urgency=low * Fixed libreadline dependency. Closes: #326385: please rebuild with libreadline5-dev as build dependency -- John Hasler Thu, 17 Nov 2005 15:41:52 -0600 bc (1.06-18) unstable; urgency=low * Corrected link in copyright file. * Fixed capitalization in menu titles. Closes: #320605: Conformance with menu policy -- John Hasler Sun, 28 Aug 2005 18:36:46 -0500 bc (1.06-17) unstable; urgency=low * New maintainer. -- John Hasler Sat, 15 Jan 2005 18:20:00 -0600 bc (1.06-16) unstable; urgency=low * debian/rules: Applied patch by NIIBE Yutaka to distinguish between GNU types build and host (Closes: #285304) -- Dirk Eddelbuettel Sun, 19 Dec 2004 18:08:47 -0600 bc (1.06-15) unstable; urgency=low * configure.in: Patch was supposed to be '-I -8' (Closes: #237957) * Also ran autoconf2.50 to re-create configure -- Dirk Eddelbuettel Thu, 29 Apr 2004 20:54:22 -0500 bc (1.06-14) unstable; urgency=low * configure.in: Applied patch by Andreas Jochens to invoke flex with argument '-I 8' instead of '-I8' (Closes: #237957) -- Dirk Eddelbuettel Mon, 26 Apr 2004 19:55:50 -0500 bc (1.06-13) unstable; urgency=low * bc/bc.y: Apply patch by Matt Kraai to fix flex issues (Closes: #236991) * debian/control: Upgraded to Standards-Version: 3.6.1 * debian/dc.menu: Quoted one more argument (thanks, lintian) -- Dirk Eddelbuettel Wed, 10 Mar 2004 21:34:02 -0600 bc (1.06-12) unstable; urgency=low * configure.in: Avoid time skew via AM_MAINTAINER_MODE (Closes: #208195) * {bc,dc,lib}/Makefile.am: s/CFLAGS/AM_CFLAGS/,s/YFLAGS/AM_YFLAGS/ * Ran 'aclocal; autoconf; automake-1.7 --gnu --add-missing --copy' * doc/bc.1: Patch by N. Francois with two minor corrections (Closes: #215292) -- Dirk Eddelbuettel Tue, 14 Oct 2003 20:43:21 -0500 bc (1.06-11) unstable; urgency=low * doc/dc.{1,texi}: Applied upstream patch by Ken Pizzini (Closes: #100344) -- Dirk Eddelbuettel Mon, 12 May 2003 16:01:32 -0500 bc (1.06-10) unstable; urgency=low * dc/{dc.c,eval.c,dc-proto.h}: Added new upstream patch by Ken Pizzini which fixes one old and one new bug report(Closes: #135029, #191663) * dc/dc.c: Corrected function argument to pointer to string * debian/control: Increased Standards-Version to 3.5.9 * debian/dc_factor: New example script -- Dirk Eddelbuettel Fri, 9 May 2003 20:20:29 -0500 bc (1.06-9) unstable; urgency=low * dc/dc.c, doc/dc.1: Applied patch by Terran Melconian for an additional command-line argument, and rc file handling; also forwarded upstream (Closes: #167274) -- Dirk Eddelbuettel Fri, 1 Nov 2002 23:51:51 -0600 bc (1.06-8) unstable; urgency=low * debian/control: Priority changed to standard as per overrides file * debian/control: Standards-Version upgraded to 3.5.0 * debian/copyright: Debian/GNU Linux typo fix (lintian) -- Dirk Eddelbuettel Sat, 13 Apr 2002 11:33:49 -0500 bc (1.06-7) unstable; urgency=low * bc/scan.l, bc/scan.c: Commented out three declarations that are now also in libreadline 4.2; mini-patch sent upstream (Closes: #100178) -- Dirk Eddelbuettel Sat, 9 Jun 2001 06:03:33 -0500 bc (1.06-6) unstable; urgency=low * The "surprise, another build-depends bug" upload * debian/control: Added bison to Build-Depends (Closes: #86977) -- Dirk Eddelbuettel Thu, 22 Feb 2001 20:43:44 -0600 bc (1.06-5) unstable; urgency=low * The "there's yet another in the pipeline" revisions * bc/bc.y: Another small patch from upstream -- Dirk Eddelbuettel Mon, 19 Feb 2001 20:05:31 -0600 bc (1.06-4) unstable; urgency=low * The "Let's make it three uploads in twenty-four hours" revisison * debian/control: Added file, flex, texinfo, libreadline4-dev (Closes: #86593) -- Dirk Eddelbuettel Mon, 19 Feb 2001 08:26:45 -0600 bc (1.06-3) unstable; urgency=low * bc/load.c: Another small patch from upstream -- Dirk Eddelbuettel Sun, 18 Feb 2001 23:04:08 -0600 bc (1.06-2) unstable; urgency=low * bc/main.c: Applied modified patch from the upstream and CVSh, supplied in response the to the bug supplied with the bug report (Closes: #86425) -- Dirk Eddelbuettel Sun, 18 Feb 2001 10:06:05 -0600 bc (1.06-1) unstable; urgency=low * Upgraded to new upstream release 1.06 (Closes: #82207) -- Dirk Eddelbuettel Sun, 14 Jan 2001 23:03:26 -0600 bc (1.05a-13) unstable; urgency=low * debian/control: Build-Depends on texi2html, not tetex-bin (Closes: #81196) -- Dirk Eddelbuettel Thu, 4 Jan 2001 20:38:12 -0600 bc (1.05a-12) unstable; urgency=low * debian/control: Added Build-Depends * debian/dc.menu: Added hints="Calculator" (Closes: #80012) * debian/bc.menu: Added hints="Calculator" (Closes: #80050) -- Dirk Eddelbuettel Tue, 19 Dec 2000 22:09:44 -0600 bc (1.05a-11) frozen; urgency=low * Argh, 1.05a-10 was meant for frozen - this really closes #57908. -- Dirk Eddelbuettel Sun, 13 Feb 2000 17:05:49 -0500 bc (1.05a-10) unstable; urgency=low * Rebuilt against libreadline4 (Closes: #57908) -- Dirk Eddelbuettel Sun, 13 Feb 2000 00:17:31 -0500 bc (1.05a-9) unstable; urgency=low * Applied upstream patch by Ken Pizzini to correct the dc.1 manual page (Closes: #48881) -- Dirk Eddelbuettel Wed, 3 Nov 1999 22:10:33 -0500 bc (1.05a-8) unstable; urgency=low * Applied another upstream patch by Phil Nelson ; this one improves the cosine and cosine and bessel functions * debian/rules: make sure we link bc with readline (Closes: #46535) -- Dirk Eddelbuettel Sun, 3 Oct 1999 17:00:38 -0400 bc (1.05a-7) unstable; urgency=low * Applied new upstream patch by Phil Nelson to improve the raise operation. Thanks to Aaron Digulla for the report. * debian/rules: Adapted to use /usr/share/ following the recommendation on FHS transition from the Technical Committee * debian/rules: Test for debhelper >= 2.0.40 for FHS compliance * debian/control: Upgraded to Debian Policy 3.0.1 -- Dirk Eddelbuettel Sat, 2 Oct 1999 09:14:41 -0400 bc (1.05a-6) unstable; urgency=low * debian/control: Actually changed maintainer name -- Dirk Eddelbuettel Fri, 4 Jun 1999 22:54:45 -0400 bc (1.05a-5) unstable; urgency=low * New maintainer * debian/rules: Converted to debhelper * debian/*: Added doc-base support for dc * debian/{bc,dc}.{post,pre}{inst,rm}: Cosmetic changes -- Dirk Eddelbuettel Fri, 28 May 1999 23:47:40 -0400 bc (1.05a-4) unstable; urgency=low * debian/control (Standards-Version): updated to 2.5.0.0. * configure.in: changed test for readline to use READLINELIB and not LIBS so we can link just bc with readline (as dc doesn't use it). [#31473] * bc/Makefile.am (LDADD): add @READLINELIB@. -- James Troup Sat, 16 Jan 1999 15:19:32 +0000 bc (1.05a-3) frozen unstable; urgency=high * bc/scan.l (rl_len): int not char, to allow input > 128 characters in length without crashing. Reported by Wakko Warner , Jeff Noxon and Camm Maguire . [#23304, #24113, #27731] -- James Troup Mon, 9 Nov 1998 02:45:00 +0000 bc (1.05a-2) unstable; urgency=low * debian/control (Maintainer): new address. * debian/copyright: ditto. * Recompile with ncurses4. -- James Troup Fri, 23 Oct 1998 18:27:44 +0100 bc (1.05a-1) unstable; urgency=low * New upstream version. * debian/control (Standards-Version): updated to 2.4.1.0. -- James Troup Tue, 30 Jun 1998 00:54:37 +0200 bc (1.04-4) unstable; urgency=low * debian/copyright: correct the FSF's address. * debian/copyright: refer to bc source package, not hello. * debian/control (Standards-Version): updated to 2.4.0.0. -- James Troup Mon, 2 Mar 1998 18:10:02 +0000 bc (1.04-3) unstable; urgency=low * Uses pristine upstream source. * Added menu entries. * debian/control: Updated Standards-Version to 2.3.0.1. * debian/control: Shortened dc's long description. * debian/rules: No longer uses {,}. * debian/rules: Compile with -g and -Wall. * debian/rules: Split binary-arch into binary-bc and binary-dc. * debian/rules: Lots of other minor changes. * bc/scan.l: Don't use readline when not interactive. (Patch from Andreas Schwab). This fixes the problem of bc echoing it's input when used in a pipe [#16069] * Test/timetest: correct location of bc. (Patch from Karl Heuer) * lib/number.c: Fix for broken sqrt function. (Patch from Phil Nelson) -- James Troup Mon, 29 Dec 1997 19:34:45 +0000 bc (1.04-2) unstable; urgency=low * Rebuilt with libc6. * Compiled with readline. -- James Troup Mon, 30 Jun 1997 01:21:23 +0100 bc (1.04-1) unstable; urgency=low * New upstream release. -- James Troup Wed, 30 Apr 1997 17:18:39 +0100 bc (1.03-14) unstable; urgency=low * Made bc flush its output unconditionally (bug #6986). -- James Troup Thu, 13 Feb 1997 16:56:49 +0000 bc (1.03-13) unstable; urgency=low * Corrected location of example files (bug #7041). -- James Troup Mon, 3 Feb 1997 02:50:29 +0000 bc (1.03-12) unstable; urgency=low * Corrected priority (optional -> important). -- James Troup Fri, 31 Jan 1997 00:59:11 +0000 bc (1.03-11) unstable; urgency=low * New maintainer. * Updated to Standards-Version 2.1.1.2. * Included Austin Donnelly's fix for bug #6463. * Fixed dc.1 so mandb can parse it (bug #4991). -- James Troup Thu, 30 Jan 1997 04:07:04 +0000 Changes for bc-1.03-10: elf package * added dependency on libc5 Changes for bc-1.03-9: * rebuilt for elf Changes for bc-1.03-8: Priority: Routine Changes: Various administrative changes changed extended description for the bc package to the one used by GNU. renamed source package debian.* files added SECTON field to control files added /usr/doc/dc with dc.texinfo man Makefile Changes for bc-1.03-7: 1. Fixed problem with debian.rules sed invocation for debian.control 2. Remove several files created by the build in debian.rules clean: Changes for bc-1.03-6: 1. Cleaned up control file descriptions and extended descriptions. Changes for bc-1.03-5: 1. Changed mode of man pages from 755 to 644 Changes for bc-1.03-4: 1. In debian.rules, added code to fix broken "orig" target. (This was most likely broken by my bc-1.03-3 changes) (??) Changes for bc-1.03-3: 1. In debian.rules: Changed the "d = 2" to "d = 3" to change the bc-1.03- line in the control files from 2 to 3. Changed references to source package files control.bc and control.dc to pre-pend "debian." to those names. Changed references to source package files control.bc and control.dc to pre-pend "debian." to those names. Changed references to source package files postinst.dc and postrm.dc to pre-pend "debian." to those names. Added dependency on clean to source and diff targets. Moved "make distclean" to the last action in the clean target to prevent a failure here from aborting the preceeding cleanup. 2. Renamed files control.bc to debian.control.bc control.dc to debian.control.bc postinst.dc to debian.postinst.bc postrm.dc to debian.postrm.bc 3. In debian.control.* changed maintainer name. This file documents changes since maintenamce of this package was taken over by Bill Mitchell beginning with bc-1.03-3. debian/compat0000664000000000000000000000000212141256361010367 0ustar 9 debian/rules0000775000000000000000000000165212150767257010270 0ustar #!/usr/bin/make -f CFLAGS += -D_POSIX_SOURCE -DDOT_IS_LAST -DDONTEXIT # The following files get overwritten by the build process. We back them up # first. BACKUP_FILES = doc/bc.info \ doc/dc.info BACKED_UP_FILES = $(BACKUP_FILES:%=%.debian-backup) %: dh $@ override_dh_auto_configure: dh_auto_configure -- --prefix=/usr --with-readline override_dh_auto_build: $(BACKED_UP_FILES) (cd doc && makeinfo --html --no-split --ifinfo bc.texi) (cd doc && makeinfo --html --no-split --ifinfo dc.texi) dh_auto_build override_dh_auto_clean: restore dh_auto_clean %.debian-backup: @# Back up automatically generated files so that we can restore them in @# the clean target, as required by Policy. We do this by copying the @# matching stem, foo, to foo.debian-backup. cp -f $* $@ restore: for file in $(BACKUP_FILES); do \ [ ! -f $${file}.debian-backup ] || mv $${file}.debian-backup $${file}; \ done .PHONY: restore debian/control0000664000000000000000000000255312312234436010600 0ustar Source: bc Section: math Priority: standard Maintainer: Ubuntu Developers XSBC-Original-Maintainer: Ryan Kavanagh Standards-Version: 3.9.4 Build-Depends: bison , debhelper (>= 9) , file , flex , libreadline-dev | libreadline6-dev , texinfo Homepage: http://ftp.gnu.org/gnu/bc/ Vcs-Git: git://anonscm.debian.org/collab-maint/bc.git Vcs-Browser: http://anonscm.debian.org/gitweb/?p=collab-maint/bc.git Package: bc Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends} Multi-Arch: foreign Description: GNU bc arbitrary precision calculator language GNU bc is an interactive algebraic language with arbitrary precision which follows the POSIX 1003.2 draft standard, with several extensions including multi-character variable names, an `else' statement and full Boolean expressions. GNU bc does not require the separate GNU dc program. Package: dc Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends} Multi-Arch: foreign Description: GNU dc arbitrary precision reverse-polish calculator GNU dc is a reverse-polish desk calculator which supports unlimited precision arithmetic. It also allows you to define and call macros. . A reverse-polish calculator stores numbers on a stack. Entering a number pushes it on the stack. Arithmetic operations pop arguments off the stack and push the results. debian/bc.doc-base0000664000000000000000000000146512141256361011162 0ustar Document: bc Title: The GNU BC arbitrary precision calculator Author: Philip A. Nelson Abstract: bc is a language that supports arbitrary precision numbers with interactive execution of statements. There are some similarities in the syntax to the C programming language. A standard math library is available by command line option. If requested, the math library is defined before processing any files. bc starts by processing code from all the files listed on the command line in the order listed. After all files have been processed, bc reads from the standard input. All code is executed as it is read. (If a file contains a command to halt the processor, bc will never read from the standard input.) Section: Science/Mathematics Format: HTML Index: /usr/share/doc/bc/bc.html Files: /usr/share/doc/bc/bc.html debian/watch0000664000000000000000000000017412135037771010231 0ustar version=3 opts=pasv,dversionmangle=s/([0-9]+.[0-9a-z]+)(.[0-9]+)?/$1/ \ ftp://ftp.gnu.org/pub/gnu/bc/bc-([0-9a-z.]+).tar.gz debian/gbp.conf0000664000000000000000000000014112152772471010613 0ustar [DEFAULT] upstream-branch = upstream debian-branch = master pristine-tar = True sign-tags = True debian/patches/0000775000000000000000000000000012152762211010616 5ustar debian/patches/02_hyphens_as_minus_in_man.diff0000664000000000000000000000637612141256361016664 0ustar Description: Correct hyphens used as minus signs Author: Ryan Kavanagh Origin: vendor Forwarded: no --- This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ Index: bc/doc/bc.1 =================================================================== --- bc.orig/doc/bc.1 2013-04-21 16:25:33.292838937 -0400 +++ bc/doc/bc.1 2013-04-21 16:25:33.288838837 -0400 @@ -543,7 +543,7 @@ variable \fBpi\fR. .RS \f(CW -pi=$(echo "scale=10; 4*a(1)" | bc -l) +pi=$(echo "scale=10; 4*a(1)" | bc \-l) \fR .RE .PP @@ -565,7 +565,7 @@ /* Check the sign of x. */ if (x<0) { m = 1 - x = -x + x = \-x } /* Precondition x. */ @@ -615,7 +615,7 @@ "current balance = "; bal "transaction? "; trans = read() if (trans == 0) break; - bal -= trans + bal \-= trans bal /= 1 } quit @@ -641,7 +641,7 @@ to \fBbc\fR. It also allows for a history of previous lines typed. When this option is selected, \fBbc\fR has one more special variable. This special variable, \fBhistory\fR is the number of lines of history -retained. For \fBreadline\fR, a value of -1 means that an unlimited +retained. For \fBreadline\fR, a value of \-1 means that an unlimited number of history lines are retained. Setting the value of \fBhistory\fR to a positive number restricts the number of history lines to the number given. The value of 0 disables the history @@ -658,7 +658,7 @@ It is not implemented in the traditional way using .I dc(1). This version is a single process which parses and runs a byte code -translation of the program. There is an "undocumented" option (-c) +translation of the program. There is an "undocumented" option (\-c) that causes the program to output the byte code to the standard output instead of running it. It was mainly used for debugging the parser and preparing the math library. @@ -710,13 +710,13 @@ .IP "function format" POSIX \fBbc\fR requires the opening brace on the same line as the \fBdefine\fR key word and the \fBauto\fR statement on the next line. -.IP "=+, =-, =*, =/, =%, =^" +.IP "=+, =\-, =*, =/, =%, =^" POSIX \fBbc\fR does not require these "old style" assignment operators to be defined. This version may allow these "old style" assignments. Use the limits statement to see if the installed version supports them. If it does support the "old style" assignment operators, the statement -"a =- 1" will decrement \fBa\fR by 1 instead of setting \fBa\fR to the -value -1. +"a =\- 1" will decrement \fBa\fR by 1 instead of setting \fBa\fR to the +value \-1. .IP "spaces in numbers" Other implementations of \fBbc\fR allow spaces in numbers. For example, "x=1 3" would assign the value 13 to the variable x. The same statement Index: bc/doc/dc.1 =================================================================== --- bc.orig/doc/dc.1 2013-04-21 16:25:33.292838937 -0400 +++ bc/doc/dc.1 2013-04-21 16:25:42.769074416 -0400 @@ -26,9 +26,9 @@ .SH NAME dc \- an arbitrary precision calculator .SH SYNOPSIS -dc [-V] [--version] [-h] [--help] - [-e scriptexpression] [--expression=scriptexpression] - [-f scriptfile] [--file=scriptfile] +dc [\-V] [\-\-version] [\-h] [\-\-help] + [\-e scriptexpression] [\-\-expression=scriptexpression] + [\-f scriptfile] [\-\-file=scriptfile] [file ...] .SH DESCRIPTION .PP debian/patches/01_typo_in_bc.diff0000664000000000000000000000126312141256361014101 0ustar Description: Fix a typo in bc Author: Ryan Kavanagh Origin: vendor Forwarded: no --- This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ Index: bc/bc/bc.c =================================================================== --- bc.orig/bc/bc.c 2013-04-21 15:37:22.457003102 -0400 +++ bc/bc/bc.c 2013-04-21 16:17:44.649193374 -0400 @@ -1922,7 +1922,7 @@ #line 460 "bc.y" { if ((yyvsp[0].i_value) & EX_COMP) - warn ("comparison in return expresion"); + warn ("comparison in return expression"); if (!((yyvsp[0].i_value) & EX_PAREN)) warn ("return expression requires parenthesis"); if ((yyvsp[0].i_value) & EX_VOID) debian/patches/06_read_dcrc.diff0000664000000000000000000000432512152762120013666 0ustar Description: Read ~/.dcrc at startup of dc Patch taken from old version of dc by Paul Dwerryhouse Was initially applied by Francois Marier in the NMU 1.06.94-3.1 to close http://bugs.debian.org/472250 . Then it disappeared along the way, until users asked for it again. Jan Braun updated it to read .drcr before argument processing so that $ dc $ dc - $ dc -f - all have the same behaviour Origin: vendor Author: upstream Author: Jan Brawn Bug-Debian: http://bugs.debian.org/582137 Bug-Ubuntu: https://bugs.launchpad.net/debian/+source/bc/+bug/918836 Forwarded: no Reviewed-by: Ryan Kavanagh Last-Update: 2013-06-02 --- This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ Index: bc/dc/dc.c =================================================================== --- bc.orig/dc/dc.c 2013-06-02 20:32:45.379126266 -0400 +++ bc/dc/dc.c 2013-06-02 20:32:45.379126266 -0400 @@ -45,6 +45,8 @@ # include #endif #include +#include +#include #include "dc.h" #include "dc-proto.h" @@ -248,6 +250,29 @@ return r; } +static void +try_rcfile(void) +{ + char *homedir; + struct passwd *pw; + char *rcfile; + FILE *input; + + homedir=getenv("HOME"); + if (!homedir) + { + pw=getpwuid(getuid()); + homedir=pw->pw_dir; + } + rcfile=malloc(strlen(homedir)+8); + sprintf(rcfile, "%s/.dcrc", homedir); + if (!(input=fopen(rcfile, "r"))) + return; + if (dc_evalfile(input)) + exit(EXIT_FAILURE); + fclose(input); +} + int main DC_DECLARG((argc, argv)) @@ -274,6 +299,8 @@ dc_register_init(); dc_array_init(); + try_rcfile(); + while ((c = getopt_long(argc, argv, "hVe:f:", long_opts, (int *)0)) != EOF) { switch (c) { case 'e': Index: bc/doc/dc.1 =================================================================== --- bc.orig/doc/dc.1 2013-06-02 20:32:45.379126266 -0400 +++ bc/doc/dc.1 2013-06-02 20:32:45.379126266 -0400 @@ -501,6 +501,14 @@ because the 2 was stored in an instance of 0:a that was later popped. .SH +FILES +.TP 15 +~/.dcrc +The commands in this file will be executed when +.I dc +is first run. +.PP +.SH BUGS .PP Email bug reports to debian/patches/03_array_initialize.diff0000664000000000000000000000116712152762211015316 0ustar Description: Fix array initialization bug Author: Phil Nelson Origin: upstream Bug-Debian: http://bugs.debian.org/586969 Bug-Debian: http://bugs.debian.org/671513 --- This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ Index: bc/bc/storage.c =================================================================== --- bc.orig/bc/storage.c 2013-06-02 20:34:09.401273864 -0400 +++ bc/bc/storage.c 2013-06-02 20:34:11.000000000 -0400 @@ -179,7 +179,7 @@ /* Initialize the new elements. */ - for (; indx < v_count; indx++) + for (; indx < a_count; indx++) arrays[indx] = NULL; /* Free the old elements. */ debian/patches/04_info_dircategory.diff0000664000000000000000000000176112141256361015311 0ustar Description: Set the dircategory of info pages to Math Converted from an inline patch introduced in 1.06.95-3 (git commit 9be25538) Author: John G. Hasler Origin: vendor --- This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ Index: bc/doc/bc.texi =================================================================== --- bc.orig/doc/bc.texi 2013-05-03 16:34:41.604415944 -0400 +++ bc/doc/bc.texi 2013-05-03 16:34:49.760617149 -0400 @@ -16,6 +16,7 @@ @c end tex @ifinfo +@dircategory Math @direntry * bc: (bc). An arbitrary precision calculator language. @end direntry Index: bc/doc/dc.texi =================================================================== --- bc.orig/doc/dc.texi 2013-05-03 16:34:41.604415944 -0400 +++ bc/doc/dc.texi 2013-05-03 16:34:50.528636094 -0400 @@ -23,6 +23,7 @@ @syncodeindex tp fn @ifinfo +@dircategory Math @direntry * dc: (dc). Arbitrary precision RPN ``Desktop Calculator''. @end direntry debian/patches/05_notice_read_write_errors.diff0000664000000000000000000004512412152761416017052 0ustar Description: notice read and write errors on input and output Quoting from the bug report: +bc (1.06-19ubuntu1) dapper; urgency=low + + * Make dc notice read and write errors on its input and output. + I grepped for mentions of the strings `putc', `print', `getc', `FILE', + `stdin', `stdout' and `stderr' and added calls to new error-checking + functions unless it was clear from the immediately-surrounding code + that the program was exiting nonzero, or would exit nonzero if the + call failed. I ignored hits in lib/getopt*, which seems to + pervasively ignore write errors when printing usage messages, in the + hope that these were correct. I _think_ I got them all. -iwj. + + -- Ian Jackson Tue, 4 Apr 2006 17:21:02 +0100 Author: Ian Jackson Origin: other Bug-Debian: http://bugs.debian.org/488735 --- This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ diff --git a/bc/execute.c b/bc/execute.c index e4e8ef7..8787048 100644 --- a/bc/execute.c +++ b/bc/execute.c @@ -108,6 +108,7 @@ execute () } out_char ('\n'); } + checkferror_output(stdout); } #endif @@ -222,6 +223,7 @@ execute () } } fflush (stdout); + checkferror_output(stdout); break; case 'R' : /* Return from function */ @@ -257,6 +259,7 @@ execute () if (inst == 'W') out_char ('\n'); store_var (4); /* Special variable "last". */ fflush (stdout); + checkferror_output(stdout); pop (); break; @@ -338,6 +341,7 @@ execute () case 'w' : /* Write a string to the output. */ while ((ch = byte(&pc)) != '"') out_schar (ch); fflush (stdout); + checkferror_output(stdout); break; case 'x' : /* Exchange Top of Stack with the one under the tos. */ @@ -545,7 +549,10 @@ execute () { signal (SIGINT, use_quit); if (had_sigint) - printf ("\ninterrupted execution.\n"); + { + printf ("\ninterrupted execution.\n"); + checkferror_output(stdout); + } } } @@ -580,6 +587,7 @@ input_char () out_col = 0; /* Saw a new line */ } } + checkferror_input(stdin); /* Classify and preprocess the input character. */ if (isdigit(in_ch)) diff --git a/bc/load.c b/bc/load.c index 1035198..4039e86 100644 --- a/bc/load.c +++ b/bc/load.c @@ -217,6 +217,7 @@ load_code (code) if (label_no > 65535L) { /* Better message? */ fprintf (stderr,"Program too big.\n"); + checkferror_output(stderr); exit(1); } addbyte ( (char) (label_no & 0xFF)); diff --git a/bc/main.c b/bc/main.c index 9a2461e..3ae427d 100644 --- a/bc/main.c +++ b/bc/main.c @@ -358,6 +358,9 @@ use_quit (sig) errno = save; #else write (1, "\n(interrupt) Exiting bc.\n", 26); +#ifdef READLINE + rl_initialize (); /* Clear readline buffer */ +#endif #if defined(LIBEDIT) if (edit != NULL) el_end(edit); diff --git a/bc/sbc.y b/bc/sbc.y index 0ded29e..6fcc1fa 100644 --- a/bc/sbc.y +++ b/bc/sbc.y @@ -86,7 +86,9 @@ program : /* empty */ if (interactive && !quiet) { show_bc_version (); + checkferror_output(stdout); welcome (); + checkferror_output(stdout); } } | program input_item diff --git a/bc/scan.c b/bc/scan.c index 1f78ec2..2b5eeb4 100644 --- a/bc/scan.c +++ b/bc/scan.c @@ -799,6 +799,7 @@ bcel_input (buf, result, max) if (bcel_len != 0) history (hist, &histev, H_ENTER, bcel_line); fflush (stdout); + checkferror_output(stdout); } if (bcel_len <= max) @@ -874,6 +875,7 @@ rl_input (buf, result, max) add_history (rl_line); rl_line[rl_len-1] = '\n'; fflush (stdout); + checkferror_output(stdout); } if (rl_len <= max) diff --git a/bc/scan.l b/bc/scan.l index 841c3df..16cd62e 100644 --- a/bc/scan.l +++ b/bc/scan.l @@ -111,6 +111,7 @@ bcel_input (buf, result, max) if (bcel_len != 0) history (hist, &histev, H_ENTER, bcel_line); fflush (stdout); + checkferror_output(stdout); } if (bcel_len <= max) @@ -186,6 +187,7 @@ rl_input (buf, result, max) add_history (rl_line); rl_line[rl_len-1] = '\n'; fflush (stdout); + checkferror_output(stdout); } if (rl_len <= max) @@ -310,6 +312,7 @@ limits return(Limits); if (c == EOF) { fprintf (stderr,"EOF encountered in a comment.\n"); + checkferror_output(stderr); break; } } diff --git a/bc/storage.c b/bc/storage.c index 699729a..37b4c6c 100644 --- a/bc/storage.c +++ b/bc/storage.c @@ -99,6 +99,7 @@ more_functions (VOID) { f = &functions[indx]; f->f_defined = FALSE; + f->f_void = FALSE; f->f_body = (char *) bc_malloc (BC_START_SIZE); f->f_body_size = BC_START_SIZE; f->f_code_size = 0; diff --git a/bc/util.c b/bc/util.c index 30beaf9..669235f 100644 --- a/bc/util.c +++ b/bc/util.c @@ -260,9 +260,10 @@ init_gen () continue_label = 0; next_label = 1; out_count = 2; - if (compile_only) + if (compile_only) { printf ("@i"); - else + checkferror_output(stdout); + } else init_load (); had_error = FALSE; did_gen = FALSE; @@ -286,6 +287,7 @@ generate (str) printf ("\n"); out_count = 0; } + checkferror_output(stdout); } else load_code (str); @@ -303,6 +305,7 @@ run_code() if (compile_only) { printf ("@r\n"); + checkferror_output(stdout); out_count = 0; } else @@ -341,6 +344,7 @@ out_char (ch) } putchar (ch); } + checkferror_output(stdout); } /* Output routines: Write a character CH to the standard output. @@ -371,6 +375,7 @@ out_schar (ch) } putchar (ch); } + checkferror_output(stdout); } @@ -657,6 +662,7 @@ limits() #ifdef OLD_EQ_OP printf ("Old assignment operatiors are valid. (=-, =+, ...)\n"); #endif + checkferror_output(stdout); } /* bc_malloc will check the return value so all other places do not @@ -721,6 +727,7 @@ yyerror (str, va_alist) fprintf (stderr,"%s %d: ",name,line_no); vfprintf (stderr, str, args); fprintf (stderr, "\n"); + checkferror_output(stderr); had_error = TRUE; va_end (args); } @@ -761,6 +768,7 @@ warn (mesg, va_alist) fprintf (stderr,"%s %d: Error: ",name,line_no); vfprintf (stderr, mesg, args); fprintf (stderr, "\n"); + checkferror_output(stderr); had_error = TRUE; } else @@ -773,6 +781,7 @@ warn (mesg, va_alist) fprintf (stderr,"%s %d: (Warning) ",name,line_no); vfprintf (stderr, mesg, args); fprintf (stderr, "\n"); + checkferror_output(stderr); } va_end (args); } @@ -807,6 +816,7 @@ rt_error (mesg, va_alist) va_end (args); fprintf (stderr, "\n"); + checkferror_output(stderr); runtime_error = TRUE; } @@ -843,4 +853,5 @@ rt_warn (mesg, va_alist) va_end (args); fprintf (stderr, "\n"); + checkferror_output(stderr); } diff --git a/dc/dc.c b/dc/dc.c index e03f094..0faf03a 100644 --- a/dc/dc.c +++ b/dc/dc.c @@ -61,6 +61,7 @@ static void bug_report_info DC_DECLVOID() { printf("Email bug reports to: bug-dc@gnu.org .\n"); + checkferror_output(stdout); } static void @@ -71,6 +72,7 @@ show_version DC_DECLVOID() This is free software; see the source for copying conditions. There is NO\n\ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE,\n\ to the extent permitted by law.\n", DC_COPYRIGHT); + checkferror_output(stdout); } /* your generic usage function */ @@ -87,6 +89,7 @@ Usage: %s [OPTION] [file ...]\n\ \n\ ", progname); bug_report_info(); + checkferror_output(f); } /* returns a pointer to one past the last occurance of c in s, diff --git a/dc/eval.c b/dc/eval.c index 4af7200..153d331 100644 --- a/dc/eval.c +++ b/dc/eval.c @@ -94,12 +94,15 @@ static int input_pushback; static int input_fil DC_DECLVOID() { + int c; if (input_pushback != EOF){ - int c = input_pushback; + c = input_pushback; input_pushback = EOF; return c; } - return getc(input_fil_fp); + c = getc(input_fil_fp); + checkferror_input(input_fil_fp); + return c; } /* passed as an argument to dc_getnum */ @@ -298,11 +301,13 @@ dc_func DC_DECLARG((c, peekc, negcmp)) tmpint = dc_num2int(datum.v.number, DC_TOSS); if (2 <= tmpint && tmpint <= DC_IBASE_MAX) dc_ibase = tmpint; - else + else { fprintf(stderr, "%s: input base must be a number \ between 2 and %d (inclusive)\n", progname, DC_IBASE_MAX); + checkferror_output(stderr); + } } break; case 'k': /* set scale to value on top of stack */ @@ -310,11 +315,12 @@ between 2 and %d (inclusive)\n", tmpint = -1; if (datum.dc_type == DC_NUMBER) tmpint = dc_num2int(datum.v.number, DC_TOSS); - if ( ! (tmpint >= 0) ) + if ( ! (tmpint >= 0) ) { fprintf(stderr, "%s: scale must be a nonnegative number\n", progname); - else + checkferror_output(stderr); + } else dc_scale = tmpint; } break; @@ -338,11 +344,12 @@ between 2 and %d (inclusive)\n", tmpint = 0; if (datum.dc_type == DC_NUMBER) tmpint = dc_num2int(datum.v.number, DC_TOSS); - if ( ! (tmpint > 1) ) + if ( ! (tmpint > 1) ) { fprintf(stderr, "%s: output base must be a number greater than 1\n", progname); - else + checkferror_output(stderr); + } else dc_obase = tmpint; } break; @@ -383,6 +390,7 @@ between 2 and %d (inclusive)\n", fprintf(stderr, "%s: square root of nonnumeric attempted\n", progname); + checkferror_output(stderr); }else if (dc_sqrt(datum.v.number, dc_scale, &tmpnum) == DC_SUCCESS){ dc_free_num(&datum.v.number); datum.v.number = tmpnum; @@ -444,6 +452,7 @@ between 2 and %d (inclusive)\n", fprintf(stderr, "%s: Q command requires a number >= 1\n", progname); + checkferror_output(stderr); } break; #if 0 @@ -489,11 +498,12 @@ between 2 and %d (inclusive)\n", if (datum.dc_type == DC_NUMBER) tmpint = dc_num2int(datum.v.number, DC_TOSS); if (dc_pop(&datum) == DC_SUCCESS){ - if (tmpint < 0) + if (tmpint < 0) { fprintf(stderr, "%s: array index must be a nonnegative integer\n", progname); - else + checkferror_output(stderr); + } else dc_array_set(peekc, tmpint, datum); } } @@ -505,17 +515,19 @@ between 2 and %d (inclusive)\n", tmpint = -1; if (datum.dc_type == DC_NUMBER) tmpint = dc_num2int(datum.v.number, DC_TOSS); - if (tmpint < 0) + if (tmpint < 0) { fprintf(stderr, "%s: array index must be a nonnegative integer\n", progname); - else + checkferror_output(stderr); + } else dc_push(dc_array_get(peekc, tmpint)); } return DC_EATONE; default: /* What did that user mean? */ fprintf(stderr, "%s: ", progname); + checkferror_output(stderr); dc_show_id(stdout, c, " unimplemented\n"); break; } @@ -544,6 +556,7 @@ dc_evalstr DC_DECLARG((string)) fprintf(stderr, "%s: eval called with non-string argument\n", progname); + checkferror_output(stderr); return DC_OKAY; } interrupt_seen = 0; @@ -640,6 +653,7 @@ dc_evalstr DC_DECLARG((string)) return DC_FAIL; } fprintf(stderr, "%s: unexpected EOS\n", progname); + checkferror_output(stderr); return DC_OKAY; } } @@ -665,6 +679,7 @@ dc_evalfile DC_DECLARG((fp)) stdin_lookahead = EOF; for (c=getc(fp); c!=EOF; c=peekc){ peekc = getc(fp); + checkferror_input(stdin); /* * The following if() is the only place where ``stdin_lookahead'' * might be set to other than EOF: @@ -716,6 +731,7 @@ dc_evalfile DC_DECLARG((fp)) return DC_SUCCESS; fprintf(stderr, "%s: Q command argument exceeded \ string execution depth\n", progname); + checkferror_output(stderr); } }else{ dc_garbage("at top of stack", -1); @@ -728,8 +744,11 @@ string execution depth\n", progname); fprintf(stderr, "%s: Q command argument exceeded string execution depth\n", progname); - if (stdin_lookahead != peekc && fp == stdin) + checkferror_output(stderr); + if (stdin_lookahead != peekc && fp == stdin) { peekc = getc(fp); + checkferror_input(stdin); + } break; case DC_INT: @@ -771,6 +790,7 @@ string execution depth\n", progname); if (ferror(fp)) goto error_fail; fprintf(stderr, "%s: unexpected EOF\n", progname); + checkferror_output(stderr); return DC_FAIL; } } diff --git a/dc/misc.c b/dc/misc.c index f2388b0..1be56fe 100644 --- a/dc/misc.c +++ b/dc/misc.c @@ -91,6 +91,7 @@ dc_show_id DC_DECLARG((fp, id, suffix)) fprintf(fp, "'%c' (%#o)%s", (unsigned int) id, id, suffix); else fprintf(fp, "%#o%s", (unsigned int) id, suffix); + checkferror_output(fp); } diff --git a/dc/numeric.c b/dc/numeric.c index 8e5e70f..c875eba 100644 --- a/dc/numeric.c +++ b/dc/numeric.c @@ -134,6 +134,7 @@ dc_div DC_DECLARG((a, b, kscale, result)) bc_init_num(CastNumPtr(result)); if (bc_divide(CastNum(a), CastNum(b), CastNumPtr(result), kscale)){ fprintf(stderr, "%s: divide by zero\n", progname); + checkferror_output(stderr); return DC_DOMAIN_ERROR; } return DC_SUCCESS; @@ -156,6 +157,7 @@ dc_divrem DC_DECLARG((a, b, kscale, quotient, remainder)) if (bc_divmod(CastNum(a), CastNum(b), CastNumPtr(quotient), CastNumPtr(remainder), kscale)){ fprintf(stderr, "%s: divide by zero\n", progname); + checkferror_output(stderr); return DC_DOMAIN_ERROR; } return DC_SUCCESS; @@ -174,6 +176,7 @@ dc_rem DC_DECLARG((a, b, kscale, result)) bc_init_num(CastNumPtr(result)); if (bc_modulo(CastNum(a), CastNum(b), CastNumPtr(result), kscale)){ fprintf(stderr, "%s: remainder by zero\n", progname); + checkferror_output(stderr); return DC_DOMAIN_ERROR; } return DC_SUCCESS; @@ -226,6 +229,7 @@ dc_sqrt DC_DECLARG((value, kscale, result)) tmp = bc_copy_num(CastNum(value)); if (!bc_sqrt(&tmp, kscale)){ fprintf(stderr, "%s: square root of negative number\n", progname); + checkferror_output(stderr); bc_free_num(&tmp); return DC_DOMAIN_ERROR; } @@ -429,8 +433,10 @@ dc_out_num DC_DECLARG((value, obase, newline_p, discard_p)) { out_char('\0'); /* clear the column counter */ bc_out_num(CastNum(value), obase, out_char, 0); - if (newline_p == DC_WITHNL) + if (newline_p == DC_WITHNL) { putchar ('\n'); + checkferror_output(stdout); + } if (discard_p == DC_TOSS) dc_free_num(&value); } @@ -475,6 +481,7 @@ dc_dump_num DC_DECLARG((dcvalue, discard_p)) for (cur=top_of_stack; cur; cur=next) { putchar(cur->digit); + checkferror_output(stdout); next = cur->link; free(cur); } @@ -592,6 +599,7 @@ out_char (ch) out_col = 1; } putchar(ch); + checkferror_output(stderr); } } @@ -631,6 +639,7 @@ rt_error (mesg, va_alist) vfprintf (stderr, mesg, args); va_end (args); fprintf (stderr, "\n"); + checkferror_output(stderr); } @@ -664,6 +673,7 @@ rt_warn (mesg, va_alist) vfprintf (stderr, mesg, args); va_end (args); fprintf (stderr, "\n"); + checkferror_output(stderr); } diff --git a/dc/stack.c b/dc/stack.c index 0730e9c..5db3975 100644 --- a/dc/stack.c +++ b/dc/stack.c @@ -38,7 +38,10 @@ #include "dc-regdef.h" /* an oft-used error message: */ -#define Empty_Stack fprintf(stderr, "%s: stack empty\n", progname) +#define Empty_Stack do{ \ + fprintf(stderr, "%s: stack empty\n", progname); \ + checkferror_output(stderr); \ + }while(0) /* simple linked-list implementation suffices: */ @@ -94,6 +97,7 @@ dc_binop DC_DECLARG((op, kscale)) if (dc_stack->value.dc_type!=DC_NUMBER || dc_stack->link->value.dc_type!=DC_NUMBER){ fprintf(stderr, "%s: non-numeric value\n", progname); + checkferror_output(stderr); return; } (void)dc_pop(&b); @@ -134,6 +138,7 @@ dc_binop2 DC_DECLARG((op, kscale)) if (dc_stack->value.dc_type!=DC_NUMBER || dc_stack->link->value.dc_type!=DC_NUMBER){ fprintf(stderr, "%s: non-numeric value\n", progname); + checkferror_output(stderr); return; } (void)dc_pop(&b); @@ -172,6 +177,7 @@ dc_cmpop DC_DECLVOID() if (dc_stack->value.dc_type!=DC_NUMBER || dc_stack->link->value.dc_type!=DC_NUMBER){ fprintf(stderr, "%s: non-numeric value\n", progname); + checkferror_output(stderr); return 0; } (void)dc_pop(&b); @@ -209,6 +215,7 @@ dc_triop DC_DECLARG((op, kscale)) || dc_stack->link->value.dc_type!=DC_NUMBER || dc_stack->link->link->value.dc_type!=DC_NUMBER){ fprintf(stderr, "%s: non-numeric value\n", progname); + checkferror_output(stderr); return; } (void)dc_pop(&c); @@ -327,6 +334,7 @@ dc_register_get DC_DECLARG((regid, result)) r = dc_register[regid]; if (r==NULL || r->value.dc_type==DC_UNINITIALIZED){ fprintf(stderr, "%s: register ", progname); + checkferror_output(stderr); dc_show_id(stderr, regid, " is empty\n"); return DC_FAIL; } @@ -401,6 +409,7 @@ dc_register_pop DC_DECLARG((stackid, result)) r = dc_register[stackid]; if (r == NULL){ fprintf(stderr, "%s: stack register ", progname); + checkferror_output(stderr); dc_show_id(stderr, stackid, " is empty\n"); return DC_FAIL; } diff --git a/dc/string.c b/dc/string.c index ff1e7f1..e24092d 100644 --- a/dc/string.c +++ b/dc/string.c @@ -101,6 +101,7 @@ dc_out_str DC_DECLARG((value, newline, discard_flag)) fwrite(value->s_ptr, value->s_len, sizeof *value->s_ptr, stdout); if (newline == DC_WITHNL) putchar('\n'); + checkferror_output(stdout); if (discard_flag == DC_TOSS) dc_free_str(&value); } @@ -176,6 +177,7 @@ dc_readstring DC_DECLARG((fp, ldelim, rdelim)) } *p++ = c; } + checkferror_input(fp); return dc_makestring(line_buf, (size_t)(p-line_buf)); } diff --git a/h/number.h b/h/number.h index 9b034b6..3a00a92 100644 --- a/h/number.h +++ b/h/number.h @@ -150,4 +150,7 @@ _PROTOTYPE(int bc_sqrt, (bc_num *num, int scale)); _PROTOTYPE(void bc_out_num, (bc_num num, int o_base, void (* out_char)(int), int leading_zero)); +_PROTOTYPE(void checkferror_input, (FILE*)); +_PROTOTYPE(void checkferror_output, (FILE*)); + #endif diff --git a/lib/number.c b/lib/number.c index e211840..4d3ce46 100644 --- a/lib/number.c +++ b/lib/number.c @@ -1776,6 +1776,7 @@ static void out_char (int c) { putchar(c); + checkferror_output(stdout); } @@ -1785,6 +1786,7 @@ pn (num) { bc_out_num (num, 10, out_char, 0); out_char ('\n'); + checkferror_output(stdout); } @@ -1799,6 +1801,28 @@ pv (name, num, len) printf ("%s=", name); for (i=0; i