From 0ef65d232f28eb1aac6724e2fcfaa07135773bf0 Mon Sep 17 00:00:00 2001 From: Zdenek Prikryl Date: Thu, 26 Jul 2007 14:02:50 +0000 Subject: [PATCH] dc accepts the input which contains wrong symbols of radix in same way like bc Resolves: #151844 Added library string.h to remove warnings. --- bc-1.06-dc_ibase.patch | 46 ++++++++++++++++++++++++++++++++++++++++++ bc-1.06-string.patch | 10 +++++++++ bc.spec | 11 +++++++++- 3 files changed, 66 insertions(+), 1 deletion(-) create mode 100644 bc-1.06-dc_ibase.patch create mode 100644 bc-1.06-string.patch diff --git a/bc-1.06-dc_ibase.patch b/bc-1.06-dc_ibase.patch new file mode 100644 index 0000000..aeebd10 --- /dev/null +++ b/bc-1.06-dc_ibase.patch @@ -0,0 +1,46 @@ +--- bc-1.06/dc/numeric.c.dc_ibase 2000-08-31 17:57:42.000000000 +0200 ++++ bc-1.06/dc/numeric.c 2007-07-26 15:47:42.000000000 +0200 +@@ -285,6 +285,8 @@ dc_getnum DC_DECLARG((input, ibase, read + int digit; + int decimal; + int c; ++ int c_buff = 0; ++ int multi = 0; + + bc_init_num(&tmp); + bc_init_num(&build); +@@ -302,6 +304,9 @@ dc_getnum DC_DECLARG((input, ibase, read + } + while (isspace(c)) + c = (*input)(); ++ c_buff = (*input)(); ++ if (isdigit(c_buff) || ('A' <= c_buff && c_buff <= 'F') || c_buff == '.') ++ multi = 1; + for (;;){ + if (isdigit(c)) + digit = c - '0'; +@@ -309,10 +314,15 @@ dc_getnum DC_DECLARG((input, ibase, read + digit = 10 + c - 'A'; + else + break; +- c = (*input)(); ++ digit = multi ? (digit >= ibase ? ibase -1 : digit) : digit; + bc_int2num(&tmp, digit); + bc_multiply(result, base, &result, 0); + bc_add(result, tmp, &result, 0); ++ if (c_buff) { ++ c = c_buff; ++ c_buff = 0; ++ } else ++ c = (*input)(); + } + if (c == '.'){ + bc_free_num(&build); +@@ -328,6 +338,7 @@ dc_getnum DC_DECLARG((input, ibase, read + digit = 10 + c - 'A'; + else + break; ++ digit = digit >= ibase ? ibase -1 : digit; + bc_int2num(&tmp, digit); + bc_multiply(build, base, &build, 0); + bc_add(build, tmp, &build, 0); diff --git a/bc-1.06-string.patch b/bc-1.06-string.patch new file mode 100644 index 0000000..2ec471b --- /dev/null +++ b/bc-1.06-string.patch @@ -0,0 +1,10 @@ +--- bc-1.06/lib/number.c.string 2007-07-26 15:01:34.000000000 +0200 ++++ bc-1.06/lib/number.c 2007-07-26 15:01:41.000000000 +0200 +@@ -34,6 +34,7 @@ + #include + #include + #include ++#include + #include /* Prototypes needed for external utility routines. */ + + #define bc_rt_warn rt_warn diff --git a/bc.spec b/bc.spec index e6f017f..f842140 100644 --- a/bc.spec +++ b/bc.spec @@ -1,7 +1,7 @@ Summary: GNU's bc (a numeric processing language) and dc (a calculator) Name: bc Version: 1.06 -Release: 26 +Release: 27 License: GPL URL: http://www.gnu.org/software/bc/ Group: Applications/Engineering @@ -10,6 +10,8 @@ Patch1: bc-1.06-readline42.patch Patch2: bc-1.06-s390.patch Patch3: bc-1.06-info_exp_bessel.patch Patch4: bc-1.06-flex.patch +Patch5: bc-1.06-string.patch +Patch6: bc-1.06-dc_ibase.patch Requires(post): /sbin/install-info Requires(preun): /sbin/install-info Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) @@ -30,6 +32,8 @@ if you would like to use its text mode calculator. %patch2 -p1 -b .s390 %patch3 -p1 -b .info_exp_bessel %patch4 -p1 -b .flexparameter +%patch5 -p1 -b .string +%patch6 -p1 -b .dc_ibase %build aclocal @@ -66,6 +70,11 @@ exit 0 %{_infodir}/* %changelog +* Thu Jul 26 2007 Zdenek Prikryl 1.06-27 +- dc accepts the input which contains wrong symbols of radix in same way like bc +- Resolves: #151844 +- Added library string.h to remove warnings. + * Mon Feb 26 2007 Thomas Woerner 1.06-26 - removed grep and mktemp usage from post script, also the requires