From d2cb9c81d55f13ed4837a063b5510ab76b316365 Mon Sep 17 00:00:00 2001 From: Landon Curt Noll Date: Mon, 28 May 2001 15:51:54 -0700 Subject: [PATCH] Release calc version 2.11.5t4 --- CHANGES | 79 ++++- Makefile | 739 ++++++++++++++++++++++++++++------------- cal/Makefile | 70 ++-- codegen.c | 15 +- config.c | 8 +- cscript/Makefile | 76 ++++- cscript/README | 10 +- cscript/powerterm.calc | 185 +++++++++++ custom/Makefile | 190 ++++++++--- help/Makefile | 101 ++++-- help/config | 8 +- help/seed | 8 +- help/srandom | 10 +- opcodes.c | 6 +- sample/Makefile | 56 +++- seed.c | 12 +- spec-template | 98 ++++++ version.c | 92 ++++- zrand.c | 8 +- zrandom.c | 22 +- 20 files changed, 1365 insertions(+), 428 deletions(-) create mode 100644 cscript/powerterm.calc create mode 100644 spec-template diff --git a/CHANGES b/CHANGES index 75b4316..b51759e 100644 --- a/CHANGES +++ b/CHANGES @@ -1,4 +1,71 @@ -The following are the changes from calc version 2.11.5t2 to date: +The following are the changes from calc version 2.11.5t3 to date: + + The Makefile will now send both stdout and sterr to /dev/null + when compiling hsrc intermeriates. + + The config("verbose_quit") value was restored to a default + value of FALSE. + + Added the cscript: + + powerterm [base_limit] value + + to write the value as the sum (or difference) of powers <= base_limit + where base_limit by default is 10000. + + Applied a bug fix by Dr.D.J.Picton + to have help with no args print the default help file. + + Renamed lavarand to LavaRnd. + + Added rules to build a calc rpm. + + All installed files are first formed as foo.new, and then moved + into place as foo via a atomic rename. + + During installation, only files that are different are installed. + If the built file and the installed file are the same, no + installation is performed. + + Calc has new default installation locations: + + Makefile var old location new location + ------------ ------------ ------------ + TOPDIR /usr/local/lib <> + BINDIR /usr/local/bin /usr/bin + SHAREDIR <> /usr/share + INCDIR /usr/local/include /usr/include + LIBDIR /usr/local/lib/calc /usr/lib + CSHAREDIR <> /usr/share/calc + HELPDIR /usr/local/lib/calc/help /usr/share/calc/help + INCDIRCALC /usr/local/include/calc /usr/include/calc + CUSTOMLIBDIR /usr/local/lib/calc/custom /usr/share/calc/custom + CUSTOMHELPDIR /usr/local/lib/calc/help/custhelp /usr/share/calc/custhelp + CUSTOMINCDIR <> /usr/include/calc/custom + SCRIPTDIR /usr/local/bin/cscript /usr/bin/cscript + MANDIR <> /usr/share/man/man1 + CATDIR <> <> + + The Makefile variable ${TOPDIR} is no longer used. In some places + it has been replaced by a new Makefile variable ${SHAREDIR}. Some + of the old TOPDIR functionality has beenn replaced by ${CSHAREDIR}. + + The install rules no longer remove old obsolete files. We assume + that these old files have long since vanished! :-) + + Reduced the amount of output when doing a make all where nothing + needs to be made. + + Reduced the amount of output when doing a make install where nothing + needs to be installed. + + If you install using the new default locations, you can remove + old calc files installed in the old default location by doing: + + make olduninstall + + +The following are the changes from calc version 2.11.5t2 to 2.11.5t2.1: Fixed a bug, reported by Ernest Bowen that caused command lines to be echoed in @@ -48,7 +115,7 @@ The following are the changes from calc version 2.11.5t2 to date: Added regression test 8310 to test for the static bug fix. -The following are the changes from calc version 2.11.5t0 to date: +The following are the changes from calc version 2.11.5t0 to 2.11.5t1.1: Fixed a compile problem with Linux 2.4 / Debian. Thanks goes to Martin Buck for help with this issue. @@ -171,7 +238,7 @@ The following are the changes from calc version 2.11.5t0 to date: that have been attempted to be built for windoz. -The following are the changes from calc version 2.11.4t1 to date: +The following are the changes from calc version 2.11.4t1 to 2.11.4t2: Added missing test8600.cal test file. @@ -5198,7 +5265,7 @@ Following is a list of visible changes to calc from version 1.24.7 to 1.26.1: A small bug in the library file regress.cal was fixed. -## Copyright (C) 1999 Landon Curt Noll +## 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 @@ -5214,8 +5281,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. ## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. ## -## @(#) $Revision: 29.29 $ -## @(#) $Id: CHANGES,v 29.29 2001/04/14 22:56:46 chongo Exp $ +## @(#) $Revision: 29.32 $ +## @(#) $Id: CHANGES,v 29.32 2001/05/28 21:59:59 chongo Exp $ ## @(#) $Source: /usr/local/src/cmd/calc/RCS/CHANGES,v $ ## ## Under source code control: 1993/06/02 18:12:57 diff --git a/Makefile b/Makefile index 40dd114..38a2dd2 100644 --- a/Makefile +++ b/Makefile @@ -20,8 +20,8 @@ # received a copy with calc; if not, write to Free Software Foundation, Inc. # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. # -MAKEFILE_REV= $$Revision: 29.21 $$ -# @(#) $Id: Makefile.ship,v 29.21 2001/04/10 22:52:05 chongo Exp $ +MAKEFILE_REV= $$Revision: 29.28 $$ +# @(#) $Id: Makefile.ship,v 29.28 2001/05/28 22:44:50 chongo Exp $ # @(#) $Source: /usr/local/src/cmd/calc/RCS/Makefile.ship,v $ # # Under source code control: 1990/02/15 01:48:41 @@ -496,41 +496,51 @@ HAVE_UNISTD_H= # where to install the *.cal, *.h and *.a files # -# ${BINDIR} where to install binary files -# ${TOPDIR} the directory under which the calc directory will be placed. -# ${LIBDIR} where the *.cal, *.a, bindings and help dir are installed. -# ${INCDIR} where the locally installed include files are found. -# ${INCDIRCALC} where the calc include files are installed. -# ${HELPDIR} where the help directory is installed. -# ${CUSTOMLIBDIR} where custom *.cal files are installed. -# ${CUSTOMHELPDIR} where custom help files are installed. -# ${SCRIPTDIR} where calc shell scripts are installed. +# These 4 values control where things are installed +# ------------------------------------------------- +# ${BINDIR} where to install binary files +# ${SHAREDIR} where most common shared files are kept +# ${INCDIR} where most .h files are kept +# ${LIBDIR} where *.a files are installed # -BINDIR= /usr/local/bin -#BINDIR= /usr/bin -#BINDIR= /usr/contrib/bin +#BINDIR= /usr/local/bin +BINDIR= /usr/bin + +#SHAREDIR= /usr/local/lib +SHAREDIR= /usr/share + +#INCDIR= /usr/local/include +INCDIR= /usr/include + +#LIBDIR= /usr/local/lib +LIBDIR= /usr/lib + +# By default, these values are based on the above 4 values +# -------------------------------------------------------- +# ${CSHAREDIR} where most common shared calc files are kept +# ${HELPDIR} where the help directory is installed +# ${INCDIRCALC} where the calc include files are installed +# ${CUSTOMLIBDIR} where custom *.cal files are installed +# ${CUSTOMHELPDIR} where custom help files are installed +# ${CUSTOMINCPDIR} where custom .h files are installed +# ${SCRIPTDIR} where calc shell scripts are installed # -TOPDIR= /usr/local/lib -#TOPDIR= /usr/lib -#TOPDIR= /usr/libdata -#TOPDIR= /usr/contrib/lib -# -LIBDIR= ${TOPDIR}/calc -HELPDIR= ${LIBDIR}/help -INCDIR= /usr/local/include +CSHAREDIR= ${SHAREDIR}/calc +HELPDIR= ${CSHAREDIR}/help INCDIRCALC= ${INCDIR}/calc -CUSTOMLIBDIR= ${LIBDIR}/custom -CUSTOMHELPDIR= ${HELPDIR}/custhelp +CUSTOMLIBDIR= ${CSHAREDIR}/custom +CUSTOMHELPDIR= ${CSHAREDIR}/custhelp +CUSTOMINCDIR= ${INCDIRCALC}/custom SCRIPTDIR= ${BINDIR}/cscript # where man pages are installed # # Use MANDIR= to disable installation of the calc man (source) page. # -MANDIR= +#MANDIR= #MANDIR= /usr/local/man/man1 #MANDIR= /usr/man/man1 -#MANDIR= /usr/share/man/man1 +MANDIR= /usr/share/man/man1 #MANDIR= /usr/man/u_man/man1 #MANDIR= /usr/contrib/man/man1 @@ -543,6 +553,7 @@ CATDIR= #CATDIR= /usr/local/catman/cat1 #CATDIR= /usr/man/cat1 #CATDIR= /usr/share/man/cat1 +#CATDIR= /var/cache/man/cat1 #CATDIR= /usr/man/u_man/cat1 #CATDIR= /usr/contrib/man/cat1 @@ -558,33 +569,40 @@ MANEXT= 1 # This is ignored if CATDIR is empty. # CATEXT= 1 +#CATEXT= 1.gz #CATEXT= 0 #CATEXT= l # how to format a man page # # If CATDIR is non-empty, then +# # If NROFF is non-empty, then +# # ${NROFF} ${NROFF_ARG} calc.1 > ${CATDIR}/calc.${CATEXT} -# is used to built and install the cat page +# is used to built and install the cat page +# # else (NROFF is empty) +# # ${MANMAKE} calc.1 ${CATDIR} -# is used to built and install the cat page +# is used to built and install the cat page # else +# # The cat page is not built or installed # # If in doubt and you don't want to fool with man pages, set MANDIR # and CATDIR to empty and ignore the NROFF, NROFF_ARG and MANMAKE # lines below. # -NROFF= nroff -#NROFF= +#NROFF= nroff +NROFF= #NROFF= groff NROFF_ARG= -man #NROFF_ARG= -mandoc MANMAKE= /usr/local/bin/manmake #MANMAKE= manmake MANMODE= 0444 +CATMODE= 0444 # If the $CALCPATH environment variable is not defined, then the following # path will be search for calc resource file routines. @@ -986,6 +1004,8 @@ TEE= tee CTAGS= ctags CHMOD= chmod FMT= fmt +XARGS= xargs +CMP= cmp # assume the X11 makedepend tool for the depend rule MAKEDEPEND= makedepend # echo command location @@ -1108,11 +1128,14 @@ UTIL_PROGS= align32 fposval have_uid_t longlong have_const \ # The complete list of Makefile vars passed down to custom/Makefile. # CUSTOM_PASSDOWN= Q="${Q}" \ - TOPDIR="${TOPDIR}" \ - LIBDIR="${LIBDIR}" \ + SHAREDIR="${SHAREDIR}" \ + INCDIR="${INCDIR}" \ + CSHAREDIR="${CSHAREDIR}" \ HELPDIR="${HELPDIR}" \ + INCDIRCALC="${INCDIRCALC}" \ CUSTOMLIBDIR="${CUSTOMLIBDIR}" \ CUSTOMHELPDIR="${CUSTOMHELPDIR}" \ + CUSTOMINCDIR="${CUSTOMINCDIR}" \ DEBUG="${DEBUG}" \ NO_SHARED="${NO_SHARED}" \ RANLIB="${RANLIB}" \ @@ -1130,14 +1153,18 @@ CUSTOM_PASSDOWN= Q="${Q}" \ MAKE_FILE=${MAKE_FILE} \ SED=${SED} \ CHMOD=${CHMOD} \ + CMP=${CMP} \ MAKEDEPEND=${MAKEDEPEND} \ SORT=${SORT} # The complete list of Makefile vars passed down to sample/Makefile. # SAMPLE_PASSDOWN= Q="${Q}" \ - TOPDIR="${TOPDIR}" \ + BINDIR="${BINDIR}" \ + SHAREDIR="${SHAREDIR}" \ + INCDIR="${INCDIR}" \ LIBDIR="${LIBDIR}" \ + CSHAREDIR="${CSHAREDIR}" \ HELPDIR="${HELPDIR}" \ DEBUG="${DEBUG}" \ NO_SHARED="${NO_SHARED}" \ @@ -1156,15 +1183,16 @@ SAMPLE_PASSDOWN= Q="${Q}" \ CC="${CC}" \ MAKE_FILE=${MAKE_FILE} \ SED=${SED} \ - MAKEDEPEND=${MAKEDEPEND} \ CHMOD=${CHMOD} \ + CMP=${CMP} \ + MAKEDEPEND=${MAKEDEPEND} \ SORT=${SORT} # The compelte list of Makefile vars passed down to help/Makefile. # HELP_PASSDOWN= Q="${Q}" \ - TOPDIR="${TOPDIR}" \ - LIBDIR="${LIBDIR}" \ + SHAREDIR="${SHAREDIR}" \ + CSHAREDIR="${CSHAREDIR}" \ HELPDIR="${HELPDIR}" \ ICFLAGS="${ICFLAGS}" \ ILDFLAGS="${ILDFLAGS}" \ @@ -1172,15 +1200,17 @@ HELP_PASSDOWN= Q="${Q}" \ MAKE_FILE=${MAKE_FILE} \ SED=${SED} \ CHMOD=${CHMOD} \ + CMP=${CMP} \ FMT=${FMT} # The compelte list of Makefile vars passed down to cal/Makefile. # CAL_PASSDOWN= Q="${Q}" \ - TOPDIR="${TOPDIR}" \ - LIBDIR="${LIBDIR}" \ + SHAREDIR="${SHAREDIR}" \ + CSHAREDIR="${CSHAREDIR}" \ MAKE_FILE=${MAKE_FILE} \ - CHMOD=${CHMOD} + CHMOD=${CHMOD} \ + CMP=${CMP} # The compelte list of Makefile vars passed down to cscript/Makefile. # @@ -1191,7 +1221,8 @@ CSCRIPT_PASSDOWN= Q="${Q}" \ CHMOD=${CHMOD} \ SED=${SED} \ FMT=${FMT} \ - SORT=${SORT} + SORT=${SORT} \ + CMP=${CMP} # complete list of .h files found (but not built) in the distribution # @@ -1223,13 +1254,28 @@ OBJS= ${LIBOBJS} ${CALCOBJS} ${UTIL_OBJS} # CALC_LIBS= libcalc.a custom/libcustcalc.a +# list of sample programs to that need to be built to satisfy sample/.all +# +# NOTE: This list MUST be co-ordinated with the ${SAMPLE_TARGETS} variable +# in the sample/Makefile +# +SAMPLE_TARGETS= sample/test_random sample/many_random + +# list of cscript programs to that need to be built to satisfy cscript/.all +# +# NOTE: This list MUST be co-ordinated with the ${CSCRIPT_TARGETS} variable +# in the cscript/Makefile +# +CSCRIPT_TARGETS= cscript/mersenne cscript/piforever cscript/plus \ + cscript/square cscript/fproduct cscript/powerterm + # complete list of progs built # PROGS= calc ${UTIL_PROGS} # complete list of targets # -TARGETS= ${LICENSE} ${CALC_LIBS} custom/.all calc sample/sample \ +TARGETS= ${LICENSE} ${CALC_LIBS} custom/.all calc sample/.all \ cal/.all help/.all help/builtin cscript/.all calc.1 @@ -1258,6 +1304,7 @@ calc.1: calc.man ${MAKE_FILE} -e 's,$${SCRIPTDIR},${SCRIPTDIR},g' \ -e 's,$${INCDIRCALC},${INCDIRCALC},g' \ -e 's,$${CUSTOMLIBDIR},${CUSTOMLIBDIR},g' \ + -e 's,$${CUSTOMINCDIR},${CUSTOMINCDIR},g' \ -e 's,$${CUSTOMHELPDIR},${CUSTOMHELPDIR},g' \ -e 's,$${CALCRC},${CALCRC},g' < calc.man > calc.1 @@ -1701,8 +1748,8 @@ longlong.h: longlong.c have_stdlib.h have_string.h ${MAKE_FILE} ${Q}echo '' >> longlong.h ${Q}echo '/* do we have/want to use a long long type? */' >> longlong.h -${Q}rm -f longlong.o longlong - -${Q}${LCC} ${ICFLAGS} longlong.c -c 2>/dev/null; true - -${Q}${LCC} ${ILDFLAGS} longlong.o -o longlong 2>/dev/null; true + -${Q}${LCC} ${ICFLAGS} longlong.c -c >/dev/null 2>&1; true + -${Q}${LCC} ${ILDFLAGS} longlong.o -o longlong >/dev/null 2>&1; true -${Q}${SHELL} -c "./longlong ${LONGLONG_BITS} > ll_tmp 2>/dev/null" \ >/dev/null 2>&1; true -${Q}if [ -s ll_tmp ]; then \ @@ -1742,8 +1789,8 @@ have_fpos.h: have_fpos.c ${MAKE_FILE} ${Q}echo '' >> have_fpos.h ${Q}echo '/* do we have fgetpos & fsetpos functions? */' >> have_fpos.h -${Q}rm -f have_fpos.o have_fpos - -${Q}${LCC} ${HAVE_FPOS} ${ICFLAGS} have_fpos.c -c 2>/dev/null; true - -${Q}${LCC} ${ILDFLAGS} have_fpos.o -o have_fpos 2>/dev/null; true + -${Q}${LCC} ${HAVE_FPOS} ${ICFLAGS} have_fpos.c -c >/dev/null 2>&1; true + -${Q}${LCC} ${ILDFLAGS} have_fpos.o -o have_fpos >/dev/null 2>&1; true -${Q}${SHELL} -c "./have_fpos > fpos_tmp 2>/dev/null" \ >/dev/null 2>&1; true -${Q}if [ -s fpos_tmp ]; then \ @@ -1785,9 +1832,9 @@ have_fpos_pos.h: have_fpos_pos.c have_fpos.h have_posscl.h ${MAKE_FILE} >> have_fpos_pos.h -${Q}rm -f have_fpos_pos.o have_fpos_pos -${Q}${LCC} ${HAVE_FPOS} ${HAVE_FPOS_POS} \ - ${ICFLAGS} have_fpos_pos.c -c 2>/dev/null; true + ${ICFLAGS} have_fpos_pos.c -c >/dev/null 2>&1; true -${Q}${LCC} ${ILDFLAGS} have_fpos_pos.o -o have_fpos_pos \ - 2>/dev/null; true + >/dev/null 2>&1; true -${Q}${SHELL} -c "./have_fpos_pos > fpos_tmp 2>/dev/null" \ >/dev/null 2>&1; true -${Q}if [ -s fpos_tmp ]; then \ @@ -1828,8 +1875,8 @@ fposval.h: fposval.c have_fpos.h have_fpos_pos.h have_offscl.h have_posscl.h \ ${Q}echo '/* what are our file position & size types? */' >> fposval.h -${Q}rm -f fposval.o fposval -${Q}${LCC} ${ICFLAGS} ${FPOS_BITS} ${OFF_T_BITS} \ - ${DEV_BITS} ${INODE_BITS} fposval.c -c 2>/dev/null; true - -${Q}${LCC} ${ILDFLAGS} fposval.o -o fposval 2>/dev/null; true + ${DEV_BITS} ${INODE_BITS} fposval.c -c >/dev/null 2>&1; true + -${Q}${LCC} ${ILDFLAGS} fposval.o -o fposval >/dev/null 2>&1; true ${Q}${SHELL} -c "./fposval fposv_tmp >> fposval.h 2>/dev/null" \ >/dev/null 2>&1; true ${Q}echo '' >> fposval.h @@ -1861,8 +1908,9 @@ have_const.h: have_const.c ${MAKE_FILE} ${Q}echo '' >> have_const.h ${Q}echo '/* do we have or want const? */' >> have_const.h -${Q}rm -f have_const.o have_const - -${Q}${LCC} ${ICFLAGS} ${HAVE_CONST} have_const.c -c 2>/dev/null; true - -${Q}${LCC} ${ILDFLAGS} have_const.o -o have_const 2>/dev/null; true + -${Q}${LCC} ${ICFLAGS} ${HAVE_CONST} have_const.c -c \ + >/dev/null 2>&1; true + -${Q}${LCC} ${ILDFLAGS} have_const.o -o have_const >/dev/null 2>&1; true -${Q}${SHELL} -c "./have_const > const_tmp 2>/dev/null" \ >/dev/null 2>&1; true -${Q}if [ -s const_tmp ]; then \ @@ -1900,8 +1948,10 @@ have_offscl.h: have_offscl.c ${MAKE_FILE} ${Q}echo '' >> have_offscl.h ${Q}echo '' >> have_offscl.h -${Q}rm -f have_offscl.o have_offscl - -${Q}${LCC} ${ICFLAGS} ${HAVE_OFFSCL} have_offscl.c -c 2>/dev/null; true - -${Q}${LCC} ${ILDFLAGS} have_offscl.o -o have_offscl 2>/dev/null; true + -${Q}${LCC} ${ICFLAGS} ${HAVE_OFFSCL} have_offscl.c -c \ + >/dev/null 2>&1; true + -${Q}${LCC} ${ILDFLAGS} have_offscl.o -o have_offscl \ + >/dev/null 2>&1; true -${Q}${SHELL} -c "./have_offscl > offscl_tmp 2>/dev/null" \ >/dev/null 2>&1; true -${Q}if [ -s offscl_tmp ]; then \ @@ -1938,8 +1988,10 @@ have_posscl.h: have_posscl.c have_fpos.h ${MAKE_FILE} ${Q}echo '' >> have_posscl.h ${Q}echo '' >> have_posscl.h -${Q}rm -f have_posscl.o have_posscl - -${Q}${LCC} ${ICFLAGS} ${HAVE_POSSCL} have_posscl.c -c 2>/dev/null; true - -${Q}${LCC} ${ILDFLAGS} have_posscl.o -o have_posscl 2>/dev/null; true + -${Q}${LCC} ${ICFLAGS} ${HAVE_POSSCL} have_posscl.c -c \ + >/dev/null 2>&1; true + -${Q}${LCC} ${ILDFLAGS} have_posscl.o -o have_posscl \ + >/dev/null 2>&1; true -${Q}${SHELL} -c "./have_posscl > posscl_tmp 2>/dev/null" \ >/dev/null 2>&1; true -${Q}if [ -s posscl_tmp ]; then \ @@ -1990,8 +2042,8 @@ align32.h: align32.c longbits.h have_unistd.h ${MAKE_FILE} fi -${Q}if [ X = X${ALIGN32} ]; then \ rm -f align32.o align32; \ - ${LCC} ${ICFLAGS} ${ALIGN32} align32.c -c 2>/dev/null; \ - ${LCC} ${ILDFLAGS} align32.o -o align32 2>/dev/null; \ + ${LCC} ${ICFLAGS} ${ALIGN32} align32.c -c >/dev/null 2>&1; \ + ${LCC} ${ILDFLAGS} align32.o -o align32 >/dev/null 2>&1; \ ${SHELL} -c "./align32 >align32_tmp 2>/dev/null" >/dev/null 2>&1; \ if [ -s align32_tmp ]; then \ cat align32_tmp >> align32.h; \ @@ -2031,8 +2083,9 @@ have_uid_t.h: have_uid_t.c have_unistd.h ${MAKE_FILE} ${Q}echo '' >> have_uid_t.h ${Q}echo '/* do we have or want uid_t? */' >> have_uid_t.h -${Q}rm -f have_uid_t.o have_uid_t - -${Q}${LCC} ${ICFLAGS} ${HAVE_UID_T} have_uid_t.c -c 2>/dev/null; true - -${Q}${LCC} ${ILDFLAGS} have_uid_t.o -o have_uid_t 2>/dev/null; true + -${Q}${LCC} ${ICFLAGS} ${HAVE_UID_T} have_uid_t.c -c \ + >/dev/null 2>&1; true + -${Q}${LCC} ${ILDFLAGS} have_uid_t.o -o have_uid_t >/dev/null 2>&1; true -${Q}${SHELL} -c "./have_uid_t > uid_tmp 2>/dev/null" \ >/dev/null 2>&1; true -${Q}if [ -s uid_tmp ]; then \ @@ -2070,8 +2123,10 @@ have_newstr.h: have_newstr.c ${MAKE_FILE} ${Q}echo '/* do we have or want memcpy(), memset() & strchr()? */' \ >> have_newstr.h -${Q}rm -f have_newstr.o have_newstr - -${Q}${LCC} ${ICFLAGS} ${HAVE_NEWSTR} have_newstr.c -c 2>/dev/null; true - -${Q}${LCC} ${ILDFLAGS} have_newstr.o -o have_newstr 2>/dev/null; true + -${Q}${LCC} ${ICFLAGS} ${HAVE_NEWSTR} have_newstr.c -c \ + >/dev/null 2>&1; true + -${Q}${LCC} ${ILDFLAGS} have_newstr.o -o have_newstr \ + >/dev/null 2>&1; true -${Q}${SHELL} -c "./have_newstr > newstr_tmp 2>/dev/null" \ >/dev/null 2>&1; true -${Q}if [ -s newstr_tmp ]; then \ @@ -2108,8 +2163,10 @@ have_memmv.h: have_memmv.c ${MAKE_FILE} ${Q}echo '' >> have_memmv.h ${Q}echo '/* do we have or want memmove()? */' >> have_memmv.h -${Q}rm -f have_memmv.o have_memmv - -${Q}${LCC} ${ICFLAGS} ${HAVE_MEMMOVE} have_memmv.c -c 2>/dev/null; true - -${Q}${LCC} ${ILDFLAGS} have_memmv.o -o have_memmv 2>/dev/null; true + -${Q}${LCC} ${ICFLAGS} ${HAVE_MEMMOVE} have_memmv.c -c \ + >/dev/null 2>&1; true + -${Q}${LCC} ${ILDFLAGS} have_memmv.o -o have_memmv \ + >/dev/null 2>&1; true -${Q}${SHELL} -c "./have_memmv > memmv_tmp 2>/dev/null" \ >/dev/null 2>&1; true -${Q}if [ -s memmv_tmp ]; then \ @@ -2146,8 +2203,10 @@ have_ustat.h: have_ustat.c ${MAKE_FILE} ${Q}echo '' >> have_ustat.h ${Q}echo '/* do we have or want ustat()? */' >> have_ustat.h -${Q}rm -f have_ustat.o have_ustat - -${Q}${LCC} ${ICFLAGS} ${HAVE_USTAT} have_ustat.c -c 2>/dev/null; true - -${Q}${LCC} ${ILDFLAGS} have_ustat.o -o have_ustat 2>/dev/null; true + -${Q}${LCC} ${ICFLAGS} ${HAVE_USTAT} have_ustat.c -c \ + >/dev/null 2>&1; true + -${Q}${LCC} ${ILDFLAGS} have_ustat.o -o have_ustat \ + >/dev/null 2>&1; true -${Q}${SHELL} -c "./have_ustat > ustat_tmp 2>/dev/null" \ >/dev/null 2>&1; true -${Q}if [ -s ustat_tmp ]; then \ @@ -2184,8 +2243,10 @@ have_getsid.h: have_getsid.c ${MAKE_FILE} ${Q}echo '' >> have_getsid.h ${Q}echo '/* do we have or want getsid()? */' >> have_getsid.h -${Q}rm -f have_getsid.o have_getsid - -${Q}${LCC} ${ICFLAGS} ${HAVE_GETSID} have_getsid.c -c 2>/dev/null; true - -${Q}${LCC} ${ILDFLAGS} have_getsid.o -o have_getsid 2>/dev/null; true + -${Q}${LCC} ${ICFLAGS} ${HAVE_GETSID} have_getsid.c -c \ + >/dev/null 2>&1; true + -${Q}${LCC} ${ILDFLAGS} have_getsid.o -o have_getsid \ + >/dev/null 2>&1; true -${Q}${SHELL} -c "./have_getsid > getsid_tmp 2>/dev/null" \ >/dev/null 2>&1; true -${Q}if [ -s getsid_tmp ]; then \ @@ -2222,9 +2283,10 @@ have_getpgid.h: have_getpgid.c ${MAKE_FILE} ${Q}echo '' >> have_getpgid.h ${Q}echo '/* do we have or want getpgid()? */' >> have_getpgid.h -${Q}rm -f have_getpgid.o have_getpgid - -${Q}${LCC} ${ICFLAGS} ${HAVE_GETPGID} have_getpgid.c -c 2>/dev/null; \ - true - -${Q}${LCC} ${ILDFLAGS} have_getpgid.o -o have_getpgid 2>/dev/null; true + -${Q}${LCC} ${ICFLAGS} ${HAVE_GETPGID} have_getpgid.c -c \ + >/dev/null 2>&1; true + -${Q}${LCC} ${ILDFLAGS} have_getpgid.o -o have_getpgid \ + >/dev/null 2>&1; true -${Q}${SHELL} -c "./have_getpgid > getpgid_tmp 2>/dev/null" \ >/dev/null 2>&1; true -${Q}if [ -s getpgid_tmp ]; then \ @@ -2261,9 +2323,10 @@ have_gettime.h: have_gettime.c ${MAKE_FILE} ${Q}echo '' >> have_gettime.h ${Q}echo '/* do we have or want clock_gettime()? */' >> have_gettime.h -${Q}rm -f have_gettime.o have_gettime - -${Q}${LCC} ${ICFLAGS} ${HAVE_GETTIME} have_gettime.c -c 2>/dev/null; \ - true - -${Q}${LCC} ${ILDFLAGS} have_gettime.o -o have_gettime 2>/dev/null; true + -${Q}${LCC} ${ICFLAGS} ${HAVE_GETTIME} have_gettime.c -c \ + >/dev/null 2>&1; true + -${Q}${LCC} ${ILDFLAGS} have_gettime.o -o have_gettime \ + >/dev/null 2>&1; true -${Q}${SHELL} -c "./have_gettime > gettime_tmp 2>/dev/null" \ >/dev/null 2>&1; true -${Q}if [ -s gettime_tmp ]; then \ @@ -2300,9 +2363,10 @@ have_getprid.h: have_getprid.c ${MAKE_FILE} ${Q}echo '' >> have_getprid.h ${Q}echo '/* do we have or want getprid()? */' >> have_getprid.h -${Q}rm -f have_getprid.o have_getprid - -${Q}${LCC} ${ICFLAGS} ${HAVE_GETPRID} have_getprid.c -c 2>/dev/null; \ - true - -${Q}${LCC} ${ILDFLAGS} have_getprid.o -o have_getprid 2>/dev/null; true + -${Q}${LCC} ${ICFLAGS} ${HAVE_GETPRID} have_getprid.c -c \ + >/dev/null 2>&1; true + -${Q}${LCC} ${ILDFLAGS} have_getprid.o -o have_getprid \ + >/dev/null 2>&1; true -${Q}${SHELL} -c "./have_getprid > getprid_tmp 2>/dev/null" \ >/dev/null 2>&1; true -${Q}if [ -s getprid_tmp ]; then \ @@ -2375,9 +2439,10 @@ have_rusage.h: have_rusage.c ${MAKE_FILE} ${Q}echo '' >> have_rusage.h ${Q}echo '/* do we have or want getrusage()? */' >> have_rusage.h -${Q}rm -f have_rusage.o have_rusage - -${Q}${LCC} ${ICFLAGS} ${HAVE_GETRUSAGE} have_rusage.c -c 2>/dev/null; \ - true - -${Q}${LCC} ${ILDFLAGS} have_rusage.o -o have_rusage 2>/dev/null; true + -${Q}${LCC} ${ICFLAGS} ${HAVE_GETRUSAGE} have_rusage.c -c \ + >/dev/null 2>&1; true + -${Q}${LCC} ${ILDFLAGS} have_rusage.o -o have_rusage \ + >/dev/null 2>&1; true -${Q}${SHELL} -c "./have_rusage > rusage_tmp 2>/dev/null" \ >/dev/null 2>&1; true -${Q}if [ -s rusage_tmp ]; then \ @@ -2414,9 +2479,10 @@ have_strdup.h: have_strdup.c ${MAKE_FILE} ${Q}echo '' >> have_strdup.h ${Q}echo '/* do we have or want getstrdup()? */' >> have_strdup.h -${Q}rm -f have_strdup.o have_strdup - -${Q}${LCC} ${ICFLAGS} ${HAVE_STRDUP} have_strdup.c -c 2>/dev/null; \ - true - -${Q}${LCC} ${ILDFLAGS} have_strdup.o -o have_strdup 2>/dev/null; true + -${Q}${LCC} ${ICFLAGS} ${HAVE_STRDUP} have_strdup.c -c \ + >/dev/null 2>&1; true + -${Q}${LCC} ${ILDFLAGS} have_strdup.o -o have_strdup \ + >/dev/null 2>&1; true -${Q}${SHELL} -c "./have_strdup > strdup_tmp 2>/dev/null" \ >/dev/null 2>&1; true -${Q}if [ -s strdup_tmp ]; then \ @@ -2453,8 +2519,8 @@ args.h: have_stdvs.c have_varvs.c have_string.h have_unistd.h have_string.h ${Q}echo '' >> args.h -${Q}rm -f have_stdvs.o have_stdvs -${Q}${LCC} ${ICFLAGS} ${HAVE_VSPRINTF} have_stdvs.c -c \ - 2>/dev/null; true - -${Q}${LCC} ${ILDFLAGS} have_stdvs.o -o have_stdvs 2>/dev/null; true + >/dev/null 2>&1; true + -${Q}${LCC} ${ILDFLAGS} have_stdvs.o -o have_stdvs >/dev/null 2>&1; true -${Q}if ./have_stdvs >>args.h 2>/dev/null; then \ touch have_args; \ else \ @@ -2621,13 +2687,24 @@ help/builtin: func.c help/builtin.top help/builtin.end help/funclist.sed ${V} echo '=-=-=-=-= Back to the main Makefile for $@ rule =-=-=-=-=' ${V} echo '=-=-=-=-= end of $@ rule =-=-=-=-=' -cscript/.all: +cscript/.all: ${CSCRIPT_TARGETS} + +${CSCRIPT_TARGETS}: ${V} echo '=-=-=-=-= start of $@ rule =-=-=-=-=' ${V} echo '=-=-=-=-= Invoking all rule for cscript =-=-=-=-=' cd cscript; ${MAKE} -f Makefile ${CSCRIPT_PASSDOWN} all ${V} echo '=-=-=-=-= Back to the main Makefile for $@ rule =-=-=-=-=' ${V} echo '=-=-=-=-= end of $@ rule =-=-=-=-=' +sample/.all: ${SAMPLE_TARGETS} + +${SAMPLE_TARGETS}: libcalc.a + ${V} echo '=-=-=-=-= start of $@ rule =-=-=-=-=' + ${V} echo '=-=-=-=-= Invoking all rule for cscript =-=-=-=-=' + cd sample; ${MAKE} -f Makefile ${SAMPLE_PASSDOWN} all + ${V} echo '=-=-=-=-= Back to the main Makefile for $@ rule =-=-=-=-=' + ${V} echo '=-=-=-=-= end of $@ rule =-=-=-=-=' + # This is a special rule that first tries to determine of a lower level # make is needed, and it so a make will be performed. Because it is # triggered as the first dependent of the all rule, it will ensure @@ -2660,47 +2737,7 @@ custom/libcustcalc: custom/libcustcalc.a: ${V} echo '=-=-=-=-= start of $@ rule =-=-=-=-=' ${V} echo '=-=-=-=-= Invoking all rule for custom =-=-=-=-=' - cd custom; ${MAKE} -f Makefile ${CUSTOM_PASSDOWN} all - ${V} echo '=-=-=-=-= Back to the main Makefile for $@ rule =-=-=-=-=' - ${V} echo '=-=-=-=-= end of $@ rule =-=-=-=-=' - -# This is a special rule that first tries to determine of a lower level -# make is needed, and it so a make will be performed. Because it is -# triggered as a dependent of the all rule, it will ensure the sample -# routines get built. -# -sample/sample: - ${V} echo '=-=-=-=-= start of $@ rule =-=-=-=-=' - ${V} echo '=-=-=-=-= Invoking all rule for sample =-=-=-=-=' - -${Q}rm -f .sample_error - -${Q}NEED="`cd sample; ${MAKE} -n -f Makefile all`"; \ - if [ ! -z "$$NEED" ]; then \ - echo " cd sample; ${MAKE} -f Makefile ${SAMPLE_PASSDOWN} all";\ - cd sample; ${MAKE} -f Makefile ${SAMPLE_PASSDOWN} all; \ - status="$$?"; \ - if [ "$$status" -ne 0 ]; then \ - echo "$$status" > ../.sample_error; \ - else \ - true ; \ - fi; \ - else \ - true ; \ - fi - ${Q}if [ -f .sample_error ]; then \ - echo "sample make failed, code: `cat .sample_error`" 1>&2; \ - exit "`cat .sample_error`"; \ - else \ - true ; \ - fi - ${V} echo '=-=-=-=-= Back to the main Makefile for $@ rule =-=-=-=-=' - ${V} echo '=-=-=-=-= end of $@ rule =-=-=-=-=' - -# This is the real sample/all rule. -# -sample/all: - ${V} echo '=-=-=-=-= start of $@ rule =-=-=-=-=' - ${V} echo '=-=-=-=-= Invoking all rule for sample =-=-=-=-=' - cd sample; ${MAKE} -f Makefile ${SAMPLE_PASSDOWN} all + ${Q}cd custom; ${MAKE} -f Makefile ${CUSTOM_PASSDOWN} all ${V} echo '=-=-=-=-= Back to the main Makefile for $@ rule =-=-=-=-=' ${V} echo '=-=-=-=-= end of $@ rule =-=-=-=-=' @@ -2789,7 +2826,7 @@ depend: hsrc ${Q}echo "" >> Makefile ${Q}${SED} -n '3,$$p' skel/makedep.out | LANG=C ${SORT} -u >> Makefile -${Q}rm -rf skel - -${Q}if cmp -s Makefile.bak Makefile; then \ + -${Q}if ${CMP} -s Makefile.bak Makefile; then \ echo 'Makefile was already up to date'; \ mv -f Makefile.bak Makefile; \ else \ @@ -2825,6 +2862,7 @@ distlist: ${DISTLIST} for i in ${BUILD_H_SRC} ${BUILD_C_SRC}; do \ echo win32/$$i; \ done; \ + echo spec-template; \ (cd help; ${MAKE} ${HELP_PASSDOWN} $@); \ (cd cal; ${MAKE} ${CAL_PASSDOWN} $@); \ (cd custom; ${MAKE} ${CUSTOM_PASSDOWN} $@); \ @@ -2914,10 +2952,12 @@ env: @echo 'HAVE_URANDOM=${HAVE_URANDOM}'; echo '' @echo 'ALIGN32=${ALIGN32}'; echo '' @echo 'BINDIR=${BINDIR}'; echo '' - @echo 'TOPDIR=${TOPDIR}'; echo '' + @echo 'SHAREDIR=${SHAREDIR}'; echo '' + @echo 'CSHAREDIR=${CSHAREDIR}'; echo '' @echo 'LIBDIR=${LIBDIR}'; echo '' @echo 'HELPDIR=${HELPDIR}'; echo '' @echo 'CUSTOMLIBDIR=${CUSTOMLIBDIR}'; echo '' + @echo 'CUSTOMINCDIR=${CUSTOMINCDIR}'; echo '' @echo 'CUSTOMHELPDIR=${CUSTOMHELPDIR}'; echo '' @echo 'SCRIPTDIR=${SCRIPTDIR}'; echo '' @echo 'MANDIR=${MANDIR}'; echo '' @@ -2987,11 +3027,10 @@ env: mkdebug: env version.c @echo '=-=-=-=-= start of $@ rule =-=-=-=-=' @echo '=-=-=-=-= Determining the source version =-=-=-=-=' - @${SED} -n '/^#[ ]*define/p' version.c + @${MAKE} -f Makefile Q= V=@ ver_calc + -@./ver_calc @echo '=-=-=-=-= Invoking ${MAKE} -f Makefile Q= V=@ all =-=-=-=-=' - @${MAKE} -f Makefile \ - MAKE_FILE=${MAKE_FILE} TOPDIR=${TOPDIR} LIBDIR=${LIBDIR} \ - HELPDIR=${HELPDIR} Q= V=@ all + @${MAKE} -f Makefile Q= V=@ all @echo '=-=-=-=-= Back to the main Makefile for $@ rule =-=-=-=-=' @echo '=-=-=-=-= Determining the binary version =-=-=-=-=' -@./calc -e -q -v @@ -3001,24 +3040,19 @@ mkdebug: env version.c debug: env @echo '=-=-=-=-= start of $@ rule =-=-=-=-=' @echo '=-=-=-=-= Invoking ${MAKE} -f Makefile Q= V=@ clobber =-=-=-=-=' - @${MAKE} -f Makefile \ - MAKE_FILE=${MAKE_FILE} TOPDIR=${TOPDIR} LIBDIR=${LIBDIR} \ - HELPDIR=${HELPDIR} Q= V=@ clobber + @${MAKE} -f Makefile Q= V=@ clobber @echo '=-=-=-=-= Back to the main Makefile for $@ rule =-=-=-=-=' @echo '=-=-=-=-= Determining the source version =-=-=-=-=' - @${SED} -n '/^#[ ]*define/p' version.c + @${MAKE} -f Makefile Q= V=@ ver_calc + -@./ver_calc @echo '=-=-=-=-= Invoking ${MAKE} -f Makefile Q= V=@ all =-=-=-=-=' - @${MAKE} -f Makefile \ - MAKE_FILE=${MAKE_FILE} TOPDIR=${TOPDIR} LIBDIR=${LIBDIR} \ - HELPDIR=${HELPDIR} Q= V=@ all + @${MAKE} -f Makefile Q= V=@ all @echo '=-=-=-=-= Determining the binary version =-=-=-=-=' -@./calc -e -q -v @echo '=-=-=-=-= Back to the main Makefile for $@ rule =-=-=-=-=' @echo '=-=-=-=-= Invoking ${MAKE} -f Makefile Q= V=@ chk =-=-=-=-=' @echo '=-=-=-=-= this may take a while =-=-=-=-=' - @${MAKE} -f Makefile \ - MAKE_FILE=${MAKE_FILE} TOPDIR=${TOPDIR} LIBDIR=${LIBDIR} \ - HELPDIR=${HELPDIR} Q= V=@ chk + @${MAKE} -f Makefile Q= V=@ chk @echo '=-=-=-=-= Back to the main Makefile for $@ rule =-=-=-=-=' @echo '=-=-=-=-= end of $@ rule =-=-=-=-=' @@ -3050,12 +3084,162 @@ dbx: gdb: ${CALC_ENV} gdb ./calc +## +# +# rpm rules +# +## + +# create an rpm spec file from the spec-template +# +# This file is linked to calc-version-rel.spec before the rpm is built. +# +calc.spec: spec-template ${MAKE_FILE} help/Makefile cal/Makefile \ + custom/Makefile cscript/Makefile ver_calc + ${V} echo '=-=-=-=-= start of $@ rule =-=-=-=-=' + ${Q}rm -f calc.spec calc.spec.sed + ${Q}echo 's,$${BINDIR},${BINDIR},g' >> calc.spec.sed + ${Q}echo 's:$${SHAREDIR}:${SHAREDIR}:g' > calc.spec.sed + ${Q}echo 's,$${INCDIR},${INCDIR},g' >> calc.spec.sed + ${Q}echo 's:$${LIBDIR}:${LIBDIR}:g' >> calc.spec.sed + ${Q}echo 's:$${CSHAREDIR}:${CSHAREDIR}:g' > calc.spec.sed + ${Q}echo 's,$${HELPDIR},${HELPDIR},g' >> calc.spec.sed + ${Q}echo 's,$${INCDIRCALC},${INCDIRCALC},g' >> calc.spec.sed + ${Q}echo 's,$${CUSTOMLIBDIR},${CUSTOMLIBDIR},g' >> calc.spec.sed + ${Q}echo 's,$${CUSTOMINCDIR},${CUSTOMINCDIR},g' >> calc.spec.sed + ${Q}echo 's,$${CUSTOMHELPDIR},${CUSTOMHELPDIR},g' >> calc.spec.sed + ${Q}echo 's,$${SCRIPTDIR},${SCRIPTDIR},g' >> calc.spec.sed + ${Q}echo 's,$${MANDIR},${MANDIR},g' >> calc.spec.sed + ${Q}echo 's,$${LIB_H_SRC},${LIB_H_SRC},g' >> calc.spec.sed + ${Q}echo 's,$${BUILD_H_SRC},${BUILD_H_SRC},g' >> calc.spec.sed + ${Q}echo 's,$${ALLOW_CUSTOM},${ALLOW_CUSTOM},g' >> calc.spec.sed + ${Q}if [ -z "${RANLIB}" ]; then \ + echo 's,$${RANLIB},:,g' >> calc.spec.sed; \ + else \ + echo 's,$${RANLIB},${RANLIB},g' >> calc.spec.sed; \ + fi + ${Q}echo 's,$${MANMAKE},${MANMAKE},g' >> calc.spec.sed + ${Q}echo 's,$${MANMODE},${MANMODE},g' >> calc.spec.sed + ${Q}echo 's,$${MANEXT},${MANEXT},g' >> calc.spec.sed + ${Q}echo 's,$${CHMOD},${CHMOD},g' >> calc.spec.sed + ${Q}cd help; \ + ${MAKE} -f Makefile ${HELP_PASSDOWN} echo_STD_HELP_FILES | \ + grep -v '^make\[[0-9][0-9]*\]: .*ing directory ' | \ + ${SED} -e 's/^/s,$${STD_HELP_FILES},/' \ + -e 's/$$/,g/' >> ../calc.spec.sed + ${Q}cd help; \ + ${MAKE} -f Makefile ${HELP_PASSDOWN} echo_BLT_HELP_FILES | \ + grep -v '^make\[[0-9][0-9]*\]: .*ing directory ' | \ + ${SED} -e 's/^/s,$${BLT_HELP_FILES},/' \ + -e 's/$$/,g/' >> ../calc.spec.sed + ${Q}cd help; \ + ${MAKE} -f Makefile ${HELP_PASSDOWN} echo_DETAIL_HELP | \ + grep -v '^make\[[0-9][0-9]*\]: .*ing directory ' | \ + ${SED} -e 's/^/s,$${DETAIL_HELP},/' \ + -e 's/$$/,g/' >> ../calc.spec.sed + ${Q}cd help; \ + ${MAKE} -f Makefile ${HELP_PASSDOWN} echo_SINGULAR_FILES | \ + grep -v '^make\[[0-9][0-9]*\]: .*ing directory ' | \ + ${SED} -e 's/^/s,$${SINGULAR_FILES},/' \ + -e 's/$$/,g/' >> ../calc.spec.sed + ${Q}cd cal; \ + ${MAKE} -f Makefile ${CAL_PASSDOWN} echo_CALC_FILES | \ + grep -v '^make\[[0-9][0-9]*\]: .*ing directory ' | \ + ${SED} -e 's/^/s,$${CALC_FILES},/' \ + -e 's/$$/,g/' >> ../calc.spec.sed + ${Q}cd custom; \ + ${MAKE} -f Makefile ${CUSTOM_PASSDOWN} echo_INSTALL_H_SRC | \ + grep -v '^make\[[0-9][0-9]*\]: .*ing directory ' | \ + ${SED} -e 's/^/s,$${INSTALL_H_SRC},/' \ + -e 's/$$/,g/' >> ../calc.spec.sed + ${Q}cd custom; \ + ${MAKE} -f Makefile ${CUSTOM_PASSDOWN} echo_CUSTOM_CALC_FILES | \ + grep -v '^make\[[0-9][0-9]*\]: .*ing directory ' | \ + ${SED} -e 's/^/s,$${CUSTOM_CALC_FILES},/' \ + -e 's/$$/,g/' >> ../calc.spec.sed + ${Q}cd custom; \ + ${MAKE} -f Makefile ${CUSTOM_PASSDOWN} echo_CUSTOM_HELP | \ + grep -v '^make\[[0-9][0-9]*\]: .*ing directory ' | \ + ${SED} -e 's/^/s,$${CUSTOM_HELP},/' \ + -e 's/$$/,g/' >> ../calc.spec.sed + ${Q}cd cscript; \ + ${MAKE} -f Makefile ${CSCRIPT_PASSDOWN} echo_SCRIPT | \ + grep -v '^make\[[0-9][0-9]*\]: .*ing directory ' | \ + ${SED} -e 's/^/s,$${SCRIPT},/' -e 's/$$/,g/' >> ../calc.spec.sed + ${Q}echo 's,$${DATE},'`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 -v`',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}rm -f calc.spec.sed + ${V} echo '=-=-=-=-= end of $@ rule =-=-=-=-=' + +# Form the installed file list +# +install.list: ${MAKE_FILE} help/Makefile cal/Makefile custom/Makefile \ + cscript/Makefile ver_calc + ${V} echo '=-=-=-=-= start of $@ rule =-=-=-=-=' + ${Q}rm -f install.list + ${Q}echo ${BINDIR}/calc > install.list + ${Q}cd help; \ + ${MAKE} -f Makefile ${HELP_PASSDOWN} echo_install.list | \ + grep -v '^make\[[0-9][0-9]*\]: .*ing directory ' >> ../install.list + ${Q}cd cal; \ + ${MAKE} -f Makefile ${CAL_PASSDOWN} echo_install.list | \ + grep -v '^make\[[0-9][0-9]*\]: .*ing directory ' >> ../install.list + ${Q}cd custom; \ + ${MAKE} -f Makefile ${CUSTOM_PASSDOWN} echo_install.list | \ + grep -v '^make\[[0-9][0-9]*\]: .*ing directory ' >> ../install.list + ${Q}cd cscript; \ + ${MAKE} -f Makefile ${CSCRIPT_PASSDOWN} echo_install.list | \ + grep -v '^make\[[0-9][0-9]*\]: .*ing directory ' >> ../install.list + ${Q}echo ${LIBDIR}/libcalc.a >> install.list + ${Q}for i in ${LIB_H_SRC} ${BUILD_H_SRC}; do \ + echo ${INCDIRCALC}/$$i; \ + done >> install.list + ${Q}if [ ! -z "${MANDIR}" ]; then \ + echo ${MANDIR}/calc.${MANEXT}; \ + fi >> install.list + ${Q}LANG=C ${SORT} -u install.list -o install.list + ${V} echo '=-=-=-=-= end of $@ rule =-=-=-=-=' + ## # # Utility rules # ## +# The olduninstall rule will remove calc files from the older, histroic +# locations under the /usr/local directory. If you are using the +# new default values for ${BINDIR}, ${SHAREDIR}, ${INCDIR} and ${LIBDIR} +# then you can use this rule to clean out the older calc stuff under +# the /usr/local directory. +# +olduninstall: + -rm -f install.list + ${MAKE} -f Makefile \ + BINDIR=/usr/local/bin \ + SHAREDIR=/usr/local/lib \ + INCDIR=/usr/local/include \ + LIBDIR=/usr/local/lib/calc \ + CSHAREDIR=/usr/local/lib/calc \ + HELPDIR=/usr/local/lib/calc/help \ + INCDIRCALC=/usr/local/include/calc \ + CUSTOMLIBDIR=/usr/local/lib/calc/custom \ + CUSTOMHELPDIR=/usr/local/lib/calc/help/custhelp \ + CUSTOMINCDIR=/usr/local/lib/calc/custom \ + SCRIPTDIR=/usr/local/bin/cscript \ + MANDIR=/usr/local/man/man1 \ + install.list + -${XARGS} rm -f < install.list + -rmdir /usr/local/lib/calc/help/custhelp + -rmdir /usr/local/lib/calc/help + -rmdir /usr/local/lib/calc/custom + -rmdir /usr/local/lib/calc + -rmdir /usr/local/include/calc + -rmdir /usr/local/bin/cscript + -rm -f install.list + tags: ${CALCSRC} ${LIBSRC} ${H_SRC} ${BUILD_H_SRC} ${MAKE_FILE} -${CTAGS} ${CALCSRC} ${LIBSRC} ${H_SRC} ${BUILD_H_SRC} 2>&1 | \ egrep -v 'Duplicate entry|Second entry ignored' @@ -3068,6 +3252,7 @@ clean: -rm -f ${UTIL_TMP} -rm -f ${UTIL_PROGS} -rm -f .libcustcalc_error + -rm -f calc.spec.sed ${Q}echo '=-=-=-=-= Invoking $@ rule for help =-=-=-=-=' -cd help; ${MAKE} -f Makefile ${HELP_PASSDOWN} clean ${Q}echo '=-=-=-=-= Back to the main Makefile for $@ rule =-=-=-=-=' @@ -3105,6 +3290,7 @@ clobber: -rm -f have_args *.u -rm -f calc.pixie calc.rf calc.Counts calc.cord -rm -rf gen_h skel Makefile.bak + -rm -f calc.spec install.list tmp ${V} echo '=-=-=-=-= Invoking $@ rule for help =-=-=-=-=' -cd help; ${MAKE} -f Makefile ${HELP_PASSDOWN} clobber ${V} echo '=-=-=-=-= Back to the main Makefile for $@ rule =-=-=-=-=' @@ -3129,123 +3315,200 @@ clobber: install: calc libcalc.a ${LIB_H_SRC} ${BUILD_H_SRC} calc.1 ${V} echo '=-=-=-=-= start of $@ rule =-=-=-=-=' - -${Q}if [ ! -d ${TOPDIR} ]; then \ - echo mkdir ${TOPDIR}; \ - mkdir ${TOPDIR}; \ - else \ - true; \ - fi - -${CHMOD} 0755 ${TOPDIR} - -${Q}if [ ! -d ${LIBDIR} ]; then \ - echo mkdir ${LIBDIR}; \ - mkdir ${LIBDIR}; \ - else \ - true; \ - fi - -${CHMOD} 0755 ${LIBDIR} - -${Q}if [ ! -d ${HELPDIR} ]; then \ - echo mkdir ${HELPDIR}; \ - mkdir ${HELPDIR}; \ - else \ - true; \ - fi - -${CHMOD} 0755 ${HELPDIR} - -${Q}if [ ! -d ${SCRIPTDIR} ]; then \ - echo mkdir ${SCRIPTDIR}; \ - mkdir ${SCRIPTDIR}; \ - else \ - true; \ - fi - -${CHMOD} 0755 ${SCRIPTDIR} - -${Q}if [ ! -d ${INCDIR} ]; then \ - echo mkdir ${INCDIR}; \ - mkdir ${INCDIR}; \ - else \ - true; \ - fi - -${CHMOD} 0755 ${INCDIR} - -${Q}if [ ! -d ${INCDIRCALC} ]; then \ - echo mkdir ${INCDIRCALC}; \ - mkdir ${INCDIRCALC}; \ - else \ - true; \ - fi - -${CHMOD} 0755 ${INCDIRCALC} -${Q}if [ ! -d ${BINDIR} ]; then \ echo mkdir ${BINDIR}; \ mkdir ${BINDIR}; \ + echo ${CHMOD} 0755 ${BINDIR}; \ + ${CHMOD} 0755 ${BINDIR}; \ + else \ + true; \ + fi + -${Q}if [ ! -d ${SHAREDIR} ]; then \ + echo mkdir ${SHAREDIR}; \ + mkdir ${SHAREDIR}; \ + echo ${CHMOD} 0755 ${SHAREDIR}; \ + ${CHMOD} 0755 ${SHAREDIR}; \ + else \ + true; \ + fi + -${Q}if [ ! -d ${INCDIR} ]; then \ + echo mkdir ${INCDIR}; \ + mkdir ${INCDIR}; \ + echo ${CHMOD} 0755 ${INCDIR}; \ + ${CHMOD} 0755 ${INCDIR}; \ + else \ + true; \ + fi + -${Q}if [ ! -d ${LIBDIR} ]; then \ + echo mkdir ${LIBDIR}; \ + mkdir ${LIBDIR}; \ + echo ${CHMOD} 0755 ${LIBDIR}; \ + ${CHMOD} 0755 ${LIBDIR}; \ + else \ + true; \ + fi + -${Q}if [ ! -d ${CSHAREDIR} ]; then \ + echo mkdir ${CSHAREDIR}; \ + mkdir ${CSHAREDIR}; \ + echo ${CHMOD} 0755 ${CSHAREDIR}; \ + ${CHMOD} 0755 ${CSHAREDIR}; \ + else \ + true; \ + fi + -${Q}if [ ! -d ${HELPDIR} ]; then \ + echo mkdir ${HELPDIR}; \ + mkdir ${HELPDIR}; \ + echo ${CHMOD} 0755 ${HELPDIR}; \ + ${CHMOD} 0755 ${HELPDIR}; \ + else \ + true; \ + fi + -${Q}if [ ! -d ${INCDIRCALC} ]; then \ + echo mkdir ${INCDIRCALC}; \ + mkdir ${INCDIRCALC}; \ + echo ${CHMOD} 0755 ${INCDIRCALC}; \ + ${CHMOD} 0755 ${INCDIRCALC}; \ + else \ + true; \ + fi + -${Q}if [ ! -d ${CUSTOMLIBDIR} ]; then \ + echo mkdir ${CUSTOMLIBDIR}; \ + mkdir ${CUSTOMLIBDIR}; \ + echo ${CHMOD} 0755 ${CUSTOMLIBDIR}; \ + ${CHMOD} 0755 ${CUSTOMLIBDIR}; \ + else \ + true; \ + fi + -${Q}if [ ! -d ${CUSTOMHELPDIR} ]; then \ + echo mkdir ${CUSTOMHELPDIR}; \ + mkdir ${CUSTOMHELPDIR}; \ + echo ${CHMOD} 0755 ${CUSTOMHELPDIR}; \ + ${CHMOD} 0755 ${CUSTOMHELPDIR}; \ + else \ + true; \ + fi + -${Q}if [ ! -d ${CUSTOMINCDIR} ]; then \ + echo mkdir ${CUSTOMINCDIR}; \ + mkdir ${CUSTOMINCDIR}; \ + echo ${CHMOD} 0755 ${CUSTOMINCDIR}; \ + ${CHMOD} 0755 ${CUSTOMINCDIR}; \ + else \ + true; \ + fi + -${Q}if [ ! -d ${SCRIPTDIR} ]; then \ + echo mkdir ${SCRIPTDIR}; \ + mkdir ${SCRIPTDIR}; \ + echo ${CHMOD} 0755 ${SCRIPTDIR}; \ + ${CHMOD} 0755 ${SCRIPTDIR}; \ else \ true; \ fi - -${CHMOD} 0755 ${BINDIR} - -rm -f ${BINDIR}/calc - cp calc ${BINDIR} - -${CHMOD} 0555 ${BINDIR}/calc + -${Q}if [ ! -z "${MANDIR}" ]; then \ + if [ ! -d ${MANDIR} ]; then \ + echo mkdir ${MANDIR}; \ + mkdir ${MANDIR}; \ + echo ${CHMOD} 0755 ${MANDIR}; \ + ${CHMOD} 0755 ${MANDIR}; \ + else \ + true; \ + fi; \ + else \ + true; \ + fi + -${Q}if [ ! -z "${CATDIR}" ]; then \ + if [ ! -d ${CATDIR} ]; then \ + echo mkdir ${CATDIR}; \ + mkdir ${CATDIR}; \ + echo ${CHMOD} 0755 ${CATDIR}; \ + ${CHMOD} 0755 ${CATDIR}; \ + else \ + true; \ + fi; \ + else \ + true; \ + fi + -${Q}if ${CMP} -s calc ${BINDIR}/calc; then \ + true; \ + else \ + rm -f ${BINDIR}/calc.new; \ + cp -f calc ${BINDIR}/calc.new; \ + ${CHMOD} 0555 ${BINDIR}/calc.new; \ + mv -f ${BINDIR}/calc.new ${BINDIR}/calc; \ + echo "installed ${BINDIR}/calc"; \ + fi ${V} echo '=-=-=-=-= Invoking $@ rule for help =-=-=-=-=' - cd help; ${MAKE} -f Makefile ${HELP_PASSDOWN} install + ${Q}cd help; ${MAKE} -f Makefile ${HELP_PASSDOWN} install ${V} echo '=-=-=-=-= Back to the main Makefile for $@ rule =-=-=-=-=' ${V} echo '=-=-=-=-= Invoking $@ rule for cal =-=-=-=-=' - cd cal; ${MAKE} -f Makefile ${CAL_PASSDOWN} install + ${Q}cd cal; ${MAKE} -f Makefile ${CAL_PASSDOWN} install ${V} echo '=-=-=-=-= Back to the main Makefile for $@ rule =-=-=-=-=' ${V} echo '=-=-=-=-= Invoking $@ rule for custom =-=-=-=-=' - cd custom; ${MAKE} -f Makefile ${CUSTOM_PASSDOWN} install + ${Q}cd custom; ${MAKE} -f Makefile ${CUSTOM_PASSDOWN} install ${V} echo '=-=-=-=-= Back to the main Makefile for $@ rule =-=-=-=-=' ${V} echo '=-=-=-=-= Invoking $@ rule for sample =-=-=-=-=' - cd sample; ${MAKE} -f Makefile ${SAMPLE_PASSDOWN} install + ${Q}cd sample; ${MAKE} -f Makefile ${SAMPLE_PASSDOWN} install ${V} echo '=-=-=-=-= Back to the main Makefile for $@ rule =-=-=-=-=' ${V} echo '=-=-=-=-= Invoking $@ rule for cscript =-=-=-=-=' - cd cscript; ${MAKE} -f Makefile ${CSCRIPT_PASSDOWN} install + ${Q}cd cscript; ${MAKE} -f Makefile ${CSCRIPT_PASSDOWN} install ${V} echo '=-=-=-=-= Back to the main Makefile for $@ rule =-=-=-=-=' - -rm -f ${LIBDIR}/libcalc.a - cp -f libcalc.a ${LIBDIR}/libcalc.a - ${RANLIB} ${LIBDIR}/libcalc.a - -${CHMOD} 0444 ${LIBDIR}/libcalc.a - -${Q}for i in ${LIB_H_SRC} ${BUILD_H_SRC}; do \ - echo rm -f ${LIBDIR}/$$i; \ - rm -f ${LIBDIR}/$$i; \ - echo rm -f ${INCDIRCALC}/$$i; \ - rm -f ${INCDIRCALC}/$$i; \ - echo cp $$i ${INCDIRCALC}; \ - cp $$i ${INCDIRCALC}; \ - echo ${CHMOD} 0444 ${INCDIRCALC}/$$i; \ - ${CHMOD} 0444 ${INCDIRCALC}/$$i; \ - done - -${Q}if [ -z "${MANDIR}" ]; then \ - echo '$${MANDIR} is empty, calc man page will not be installed'; \ + -${Q}if ${CMP} -s libcalc.a ${LIBDIR}/libcalc.a; then \ + true; \ else \ - echo "rm -f ${MANDIR}/calc.${MANEXT}"; \ - rm -f ${MANDIR}/calc.${MANEXT}; \ - echo "cp calc.1 ${MANDIR}/calc.${MANEXT}"; \ - cp calc.1 ${MANDIR}/calc.${MANEXT}; \ - echo "${CHMOD} 0444 ${MANDIR}/calc.${MANEXT}"; \ - ${CHMOD} 0444 ${MANDIR}/calc.${MANEXT}; \ + rm -f ${LIBDIR}/libcalc.a.new; \ + cp -f libcalc.a ${LIBDIR}/libcalc.a.new; \ + mv -f ${LIBDIR}/libcalc.a.new ${LIBDIR}/libcalc.a; \ + ${RANLIB} ${LIBDIR}/libcalc.a; \ + ${CHMOD} 0444 ${LIBDIR}/libcalc.a; \ + echo "installed ${LIBDIR}/libcalc.a"; \ fi - -${Q}if [ -z "${CATDIR}" ]; then \ - echo '$${CATDIR} is empty, calc cat page will not be installed'; \ - else \ - if [ -z "${NROFF}" ]; then \ - echo "${MANMAKE} calc.1 ${CATDIR}"; \ - ${MANMAKE} calc.1 ${CATDIR}; \ + -${Q}for i in ${LIB_H_SRC} ${BUILD_H_SRC}; do \ + rm -f tmp; \ + ${SED} -e 's/^\(#[ ]*include[ ][ ]*\)"/\1"calc\//' $$i > tmp; \ + if ${CMP} -s tmp ${INCDIRCALC}/$$i; then \ + true; \ else \ - echo "rm -f ${CATDIR}/calc.${CATEXT}"; \ - rm -f ${CATDIR}/calc.${CATEXT}; \ - echo "${NROFF} ${NROFF_ARG} calc.1 > ${CATDIR}/calc.${CATEXT}";\ - ${NROFF} ${NROFF_ARG} calc.1 > ${CATDIR}/calc.${CATEXT}; \ - echo "${CHMOD} ${MANMODE} ${MANDIR}/calc.${MANEXT}"; \ - ${CHMOD} ${MANMODE} ${MANDIR}/calc.${MANEXT}; \ + rm -f ${INCDIRCALC}/$$i.new; \ + cp -f tmp ${INCDIRCALC}/$$i.new; \ + ${CHMOD} 0444 ${INCDIRCALC}/$$i.new; \ + mv -f ${INCDIRCALC}/$$i.new ${INCDIRCALC}/$$i; \ + echo "installed ${INCDIRCALC}/$$i"; \ + fi; \ + done + ${Q}rm -f tmp + -${Q}if [ -z "${MANDIR}" ]; then \ + true; \ + else \ + if ${CMP} -s calc.1 ${MANDIR}/calc.${MANEXT}; then \ + true; \ + else \ + rm -f ${MANDIR}/calc.${MANEXT}.new; \ + cp -f calc.1 ${MANDIR}/calc.${MANEXT}.new; \ + ${CHMOD} 0444 ${MANDIR}/calc.${MANEXT}.new; \ + mv -f ${MANDIR}/calc.${MANEXT}.new \ + ${MANDIR}/calc.${MANEXT}; \ + echo "installed ${MANDIR}/calc.${MANEXT}"; \ + fi; \ + fi + -${Q}if [ -z "${CATDIR}" ]; then \ + true; \ + else \ + if ${CMP} -s calc.1 ${MANDIR}/calc.${MANEXT}; then \ + true; \ + else \ + if [ -z "${NROFF}" ]; then \ + echo "${MANMAKE} calc.1 ${CATDIR}"; \ + ${MANMAKE} calc.1 ${CATDIR}; \ + else \ + rm -f ${CATDIR}/calc.${CATEXT}.new; \ + ${NROFF} ${NROFF_ARG} calc.1 > \ + ${CATDIR}/calc.${CATEXT}.new; \ + ${CHMOD} ${MANMODE} ${MANDIR}/calc.${CATEXT}.new; \ + mv -f ${CATDIR}/calc.${CATEXT}.new \ + ${CATDIR}/calc.${CATEXT}; \ + echo "installed ${CATDIR}/calc.${CATEXT}"; \ + fi; \ fi; \ fi - ${Q}echo remove files that are obsolete - -rm -f ${LIBDIR}/endian.h endian.h - -rm -f ${LIBDIR}/stdarg.h stdarg.h - -rm -f ${LIBDIR}/prototype.h prototype.h - -rm -f ${LIBDIR}/libcalcerr.a libcalcerr.a - -rm -f ${LIBDIR}/calc_errno.h calc_errno.h ${INCDIRCALC}/calc_errno.h - -rm -f calc_errno.c calc_errno.o calc_errno lint.sed - -rm -f alloc.c alloc.o have_vs.c have_vs.o have_vs io.c io.o - -rm -f std_arg.h try_stdarg.c try_stdarg.o try_stdarg - -rm -f ${LIBDIR}/altbind ${HELPDIR}/altbind cal/altbind - -rm -f ${LIBDIR}/llib-lcalc.ln ${V} echo '=-=-=-=-= end of $@ rule =-=-=-=-=' ## diff --git a/cal/Makefile b/cal/Makefile index 0d02c8e..493d9ea 100644 --- a/cal/Makefile +++ b/cal/Makefile @@ -18,8 +18,8 @@ # received a copy with calc; if not, write to Free Software Foundation, Inc. # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. # -# @(#) $Revision: 29.5 $ -# @(#) $Id: Makefile,v 29.5 2001/03/31 16:24:17 chongo Exp $ +# @(#) $Revision: 29.9 $ +# @(#) $Id: Makefile,v 29.9 2001/05/28 21:56:08 chongo Exp $ # @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/Makefile,v $ # # Under source code control: 1991/07/21 05:00:54 @@ -40,11 +40,12 @@ MAKE_FILE = Makefile # a default here just in case you want to build from this directory. # # where to install things -TOPDIR= /usr/local/lib -#TOPDIR= /usr/lib -#TOPDIR= /usr/libdata +#SHAREDIR= /usr/local/lib +#SHAREDIR= /usr/lib +SHAREDIR= /usr/share +#SHAREDIR= /usr/libdata -LIBDIR= ${TOPDIR}/calc +CSHAREDIR= ${SHAREDIR}/calc # Makefile debug # @@ -57,6 +58,7 @@ Q=@ # standard tools # CHMOD= chmod +CMP= cmp # The calc files to install # @@ -116,34 +118,56 @@ calcliblist: fi; \ done +## +# +# rpm rules +# +## + +echo_CALC_FILES: ${MAKE_FILE} + @echo ${CALC_FILES} + +echo_install.list: ${MAKE_FILE} + @for i in ${CALC_FILES}; do \ + echo ${CSHAREDIR}/$$i; \ + done + +## +# +# Utility rules +# +## + clean: clobber: rm -f .all install: all - -${Q}if [ ! -d ${TOPDIR} ]; then \ - echo mkdir ${TOPDIR}; \ - mkdir ${TOPDIR}; \ + -${Q}if [ ! -d ${SHAREDIR} ]; then \ + echo mkdir ${SHAREDIR}; \ + mkdir ${SHAREDIR}; \ + echo ${CHMOD} 0755 ${SHAREDIR}; \ + ${CHMOD} 0755 ${SHAREDIR}; \ else \ true; \ fi - -${Q}if [ ! -d ${LIBDIR} ]; then \ - echo mkdir ${LIBDIR}; \ - mkdir ${LIBDIR}; \ + -${Q}if [ ! -d ${CSHAREDIR} ]; then \ + echo mkdir ${CSHAREDIR}; \ + mkdir ${CSHAREDIR}; \ + echo ${CHMOD} 0755 ${CSHAREDIR}; \ + ${CHMOD} 0755 ${CSHAREDIR}; \ else \ true; \ fi ${Q}for i in ${CALC_FILES}; do \ - echo rm -f ${LIBDIR}/$$i; \ - rm -f ${LIBDIR}/$$i; \ - echo cp $$i ${LIBDIR}; \ - cp $$i ${LIBDIR}; \ - echo ${CHMOD} 0444 ${LIBDIR}/$$i; \ - ${CHMOD} 0444 ${LIBDIR}/$$i; \ + if ${CMP} -s $$i ${CSHAREDIR}/$$i; then \ + true; \ + else \ + rm -f ${CSHAREDIR}/$$i.new; \ + cp -f $$i ${CSHAREDIR}/$$i.new; \ + ${CHMOD} 0444 ${CSHAREDIR}/$$i.new; \ + mv -f ${CSHAREDIR}/$$i.new ${CSHAREDIR}/$$i; \ + echo "installed ${CSHAREDIR}/$$i"; \ + fi; \ done - ${Q}echo remove files that are obsolete - -rm -f nextprime.cal nextprim.cal - -rm -f test1000.cal test2000.cal ${LIBDIR}/test2000.cal - -rm -f ${LIBDIR}/nextprime.cal ${LIBDIR}/nextprim.cal - -rm -f ${LIBDIR}/test1000.cal ${LIBDIR}/cryrand.cal diff --git a/codegen.c b/codegen.c index 7de7207..1f3ae71 100644 --- a/codegen.c +++ b/codegen.c @@ -19,8 +19,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.5 $ - * @(#) $Id: codegen.c,v 29.5 2001/04/14 22:55:39 chongo Exp $ + * @(#) $Revision: 29.6 $ + * @(#) $Id: codegen.c,v 29.6 2001/05/08 06:29:24 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/codegen.c,v $ * * Under source code control: 1990/02/15 01:48:13 @@ -127,6 +127,7 @@ getcommands(BOOL toplevel) if (!toplevel) enterfilescope(); for (;;) { + int i; (void) tokenmode(TM_NEWLINES); switch (gettoken()) { @@ -144,10 +145,14 @@ getcommands(BOOL toplevel) return; case T_HELP: - for (;;) { + for (i=1;;i++) { switch(getfilename(name, NULL)) { - case 1: - strcpy(name, DEFAULTCALCHELP); + case -1: + if(i == 1) { + strcpy(name, DEFAULTCALCHELP); + givehelp(name); + } + break; case 0: givehelp(name); continue; diff --git a/config.c b/config.c index 5767314..0364510 100644 --- a/config.c +++ b/config.c @@ -19,8 +19,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.6 $ - * @(#) $Id: config.c,v 29.6 2001/04/08 10:07:19 chongo Exp $ + * @(#) $Revision: 29.7 $ + * @(#) $Id: config.c,v 29.7 2001/04/25 07:15:22 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/config.c,v $ * * Under source code control: 1991/07/20 00:21:56 @@ -133,7 +133,7 @@ CONFIG oldstd = { /* backward compatible standard configuration */ 0, /* internal calc debug level */ 3, /* calc resource file debug level */ 0, /* user defined debug level */ - TRUE, /* print Quit or abort executed messages */ + FALSE, /* print Quit or abort executed messages */ CTRL_D_VIRGIN_EOF, /* ^D only exits on virgin lines */ NULL, /* our name */ NULL, /* basename of our name */ @@ -178,7 +178,7 @@ CONFIG newstd = { /* new non-backward compatible configuration */ 0, /* internal calc debug level */ 3, /* calc resource file debug level */ 0, /* user defined debug level */ - TRUE, /* print Quit or abort executed messages */ + FALSE, /* print Quit or abort executed messages */ CTRL_D_VIRGIN_EOF, /* ^D only exits on virgin lines */ NULL, /* our name */ NULL, /* basename of our name */ diff --git a/cscript/Makefile b/cscript/Makefile index b7cfafa..b047c08 100644 --- a/cscript/Makefile +++ b/cscript/Makefile @@ -17,8 +17,8 @@ # received a copy with calc; if not, write to Free Software Foundation, Inc. # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. # -# @(#) $Revision: 29.9 $ -# @(#) $Id: Makefile,v 29.9 2001/04/08 10:53:52 chongo Exp $ +# @(#) $Revision: 29.13 $ +# @(#) $Id: Makefile,v 29.13 2001/05/13 14:43:56 chongo Exp chongo $ # @(#) $Source: /usr/local/src/cmd/calc/cscript/RCS/Makefile,v $ # # Under source code control: 1999/11/29 11:10:26 @@ -39,8 +39,8 @@ MAKE_FILE = Makefile # Normally, the upper level makefile will set these values. We provide # a default here just in case you want to build from this directory. # -BINDIR= /usr/local/bin -#BINDIR= /usr/bin +#BINDIR= /usr/local/bin +BINDIR= /usr/bin #BINDIR= /usr/contrib/bin # SCRIPTDIR= ${BINDIR}/cscript @@ -59,6 +59,7 @@ CHMOD= chmod SED= sed SORT= sort FMT= fmt +CMP= cmp # The ${SCRIPT} list is the list of calc shell script files (without the .calc # extension) which will be installed. @@ -76,10 +77,10 @@ FMT= fmt # # make detaillist # -SCRIPT= mersenne piforever plus simple square fproduct +SCRIPT= mersenne piforever plus simple square fproduct powerterm SCRIPT_SRC= mersenne.calc piforever.calc plus.calc simple.calc square.calc \ - fproduct.calc + fproduct.calc powerterm.calc # These files are found (but not built) in the distribution # @@ -89,9 +90,17 @@ DISTLIST= ${SCRIPT_SRC} ${MAKE_FILE} README # CALCLIBLIST= +# complete list of targets +# +# NOTE: This list MUST be co-ordinated with the ${CSCRIPT_TARGETS} variable +# in the upper level ../Makefile +# +CSCRIPT_TARGETS= ${SCRIPT} +TARGETS= ${CSCRIPT_TARGETS} + # The reason for this Makefile # -all: ${SCRIPT} ${SCRIPT_SRC} .all +all: ${TARGETS} .all # used by the upper level Makefile to determine if we have done all # @@ -185,7 +194,7 @@ depend: ${Q}echo "" >> Makefile ${Q}${SED} -n '3,$$p' makedep.out >> Makefile -${Q}rm -f makedep.out - -${Q}if cmp -s Makefile.bak Makefile; then \ + -${Q}if ${CMP} -s Makefile.bak Makefile; then \ echo 'sample Makefile was already up to date'; \ mv -f Makefile.bak Makefile; \ else \ @@ -200,32 +209,59 @@ depend: fi; \ fi +## +# +# rpm rules +# +## + +echo_SCRIPT: ${MAKE_FILE} + @echo ${SCRIPT} + + +echo_install.list: ${MAKE_FILE} + @for i in ${SCRIPT}; do \ + echo ${SCRIPTDIR}/$$i; \ + done +## +# +# Utility rules +# +## + clean: -rm -f makedep.out clobber: - -rm -f ${SCRIPT} + -rm -f ${TARGETS} install: all -${Q}if [ ! -d ${BINDIR} ]; then \ - echo mkdir ${BINDIR}; \ - mkdir ${BINDIR}; \ + echo mkdir ${BINDIR}; \ + mkdir ${BINDIR}; \ + echo ${CHMOD} 0755 ${BINDIR}; \ + ${CHMOD} 0755 ${BINDIR}; \ else \ true; \ fi -${Q}if [ ! -d ${SCRIPTDIR} ]; then \ - echo mkdir ${SCRIPTDIR}; \ - mkdir ${SCRIPTDIR}; \ + echo mkdir ${SCRIPTDIR}; \ + mkdir ${SCRIPTDIR}; \ + echo ${CHMOD} 0755 ${SCRIPTDIR}; \ + ${CHMOD} 0755 ${SCRIPTDIR}; \ else \ true; \ fi ${Q}for i in ${SCRIPT}; do \ - echo rm -f ${SCRIPTDIR}/$$i; \ - rm -f ${SCRIPTDIR}/$$i; \ - echo cp $$i ${SCRIPTDIR}; \ - cp $$i ${SCRIPTDIR}; \ - echo ${CHMOD} 0555 ${SCRIPTDIR}/$$i; \ + if ${CMP} -s $$i ${SCRIPTDIR}/$$i; then \ + true; \ + else \ + rm -f ${SCRIPTDIR}/$$i.new; \ + cp -f $$i ${SCRIPTDIR}/$$i.new; \ ${CHMOD} 0555 ${SCRIPTDIR}/$$i; \ + mv -f ${SCRIPTDIR}/$$i.new ${SCRIPTDIR}/$$i; \ + echo "installed ${SCRIPTDIR}/$$i"; \ + fi; \ done # DO NOT DELETE THIS LINE -- make depend depends on it. @@ -254,3 +290,7 @@ fproduct: fproduct.calc rm -f $@ ${SED} -e "1s:^#!/usr/local/src/cmd/calc/calc:#!${BINDIR}/calc:" $?>$@ ${CHMOD} +x $@ +powerterm: powerterm.calc + rm -f $@ + ${SED} -e "1s:^#!/usr/local/src/cmd/calc/calc:#!${BINDIR}/calc:" $?>$@ + ${CHMOD} +x $@ diff --git a/cscript/README b/cscript/README index 10386e1..4e11518 100644 --- a/cscript/README +++ b/cscript/README @@ -39,6 +39,12 @@ plus arg ... Print the sum of 1 or more arguments. +powerterm [base_limit] value + + Print the value as a sum (or difference) of powers of integers up + to and including powers <= base_limit. By default, base_limit is 10000. + + simple A trivial example of a calc shell script. @@ -59,8 +65,8 @@ simple ## received a copy with calc; if not, write to Free Software Foundation, Inc. ## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. ## -## @(#) $Revision: 29.5 $ -## @(#) $Id: README,v 29.5 2001/04/08 08:24:40 chongo Exp $ +## @(#) $Revision: 29.6 $ +## @(#) $Id: README,v 29.6 2001/04/25 07:26:12 chongo Exp $ ## @(#) $Source: /usr/local/src/cmd/calc/cscript/RCS/README,v $ ## ## Under source code control: 1999/12/17 10:23:40 diff --git a/cscript/powerterm.calc b/cscript/powerterm.calc new file mode 100644 index 0000000..05cc2c8 --- /dev/null +++ b/cscript/powerterm.calc @@ -0,0 +1,185 @@ +#!/usr/local/bin/calc -q -s -f +/* + * powerterm - print the argument as a sum of powers of integers + * + * usage: + * powerterm [base_limit] value + * + * base_limit largest base we will consider (def: 10000) + * value value to convert into sums of powers of integers + * + * Copyright (C) 2001 Landon Curt Noll + * + * Calc is open software; you can redistribute it and/or modify it under + * the powerterm of the version 2.1 of the GNU Lesser General Public License + * as published by the Free Software Foundation. + * + * Calc is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General + * Public License for more details. + * + * A copy of version 2.1 of the GNU Lesser General Public License is + * distributed with calc under the filename COPYING-LGPL. You should have + * received a copy with calc; if not, write to Free Software Foundation, Inc. + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. + * + * @(#) $Revision: 29.5 $ + * @(#) $Id: powerterm.calc,v 29.5 2001/04/25 08:41:36 chongo Exp $ + * @(#) $Source: /usr/local/src/cmd/calc/cscript/RCS/powerterm.calc,v $ + * + * Under source code control: 2001/04/24 23:49:11 + * File existed as early as: 2001 + * + * chongo /\oo/\ http://www.isthe.com/chongo/ + * Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ + */ + + +/* + * parse args + */ +config("verbose_quit", 0),; +base_lim = 10000; /* default: highest base we will consider */ +if (argv() < 2 || argv() > 3) { + fprintf(files(2), "usage: %s [base_limit] value\n", argv(0)); + exit; +} +if (argv() == 3) { + x = eval(argv(2)); + base_lim = eval(argv(1)); +} else { + x = eval(argv(1)); +} +if (! isint(x)) { + fprintf(files(2), "%s: value must be an integer\n"); + exit; +} +if (! isint(base_lim)) { + fprintf(files(2), "%s: base limit must be an integer\n"); + exit; +} +if (base_lim <= 1) { + fprintf(files(2), "%s: base limit is too small\n"); + exit; +} +++base_lim; + +/* + * setup loop variables + */ +term = 0; /* number of powerterm found */ + +/* + * log constants + */ +if (base_lim <= 2^20+1) { /* 2^20 requires ~96 Megs of memory */ + mat lni[base_lim]; /* log of integers */ + for (i=2; i < base_lim; ++i) { + lni[i] = ln(i); + } + have_lni = 1; /* have lni[x] array */ +} else { + mat lni[1]; /* not used */ + have_lni = 0; /* base_lim too large for array */ +} + +/* + * remove nestest powers + */ +while (abs(x) >= base_lim) { + + /* + * look for the nearest power + */ + lnx = ln(abs(x)); /* log of the remaining co-factor */ + closest = 0.5; + base = 1; + exponent = 0; + if (have_lni) { + + /* + * use pre-calculated log array when looking for the nearest power + */ + for (i = 2; i < base_lim; ++i) { + + /* + * determine exponent closeness to an integer + */ + ex = lnx / lni[i]; + power = int(ex + 0.5); + diff = ex - power; + + /* + * look for a closer power + */ + if (abs(diff) < closest) { + closest = abs(diff); + base = i; + exponent = power; + } + } + + } else { + + /* + * re-calculate logs when looking for the nearest power + */ + for (i = 2; i < base_lim; ++i) { + + /* + * determine exponent closeness to an integer + */ + ex = lnx / ln(i); + power = int(ex + 0.5); + diff = ex - power; + + /* + * look for a closer power + */ + if (abs(diff) < closest) { + closest = abs(diff); + base = i; + exponent = power; + } + } + } + + /* + * output current term and then subtract it + */ + if (x != 0) { + if (x < 0) { + print "-",; + } else if (term > 0) { + print "+",; + } + if (exponent > 1) { + print base: "^": exponent,; + } else { + print base,; + } + } + + /* + * subtract (or add) this near power + */ + if (x < 0) { + x = x + base^exponent; + } else { + x = x - base^exponent; + } + ++term; +} + +/* + * print the final term + */ +if (x < 0) { + print "-", -x; +} else if (x > 0) { + print "+", x; +} else { + print ""; +} +exit; diff --git a/custom/Makefile b/custom/Makefile index 5e4584c..da5f0fe 100644 --- a/custom/Makefile +++ b/custom/Makefile @@ -18,8 +18,8 @@ # received a copy with calc; if not, write to Free Software Foundation, Inc. # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. # -# @(#) $Revision: 29.6 $ -# @(#) $Id: Makefile,v 29.6 2001/04/08 10:53:52 chongo Exp $ +# @(#) $Revision: 29.11 $ +# @(#) $Id: Makefile,v 29.11 2001/05/28 22:23:56 chongo Exp $ # @(#) $Source: /usr/local/src/cmd/calc/custom/RCS/Makefile,v $ # # Under source code control: 1997/03/09 02:28:54 @@ -93,21 +93,28 @@ Q=@ # # where to install things # -# ${TOPDIR} is the directory under which the calc directory will be placed. -# ${LIBDIR} is where the *.cal, *.h, *.a, bindings and help dir are installed. -# ${HELPDIR} is where the help directory is installed. -# ${CUSTOMLIBDIR} is where custom lib files are installed. -# ${CUSTOMHELPDIR} is where custom help files are installed. +# ${SHAREDIR} where most common shared files are kept +# ${INCDIR} where most .h files are kept # -TOPDIR= /usr/local/lib -#TOPDIR= /usr/lib -#TOPDIR= /usr/libdata -#TOPDIR= /usr/contrib/lib +# ${CSHAREDIR} where most common shared calc files are kept +# ${HELPDIR} where the help directory is installed. +# ${INCDIRCALC} where the calc include files are installed +# ${CUSTOMLIBDIR} where custom *.cal files & libcustcalc.a are installed. +# ${CUSTOMHELPDIR} where custom help files are installed. +# ${CUSTOMINCPDIR} where custom .h files are installed. # -LIBDIR= ${TOPDIR}/calc -HELPDIR= ${LIBDIR}/help -CUSTOMLIBDIR= ${LIBDIR}/custom -CUSTOMHELPDIR= ${HELPDIR}/custhelp +#SHAREDIR= /usr/local/lib +SHAREDIR= /usr/share +# +#INCDIR= /usr/local/include +INCDIR= /usr/include +# +CSHAREDIR= ${SHAREDIR}/calc +HELPDIR= ${CSHAREDIR}/help +INCDIRCALC= ${INCDIR}/calc +CUSTOMLIBDIR= ${CSHAREDIR}/custom +CUSTOMHELPDIR= ${CSHAREDIR}/custhelp +CUSTOMINCDIR= ${INCDIRCALC}/custom # Normally, the upper level makefile will set these values. We provide # a default here just in case you want to build from this directory. @@ -288,9 +295,13 @@ DISTLIST= ${CUSTCALC_SRC} ${CUSTOM_CALC_FILES} ${CUSTOM_HELP} \ # CALCLIBLIST= ${CUSTCALC_SRC} ${INSTALL_H_SRC} ${MAKE_FILE} HOW_TO_ADD +# This is the custom .a link library that is build +# +CALC_LIBCUSTOM= libcustcalc.a + # complete list of targets # -TARGETS= libcustcalc.a ${CUSTCALC_OBJ} +TARGETS= ${CALC_LIBCUSTOM} ${CUSTCALC_OBJ} # required vars # @@ -303,6 +314,7 @@ SED= sed MAKEDEPEND= makedepend CHMOD= chmod SORT= sort +CMP= cmp ## # @@ -313,7 +325,7 @@ SORT= sort all: ${TARGETS} ${INSTALL_H_SRC} ${CUSTOM_CALC_FILES} \ ${CUSTOM_HELP} ${MAKE_FILE} .all -libcustcalc.a: ${CUSTCALC_OBJ} ${MAKE_FILE} ../Makefile +libcustcalc.a: ${CUSTCALC_OBJ} ${MAKE_FILE} ../${MAKE_FILE} -rm -f libcustcalc.a ar qc libcustcalc.a ${CUSTCALC_OBJ} ${RANLIB} libcustcalc.a @@ -435,7 +447,7 @@ depend: ${Q}${SED} -n '3,$$p' skel/custom/makedep.out | \ LANG=C ${SORT} -u >> Makefile -${Q}rm -rf skel - -${Q}if cmp -s Makefile.bak Makefile; then \ + -${Q}if ${CMP} -s Makefile.bak Makefile; then \ echo 'custom Makefile was already up to date'; \ mv -f Makefile.bak Makefile; \ else \ @@ -450,6 +462,35 @@ depend: fi; \ fi +## +# +# rpm rules +# +## + +echo_INSTALL_H_SRC: ${MAKE_FILE} + @echo ${INSTALL_H_SRC} + +echo_CUSTOM_CALC_FILES: ${MAKE_FILE} + @echo ${CUSTOM_CALC_FILES} + +echo_CUSTOM_HELP: ${MAKE_FILE} + @echo ${CUSTOM_HELP} + +echo_install.list: ${MAKE_FILE} + @for i in ${INSTALL_H_SRC}; do \ + echo ${CUSTOMINCDIR}/$$i; \ + done + @for i in ${CUSTOM_HELP}; do \ + echo ${CUSTOMHELPDIR}/$$i; \ + done + @for i in ${CUSTOM_CALC_FILES}; do \ + echo ${CUSTOMLIBDIR}/$$i; \ + done + @for i in ${CALC_LIBCUSTOM}; do \ + echo ${CUSTOMLIBDIR}/$$i; \ + done + ## # # Utility rules @@ -464,70 +505,119 @@ clobber: rm -f .all Makefile.tmp Makefile.bak install: all - -${Q}if [ ! -d ${TOPDIR} ]; then \ - echo mkdir ${TOPDIR}; \ - mkdir ${TOPDIR}; \ + -${Q}if [ ! -d ${SHAREDIR} ]; then \ + echo mkdir ${SHAREDIR}; \ + mkdir ${SHAREDIR}; \ + echo ${CHMOD} 0755 ${SHAREDIR}; \ + ${CHMOD} 0755 ${SHAREDIR}; \ else \ true; \ fi - -${Q}if [ ! -d ${LIBDIR} ]; then \ - echo mkdir ${LIBDIR}; \ - mkdir ${LIBDIR}; \ + -${Q}if [ ! -d ${INCDIR} ]; then \ + echo mkdir ${INCDIR}; \ + mkdir ${INCDIR}; \ + echo ${CHMOD} 0755 ${INCDIR}; \ + ${CHMOD} 0755 ${INCDIR}; \ + else \ + true; \ + fi + -${Q}if [ ! -d ${CSHAREDIR} ]; then \ + echo mkdir ${CSHAREDIR}; \ + mkdir ${CSHAREDIR}; \ + echo ${CHMOD} 0755 ${CSHAREDIR}; \ + ${CHMOD} 0755 ${CSHAREDIR}; \ + else \ + true; \ + fi + -${Q}if [ ! -d ${INCDIRCALC} ]; then \ + echo mkdir ${INCDIRCALC}; \ + mkdir ${INCDIRCALC}; \ + echo ${CHMOD} 0755 ${INCDIRCALC}; \ + ${CHMOD} 0755 ${INCDIRCALC}; \ else \ true; \ fi -${Q}if [ ! -d ${HELPDIR} ]; then \ echo mkdir ${HELPDIR}; \ mkdir ${HELPDIR}; \ + echo ${CHMOD} 0755 ${HELPDIR}; \ + ${CHMOD} 0755 ${HELPDIR}; \ else \ true; \ fi -${Q}if [ ! -d ${CUSTOMLIBDIR} ]; then \ echo mkdir ${CUSTOMLIBDIR}; \ mkdir ${CUSTOMLIBDIR}; \ + echo ${CHMOD} 0755 ${CUSTOMLIBDIR}; \ + ${CHMOD} 0755 ${CUSTOMLIBDIR}; \ else \ true; \ fi -${Q}if [ ! -d ${CUSTOMHELPDIR} ]; then \ echo mkdir ${CUSTOMHELPDIR}; \ mkdir ${CUSTOMHELPDIR}; \ + echo ${CHMOD} 0755 ${CUSTOMHELPDIR}; \ + ${CHMOD} 0755 ${CUSTOMHELPDIR}; \ else \ true; \ fi - ${Q}for i in ${INSTALL_H_SRC} /dev/null; do \ - if [ X$$i = X/dev/null ]; then continue; fi; \ - echo rm -f ${CUSTOMLIBDIR}/$$i; \ - rm -f ${CUSTOMLIBDIR}/$$i; \ - echo cp $$i ${CUSTOMLIBDIR}; \ - cp $$i ${CUSTOMLIBDIR}; \ - echo ${CHMOD} 0444 ${CUSTOMLIBDIR}/$$i; \ - ${CHMOD} 0444 ${CUSTOMLIBDIR}/$$i; \ + -${Q}if [ ! -d ${CUSTOMINCDIR} ]; then \ + echo mkdir ${CUSTOMINCDIR}; \ + mkdir ${CUSTOMINCDIR}; \ + echo ${CHMOD} 0755 ${CUSTOMINCDIR}; \ + ${CHMOD} 0755 ${CUSTOMINCDIR}; \ + else \ + true; \ + fi + -${Q}for i in ${INSTALL_H_SRC}; do \ + rm -f tmp; \ + ${SED} -e 's/^\(#[ ]*include[ ][ ]*\)"/\1"calc\//' $$i > tmp; \ + if ${CMP} -s tmp ${CUSTOMINCDIR}/$$i; then \ + true; \ + else \ + rm -f ${CUSTOMINCDIR}/$$i; \ + cp -f tmp ${INCDIRCALC}/$$i.new; \ + cp -f $$i ${CUSTOMINCDIR}/$$i.new; \ + ${CHMOD} 0444 ${CUSTOMINCDIR}/$$i.new; \ + mv -f ${CUSTOMINCDIR}/$$i.new ${CUSTOMINCDIR}/$$i; \ + echo "installed ${CUSTOMINCDIR}/$$i"; \ + fi; \ done - ${Q}for i in ${CUSTOM_CALC_FILES}; do \ - echo rm -f ${CUSTOMLIBDIR}/$$i; \ + -${Q}rm -f tmp + -${Q}for i in ${CUSTOM_CALC_FILES}; do \ + if ${CMP} -s $$i ${CUSTOMLIBDIR}/$$i; then \ + true; \ + else \ rm -f ${CUSTOMLIBDIR}/$$i; \ - echo cp $$i ${CUSTOMLIBDIR}; \ - cp $$i ${CUSTOMLIBDIR}; \ - echo ${CHMOD} 0444 ${CUSTOMLIBDIR}/$$i; \ - ${CHMOD} 0444 ${CUSTOMLIBDIR}/$$i; \ + cp -f $$i ${CUSTOMLIBDIR}/$$i; \ + ${CHMOD} 0444 ${CUSTOMLIBDIR}/$$i.new; \ + mv -f ${CUSTOMLIBDIR}/$$i.new ${CUSTOMLIBDIR}/$$i; \ + echo "installed ${CUSTOMLIBDIR}/$$i"; \ + fi; \ done - ${Q}for i in ${CUSTOM_HELP}; do \ - echo rm -f ${CUSTOMHELPDIR}/$$i; \ + -${Q}for i in ${CUSTOM_HELP}; do \ + if ${CMP} -s $$i ${CUSTOMHELPDIR}/$$i; then \ + true; \ + else \ rm -f ${CUSTOMHELPDIR}/$$i; \ - echo cp $$i ${CUSTOMHELPDIR}; \ - cp $$i ${CUSTOMHELPDIR}; \ - echo ${CHMOD} 0444 ${CUSTOMHELPDIR}/$$i; \ - ${CHMOD} 0444 ${CUSTOMHELPDIR}/$$i; \ + cp -f $$i ${CUSTOMHELPDIR}/$$i.new; \ + ${CHMOD} 0444 ${CUSTOMHELPDIR}/$$i.new; \ + mv -f ${CUSTOMHELPDIR}/$$i.new ${CUSTOMHELPDIR}/$$i; \ + echo "installed ${CUSTOMHELPDIR}/$$i"; \ + fi; \ done -${Q}if [ ! -z ${ALLOW_CUSTOM} ]; then \ - echo "rm -f ${CUSTOMLIBDIR}/libcustcalc.a"; \ - rm -f ${CUSTOMLIBDIR}/libcustcalc.a; \ - echo "cp libcustcalc.a ${CUSTOMLIBDIR}/libcustcalc.a"; \ - cp libcustcalc.a ${CUSTOMLIBDIR}/libcustcalc.a; \ - echo "${CHMOD} 0644 ${CUSTOMLIBDIR}/libcustcalc.a"; \ + if ${CMP} -s libcustcalc.a ${CUSTOMLIBDIR}/libcustcalc.a; then \ + true; \ + else \ + rm -f ${CUSTOMLIBDIR}/libcustcalc.a.new; \ + cp -f libcustcalc.a ${CUSTOMLIBDIR}/libcustcalc.a.new; \ ${CHMOD} 0644 ${CUSTOMLIBDIR}/libcustcalc.a; \ - echo "${RANLIB} ${CUSTOMLIBDIR}/libcustcalc.a"; \ + mv -f ${CUSTOMLIBDIR}/libcustcalc.a.new \ + ${CUSTOMLIBDIR}/libcustcalc.a; \ ${RANLIB} ${CUSTOMLIBDIR}/libcustcalc.a; \ + echo "installed ${CUSTOMLIBDIR}/libcustcalc.a"; \ + fi; \ fi ## diff --git a/help/Makefile b/help/Makefile index df494b6..86e91d6 100644 --- a/help/Makefile +++ b/help/Makefile @@ -18,8 +18,8 @@ # received a copy with calc; if not, write to Free Software Foundation, Inc. # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. # -# @(#) $Revision: 29.6 $ -# @(#) $Id: Makefile,v 29.6 2001/04/08 10:53:52 chongo Exp $ +# @(#) $Revision: 29.12 $ +# @(#) $Id: Makefile,v 29.12 2001/05/28 22:36:28 chongo Exp $ # @(#) $Source: /usr/local/src/cmd/calc/help/RCS/Makefile,v $ # # Under source code control: 1991/07/23 06:47:57 @@ -36,15 +36,16 @@ SHELL= /bin/sh MAKE_FILE = Makefile -# Normally, the upper level makefile will set these values. We provide -# a default here just in case you want to build from this directory. +# ${SHAREDIR} where most common shared files are kept # -TOPDIR= /usr/local/lib -#TOPDIR= /usr/lib -#TOPDIR= /usr/libdata +# ${CSHAREDIR} where most common shared calc files are kept +# ${HELPDIR} where the help directory is installed. +# +#SHAREDIR= /usr/local/lib +SHAREDIR= /usr/share -LIBDIR= ${TOPDIR}/calc -HELPDIR= ${LIBDIR}/help +CSHAREDIR= ${SHAREDIR}/calc +HELPDIR= ${CSHAREDIR}/help # Makefile debug # @@ -63,6 +64,7 @@ CHMOD= chmod SED= sed SORT= sort FMT= fmt +CMP= cmp # Standard and Builtin help files # @@ -489,6 +491,37 @@ detaillist: ${SED} -e '1s/xxxxx/DETAIL_HELP=/' -e '2,$$s/^/ /' \ -e 's/$$/ \\/' -e '$$s/ \\$$//' +## +# +# rpm rules +# +## + +echo_STD_HELP_FILES: ${MAKE_FILE} + @echo ${STD_HELP_FILES} + +echo_BLT_HELP_FILES: ${MAKE_FILE} + @echo ${BLT_HELP_FILES} + +echo_DETAIL_HELP: ${MAKE_FILE} + @echo ${DETAIL_HELP} + +echo_SINGULAR_FILES: ${MAKE_FILE} + @echo ${SINGULAR_FILES} + +echo_install.list: ${MAKE_FILE} + @for i in ${STD_HELP_FILES} full ${BLT_HELP_FILES} \ + builtin ${DETAIL_HELP} ${SINGULAR_FILES}; do \ + echo ${HELPDIR}/$$i; \ + done + @echo ${HELPDIR}/obj + +## +# +# Utility rules +# +## + clean: rm -f obj mkbuiltin funclist.c funclist.o funclist rm -f COPYING COPYING-LGPL @@ -500,36 +533,48 @@ clobber: rm -f ${SINGULAR_FILES} ${DETAIL_CLONE} install: all - -${Q}if [ ! -d ${TOPDIR} ]; then \ - echo mkdir ${TOPDIR}; \ - mkdir ${TOPDIR}; \ + -${Q}if [ ! -d ${SHAREDIR} ]; then \ + echo mkdir ${SHAREDIR}; \ + mkdir ${SHAREDIR}; \ + echo ${CHMOD} 0755 ${SHAREDIR}; \ + ${CHMOD} 0755 ${SHAREDIR}; \ else \ true; \ fi - -${Q}if [ ! -d ${LIBDIR} ]; then \ - echo mkdir ${LIBDIR}; \ - mkdir ${LIBDIR}; \ + -${Q}if [ ! -d ${CSHAREDIR} ]; then \ + echo mkdir ${CSHAREDIR}; \ + mkdir ${CSHAREDIR}; \ + echo ${CHMOD} 0755 ${CSHAREDIR}; \ + ${CHMOD} 0755 ${CSHAREDIR}; \ else \ true; \ fi -${Q}if [ ! -d ${HELPDIR} ]; then \ echo mkdir ${HELPDIR}; \ mkdir ${HELPDIR}; \ + echo ${CHMOD} 0755 ${HELPDIR}; \ + ${CHMOD} 0755 ${HELPDIR}; \ else \ true; \ fi - ${Q}for i in ${STD_HELP_FILES} ${BLT_HELP_FILES} builtin \ + -${Q}for i in ${STD_HELP_FILES} ${BLT_HELP_FILES} builtin \ full ${DETAIL_HELP} ${SINGULAR_FILES}; do \ - echo rm -f ${HELPDIR}/$$i; \ - rm -f ${HELPDIR}/$$i; \ - echo cp $$i ${HELPDIR}; \ - cp $$i ${HELPDIR}; \ - echo ${CHMOD} 0444 ${HELPDIR}/$$i; \ - ${CHMOD} 0444 ${HELPDIR}/$$i; \ + if ${CMP} -s $$i ${HELPDIR}/$$i; then \ + true; \ + else \ + rm -f ${HELPDIR}/$$i.new; \ + cp -f $$i ${HELPDIR}/$$i.new; \ + ${CHMOD} 0444 ${HELPDIR}/$$i.new; \ + mv -f ${HELPDIR}/$$i.new ${HELPDIR}/$$i; \ + echo "installed ${HELPDIR}/$$i"; \ + fi; \ done - rm -f ${HELPDIR}/obj - cp obj.file ${HELPDIR}/obj - ${CHMOD} 0444 ${HELPDIR}/obj - ${Q}echo remove files that are obsolete - -rm -f rmblk block stdlib - -rm -f ${HELPDIR}/rmblk ${HELPDIR}/block ${HELPDIR}/stdlib + -${Q}if ${CMP} -s obj.file ${HELPDIR}/obj; then \ + true; \ + else \ + rm -f ${HELPDIR}/obj.new; \ + cp -f obj.file ${HELPDIR}/obj.new; \ + ${CHMOD} 0444 ${HELPDIR}/obj.new; \ + mv -f ${HELPDIR}/obj.new ${HELPDIR}/obj; \ + echo "installed ${HELPDIR}/obj"; \ + fi diff --git a/help/config b/help/config index dc90a8d..0324d05 100644 --- a/help/config +++ b/help/config @@ -580,12 +580,14 @@ Detailed config descriptions The "verbose_quit" controls the print of the message: - Quit or abort executed + quit or abort executed when a non-interactive quit or abort without an argument is encountered. A quit of abort without an argument does not display a message when invoked at the interactive level. + By deafult, "verbose_quit" is false. + =-= config("ctrl_d", "ctrl_d_string") @@ -711,8 +713,8 @@ Detailed config descriptions ## received a copy with calc; if not, write to Free Software Foundation, Inc. ## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. ## -## @(#) $Revision: 29.5 $ -## @(#) $Id: config,v 29.5 2001/04/14 22:46:33 chongo Exp $ +## @(#) $Revision: 29.6 $ +## @(#) $Id: config,v 29.6 2001/04/25 07:17:38 chongo Exp $ ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/config,v $ ## ## Under source code control: 1991/07/21 04:37:17 diff --git a/help/seed b/help/seed index 36df2d6..13ba79a 100644 --- a/help/seed +++ b/help/seed @@ -19,9 +19,9 @@ DESCRIPTION is almost certainly non-chaotic. This function is likely not suitable for applications (such as cryptographic applications) where the unpredictability of seeds is critical. For such critical - applications, lavarand should be used. See the URL: + applications, LavaRnd should be used. See the URL: - http://lavarand.sgi.com/index.html + http://www.LavaRnd.org/ for information about seeding a pseudo-random number generator (such as rand() or random()) with the cryptographic hash of the @@ -67,8 +67,8 @@ SEE ALSO ## received a copy with calc; if not, write to Free Software Foundation, Inc. ## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. ## -## @(#) $Revision: 29.2 $ -## @(#) $Id: seed,v 29.2 2000/06/07 14:02:33 chongo Exp $ +## @(#) $Revision: 29.3 $ +## @(#) $Id: seed,v 29.3 2001/05/13 13:26:26 chongo Exp $ ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/seed,v $ ## ## Under source code control: 1999/10/03 10:04:29 diff --git a/help/srandom b/help/srandom index aa5c4ab..f92c836 100644 --- a/help/srandom +++ b/help/srandom @@ -220,11 +220,11 @@ DESCRIPTION Blum moduli. The pre-defined Blum moduli and quadratic residues were selected - by lavarand, a hardware random number generator. See the URL: + by LavaRnd, a hardware random number generator. See the URL: - http://lavarand.sgi.com/index.html + http://www.LavaRnd.org/ - for an explanation of how the lavarand random number generator works. + for an explanation of how the LavaRnd random number generator works. For more information, see the comments at the top of the calc source file, zrandom.c. @@ -354,8 +354,8 @@ SEE ALSO ## received a copy with calc; if not, write to Free Software Foundation, Inc. ## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. ## -## @(#) $Revision: 29.2 $ -## @(#) $Id: srandom,v 29.2 2000/06/07 14:02:33 chongo Exp $ +## @(#) $Revision: 29.3 $ +## @(#) $Id: srandom,v 29.3 2001/05/13 13:26:26 chongo Exp $ ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/srandom,v $ ## ## Under source code control: 1997/02/17 01:18:22 diff --git a/opcodes.c b/opcodes.c index e3cc7a3..50d0082 100644 --- a/opcodes.c +++ b/opcodes.c @@ -19,8 +19,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.3 $ - * @(#) $Id: opcodes.c,v 29.3 2000/07/17 15:35:49 chongo Exp $ + * @(#) $Revision: 29.4 $ + * @(#) $Id: opcodes.c,v 29.4 2001/04/25 07:16:26 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/opcodes.c,v $ * * Under source code control: 1990/02/15 01:48:19 @@ -3234,7 +3234,7 @@ o_quit(FUNC *fp, long index) if (cp) printf("%s\n", cp); else if (conf->verbose_quit) - printf("Quit or abort executed\n"); + printf("quit or abort executed\n"); if (!inputisterminal() && !strcmp(fp->f_name, "*")) closeinput(); go = FALSE; diff --git a/sample/Makefile b/sample/Makefile index c8420c1..d2c85ae 100644 --- a/sample/Makefile +++ b/sample/Makefile @@ -17,8 +17,8 @@ # received a copy with calc; if not, write to Free Software Foundation, Inc. # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. # -# @(#) $Revision: 29.5 $ -# @(#) $Id: Makefile,v 29.5 2001/04/08 10:53:52 chongo Exp $ +# @(#) $Revision: 29.9 $ +# @(#) $Id: Makefile,v 29.9 2001/05/28 22:27:15 chongo Exp $ # @(#) $Source: /usr/local/src/cmd/calc/sample/RCS/Makefile,v $ # # Under source code control: 1997/04/19 22:46:49 @@ -78,18 +78,30 @@ Q=@ # Normally, the upper level makefile will set these values. We provide # a default here just in case you want to build from this directory. # -# where to install things +# where things go # -# ${TOPDIR} is the directory under which the calc directory will be placed. -# ${LIBDIR} is where the *.cal, *.h, *.a, bindings and help dir are installed. -# ${HELPDIR} is where the help directory is installed. +# ${BINDIR} where to install binary files +# ${SHAREDIR} where most common shared files are kept +# ${INCDIR} where most .h files are kept +# ${LIBDIR} where *.a files are installed # -TOPDIR= /usr/local/lib -#TOPDIR= /usr/lib -#TOPDIR= /usr/libdata -#TOPDIR= /usr/contrib/lib +# ${CSHAREDIR} where most common shared calc files are kept +# ${HELPDIR} where the help directory is installed. # -LIBDIR= ${TOPDIR}/calc +#BINDIR= /usr/local/bin +BINDIR= /usr/bin +#BINDIR= /usr/contrib/bin +# +#SHAREDIR= /usr/local/lib +SHAREDIR= /usr/share +# +#INCDIR= /usr/local/include +INCDIR= /usr/include +# +#LIBDIR= /usr/local/lib +LIBDIR= /usr/lib + +CSHAREDIR= ${SHAREDIR}/calc HELPDIR= ${LIBDIR}/help # Normally, the upper level makefile will set these values. We provide @@ -266,12 +278,15 @@ CALCLIBLIST= ${C_SRC} ${H_SRC} ${MAKE_FILE} README_SAMPLE # complete list of targets # -TARGETS= many_random test_random +# NOTE: This list MUST be co-ordinated with the ${SAMPLE_TARGETS} variable +# in the upper level ../Makefile +# +SAMPLE_TARGETS= many_random test_random +TARGETS= ${SAMPLE_TARGETS} # required vars # SHELL= /bin/sh -MAKE_FILE= Makefile # standard tools # @@ -279,6 +294,7 @@ SED= sed MAKEDEPEND= makedepend CHMOD= chmod SORT= sort +CMP= cmp ## # @@ -287,6 +303,7 @@ SORT= sort ## all: ${TARGETS} .all + @true test_random.o: test_random.c ${CC} ${CFLAGS} ${ALLOW_CUSTOM} test_random.c -c @@ -407,7 +424,7 @@ depend: ${Q}${SED} -n '3,$$p' skel/sample/makedep.out | \ LANG=C ${SORT} -u >> Makefile -${Q}rm -rf skel - -${Q}if cmp -s Makefile.bak Makefile; then \ + -${Q}if ${CMP} -s Makefile.bak Makefile; then \ echo 'sample Makefile was already up to date'; \ mv -f Makefile.bak Makefile; \ else \ @@ -422,6 +439,15 @@ depend: fi; \ fi +## +# +# rpm rules +# +## + +echo_install.list: Makefile + + ## # # Utility rules @@ -437,7 +463,9 @@ clobber: rm -f .all Makefile.tmp sample # for right now we will not install anything +# install: all + @true ## # diff --git a/seed.c b/seed.c index fbdce2c..cb720ab 100644 --- a/seed.c +++ b/seed.c @@ -17,8 +17,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.4 $ - * @(#) $Id: seed.c,v 29.4 2001/03/17 21:31:47 chongo Exp $ + * @(#) $Revision: 29.5 $ + * @(#) $Id: seed.c,v 29.5 2001/05/08 06:44:29 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/seed.c,v $ * * Under source code control: 1999/10/03 10:06:53 @@ -31,10 +31,10 @@ /* * Generate a quasi-random seed based on system and process information. * - * NOTE: This is not a good source of chaotic data. The lavarand + * NOTE: This is not a good source of chaotic data. The LavaRnd * system does a much better job of that. See: * - * http://lavarand.sgi.com/index.html + * http://www.LavaRnd.org/ */ @@ -270,10 +270,10 @@ hash_buf(char *buf, unsigned len) * * Generate a quasi-random seed based on system and process information. * - * NOTE: This is not a good source of chaotic data. The lavarand + * NOTE: This is not a good source of chaotic data. The LavaRnd * system does a much better job of that. See: * - * http://lavarand.sgi.com/index.html + * http://www.LavaRnd.org/ * * PORTING NOTE: * If when porting this code to your system and something diff --git a/spec-template b/spec-template new file mode 100644 index 0000000..68be804 --- /dev/null +++ b/spec-template @@ -0,0 +1,98 @@ +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 +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 RPM_OPT_FLAGS="$RPM_OPT_FLAGS" + +%install +rm -rf $RPM_BUILD_ROOT +mkdir -p $RPM_BUILD_ROOT${BINDIR} +mkdir -p $RPM_BUILD_ROOT${SHAREDIR} +mkdir -p $RPM_BUILD_ROOT${INCDIR} +mkdir -p $RPM_BUILD_ROOT${LIBDIR} +mkdir -p $RPM_BUILD_ROOT${CSHAREDIR} +mkdir -p $RPM_BUILD_ROOT${HELPDIR} +mkdir -p $RPM_BUILD_ROOT${INCDIRCALC} +mkdir -p $RPM_BUILD_ROOT${CUSTOMLIBDIR} +mkdir -p $RPM_BUILD_ROOT${CUSTOMHELPDIR} +mkdir -p $RPM_BUILD_ROOT${CUSTOMINCDIR} +mkdir -p $RPM_BUILD_ROOT${SCRIPTDIR} +mkdir -p $RPM_BUILD_ROOT${MANDIR} + +install -m 0555 calc $RPM_BUILD_ROOT${BINDIR} + +(cd help + install -m 0444 ${STD_HELP_FILES} $RPM_BUILD_ROOT${HELPDIR} + install -m 0444 ${BLT_HELP_FILES} $RPM_BUILD_ROOT${HELPDIR} + install -m 0444 builtin full $RPM_BUILD_ROOT${HELPDIR} + install -m 0444 ${DETAIL_HELP} $RPM_BUILD_ROOT${HELPDIR} + install -m 0444 ${SINGULAR_FILES} $RPM_BUILD_ROOT${HELPDIR} + install -m 0444 obj.file $RPM_BUILD_ROOT${HELPDIR}/obj +) + +(cd cal; install -m 0444 ${CALC_FILES} $RPM_BUILD_ROOT${LIBDIR}) + +(cd custom + if [ ! -z "${INSTALL_H_SRC}" ]; then + install -m 0444 ${INSTALL_H_SRC} $RPM_BUILD_ROOT${CUSTOMINCDIR} + fi + install -m 0444 ${CUSTOM_CALC_FILES} $RPM_BUILD_ROOT${CUSTOMLIBDIR} + install -m 0444 ${CUSTOM_HELP} $RPM_BUILD_ROOT${CUSTOMHELPDIR} + if [ ! -z "${ALLOW_CUSTOM}" ]; then + install -m 0644 libcustcalc.a $RPM_BUILD_ROOT${CUSTOMLIBDIR} + ${RANLIB} $RPM_BUILD_ROOT${CUSTOMLIBDIR} + fi +) + +(cd cscript + install -m 0555 ${SCRIPT} $RPM_BUILD_ROOT${SCRIPTDIR} +) + +install -m 0444 libcalc.a $RPM_BUILD_ROOT${LIBDIR} +${RANLIB} $RPM_BUILD_ROOT${LIBDIR} +install -m 0444 ${LIB_H_SRC} $RPM_BUILD_ROOT${INCDIRCALC} +install -m 0444 ${BUILD_H_SRC} $RPM_BUILD_ROOT${INCDIRCALC} +install -m 0444 calc.1 $RPM_BUILD_ROOT${MANDIR}.${MANEXT} + +%clean +rm -rf $RPM_BUILD_ROOT + +%files -f install.list +%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 +- calc version ${VER_CALC} diff --git a/version.c b/version.c index 7384c9e..30233e6 100644 --- a/version.c +++ b/version.c @@ -19,8 +19,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.24 $ - * @(#) $Id: version.c,v 29.24 2001/04/14 22:56:46 chongo Exp $ + * @(#) $Revision: 29.26 $ + * @(#) $Id: version.c,v 29.26 2001/05/28 22:00:22 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/version.c,v $ * * Under source code control: 1990/05/22 11:00:58 @@ -43,7 +43,7 @@ static char *program; #define MAJOR_VER 2 /* major version */ #define MINOR_VER 11 /* minor version */ #define MAJOR_PATCH 5 /* patch level or 0 if no patch */ -#define MINOR_PATCH "3" /* test number or empty string if no patch */ +#define MINOR_PATCH "4" /* test number or empty string if no patch */ /* * calc version constants @@ -144,6 +144,82 @@ version(void) #if defined(CALC_VER) + +/* + * print_rpm_version_release - print the rpm style version-release + * + * This function prints a version-release string, rpm style: + * + * x.y.z-w + * x.y.z-0 + * x.y-0 + */ +void +print_rpm_version_release(void) +{ + /* + * form the version buffer + */ + if (sizeof(MINOR_PATCH) > 1) { + printf("%d.%d.%d-%s\n", calc_major_ver, calc_minor_ver, + calc_major_patch, calc_minor_patch); + } else if (MAJOR_PATCH > 0) { + printf("%d.%d.%d-0\n", calc_major_ver, calc_minor_ver, + calc_major_patch); + } else { + printf("%d.%d-0\n", calc_major_ver, calc_minor_ver); + } + return; +} + + +/* + * print_rpm_version - print just the version string, rpm style + * + * This function prints a version string, rpm style: + * + * x.y.z + * x.y + */ +void +print_rpm_version(void) +{ + /* + * form the version buffer + */ + if (MAJOR_PATCH > 0) { + printf("%d.%d.%d\n", calc_major_ver, calc_minor_ver, + calc_major_patch); + } else { + printf("%d.%d\n", calc_major_ver, calc_minor_ver); + } + return; +} + + +/* + * print_rpm_release - print just the release string, rpm style + * + * This function prints a release string, rpm style: + * + * w + * 0 + */ +void +print_rpm_release(void) +{ + /* + * form the version buffer + */ + if (sizeof(MINOR_PATCH) > 1) { + printf("%s\n", calc_minor_patch); + } else { + printf("0\n"); + } + return; +} + + /* * version - print the calc version */ @@ -152,7 +228,15 @@ int main(int argc, char *argv[]) { program = argv[0]; - printf("%s\n", version()); + if (argc == 2 && strcmp(argv[1], "-R") == 0) { + print_rpm_version_release(); + } else if (argc == 2 && strcmp(argv[1], "-v") == 0) { + print_rpm_version(); + } else if (argc == 2 && strcmp(argv[1], "-r") == 0) { + print_rpm_release(); + } else { + printf("%s\n", version()); + } return 0; } diff --git a/zrand.c b/zrand.c index 8d5c314..98adc30 100644 --- a/zrand.c +++ b/zrand.c @@ -17,8 +17,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.3 $ - * @(#) $Id: zrand.c,v 29.3 2001/04/14 22:47:21 chongo Exp $ + * @(#) $Revision: 29.4 $ + * @(#) $Id: zrand.c,v 29.4 2001/05/08 06:44:29 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/zrand.c,v $ * * Under source code control: 1995/01/07 09:45:25 @@ -284,7 +284,7 @@ * SOURCE OF MAGIC NUMBERS: * * Most of the magic constants used on this file ultimately are - * based on SGI Lavarand. SGI Lavarand produced a 5-way cryprographic + * based on LavaRnd. LavaRnd produced them via a cryprographic * of the digitization of chaotic system that consisted of a noisy * digital camera and 6 Lava Lite(R) lamps. * @@ -568,7 +568,7 @@ static CONST RAND init_s100 = { * * The subtractive 100 table in init_s100 has been processed 256 times in order * to preload the shuffle table. The array below is the table before - * this processing. These values have came from Lavarand. + * this processing. These values have came from LavaRnd. * * This array is never changed, only copied. */ diff --git a/zrandom.c b/zrandom.c index 99b7fa3..01b3d4c 100644 --- a/zrandom.c +++ b/zrandom.c @@ -17,8 +17,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.2 $ - * @(#) $Id: zrandom.c,v 29.2 2000/06/07 14:02:13 chongo Exp $ + * @(#) $Revision: 29.3 $ + * @(#) $Id: zrandom.c,v 29.3 2001/05/08 06:44:29 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/zrandom.c,v $ * * Under source code control: 1997/02/15 04:01:56 @@ -356,33 +356,33 @@ * * The pre-defined Blum moduli was computed by searching for Blum * primes (primes == 3 mod 4) starting from new values that - * were selected by lavarand, a hardware random number generator. + * were selected by LavaRnd, a hardware random number generator. * See the URL: * - * http://lavarand.sgi.com/index.html + * http://www.LavaRnd.org/ * - * for an explination of how the lavarand random number generator works. + * for an explination of how the LavaRnd random number generator works. * * For a given newn, we select a given bit length. For 0 < newn <= 20, * the bit length selected was by: * * bitlen = 2^(int((newn-1)/4)+7) + small_random_value; * - * where small_random_value is also generated by lavarand. For + * where small_random_value is also generated by LavaRnd. For * 1 <= newn <= 16, small_random_value is a random value in [0,40). * For 17 < newn <= 20, small_random_value is a random value in [0,120). - * Given two random integers generated by lavarand, we used the following + * Given two random integers generated by LavaRnd, we used the following * to compute Blum primes: * * (* find the first Blum prime *) - * fp = int((ip-1)/2); (* ip was generated by lavarand *) + * fp = int((ip-1)/2); (* ip was generated by LavaRnd *) * do { * fp = nextcand(fp+2, 25, 0, 3, 4); * p = 2*fp+1; * } while (ptest(p, 25) == 0); * * (* find the 2nd Blum prime *) - * fq = int((iq-1)/2); (* iq was generated by lavarand *) + * fq = int((iq-1)/2); (* iq was generated by LavaRnd *) * do { * fq = nextcand(fq+2, 25, 0, 3, 4); * q = 2*fq+1; @@ -391,8 +391,8 @@ * (* compute the Blum modulus *) * n[newn] = p * q; * - * The pre-defined quadratic residues was also generated by lavarand. - * The value produced by lavarand was squared mod the Blum moduli + * The pre-defined quadratic residues was also generated by LavaRnd. + * The value produced by LavaRnd was squared mod the Blum moduli * that was previously computed. * * The purpose of these pre-defined Blum moduli is to provide users with