Release calc version 2.11.5.5

This commit is contained in:
Landon Curt Noll
2001-12-10 19:20:46 -08:00
parent 86e0f98c8f
commit a6e226fa80
14 changed files with 210 additions and 5770 deletions

22
BUGS
View File

@@ -74,6 +74,24 @@ Known bugs:
Problems with known work-a-rounds: Problems with known work-a-rounds:
* The gcc as shipped with Redhat 7 perhaps other Linux distributions
has a bug causes calc to dump core on startup of it is
compiled BOTH optimized (-O, -O1, -O2 or -O3) as well as
with debugging (-g or -g3.
On Redhat, the gcc -v which has this problem is:
gcc version 2.96 20000731 (Red Hat Linux 7.1 2.96-85)
there may be other gcc versions that also suffer this fate.
The work-a-round is to change the DEBUG Makefile variable to either:
compile for speed: -O3
compile to debug: -g3
but not both.
* There is a bug in gcc-2.95 that causes calc, when compiled with -O2, * There is a bug in gcc-2.95 that causes calc, when compiled with -O2,
to fail the regression test. The work-a-round is to compile with -O to fail the regression test. The work-a-round is to compile with -O
or to use gcc-2.96 or later. or to use gcc-2.96 or later.
@@ -241,8 +259,8 @@ Problems with known work-a-rounds:
## received a copy with calc; if not, write to Free Software Foundation, Inc. ## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. ## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
## ##
## @(#) $Revision: 29.12 $ ## @(#) $Revision: 29.14 $
## @(#) $Id: BUGS,v 29.12 2001/06/01 11:32:01 chongo Exp $ ## @(#) $Id: BUGS,v 29.14 2001/12/11 03:18:21 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/RCS/BUGS,v $ ## @(#) $Source: /usr/local/src/cmd/calc/RCS/BUGS,v $
## ##
## Under source code control: 1994/03/18 14:06:13 ## Under source code control: 1994/03/18 14:06:13

36
CHANGES
View File

@@ -1,4 +1,26 @@
The following are the changes from calc version 2.11.5t4.1 to date: The following are the changes from calc version 2.11.5.5 to date:
Now using version numbers of one of these forms:
x.y.z.w
x.y.z
x.y
Changed the READLINE_LIB Makefile variable to not link with -lreadline
by default. If you do have readline, we recommend that you use it.
If you can install the GNU readline:
http://freshmeat.net/projects/gnureadline/
http://cnswww.cns.cwru.edu/php/chet/readline/rltop.html
we recommend it. But if not, you should set the USE_READLINE,
READLINE_LIB, and READLINE_INCLUDE Makefile variables to empty.
Calc compiles without -g or -g3 by default use to recent gcc
bugs related to -O* and -g*. *sigh*
The following are the changes from calc version 2.11.5t4.1 to 2.11.5t4.4:
Updated dependency rules in Makefiles. Updated dependency rules in Makefiles.
@@ -60,9 +82,9 @@ The following are the changes from calc version 2.11.5t4.1 to date:
Makefile has not changed. The Makefile.linux only in minor ways Makefile has not changed. The Makefile.linux only in minor ways
needed to build calc rpms. needed to build calc rpms.
Added $T Makefile variable, top level directory under which calc Added $T Makefile variable. $T is the top level directory under
will be installed. The calc install is performed under $T, the which calc will be installed. The calc install is performed under $T,
calc build is performed under /. The purpose for $T is to allow the calc build is performed under /. The purpose for $T is to allow
someone to install calc somewhere other than into the system area. someone to install calc somewhere other than into the system area.
For examplewhen forming the calc rpm, the Makefile is called with For examplewhen forming the calc rpm, the Makefile is called with
T=$RPM_BUILD_ROOT. If $T is empty, calc is installed under /. T=$RPM_BUILD_ROOT. If $T is empty, calc is installed under /.
@@ -204,7 +226,7 @@ The following are the changes from calc version 2.11.5t0 to 2.11.5t1.1:
An effort was made to make calc easier to build under Windoz An effort was made to make calc easier to build under Windoz
using the Cygwin project (http://sources.redhat.com/cygwin/). using the Cygwin project (http://sources.redhat.com/cygwin/).
Thanks to the work of Thomas Jones-Low (tjoneslo and softstart Thanks to the work of Thomas Jones-Low (tjoneslo at softstart
dot com), a number of #if defined(_WIN32)'s have been added dot com), a number of #if defined(_WIN32)'s have been added
to calc source. These changes should not effect Windoz to calc source. These changes should not effect Windoz
free system such as GNU/Linux, Solaris, POSIX-like, etc ... free system such as GNU/Linux, Solaris, POSIX-like, etc ...
@@ -5358,8 +5380,8 @@ Following is a list of visible changes to calc from version 1.24.7 to 1.26.1:
## received a copy with calc; if not, write to Free Software Foundation, Inc. ## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. ## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
## ##
## @(#) $Revision: 29.39 $ ## @(#) $Revision: 29.42 $
## @(#) $Id: CHANGES,v 29.39 2001/06/08 22:32:42 chongo Exp $ ## @(#) $Id: CHANGES,v 29.42 2001/12/11 02:51:00 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/RCS/CHANGES,v $ ## @(#) $Source: /usr/local/src/cmd/calc/RCS/CHANGES,v $
## ##
## Under source code control: 1993/06/02 18:12:57 ## Under source code control: 1993/06/02 18:12:57

View File

@@ -26,6 +26,13 @@ Installing calc in 4 easy steps:
Set BINDIR to the place where calc is installed. As shipped Set BINDIR to the place where calc is installed. As shipped
the Makefile assumes a BINDIR /usr/local/bin. the Makefile assumes a BINDIR /usr/local/bin.
Some compilers (to put it mildly) have bugs. Sometimes the
DEBUG Makefile variable causes the compiler / optimizer to
produce bad code. Other compilers do just fine. If possible
try to use DEBUG=-O3 -g3 (maximum optimization and debug symbols).
If the calc test fails (see step 3), try lowering either the
-O value and/or the -g3. Also try using -Osomething without -g.
Adjust other Makefile variables as needed. Adjust other Makefile variables as needed.
2) build calc: 2) build calc:
@@ -65,8 +72,8 @@ the calc help subsystem. See the README file for details.
## received a copy with calc; if not, write to Free Software Foundation, Inc. ## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. ## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
## ##
## @(#) $Revision: 29.2 $ ## @(#) $Revision: 29.3 $
## @(#) $Id: HOWTO.INSTALL,v 29.2 2000/06/07 14:02:13 chongo Exp $ ## @(#) $Id: HOWTO.INSTALL,v 29.3 2001/12/11 02:51:00 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/RCS/HOWTO.INSTALL,v $ ## @(#) $Source: /usr/local/src/cmd/calc/RCS/HOWTO.INSTALL,v $
## ##
## Under source code control: 1999/09/27 20:48:44 ## Under source code control: 1999/09/27 20:48:44

View File

@@ -20,8 +20,8 @@
# received a copy with calc; if not, write to Free Software Foundation, Inc. # received a copy with calc; if not, write to Free Software Foundation, Inc.
# 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
# #
MAKEFILE_REV= $$Revision: 29.36 $$ MAKEFILE_REV= $$Revision: 29.38 $$
# @(#) $Id: Makefile.ship,v 29.36 2001/06/08 23:00:19 chongo Exp $ # @(#) $Id: Makefile.ship,v 29.38 2001/12/11 02:35:43 chongo Exp $
# @(#) $Source: /usr/local/src/cmd/calc/RCS/Makefile.ship,v $ # @(#) $Source: /usr/local/src/cmd/calc/RCS/Makefile.ship,v $
# #
# Under source code control: 1990/02/15 01:48:41 # Under source code control: 1990/02/15 01:48:41
@@ -672,8 +672,8 @@ CALCRC= ${CSHAREDIR}/startup:~/.calcrc:./.calcinit
USE_READLINE= USE_READLINE=
#USE_READLINE= -DUSE_READLINE #USE_READLINE= -DUSE_READLINE
# #
#READLINE_LIB= READLINE_LIB=
READLINE_LIB= -lreadline -lhistory -lncurses #READLINE_LIB= -lreadline -lhistory -lncurses
#READLINE_LIB= -L/usr/gnu/lib -lreadline -lhistory -lncurses #READLINE_LIB= -L/usr/gnu/lib -lreadline -lhistory -lncurses
#READLINE_LIB= -L/usr/local/lib -lreadline -lhistory -lncurses #READLINE_LIB= -L/usr/local/lib -lreadline -lhistory -lncurses
# #
@@ -700,9 +700,9 @@ CALCPAGER= more
#DEBUG= -O1 -g #DEBUG= -O1 -g
#DEBUG= -O1 -g3 #DEBUG= -O1 -g3
# #
#DEBUG= -O2 DEBUG= -O2
#DEBUG= -O2 -g #DEBUG= -O2 -g
DEBUG= -O2 -g3 #DEBUG= -O2 -g3
#DEBUG= -O2 -ipa #DEBUG= -O2 -ipa
#DEBUG= -O2 -g3 -ipa #DEBUG= -O2 -g3 -ipa
# #
@@ -1322,9 +1322,10 @@ SAMPLE_TARGETS= sample/test_random sample/many_random
CSCRIPT_TARGETS= cscript/mersenne cscript/piforever cscript/plus \ CSCRIPT_TARGETS= cscript/mersenne cscript/piforever cscript/plus \
cscript/square cscript/fproduct cscript/powerterm cscript/square cscript/fproduct cscript/powerterm
# List of miscellaneous files shipped with calc # List of miscellaneous files NOT shipped with calc
# #
MISC= Makefile.linux calc.spec inst_files spec-template rpm.mk.patch NO_SHIP= Makefile.linux calc.spec inst_files spec-template \
rpm.mk.patch rpm.release
# complete list of progs built # complete list of progs built
# #
@@ -1333,7 +1334,7 @@ PROGS= calc ${UTIL_PROGS}
# complete list of targets # complete list of targets
# #
TARGETS= ${LICENSE} ${CALC_LIBS} custom/.all calc sample/.all \ TARGETS= ${LICENSE} ${CALC_LIBS} custom/.all calc sample/.all \
cal/.all help/.all help/builtin cscript/.all calc.1 ${MISC} cal/.all help/.all help/builtin cscript/.all calc.1
### ###
@@ -2919,9 +2920,6 @@ distlist: ${DISTLIST}
for i in ${BUILD_H_SRC} ${BUILD_C_SRC}; do \ for i in ${BUILD_H_SRC} ${BUILD_C_SRC}; do \
echo win32/$$i; \ echo win32/$$i; \
done; \ done; \
for i in ${MISC}; do \
echo $$i; \
done; \
(cd help; ${MAKE} ${HELP_PASSDOWN} $@); \ (cd help; ${MAKE} ${HELP_PASSDOWN} $@); \
(cd cal; ${MAKE} ${CAL_PASSDOWN} $@); \ (cd cal; ${MAKE} ${CAL_PASSDOWN} $@); \
(cd custom; ${MAKE} ${CUSTOM_PASSDOWN} $@); \ (cd custom; ${MAKE} ${CUSTOM_PASSDOWN} $@); \
@@ -3086,11 +3084,12 @@ env:
@echo 'TARGETS=${TARGETS}'; echo '' @echo 'TARGETS=${TARGETS}'; echo ''
@echo '=-=-=-=-= end of major make variable dump =-=-=-=-=' @echo '=-=-=-=-= end of major make variable dump =-=-=-=-='
mkdebug: env version.c mkdebug: env version.c rpm.release
@echo '=-=-=-=-= start of $@ rule =-=-=-=-=' @echo '=-=-=-=-= start of $@ rule =-=-=-=-='
@echo '=-=-=-=-= Determining the source version =-=-=-=-=' @echo '=-=-=-=-= Determining the source version =-=-=-=-='
@${MAKE} -f Makefile Q= V=@ ver_calc @${MAKE} -f Makefile Q= V=@ ver_calc
-@./ver_calc -@./ver_calc
-@./ver_calc -r rpm.release
@echo '=-=-=-=-= Invoking ${MAKE} -f Makefile Q= V=@ all =-=-=-=-=' @echo '=-=-=-=-= Invoking ${MAKE} -f Makefile Q= V=@ all =-=-=-=-='
@${MAKE} -f Makefile Q= V=@ all @${MAKE} -f Makefile Q= V=@ all
@echo '=-=-=-=-= Back to the main Makefile for $@ rule =-=-=-=-=' @echo '=-=-=-=-= Back to the main Makefile for $@ rule =-=-=-=-='
@@ -3099,7 +3098,7 @@ mkdebug: env version.c
@echo '=-=-=-=-= Back to the main Makefile for $@ rule =-=-=-=-=' @echo '=-=-=-=-= Back to the main Makefile for $@ rule =-=-=-=-='
@echo '=-=-=-=-= end of $@ rule =-=-=-=-=' @echo '=-=-=-=-= end of $@ rule =-=-=-=-='
debug: env debug: env rpm.release
@echo '=-=-=-=-= start of $@ rule =-=-=-=-=' @echo '=-=-=-=-= start of $@ rule =-=-=-=-='
@echo '=-=-=-=-= Invoking ${MAKE} -f Makefile Q= V=@ clobber =-=-=-=-=' @echo '=-=-=-=-= Invoking ${MAKE} -f Makefile Q= V=@ clobber =-=-=-=-='
@${MAKE} -f Makefile Q= V=@ clobber @${MAKE} -f Makefile Q= V=@ clobber
@@ -3107,6 +3106,7 @@ debug: env
@echo '=-=-=-=-= Determining the source version =-=-=-=-=' @echo '=-=-=-=-= Determining the source version =-=-=-=-='
@${MAKE} -f Makefile Q= V=@ ver_calc @${MAKE} -f Makefile Q= V=@ ver_calc
-@./ver_calc -@./ver_calc
-@./ver_calc -r rpm.release
@echo '=-=-=-=-= Invoking ${MAKE} -f Makefile Q= V=@ all =-=-=-=-=' @echo '=-=-=-=-= Invoking ${MAKE} -f Makefile Q= V=@ all =-=-=-=-='
@${MAKE} -f Makefile Q= V=@ all @${MAKE} -f Makefile Q= V=@ all
@echo '=-=-=-=-= Determining the binary version =-=-=-=-=' @echo '=-=-=-=-= Determining the binary version =-=-=-=-='
@@ -3157,7 +3157,7 @@ gdb:
# This file is linked to calc-version-rel.spec before the rpm is built. # This file is linked to calc-version-rel.spec before the rpm is built.
# #
calc.spec: spec-template ${MAKE_FILE} help/Makefile cal/Makefile \ calc.spec: spec-template ${MAKE_FILE} help/Makefile cal/Makefile \
custom/Makefile cscript/Makefile ver_calc custom/Makefile cscript/Makefile ver_calc rpm.release
${V} echo '=-=-=-=-= start of $@ rule =-=-=-=-=' ${V} echo '=-=-=-=-= start of $@ rule =-=-=-=-='
${Q}rm -f calc.spec calc.spec.sed ${Q}rm -f calc.spec calc.spec.sed
${Q}echo 's,$${BINDIR},${BINDIR},g' >> calc.spec.sed ${Q}echo 's,$${BINDIR},${BINDIR},g' >> calc.spec.sed
@@ -3185,9 +3185,8 @@ calc.spec: spec-template ${MAKE_FILE} help/Makefile cal/Makefile \
${Q}echo 's,$${MANEXT},${MANEXT},g' >> calc.spec.sed ${Q}echo 's,$${MANEXT},${MANEXT},g' >> calc.spec.sed
${Q}echo 's,$${CHMOD},${CHMOD},g' >> calc.spec.sed ${Q}echo 's,$${CHMOD},${CHMOD},g' >> calc.spec.sed
${Q}echo 's,$${DATE},'`LANG=C date +"%a %b %d %Y"`',g' >> calc.spec.sed ${Q}echo 's,$${DATE},'`LANG=C date +"%a %b %d %Y"`',g' >> calc.spec.sed
${Q}echo 's,$${VER_CALC},'`./ver_calc`',g' >> calc.spec.sed ${Q}echo 's,$${VERSION},'`./ver_calc`',g' >> calc.spec.sed
${Q}echo 's,$${VERSION},'`./ver_calc -v`',g' >> calc.spec.sed ${Q}echo 's,$${REL},'`./ver_calc -R rpm.release`',g' >> calc.spec.sed
${Q}echo 's,$${RELEASE},'`./ver_calc -r`',g' >> calc.spec.sed
${Q}${SED} -f calc.spec.sed < spec-template > calc.spec ${Q}${SED} -f calc.spec.sed < spec-template > calc.spec
${Q}rm -f calc.spec.sed ${Q}rm -f calc.spec.sed
${V} echo '=-=-=-=-= end of $@ rule =-=-=-=-=' ${V} echo '=-=-=-=-= end of $@ rule =-=-=-=-='

File diff suppressed because it is too large Load Diff

6
calc.h
View File

@@ -17,8 +17,8 @@
* received a copy with calc; if not, write to Free Software Foundation, Inc. * received a copy with calc; if not, write to Free Software Foundation, Inc.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
* *
* @(#) $Revision: 29.8 $ * @(#) $Revision: 29.9 $
* @(#) $Id: calc.h,v 29.8 2001/06/08 21:00:58 chongo Exp $ * @(#) $Id: calc.h,v 29.9 2001/12/11 02:28:47 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/calc.h,v $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/calc.h,v $
* *
* Under source code control: 1990/02/15 01:48:31 * Under source code control: 1990/02/15 01:48:31
@@ -258,7 +258,7 @@ extern DLL char *run_state_name(run state);
extern int calc_major_ver; extern int calc_major_ver;
extern int calc_minor_ver; extern int calc_minor_ver;
extern int calc_major_patch; extern int calc_major_patch;
extern char *calc_minor_patch; extern int calc_minor_patch;
extern char *Copyright; extern char *Copyright;
extern DLL char *version(void); extern DLL char *version(void);

View File

@@ -1,60 +0,0 @@
Summary: C-style arbitrary precision calculator
Name: calc
Version: 2.11.5
Release: 4.5
Copyright: LGPL
Group: Applications/Engineering
Source: http://www.isthe.com/chongo/src/calc/calc-2.11.5t4.5.tar.gz
Patch0: rpm.mk.patch
BuildRoot: /var/tmp/%{name}-buildroot
%description
Calc is an interactive calculator which provides for easy large numeric
calculations, but which also can be easily programmed for difficult or
long calculations.
All numbers are represented as fractions with arbitrarily large numerators
and denominators which are always reduced to lowest terms. Real or
exponential format numbers are converted to the equivalent fraction.
One use enter decinal, hex, octal, binary and complex values.
Commands are statements in a C-like language, where each input line is
treated as the body of a procedure. You can define your own functions
by using the 'define' keyword, followed by a function declaration very
similar to C. Calc also comes with a rich set of builtin functions
and calc shell commands.
In addition to numeric global, local and static variables, Calc as
lists, associated arrays, matrices, byte blocks, dymanic strings and
user defined objects.
%prep
%setup -q
%build
make -f Makefile.linux all RPM_OPT_FLAGS="$RPM_OPT_FLAGS"
%install
rm -rf $RPM_BUILD_ROOT
make -f Makefile.linux install RPM_OPT_FLAGS="$RPM_OPT_FLAGS" T="$RPM_BUILD_ROOT"
%clean
rm -rf $RPM_BUILD_ROOT
%files -f install.list
%dir /usr/share/calc
%dir /usr/share/calc/help
%dir /usr/include/calc
%dir /usr/share/calc/custom
%dir /usr/share/calc/custhelp
%dir /usr/include/calc/custom
%dir /usr/bin/cscript
%defattr(-,root,root)
%doc BUGS README COPYING COPYING-LGPL HOWTO.INSTALL
%doc README LIBRARY README.WINDOWS calc.1
%doc help/resource help/errorcodes help/custom_cal help/new_custom
%doc help/cscript help/full
%changelog
* Fri Jun 08 2001 Landon Curt Noll <http://www.isthe.com/chongo/index.html>
- calc version 2.11.5t4.5

View File

@@ -17,8 +17,8 @@
# received a copy with calc; if not, write to Free Software Foundation, Inc. # received a copy with calc; if not, write to Free Software Foundation, Inc.
# 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
# #
# @(#) $Revision: 29.18 $ # @(#) $Revision: 29.20 $
# @(#) $Id: Makefile,v 29.18 2001/06/08 22:38:53 chongo Exp $ # @(#) $Id: Makefile,v 29.20 2001/06/10 19:35:02 chongo Exp $
# @(#) $Source: /usr/local/src/cmd/calc/cscript/RCS/Makefile,v $ # @(#) $Source: /usr/local/src/cmd/calc/cscript/RCS/Makefile,v $
# #
# Under source code control: 1999/11/29 11:10:26 # Under source code control: 1999/11/29 11:10:26
@@ -93,11 +93,11 @@ CMP= cmp
# #
# make detaillist # make detaillist
# #
SCRIPT= 4dsphere fproduct mersenne piforever plus powerterm simple \ SCRIPT= 4dsphere fproduct mersenne piforever plus powerterm \
square simple square
SCRIPT_SRC= 4dsphere.calc fproduct.calc mersenne.calc piforever.calc \ SCRIPT_SRC= 4dsphere.calc fproduct.calc mersenne.calc \
plus.calc powerterm.calc simple.calc square.calc piforever.calc plus.calc powerterm.calc simple.calc square.calc
# These files are found (but not built) in the distribution # These files are found (but not built) in the distribution
# #

View File

@@ -21,9 +21,9 @@ For more info, see:
4dsphere 4dsphere
determine if 6 points lie on the surface of a sphere in R^4 Determine if 6 points lie on the surface of a 4-dimensional sphere in R^4.
usage: 4dsphere x0 y0 z0 w0 x1 y1 z1 w1 ... x5 y5 z5 w5 4dsphere x0 y0 z0 w0 x1 y1 z1 w1 ... x5 y5 z5 w5
x0 y0 z0 w0 point 0 in R^4 x0 y0 z0 w0 point 0 in R^4
x1 y1 z1 w1 point 1 in R^4 x1 y1 z1 w1 point 1 in R^4
@@ -77,8 +77,8 @@ simple
## received a copy with calc; if not, write to Free Software Foundation, Inc. ## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. ## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
## ##
## @(#) $Revision: 29.7 $ ## @(#) $Revision: 29.10 $
## @(#) $Id: README,v 29.7 2001/05/28 23:08:22 chongo Exp $ ## @(#) $Id: README,v 29.10 2001/06/10 19:34:40 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/cscript/RCS/README,v $ ## @(#) $Source: /usr/local/src/cmd/calc/cscript/RCS/README,v $
## ##
## Under source code control: 1999/12/17 10:23:40 ## Under source code control: 1999/12/17 10:23:40

View File

@@ -12,8 +12,7 @@ DESCRIPTION
Calc version strings can be of the form: Calc version strings can be of the form:
x.y.ztw.v x.y.z.w
x.y.ztw
x.y.z x.y.z
x.y x.y
@@ -22,7 +21,7 @@ DESCRIPTION
EXAMPLE EXAMPLE
> version() > version()
"2.11.5t4.1" "2.11.5.4"
LIMITS LIMITS
none none
@@ -49,8 +48,8 @@ SEE ALSO
## received a copy with calc; if not, write to Free Software Foundation, Inc. ## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. ## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
## ##
## @(#) $Revision: 29.2 $ ## @(#) $Revision: 29.3 $
## @(#) $Id: version,v 29.2 2001/05/29 00:43:54 chongo Exp $ ## @(#) $Id: version,v 29.3 2001/06/09 23:32:45 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/version,v $ ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/version,v $
## ##
## Under source code control: 2001/05/28 17:38:01 ## Under source code control: 2001/05/28 17:38:01

View File

@@ -1,456 +0,0 @@
/usr/bin/calc
/usr/bin/cscript/4dsphere
/usr/bin/cscript/fproduct
/usr/bin/cscript/mersenne
/usr/bin/cscript/piforever
/usr/bin/cscript/plus
/usr/bin/cscript/powerterm
/usr/bin/cscript/simple
/usr/bin/cscript/square
/usr/include/calc/align32.h
/usr/include/calc/alloc.h
/usr/include/calc/args.h
/usr/include/calc/blkcpy.h
/usr/include/calc/block.h
/usr/include/calc/byteswap.h
/usr/include/calc/calc.h
/usr/include/calc/calcerr.h
/usr/include/calc/cmath.h
/usr/include/calc/conf.h
/usr/include/calc/config.h
/usr/include/calc/custom.h
/usr/include/calc/endian_calc.h
/usr/include/calc/file.h
/usr/include/calc/fposval.h
/usr/include/calc/func.h
/usr/include/calc/hash.h
/usr/include/calc/have_const.h
/usr/include/calc/have_fpos.h
/usr/include/calc/have_fpos_pos.h
/usr/include/calc/have_getpgid.h
/usr/include/calc/have_getprid.h
/usr/include/calc/have_getsid.h
/usr/include/calc/have_gettime.h
/usr/include/calc/have_malloc.h
/usr/include/calc/have_memmv.h
/usr/include/calc/have_newstr.h
/usr/include/calc/have_offscl.h
/usr/include/calc/have_posscl.h
/usr/include/calc/have_rusage.h
/usr/include/calc/have_stdlib.h
/usr/include/calc/have_strdup.h
/usr/include/calc/have_string.h
/usr/include/calc/have_times.h
/usr/include/calc/have_uid_t.h
/usr/include/calc/have_unistd.h
/usr/include/calc/have_urandom.h
/usr/include/calc/have_ustat.h
/usr/include/calc/hist.h
/usr/include/calc/jump.h
/usr/include/calc/label.h
/usr/include/calc/lib_util.h
/usr/include/calc/longbits.h
/usr/include/calc/longlong.h
/usr/include/calc/math_error.h
/usr/include/calc/md5.h
/usr/include/calc/nametype.h
/usr/include/calc/opcodes.h
/usr/include/calc/prime.h
/usr/include/calc/qmath.h
/usr/include/calc/shs.h
/usr/include/calc/shs1.h
/usr/include/calc/string.h
/usr/include/calc/symbol.h
/usr/include/calc/terminal.h
/usr/include/calc/token.h
/usr/include/calc/value.h
/usr/include/calc/win32dll.h
/usr/include/calc/zmath.h
/usr/include/calc/zrand.h
/usr/include/calc/zrandom.h
/usr/lib/libcalc.a
/usr/share/calc/README
/usr/share/calc/beer.cal
/usr/share/calc/bernoulli.cal
/usr/share/calc/bigprime.cal
/usr/share/calc/bindings
/usr/share/calc/chi.cal
/usr/share/calc/chrem.cal
/usr/share/calc/custhelp/argv
/usr/share/calc/custhelp/devnull
/usr/share/calc/custhelp/help
/usr/share/calc/custhelp/pzasusb8
/usr/share/calc/custhelp/sysinfo
/usr/share/calc/custom/argv.cal
/usr/share/calc/custom/halflen.cal
/usr/share/calc/custom/libcustcalc.a
/usr/share/calc/custom/pzasusb8.cal
/usr/share/calc/deg.cal
/usr/share/calc/ellip.cal
/usr/share/calc/hello.cal
/usr/share/calc/help/COPYING
/usr/share/calc/help/COPYING-LGPL
/usr/share/calc/help/abs
/usr/share/calc/help/access
/usr/share/calc/help/acos
/usr/share/calc/help/acosh
/usr/share/calc/help/acot
/usr/share/calc/help/acoth
/usr/share/calc/help/acsc
/usr/share/calc/help/acsch
/usr/share/calc/help/address
/usr/share/calc/help/agd
/usr/share/calc/help/append
/usr/share/calc/help/appr
/usr/share/calc/help/archive
/usr/share/calc/help/arg
/usr/share/calc/help/argv
/usr/share/calc/help/arrow
/usr/share/calc/help/asec
/usr/share/calc/help/asech
/usr/share/calc/help/asin
/usr/share/calc/help/asinh
/usr/share/calc/help/assign
/usr/share/calc/help/assoc
/usr/share/calc/help/atan
/usr/share/calc/help/atan2
/usr/share/calc/help/atanh
/usr/share/calc/help/avg
/usr/share/calc/help/base
/usr/share/calc/help/bernoulli
/usr/share/calc/help/binding
/usr/share/calc/help/bindings
/usr/share/calc/help/bit
/usr/share/calc/help/blk
/usr/share/calc/help/blkcpy
/usr/share/calc/help/blkfree
/usr/share/calc/help/blocks
/usr/share/calc/help/bround
/usr/share/calc/help/btrunc
/usr/share/calc/help/bug
/usr/share/calc/help/bugs
/usr/share/calc/help/builtin
/usr/share/calc/help/calc_tty
/usr/share/calc/help/calclevel
/usr/share/calc/help/catalan
/usr/share/calc/help/ceil
/usr/share/calc/help/cfappr
/usr/share/calc/help/cfsim
/usr/share/calc/help/change
/usr/share/calc/help/changes
/usr/share/calc/help/char
/usr/share/calc/help/cmdbuf
/usr/share/calc/help/cmp
/usr/share/calc/help/comb
/usr/share/calc/help/command
/usr/share/calc/help/config
/usr/share/calc/help/conj
/usr/share/calc/help/contrib
/usr/share/calc/help/cos
/usr/share/calc/help/cosh
/usr/share/calc/help/cot
/usr/share/calc/help/coth
/usr/share/calc/help/count
/usr/share/calc/help/cp
/usr/share/calc/help/credit
/usr/share/calc/help/csc
/usr/share/calc/help/csch
/usr/share/calc/help/cscript
/usr/share/calc/help/ctime
/usr/share/calc/help/custom
/usr/share/calc/help/custom_cal
/usr/share/calc/help/define
/usr/share/calc/help/delete
/usr/share/calc/help/den
/usr/share/calc/help/dereference
/usr/share/calc/help/det
/usr/share/calc/help/digit
/usr/share/calc/help/digits
/usr/share/calc/help/dp
/usr/share/calc/help/environment
/usr/share/calc/help/epsilon
/usr/share/calc/help/errcount
/usr/share/calc/help/errmax
/usr/share/calc/help/errno
/usr/share/calc/help/error
/usr/share/calc/help/errorcode
/usr/share/calc/help/errorcodes
/usr/share/calc/help/euler
/usr/share/calc/help/eval
/usr/share/calc/help/exp
/usr/share/calc/help/expression
/usr/share/calc/help/fact
/usr/share/calc/help/factor
/usr/share/calc/help/fclose
/usr/share/calc/help/fcnt
/usr/share/calc/help/feof
/usr/share/calc/help/ferror
/usr/share/calc/help/fflush
/usr/share/calc/help/fgetc
/usr/share/calc/help/fgetfield
/usr/share/calc/help/fgetline
/usr/share/calc/help/fgets
/usr/share/calc/help/fgetstr
/usr/share/calc/help/fib
/usr/share/calc/help/file
/usr/share/calc/help/files
/usr/share/calc/help/floor
/usr/share/calc/help/fopen
/usr/share/calc/help/forall
/usr/share/calc/help/fprintf
/usr/share/calc/help/fputc
/usr/share/calc/help/fputs
/usr/share/calc/help/fputstr
/usr/share/calc/help/frac
/usr/share/calc/help/free
/usr/share/calc/help/freebernoulli
/usr/share/calc/help/freeeuler
/usr/share/calc/help/freeglobals
/usr/share/calc/help/freeredc
/usr/share/calc/help/freestatics
/usr/share/calc/help/frem
/usr/share/calc/help/freopen
/usr/share/calc/help/fscan
/usr/share/calc/help/fscanf
/usr/share/calc/help/fseek
/usr/share/calc/help/fsize
/usr/share/calc/help/ftell
/usr/share/calc/help/full
/usr/share/calc/help/gcd
/usr/share/calc/help/gcdrem
/usr/share/calc/help/gd
/usr/share/calc/help/getenv
/usr/share/calc/help/hash
/usr/share/calc/help/head
/usr/share/calc/help/help
/usr/share/calc/help/highbit
/usr/share/calc/help/history
/usr/share/calc/help/hmean
/usr/share/calc/help/hnrmod
/usr/share/calc/help/hypot
/usr/share/calc/help/ilog
/usr/share/calc/help/ilog10
/usr/share/calc/help/ilog2
/usr/share/calc/help/im
/usr/share/calc/help/indices
/usr/share/calc/help/inputlevel
/usr/share/calc/help/insert
/usr/share/calc/help/int
/usr/share/calc/help/interrupt
/usr/share/calc/help/intro
/usr/share/calc/help/inverse
/usr/share/calc/help/iroot
/usr/share/calc/help/isassoc
/usr/share/calc/help/isatty
/usr/share/calc/help/isblk
/usr/share/calc/help/isconfig
/usr/share/calc/help/isdefined
/usr/share/calc/help/iserror
/usr/share/calc/help/iseven
/usr/share/calc/help/isfile
/usr/share/calc/help/ishash
/usr/share/calc/help/isident
/usr/share/calc/help/isint
/usr/share/calc/help/islist
/usr/share/calc/help/ismat
/usr/share/calc/help/ismult
/usr/share/calc/help/isnull
/usr/share/calc/help/isnum
/usr/share/calc/help/isobj
/usr/share/calc/help/isobjtype
/usr/share/calc/help/isodd
/usr/share/calc/help/isprime
/usr/share/calc/help/isptr
/usr/share/calc/help/isqrt
/usr/share/calc/help/isrand
/usr/share/calc/help/israndom
/usr/share/calc/help/isreal
/usr/share/calc/help/isrel
/usr/share/calc/help/issimple
/usr/share/calc/help/issq
/usr/share/calc/help/isstr
/usr/share/calc/help/istype
/usr/share/calc/help/jacobi
/usr/share/calc/help/join
/usr/share/calc/help/lcm
/usr/share/calc/help/lcmfact
/usr/share/calc/help/lfactor
/usr/share/calc/help/libcalc
/usr/share/calc/help/list
/usr/share/calc/help/ln
/usr/share/calc/help/lowbit
/usr/share/calc/help/ltol
/usr/share/calc/help/makelist
/usr/share/calc/help/mat
/usr/share/calc/help/matdim
/usr/share/calc/help/matfill
/usr/share/calc/help/matmax
/usr/share/calc/help/matmin
/usr/share/calc/help/matsum
/usr/share/calc/help/mattrace
/usr/share/calc/help/mattrans
/usr/share/calc/help/max
/usr/share/calc/help/md5
/usr/share/calc/help/memsize
/usr/share/calc/help/meq
/usr/share/calc/help/min
/usr/share/calc/help/minv
/usr/share/calc/help/mmin
/usr/share/calc/help/mne
/usr/share/calc/help/mod
/usr/share/calc/help/modify
/usr/share/calc/help/name
/usr/share/calc/help/near
/usr/share/calc/help/new_custom
/usr/share/calc/help/newerror
/usr/share/calc/help/nextcand
/usr/share/calc/help/nextprime
/usr/share/calc/help/norm
/usr/share/calc/help/null
/usr/share/calc/help/num
/usr/share/calc/help/obj
/usr/share/calc/help/oldvalue
/usr/share/calc/help/operator
/usr/share/calc/help/ord
/usr/share/calc/help/overview
/usr/share/calc/help/param
/usr/share/calc/help/perm
/usr/share/calc/help/pfact
/usr/share/calc/help/pi
/usr/share/calc/help/pix
/usr/share/calc/help/places
/usr/share/calc/help/pmod
/usr/share/calc/help/polar
/usr/share/calc/help/poly
/usr/share/calc/help/pop
/usr/share/calc/help/popcnt
/usr/share/calc/help/power
/usr/share/calc/help/prevcand
/usr/share/calc/help/prevprime
/usr/share/calc/help/printf
/usr/share/calc/help/prompt
/usr/share/calc/help/protect
/usr/share/calc/help/ptest
/usr/share/calc/help/push
/usr/share/calc/help/putenv
/usr/share/calc/help/quo
/usr/share/calc/help/quomod
/usr/share/calc/help/rand
/usr/share/calc/help/randbit
/usr/share/calc/help/random
/usr/share/calc/help/randombit
/usr/share/calc/help/randperm
/usr/share/calc/help/rcin
/usr/share/calc/help/rcmul
/usr/share/calc/help/rcout
/usr/share/calc/help/rcpow
/usr/share/calc/help/rcsq
/usr/share/calc/help/re
/usr/share/calc/help/remove
/usr/share/calc/help/resource
/usr/share/calc/help/reverse
/usr/share/calc/help/rewind
/usr/share/calc/help/rm
/usr/share/calc/help/root
/usr/share/calc/help/round
/usr/share/calc/help/rsearch
/usr/share/calc/help/runtime
/usr/share/calc/help/saveval
/usr/share/calc/help/scale
/usr/share/calc/help/scan
/usr/share/calc/help/scanf
/usr/share/calc/help/script
/usr/share/calc/help/search
/usr/share/calc/help/sec
/usr/share/calc/help/sech
/usr/share/calc/help/seed
/usr/share/calc/help/segment
/usr/share/calc/help/select
/usr/share/calc/help/sgn
/usr/share/calc/help/sha
/usr/share/calc/help/sha1
/usr/share/calc/help/sin
/usr/share/calc/help/sinh
/usr/share/calc/help/size
/usr/share/calc/help/sizeof
/usr/share/calc/help/sleep
/usr/share/calc/help/sort
/usr/share/calc/help/sqrt
/usr/share/calc/help/srand
/usr/share/calc/help/srandom
/usr/share/calc/help/ssq
/usr/share/calc/help/statement
/usr/share/calc/help/str
/usr/share/calc/help/strcat
/usr/share/calc/help/strerror
/usr/share/calc/help/strlen
/usr/share/calc/help/strpos
/usr/share/calc/help/strprintf
/usr/share/calc/help/strscan
/usr/share/calc/help/strscanf
/usr/share/calc/help/substr
/usr/share/calc/help/sum
/usr/share/calc/help/swap
/usr/share/calc/help/system
/usr/share/calc/help/tail
/usr/share/calc/help/tan
/usr/share/calc/help/tanh
/usr/share/calc/help/test
/usr/share/calc/help/time
/usr/share/calc/help/todo
/usr/share/calc/help/trunc
/usr/share/calc/help/type
/usr/share/calc/help/types
/usr/share/calc/help/unexpected
/usr/share/calc/help/usage
/usr/share/calc/help/variable
/usr/share/calc/help/version
/usr/share/calc/help/wishlist
/usr/share/calc/help/xor
/usr/share/calc/intfile.cal
/usr/share/calc/lucas.cal
/usr/share/calc/lucas_chk.cal
/usr/share/calc/lucas_tbl.cal
/usr/share/calc/mersenne.cal
/usr/share/calc/mfactor.cal
/usr/share/calc/mod.cal
/usr/share/calc/natnumset.cal
/usr/share/calc/pell.cal
/usr/share/calc/pi.cal
/usr/share/calc/pix.cal
/usr/share/calc/pollard.cal
/usr/share/calc/poly.cal
/usr/share/calc/prompt.cal
/usr/share/calc/psqrt.cal
/usr/share/calc/qtime.cal
/usr/share/calc/quat.cal
/usr/share/calc/randbitrun.cal
/usr/share/calc/randmprime.cal
/usr/share/calc/randombitrun.cal
/usr/share/calc/randomrun.cal
/usr/share/calc/randrun.cal
/usr/share/calc/regress.cal
/usr/share/calc/seedrandom.cal
/usr/share/calc/solve.cal
/usr/share/calc/sumsq.cal
/usr/share/calc/surd.cal
/usr/share/calc/test1700.cal
/usr/share/calc/test2300.cal
/usr/share/calc/test2600.cal
/usr/share/calc/test2700.cal
/usr/share/calc/test3100.cal
/usr/share/calc/test3300.cal
/usr/share/calc/test3400.cal
/usr/share/calc/test3500.cal
/usr/share/calc/test4000.cal
/usr/share/calc/test4100.cal
/usr/share/calc/test4600.cal
/usr/share/calc/test5100.cal
/usr/share/calc/test5200.cal
/usr/share/calc/test8400.cal
/usr/share/calc/test8500.cal
/usr/share/calc/test8600.cal
/usr/share/calc/unitfrac.cal
/usr/share/calc/varargs.cal
/usr/share/calc/xx_print.cal
/usr/share/man/man1/calc.1

View File

@@ -1,117 +0,0 @@
*** Makefile Fri Jun 8 16:07:27 2001
--- Makefile.linux Fri Jun 8 16:07:27 2001
***************
*** 2,10 ****
#
# calc - arbitrary precision calculator
#
! # (Generic calc makefile)
#
! # Copyright (C) 1999 Landon Curt Noll
#
# Calc is open software; you can redistribute it and/or modify it under
# the terms of the version 2.1 of the GNU Lesser General Public License
--- 2,14 ----
#
# calc - arbitrary precision calculator
#
! # (Linux calc makefile)
#
! # NOTE: The Makefile.linux is the Makefile used to make the calc rpm.
! # It differs from the standard calc Makefile in the ''You may
! # want to change some values below'' section.
! #
! # Copyright (C) 2001 Landon Curt Noll
#
# Calc is open software; you can redistribute it and/or modify it under
# the terms of the version 2.1 of the GNU Lesser General Public License
***************
*** 21,28 ****
# 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
#
MAKEFILE_REV= $$Revision: 29.36 $$
! # @(#) $Id: Makefile.ship,v 29.36 2001/06/08 23:00:19 chongo Exp $
! # @(#) $Source: /usr/local/src/cmd/calc/RCS/Makefile.ship,v $
#
# Under source code control: 1990/02/15 01:48:41
# File existed as early as: before 1990
--- 25,32 ----
# 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
#
MAKEFILE_REV= $$Revision: 29.36 $$
! # @(#) $Id: Makefile.linux,v 29.36 2001/06/08 23:00:19 chongo Exp $
! # @(#) $Source: /usr/local/src/cmd/calc/RCS/Makefile.linux,v $
#
# Under source code control: 1990/02/15 01:48:41
# File existed as early as: before 1990
***************
*** 669,676 ****
#
# If in doubt, set USE_READLINE, READLINE_LIB and READLINE_INCLUDE to nothing.
#
! USE_READLINE=
! #USE_READLINE= -DUSE_READLINE
#
#READLINE_LIB=
READLINE_LIB= -lreadline -lhistory -lncurses
--- 673,680 ----
#
# If in doubt, set USE_READLINE, READLINE_LIB and READLINE_INCLUDE to nothing.
#
! #USE_READLINE=
! USE_READLINE= -DUSE_READLINE
#
#READLINE_LIB=
READLINE_LIB= -lreadline -lhistory -lncurses
***************
*** 683,692 ****
# If $PAGER is not set, use this program to display a help file
#
! CALCPAGER= more
#CALCPAGER= pg
#CALCPAGER= cat
! #CALCPAGER= less
# Debug/Optimize options for ${CC} and ${LCC}
#
--- 687,696 ----
# If $PAGER is not set, use this program to display a help file
#
! #CALCPAGER= more
#CALCPAGER= pg
#CALCPAGER= cat
! CALCPAGER= less
# Debug/Optimize options for ${CC} and ${LCC}
#
***************
*** 702,714 ****
#
#DEBUG= -O2
#DEBUG= -O2 -g
! DEBUG= -O2 -g3
#DEBUG= -O2 -ipa
#DEBUG= -O2 -g3 -ipa
#
#DEBUG= -O3
#DEBUG= -O3 -g
! #DEBUG= -O3 -g3
#DEBUG= -O3 -ipa
#DEBUG= -O3 -g3 -ipa
#
--- 706,718 ----
#
#DEBUG= -O2
#DEBUG= -O2 -g
! #DEBUG= -O2 -g3
#DEBUG= -O2 -ipa
#DEBUG= -O2 -g3 -ipa
#
#DEBUG= -O3
#DEBUG= -O3 -g
! DEBUG= -O3 -g3
#DEBUG= -O3 -ipa
#DEBUG= -O3 -g3 -ipa
#

View File

@@ -1,60 +0,0 @@
Summary: C-style arbitrary precision calculator
Name: calc
Version: ${VERSION}
Release: ${RELEASE}
Copyright: LGPL
Group: Applications/Engineering
Source: http://www.isthe.com/chongo/src/calc/calc-${VER_CALC}.tar.gz
Patch0: rpm.mk.patch
BuildRoot: /var/tmp/%{name}-buildroot
%description
Calc is an interactive calculator which provides for easy large numeric
calculations, but which also can be easily programmed for difficult or
long calculations.
All numbers are represented as fractions with arbitrarily large numerators
and denominators which are always reduced to lowest terms. Real or
exponential format numbers are converted to the equivalent fraction.
One use enter decinal, hex, octal, binary and complex values.
Commands are statements in a C-like language, where each input line is
treated as the body of a procedure. You can define your own functions
by using the 'define' keyword, followed by a function declaration very
similar to C. Calc also comes with a rich set of builtin functions
and calc shell commands.
In addition to numeric global, local and static variables, Calc as
lists, associated arrays, matrices, byte blocks, dymanic strings and
user defined objects.
%prep
%setup -q
%build
make -f Makefile.linux all RPM_OPT_FLAGS="$RPM_OPT_FLAGS"
%install
rm -rf $RPM_BUILD_ROOT
make -f Makefile.linux install RPM_OPT_FLAGS="$RPM_OPT_FLAGS" T="$RPM_BUILD_ROOT"
%clean
rm -rf $RPM_BUILD_ROOT
%files -f install.list
%dir ${CSHAREDIR}
%dir ${HELPDIR}
%dir ${INCDIRCALC}
%dir ${CUSTOMLIBDIR}
%dir ${CUSTOMHELPDIR}
%dir ${CUSTOMINCDIR}
%dir ${SCRIPTDIR}
%defattr(-,root,root)
%doc BUGS README COPYING COPYING-LGPL HOWTO.INSTALL
%doc README LIBRARY README.WINDOWS calc.1
%doc help/resource help/errorcodes help/custom_cal help/new_custom
%doc help/cscript help/full
%changelog
* ${DATE} Landon Curt Noll <http://www.isthe.com/chongo/index.html>
- calc version ${VER_CALC}

150
version.c
View File

@@ -19,8 +19,8 @@
* received a copy with calc; if not, write to Free Software Foundation, Inc. * received a copy with calc; if not, write to Free Software Foundation, Inc.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
* *
* @(#) $Revision: 29.31 $ * @(#) $Revision: 29.34 $
* @(#) $Id: version.c,v 29.31 2001/06/08 22:32:42 chongo Exp $ * @(#) $Id: version.c,v 29.34 2001/12/11 02:54:14 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/version.c,v $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/version.c,v $
* *
* Under source code control: 1990/05/22 11:00:58 * Under source code control: 1990/05/22 11:00:58
@@ -32,6 +32,9 @@
#include <stdio.h> #include <stdio.h>
#include <errno.h>
#include <string.h>
#if defined(CALC_VER) #if defined(CALC_VER)
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h> #include <unistd.h>
@@ -43,7 +46,8 @@ static char *program;
#define MAJOR_VER 2 /* major version */ #define MAJOR_VER 2 /* major version */
#define MINOR_VER 11 /* minor version */ #define MINOR_VER 11 /* minor version */
#define MAJOR_PATCH 5 /* patch level or 0 if no patch */ #define MAJOR_PATCH 5 /* patch level or 0 if no patch */
#define MINOR_PATCH "4.5" /* test number or empty string if no patch */ #define MINOR_PATCH 5 /* test number or 0 if no minor patch */
/* /*
* calc version constants * calc version constants
@@ -51,7 +55,7 @@ static char *program;
int calc_major_ver = MAJOR_VER; int calc_major_ver = MAJOR_VER;
int calc_minor_ver = MINOR_VER; int calc_minor_ver = MINOR_VER;
int calc_major_patch = MAJOR_PATCH; int calc_major_patch = MAJOR_PATCH;
char *calc_minor_patch = MINOR_PATCH; int calc_minor_patch = MINOR_PATCH;
/* /*
@@ -95,7 +99,7 @@ char *Copyright = "\n"
* This function returns a malloced version string. This version * This function returns a malloced version string. This version
* string does not contain the title, just: * string does not contain the title, just:
* *
* x.y.ztw * x.y.z.w
* x.y.z * x.y.z
* x.y * x.y
*/ */
@@ -114,15 +118,17 @@ version(void)
/* /*
* form the version buffer * form the version buffer
*/ */
if (sizeof(MINOR_PATCH) > 1) { if (MINOR_PATCH > 0) {
sprintf(verbuf, snprintf(verbuf, BUFSIZ,
"%d.%d.%dt%s", calc_major_ver, calc_minor_ver, "%d.%d.%d.%d", calc_major_ver, calc_minor_ver,
calc_major_patch, calc_minor_patch); calc_major_patch, calc_minor_patch);
} else if (MAJOR_PATCH > 0) { } else if (MAJOR_PATCH > 0) {
sprintf(verbuf, snprintf(verbuf, BUFSIZ,
"%d.%d.%d", calc_major_ver, calc_minor_ver, calc_major_patch); "%d.%d.%d", calc_major_ver,
calc_minor_ver, calc_major_patch);
} else { } else {
sprintf(verbuf, "%d.%d", calc_major_ver, calc_minor_ver); snprintf(verbuf, BUFSIZ,
"%d.%d", calc_major_ver, calc_minor_ver);
} }
/* /*
@@ -131,7 +137,7 @@ version(void)
stored_version = (char *)malloc(strlen(verbuf)+1); stored_version = (char *)malloc(strlen(verbuf)+1);
if (stored_version == NULL) { if (stored_version == NULL) {
fprintf(stderr, "%s: version formation value\n", program); fprintf(stderr, "%s: version formation value\n", program);
exit(2); exit(1);
} }
strcpy(stored_version, verbuf); strcpy(stored_version, verbuf);
@@ -146,43 +152,69 @@ version(void)
/* /*
* print_rpm_version_release - print the rpm style version-release * print_rpm_version - print just the version string, rpm style
* *
* This function prints a version-release string, rpm style: * This function prints a version string, rpm style:
* *
* x.y.z-w * x.y.z.w-r
* x.y.z-0 * x.y.z-r
* x.y-0 * x.y-r
*
* where 'r' comes from the content of the release file.
*/ */
void void
print_rpm_version_release(void) print_rpm_version(char *release)
{ {
FILE *file; /* open file */
char buf[BUFSIZ+1]; /* release file buffer */
char *p;
/*
* obtain the release
*/
file = fopen(release, "r");
if (file == NULL) {
fprintf(stderr, "%s: cannot open %s: %s\n",
program, release, strerror(errno));
exit(2);
}
buf[BUFSIZ] = '\0';
if (fgets(buf, BUFSIZ, file) == NULL) {
fprintf(stderr, "%s: cannot read %s: %s\n",
program, release, strerror(errno));
exit(3);
}
p = strchr(buf, '\n');
if (p != NULL) {
*p = '\0';
}
/* /*
* form the version buffer * form the version buffer
*/ */
if (sizeof(MINOR_PATCH) > 1) { if (MINOR_PATCH > 0) {
printf("%d.%d.%d-%s\n", calc_major_ver, calc_minor_ver, printf("%d.%d.%d.%d-%s\n", calc_major_ver, calc_minor_ver,
calc_major_patch, calc_minor_patch); calc_major_patch, calc_minor_patch, buf);
} else if (MAJOR_PATCH > 0) { } else if (MAJOR_PATCH > 0) {
printf("%d.%d.%d-0\n", calc_major_ver, calc_minor_ver, printf("%d.%d.%d-%s\n", calc_major_ver, calc_minor_ver,
calc_major_patch); calc_major_patch, buf);
} else { } else {
printf("%d.%d-0\n", calc_major_ver, calc_minor_ver); printf("%d.%d-%s\n", calc_major_ver, calc_minor_ver, buf);
} }
return; return;
} }
/* /*
* print_rpm_version - print just the version string, rpm style * print_rpm_major - print just the major part version string
* *
* This function prints a version string, rpm style: * This function prints the major part version string:
* *
* x.y.z * x.y.z
* x.y * x.y
*/ */
void void
print_rpm_version(void) print_rpm_major(void)
{ {
/* /*
* form the version buffer * form the version buffer
@@ -198,24 +230,45 @@ print_rpm_version(void)
/* /*
* print_rpm_release - print just the release string, rpm style * print_rpm_release - print just the rpm release
* *
* This function prints a release string, rpm style: * This function prints the rpm release:
* *
* w * r
* 0 *
* where 'r' comes from the content of the release file.
*/ */
void void
print_rpm_release(void) print_rpm_release(char *release)
{ {
FILE *file; /* open file */
char buf[BUFSIZ+1]; /* release file buffer */
char *p;
/*
* obtain the release
*/
file = fopen(release, "r");
if (file == NULL) {
fprintf(stderr, "%s: cannot open %s: %s\n",
program, release, strerror(errno));
exit(2);
}
buf[BUFSIZ] = '\0';
if (fgets(buf, BUFSIZ, file) == NULL) {
fprintf(stderr, "%s: cannot read %s: %s\n",
program, release, strerror(errno));
exit(3);
}
p = strchr(buf, '\n');
if (p != NULL) {
*p = '\0';
}
/* /*
* form the version buffer * form the version buffer
*/ */
if (sizeof(MINOR_PATCH) > 1) { printf("%s\n", buf);
printf("%s\n", calc_minor_patch);
} else {
printf("0\n");
}
return; return;
} }
@@ -228,14 +281,23 @@ int
main(int argc, char *argv[]) main(int argc, char *argv[])
{ {
program = argv[0]; program = argv[0];
if (argc == 2 && strcmp(argv[1], "-R") == 0) { if (argc == 3 && strcmp(argv[1], "-r") == 0) {
print_rpm_version_release(); print_rpm_version(argv[2]);
} else if (argc == 2 && strcmp(argv[1], "-v") == 0) {
print_rpm_version(); } else if (argc == 3 && strcmp(argv[1], "-R") == 0) {
} else if (argc == 2 && strcmp(argv[1], "-r") == 0) { print_rpm_release(argv[2]);
print_rpm_release();
} else { } else if (argc == 2 && strcmp(argv[1], "-V") == 0) {
print_rpm_major();
} else if (argc == 1) {
printf("%s\n", version()); printf("%s\n", version());
} else {
fprintf(stderr,
"usage: %s [-V] [-R release_file] [-r release_file]\n",
program);
exit(4);
} }
return 0; return 0;
} }