"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "cscript/plus.calc" between
calc-2.12.7.2.tar.bz2 and calc-2.12.7.6.tar.bz2

About: Calc is a C-style arbitrary precision calculator.

plus.calc  (calc-2.12.7.2.tar.bz2):plus.calc  (calc-2.12.7.6.tar.bz2)
#!/usr/local/src/bin/calc/calc -q -f #!/usr/local/src/bin/calc/calc -q -s -f
/* /*
* plus - add two or more arguments together * plus - add two or more arguments together
* *
* Copyright (C) 1999-2007,2014 Landon Curt Noll * Copyright (C) 1999-2007,2014,2019 Landon Curt Noll
* *
* Calc is open software; you can redistribute it and/or modify it under * 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 * the terms of the version 2.1 of the GNU Lesser General Public License
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* Calc is distributed in the hope that it will be useful, but WITHOUT * Calc is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
* Public License for more details. * Public License for more details.
* *
skipping to change at line 34 skipping to change at line 34
* chongo <was here> /\oo/\ http://www.isthe.com/chongo/ * chongo <was here> /\oo/\ http://www.isthe.com/chongo/
* Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ * Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
* *
* usage: * usage:
* plus val ... * plus val ...
*/ */
/* /*
* parse args * parse args
*/ */
if (argv() < 2) { argc = argv();
/* we include the name of this script in the error message */ stderr = files(2);
fprintf(files(2), "usage: %s value ...\n", config("program")); program = argv(0);
abort "not enough args"; if (argc < 2) {
/* we include the name of this script in the error message */
fprintf(stderr, "usage: %s value ...\n", program);
abort "not enough args";
} }
/* /*
* print the sum of the args * print the sum of the args
* *
* Since args are strings, we must eval them before using them numerically. * Since args are strings, we must eval them before using them numerically.
*/ */
sum = 0; sum = 0;
for (i=1; i < argv(); ++i) { for (i=1; i < argv(); ++i) {
sum += eval(argv(i)); sum += eval(argv(i));
} }
print sum; print sum;
 End of changes. 4 change blocks. 
7 lines changed or deleted 10 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)