1 #!/usr/local/src/cmd/calc/calc -q -f
3 * plus - add two or more arguments together
5 * Copyright (C) 1999-2007 Landon Curt Noll
7 * Calc is open software; you can redistribute it and/or modify it under
8 * the terms of the version 2.1 of the GNU Lesser General Public License
9 * as published by the Free Software Foundation.
11 * Calc is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
14 * Public License for more details.
16 * A copy of version 2.1 of the GNU Lesser General Public License is
17 * distributed with calc under the filename COPYING-LGPL. You should have
18 * received a copy with calc; if not, write to Free Software Foundation, Inc.
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 * @(#) $Revision: 30.1 $
22 * @(#) $Id: plus.calc,v 30.1 2007/03/16 11:12:11 chongo Exp $
23 * @(#) $Source: /usr/local/src/bin/calc/cscript/RCS/plus.calc,v $
25 * Under source code control: 1999/11/29 10:22:37
26 * File existed as early as: 1999
28 * chongo <was here> /\oo/\ http://www.isthe.com/chongo/
29 * Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
40 /* we include the name of this script in the error message */
41 fprintf(files(2), "usage: %s value ...\n", config("program"));
42 abort "not enough args";
46 * print the sum of the args
48 * Since args are strings, we must eval them before using them numerically.
51 for (i=1; i < argv(); ++i) {