Files
calc/help/usage
2017-05-21 15:38:25 -07:00

112 lines
4.1 KiB
Plaintext

Calc command line
Calc has the following command line:
calc [-C] [-e] [-h] [-i] [-m mode] [-n] [-p] [-q] [-u] [calc_cmd ...]
-C Permit the execution of custom builtin functions. Without
this flag, calling the custom() builtin function will
simply generate an error.
Use if this flag may cause calc to execute functions that
are non-standard and that are not portable. Custom builtin
functions are disabled by default for this reason.
-e Ignore any environment variables on startup. The
getenv() builtin will still return values, however.
-h Print a help message. This option implies -q. This
is equivalent to the calc command help help. The help
facility is disabled unless the mode is 5 or 7. See -m.
-i Do not about if the error count exceeds maxerr().
-m mode
This flag sets the permission mode of calc. It
controls the ability for calc to open files and execute
programs. Mode may be a number from 0 to 7.
The mode value is interpreted in a way similar to that
of the chmod(1) octal mode:
0 do not open any file, do not execute progs
1 do not open any file
2 do not open files for reading, do not execute progs
3 do not open files for reading
4 do not open files for writing, do not execute progs
5 do not open files for writing
6 do not execute any program
7 allow everything (default mode)
If one wished to run calc from a privledged user, one
might want to use -m 0 in an effort to make calc more
secure.
Mode bits for reading and writing apply only on an
open. Files already open are not effected. Thus if one
wanted to use the -m 0 in an effort to make calc more
secure, but still wanted to read and write a specific
file, one might want to do:
calc -m 0 3<a.file
Files presented to calc in this way are opened in an
unknown mode. Calc will attempt to read or write them
if directed.
If the mode disables opening of files for reading, then
the startup library scripts are disabled as of -q was
given. The reading of key bindings is also disabled
when the mode disables opening of files for reading.
-n Use the new configutation defaults instead of the old
default classic defaults. This flag as the same effect
as executing config("all", "newcfg") at startup time.
-p Pipe processing is enabled by use of -p. For example:
echo "print 2^21701-1, 2^23209-1" | calc -p | fizzbin
In pipe mode, calc does not prompt, does not print
leading tabs and does not print the initial header.
-q Disable the use of the $CALCRC startup scripts.
-u Disable buffering of stdin and stdout.
Without `calc_cmd', calc operates interactively. If one or more
`calc_cmd' are given on the command line, calc will execute them and
exit. The printing of leading tabs on output is disabled as if
config("tab",0) had been executed.
Normally on startup, calc attempts to execute a collection of
library scripts. The environment variable $CALCRC (if non-existent
then a compiled in value) contains a : separated list of startup
library scripts. No error conditions are produced if these startup
library scripts are not found.
If the mode disables opening of files for reading, then the startup
library scripts 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
environment variable $CALCPATH (if non-existent then a compiled in
value) contains a : separated list of search directories. If a
file does not begin with /, ~ or ./, then it is searched for under
each directory listed in the $CALCPATH. It is an error if no such
readable file is found.
Calc treats all open files, other than stdin, stdout and
stderr as files available for reading and writing. One may
present calc with an already open file in the following way:
calc 3<open_file 4<open_file2
For more information use the following calc commands:
help help
help overview
help usage
help environment
help config