mirror of
https://github.com/lcn2/calc.git
synced 2025-08-22 01:23:28 +03:00
Compare commits
7 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
9968a69f50 | ||
|
1ea579d929 | ||
|
0521ed202f | ||
|
6f5e8bf1b6 | ||
|
f3913609ea | ||
|
0514dc0de9 | ||
|
94e35d9b07 |
4
BUGS
4
BUGS
@@ -177,8 +177,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.1 $
|
## @(#) $Revision: 29.4 $
|
||||||
## @(#) $Id: BUGS,v 29.1 1999/12/14 09:15:29 chongo Exp $
|
## @(#) $Id: BUGS,v 29.4 1999/12/15 09:13:29 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
|
||||||
|
29
CHANGES
29
CHANGES
@@ -1,4 +1,12 @@
|
|||||||
The following are the changes from calc version 2.11.1 to date:
|
The following are the changes from calc version 2.11.1t3 to date:
|
||||||
|
|
||||||
|
Removed non-portable strerror() tests (3715, 3724 and 3728) from
|
||||||
|
calc/regress.cal.
|
||||||
|
|
||||||
|
Fixed missing strdup() from func.c problem.
|
||||||
|
|
||||||
|
|
||||||
|
The following are the changes from calc version 2.11.1 to 2.11.1t2.2:
|
||||||
|
|
||||||
Placed calc under version 2.1 of the GNU Lesser General Public License.
|
Placed calc under version 2.1 of the GNU Lesser General Public License.
|
||||||
|
|
||||||
@@ -39,6 +47,20 @@ The following are the changes from calc version 2.11.1 to date:
|
|||||||
now uses ./cal:~/cal (instead of ./lib:~/lib). Changed LIB_PASSDOWN
|
now uses ./cal:~/cal (instead of ./lib:~/lib). Changed LIB_PASSDOWN
|
||||||
Makefile variable to CAL_PASSDOWN.
|
Makefile variable to CAL_PASSDOWN.
|
||||||
|
|
||||||
|
Fixed misc compile warnings and bugs.
|
||||||
|
|
||||||
|
Fixed problem of incorrect paths in the formation of installed
|
||||||
|
calc shell scripts.
|
||||||
|
|
||||||
|
Changed the recommended Comqaq cc compile to be -std0 -fast -O4 -static.
|
||||||
|
|
||||||
|
Fixed a problem related to asking for help for a non-existent file.
|
||||||
|
|
||||||
|
Added ./.calcinit to the default calcrc.
|
||||||
|
|
||||||
|
Added cscript/README and help cscript to document the calc shell
|
||||||
|
script supplied with calc.
|
||||||
|
|
||||||
|
|
||||||
The following are the changes from calc version 2.11.0t10 to 2.11.0t11:
|
The following are the changes from calc version 2.11.0t10 to 2.11.0t11:
|
||||||
|
|
||||||
@@ -272,6 +294,7 @@ The following are the changes from calc version 2.11.0t10 to 2.11.0t11:
|
|||||||
# this is a comment
|
# this is a comment
|
||||||
#
|
#
|
||||||
# The lone # above was also a comment
|
# The lone # above was also a comment
|
||||||
|
## is also a comment
|
||||||
|
|
||||||
Improved how calc makes changes to file descriptor interactive state.
|
Improved how calc makes changes to file descriptor interactive state.
|
||||||
Moved state changing code to calc_tty() and orig_tty() in lib_calc.c.
|
Moved state changing code to calc_tty() and orig_tty() in lib_calc.c.
|
||||||
@@ -4703,8 +4726,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.1 $
|
## @(#) $Revision: 29.6 $
|
||||||
## @(#) $Id: CHANGES,v 29.1 1999/12/14 09:15:29 chongo Exp $
|
## @(#) $Id: CHANGES,v 29.6 1999/12/19 03:26:47 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
|
||||||
|
12
Makefile
12
Makefile
@@ -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.
|
||||||
#
|
#
|
||||||
# @(#) $Revision: 29.1 $
|
# @(#) $Revision: 29.6 $
|
||||||
# @(#) $Id: Makefile.ship,v 29.1 1999/12/14 09:14:53 chongo Exp $
|
# @(#) $Id: Makefile.ship,v 29.6 1999/12/19 03:19:58 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
|
||||||
@@ -415,6 +415,7 @@ NROFF_ARG= -man
|
|||||||
#NROFF_ARG= -mandoc
|
#NROFF_ARG= -mandoc
|
||||||
MANMAKE= /usr/local/bin/manmake
|
MANMAKE= /usr/local/bin/manmake
|
||||||
#MANMAKE= manmake
|
#MANMAKE= manmake
|
||||||
|
MANMODE= 0444
|
||||||
|
|
||||||
# If the $CALCPATH environment variable is not defined, then the following
|
# If the $CALCPATH environment variable is not defined, then the following
|
||||||
# path will be search for calc resource file routines.
|
# path will be search for calc resource file routines.
|
||||||
@@ -424,7 +425,7 @@ CALCPATH= .:./cal:~/cal:${LIBDIR}:${CUSTOMLIBDIR}
|
|||||||
# If the $CALCRC environment variable is not defined, then the following
|
# If the $CALCRC environment variable is not defined, then the following
|
||||||
# path will be search for calc resource files.
|
# path will be search for calc resource files.
|
||||||
#
|
#
|
||||||
CALCRC= ${LIBDIR}/startup:~/.calcrc
|
CALCRC= ${LIBDIR}/startup:~/.calcrc:./.calcinit
|
||||||
|
|
||||||
# Determine of the GNU-readline facility will be used instead of the
|
# Determine of the GNU-readline facility will be used instead of the
|
||||||
# built-in calc binding method.
|
# built-in calc binding method.
|
||||||
@@ -487,6 +488,8 @@ DEBUG= -O2 -g3
|
|||||||
#DEBUG= -O3 -ipa
|
#DEBUG= -O3 -ipa
|
||||||
#DEBUG= -O3 -g3 -ipa
|
#DEBUG= -O3 -g3 -ipa
|
||||||
#
|
#
|
||||||
|
#DEBUG= -std0 -fast -O4 -static
|
||||||
|
#
|
||||||
#DEBUG= -g
|
#DEBUG= -g
|
||||||
#DEBUG= -g3
|
#DEBUG= -g3
|
||||||
#DEBUG= -gx
|
#DEBUG= -gx
|
||||||
@@ -784,7 +787,7 @@ CC= ${PURIFY} ${LCC}
|
|||||||
#
|
#
|
||||||
# Dec Alpha / Compaq Tru64 cc (non-gnu) compiler set
|
# Dec Alpha / Compaq Tru64 cc (non-gnu) compiler set
|
||||||
#
|
#
|
||||||
# For better performance, set the following above: DEBUG= -O2 -g3
|
# For better performance, set the following: DEBUG= -std0 -fast -O4 -static
|
||||||
#
|
#
|
||||||
#CCWARN=
|
#CCWARN=
|
||||||
#CCOPT= ${DEBUG} ${NO_SHARED}
|
#CCOPT= ${DEBUG} ${NO_SHARED}
|
||||||
@@ -3313,6 +3316,7 @@ func.o: have_malloc.h
|
|||||||
func.o: have_memmv.h
|
func.o: have_memmv.h
|
||||||
func.o: have_newstr.h
|
func.o: have_newstr.h
|
||||||
func.o: have_stdlib.h
|
func.o: have_stdlib.h
|
||||||
|
func.o: have_strdup.h
|
||||||
func.o: have_string.h
|
func.o: have_string.h
|
||||||
func.o: have_times.h
|
func.o: have_times.h
|
||||||
func.o: have_unistd.h
|
func.o: have_unistd.h
|
||||||
|
@@ -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.1 $
|
* @(#) $Revision: 29.2 $
|
||||||
* @(#) $Id: regress.cal,v 29.1 1999/12/14 09:15:32 chongo Exp $
|
* @(#) $Id: regress.cal,v 29.2 1999/12/19 03:16:54 chongo Exp $
|
||||||
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/regress.cal,v $
|
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/regress.cal,v $
|
||||||
*
|
*
|
||||||
* Under source code control: 1990/02/15 01:50:36
|
* Under source code control: 1990/02/15 01:50:36
|
||||||
@@ -3085,8 +3085,7 @@ define test_error()
|
|||||||
print '3712: e9999 = error(9999)';
|
print '3712: e9999 = error(9999)';
|
||||||
vrfy(errno() == 9999, '3713: errno() == 9999');
|
vrfy(errno() == 9999, '3713: errno() == 9999');
|
||||||
vrfy(error() == e9999, '3714: error() == e9999');
|
vrfy(error() == e9999, '3714: error() == e9999');
|
||||||
vrfy(substr(strerror(), strpos(strerror(),"9999"), 4) == "9999",
|
/* test 3715 removed due to non-portable strerror() output */
|
||||||
'3715: substr(strerror(), strpos(strerror(),"9999"), 4) == "9999"');
|
|
||||||
x = newerror("Alpha");
|
x = newerror("Alpha");
|
||||||
print '3716: x = newerror("Alpha")';
|
print '3716: x = newerror("Alpha")';
|
||||||
n = iserror(x);
|
n = iserror(x);
|
||||||
@@ -3097,16 +3096,14 @@ define test_error()
|
|||||||
vrfy(errno(9999) == n, '3721: errno() == n');
|
vrfy(errno(9999) == n, '3721: errno() == n');
|
||||||
vrfy(errno() == 9999, '3722: errno() == 9999');
|
vrfy(errno() == 9999, '3722: errno() == 9999');
|
||||||
vrfy(error() == e9999, '3723: error() == e9999');
|
vrfy(error() == e9999, '3723: error() == e9999');
|
||||||
vrfy(substr(strerror(), strpos(strerror(),"9999"), 4) == "9999",
|
/* test 3724 removed due to non-portable strerror() output */
|
||||||
'3724: substr(strerror(), strpos(strerror(),"9999"), 4) == "9999"');
|
|
||||||
a = 1/0;
|
a = 1/0;
|
||||||
print '3725: a = 1/0';
|
print '3725: a = 1/0';
|
||||||
vrfy(strerror() == "Division by zero",
|
vrfy(strerror() == "Division by zero",
|
||||||
'3726: strerror() == "Division by zero"');
|
'3726: strerror() == "Division by zero"');
|
||||||
n = 8191;
|
n = 8191;
|
||||||
print '3727: n = 8191';
|
print '3727: n = 8191';
|
||||||
vrfy(substr(strerror(8191),strpos(strerror(n),"8191"), 4) == "8191",
|
/* test 3728 removed due to non-portable strerror() output */
|
||||||
'3728: substr(strerror(n),strpos(strerror(n),"8191"),4) == "8191"');
|
|
||||||
|
|
||||||
/* errmax and errcount should be bumped up the 148 errors above */
|
/* errmax and errcount should be bumped up the 148 errors above */
|
||||||
vrfy(errcount() == ecnt, '3729: errcount() == ecnt');
|
vrfy(errcount() == ecnt, '3729: errcount() == ecnt');
|
||||||
|
6
calc.c
6
calc.c
@@ -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.1 $
|
* @(#) $Revision: 29.2 $
|
||||||
* @(#) $Id: calc.c,v 29.1 1999/12/14 09:15:34 chongo Exp $
|
* @(#) $Id: calc.c,v 29.2 1999/12/17 09:21:45 chongo Exp $
|
||||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/calc.c,v $
|
* @(#) $Source: /usr/local/src/cmd/calc/RCS/calc.c,v $
|
||||||
*
|
*
|
||||||
* Under source code control: 1990/02/15 01:48:11
|
* Under source code control: 1990/02/15 01:48:11
|
||||||
@@ -197,7 +197,7 @@ main(int argc, char **argv)
|
|||||||
*/
|
*/
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"usage: %s [-c] [-C] [-d] [-e] [-h] [-i] [-m mode]\n"
|
"usage: %s [-c] [-C] [-d] [-e] [-h] [-i] [-m mode]\n"
|
||||||
"\t[-D calc_debug[:resource_debug:[user_debug]]]\n"
|
"\t[-D calc_debug[:resource_debug[:user_debug]]]\n"
|
||||||
"\t[-n] [-p] [-q] [-s] [-u] [-v] "
|
"\t[-n] [-p] [-q] [-s] [-u] [-v] "
|
||||||
"[[--] calc_cmd ...]\n",
|
"[[--] calc_cmd ...]\n",
|
||||||
program);
|
program);
|
||||||
|
6
calc.h
6
calc.h
@@ -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.1 $
|
* @(#) $Revision: 29.2 $
|
||||||
* @(#) $Id: calc.h,v 29.1 1999/12/14 09:15:34 chongo Exp $
|
* @(#) $Id: calc.h,v 29.2 1999/12/14 19:37:46 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
|
||||||
@@ -202,7 +202,7 @@ extern char *pager; /* $PAGER or default */
|
|||||||
extern int stdin_tty; /* TRUE if stdin is a tty */
|
extern int stdin_tty; /* TRUE if stdin is a tty */
|
||||||
extern int havecommands; /* TRUE if have cmd args) */
|
extern int havecommands; /* TRUE if have cmd args) */
|
||||||
extern char *program; /* our name */
|
extern char *program; /* our name */
|
||||||
extern char *basename; /* basename of our name */
|
extern char *base_name; /* basename of our name */
|
||||||
extern char cmdbuf[]; /* command line expression */
|
extern char cmdbuf[]; /* command line expression */
|
||||||
|
|
||||||
extern int abortlevel; /* current level of aborts */
|
extern int abortlevel; /* current level of aborts */
|
||||||
|
250
calc.man
250
calc.man
@@ -15,8 +15,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.1 $
|
.\" @(#) $Revision: 29.4 $
|
||||||
.\" @(#) $Id: calc.man,v 29.1 1999/12/14 09:15:35 chongo Exp $
|
.\" @(#) $Id: calc.man,v 29.4 1999/12/17 10:06:31 chongo Exp $
|
||||||
.\" @(#) $Source: /usr/local/src/cmd/calc/RCS/calc.man,v $
|
.\" @(#) $Source: /usr/local/src/cmd/calc/RCS/calc.man,v $
|
||||||
.\"
|
.\"
|
||||||
.\" Under source code control: 1991/07/23 05:48:26
|
.\" Under source code control: 1991/07/23 05:48:26
|
||||||
@@ -36,7 +36,7 @@ calc \- arbitrary precision calculator
|
|||||||
.RB [ \-c ]
|
.RB [ \-c ]
|
||||||
.RB [ \-C ]
|
.RB [ \-C ]
|
||||||
.RB [ \-d ]
|
.RB [ \-d ]
|
||||||
.RB [ -D\ \&calc_debug[:resource_debug:[user_debug]] ]
|
.RB [ -D\ \&calc_debug[:resource_debug[:user_debug]] ]
|
||||||
.br
|
.br
|
||||||
.in +5n
|
.in +5n
|
||||||
.RB [ \-e ]
|
.RB [ \-e ]
|
||||||
@@ -53,7 +53,7 @@ calc \- arbitrary precision calculator
|
|||||||
.RB [ calc_cmd\ \&.\|.\|. ]
|
.RB [ calc_cmd\ \&.\|.\|. ]
|
||||||
.in -5n
|
.in -5n
|
||||||
.sp
|
.sp
|
||||||
\fI#!${BINDIR}/calc\fP\ \fB\-S\fP\ [\-other_flags\ \&...]
|
\fI#!${BINDIR}/calc\fP\ \fB\-S\fP\ [other_flags\ \&...]
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
\&
|
\&
|
||||||
.br
|
.br
|
||||||
@@ -89,7 +89,7 @@ cause
|
|||||||
to try to process each line being read
|
to try to process each line being read
|
||||||
despite the errors that it encounters.
|
despite the errors that it encounters.
|
||||||
.sp 1
|
.sp 1
|
||||||
By default, calc startup resource files ($CALCRC) are silently
|
By default, calc startup resource files are silently
|
||||||
ignored if not found.
|
ignored if not found.
|
||||||
This flag will report missing
|
This flag will report missing
|
||||||
startup resource files unless
|
startup resource files unless
|
||||||
@@ -103,10 +103,10 @@ Without
|
|||||||
this flag, calling the custom() builtin function will
|
this flag, calling the custom() builtin function will
|
||||||
simply generate an error.
|
simply generate an error.
|
||||||
.sp 1
|
.sp 1
|
||||||
Use if this flag may cause
|
Use of this flag may cause
|
||||||
.B calc
|
.B calc
|
||||||
to execute functions that
|
to execute functions
|
||||||
are non-standard and that are not portable. Custom builtin
|
that are non-standard and that are not portable. Custom builtin
|
||||||
functions are disabled by default for this reason.
|
functions are disabled by default for this reason.
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
@@ -147,14 +147,14 @@ It's nearly ten past six.
|
|||||||
.in -5n
|
.in -5n
|
||||||
.sp 1
|
.sp 1
|
||||||
This flag disables the reporting of missing calc
|
This flag disables the reporting of missing calc
|
||||||
startup resource files ($CALCRC).
|
startup resource files.
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.BR -D " calc_debug[:resource_debug:[user_debug]]"
|
.BR -D " calc_debug[:resource_debug[:user_debug]]"
|
||||||
Force the initial value of config("calc_debug"),
|
Force the initial value of config("calc_debug"),
|
||||||
config("resource_debug") and config("user_debug").
|
config("resource_debug") and config("user_debug").
|
||||||
.sp 1
|
.sp 1
|
||||||
The : separated strings are interpreted as signed 32 bit values.
|
The : separated strings are interpreted as signed 32 bit integers.
|
||||||
After an optional leading sign a leading zero indicates octal
|
After an optional leading sign a leading zero indicates octal
|
||||||
conversion, and a leading ``0x'' or ``0X'' hexadecimal
|
conversion, and a leading ``0x'' or ``0X'' hexadecimal
|
||||||
conversion. Otherwise, decimal conversion is assumed.
|
conversion. Otherwise, decimal conversion is assumed.
|
||||||
@@ -197,14 +197,14 @@ See
|
|||||||
.TP
|
.TP
|
||||||
.B \-i
|
.B \-i
|
||||||
Become interactive if possible.
|
Become interactive if possible.
|
||||||
Be default, if
|
If
|
||||||
.I calc_cmd
|
.I calc_cmd
|
||||||
args are given,
|
args are given,
|
||||||
.B calc
|
.B calc
|
||||||
will execute them and exit.
|
by default, calc will execute them and exit.
|
||||||
This flag args are given,
|
This flag causes
|
||||||
.B calc
|
.B calc
|
||||||
will execute them and exit.
|
to drop into interactive mode after the commands are executed.
|
||||||
This flag will cause
|
This flag will cause
|
||||||
.B calc
|
.B calc
|
||||||
to drop into interactive mode after the
|
to drop into interactive mode after the
|
||||||
@@ -294,7 +294,7 @@ unknown mode.
|
|||||||
will attempt to read or write them if directed.
|
will attempt to read or write them if directed.
|
||||||
.sp 1
|
.sp 1
|
||||||
If the mode disables opening of files for reading, then
|
If the mode disables opening of files for reading, then
|
||||||
the startup resource files are disabled as of
|
the startup resource files are disabled as if
|
||||||
.B \-q
|
.B \-q
|
||||||
was given.
|
was given.
|
||||||
The reading of key bindings is also disabled
|
The reading of key bindings is also disabled
|
||||||
@@ -330,7 +330,7 @@ flag overrides
|
|||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B \-q
|
.B \-q
|
||||||
Disable the use of the $CALCRC startup resource files.
|
Disable the reading of the startup scripts.
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B \-s
|
.B \-s
|
||||||
@@ -355,26 +355,20 @@ version number and exit.
|
|||||||
.br
|
.br
|
||||||
CALC COMMAND LINE
|
CALC COMMAND LINE
|
||||||
.PP
|
.PP
|
||||||
Without
|
With no
|
||||||
.IR calc_cmd ,
|
.I calc_cmd
|
||||||
|
arguments,
|
||||||
.B calc
|
.B calc
|
||||||
operates interactively.
|
operates interactively.
|
||||||
If one or more
|
If one or more
|
||||||
.I calc_cmd
|
arguments are given on the command line and
|
||||||
are given on the command line and
|
|
||||||
.B \-s
|
.B \-s
|
||||||
is NOT given, then
|
is NOT given, then
|
||||||
.B calc
|
.B calc
|
||||||
will evaluate and execute them and then exit.
|
will read and execute them and either attempt
|
||||||
.sp
|
to go interactive according as the
|
||||||
If
|
|
||||||
.B \-i
|
.B \-i
|
||||||
is given,
|
flag was present or absent.
|
||||||
.B calc
|
|
||||||
will attempt to become interactive
|
|
||||||
even of one or more
|
|
||||||
.I calc_cmd
|
|
||||||
are given on the command line.
|
|
||||||
.sp
|
.sp
|
||||||
If
|
If
|
||||||
.B \-s
|
.B \-s
|
||||||
@@ -384,32 +378,157 @@ will not evaluate any
|
|||||||
.I calc_cmd
|
.I calc_cmd
|
||||||
arguments but instead make them available
|
arguments but instead make them available
|
||||||
as strings to the argv() builtin function.
|
as strings to the argv() builtin function.
|
||||||
|
|
||||||
|
Sufficiently simple commands with no no characters like
|
||||||
|
parentheses, brackets, semicolons, '*', which have special
|
||||||
|
interpretations in UNIX shells may be entered, possibly with
|
||||||
|
spaces, until the terminating newline.
|
||||||
|
For example:
|
||||||
|
.sp 1
|
||||||
|
.in +5n
|
||||||
|
.nf
|
||||||
|
calc 23 + 47
|
||||||
|
.fi
|
||||||
|
.in -5n
|
||||||
|
.sp 1
|
||||||
|
should respond with display of 70, but
|
||||||
|
.sp 1
|
||||||
|
.in +5n
|
||||||
|
.nf
|
||||||
|
calc 23 * 47
|
||||||
|
.fi
|
||||||
|
.in -5n
|
||||||
|
.sp 1
|
||||||
|
may fail.
|
||||||
|
Such cases can usually be made to work as expected by
|
||||||
|
enclosing the command between single marks as in:
|
||||||
|
.sp 1
|
||||||
|
.in +5n
|
||||||
|
.nf
|
||||||
|
calc '23 * 47'
|
||||||
|
.fi
|
||||||
|
.in -5n
|
||||||
|
.sp 1
|
||||||
|
and
|
||||||
|
.sp 1
|
||||||
|
.in +5n
|
||||||
|
.nf
|
||||||
|
calc 'print sqrt(2), exp(1)'
|
||||||
|
.fi
|
||||||
|
.in -5n
|
||||||
|
.sp
|
||||||
|
If '!' is to be used to indicate the factorial function, for
|
||||||
|
shells like
|
||||||
|
.BI csh (1)
|
||||||
|
for which '!' followed by a non-space character
|
||||||
|
is used for history substitution, it may be necessary to
|
||||||
|
include a space or use a backslash to escape the special
|
||||||
|
meaning of '!'.
|
||||||
|
For example, the command:
|
||||||
|
.sp 1
|
||||||
|
.in +5n
|
||||||
|
.nf
|
||||||
|
print 27!^2
|
||||||
|
.fi
|
||||||
|
.in -5n
|
||||||
|
.sp 1
|
||||||
|
may have to be replaced by:
|
||||||
|
.sp 1
|
||||||
|
.in +5n
|
||||||
|
.nf
|
||||||
|
print 27! ^2 or print 27\!^2
|
||||||
|
.fi
|
||||||
|
.in -5n
|
||||||
|
|
||||||
|
\&
|
||||||
|
.br
|
||||||
|
CALC STARTUP FILES
|
||||||
.PP
|
.PP
|
||||||
Normally on startup,
|
Normally on startup,
|
||||||
|
if the environment variable
|
||||||
|
.B $CALCRC
|
||||||
|
is undefined and
|
||||||
.B calc
|
.B calc
|
||||||
attempts to execute a collection of
|
is invoked without the
|
||||||
startup resource files.
|
|
||||||
The environment variable $CALCRC (if non-existent
|
|
||||||
then a compiled in value) contains a : separated list of startup
|
|
||||||
resource files.
|
|
||||||
No error conditions are produced if these startup
|
|
||||||
resource files are not found.
|
|
||||||
.PP
|
|
||||||
If the mode disables opening of files for reading, then the startup
|
|
||||||
resource files are disabled as of
|
|
||||||
.B \-q
|
.B \-q
|
||||||
was given and $CALCRC as well
|
flag, or if
|
||||||
as the default compiled in value are ignored.
|
.B $CALCRC
|
||||||
|
is defined and calc is invoked with
|
||||||
|
.BR \-e ,
|
||||||
|
.B calc
|
||||||
|
looks for a file "startup" in the calc resource directory
|
||||||
|
.B .calcrc
|
||||||
|
in the user's home directory, and
|
||||||
|
.B .calcinit in the current directory.
|
||||||
|
If one or more of these are found, they are read in succession as
|
||||||
|
.B calc
|
||||||
|
scripts and their commands executed.
|
||||||
|
When defined,
|
||||||
|
.B $CALCRC
|
||||||
|
is to contain a ':' separated list of names of files,
|
||||||
|
and if calc is then invoked without either the
|
||||||
|
.B \-q
|
||||||
|
or
|
||||||
|
.B \-e
|
||||||
|
flags, these files are read in succession and their commands executed.
|
||||||
|
No error condition is produced if a listed file is not found.
|
||||||
|
.sp
|
||||||
|
If the mode specified by
|
||||||
|
.B \-m
|
||||||
|
disables opening of files for reading, then the reading of startup
|
||||||
|
files is also disabled as if
|
||||||
|
.B \-q
|
||||||
|
was given.
|
||||||
|
|
||||||
|
\&
|
||||||
|
.br
|
||||||
|
CALC FILE SEARCH PATH
|
||||||
.PP
|
.PP
|
||||||
Filenames are subject to ``~'' expansion (see below).
|
If the environment variable
|
||||||
The
|
.B $CALCPATH
|
||||||
environment variable $CALCPATH (if non-existent then a compiled in
|
is undefined, or if it
|
||||||
value) contains a : separated list of search directories.
|
is defined and
|
||||||
If a
|
.B calc
|
||||||
file does not begin with /, ~ or ./, then it is searched for under
|
is invoked with the
|
||||||
each directory listed in the $CALCPATH.
|
.B \-e
|
||||||
It is an error if no such
|
flag, when a file name not beginning with
|
||||||
readable file is found.
|
.BR / ,
|
||||||
|
.B ~
|
||||||
|
or
|
||||||
|
.BR ./ ,
|
||||||
|
is specified as in:
|
||||||
|
.sp 1
|
||||||
|
.in +5n
|
||||||
|
.nf
|
||||||
|
calc read myfile
|
||||||
|
.fi
|
||||||
|
.in -5n
|
||||||
|
.sp 1
|
||||||
|
.B calc
|
||||||
|
searches in succession:
|
||||||
|
.sp 1
|
||||||
|
.in +5n
|
||||||
|
.nf
|
||||||
|
./myfile
|
||||||
|
./myfile.cal
|
||||||
|
${LIBDIR}/myfile
|
||||||
|
${LIBDIR}/myfile.cal
|
||||||
|
${CUSTOMLIBDIR}/myfile
|
||||||
|
${CUSTOMLIBDIR}/myfile.cal
|
||||||
|
.fi
|
||||||
|
.in -5n
|
||||||
|
.sp 1
|
||||||
|
If the file is found, the
|
||||||
|
search stops and the commands in the file are executed.
|
||||||
|
It is an error if no readable file with the specified name is found.
|
||||||
|
An alternative search path can be specified by defining
|
||||||
|
.B $CALCPATH
|
||||||
|
in the same way as PATH is defined, as a ':' separated
|
||||||
|
list of directories, and then invoking
|
||||||
|
.B calc
|
||||||
|
without the
|
||||||
|
.B \-e
|
||||||
|
flag.
|
||||||
.PP
|
.PP
|
||||||
.B Calc
|
.B Calc
|
||||||
treats all open files, other than stdin, stdout and
|
treats all open files, other than stdin, stdout and
|
||||||
@@ -447,11 +566,17 @@ help config
|
|||||||
.br
|
.br
|
||||||
SHELL SCRIPT MODE
|
SHELL SCRIPT MODE
|
||||||
.PP
|
.PP
|
||||||
If an executable file begins with:
|
If first line of an executable file begins
|
||||||
|
.B #!
|
||||||
|
followed by the absolute pathname of the
|
||||||
|
.B calc
|
||||||
|
program and the flag
|
||||||
|
.B \-S
|
||||||
|
as in:
|
||||||
.sp 1
|
.sp 1
|
||||||
.in +5n
|
.in +5n
|
||||||
.nf
|
.nf
|
||||||
\fI#!${BINDIR}/calc\fP\ \fB\-S\fP\ [\-other_flags\ \&...]
|
\fI#!${BINDIR}/calc\fP\ \fB\-S\fP\ [other_flags\ \&...]
|
||||||
.fi
|
.fi
|
||||||
.in -5n
|
.in -5n
|
||||||
.sp 1
|
.sp 1
|
||||||
@@ -462,19 +587,22 @@ Note that
|
|||||||
(UPPER CASE
|
(UPPER CASE
|
||||||
.BR \-S )
|
.BR \-S )
|
||||||
must be the first \-flag on the ``#!'' line.
|
must be the first \-flag on the ``#!'' line.
|
||||||
Any other optional ``\-other_flags'' must come after
|
Any other optional
|
||||||
|
.B "other_flags"
|
||||||
|
must come after
|
||||||
the
|
the
|
||||||
.BR \-S .
|
.BR \-S .
|
||||||
.sp 1
|
.sp 1
|
||||||
In
|
In
|
||||||
.B "shell script mode"
|
.B "shell script mode"
|
||||||
the contents of the file
|
the contents of the file are read and
|
||||||
are evaluated and executed as if they were processed
|
executed as if they were in a file being processed by a read
|
||||||
by the
|
command, except that a "command" beginning with '#' followed by
|
||||||
.B read
|
whitespace and ending at the next newline is treated as a comment.
|
||||||
command.
|
Any optional
|
||||||
Any optional ``\-other_flags'' will by parsed first
|
.B "other_flags"
|
||||||
followed by any arguments given shell script itself.
|
will be parsed first followed by
|
||||||
|
the later lines within the script itself.
|
||||||
.sp 1
|
.sp 1
|
||||||
In
|
In
|
||||||
.BR "shell script mode" ,
|
.BR "shell script mode" ,
|
||||||
|
30
config.c
30
config.c
@@ -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.1 $
|
* @(#) $Revision: 29.2 $
|
||||||
* @(#) $Id: config.c,v 29.1 1999/12/14 09:15:35 chongo Exp $
|
* @(#) $Id: config.c,v 29.2 1999/12/14 19:37:46 chongo Exp $
|
||||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/config.c,v $
|
* @(#) $Source: /usr/local/src/cmd/calc/RCS/config.c,v $
|
||||||
*
|
*
|
||||||
* Under source code control: 1991/07/20 00:21:56
|
* Under source code control: 1991/07/20 00:21:56
|
||||||
@@ -960,10 +960,10 @@ config_copy(CONFIG *src)
|
|||||||
} else {
|
} else {
|
||||||
dest->program = strdup(src->program);
|
dest->program = strdup(src->program);
|
||||||
}
|
}
|
||||||
if (src->basename == NULL) {
|
if (src->base_name == NULL) {
|
||||||
dest->basename = strdup(basename);
|
dest->base_name = strdup(base_name);
|
||||||
} else {
|
} else {
|
||||||
dest->basename = strdup(src->basename);
|
dest->base_name = strdup(src->base_name);
|
||||||
}
|
}
|
||||||
if (src->version == NULL) {
|
if (src->version == NULL) {
|
||||||
dest->version = strdup(version());
|
dest->version = strdup(version());
|
||||||
@@ -1009,8 +1009,8 @@ config_free(CONFIG *cfg)
|
|||||||
if (cfg->program != NULL) {
|
if (cfg->program != NULL) {
|
||||||
free(cfg->program);
|
free(cfg->program);
|
||||||
}
|
}
|
||||||
if (cfg->basename != NULL) {
|
if (cfg->base_name != NULL) {
|
||||||
free(cfg->basename);
|
free(cfg->base_name);
|
||||||
}
|
}
|
||||||
if (cfg->version != NULL) {
|
if (cfg->version != NULL) {
|
||||||
free(cfg->version);
|
free(cfg->version);
|
||||||
@@ -1255,7 +1255,7 @@ config_value(CONFIG *cfg, int type, VALUE *vp)
|
|||||||
|
|
||||||
case CONFIG_PROGRAM:
|
case CONFIG_PROGRAM:
|
||||||
vp->v_type = V_STR;
|
vp->v_type = V_STR;
|
||||||
if (cfg->basename == NULL) {
|
if (cfg->base_name == NULL) {
|
||||||
vp->v_str = makestring(strdup(program));
|
vp->v_str = makestring(strdup(program));
|
||||||
} else {
|
} else {
|
||||||
vp->v_str = makenewstring(cfg->program);
|
vp->v_str = makenewstring(cfg->program);
|
||||||
@@ -1264,10 +1264,10 @@ config_value(CONFIG *cfg, int type, VALUE *vp)
|
|||||||
|
|
||||||
case CONFIG_BASENAME:
|
case CONFIG_BASENAME:
|
||||||
vp->v_type = V_STR;
|
vp->v_type = V_STR;
|
||||||
if (cfg->basename == NULL) {
|
if (cfg->base_name == NULL) {
|
||||||
vp->v_str = makestring(strdup(basename));
|
vp->v_str = makestring(strdup(base_name));
|
||||||
} else {
|
} else {
|
||||||
vp->v_str = makenewstring(cfg->basename);
|
vp->v_str = makenewstring(cfg->base_name);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -1364,10 +1364,10 @@ config_cmp(CONFIG *cfg1, CONFIG *cfg2)
|
|||||||
(cfg1->program != NULL && cfg2->program != NULL &&
|
(cfg1->program != NULL && cfg2->program != NULL &&
|
||||||
strcmp(cfg1->program, cfg2->program) != 0) ||
|
strcmp(cfg1->program, cfg2->program) != 0) ||
|
||||||
|
|
||||||
(cfg1->basename == NULL && cfg2->basename != NULL) ||
|
(cfg1->base_name == NULL && cfg2->base_name != NULL) ||
|
||||||
(cfg1->basename != NULL && cfg2->basename == NULL) ||
|
(cfg1->base_name != NULL && cfg2->base_name == NULL) ||
|
||||||
(cfg1->basename != NULL && cfg2->basename != NULL &&
|
(cfg1->base_name != NULL && cfg2->base_name != NULL &&
|
||||||
strcmp(cfg1->basename, cfg2->basename) != 0) ||
|
strcmp(cfg1->base_name, cfg2->base_name) != 0) ||
|
||||||
|
|
||||||
(cfg1->version == NULL && cfg2->version != NULL) ||
|
(cfg1->version == NULL && cfg2->version != NULL) ||
|
||||||
(cfg1->version != NULL && cfg2->version == NULL) ||
|
(cfg1->version != NULL && cfg2->version == NULL) ||
|
||||||
|
6
config.h
6
config.h
@@ -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.1 $
|
* @(#) $Revision: 29.2 $
|
||||||
* @(#) $Id: config.h,v 29.1 1999/12/14 09:15:35 chongo Exp $
|
* @(#) $Id: config.h,v 29.2 1999/12/14 19:37:46 chongo Exp $
|
||||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/config.h,v $
|
* @(#) $Source: /usr/local/src/cmd/calc/RCS/config.h,v $
|
||||||
*
|
*
|
||||||
* Under source code control: 1995/11/01 22:20:17
|
* Under source code control: 1995/11/01 22:20:17
|
||||||
@@ -145,7 +145,7 @@ struct config {
|
|||||||
BOOL verbose_quit; /* TRUE => print Quit or abort executed msg */
|
BOOL verbose_quit; /* TRUE => print Quit or abort executed msg */
|
||||||
int ctrl_d; /* see CTRL_D_xyz below */
|
int ctrl_d; /* see CTRL_D_xyz below */
|
||||||
char *program; /* our name */
|
char *program; /* our name */
|
||||||
char *basename; /* basename of our name */
|
char *base_name; /* basename of our name */
|
||||||
char *version; /* calc version string */
|
char *version; /* calc version string */
|
||||||
};
|
};
|
||||||
typedef struct config CONFIG;
|
typedef struct config CONFIG;
|
||||||
|
@@ -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.1 $
|
# @(#) $Revision: 29.4 $
|
||||||
# @(#) $Id: Makefile,v 29.1 1999/12/14 09:15:35 chongo Exp $
|
# @(#) $Id: Makefile,v 29.4 1999/12/17 11:30:35 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
|
||||||
@@ -82,7 +82,7 @@ SCRIPT_SRC= mersenne.calc piforever.calc plus.calc simple.calc
|
|||||||
|
|
||||||
# These files are found (but not built) in the distribution
|
# These files are found (but not built) in the distribution
|
||||||
#
|
#
|
||||||
DISTLIST= ${SCRIPT_SRC} ${MAKE_FILE}
|
DISTLIST= ${SCRIPT_SRC} ${MAKE_FILE} README
|
||||||
|
|
||||||
# These files are used to make (but not built) a calc .a library
|
# These files are used to make (but not built) a calc .a library
|
||||||
#
|
#
|
||||||
@@ -173,7 +173,7 @@ depend:
|
|||||||
${Q}for i in ${SCRIPT}; do \
|
${Q}for i in ${SCRIPT}; do \
|
||||||
echo "$$i: $$i.calc"; \
|
echo "$$i: $$i.calc"; \
|
||||||
echo ' rm -f $$@'; \
|
echo ' rm -f $$@'; \
|
||||||
echo ' $${SED} -e 1s:^#!/usr/local/src/cmd/calc/calc:#!$${SCRIPTDIR}/calc: $$?>$$@'; \
|
echo ' $${SED} -e "1s:^#!/usr/local/src/cmd/calc/calc:#!$${BINDIR}/calc:" $$?>$$@'; \
|
||||||
echo ' $${CHMOD} +x $$@'; \
|
echo ' $${CHMOD} +x $$@'; \
|
||||||
done >> makedep.out
|
done >> makedep.out
|
||||||
${Q}echo sample dependency list formed
|
${Q}echo sample dependency list formed
|
||||||
@@ -231,17 +231,17 @@ install: all
|
|||||||
|
|
||||||
mersenne: mersenne.calc
|
mersenne: mersenne.calc
|
||||||
rm -f $@
|
rm -f $@
|
||||||
${SED} -e 1s:^#!/usr/local/src/cmd/calc/calc:#!${SCRIPTDIR}/calc: $?>$@
|
${SED} -e "1s:^#!/usr/local/src/cmd/calc/calc:#!${BINDIR}/calc:" $?>$@
|
||||||
${CHMOD} +x $@
|
${CHMOD} +x $@
|
||||||
piforever: piforever.calc
|
piforever: piforever.calc
|
||||||
rm -f $@
|
rm -f $@
|
||||||
${SED} -e 1s:^#!/usr/local/src/cmd/calc/calc:#!${SCRIPTDIR}/calc: $?>$@
|
${SED} -e "1s:^#!/usr/local/src/cmd/calc/calc:#!${BINDIR}/calc:" $?>$@
|
||||||
${CHMOD} +x $@
|
${CHMOD} +x $@
|
||||||
plus: plus.calc
|
plus: plus.calc
|
||||||
rm -f $@
|
rm -f $@
|
||||||
${SED} -e 1s:^#!/usr/local/src/cmd/calc/calc:#!${SCRIPTDIR}/calc: $?>$@
|
${SED} -e "1s:^#!/usr/local/src/cmd/calc/calc:#!${BINDIR}/calc:" $?>$@
|
||||||
${CHMOD} +x $@
|
${CHMOD} +x $@
|
||||||
simple: simple.calc
|
simple: simple.calc
|
||||||
rm -f $@
|
rm -f $@
|
||||||
${SED} -e 1s:^#!/usr/local/src/cmd/calc/calc:#!${SCRIPTDIR}/calc: $?>$@
|
${SED} -e "1s:^#!/usr/local/src/cmd/calc/calc:#!${BINDIR}/calc:" $?>$@
|
||||||
${CHMOD} +x $@
|
${CHMOD} +x $@
|
||||||
|
64
cscript/README
Normal file
64
cscript/README
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
calc shell script examples
|
||||||
|
--------------------------
|
||||||
|
|
||||||
|
These calc shell scripts are provided because they serve as examples of
|
||||||
|
how use the calc language, and/or because the authors thought them to
|
||||||
|
be useful!
|
||||||
|
|
||||||
|
If you write something that you think is useful, please send it to:
|
||||||
|
|
||||||
|
calc-tester at postofc dot corp dot sgi dot com
|
||||||
|
|
||||||
|
[[ Replace 'at' with @, 'dot' is with . and remove the spaces ]]
|
||||||
|
|
||||||
|
For more info, see:
|
||||||
|
|
||||||
|
help script
|
||||||
|
help cscript
|
||||||
|
|
||||||
|
=-=
|
||||||
|
|
||||||
|
mersenne exp
|
||||||
|
|
||||||
|
Print the value of 2^exp-1.
|
||||||
|
|
||||||
|
|
||||||
|
piforever
|
||||||
|
|
||||||
|
Print the value of pi forever, or as long as you cpu / memory allows.
|
||||||
|
|
||||||
|
|
||||||
|
plus arg ...
|
||||||
|
|
||||||
|
Print the sum of 1 or more arguments.
|
||||||
|
|
||||||
|
|
||||||
|
simple
|
||||||
|
|
||||||
|
A trivial example of a calc shell script.
|
||||||
|
|
||||||
|
## 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
|
||||||
|
## 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.3 $
|
||||||
|
## @(#) $Id: README,v 29.3 1999/12/17 10:34:54 chongo Exp $
|
||||||
|
## @(#) $Source: /usr/local/src/cmd/calc/cscript/RCS/README,v $
|
||||||
|
##
|
||||||
|
## Under source code control: 1999/12/17 10:23:40
|
||||||
|
## File existed as early as: 1999
|
||||||
|
##
|
||||||
|
## chongo <was here> /\oo/\ http://reality.sgi.com/chongo/
|
||||||
|
## Share and enjoy! :-) http://reality.sgi.com/chongo/tech/comp/calc/
|
@@ -18,7 +18,7 @@
|
|||||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*
|
*
|
||||||
* @(#) $Revision: 29.1 $
|
* @(#) $Revision: 29.1 $
|
||||||
* @(#) $Id: c_sysinfo.c,v 29.1 1999/12/14 09:15:37 chongo Exp $
|
* @(#) $Id: c_sysinfo.c,v 29.1 1999/12/14 09:15:37 chongo Exp chongo $
|
||||||
* @(#) $Source: /usr/local/src/cmd/calc/custom/RCS/c_sysinfo.c,v $
|
* @(#) $Source: /usr/local/src/cmd/calc/custom/RCS/c_sysinfo.c,v $
|
||||||
*
|
*
|
||||||
* Under source code control: 1997/03/09 23:14:40
|
* Under source code control: 1997/03/09 23:14:40
|
||||||
@@ -319,8 +319,7 @@ dump_name_value(void)
|
|||||||
for (p = sys_info; p->name != NULL; ++p) {
|
for (p = sys_info; p->name != NULL; ++p) {
|
||||||
if (p->str == NULL) {
|
if (p->str == NULL) {
|
||||||
#if LONG_BITS == FULL_BITS || FULL_BITS == 32 || !defined(HAVE_LONGLONG)
|
#if LONG_BITS == FULL_BITS || FULL_BITS == 32 || !defined(HAVE_LONGLONG)
|
||||||
fmt = "%s%-23s\t%-8lu\t(0x%lx)\n";
|
printf("%s%-23s\t%-8lu\t(0x%lx)\n",
|
||||||
printf(fmt,
|
|
||||||
(conf->tab_ok ? "\t" : ""), p->name,
|
(conf->tab_ok ? "\t" : ""), p->name,
|
||||||
(unsigned long)p->nmbr,
|
(unsigned long)p->nmbr,
|
||||||
(unsigned long)p->nmbr);
|
(unsigned long)p->nmbr);
|
||||||
@@ -333,7 +332,7 @@ dump_name_value(void)
|
|||||||
* So we will only try %lld if %ld does not work.
|
* So we will only try %lld if %ld does not work.
|
||||||
*/
|
*/
|
||||||
# if defined(L64_FORMAT)
|
# if defined(L64_FORMAT)
|
||||||
printf("%s%-23s\t%-8lu\t(0x%lx)\n".
|
printf("%s%-23s\t%-8lu\t(0x%lx)\n",
|
||||||
(conf->tab_ok ? "\t" : ""), p->name,
|
(conf->tab_ok ? "\t" : ""), p->name,
|
||||||
(unsigned long long)p->nmbr,
|
(unsigned long long)p->nmbr,
|
||||||
(unsigned long long)p->nmbr);
|
(unsigned long long)p->nmbr);
|
||||||
|
9
func.c
9
func.c
@@ -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.1 $
|
* @(#) $Revision: 29.2 $
|
||||||
* @(#) $Id: func.c,v 29.1 1999/12/14 09:15:38 chongo Exp $
|
* @(#) $Id: func.c,v 29.2 1999/12/19 03:20:26 chongo Exp $
|
||||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/func.c,v $
|
* @(#) $Source: /usr/local/src/cmd/calc/RCS/func.c,v $
|
||||||
*
|
*
|
||||||
* Under source code control: 1990/02/15 01:48:15
|
* Under source code control: 1990/02/15 01:48:15
|
||||||
@@ -73,6 +73,11 @@
|
|||||||
#include <sys/times.h>
|
#include <sys/times.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "have_strdup.h"
|
||||||
|
#if !defined(HAVE_STRDUP)
|
||||||
|
# define strdup(x) calc_strdup((CONST char *)(x))
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "have_const.h"
|
#include "have_const.h"
|
||||||
#include "calc.h"
|
#include "calc.h"
|
||||||
#include "calcerr.h"
|
#include "calcerr.h"
|
||||||
|
6
hash.c
6
hash.c
@@ -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.1 $
|
* @(#) $Revision: 29.2 $
|
||||||
* @(#) $Id: hash.c,v 29.1 1999/12/14 09:15:38 chongo Exp $
|
* @(#) $Id: hash.c,v 29.2 1999/12/14 19:37:46 chongo Exp $
|
||||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/hash.c,v $
|
* @(#) $Source: /usr/local/src/cmd/calc/RCS/hash.c,v $
|
||||||
*
|
*
|
||||||
* Under source code control: 1995/11/23 05:13:11
|
* Under source code control: 1995/11/23 05:13:11
|
||||||
@@ -982,7 +982,7 @@ hash_value(int type, void *v, HASH *state)
|
|||||||
state = hash_bool(type, value->v_config->verbose_quit, state);
|
state = hash_bool(type, value->v_config->verbose_quit, state);
|
||||||
state = hash_int(type, value->v_config->ctrl_d, state);
|
state = hash_int(type, value->v_config->ctrl_d, state);
|
||||||
state = hash_str(type, value->v_config->program, state);
|
state = hash_str(type, value->v_config->program, state);
|
||||||
state = hash_str(type, value->v_config->basename, state);
|
state = hash_str(type, value->v_config->base_name, state);
|
||||||
state = hash_str(type, value->v_config->version, state);
|
state = hash_str(type, value->v_config->version, state);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
20
help.c
20
help.c
@@ -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.1 $
|
* @(#) $Revision: 29.2 $
|
||||||
* @(#) $Id: help.c,v 29.1 1999/12/14 09:15:40 chongo Exp $
|
* @(#) $Id: help.c,v 29.2 1999/12/17 09:22:03 chongo Exp $
|
||||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/help.c,v $
|
* @(#) $Source: /usr/local/src/cmd/calc/RCS/help.c,v $
|
||||||
*
|
*
|
||||||
* Under source code control: 1997/09/14 10:58:30
|
* Under source code control: 1997/09/14 10:58:30
|
||||||
@@ -253,19 +253,15 @@ givehelp(char *type)
|
|||||||
stream = fopen(helppath, "r");
|
stream = fopen(helppath, "r");
|
||||||
if (stream == NULL) {
|
if (stream == NULL) {
|
||||||
|
|
||||||
/*
|
/* no such help file */
|
||||||
* we have the help file open, now display it
|
|
||||||
*/
|
|
||||||
page_file(stream);
|
|
||||||
(void) fclose(stream);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* no such help file
|
|
||||||
*/
|
|
||||||
} else {
|
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"%s: no such help file, try: help help\n",
|
"%s: no such help file, try: help help\n",
|
||||||
type);
|
type);
|
||||||
|
} else {
|
||||||
|
|
||||||
|
/* we have the help file open, now display it */
|
||||||
|
page_file(stream);
|
||||||
|
(void) fclose(stream);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -18,8 +18,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.1 $
|
# @(#) $Revision: 29.2 $
|
||||||
# @(#) $Id: Makefile,v 29.1 1999/12/14 09:16:34 chongo Exp $
|
# @(#) $Id: Makefile,v 29.2 1999/12/17 10:33:00 chongo Exp $
|
||||||
# @(#) $Source: /usr/local/src/cmd/calc/help/RCS/Makefile,v $
|
# @(#) $Source: /usr/local/src/cmd/calc/help/RCS/Makefile,v $
|
||||||
#
|
#
|
||||||
# Under source code control: 1991/07/23 06:47:57
|
# Under source code control: 1991/07/23 06:47:57
|
||||||
@@ -87,7 +87,11 @@ STD_HELP_FILES_8= operator statement
|
|||||||
|
|
||||||
BLT_HELP_FILES_9= resource
|
BLT_HELP_FILES_9= resource
|
||||||
|
|
||||||
STD_HELP_FILES_10= types usage script unexpected variable
|
STD_HELP_FILES_10= types usage script
|
||||||
|
|
||||||
|
BLT_HELP_FILES_10a= cscript
|
||||||
|
|
||||||
|
STD_HELP_FILES_10b= unexpected variable
|
||||||
|
|
||||||
BLT_HELP_FILES_11= bindings custom_cal libcalc new_custom resource
|
BLT_HELP_FILES_11= bindings custom_cal libcalc new_custom resource
|
||||||
|
|
||||||
@@ -108,6 +112,7 @@ FULL_HELP_FILES= ${STD_HELP_FILES_1} ${STD_HELP_FILES_2} \
|
|||||||
${BLT_HELP_FILES_5} ${STD_HELP_FILES_6} \
|
${BLT_HELP_FILES_5} ${STD_HELP_FILES_6} \
|
||||||
${SPECIAL_HELP_7} ${STD_HELP_FILES_8} \
|
${SPECIAL_HELP_7} ${STD_HELP_FILES_8} \
|
||||||
${BLT_HELP_FILES_9} ${STD_HELP_FILES_10} \
|
${BLT_HELP_FILES_9} ${STD_HELP_FILES_10} \
|
||||||
|
${BLT_HELP_FILES_10a} ${STD_HELP_FILES_10b} \
|
||||||
${BLT_HELP_FILES_11} ${STD_HELP_FILES_12} \
|
${BLT_HELP_FILES_11} ${STD_HELP_FILES_12} \
|
||||||
${BLT_HELP_FILES_13} ${STD_HELP_FILES_14} \
|
${BLT_HELP_FILES_13} ${STD_HELP_FILES_14} \
|
||||||
${BLT_HELP_FILES_14} ${STD_HELP_FILES_15}
|
${BLT_HELP_FILES_14} ${STD_HELP_FILES_15}
|
||||||
@@ -117,6 +122,7 @@ FULL_HELP_FILES= ${STD_HELP_FILES_1} ${STD_HELP_FILES_2} \
|
|||||||
STD_HELP_FILES= ${STD_HELP_FILES_1} ${STD_HELP_FILES_2} \
|
STD_HELP_FILES= ${STD_HELP_FILES_1} ${STD_HELP_FILES_2} \
|
||||||
${STD_HELP_FILES_4} ${STD_HELP_FILES_6} \
|
${STD_HELP_FILES_4} ${STD_HELP_FILES_6} \
|
||||||
${STD_HELP_FILES_8} ${STD_HELP_FILES_10} \
|
${STD_HELP_FILES_8} ${STD_HELP_FILES_10} \
|
||||||
|
${STD_HELP_FILES_10b} \
|
||||||
${STD_HELP_FILES_12} ${STD_HELP_FILES_14} \
|
${STD_HELP_FILES_12} ${STD_HELP_FILES_14} \
|
||||||
${STD_HELP_FILES_15}
|
${STD_HELP_FILES_15}
|
||||||
|
|
||||||
@@ -127,6 +133,7 @@ STD_HELP_FILES= ${STD_HELP_FILES_1} ${STD_HELP_FILES_2} \
|
|||||||
#
|
#
|
||||||
BLT_HELP_FILES= ${BLT_HELP_FILES_3} ${BLT_HELP_FILES_5} \
|
BLT_HELP_FILES= ${BLT_HELP_FILES_3} ${BLT_HELP_FILES_5} \
|
||||||
${BLT_HELP_FILES_9} \
|
${BLT_HELP_FILES_9} \
|
||||||
|
${BLT_HELP_FILES_10a} \
|
||||||
${BLT_HELP_FILES_11} ${BLT_HELP_FILES_13} \
|
${BLT_HELP_FILES_11} ${BLT_HELP_FILES_13} \
|
||||||
${BLT_HELP_FILES_14}
|
${BLT_HELP_FILES_14}
|
||||||
|
|
||||||
@@ -337,6 +344,18 @@ COPYING-LGPL: ../COPYING-LGPL
|
|||||||
true; \
|
true; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
cscript: ../cscript/README
|
||||||
|
rm -f $@
|
||||||
|
cp ../cscript/README $@
|
||||||
|
${CHMOD} 0444 $@
|
||||||
|
-@if [ -z "${Q}" ]; then \
|
||||||
|
echo ''; \
|
||||||
|
echo '=-=-= skipping the cat of help/$@ =-=-='; \
|
||||||
|
echo ''; \
|
||||||
|
else \
|
||||||
|
true; \
|
||||||
|
fi
|
||||||
|
|
||||||
full: ${FULL_HELP_FILES} ${MAKE_FILE}
|
full: ${FULL_HELP_FILES} ${MAKE_FILE}
|
||||||
${Q}echo "forming full"
|
${Q}echo "forming full"
|
||||||
-${Q}rm -f $@
|
-${Q}rm -f $@
|
||||||
|
@@ -35,6 +35,7 @@ following topics:
|
|||||||
new_custom information about how to add new custom functions
|
new_custom information about how to add new custom functions
|
||||||
resource standard calc resource files
|
resource standard calc resource files
|
||||||
script using calc shell scripts
|
script using calc shell scripts
|
||||||
|
cscript info on the calc shell scripts supplied with calc
|
||||||
|
|
||||||
archive where to get the latest versions of calc
|
archive where to get the latest versions of calc
|
||||||
bugs known bugs and mis-features
|
bugs known bugs and mis-features
|
||||||
@@ -118,8 +119,8 @@ as the same effect as:
|
|||||||
## 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.1 $
|
## @(#) $Revision: 29.2 $
|
||||||
## @(#) $Id: help,v 29.1 1999/12/14 09:15:52 chongo Exp $
|
## @(#) $Id: help,v 29.2 1999/12/17 10:33:00 chongo Exp $
|
||||||
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/help,v $
|
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/help,v $
|
||||||
##
|
##
|
||||||
## Under source code control: 1991/07/21 04:37:20
|
## Under source code control: 1991/07/21 04:37:20
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
Calc shell scripts
|
Calc shell scripts
|
||||||
|
------------------
|
||||||
|
|
||||||
If an executable file begins with:
|
If an executable file begins with:
|
||||||
|
|
||||||
@@ -62,6 +63,7 @@ For more information use the following calc commands:
|
|||||||
help usage
|
help usage
|
||||||
help argv
|
help argv
|
||||||
help config
|
help config
|
||||||
|
help cscript
|
||||||
|
|
||||||
## Copyright (C) 1999 Landon Curt Noll
|
## Copyright (C) 1999 Landon Curt Noll
|
||||||
##
|
##
|
||||||
@@ -79,8 +81,8 @@ For more information use the following calc commands:
|
|||||||
## 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.1 $
|
## @(#) $Revision: 29.2 $
|
||||||
## @(#) $Id: script,v 29.1 1999/12/14 09:16:06 chongo Exp $
|
## @(#) $Id: script,v 29.2 1999/12/17 10:33:00 chongo Exp $
|
||||||
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/script,v $
|
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/script,v $
|
||||||
##
|
##
|
||||||
## Under source code control: 1999/11/30 05:29:48
|
## Under source code control: 1999/11/30 05:29:48
|
||||||
|
150
help/usage
150
help/usage
@@ -2,11 +2,11 @@ Calc command line
|
|||||||
|
|
||||||
Calc has the following command line:
|
Calc has the following command line:
|
||||||
|
|
||||||
calc [-c] [-C] [-d] [-D calc_debug[:resource_debug:[user_debug]]]
|
calc [-c] [-C] [-d] [-D calc_debug[:resource_debug[:user_debug]]]
|
||||||
[-e] [-h] [-i] [-m mode] [-n] [-p] [-q] [-s] [-u] [-v]
|
[-e] [-h] [-i] [-m mode] [-n] [-p] [-q] [-s] [-u] [-v]
|
||||||
[calc_cmd ...]
|
[calc_cmd ...]
|
||||||
|
|
||||||
#!/usr/local/bin/calc -S [-other_flags ...]
|
#!/usr/local/bin/calc -S [other_flags]
|
||||||
|
|
||||||
-c Continue reading command lines even after an execution
|
-c Continue reading command lines even after an execution
|
||||||
error has caused the abandonment of a line.
|
error has caused the abandonment of a line.
|
||||||
@@ -22,7 +22,7 @@ Calc command line
|
|||||||
will cause calc to try to process each line being read
|
will cause calc to try to process each line being read
|
||||||
despite the errors that it encounters.
|
despite the errors that it encounters.
|
||||||
|
|
||||||
By default, calc startup resource files ($CALCRC) are
|
By default, calc startup resource files are
|
||||||
silently ignored if not found. This flag will report
|
silently ignored if not found. This flag will report
|
||||||
missing startup scripts unless -d is also given.
|
missing startup scripts unless -d is also given.
|
||||||
|
|
||||||
@@ -31,7 +31,7 @@ Calc command line
|
|||||||
Without this flag, calling the custom() builtin
|
Without this flag, calling the custom() builtin
|
||||||
function will simply generate an error.
|
function will simply generate an error.
|
||||||
|
|
||||||
Use if this flag may cause calc to execute functions
|
Use of this flag may cause calc to execute functions
|
||||||
that are non-standard and that are not portable.
|
that are non-standard and that are not portable.
|
||||||
Custom builtin functions are disabled by default for
|
Custom builtin functions are disabled by default for
|
||||||
this reason.
|
this reason.
|
||||||
@@ -60,7 +60,7 @@ Calc command line
|
|||||||
It's nearly ten past six.
|
It's nearly ten past six.
|
||||||
|
|
||||||
This flag disables the reporting of missing calc
|
This flag disables the reporting of missing calc
|
||||||
startup scripts ($CALCRC).
|
startup scripts.
|
||||||
|
|
||||||
|
|
||||||
-D calc_debug[:resource_debug:[user_debug]]
|
-D calc_debug[:resource_debug:[user_debug]]
|
||||||
@@ -68,7 +68,7 @@ Calc command line
|
|||||||
config("resource_debug") and config("user_debug").
|
config("resource_debug") and config("user_debug").
|
||||||
|
|
||||||
The : separated strings are interpreted as signed 32
|
The : separated strings are interpreted as signed 32
|
||||||
bit values. After an optional leading sign a leading
|
bit integers. After an optional leading sign a leading
|
||||||
zero indicates octal conversion, and a leading ``0x''
|
zero indicates octal conversion, and a leading ``0x''
|
||||||
or ``0X'' hexadecimal conversion. Otherwise, decimal
|
or ``0X'' hexadecimal conversion. Otherwise, decimal
|
||||||
conversion is assumed.
|
conversion is assumed.
|
||||||
@@ -91,11 +91,10 @@ Calc command line
|
|||||||
-m.
|
-m.
|
||||||
|
|
||||||
|
|
||||||
-i Become interactive if possible. Be default, if
|
-i Become interactive if possible. If calc_cmd args are given,
|
||||||
calc_cmd args are given, calc will execute them and
|
by default, calc will execute them and exit. This flag causes
|
||||||
exit. This flag args are given, calc will execute them
|
calc to drop into interactive mode after the commands are
|
||||||
and exit. This flag will cause calc to drop into
|
executed.
|
||||||
interactive mode after the commands are executed.
|
|
||||||
|
|
||||||
For example:
|
For example:
|
||||||
|
|
||||||
@@ -144,7 +143,7 @@ Calc command line
|
|||||||
if directed.
|
if directed.
|
||||||
|
|
||||||
If the mode disables opening of files for reading, then
|
If the mode disables opening of files for reading, then
|
||||||
the startup resource files are disabled as of -q was
|
the startup resource files are disabled as if -q was
|
||||||
given. The reading of key bindings is also disabled
|
given. The reading of key bindings is also disabled
|
||||||
when the mode disables opening of files for reading.
|
when the mode disables opening of files for reading.
|
||||||
|
|
||||||
@@ -163,7 +162,7 @@ Calc command line
|
|||||||
The -p flag overrides -i.
|
The -p flag overrides -i.
|
||||||
|
|
||||||
|
|
||||||
-q Disable the use of the $CALCRC startup scripts.
|
-q Disable the reading of the startup scripts.
|
||||||
|
|
||||||
|
|
||||||
-s By default, all calc_cmd args are evaluated and
|
-s By default, all calc_cmd args are evaluated and
|
||||||
@@ -178,39 +177,87 @@ Calc command line
|
|||||||
-v Print the calc version number and exit.
|
-v Print the calc version number and exit.
|
||||||
|
|
||||||
|
|
||||||
CALC COMMAND LINE
|
CALC COMMAND ARGUMENTS
|
||||||
|
|
||||||
Without calc_cmd, calc operates interactively. If one or
|
With no calc_cmd arguments, calc operates interactively. If one
|
||||||
more calc_cmd are given on the command line and -s is NOT
|
or more arguments are given on the command line and -s is NOT
|
||||||
given, then calc will evaluate and execute them and then
|
given, then calc will read and execute them and either attempt
|
||||||
exit.
|
to go interactive according as the -i flag was present or absent.
|
||||||
|
|
||||||
If -i is given, calc will attempt to become interactive even
|
|
||||||
of one or more calc_cmd are given on the command line.
|
|
||||||
|
|
||||||
If -s is given, calc will not evaluate any calc_cmd
|
If -s is given, calc will not evaluate any calc_cmd
|
||||||
arguments but instead make them available as strings to the
|
arguments but instead make them available as strings to the
|
||||||
argv() builtin function.
|
argv() builtin function.
|
||||||
|
|
||||||
Normally on startup, calc attempts to execute a collection
|
Sufficiently simple commands with no no characters like
|
||||||
of resource files. The environment variable $CALCRC (if
|
parentheses, brackets, semicolons, '*', which have special
|
||||||
non-existent then a compiled in value) contains a
|
interpretations in UNIX commands may be entered, possibly with
|
||||||
: separated list of startup resource files. No error
|
spaces, until the terminating newline. For example:
|
||||||
conditions are produced if these startup resource file are
|
|
||||||
not found.
|
|
||||||
|
|
||||||
If the mode disables opening of files for reading, then the
|
calc 23 + 47
|
||||||
startup resource files are disabled as of -q was given and
|
|
||||||
$CALCRC as well as the default compiled in value are
|
|
||||||
ignored.
|
|
||||||
|
|
||||||
Filenames are subject to ``~'' expansion (see below). The
|
should respond with display of 70, but:
|
||||||
environment variable $CALCPATH (if non-existent then a
|
|
||||||
compiled in value) contains a : separated list of search
|
calc 23 * 47
|
||||||
directories. If a file does not begin with /, ~ or ./, then
|
|
||||||
it is searched for under each directory listed in the
|
may fail. Such cases can usually be made to work as expected by
|
||||||
$CALCPATH. It is an error if no such readable file is
|
enclosing the command between single quotation marks as in:
|
||||||
found.
|
|
||||||
|
calc '23 * 47'
|
||||||
|
|
||||||
|
and
|
||||||
|
|
||||||
|
calc 'print sqrt(2), exp(1)'
|
||||||
|
|
||||||
|
If '!' is to be used to indicate the factorial function, for
|
||||||
|
shells like csh for which '!' followed by a non-space character
|
||||||
|
is used for history substitution, it may be necessary to
|
||||||
|
include a space or use a backslash to escape the special
|
||||||
|
meaning of '!'. For example, the command "print 27!^2" may have
|
||||||
|
to be replaced by "print 27! ^2" or "print 27\!^2".
|
||||||
|
|
||||||
|
|
||||||
|
CALC STARTUP FILES
|
||||||
|
|
||||||
|
Normally on startup, if the environment variable $CALCRC is
|
||||||
|
undefined and calc is invoked without the -q flag, or if
|
||||||
|
$CALCRC is defined and calc is invoked with -e, calc looks
|
||||||
|
for a file "startup" in the calc resource directory, .calcrc in
|
||||||
|
the user's home directory, and .calcinit in the current directory.
|
||||||
|
If one or more of these are found, they are read in succession
|
||||||
|
as calc scripts and their commands executed. When defined,
|
||||||
|
$CALCRC is to contain a ':' separated list of names of files,
|
||||||
|
and if calc is then invoked without either the -q or -e flags,
|
||||||
|
these files are read in succession and their commands executed.
|
||||||
|
No error condition is produced if a listed file is not found.
|
||||||
|
|
||||||
|
If the mode specified by -m disables opening of files for
|
||||||
|
reading, then the reading of startup files is also disabled
|
||||||
|
as if -q was given.
|
||||||
|
|
||||||
|
|
||||||
|
CALC FILE SEARCH PATH
|
||||||
|
|
||||||
|
If the environment variable $CALCPATH is undefined, or if it
|
||||||
|
is defined and calc is invoked with the -e flag, when a file
|
||||||
|
name not beginning with /, ~ or ./, is specified as in:
|
||||||
|
|
||||||
|
calc read myfile
|
||||||
|
|
||||||
|
calc searches in succession:
|
||||||
|
|
||||||
|
./myfile
|
||||||
|
./myfile.cal
|
||||||
|
${LIBDIR}/myfile
|
||||||
|
${LIBDIR}/myfile.cal
|
||||||
|
${CUSTOMLIBDIR}/myfile
|
||||||
|
${CUSTOMLIBDIR}/myfile.cal
|
||||||
|
|
||||||
|
If the file is found, the search stops and the commands in
|
||||||
|
the file are executed. It is an error if no readable file
|
||||||
|
with the specified name is found. An alternative search
|
||||||
|
path can be specified by defining $CALCPATH in the same way
|
||||||
|
as PATH is defined, as a ':' separated list of directories,
|
||||||
|
and then invoking calc without the -e flag.
|
||||||
|
|
||||||
Calc treats all open files, other than stdin, stdout and
|
Calc treats all open files, other than stdin, stdout and
|
||||||
stderr as files available for reading and writing. One may
|
stderr as files available for reading and writing. One may
|
||||||
@@ -222,21 +269,24 @@ Calc command line
|
|||||||
|
|
||||||
SHELL SCRIPT MODE
|
SHELL SCRIPT MODE
|
||||||
|
|
||||||
If an executable file begins with:
|
If first line of an executable file begins #! followed by the
|
||||||
|
absolute pathname of the calc program and the flag -S as in
|
||||||
|
|
||||||
#!/usr/local/bin/calc -S [-other_flags ...]
|
#!/usr/local/bin/calc -S [other_flags]
|
||||||
|
|
||||||
the rest of the file will be processed in shell script mode.
|
the rest of the file will be processed in shell script mode.
|
||||||
Note that -S (UPPER CASE -S) must be the first -flag on the
|
Note that -S (UPPER CASE S) must be the first -flag on the
|
||||||
``#!'' line. Any other optional ``-other_flags'' must come
|
``#!'' line. Any optional ``other_flags'' must come after
|
||||||
after the -S.
|
the -S.
|
||||||
|
|
||||||
In shell script mode the contents of the file are evaluated
|
In shell script mode the contents of the file are read and
|
||||||
and executed as if they were processed by the read command.
|
executed as if they were in a file being processed by a read
|
||||||
Any optional ``-other_flags'' will by parsed first followed
|
command, except that a "command" beginning with '#' followed by
|
||||||
by any arguments given shell script itself.
|
whitespace and ending at the next newline is treated as a comment.
|
||||||
|
Any optional ``other_flags'' will be parsed first followed by
|
||||||
|
the later lines within the script itself.
|
||||||
|
|
||||||
In shell script mode, -s (lower case -s) is always assumed.
|
In shell script mode, -s (lower case s) is always assumed.
|
||||||
In addition, -d and -p are automatically set if -i is not
|
In addition, -d and -p are automatically set if -i is not
|
||||||
given.
|
given.
|
||||||
|
|
||||||
@@ -303,8 +353,8 @@ For more information use the following calc commands:
|
|||||||
## 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.1 $
|
## @(#) $Revision: 29.2 $
|
||||||
## @(#) $Id: usage,v 29.1 1999/12/14 09:16:10 chongo Exp $
|
## @(#) $Id: usage,v 29.2 1999/12/17 10:05:20 chongo Exp $
|
||||||
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/usage,v $
|
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/usage,v $
|
||||||
##
|
##
|
||||||
## Under source code control: 1991/07/21 04:37:25
|
## Under source code control: 1991/07/21 04:37:25
|
||||||
|
12
lib_calc.c
12
lib_calc.c
@@ -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.1 $
|
* @(#) $Revision: 29.2 $
|
||||||
* @(#) $Id: lib_calc.c,v 29.1 1999/12/14 09:16:11 chongo Exp $
|
* @(#) $Id: lib_calc.c,v 29.2 1999/12/14 19:37:46 chongo Exp $
|
||||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/lib_calc.c,v $
|
* @(#) $Source: /usr/local/src/cmd/calc/RCS/lib_calc.c,v $
|
||||||
*
|
*
|
||||||
* Under source code control: 1996/06/17 18:06:19
|
* Under source code control: 1996/06/17 18:06:19
|
||||||
@@ -95,7 +95,7 @@ int abortlevel; /* current level of aborts */
|
|||||||
BOOL inputwait; /* TRUE if in a terminal input wait */
|
BOOL inputwait; /* TRUE if in a terminal input wait */
|
||||||
jmp_buf jmpbuf; /* for errors */
|
jmp_buf jmpbuf; /* for errors */
|
||||||
char *program = "calc"; /* our name */
|
char *program = "calc"; /* our name */
|
||||||
char *basename = "calc"; /* basename of our name */
|
char *base_name = "calc"; /* basename of our name */
|
||||||
char cmdbuf[MAXCMD+1+1+1]; /* command line expression + "\n\0" + guard */
|
char cmdbuf[MAXCMD+1+1+1]; /* command line expression + "\n\0" + guard */
|
||||||
run run_state = RUN_UNKNOWN; /* calc startup and run state */
|
run run_state = RUN_UNKNOWN; /* calc startup and run state */
|
||||||
|
|
||||||
@@ -200,9 +200,9 @@ libcalc_call_me_first(void)
|
|||||||
if (program != NULL) {
|
if (program != NULL) {
|
||||||
p = strrchr(program, '/');
|
p = strrchr(program, '/');
|
||||||
if (p == NULL) {
|
if (p == NULL) {
|
||||||
basename = program;
|
base_name = program;
|
||||||
} else {
|
} else {
|
||||||
basename = p+1;
|
base_name = p+1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -211,7 +211,7 @@ libcalc_call_me_first(void)
|
|||||||
*/
|
*/
|
||||||
oldstd.epsilon = &_qonesqbase_; /* magic to fake early str2q() */
|
oldstd.epsilon = &_qonesqbase_; /* magic to fake early str2q() */
|
||||||
oldstd.program = strdup(program);
|
oldstd.program = strdup(program);
|
||||||
oldstd.basename = strdup(basename);
|
oldstd.base_name = strdup(base_name);
|
||||||
oldstd.version = strdup(version());
|
oldstd.version = strdup(version());
|
||||||
conf = config_copy(&oldstd); /* more magic to fake early str2q() */
|
conf = config_copy(&oldstd); /* more magic to fake early str2q() */
|
||||||
conf->tab_ok = FALSE;
|
conf->tab_ok = FALSE;
|
||||||
|
@@ -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.1 $
|
* @(#) $Revision: 29.2 $
|
||||||
* @(#) $Id: quickhash.c,v 29.1 1999/12/14 09:16:14 chongo Exp $
|
* @(#) $Id: quickhash.c,v 29.2 1999/12/14 19:37:46 chongo Exp $
|
||||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/quickhash.c,v $
|
* @(#) $Source: /usr/local/src/cmd/calc/RCS/quickhash.c,v $
|
||||||
*
|
*
|
||||||
* Under source code control: 1995/03/04 11:34:23
|
* Under source code control: 1995/03/04 11:34:23
|
||||||
@@ -436,8 +436,8 @@ config_hash(CONFIG *cfg, QCKHASH val)
|
|||||||
if (cfg->program) {
|
if (cfg->program) {
|
||||||
val = fnv_strhash(cfg->program, val);
|
val = fnv_strhash(cfg->program, val);
|
||||||
}
|
}
|
||||||
if (cfg->basename) {
|
if (cfg->base_name) {
|
||||||
val = fnv_strhash(cfg->basename, val);
|
val = fnv_strhash(cfg->base_name, val);
|
||||||
}
|
}
|
||||||
if (cfg->version) {
|
if (cfg->version) {
|
||||||
val = fnv_strhash(cfg->version, val);
|
val = fnv_strhash(cfg->version, val);
|
||||||
|
13
token.c
13
token.c
@@ -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.1 $
|
* @(#) $Revision: 29.2 $
|
||||||
* @(#) $Id: token.c,v 29.1 1999/12/14 09:16:16 chongo Exp $
|
* @(#) $Id: token.c,v 29.2 1999/12/17 09:22:38 chongo Exp $
|
||||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/token.c,v $
|
* @(#) $Source: /usr/local/src/cmd/calc/RCS/token.c,v $
|
||||||
*
|
*
|
||||||
* Under source code control: 1990/02/15 01:48:25
|
* Under source code control: 1990/02/15 01:48:25
|
||||||
@@ -335,10 +335,11 @@ gettoken(void)
|
|||||||
switch(nextchar()) {
|
switch(nextchar()) {
|
||||||
case '=': type = T_HASHEQUALS; break;
|
case '=': type = T_HASHEQUALS; break;
|
||||||
case '!': type = T_POUNDBANG; eatline(); break;
|
case '!': type = T_POUNDBANG; eatline(); break;
|
||||||
case ' ': type = T_POUNDCOMMENT; eatline();
|
case '#':
|
||||||
break;
|
case ' ':
|
||||||
case '\t': type = T_POUNDCOMMENT; eatline();
|
case '\t':
|
||||||
break;
|
type = T_POUNDCOMMENT; eatline();
|
||||||
|
break;
|
||||||
case '\n': type = T_POUNDCOMMENT; break;
|
case '\n': type = T_POUNDCOMMENT; break;
|
||||||
default: type = T_HASH; reread();
|
default: type = T_HASH; reread();
|
||||||
}
|
}
|
||||||
|
14
version.c
14
version.c
@@ -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.1 $
|
* @(#) $Revision: 29.7 $
|
||||||
* @(#) $Id: version.c,v 29.1 1999/12/14 09:16:17 chongo Exp $
|
* @(#) $Id: version.c,v 29.7 1999/12/19 03:26:47 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
|
||||||
@@ -43,7 +43,7 @@ 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 1 /* patch level or 0 if no patch */
|
#define MAJOR_PATCH 1 /* patch level or 0 if no patch */
|
||||||
#define MINOR_PATCH "" /* test number or empty string if no patch */
|
#define MINOR_PATCH "3" /* test number or empty string if no patch */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* calc version constants
|
* calc version constants
|
||||||
@@ -84,12 +84,8 @@ char *Copyright = "\n"
|
|||||||
"received a copy with calc; if not, write to Free Software Foundation, Inc.\n"
|
"received a copy with calc; if not, write to Free Software Foundation, Inc.\n"
|
||||||
"59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.\n"
|
"59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.\n"
|
||||||
"\n"
|
"\n"
|
||||||
"For license details use the command:\t\t\thelp copying\n"
|
"@(#) For license details use the command:\thelp copying\n"
|
||||||
"The COPYING-LGPL file may be viewed with the command:\thelp copying-lgpl\n"
|
"The COPYING-LGPL file may be viewed with:\thelp copying-lgpl\n"
|
||||||
"\n"
|
|
||||||
"@(#) $Revision: 29.1 $\n"
|
|
||||||
"@(#) $Id: version.c,v 29.1 1999/12/14 09:16:17 chongo Exp $\n"
|
|
||||||
"@(#) $Source: /usr/local/src/cmd/calc/RCS/version.c,v $\n"
|
|
||||||
"\n";
|
"\n";
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user