General Utilities

This chapter contains various utilities that do not fit conveniently into other chapters. Programs include a command line calculator, several utilities for manipulating text and graphics, and a program to interface with a palm-pilot.

Bc-1.06

Introduction to Bc

The bc package contains an arbitrary precision numeric processing language.

Package Information

User Notes: http://wiki.linuxfromscratch.org/blfs/wiki/bc

Installation of Bc

Install bc by running the following commands:

sed -i '/PROTO.*readline/d' bc/scan.l &&
sed -i '/flex -I8/s/8//' configure &&
sed -i '/stdlib/a #include <string.h>' lib/number.c &&
sed -i 's/program.*save/static &/' bc/load.c &&
./configure --prefix=/usr --with-readline &&
make

To test bc, run the commands below. There is quite a bit of output, so you may want to redirect it to a file. There are a very small percentage of tests (10 of 12,144) that will indicate a roundoff error at the last digit.

echo "quit" | ./bc/bc -l Test/checklib.b

Now, as the root user:

make install

Command Explanations

sed -i '/PROTO.*readline/d' bc/scan.l: This command fixes the Readline library call.

sed -i '/flex -I8/s/8//' configure: This command fixes the Flex invocation.

sed -i '/stdlib/a #include <string.h>' lib/number.c: This command inserts a missing header.

sed -i 's/program.*save/static &/' bc/load.c: This command fixes a segfault when running bc with bc -l.

--with-readline: This option enables Readline support in interactive mode.

Contents

Installed Programs: bc and dc
Installed Libraries: None
Installed Directories: None

Short Descriptions

bc

is a calculator.

dc

is a reverse-polish calculator.

Last updated on 2007-02-14 11:57:11 -0600