.\" .\" 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.6 $ .\" @(#) $Id: calc.man,v 29.6 2001/04/10 21:48:46 chongo Exp $ .\" @(#) $Source: /usr/local/src/cmd/calc/RCS/calc.man,v $ .\" .\" Under source code control: 1991/07/23 05:48:26 .\" File existed as early as: 1991 .\" .\" chongo /\oo/\ http://www.isthe.com/chongo/ .\" Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ .\" .\" calculator by David I. Bell .\" man page by Landon Noll .\" .TH calc 1 "^..^" "1999-11-30" .SH NAME calc \- arbitrary precision calculator .SH SYNOPSIS \fIcalc\fP .RB [ \-c ] .RB [ \-C ] .RB [ \-d ] .br .in +5n .RB [ -D\ \&calc_debug[:resource_debug[:user_debug]] ] .br .RB [ \-e ] .RB [ \-h ] .RB [ \-i ] .RB [ \-m\ \&mode ] .RB [ \-n ] .br .RB [ \-p ] .RB [ \-q ] .RB [ \-s ] .RB [ \-u ] .RB [ \-v ] .RB [ calc_cmd\ \&.\|.\|. ] .in -5n .sp \fI#!${BINDIR}/calc\fP\ \fB\-S\fP\ [other_flags\ \&...] .SH DESCRIPTION \& .br CALC OPTIONS .PP .TP .B \-c Continue reading command lines even after an execution error has caused the abandonment of a line. .sp 1 For example: .sp 1 .in +5n .nf calc read many_errors.cal .fi .in -5n .sp 1 will cause .B calc to abort on the first error, whereas: .sp 1 .in +5n .nf calc -c read many_errors.cal .fi .in -5n .sp 1 will cause .B calc to try to process each line being read despite the errors that it encounters. .sp 1 By default, calc startup resource files are silently ignored if not found. This flag will report missing startup resource files unless .B \-d is also given. .TP .B \-C Permit the execution of custom builtin functions. Without this flag, calling the custom() builtin function will simply generate an error. .sp 1 Use of this flag may cause .B calc to execute functions that are non-standard and that are not portable. Custom builtin functions are disabled by default for this reason. .TP .B \-d Disable the printing of the opening title. The printing of resource file debug and informational messages is also disabled as if \fBconfig("resource_debug", 0)\fP had been executed. .sp 1 For example: .sp 1 .in +5n calc 'read qtime; qtime(2)' .in -5n .sp 1 will output something like: .sp 1 .in +5n .nf qtime(utc_hr_offset) defined It's nearly ten past six. .fi .in -5n .sp 1 whereas: .sp 1 .in +5n .nf calc -d 'read qtime; qtime(2)' .fi .in -5n .sp 1 will just say: .sp 1 .in +5n .nf It's nearly ten past six. .fi .in -5n .sp 1 This flag disables the reporting of missing calc startup resource files. .TP .BR -D " calc_debug[:resource_debug[:user_debug]]" Force the initial value of config("calc_debug"), config("resource_debug") and config("user_debug"). .sp 1 The : separated strings are interpreted as signed 32 bit integers. After an optional leading sign a leading zero indicates octal conversion, and a leading ``0x'' or ``0X'' hexadecimal conversion. Otherwise, decimal conversion is assumed. .sp 1 By default, .I calc_debug is 0, .I resource_debug is 3 and .I user_debug is 0. .sp 1 For more information use the following .B calc command: .sp 1 .in +5n .nf help config .fi .in -5n .TP .B \-e Ignore any environment variables on startup. The getenv() builtin will still return values, however. .TP .B \-h Print a help message. This option implies .BR \-q . This is equivalent to the .B calc command help help. The help facility is disabled unless the mode is 5 or 7. See .BR \-m . .TP .B \-i Become interactive if possible. If .I calc_cmd args are given, .B calc by default, calc will execute them and exit. This flag causes .B calc to drop into interactive mode after the commands are executed. This flag will cause .B calc to drop into interactive mode after the commands are executed. .sp 1 For example: .sp 1 .in +5n .nf calc 2+5 .fi .in -5n .sp 1 will print the value 7 and exit whereas: .sp 1 .in +5n .nf calc -i 2+5 .fi .in -5n .sp 1 will print the value 7 and prompt the user for more .B calc commands. .TP .BR \-m " mode" This flag sets the permission mode of .BR calc . It controls the ability for .B calc to open files and execute programs. .I Mode may be a number from 0 to 7. .sp 1 The mode value is interpreted in a way similar to that of the .BR chmod (1) octal mode: .sp 1 .in +5n .nf 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) .fi .in -5n .sp 1 If one wished to run .B calc from a privileged user, one might want to use .BR \-m " 0" in an effort to make .B calc somewhat more secure. .sp 1 Mode bits for reading and writing apply only on an open. Files already open are not effected. Thus if one wanted to use the .BR \-m " 0" in an effort to make .B calc somewhat more secure, but still wanted to read and write a specific file, one might want to do in .BR sh (1), .BR ksh (1), .BR bash (1)-like shells: .sp 1 .in +5n .nf calc -m 0 3