1303 files changed, 32187 insertions, 57138 deletions
diff --git a/coreutils/expr.c b/coreutils/expr.c index 128775b..55a19aa 100644 --- a/coreutils/expr.c +++ b/coreutils/expr.c @@ -13,7 +13,6 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ - /* This program evaluates expressions. Each token (operator, operand, * parenthesis) of the expression must be a separate argument. The * parser used is a reasonably general one, though any incarnation of @@ -21,9 +20,27 @@ * * No parse tree is needed; a new node is evaluated immediately. * One function can handle multiple operators all of equal precedence, - * provided they all associate ((x op x) op x). */ - -/* no getopt needed */ + * provided they all associate ((x op x) op x). + */ +//config:config EXPR +//config: bool "expr" +//config: default y +//config: help +//config: expr is used to calculate numbers and print the result +//config: to standard output. +//config: +//config:config EXPR_MATH_SUPPORT_64 +//config: bool "Extend Posix numbers support to 64 bit" +//config: default y +//config: depends on EXPR +//config: help +//config: Enable 64-bit math support in the expr applet. This will make +//config: the applet slightly larger, but will allow computation with very +//config: large numbers. + +//applet:IF_EXPR(APPLET(expr, BB_DIR_USR_BIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_EXPR) += expr.o //usage:#define expr_trivial_usage //usage: "EXPRESSION" @@ -61,6 +78,7 @@ //usage: "of characters matched or 0." #include "libbb.h" +#include "common_bufsiz.h" #include "xregex.h" #if ENABLE_EXPR_MATH_SUPPORT_64 @@ -99,8 +117,8 @@ typedef struct valinfo VALUE; struct globals { char **args; } FIX_ALIASING; -#define G (*(struct globals*)&bb_common_bufsiz1) -#define INIT_G() do { } while (0) +#define G (*(struct globals*)bb_common_bufsiz1) +#define INIT_G() do { setup_common_bufsiz(); } while (0) /* forward declarations */ static VALUE *eval(void); @@ -113,7 +131,7 @@ static VALUE *int_value(arith_t i) VALUE *v; v = xzalloc(sizeof(VALUE)); - if (INTEGER) /* otherwise xzaaloc did it already */ + if (INTEGER) /* otherwise xzalloc did it already */ v->type = INTEGER; v->u.i = i; return v; @@ -126,7 +144,7 @@ static VALUE *str_value(const char *s) VALUE *v; v = xzalloc(sizeof(VALUE)); - if (STRING) /* otherwise xzaaloc did it already */ + if (STRING) /* otherwise xzalloc did it already */ v->type = STRING; v->u.s = xstrdup(s); return v; |