rpms/bc/devel bc-1.06-dc_ibase.patch, NONE, 1.1 bc-1.06-string.patch, NONE, 1.1 bc.spec, 1.28, 1.29

Zdenek Prikryl (zprikryl) fedora-extras-commits at redhat.com
Thu Jul 26 14:03:23 UTC 2007


Author: zprikryl

Update of /cvs/extras/rpms/bc/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv28655

Modified Files:
	bc.spec 
Added Files:
	bc-1.06-dc_ibase.patch bc-1.06-string.patch 
Log Message:
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:

--- NEW FILE bc-1.06-dc_ibase.patch ---
--- 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);

bc-1.06-string.patch:

--- NEW FILE bc-1.06-string.patch ---
--- 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


Index: bc.spec
===================================================================
RCS file: /cvs/extras/rpms/bc/devel/bc.spec,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -r1.28 -r1.29
--- bc.spec	26 Feb 2007 14:18:11 -0000	1.28
+++ bc.spec	26 Jul 2007 14:02:50 -0000	1.29
@@ -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 @@
 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 @@
 %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 @@
 %{_infodir}/*
 
 %changelog
+* Thu Jul 26 2007 Zdenek Prikryl <zprikryl at 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 at redhat.com> 1.06-26
 - removed grep and mktemp usage from post script, also the requires
 




More information about the fedora-extras-commits mailing list