mirror of
https://github.com/lcn2/calc.git
synced 2025-08-16 01:03:29 +03:00
Release calc version 2.12.0.2
This commit is contained in:
38
CHANGES
38
CHANGES
@@ -145,6 +145,40 @@ The following are the changes from calc version 2.12.0 to date:
|
||||
|
||||
Added missing help file for the stoponerror() builtin.
|
||||
|
||||
Corrected and improved the help documentation for factor and lfactor.
|
||||
|
||||
Fixed a problem where some error messages that should have been
|
||||
written to a file or string, went to stderr instead. This bug was
|
||||
fixed by Ernest Bowen <ebowen at une dot edu dot au>.
|
||||
|
||||
Corrected the documentation relating to the calc -c command line option.
|
||||
The -c relates to scan/parse errors only, not execution errors.
|
||||
|
||||
Corrected a stack overflow problem where the math_fmt() in zio.c
|
||||
could be induced to overflow the stack. This problem was independently
|
||||
reported by Chew Keong Tan of Secunia Research <vuln at secunia dot com>.
|
||||
|
||||
Corrected a stack overflow problem where the scanerror() in token.c
|
||||
could be induced to overflow the stack by a malformed token.
|
||||
|
||||
Made math_error() in math_error.c more robust against a error
|
||||
message constant that is too long.
|
||||
|
||||
Made read_bindings() in hist.c more robust against very line bindings
|
||||
config lines.
|
||||
|
||||
Made listsort() in listfunc.c and matsort() matfunc.c more robust
|
||||
against sorting of impossibly huge lists and matrices.
|
||||
|
||||
Warnings about an undefining a builtin or undefined function, a
|
||||
constant before the comma operator, and an unterminated comment is
|
||||
now processed by scanerrors (not simply written directly to stderr).
|
||||
These warnings file and line number in which the "error" occurred
|
||||
as well as a more precise message than before. If using -c on the
|
||||
calc command line or if stoponerror(-1), then assuming there are
|
||||
no other compile errors, only the unterminated comment will stop
|
||||
completion of the function being defined.
|
||||
|
||||
|
||||
The following are the changes from calc version 2.11.10.1 to 2.11.11:
|
||||
|
||||
@@ -5962,8 +5996,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.
|
||||
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||
##
|
||||
## @(#) $Revision: 29.76 $
|
||||
## @(#) $Id: CHANGES,v 29.76 2006/05/21 07:55:17 chongo Exp $
|
||||
## @(#) $Revision: 29.78 $
|
||||
## @(#) $Id: CHANGES,v 29.78 2006/06/03 22:52:39 chongo Exp $
|
||||
## @(#) $Source: /usr/local/src/cmd/calc/RCS/CHANGES,v $
|
||||
##
|
||||
## Under source code control: 1993/06/02 18:12:57
|
||||
|
18
addop.c
18
addop.c
@@ -19,8 +19,8 @@
|
||||
* 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.9 $
|
||||
* @(#) $Id: addop.c,v 29.9 2006/05/22 19:04:45 chongo Exp $
|
||||
* @(#) $Revision: 29.12 $
|
||||
* @(#) $Id: addop.c,v 29.12 2006/06/03 22:47:28 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/addop.c,v $
|
||||
*
|
||||
* Under source code control: 1990/02/15 01:48:10
|
||||
@@ -195,8 +195,8 @@ endfunc(void)
|
||||
checklabels();
|
||||
|
||||
if (errorcount) {
|
||||
printf("\"%s\": %ld error%s\n", newname, errorcount,
|
||||
((errorcount == 1) ? "" : "s"));
|
||||
scanerror(T_NULL,"Compilation of \"%s\" failed: %ld error(s)",
|
||||
newname, errorcount);
|
||||
return;
|
||||
}
|
||||
size = funcsize(curfunc->f_opcodecount);
|
||||
@@ -280,8 +280,9 @@ rmuserfunc(char *name)
|
||||
|
||||
index = findstr(&funcnames, name);
|
||||
if (index < 0) {
|
||||
fprintf(stderr, "%s() has never been defined\n",
|
||||
name);
|
||||
errorcount--;
|
||||
scanerror(T_NULL,
|
||||
"Attempt to undefine an undefined function\n\t\"%s\"", name);
|
||||
return;
|
||||
}
|
||||
if (functions[index] == NULL)
|
||||
@@ -526,9 +527,8 @@ addop(long op)
|
||||
fp->f_opcodecount -= diff;
|
||||
oldop = OP_NOP;
|
||||
oldoldop = OP_NOP;
|
||||
fprintf(stderr,
|
||||
"Line %ld: unused value ignored\n",
|
||||
linenumber());
|
||||
errorcount--;
|
||||
scanerror(T_NULL, "Constant before comma operator");
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
@@ -17,8 +17,8 @@
|
||||
* 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.25 $
|
||||
* @(#) $Id: regress.cal,v 29.25 2006/05/21 00:58:31 chongo Exp $
|
||||
* @(#) $Revision: 29.26 $
|
||||
* @(#) $Id: regress.cal,v 29.26 2006/06/02 09:49:13 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/regress.cal,v $
|
||||
*
|
||||
* Under source code control: 1990/02/15 01:50:36
|
||||
@@ -3409,6 +3409,7 @@ define test_fileops()
|
||||
local C = "Curt";
|
||||
local N = "Noll";
|
||||
local LCN = "Landon\nCurt\nNoll\n";
|
||||
local long = "0123456789abcdef0123456789abcdef";
|
||||
|
||||
print '4200: Beginning test_fileops';
|
||||
|
||||
@@ -3511,16 +3512,32 @@ define test_fileops()
|
||||
*/
|
||||
vrfy(!iserror(p=fpathopen("junk4200","r",".")),
|
||||
'4260: !iserror(p=fparhopen("junk4200","r","."))');
|
||||
vrfy(!iserror(fclose(p)), '4261: !iserror(fclose(p))');
|
||||
vrfy(!iserror(r=fpathopen("regress.cal","r")),
|
||||
'4261: !iserror(r=fparhopen("regress.cal","r","."))');
|
||||
'4262: !iserror(r=fparhopen("regress.cal","r","."))');
|
||||
vrfy(!iserror(fclose(r)), '4263: !iserror(fclose(r))');
|
||||
|
||||
/*
|
||||
* verify non-stack overflow on long filenames
|
||||
*/
|
||||
long = long + long + long + long;
|
||||
print '4264: long = long + long + long + long;';
|
||||
long = long + long + long + long;
|
||||
print '4265: long = long + long + long + long;';
|
||||
vrfy(strlen(long) == 512, '4266: strlen(long) == 512');
|
||||
/* bump ecnt up by 1 */
|
||||
++ecnt;
|
||||
print '4267: ++ecnt;';
|
||||
vrfy(isfile(p=fopen(long,"r")) == 0,
|
||||
'4268: isfile(p=fopen(long,"r")) == 0');
|
||||
|
||||
/*
|
||||
* cleanup
|
||||
*/
|
||||
x = rm("junk4200");
|
||||
print '4262: x = rm("junk4200")';
|
||||
print '4269: x = rm("junk4200")';
|
||||
|
||||
print '4263: Ending test_fileops';
|
||||
print '4270: Ending test_fileops';
|
||||
}
|
||||
print '071: parsed test_fileops()';
|
||||
|
||||
|
13
calc.man
13
calc.man
@@ -15,8 +15,8 @@
|
||||
.\" 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.18 $
|
||||
.\" @(#) $Id: calc.man,v 29.18 2005/10/18 11:10:18 chongo Exp $
|
||||
.\" @(#) $Revision: 29.20 $
|
||||
.\" @(#) $Id: calc.man,v 29.20 2006/06/01 12:04:16 chongo Exp $
|
||||
.\" @(#) $Source: /usr/local/src/cmd/calc/RCS/calc.man,v $
|
||||
.\"
|
||||
.\" Under source code control: 1991/07/23 05:48:26
|
||||
@@ -63,8 +63,11 @@ CALC OPTIONS
|
||||
|
||||
.TP
|
||||
.B \-c
|
||||
Continue reading command lines even after an execution
|
||||
Continue reading command lines even after an 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.
|
||||
.sp 1
|
||||
For example:
|
||||
.sp 1
|
||||
@@ -76,7 +79,7 @@ calc read many_errors.cal
|
||||
.sp 1
|
||||
will cause
|
||||
.B calc
|
||||
to abort on the first error, whereas:
|
||||
to abort on the first syntax error, whereas:
|
||||
.sp 1
|
||||
.in +5n
|
||||
.nf
|
||||
@@ -88,7 +91,7 @@ will
|
||||
cause
|
||||
.B calc
|
||||
to try to process each line being read
|
||||
despite the errors that it encounters.
|
||||
despite the scan/parse errors that it encounters.
|
||||
.sp 1
|
||||
By default, calc startup resource files are silently
|
||||
ignored if not found.
|
||||
|
26
codegen.c
26
codegen.c
@@ -19,8 +19,8 @@
|
||||
* 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.15 $
|
||||
* @(#) $Id: codegen.c,v 29.15 2006/05/20 09:42:57 chongo Exp $
|
||||
* @(#) $Revision: 29.18 $
|
||||
* @(#) $Id: codegen.c,v 29.18 2006/06/03 22:47:28 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/codegen.c,v $
|
||||
*
|
||||
* Under source code control: 1990/02/15 01:48:13
|
||||
@@ -306,8 +306,9 @@ ungetfunction(void)
|
||||
name = tokensymbol();
|
||||
type = getbuiltinfunc(name);
|
||||
if (type >= 0) {
|
||||
fprintf(stderr,
|
||||
"Attempt to undefine builtin function \"%s\" ignored\n", name);
|
||||
errorcount--;
|
||||
scanerror(T_NULL,
|
||||
"Attempt to undefine the builtin function \"%s\"", name);
|
||||
continue;
|
||||
}
|
||||
rmuserfunc(name);
|
||||
@@ -365,7 +366,8 @@ getfunction(void)
|
||||
if (type == T_RIGHTPAREN)
|
||||
break;
|
||||
if (type != T_SYMBOL) {
|
||||
scanerror(T_COMMA, "Bad function definition");
|
||||
scanerror(T_COMMA,
|
||||
"Using non-identifier as function parameter");
|
||||
return;
|
||||
}
|
||||
name = tokensymbol();
|
||||
@@ -394,7 +396,8 @@ getfunction(void)
|
||||
if (type == T_RIGHTPAREN)
|
||||
break;
|
||||
if (type != T_COMMA) {
|
||||
scanerror(T_COMMA, "Bad function definition");
|
||||
scanerror(T_COMMA,
|
||||
"Using other than comma to separate parameters");
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -408,8 +411,7 @@ getfunction(void)
|
||||
break;
|
||||
default:
|
||||
scanerror(T_NULL,
|
||||
"Left brace or equals sign "
|
||||
"expected for function");
|
||||
"Left brace or equals sign expected for function");
|
||||
return;
|
||||
}
|
||||
endfunc();
|
||||
@@ -938,6 +940,7 @@ getstatement(LABEL *contlabel, LABEL *breaklabel, LABEL *nextcaselabel, LABEL *d
|
||||
case T_RIGHTBRACKET:
|
||||
case T_RIGHTBRACE:
|
||||
case T_NEWLINE:
|
||||
case T_ELSE:
|
||||
case T_EOF:
|
||||
rescantoken();
|
||||
/*FALLTHRU*/
|
||||
@@ -1020,6 +1023,7 @@ getstatement(LABEL *contlabel, LABEL *breaklabel, LABEL *nextcaselabel, LABEL *d
|
||||
case T_RIGHTBRACE:
|
||||
case T_NEWLINE:
|
||||
case T_EOF:
|
||||
case T_ELSE:
|
||||
rescantoken();
|
||||
return;
|
||||
case T_SEMICOLON:
|
||||
@@ -1393,7 +1397,7 @@ getinitlist(void)
|
||||
oldmode = tokenmode(TM_DEFAULT);
|
||||
|
||||
if (gettoken() != T_LEFTBRACE) {
|
||||
scanerror(T_SEMICOLON, "Missing brace for initialization list");
|
||||
scanerror(T_SEMICOLON, "Missing left brace for initialization list");
|
||||
(void) tokenmode(oldmode);
|
||||
return -1;
|
||||
}
|
||||
@@ -1428,7 +1432,7 @@ getinitlist(void)
|
||||
|
||||
default:
|
||||
scanerror(T_SEMICOLON,
|
||||
"Bad initialization list");
|
||||
"Missing right brace for initialization list");
|
||||
(void) tokenmode(oldmode);
|
||||
return -1;
|
||||
}
|
||||
@@ -2305,7 +2309,7 @@ getfilename(char *name, size_t namelen, BOOL *once)
|
||||
|
||||
/*
|
||||
* special hack - symbols starting with $ are
|
||||
* treated as a gloabl variable
|
||||
* treated as a global variable
|
||||
* instead of a literal string.
|
||||
*/
|
||||
if (symstr[0] == '$') {
|
||||
|
@@ -34,8 +34,9 @@ DESCRIPTION
|
||||
EXAMPLE
|
||||
Assuming there is no file with name "not_a_file"
|
||||
; errno(0)
|
||||
; errmax(errcount()+4)
|
||||
0
|
||||
; errmax(errcount()+4)
|
||||
20
|
||||
; badfile = fopen("not_a_file", "r")
|
||||
; print errno(), error(), strerror()
|
||||
2 System error 2 No such file or directory
|
||||
@@ -70,8 +71,8 @@ SEE ALSO
|
||||
## 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.4 $
|
||||
## @(#) $Id: errno,v 29.4 2006/05/21 07:31:46 chongo Exp $
|
||||
## @(#) $Revision: 29.5 $
|
||||
## @(#) $Id: errno,v 29.5 2006/05/23 19:15:48 chongo Exp $
|
||||
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/errno,v $
|
||||
##
|
||||
## Under source code control: 1994/10/27 03:05:08
|
||||
|
14
help/error
14
help/error
@@ -19,17 +19,13 @@ DESCRIPTION
|
||||
is returned by some function, errno() will return the value n.
|
||||
|
||||
EXAMPLE
|
||||
Note that by default, errmax() is 0 so unless errmax() is
|
||||
increased you will get:
|
||||
|
||||
; ba = error(10009)
|
||||
Error 10009 caused errcount to exceed errmax
|
||||
|
||||
; errmax(errcount()+1)
|
||||
0
|
||||
20
|
||||
; a = error(10009)
|
||||
; a
|
||||
Error 10009
|
||||
; strerror(a)
|
||||
"Bad argument for inverse"
|
||||
|
||||
LIMITS
|
||||
none
|
||||
@@ -57,8 +53,8 @@ SEE ALSO
|
||||
## 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.4 $
|
||||
## @(#) $Id: error,v 29.4 2006/05/21 07:31:46 chongo Exp $
|
||||
## @(#) $Revision: 29.5 $
|
||||
## @(#) $Id: error,v 29.5 2006/05/23 19:15:48 chongo Exp $
|
||||
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/error,v $
|
||||
##
|
||||
## Under source code control: 1995/12/18 03:30:59
|
||||
|
37
help/factor
37
help/factor
@@ -9,30 +9,39 @@ TYPES
|
||||
limit integer with abs(limit) < 2^32, defaults to 2^32 - 1
|
||||
err integer
|
||||
|
||||
return positive integer, -1 or err
|
||||
return positive integer or err
|
||||
|
||||
DESCRIPTION
|
||||
This function ignores the signs of n and limit, so here we shall
|
||||
assume n and limit are both nonnegative.
|
||||
|
||||
If n >= 0 and n has a prime factor less than or equal to limit,
|
||||
factor(n, limit) returns the smallest such factor. If n >= 0
|
||||
and the smallest prime factor of n exceeds limit, 1 is returned.
|
||||
In particular, if n >= 0 and limit <= 1, factor(n, limit)
|
||||
always returns 1; factor(n,2) returns 2 if and only if n is even.
|
||||
If n has a prime proper factor less than or equal to limit, then
|
||||
factor(n, limit) returns the smallest such factor.
|
||||
|
||||
If n < 0, -1 is returned.
|
||||
NOTE: A proper factor of n>1 is a factor < n. In other words,
|
||||
for n>1 is not a proper factor of itself. The value 1
|
||||
is a special case because 1 is a proper factor of 1.
|
||||
|
||||
If abs(limit) >= 2^32, factor(n, limit) causes an error,
|
||||
factor(n, limit, err) returns the value of err.
|
||||
When every prime proper factor of n is greater than limit, 1 is
|
||||
returned. In particular, if limit < 2, factor(n, limit) always
|
||||
returns 1. Also, factor(n,2) returns 2 if and only if n is even
|
||||
and n > 2.
|
||||
|
||||
If 1 < n < nextprime(limit)^2, then f(n, limit) == 1 <==> n is prime.
|
||||
For example, if 1 < n < 121, n is prime if and only if f(n,7) == 1.
|
||||
|
||||
If limit >= 2^32, factor(n, limit) causes an error and factor(n,
|
||||
limit, err) returns the value of err.
|
||||
|
||||
EXAMPLE
|
||||
; print factor(35,4), factor(35,5), factor(35), factor(-35)
|
||||
1 5 5 -1
|
||||
1 5 5 5
|
||||
|
||||
; print factor(2^32 + 1), factor(2^47 - 1), factor(2^59 - 1)
|
||||
641 2351 179951
|
||||
|
||||
LIMITS
|
||||
none
|
||||
limit < 2^32
|
||||
|
||||
LINK LIBRARY
|
||||
FLAG zfactor(ZVALUE n, ZVALUE limit, ZVALUE *res)
|
||||
@@ -40,7 +49,7 @@ LINK LIBRARY
|
||||
SEE ALSO
|
||||
lfactor
|
||||
|
||||
## Copyright (C) 1999 Landon Curt Noll
|
||||
## Copyright (C) 1999-2006 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
|
||||
@@ -56,8 +65,8 @@ SEE ALSO
|
||||
## 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: factor,v 29.3 2006/05/07 07:25:46 chongo Exp $
|
||||
## @(#) $Revision: 29.4 $
|
||||
## @(#) $Id: factor,v 29.4 2006/06/01 11:36:02 chongo Exp $
|
||||
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/factor,v $
|
||||
##
|
||||
## Under source code control: 1995/12/18 12:34:57
|
||||
|
@@ -35,7 +35,7 @@ EXAMPLE
|
||||
file is open
|
||||
|
||||
; err = fclose(fd);
|
||||
; if (isnull(err)) print "close successful"; else errno(err);
|
||||
; if (isnull(err)) print "close successful"; else strerror(err);
|
||||
close successful
|
||||
|
||||
; if (!fd) print "file is closed";
|
||||
@@ -51,7 +51,7 @@ SEE ALSO
|
||||
errno, fclose, feof, ferror, fflush, fgetc, fgetline, fgets, files, fopen,
|
||||
fprintf, fputc, fputs, fseek, fsize, ftell, isfile, printf, prompt
|
||||
|
||||
## Copyright (C) 1999 Landon Curt Noll
|
||||
## Copyright (C) 1999-2006 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
|
||||
@@ -67,8 +67,8 @@ SEE ALSO
|
||||
## 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: fclose,v 29.3 2006/05/07 07:25:46 chongo Exp $
|
||||
## @(#) $Revision: 29.4 $
|
||||
## @(#) $Id: fclose,v 29.4 2006/05/23 19:15:48 chongo Exp $
|
||||
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/fclose,v $
|
||||
##
|
||||
## Under source code control: 1994/10/27 03:04:16
|
||||
|
10
help/file
10
help/file
@@ -59,12 +59,12 @@ Using files
|
||||
function returns the numeric value of errno if there had been an
|
||||
error using the file, or the null value if there was no error.
|
||||
|
||||
The builtin 'errno' can be use to convert an errno number into
|
||||
The builtin 'strerror' can be use to convert an errno number into
|
||||
a slightly more meaningful error message:
|
||||
|
||||
badfile = fopen("not_a_file", "r");
|
||||
if (!isfile(badfile)) {
|
||||
print "error #" : badfile : ":", errno(badfile);
|
||||
print "error #" : badfile : ":", strerror(badfile);
|
||||
}
|
||||
|
||||
File values can be printed. When this is done, the filename of the
|
||||
@@ -166,7 +166,7 @@ Using files
|
||||
but the output is returned as a string value instead of being
|
||||
printed.
|
||||
|
||||
## Copyright (C) 1999 Landon Curt Noll
|
||||
## Copyright (C) 1999-2006 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
|
||||
@@ -182,8 +182,8 @@ Using files
|
||||
## 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.2 $
|
||||
## @(#) $Id: file,v 29.2 2000/06/07 14:02:33 chongo Exp $
|
||||
## @(#) $Revision: 29.3 $
|
||||
## @(#) $Id: file,v 29.3 2006/05/23 19:15:48 chongo Exp $
|
||||
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/file,v $
|
||||
##
|
||||
## Under source code control: 1991/07/21 04:37:19
|
||||
|
18
help/fopen
18
help/fopen
@@ -75,7 +75,7 @@ DESCRIPTION
|
||||
The truth value of an opened file is TRUE.
|
||||
|
||||
If the open is unsuccessful, the numeric value of errno is returned.
|
||||
You can the errno() builtin to determine what the errno number means.
|
||||
You can the strerror() builtin to determine what the errno number means.
|
||||
|
||||
EXAMPLE
|
||||
; fd = fopen("/etc/motd", "r")
|
||||
@@ -90,9 +90,11 @@ EXAMPLE
|
||||
; outfile
|
||||
FILE 4 "~/tmp/output" (writing, pos 0)
|
||||
|
||||
; badfile = fopen("not_a_file", "r")
|
||||
; if (!isfile(badfile)) print "error #" : badfile : ":", errno(badfile);
|
||||
error #2: No such file or directory
|
||||
; badfile = fopen("not_a_file", "r");
|
||||
; if (!isfile(badfile)) {
|
||||
;; printf("error(%d): %s\n", errno(badfile), strerror(badfile));
|
||||
;; }
|
||||
error(2): No such file or directory
|
||||
|
||||
LIMITS
|
||||
none
|
||||
@@ -103,9 +105,9 @@ LINK LIBRARY
|
||||
SEE ALSO
|
||||
errno, fclose, feof, ferror, fflush, fgetc, fgetline, fgets, files, fopen,
|
||||
fprintf, fputc, fputs, fseek, fsize, ftell, isfile, printf, prompt,
|
||||
fpathopen
|
||||
fpathopen, strerror
|
||||
|
||||
## Copyright (C) 1999 Landon Curt Noll
|
||||
## Copyright (C) 1999-2006 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
|
||||
@@ -121,8 +123,8 @@ SEE ALSO
|
||||
## 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.4 $
|
||||
## @(#) $Id: fopen,v 29.4 2006/05/07 07:18:26 chongo Exp $
|
||||
## @(#) $Revision: 29.6 $
|
||||
## @(#) $Id: fopen,v 29.6 2006/05/23 20:06:16 chongo Exp $
|
||||
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/fopen,v $
|
||||
##
|
||||
## Under source code control: 1994/10/27 03:04:17
|
||||
|
@@ -165,7 +165,7 @@ EXAMPLE
|
||||
FILE 7 "/home/chongo/tmp/output" (writing, pos 0)
|
||||
|
||||
; badfile = fpathopen("no_such_file", "r")
|
||||
; if (!isfile(badfile)) print "error #" : badfile : ":", errno(badfile);
|
||||
; if (!isfile(badfile)) print "error #" errno(badfile) : ":" : strerror(badfile);
|
||||
error #2: No such file or directory
|
||||
|
||||
LIMITS
|
||||
@@ -195,8 +195,8 @@ SEE ALSO
|
||||
## 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.2 $
|
||||
## @(#) $Id: fpathopen,v 29.2 2006/05/07 07:24:34 chongo Exp $
|
||||
## @(#) $Revision: 29.3 $
|
||||
## @(#) $Id: fpathopen,v 29.3 2006/05/23 19:15:48 chongo Exp $
|
||||
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/fpathopen,v $
|
||||
##
|
||||
## Under source code control: 2006/05/07 23:56:04
|
||||
|
25
help/lfactor
25
help/lfactor
@@ -11,20 +11,29 @@ TYPES
|
||||
return positive integer
|
||||
|
||||
DESCRIPTION
|
||||
If n >= 0 and n has a prime factor in the first m primes,
|
||||
lfactor(n, m) returns the smallest such factor.
|
||||
This function ignores the signs of n and m, so here we shall
|
||||
assume n and limit are both nonnegative.
|
||||
|
||||
If n < 0, -1 is returned.
|
||||
If n is nonzero and abs(n) has a prime proper factor in the first
|
||||
m primes (2, 3, 5, ...), then lfactor(n, m) returns the smallest
|
||||
such factor. Otherwise 1 is returned.
|
||||
|
||||
If n is nonzero and m = pix(limit), then lfactor(n, m) returns the
|
||||
same as factor(n, limit).
|
||||
|
||||
Both lfactor(n, 0) and lfactor(1, m) return 1 for all n and m.
|
||||
Also lfactor(0, m) always returns 1, and factor(0, limit) always
|
||||
returns 2 if limit >= 2.
|
||||
|
||||
EXAMPLE
|
||||
; print lfactor(35,2), lfactor(35,3), lfactor(-35, 3)
|
||||
1 5 -1
|
||||
1 5 5
|
||||
|
||||
; print lfactor(2^32+1,115), lfactor(2^32+1,116), lfactor(2^59-1,1e5)
|
||||
1 641 179951
|
||||
|
||||
LIMITS
|
||||
none
|
||||
m <= 203280221 (= number of primes < 2^32)
|
||||
|
||||
LINK LIBRARY
|
||||
NUMBER *qlowfactor(NUMBER *n, NUMBER *count)
|
||||
@@ -33,7 +42,7 @@ LINK LIBRARY
|
||||
SEE ALSO
|
||||
factor
|
||||
|
||||
## Copyright (C) 1999 Landon Curt Noll
|
||||
## Copyright (C) 1999-2006 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
|
||||
@@ -49,8 +58,8 @@ SEE ALSO
|
||||
## 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: lfactor,v 29.3 2006/05/07 07:25:46 chongo Exp $
|
||||
## @(#) $Revision: 29.4 $
|
||||
## @(#) $Id: lfactor,v 29.4 2006/06/01 11:36:02 chongo Exp $
|
||||
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/lfactor,v $
|
||||
##
|
||||
## Under source code control: 1995/12/18 12:34:57
|
||||
|
14
help/usage
14
help/usage
@@ -8,19 +8,21 @@ Calc command line
|
||||
|
||||
#!/usr/local/bin/calc -S [other_flags]
|
||||
|
||||
-c Continue reading command lines even after an execution
|
||||
error has caused the abandonment of a line.
|
||||
-c Continue reading command lines even after an 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 error, whereas:
|
||||
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 errors that it encounters.
|
||||
despite the scan/parse errors that it encounters.
|
||||
|
||||
By default, calc startup resource files are
|
||||
silently ignored if not found. This flag will report
|
||||
@@ -357,8 +359,8 @@ For more information use the following calc commands:
|
||||
## 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: usage,v 29.6 2003/06/10 21:39:34 chongo Exp $
|
||||
## @(#) $Revision: 29.8 $
|
||||
## @(#) $Id: usage,v 29.8 2006/06/01 12:04:16 chongo Exp $
|
||||
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/usage,v $
|
||||
##
|
||||
## Under source code control: 1991/07/21 04:37:25
|
||||
|
9
hist.c
9
hist.c
@@ -17,8 +17,8 @@
|
||||
* 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.11 $
|
||||
* @(#) $Id: hist.c,v 29.11 2006/05/22 19:04:45 chongo Exp $
|
||||
* @(#) $Revision: 29.12 $
|
||||
* @(#) $Id: hist.c,v 29.12 2006/06/02 09:57:12 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/hist.c,v $
|
||||
*
|
||||
* Under source code control: 1993/05/02 20:09:19
|
||||
@@ -589,7 +589,7 @@ read_bindings(FILE *fp)
|
||||
{
|
||||
char *cp;
|
||||
KEY_MAP *input_map;
|
||||
char line[100];
|
||||
char line[BUFSIZ+1];
|
||||
|
||||
base_map = find_map(base_map_name);
|
||||
cur_map = base_map;
|
||||
@@ -599,6 +599,7 @@ read_bindings(FILE *fp)
|
||||
return 1;
|
||||
|
||||
while (fgets(line, sizeof(line) - 1, fp)) {
|
||||
line[BUFSIZ] = '\0';
|
||||
cp = line;
|
||||
while (isspace((int)*cp))
|
||||
cp++;
|
||||
@@ -1546,7 +1547,7 @@ main(int argc, char **argv)
|
||||
{
|
||||
char *filename;
|
||||
int len;
|
||||
char buf[256];
|
||||
char buf[BUFSIZ+1];
|
||||
|
||||
filename = NULL;
|
||||
if (argc > 1)
|
||||
|
16
listfunc.c
16
listfunc.c
@@ -17,8 +17,8 @@
|
||||
* 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.2 $
|
||||
* @(#) $Id: listfunc.c,v 29.2 2000/06/07 14:02:13 chongo Exp $
|
||||
* @(#) $Revision: 29.3 $
|
||||
* @(#) $Id: listfunc.c,v 29.3 2006/06/02 10:24:09 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/listfunc.c,v $
|
||||
*
|
||||
* Under source code control: 1990/02/15 01:48:18
|
||||
@@ -680,14 +680,13 @@ listreverse(LIST *lp)
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
listsort(LIST *lp)
|
||||
{
|
||||
LISTELEM *start;
|
||||
LISTELEM *last, *a, *a1, *b, *next;
|
||||
LISTELEM *S[32];
|
||||
long len[32];
|
||||
LISTELEM *S[LONG_BITS+1];
|
||||
long len[LONG_BITS+1];
|
||||
long i, j, k;
|
||||
|
||||
if (lp->l_count < 2)
|
||||
@@ -697,7 +696,7 @@ listsort(LIST *lp)
|
||||
next = lp->l_first;
|
||||
last = start;
|
||||
start->e_next = next;
|
||||
for (k = 0; next; k++) {
|
||||
for (k = 0; next && k < LONG_BITS; k++) {
|
||||
next->e_prev = last;
|
||||
last = next;
|
||||
S[k] = next;
|
||||
@@ -769,6 +768,11 @@ listsort(LIST *lp)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (k >= LONG_BITS) {
|
||||
/* this should never happen */
|
||||
math_error("impossible k overflow in listsort!");
|
||||
/*NOTREACHED*/
|
||||
}
|
||||
lp->l_first = start->e_next;
|
||||
lp->l_first->e_prev = NULL;
|
||||
lp->l_last = last;
|
||||
|
@@ -17,8 +17,8 @@
|
||||
* 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: longbits.c,v 29.6 2006/05/22 19:04:45 chongo Exp $
|
||||
* @(#) $Revision: 29.7 $
|
||||
* @(#) $Id: longbits.c,v 29.7 2006/06/01 11:37:20 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/longbits.c,v $
|
||||
*
|
||||
* Under source code control: 1994/03/18 03:06:18
|
||||
@@ -146,7 +146,7 @@ main(int argc, char **argv)
|
||||
*/
|
||||
printf("#undef LONG_BITS\n");
|
||||
printf("#define LONG_BITS %ld\t\t/%s/\n",
|
||||
long_bits, "* bit length of a long *");
|
||||
(long int)long_bits, "* bit length of a long *");
|
||||
putchar('\n');
|
||||
|
||||
/*
|
||||
|
15
matfunc.c
15
matfunc.c
@@ -17,8 +17,8 @@
|
||||
* 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: matfunc.c,v 29.6 2006/05/20 08:43:55 chongo Exp $
|
||||
* @(#) $Revision: 29.7 $
|
||||
* @(#) $Id: matfunc.c,v 29.7 2006/06/02 10:24:09 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/matfunc.c,v $
|
||||
*
|
||||
* Under source code control: 1990/02/15 01:48:18
|
||||
@@ -1606,8 +1606,8 @@ matsort(MATRIX *m)
|
||||
{
|
||||
VALUE *a, *b, *next, *end;
|
||||
VALUE *buf, *p;
|
||||
VALUE *S[32];
|
||||
long len[32];
|
||||
VALUE *S[LONG_BITS];
|
||||
long len[LONG_BITS];
|
||||
long i, j, k;
|
||||
|
||||
buf = (VALUE *) malloc(m->m_size * sizeof(VALUE));
|
||||
@@ -1617,7 +1617,7 @@ matsort(MATRIX *m)
|
||||
}
|
||||
next = m->m_table;
|
||||
end = next + m->m_size;
|
||||
for (k = 0; next; k++) {
|
||||
for (k = 0; next && k < LONG_BITS; k++) {
|
||||
S[k] = next++; /* S[k] is start of a run */
|
||||
len[k] = 1;
|
||||
if (next == end)
|
||||
@@ -1665,6 +1665,11 @@ matsort(MATRIX *m)
|
||||
}
|
||||
}
|
||||
free(buf);
|
||||
if (k >= LONG_BITS) {
|
||||
/* this should never happen */
|
||||
math_error("impossible k overflow in matsort!");
|
||||
/*NOTREACHED*/
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
@@ -17,8 +17,8 @@
|
||||
* 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.2 $
|
||||
* @(#) $Id: math_error.c,v 29.2 2000/06/07 14:02:13 chongo Exp $
|
||||
* @(#) $Revision: 29.3 $
|
||||
* @(#) $Id: math_error.c,v 29.3 2006/06/02 09:52:22 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/math_error.c,v $
|
||||
*
|
||||
* Under source code control: 1994/08/03 05:08:22
|
||||
@@ -95,8 +95,9 @@ math_error(char *fmt, ...)
|
||||
#else
|
||||
va_start(ap, fmt);
|
||||
#endif
|
||||
vsprintf(calc_error, fmt, ap);
|
||||
vsnprintf(calc_error, MAXERROR, fmt, ap);
|
||||
va_end(ap);
|
||||
calc_error[MAXERROR] = '\0';
|
||||
|
||||
/*
|
||||
* if we should longjmp, so do
|
||||
|
9
token.c
9
token.c
@@ -19,8 +19,8 @@
|
||||
* 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: token.c,v 29.6 2006/05/20 08:43:55 chongo Exp $
|
||||
* @(#) $Revision: 29.8 $
|
||||
* @(#) $Id: token.c,v 29.8 2006/06/03 22:47:28 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/token.c,v $
|
||||
*
|
||||
* Under source code control: 1990/02/15 01:48:25
|
||||
@@ -390,7 +390,7 @@ eatcomment(void)
|
||||
reread();
|
||||
}
|
||||
if (ch == EOF || ch == '\0') {
|
||||
fprintf(stderr, "Unterminated comment ignored\n");
|
||||
scanerror(T_NULL, "Unterminated comment");
|
||||
reread();
|
||||
break;
|
||||
}
|
||||
@@ -717,8 +717,9 @@ scanerror(int skip, char *fmt, ...)
|
||||
if (name)
|
||||
fprintf(stderr, "\"%s\", line %ld: ", name, linenumber());
|
||||
va_start(ap, fmt);
|
||||
vsprintf(buf, fmt, ap);
|
||||
vsnprintf(buf, MAXERROR, fmt, ap);
|
||||
va_end(ap);
|
||||
buf[MAXERROR] = '\0';
|
||||
fprintf(stderr, "%s\n", buf);
|
||||
|
||||
/* bail out if continuation not permitted */
|
||||
|
28
value.c
28
value.c
@@ -17,8 +17,8 @@
|
||||
* 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.8 $
|
||||
* @(#) $Id: value.c,v 29.8 2006/05/20 08:43:55 chongo Exp $
|
||||
* @(#) $Revision: 29.9 $
|
||||
* @(#) $Id: value.c,v 29.9 2006/06/01 11:47:07 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/value.c,v $
|
||||
*
|
||||
* Under source code control: 1990/02/15 01:48:25
|
||||
@@ -2659,21 +2659,21 @@ printvalue(VALUE *vp, int flags)
|
||||
if (userfunc("error_print", vp))
|
||||
return;
|
||||
if (-type >= E__BASE)
|
||||
printf("Error %d", -type);
|
||||
math_fmt("Error %d", -type);
|
||||
else
|
||||
printf("System error %d", -type);
|
||||
math_fmt("System error %d", -type);
|
||||
return;
|
||||
}
|
||||
switch (type) {
|
||||
case V_NUM:
|
||||
qprintnum(vp->v_num, MODE_DEFAULT);
|
||||
if (conf->traceflags & TRACE_LINKS)
|
||||
printf("#%ld", vp->v_num->links);
|
||||
math_fmt("#%ld", vp->v_num->links);
|
||||
break;
|
||||
case V_COM:
|
||||
comprint(vp->v_com);
|
||||
if (conf->traceflags & TRACE_LINKS)
|
||||
printf("##%ld", vp->v_com->links);
|
||||
math_fmt("##%ld", vp->v_com->links);
|
||||
break;
|
||||
case V_STR:
|
||||
if (flags & PRINT_UNAMBIG)
|
||||
@@ -2731,16 +2731,16 @@ printvalue(VALUE *vp, int flags)
|
||||
qfree(qtemp);
|
||||
break;
|
||||
case V_OPTR:
|
||||
printf("o-ptr: %p", vp->v_octet);
|
||||
math_fmt("o-ptr: %p", vp->v_octet);
|
||||
break;
|
||||
case V_VPTR:
|
||||
printf("v-ptr: %p", vp->v_addr);
|
||||
math_fmt("v-ptr: %p", vp->v_addr);
|
||||
break;
|
||||
case V_SPTR:
|
||||
printf("s_ptr: %p", vp->v_str);
|
||||
math_fmt("s_ptr: %p", vp->v_str);
|
||||
break;
|
||||
case V_NPTR:
|
||||
printf("n_ptr: %p", vp->v_num);
|
||||
math_fmt("n_ptr: %p", vp->v_num);
|
||||
break;
|
||||
case V_NBLOCK:
|
||||
if (!userfunc("nblk_print", vp))
|
||||
@@ -2789,22 +2789,22 @@ config_print(CONFIG *cfg)
|
||||
|
||||
/* print tab if allowed */
|
||||
if (tab_over) {
|
||||
printf("\t");
|
||||
math_str("\t");
|
||||
} else if (conf->tab_ok) {
|
||||
tab_over = TRUE; /* tab next time */
|
||||
}
|
||||
|
||||
/* print name and spaces */
|
||||
printf("%s", cp->name);
|
||||
math_fmt("%s", cp->name);
|
||||
len = 16 - strlen(cp->name);
|
||||
while (len-- > 0)
|
||||
printf(" ");
|
||||
math_str(" ");
|
||||
|
||||
/* print value */
|
||||
config_value(cfg, cp->type, &tmp);
|
||||
printvalue(&tmp, PRINT_SHORT | PRINT_UNAMBIG);
|
||||
freevalue(&tmp);
|
||||
if ((cp+1)->name)
|
||||
printf("\n");
|
||||
math_str("\n");
|
||||
}
|
||||
}
|
||||
|
@@ -19,8 +19,8 @@
|
||||
* 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.58 $
|
||||
* @(#) $Id: version.c,v 29.58 2006/05/22 19:04:45 chongo Exp $
|
||||
* @(#) $Revision: 29.59 $
|
||||
* @(#) $Id: version.c,v 29.59 2006/06/03 22:52:39 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/version.c,v $
|
||||
*
|
||||
* Under source code control: 1990/05/22 11:00:58
|
||||
@@ -48,7 +48,7 @@ static char *program;
|
||||
#define MAJOR_VER 2 /* major version */
|
||||
#define MINOR_VER 12 /* minor version */
|
||||
#define MAJOR_PATCH 0 /* patch level or 0 if no patch */
|
||||
#define MINOR_PATCH 1 /* test number or 0 if no minor patch */
|
||||
#define MINOR_PATCH 2 /* test number or 0 if no minor patch */
|
||||
|
||||
|
||||
/*
|
||||
|
9
zio.c
9
zio.c
@@ -17,8 +17,8 @@
|
||||
* 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: zio.c,v 29.6 2006/05/19 15:26:10 chongo Exp $
|
||||
* @(#) $Revision: 29.8 $
|
||||
* @(#) $Id: zio.c,v 29.8 2006/06/01 16:21:37 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/zio.c,v $
|
||||
*
|
||||
* Under source code control: 1993/07/30 19:42:48
|
||||
@@ -176,11 +176,12 @@ void
|
||||
math_fmt(char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
char buf[200];
|
||||
char buf[BUFSIZ+1];
|
||||
|
||||
va_start(ap, fmt);
|
||||
vsprintf(buf, fmt, ap);
|
||||
vsnprintf(buf, BUFSIZ, fmt, ap);
|
||||
va_end(ap);
|
||||
buf[BUFSIZ] = '\0';
|
||||
math_str(buf);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user