This file is indexed.

/usr/share/calc/help/usage is in apcalc-common 2.12.5.0-1build1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
calc(1) 		    General Commands Manual		       calc(1)



NAME
       calc - arbitrary precision calculator

SYNOPSIS
       calc [-c] [-C] [-d]
	    [-D calc_debug[:resource_debug[:user_debug]]]
	    [-e] [-h] [-i] [-m mode] [-O]
	    [-p] [-q] [-s] [-u] [-v] [[--] calc_cmd ...]

       #!/usr/bin/calc [other_flags ...] -f

DESCRIPTION

       CALC OPTIONS

       -c     Continue reading command lines even after a scan/parse error has
	      caused the abandonment of a line.  Note that  this  option  only
	      deals  with  scanning and parsing of the calc language.  It does
	      not deal with execution or run-time errors.

	      For example:

		   calc read many_errors.cal

	      will cause calc to abort on the first syntax error, whereas:

		   calc -c read many_errors.cal

	      will cause calc to try to process each line being  read  despite
	      the scan/parse errors that it encounters.

	      By  default, calc startup resource files are silently ignored if
	      not found.  This flag will report missing startup resource files
	      unless -d is also given.


       -C     Permit  the execution of custom builtin functions.  Without this
	      flag, calling the custom() builtin function will simply generate
	      an error.

	      Use  of  this  flag may cause calc to execute functions that are
	      non-standard and that are not portable.	Custom	builtin  func-
	      tions are disabled by default for this reason.


       -d     Disable  the  printing  of  the  opening title.  The printing of
	      resource file debug and informational messages is also  disabled
	      as if config("resource_debug", 0) had been executed.

	      For example:

		   calc "read qtime; qtime(2)"

	      will output something like:

		   qtime(utc_hr_offset) defined
		   It's nearly ten past six.

	      whereas:

		   calc -d "read qtime; qtime(2)"

	      will just say:

		   It's nearly ten past six.

	      This  flag  disables  the  reporting  of	missing  calc  startup
	      resource files.


       -D calc_debug[:resource_debug[:user_debug]]
	      Force  the   initial   value   of   config("calc_debug"),   con-
	      fig("resource_debug") and config("user_debug").

	      The  :  separated strings are interpreted as signed 32 bit inte-
	      gers.  After an optional leading sign a leading  zero  indicates
	      octal  conversion,  and  a  leading ``0x'' or ``0X'' hexadecimal
	      conversion.  Otherwise, decimal conversion is assumed.

	      By default, calc_debug is 0, resource_debug is 3 and  user_debug
	      is 0.

	      For more information use the following calc command:

		   help config


       -e     Ignore  any  environment	variables  on  startup.   The getenv()
	      builtin will still return values, however.


       -f     This flag is required when using calc in shell script mode.   It
	      must be at the end of the initial #!  line of the script.

	      This  flag  is  normally only at the end of a calc shell script.
	      If the first line of an executable file begins #!   followed  by
	      the absolute pathname of the calc program and the flag -f as in:

		   #!/usr/bin/calc [other_flags ...] -f

	      the  rest  of  the  file will be processed in shell script mode.
	      See SHELL SCRIPT	MODE  section  of  this  man  page  below  for
	      details.

	      The actual form of this flag is:

		   -f filename

	      On  systems  that  treat an executable that begins with #!  as a
	      script, the path of the executable is appended by the kernel  as
	      the  final  argument to the exec() system call.  This is why the
	      -f flag at the very end of the #!  line.

	      It is possible use -f filename on the command line:

		   calc [other_flags ...] -f filename

	      This will cause calc to  process	lines  in  filename  in  shell
	      script mode.

	      Use  of -f implies -s.  In addition, -d and -p are implied if -i
	      is not given.


       -h     Print a help message.  This option implies -q.  This is  equiva-
	      lent  to	the calc command help help.  The help facility is dis-
	      abled unless the mode is 5 or 7.	See -m.


       -i     Become interactive if possible.  This flag will  cause  calc  to
	      drop  into  interactive mode after the calc_cmd arguments on the
	      command line are evaluated.  Without this flag, calc  will  exit
	      after they are evaluated.

	      For example:

		   calc 2+5

	      will print the value 7 and exit whereas:

		   calc -i 2+5

	      will  print  the	value 7 and prompt the user for more calc com-
	      mands.


       -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 privileged user, one might want
	      to use -m 0 in an effort to make calc somewhat 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  somewhat  more  secure,  but  still
	      wanted  to  read and write a specific file, one might want to do
	      in sh(1), ksh(1), bash(1)-like shells:

		   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 resource files are disabled as if  -q  was  given.   The
	      reading  of key bindings is also disabled when the mode disables
	      opening of files for reading.


       -O     Use the old classic defaults instead of the  default  configura-
	      tion.   This  flag as the same effect as executing config("all",
	      "oldcfg") at startup time.

	      NOTE: Older versions of calc used -n to setup a modified form of
	      the  default  calc  configuration.   The	-n flag currently does
	      nothing.	Use of the -n flag is now deprecated and may  be  used
	      for something else in the future.


       -p     Pipe processing is enabled by use of -p.	For example:

		   calc -p "2^21701-1" | fizzbin

	      In  pipe mode, calc does not prompt, does not print leading tabs
	      and does not print the initial header.  The  -p  flag  overrides
	      -i.


       -q     Disable the reading of the startup scripts.


       -s     By  default, all calc_cmd args are evaluated and executed.  This
	      flag will disable their evaluation and instead make them	avail-
	      able as strings for the argv() builtin function.


       -u     Disable buffering of stdin and stdout.


       -v     Print the calc version number and exit.


       --     The  double  dash indicates to calc that no more options follow.
	      Thus calc will ignore a later argument on the command line  even
	      if it starts with a dash.  This is useful when entering negative
	      values on the command line as in:

		   calc -p -- -1 - -7




       CALC COMMAND LINE

       With no calc_cmd arguments, calc operates  interactively.   If  one  or
       more  arguments are given on the command line and -s is NOT given, then
       calc will read and execute them and either attempt  to  go  interactive
       according as the -i flag was present or absent.

       If  -s  is  given,  calc  will  not evaluate any calc_cmd arguments but
       instead make them available as strings to the argv() builtin function.

       Sufficiently simple  commands  with  no	characters  like  parentheses,
       brackets,  semicolons,  '*', which have special interpretations in UNIX
       shells may be entered, possibly with spaces, until the terminating new-
       line.  For example:

	    calc 23 + 47

       will print 70.  However, command lines will have problems:

	    calc 23 * 47

	    calc -23 + 47

       The 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 by
       enclosing the command between quotes:

	    calc '23 * 47'

	    calc "print sqrt(2), exp(1)"

       or in parentheses and quotes to avoid leading -'s as in:

	    calc '(-23 + 47)'

       One  may  also use a double dash to denote that calc options have ended
       as in:

	    calc -- -23 + 47

	    calc -q -- -23 + 47

       If '!' is to be used to indicate the  factorial	function,  for	shells
       like 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 com-
       mand:

	    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
	    /usr/lib/myfile
	    /usr/lib/myfile.cal
	    /usr/share/calc/custom/myfile
	    /usr/share/calc/custom/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  stderr  as
       files  available for reading and writing.  One may present calc with an
       already open file using sh(1), ksh(1), bash(1)-like shells is to:

	    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



       SHELL SCRIPT MODE

       If the first line of an executable file	begins	#!   followed  by  the
       absolute pathname of the calc program and the flag -f as in:

	    #!/usr/bin/calc [other_flags ...] -f

       the rest of the file will be processed in shell script mode.  Note that
       -f must be at the end of the initial ``#!'' line.  Any  other  optional
       other_flags must come before the -f.

       In  shell script mode the contents of the file are read and executed as
       if they were in a file being processed by a read command, except that a
       "command"  beginning  with '#' followed by 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 is always assumed.  In addition, -d and -p are
       automatically set if -i is not given.

       For example, if the file /tmp/mersenne:

	    #!/usr/bin/calc -q -f
	    #
	    # mersenne - an example of a calc shell script file

	    /* parse args */
	    if (argv() != 1) {
		fprintf(files(2), "usage: %s exp\n", config("program"));
		abort "must give one exponent arg";
	    }

	    /* print the mersenne number */
	    print "2^": argv(0) : "-1 =", 2^eval(argv(0))-1;

       is made an executable file by:

	    chmod +x /tmp/mersenne

       then the command line:

	    /tmp/mersenne 127

       will print:

	    2^127-1 = 170141183460469231731687303715884105727

       Note that because -s is assumed in shell  script  mode  and  non-dashed
       args  are  made	available  as strings via the argv() builtin function.
       Therefore:

	    2^eval(argv(0))-1

       will print the decimal value of 2^n-1 but

	    2^argv(0)-1

       will not.


       DATA TYPES

       Fundamental builtin data types include integers, real numbers, rational
       numbers, complex numbers and strings.

       By  use of an object, one may define an arbitrarily complex data types.
       One may define how such objects behave a wide range of operations  such
       as addition, subtraction, multiplication, division, negation, squaring,
       modulus, rounding, exponentiation, equality, comparison,  printing  and
       so on.

       For more information use the following calc commands:

	  help types
	  help obj
	  show objfuncs


       VARIABLES

       Variables  in  calc are typeless.  In other words, the fundamental type
       of a variable is determined by  its  content.   Before  a  variable  is
       assigned a value it has the value of zero.

       The  scope  of a variable may be global, local to a file, or local to a
       procedure.  Values may be grouped together in a matrix, or into a  list
       that permits stack and queue style operations.

       For more information use the following calc commands:

	  help variable
	  help mat
	  help list
	  show globals


       INPUT/OUTPUT

       A  leading ``0x'' implies a hexadecimal value, a leading ``0b'' implies
       a binary value, and a ``0'' followed by a digit implies an octal value.
       Complex	numbers are indicated by a trailing ``i'' such as in ``3+4i''.
       Strings may be delimited by either a pair of single or  double  quotes.
       By  default, calc prints values as if they were floating point numbers.
       One may change the default to print values in a number of modes includ-
       ing fractions, integers and exponentials.

       A number of stdio-like file I/O operations are provided.  One may open,
       read, write, seek and close files.  Filenames  are  subject  to	``  ''
       expansion  to  home directories in a way similar to that of the Korn or
       C-Shell.

       For example:

	  ~/.calcrc
	  ~chongo/lib/fft_multiply.cal

       For more information use the following calc command:

	  help file


       CALC LANGUAGE

       The calc language is a C-like language.	The language includes commands
       such  as variable declarations, expressions, tests, labels, loops, file
       operations, function calls.  These commands are very similar  to  their
       counterparts in C.

       The  language  also  include  a	number	of commands particular to calc
       itself.	These include commands	such  as  function  definition,  help,
       reading	in  resource  files, dump files to a file, error notification,
       configuration control and status.

       For more information use the following calc command:

	  help command
	  help statement
	  help expression
	  help operator
	  help config

FILES

       /usr/bin/calc
	    calc binary

       /usr/share/doc/apcalc/examples/*
	    calc shell scripts

       /usr/lib/*.cal
	    calc standard resource files

       /usr/lib/help/*
	    help files

       /usr/lib/bindings
	    non-GNU-readline command line editor bindings

       /usr/include/calc/*.h
	    include files for C interface use

       /usr/lib/libcalc.a
	    calc binary link library

       /usr/lib/libcustcalc.a
	    custom binary link library

       /usr/share/calc/custom/*.cal
	    custom resource files

       /usr/share/calc/custhelp/*
	    custom help files

ENVIRONMENT

       CALCPATH
	    A :-separated list of directories used to search for calc resource
	    filenames that do not begin with /, ./ or ~.

	    Default	   value:	 .:./cal:~/.cal:/usr/local/share/calc:
	    /usr/share/calc:/usr/share/calc/custom

       CALCRC
	    On startup (unless -h or -q was given on the command  line),  calc
	    searches for files along this :-separated environment variable.

	    Default		  value:	      /usr/share/calc/startup:
	    /usr/local/share/calc/startup:~/.calcrc:./.calcinit

       CALCBINDINGS
	    On startup (unless -h or -q was given on the command line,	or  -m
	    disallows opening files for reading), calc reads key bindings from
	    the filename specified by  this  environment  variable.   The  key
	    binding  file is searched for along the $CALCPATH list of directo-
	    ries.

	    Default value: binding

	    This variable is not used if calc was compiled  with  GNU-readline
	    support.   In  that  case,	the  standard readline mechanisms (see
	    readline(3)) are used.

CREDIT

       The main chunk of calc was written by David I. Bell.

       The calc primary mirror, calc mailing list and calc bug report process-
       ing is performed by Landon Curt Noll.

       Landon  Curt  Noll  maintains  the  master  reference  source, performs
       release control functions as well as other calc maintenance functions.

       Thanks for suggestions and encouragement from Peter Miller,  Neil  Jus-
       tusson, and Landon Noll.

       Thanks  to  Stephen Rothwell for writing the original version of hist.c
       which is used to do the command line editing.

       Thanks to Ernest W. Bowen for supplying many improvements  in  accuracy
       and  generality	for some numeric functions.  Much of this was in terms
       of actual code which I gratefully accepted.  Ernest also  supplied  the
       original text for many of the help files.

       Portions  of  this  program  are  derived from an earlier set of public
       domain arbitrarily precision routines  which  was  posted  to  the  net
       around  1984.   By  now, there is almost no recognizable code left from
       that original source.

COPYING / CALC GNU LESSER GENERAL PUBLIC LICENSE


       Calc is open software, and is covered under  version  2.1  of  the  GNU
       Lesser  General	Public	License.   You are welcome to change it and/or
       distribute copies of it under certain conditions.  The calc commands:

	    help copyright
	    help copying
	    help copying-lgpl

       should display the contents of  the  COPYING  and  COPYING-LGPL	files.
       Those  files  contain  information  about the calc's GNU Lesser General
       Public License, and in particular the conditions under  which  you  are
       allowed to change it and/or distribute copies of it.

       You  should  have  received a copy of the version 2.1 of the GNU Lesser
       General Public License.	If you do not have these files, write to:

	    Free Software Foundation, Inc.
	    51 Franklin Street
	    Fifth Floor
	    Boston, MA	02110-1301
	    USA

       Calc is copyrighted in several different ways.  These ways include:

	    Copyright (C) year	David I. Bell
	    Copyright (C) year	David I. Bell and Landon Curt Noll
	    Copyright (C) year	David I. Bell and Ernest Bowen
	    Copyright (C) year	David I. Bell, Landon Curt Noll and Ernest Bowen
	    Copyright (C) year	Landon Curt Noll
	    Copyright (C) year	Ernest Bowen and Landon Curt Noll
	    Copyright (C) year	Ernest Bowen

       This man page is:

	    Copyright (C) 1999	Landon Curt Noll

       and is covered under version 2.1 GNU Lesser General Public License.

CALC MAILING LIST / CALC UPDATES / ENHANCEMENTS


       To contribute comments, suggestions, enhancements and interesting  calc
       resource  files, and shell scripts please join the calc-tester low vol-
       ume moderated calc mailing list.

       To the calc-tester mailing list, visit the following URL:

	    https://www.listbox.com/subscribe/?list_id=239342

       To help determine you are a human and not just a spam bot, you will  be
       required to provide the following additional information:

	    Your Name

	    Calc Version
	       For example, the current version is: 2.12.5.0

	    Operating System
	       If you don't know your operating system, enter: unknown

	    The date 7 days ago
	       Consult a calendar :-)

       If you need a human to help you with your mailing list subscription, or
       if you have problems with the above procedure, please send EMail to our
       special address:

	    calc-tester-maillist-help at asthe dot com

	    NOTE: Remove spaces and replace 'at' with @, 'dot' with .

	    NOTE: Yes, the EMail address uses 'asthe',
		  while the web site uses 'isthe'.

       To  be  sure  we  see your EMail asking for help with your mailing list
       subscription, please use the following phase in your EMail Subject line
       your subject must contain the words:

	    calc tester mailing list help

       You may have additional words in your subject line.

BUG REPORTS / BUG FIXES


       Send bug reports and bug fixes to:

	    calc-bug-report at asthe dot com

	    NOTE: Remove spaces and replace 'at' with @, 'dot' with .

	    NOTE: Yes, the EMail address uses 'asthe',
		  while the web site uses 'isthe'.

       Your subject must contain the words:

	    calc bug report

       You may have additional words in your subject line.
	    However,  you  may find it more helpful to simply subscribe to the
	    calc-tester mailing list (see above) and then to send your	report
	    to	that  mailing  list as a wider set calc testers may be able to
	    help you.

	    See the BUGS source file or use the calc command:

		 help bugs

	    for more information about bug reporting.

CALC WEB SITE

       Landon Noll maintains the calc web site is located at:

	    www.isthe.com/chongo/tech/comp/calc/

       Share and Enjoy! :-)



2007-02-06			     ^..^			       calc(1)