⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 calc.man

📁 Calc Software Package for Number Calc
💻 MAN
📖 第 1 页 / 共 2 页
字号:
.\".\" Copyright (C) 1999-2007	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.21 $.\" @(#) $Id: calc.man,v 29.21 2007/02/07 00:38:43 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 <was here> /\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 "^..^" "2007-02-06".SH NAMEcalc \- 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 [ \-O ].br.RB [ \-p ].RB [ \-q ].RB [ \-s ].RB [ \-u ].RB [ \-v ].RB [ [\-\-]\ calc_cmd\ \&.\|.\|. ].in -5n.sp\fI#!${BINDIR}/calc\fP\ [other_flags\ \&...] \fB\-f\fP.SH DESCRIPTION\&.brCALC OPTIONS.PP.TP.B \-cContinue reading command lines even after an scan/parseerror has caused the abandonment of a line.Note that this option only deals with scanning andparsing of the calc language.It does not deal with execution or run-time errors..sp 1For example:.sp 1.in +5n.nfcalc read many_errors.cal.fi.in -5n.sp 1will cause.B calcto abort on the first syntax error, whereas:.sp 1.in +5n.nfcalc -c read many_errors.cal.fi.in -5n.sp 1willcause.B calcto try to process each line being readdespite the scan/parse errors that it encounters..sp 1By default, calc startup resource files are silentlyignored if not found.This flag will report missingstartup resource files unless.B \-dis also given..TP.B \-CPermit the execution of custom builtin functions.Withoutthis flag, calling the custom() builtin function willsimply generate an error..sp 1Use of this flag may cause.B calcto execute functionsthat are non-standard and that are not portable.  Custom builtinfunctions are disabled by default for this reason..TP.B \-dDisable the printing of the opening title.  The printingof resource file debug and informational messages is also disabledas if \fBconfig("resource_debug", 0)\fP had been executed..sp 1For example:.sp 1.in +5ncalc "read qtime; qtime(2)".in -5n.sp 1will output something like:.sp 1.in +5n.nfqtime(utc_hr_offset) definedIt's nearly ten past six..fi.in -5n.sp 1whereas:.sp 1.in +5n.nfcalc -d "read qtime; qtime(2)".fi.in -5n.sp 1will just say:.sp 1.in +5n.nfIt's nearly ten past six..fi.in -5n.sp 1This flag disables the reporting of missing calcstartup 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 1The : separated strings are interpreted as signed 32 bit integers.After an optional leading sign a leading zero indicates octalconversion, and a leading ``0x'' or ``0X'' hexadecimalconversion.  Otherwise, decimal conversion is assumed..sp 1By default,.I calc_debugis 0,.I resource_debugis 3 and.I user_debugis 0..sp 1For more information use the following.B calccommand:.sp 1.in +5n.nfhelp config.fi.in -5n.TP.B \-eIgnore any environment variables on startup.The getenv() builtin will still return values, however..TP.B \-fThis flag is required when using calc in.BR "shell script mode" .It must be at the end of the initial.B #!line of the script..sp 1This flag is normally only at the end of a calc shell script.If the first line of an executable file begins.B #!followed by the absolute pathname of the.B calcprogram and the flag.B \-fas in:.sp 1.in +5n.nf\fI#!${BINDIR}/calc\fP\ [other_flags\ \&...] \fB\-f\fP.fi.in -5n.sp 1the rest of the file will be processed in.BR "shell script mode" .See.B "SHELL SCRIPT MODE"section of this man pagebelow for details..sp 1The actual form of this flag is:.sp 1.in +5n.B \-ffilename.in -5n.sp 1On systems that treat an executable that begins with.B #!as a script, the path of the execurable is appended by the kernelas the final argument to the exec() system call.This is why the.B \-fflag at the very end of the.B #!line..sp 1It is possible use.B \-f\ filenameon the command line:.sp 1.in +5n.nf\fIcalc\fP\ [other_flags\ \&...] \fB\-f\fP filename.fi.in -5n.sp 1This will cause calc to process lines in.B filenamein.BR "shell script mode" ..sp 1Use of.B \-fimplies.BR \-s .In addition,.B \-dand.B \-pare implied if.B \-iis not given..TP.B \-hPrint a help message.  This option implies.BR \-q .Thisis equivalent to the.B calccommand help help.The help facility is disabled unless the mode is 5 or 7.See.BR \-m ..TP.B \-iBecome interactive if possible.If.I calc_cmdargs are given,.B calcby default, calc will execute them and exit.This flag causes.B calcto drop into interactive mode after the commands are executed.This flag will cause.B calcto drop into interactive mode after thecommands are executed..sp 1For example:.sp 1.in +5n.nfcalc 2+5.fi.in -5n.sp 1will print the value 7 and exit whereas:.sp 1.in +5n.nfcalc -i 2+5.fi.in -5n.sp 1will print the value 7 and prompt the user for more.B calccommands..TP.BR \-m " mode"This flag sets the permission mode of.BR calc .It controls the ability for.B calcto open files and execute programs..I Modemay be a number from 0 to 7..sp 1The mode value is interpreted in a way similar to thatof the.BR chmod (1)octal mode:.sp 1.in +5n.nf0  do not open any file, do not execute progs1  do not open any file2  do not open files for reading, do not execute progs3  do not open files for reading4  do not open files for writing, do not execute progs5  do not open files for writing6  do not execute any program7  allow everything (default mode).fi.in -5n.sp 1If one wished to run.B calcfrom a privileged user, one might want to use.BR \-m " 0"in an effort to make.B calcsomewhat more secure..sp 1Mode bits for reading and writing apply only on anopen.Files already open are not effected.Thus if one wanted to use the.BR \-m " 0"in an effort to make.B calcsomewhat more secure, but still wanted to read and write a specificfile, one might want to do in.BR sh (1),.BR ksh (1),.BR bash (1)-likeshells:.sp 1.in +5n.nfcalc -m 0 3<a.file.fi.in -5n.sp 1Files presented to.B calcin this way are opened in anunknown mode..B Calcwill attempt to read or write them if directed..sp 1If the mode disables opening of files for reading, thenthe startup resource files are disabled as if.B \-qwas given.The reading of key bindings is also disabledwhen the mode disables opening of files for reading..TP.B \-OUse the old classic defaults instead of thedefault configuration.This flag as the same effectas executing \fBconfig("all", "oldcfg")\fP at startup time..sp 1NOTE: Older versions of calc used.B \-nto setup a modified form of the default calc configuration.The.B \-nflag currently does nothing.Use of the.B \-nflag is now deprecated and may be used forsomething else in the future..TP.B \-pPipe processing is enabled by use of.BR \-p .For example:.sp 1.in +5n.nfcalc -p "2^21701-1" | fizzbin.fi.in -5n.sp 1In pipe mode,.B calcdoes not prompt, does not print leadingtabs and does not print the initial header.The.B \-pflag overrides.BR \-i ..TP.B \-qDisable the reading of the startup scripts..TP.B \-sBy default, all.I calc_cmdargs are evaluated and executed.This flag will disable their evaluation and instead makethem available as strings for the argv() builtin function..TP.B \-uDisable buffering of stdin and stdout..TP.B \-vPrint the.B calcversion number and exit..TP.B \-\-The double dash indicates to calc that no more option follow.Thus calc will ignore a later argument on the command lineeven if it starts with a dash.This is useful when entering negative values on the command line as in:.sp 1.in +5n.nfcalc \-p \-\- \-1 - -7.sp 1.fi.in -5n.PP\&.brCALC COMMAND LINE.PPWith no.I calc_cmdarguments,.B calcoperates interactively.If one or morearguments are given on the command line and.B \-sis NOT given, then.B calcwill read and execute them and either attemptto go interactive according as the.B \-iflag was present or absent..spIf.B \-sis given,.B calcwill not evaluate any.I calc_cmdarguments but instead make them availableas strings to the argv() builtin function.Sufficiently simple commands with no no characters likeparentheses, brackets, semicolons, '*', which have specialinterpretations in UNIX shells may be entered, possibly withspaces, until the terminating newline.For example:.sp 1.in +5n.nfcalc 23 + 47.fi.in -5n.sp 1will print 70.However, command lines will have problems:.sp 1.in +5n.nfcalc 23 * 47.sp 1calc -23 + 47.fi.in -5n.sp 1The first example above fails because the shell interprets the '*'as a file glob.The second example fails because '\-23' is viewed as a calc option(which it is not) and do calc objects to that it thinks of as an unknown option.These cases can usually be made to work as expected byenclosing the command between quotes:.sp 1.in +5n.nfcalc '23 * 47'.sp 1calc "print sqrt(2), exp(1)".fi.in -5n.sp 1or in parentheses and quotes to avoid leading \-'s as in:.sp 1.in +5n.nfcalc '(-23 + 47)'.fi.in -5n.sp 1One may also use a double dash to denote that calc options have ended as in:.sp 1.in +5n.nfcalc -- -23 + 47.sp 1calc -q -- -23 + 47.fi.in -5n.sp 1If '!' is to be used to indicate the factorial function, forshells like.BI csh (1)for which '!' followed by a non-space characteris used for history substitution, it may be necessary toinclude a space or use a backslash to escape the specialmeaning of '!'.For example, the command:.sp 1.in +5n.nfprint 27!^2.fi.in -5n.sp 1may have to be replaced by:.sp 1.in +5n.nfprint 27! ^2	or	print 27\!^2.fi.in -5n\&.brCALC STARTUP FILES.PPNormally on startup,if the environment variable.B $CALCRCis undefined and.B calcis invoked without the.B \-qflag, or if.B $CALCRCis defined and calc is invoked with.BR \-e ,.B calclooks for a file "startup" in the calc resource directory.B .calcrcin 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 calcscripts and their commands executed.When defined,.B $CALCRCis to contain a ':' separated list of names of files,and if calc is then invoked without either the.B \-qor.B \-eflags, these files are read in succession and their commands executed.No error condition is produced if a listed file is not found..spIf the mode specified by.B \-mdisables opening of files for reading, then the reading of startupfiles is also disabled as if.B \-qwas given.\&.br

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -