From: jrs@world.std.com (Rick Sladkey) Subject: Re: Anyone done bc? Date: Thu, 23 Jul 1992 02:21:31 GMT
>>>>> On 22 Jul 92 20:18:24 GMT, davidsen@ariel.crd.GE.COM (william E
>>>>> Davidsen) said:
bill> Last night using linux I realized how much I use bc. Has anyone done a
bill> port, or is there even a free version? Seems there was a GNU version,
bill> but it may only have been dc.
There is a GNU version available from prep and the others as:
prep.mit.edu:/pub/gnu/bc-1.02.tar.Z
You may want bison and flex although these are not strictly necessary.
The original distribution requires ed but Linux has none so I used awk.
Here is a Linux patch for bc-1.06.tar.Z:
=====
diff -rcN ../bc-1.02/Makefile ./Makefile
*** ../bc-1.02/Makefile Wed Mar 4 18:21:47 1992
--- ./Makefile Wed Jul 22 21:35:21 1992
***************
*** 6,12 ****
#
# LIBDIR and BINDIR are where bc and libmath.b will be put.
#
! PREFIX = /usr/local
LIBDIR = $(PREFIX)/lib
BINDIR = $(PREFIX)/bin
MANDIR = $(PREFIX)/man/man1
--- 6,12 ----
#
# LIBDIR and BINDIR are where bc and libmath.b will be put.
#
! PREFIX = /usr
LIBDIR = $(PREFIX)/lib
BINDIR = $(PREFIX)/bin
MANDIR = $(PREFIX)/man/man1
***************
*** 23,33 ****
# Programs definitions for use by make.
#
SHELL = /bin/sh
! YACC = yacc
! #YACC = bison -y
LEX = flex -I8
#LEX = lex
! CC = cc
UUENCODE = uue
MAKE = make
#
--- 23,33 ----
# Programs definitions for use by make.
#
SHELL = /bin/sh
! #YACC = yacc
! YACC = bison -y
LEX = flex -I8
#LEX = lex
! CC = gcc
UUENCODE = uue
MAKE = make
#
***************
*** 37,43 ****
# README file for more details.
#
O=o
! CFLAGS = -O -D_POSIX_SOURCE
LDFLAGS =
#
# For the PC version of MINIX (K&R compiler), use the following lines.
--- 37,43 ----
# README file for more details.
#
O=o
! CFLAGS = -O2 -D_POSIX_SOURCE
LDFLAGS =
#
# For the PC version of MINIX (K&R compiler), use the following lines.
diff -rcN ../bc-1.02/config.h ./config.h
*** ../bc-1.02/config.h
--- ./config.h Wed Jul 22 21:33:46 1992
***************
*** 0 ****
--- 1 ----
+ /* config.h */
diff -rcN ../bc-1.02/fix_math.h ./fix_math.h
*** ../bc-1.02/fix_math.h Fri Nov 1 21:19:55 1991
--- ./fix_math.h Wed Jul 22 21:53:39 1992
***************
*** 1,8 ****
! ed math.h <<EOS-EOS
! 1,1s/^/"/
! 1,\$s/\$/\\\\/
! \$,\$d
! \$,\$s/\\\\\$/"/
! w
! q
! EOS-EOS
--- 1,14 ----
! awk '
! { line[++n] = $0 }
! END {
! printf "\""
! for (i = 1; i < n; i++) {
! printf "%s", line[i]
! if (i < n - 1)
! printf "\\\n"
! else
! printf "\"\n"
! }
! }
! ' <math.h >new.math.h
! mv new.math.h math.h