Accepting request 133894 from Base:System

Automatic submission by obs-autosubmit

OBS-URL: https://build.opensuse.org/request/show/133894
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/bc?expand=0&rev=16
This commit is contained in:
Stephan Kulow 2012-09-17 11:47:45 +00:00 committed by Git OBS Bridge
commit dbaa85ab83
14 changed files with 159 additions and 144 deletions

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

@ -0,0 +1,58 @@
--- bc-1.06/dc/numeric.c.dc_ibase 2007-08-22 08:37:57.000000000 +0200
+++ bc-1.06/dc/numeric.c 2007-08-22 08:37:40.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);
@@ -321,13 +331,18 @@ dc_getnum DC_DECLARG((input, ibase, read
build = bc_copy_num(_zero_);
decimal = 0;
for (;;){
- c = (*input)();
+ if (c_buff) {
+ c = c_buff;
+ c_buff = 0;
+ } else
+ c = (*input)();
if (isdigit(c))
digit = c - '0';
else if ('A' <= c && c <= 'F')
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);

View File

@ -1,10 +0,0 @@
--- bc-1.06/lib/number.c
+++ bc-1.06/lib/number.c
@@ -35,6 +35,7 @@
#include <assert.h>
#include <stdlib.h>
#include <ctype.h>/* Prototypes needed for external utility routines. */
+#include <string.h>
#define bc_rt_warn rt_warn
#define bc_rt_error rt_error

View File

@ -1,11 +0,0 @@
--- ./configure.in 2000-07-08 01:34:09.000000000 +0200
+++ ./configure.in 2004-08-19 12:36:16.000000000 +0200
@@ -68,7 +68,7 @@
])
if test "$LEX" = "flex" ; then
- LEX="flex -I8"
+ LEX="flex -I -8"
else
if test "$bcrl" = "y" ; then
AC_MSG_WARN(readline works only with flex.)

View File

@ -1,20 +0,0 @@
--- bc/bc.y
+++ bc/bc.y
@@ -203,7 +203,7 @@ statement : Warranty
{
if ($4 & 2)
warn ("Comparison in first for expression");
- if ($4 >= 0)
+ if (!($4 & 16))
generate ("p");
$4 = next_label++;
sprintf (genstr, "N%1d:", $4);
@@ -211,7 +211,7 @@ statement : Warranty
}
opt_expression ';'
{
- if ($7 < 0) generate ("1");
+ if ($7 & 16) generate ("1");
$7 = next_label++;
sprintf (genstr, "B%1d:J%1d:", $7, break_label);
generate (genstr);

View File

@ -1,13 +0,0 @@
--- bc-1.06/dc/numeric.c
+++ bc-1.06/dc/numeric.c
@@ -254,8 +254,8 @@
{
dc_data result;
- bc_init_num((bc_num *)&result.v.number);
- bc_int2num((bc_num *)&result.v.number, value);
+ bc_init_num(&result.v.number);
+ bc_int2num(&result.v.number, value);
result.dc_type = DC_NUMBER;
return result;
}

20
bc-1.06.95-matlib.patch Normal file
View File

@ -0,0 +1,20 @@
diff -urNp bc-1.06.95-orig/bc/storage.c bc-1.06.95/bc/storage.c
--- bc-1.06.95-orig/bc/storage.c 2006-09-05 04:39:31.000000000 +0200
+++ bc-1.06.95/bc/storage.c 2010-12-22 10:26:43.805250912 +0100
@@ -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;
@@ -179,7 +180,7 @@ more_arrays ()
/* Initialize the new elements. */
- for (; indx < v_count; indx++)
+ for (; indx < a_count; indx++)
arrays[indx] = NULL;
/* Free the old elements. */

26
bc-1.06.95-memleak.patch Normal file
View File

@ -0,0 +1,26 @@
diff --git a/bc/bc.y b/bc/bc.y
index 14dc4be..bd91c38 100644
--- a/bc/bc.y
+++ b/bc/bc.y
@@ -569,6 +569,7 @@ expression : named_expression ASSIGN_OP
generate (">");
break;
}
+ free($2);
}
| expression '+' expression
{
diff --git a/bc/util.c b/bc/util.c
index 30beaf9..26e2e85 100644
--- a/bc/util.c
+++ b/bc/util.c
@@ -602,8 +602,7 @@ lookup (name, namekind)
case FUNCTDEF:
if (id->f_name != 0)
{
- if (namekind != FUNCT)
- free(name);
+ free(name);
/* Check to see if we are redefining a math lib function. */
if (use_math && namekind == FUNCTDEF && id->f_name <= 6)
id->f_name = next_func++;

View File

@ -0,0 +1,27 @@
Binary files bc-1.06.95-orig/dc/.dc.c.swp and bc-1.06.95/dc/.dc.c.swp differ
diff -urNp bc-1.06.95-orig/dc/eval.c bc-1.06.95/dc/eval.c
--- bc-1.06.95-orig/dc/eval.c 2006-06-04 13:04:40.000000000 +0200
+++ bc-1.06.95/dc/eval.c 2011-09-08 15:11:48.815060585 +0200
@@ -661,7 +661,9 @@ dc_evalfile DC_DECLARG((fp))
int next_negcmp = 0;
dc_data datum;
- signal(SIGINT, dc_trap_interrupt);
+ /* Do not mask SIGINT when running from stdin */
+ if (fp != stdin)
+ signal(SIGINT, dc_trap_interrupt);
stdin_lookahead = EOF;
for (c=getc(fp); c!=EOF; c=peekc){
peekc = getc(fp);
diff -urNp bc-1.06.95-orig/doc/dc.texi bc-1.06.95/doc/dc.texi
--- bc-1.06.95-orig/doc/dc.texi 2006-06-11 10:15:54.000000000 +0200
+++ bc-1.06.95/doc/dc.texi 2011-09-08 15:09:37.032059798 +0200
@@ -126,6 +126,8 @@ To exit, use @samp{q}.
(or whatever other keystroke your system uses to generate a @code{SIGINT})
does not exit;
it is used to abort macros that are looping, etc.
+This is not true if running on stdin to prevent accidental user confusion
+about @kbd{C-c} unfunctionality.
A reverse-polish calculator stores numbers on a stack.
Entering a number pushes it on the stack.

3
bc-1.06.95.tar.bz2 Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:7ee4abbcfac03d8a6e1a8a3440558a3d239d6b858585063e745c760957725ecc
size 290069

View File

@ -1,55 +0,0 @@
--- bc/load.c
+++ bc/load.c
@@ -156,7 +156,7 @@
long label_no;
long vaf_name; /* variable, array or function number. */
long func;
- program_counter save_adr;
+ program_counter save_adr = { 0, 0 };;
/* Initialize. */
str = code;
--- bc/scan.l
+++ bc/scan.l
@@ -143,7 +143,7 @@
/* Definitions for readline access. */
extern FILE *rl_instream;
-_PROTOTYPE(char *readline, (char *));
+/* _PROTOTYPE(char *readline, (char *)); */
/* rl_input puts upto MAX characters into BUF with the number put in
BUF placed in *RESULT. If the yy input file is the same as
--- bc/util.c
+++ bc/util.c
@@ -423,7 +423,7 @@
case 0: /* no height increase. */
return (FALSE);
case -1: /* height increase. */
- return (FALSE);
+ return (TRUE);
case -2: /* we need to do a rebalancing act. */
A = *root;
B = (*root)->left;
@@ -476,7 +476,7 @@
case 0: /* no height increase. */
return (FALSE);
case 1: /* height increase. */
- return (FALSE);
+ return (TRUE);
case 2: /* we need to do a rebalancing act. */
A = *root;
B = (*root)->right;
--- doc/bc.info
+++ doc/bc.info
@@ -1,5 +1,10 @@
This is bc.info, produced by makeinfo version 4.0 from bc.texi.
+START-INFO-DIR-ENTRY
+* bc: (bc). An arbritrary precision calculator language
+END-INFO-DIR-ENTRY
+
+

File: bc.info, Node: Top, Next: Introduction, Prev: (dir), Up: (dir)

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:250595f87ff5aa8ce91eb09f14efb19f9b9087999a8cf5751ceff8f4b4b63f21
size 230980

View File

@ -1,12 +0,0 @@
--- bc/main.c
+++ bc/main.c
@@ -93,6 +93,9 @@ parse_args (argc, argv)
switch (optch)
{
+ case 0: /* long option */
+ break;
+
case 'c': /* compile only */
compile_only = TRUE;
break;

View File

@ -1,3 +1,11 @@
-------------------------------------------------------------------
Thu May 31 12:56:27 UTC 2012 - sweet_f_a@gmx.de
- update to upstream alpha 1.06.95 (2006-09-05), in use in other
major distros for quite a long time (Debian, Fedora, Ubuntu, ...)
- add patches from Fedora
- automake dependency removed
-------------------------------------------------------------------
Wed Nov 30 09:29:51 UTC 2011 - coolo@suse.com

37
bc.spec
View File

@ -1,7 +1,7 @@
#
# spec file for package bc
#
# Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany.
# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -16,23 +16,23 @@
#
Name: bc
BuildRequires: automake bison ed flex readline-devel
BuildRequires: bison
BuildRequires: ed
BuildRequires: flex
BuildRequires: readline-devel
Url: ftp://ftp.gnu.org/pub/gnu/bc
License: GPL-2.0+
Group: Productivity/Scientific/Math
PreReq: %{install_info_prereq}
Version: 1.06
Version: 1.06.95
Release: 0
Summary: GNU Command Line Calculator
Source: %{name}-%{version}.tar.bz2
Patch: %{name}-%{version}.dif
Patch1: %{name}-%{version}-flex.diff
Patch2: %name-1.06-decl.diff
Patch3: %name-1.06-strict-aliasing.diff
Patch4: %{name}-%{version}_getopt.patch
Patch5: %{name}-%{version}-opt-expression.diff
License: GPL-2.0+
Group: Productivity/Scientific/Math
Source: ftp://alpha.gnu.org/pub/gnu/bc/bc-%{version}.tar.bz2
Patch1: bc-1.06-dc_ibase.patch
Patch2: bc-1.06.95-memleak.patch
Patch3: bc-1.06.95-matlib.patch
Patch4: bc-1.06.95-sigintmasking.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
@ -55,15 +55,12 @@ and "pushes" its results back onto the stack.
%prep
%setup -q
%patch
%patch1
%patch2 -p1
%patch3 -p1
%patch4
%patch5
%patch1 -p1 -b .dc_ibase
%patch2 -p1 -b .memleak
%patch3 -p1 -b .matlib
%patch4 -p1 -b .sigintmask
%build
autoreconf -fi
./configure CFLAGS="$RPM_OPT_FLAGS" \
--with-readline \
--prefix=/usr \