dc accepts the input which contains wrong symbols of radix in same way like

bc Resolves: #151844 Added library string.h to remove warnings.
This commit is contained in:
Zdenek Prikryl 2007-07-26 14:02:50 +00:00
parent c5e5d6bf96
commit 0ef65d232f
3 changed files with 66 additions and 1 deletions

46
bc-1.06-dc_ibase.patch Normal file
View File

@ -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);

10
bc-1.06-string.patch Normal file
View File

@ -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 <number.h>
#include <assert.h>
#include <stdlib.h>
+#include <string.h>
#include <ctype.h>/* Prototypes needed for external utility routines. */
#define bc_rt_warn rt_warn

11
bc.spec
View File

@ -1,7 +1,7 @@
Summary: GNU's bc (a numeric processing language) and dc (a calculator) Summary: GNU's bc (a numeric processing language) and dc (a calculator)
Name: bc Name: bc
Version: 1.06 Version: 1.06
Release: 26 Release: 27
License: GPL License: GPL
URL: http://www.gnu.org/software/bc/ URL: http://www.gnu.org/software/bc/
Group: Applications/Engineering Group: Applications/Engineering
@ -10,6 +10,8 @@ Patch1: bc-1.06-readline42.patch
Patch2: bc-1.06-s390.patch Patch2: bc-1.06-s390.patch
Patch3: bc-1.06-info_exp_bessel.patch Patch3: bc-1.06-info_exp_bessel.patch
Patch4: bc-1.06-flex.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(post): /sbin/install-info
Requires(preun): /sbin/install-info Requires(preun): /sbin/install-info
Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) 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 %patch2 -p1 -b .s390
%patch3 -p1 -b .info_exp_bessel %patch3 -p1 -b .info_exp_bessel
%patch4 -p1 -b .flexparameter %patch4 -p1 -b .flexparameter
%patch5 -p1 -b .string
%patch6 -p1 -b .dc_ibase
%build %build
aclocal aclocal
@ -66,6 +70,11 @@ exit 0
%{_infodir}/* %{_infodir}/*
%changelog %changelog
* Thu Jul 26 2007 Zdenek Prikryl <zprikryl@redhat.com> 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 <twoerner@redhat.com> 1.06-26 * Mon Feb 26 2007 Thomas Woerner <twoerner@redhat.com> 1.06-26
- removed grep and mktemp usage from post script, also the requires - removed grep and mktemp usage from post script, also the requires