X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=shell%2Fmath.c;h=91fb28f0560ef4ccee30e2c49cfb9d1811c89655;hb=79b3d42e13814f984ec35ec632d34db301871567;hp=fc20def628da43deebd1d1f62b3645daeba89d1b;hpb=76ace254e171ee9ca7a13f36335ccad9cc6ae6e1;p=oweals%2Fbusybox.git diff --git a/shell/math.c b/shell/math.c index fc20def62..91fb28f05 100644 --- a/shell/math.c +++ b/shell/math.c @@ -1,20 +1,17 @@ /* * arithmetic code ripped out of ash shell for code sharing * + * This code is derived from software contributed to Berkeley by + * Kenneth Almquist. + * + * Original BSD copyright notice is retained at the end of this file. + * * Copyright (c) 1989, 1991, 1993, 1994 * The Regents of the University of California. All rights reserved. * * Copyright (c) 1997-2005 Herbert Xu * was re-ported from NetBSD and debianized. * - * This code is derived from software contributed to Berkeley by - * Kenneth Almquist. - * - * Licensed under the GPL v2 or later, see the file LICENSE in this tarball. - * - * Original BSD copyright notice is retained at the end of this file. - */ -/* * rewrite arith.y to micro stack based cryptic algorithm by * Copyright (c) 2001 Aaron Lehmann * @@ -25,15 +22,9 @@ * used in busybox and size optimizations, * rewrote arith (see notes to this), added locale support, * rewrote dynamic variables. + * + * Licensed under the GPL v2 or later, see the file LICENSE in this tarball. */ -#include "libbb.h" -#include "math.h" - -#define a_e_h_t arith_eval_hooks_t -#define lookupvar (math_hooks->lookupvar) -#define setvar (math_hooks->setvar) -#define endofname (math_hooks->endofname) - /* Copyright (c) 2001 Aaron Lehmann Permission is hereby granted, free of charge, to any person obtaining @@ -100,7 +91,6 @@ * whitespace chars should be considered. Look below the "#include"s for a * precompiler test. */ - /* * Aug 26, 2001 Manuel Novoa III * @@ -110,7 +100,6 @@ * modified slightly to take account of my changes to the code. * */ - /* * (C) 2003 Vladimir Oleynik * @@ -127,6 +116,13 @@ * - protect $((num num)) as true zero expr (Manuel`s error) * - always use special isspace(), see comment from bash ;-) */ +#include "libbb.h" +#include "math.h" + +#define a_e_h_t arith_eval_hooks_t +#define lookupvar (math_hooks->lookupvar) +#define setvar (math_hooks->setvar ) +#define endofname (math_hooks->endofname) #define arith_isspace(arithval) \ (arithval == ' ' || arithval == '\n' || arithval == '\t') @@ -421,7 +417,7 @@ arith_apply(operator op, v_n_t *numstack, v_n_t **numstackptr, a_e_h_t *math_hoo } /* save to shell variable */ sprintf(buf, arith_t_fmt, rez); - setvar(numptr_m1->var, buf, 0); + setvar(numptr_m1->var, buf); /* after saving, make previous value for v++ or v-- */ if (op == TOK_POST_INC) rez--;