summaryrefslogtreecommitdiff
path: root/src/expr.c
AgeCommit message (Collapse)Author
2005-03-28(docolon): Use NULL, not `0'.Jim Meyering
2005-03-10(tostring, printv): Use INT_BUFSIZE_BOUND in place of INT_STRLEN_BOUND + 1.Jim Meyering
2005-01-14(toarith): Rewrite to detect/diagnose integer overflow,Jim Meyering
rather than suffering silently. Before, expr would silently overflow and wrap around: $ expr 9223372036854775808 = 0 # $(echo 2^63|bc) 1 Now it detects the problem and exits nonzero: $ ./expr $(echo 2^63|bc) = 0 ./expr: 9223372036854775808: integer is too large
2004-11-16(usage): Improve documentation along the lines suggestedPaul Eggert
by Debian 5.2.1-2.
2004-10-05(NEW, OLD): Remove, partly to avoidPaul Eggert
reference to obsolescent macro XMALLOC. All uses replaced by xmalloc and free.
2004-08-03(nextarg): Use bool for booleans.Paul Eggert
2004-06-21(main): Standardize on the diagnostics given when someone givesJim Meyering
too few operands ("missing operand after `xxx'") or too many operands ("extra operand `xxx'"). Include "quote.h" and/or "error.h" if it wasn't already being included.
2004-06-01(nextarg): Prefer the notation `STREQ (a, b)' over `strcmp (a, b) == 0'.Jim Meyering
2004-02-22(eval, eval7, eval6, eval5, eval4, eval3, eval2, eval1):Jim Meyering
Accept a bool argument specifying whether to evaluate the expression. This is to allow short-circuit evaluation. All callers changed. (null): Report that a string is zero even if it has a form like "-0" or "00". (eval1, eval): Use short-circuit evaluation for | and &. (eval): Return 0 if both arguments are null or zero, instead of returning the first argument.
2004-01-21(usage): Use EXIT_SUCCESS, not 0, for clarity.Jim Meyering
(main): Use initialize_exit_failure rather than setting exit_failure directly; this optimizes away redundant assignments. (EXPR_FAILURE): Renamed from EXPR_ERROR, for consistency with the other programs' naming conventions. All uses changed.
2003-11-05Cast NULL to `(char *)' in call to variadic function,Jim Meyering
parse_long_options, so that it works even on systems for which sizeof char* != sizeof int.
2003-10-18Most .c files (AUTHORS): Revert the WRITTEN_BY/AUTHORS changeJim Meyering
of 2003-09-19. Now, AUTHORS is a comma-separated list of strings. Update the call to parse_long_options so that `AUTHORS, NULL' are the last parameters. * src/true.c (main): Append NULL to version_etc argument list. * src/sys2.h (case_GETOPT_VERSION_CHAR): Likewise.
2003-09-18(WRITTEN_BY): Rename from AUTHORS.Jim Meyering
Begin each WRITTEN_BY string with `Written by ' and end it with `.'. Mark each WRITTEN_BY string as translatable.
2003-09-18revert previous changeJim Meyering
2003-09-18Update AUTHORS definition to be a comma-separated list of strings and/or updateJim Meyering
the call to parse_long_options so that `AUTHORS, NULL' are the last parameters.
2003-07-23Don't include headers already included by system.h:Jim Meyering
Don't include closeout.h.
2003-07-18Include "exitfail.h", "quotearg.h".Jim Meyering
(EXPR_INVALID, EXPR_ERROR): New constants. (nomoreargs, null, toarith, nextarg): Return bool, not int. (syntax_error): New function, exiting with status 2. Use it insteading of printing "syntax error" ourselves. (main): Initialize exit_failure to EXPR_ERROR. Exit with EXPR_INVALID on syntax error (too few arguments). (nextarg): Use strcmp, not strcoll; strcoll might return an undesirable 0, or might fail. (docolon, eval4, eval3): Exit with status 3 on invalid argument type or other such error. (eval2): Report an error if strcoll fails in a string comparison.
2003-06-17(main): Call initialize_main.Jim Meyering
2003-05-13(OLD): Don't apply cast to argument of free.Jim Meyering
2003-05-10(main): Handle argc == 0.Jim Meyering
2003-04-11Remove anachronistic casts of xmalloc,Jim Meyering
xrealloc, and xcalloc return values and of xrealloc's first argument.
2003-03-07(usage): Use putchar, not fputs, to output a single character.Jim Meyering
2002-12-15Remove all uses of `PARAMS'.Jim Meyering
2002-11-05(inttostr): Remove; use new imaxtostr library function instead.Jim Meyering
2002-08-31Change `exit (0)' to `exit (EXIT_SUCCESS)',Jim Meyering
`exit (1)' to `exit (EXIT_FAILURE)', and `usage (1)' to `usage (EXIT_FAILURE)'.
2002-07-02(usage): Use the PACKAGE_BUGREPORT e-mail address, rather than hard-coding it.Jim Meyering
2002-01-21Don't include "xalloc.h", as system.h already does that via sys2.h.Jim Meyering
2001-12-15Use new macros, HELP_OPTION_DESCRIPTION and VERSION_OPTION_DESCRIPTIONJim Meyering
instead of hard-coding --help and --version descriptions. Split --help output into smaller pieces. Use fputs, not printf.
2001-11-25(usage): Indent --help and --version strings to start in the 7th column.Jim Meyering
2001-08-26(nextarg): Use strcoll, not strcmp.Jim Meyering
2001-08-24(posixly_correct): Remove; no longer needed.Jim Meyering
(main): Do not worry about POSIXLY_CORRECT, as it's OK for expr to have options (so long as they do not begin with digits).
2001-08-18(nextarg): Advance ARGS by one if the next token matches.Jim Meyering
All callers changed.
2001-08-18(isstring): Remove.Jim Meyering
(eval2): Do comparisons as strings first, before trying to convert to integer. This avoids loss of information and wrong result, e.g. for "expr '00' '<' '0!'", where you don't want to convert '00' to '0'.
2001-08-18Code cleanup to avoid tricky macros and old-style function declarations.Jim Meyering
(cmpf, less_than, less_equal, equal, not_equal, greater_equal, greater_than, arithf, arithdivf, plus, minus, multiply, divide, mod): Remove. (eval4, eval3, eval2): Rewrite to avoid the need for the above macros and functions.
2001-08-18(main): Handle a leading "--" option as POSIX requires.Jim Meyering
2001-08-18(toarith): Don't accept plain "-" as a valid integer.Jim Meyering
2001-08-18Modify 'expr' so that it uses intmax_t, not int, to calculateJim Meyering
the value of integer expressions. (struct valinfo.i): Now intmax_t, not int. (docolon, int_value, str_value, isstring, nextarg, toarith, freev, tostring, trace): Remove unnecessary forward decls. (int_value, printv, tostring, toarith, arithf, arithdivf, docolon, eval6, eval4, eval3): Do integer arithmetic using intmax_t, not int. (docolon): Don't assume size_t fits in int.
2000-05-07Include "closeout.h".Jim Meyering
(main): Call atexit with close_stdout.
1999-11-09(NEW): Undefine to avoid warning about redefinition.Jim Meyering
(NEW): Redefine in terms of XMALLOC.
1999-09-02Remove xstrdup declaration.Jim Meyering
1999-03-31(PROGRAM_NAME, AUTHORS): Define and use.Jim Meyering
1999-03-04(main): Include author name argument in call to parse_long_options.Jim Meyering
1999-02-16update copyright datesJim Meyering
1999-01-25(usage): Remove static attribute.Jim Meyering
1998-09-19update bug-reporting addressJim Meyering
1998-06-29revert back to using lower case _unlocked wrapper namesJim Meyering
1998-06-29Change all uses of unlocked-wrapped functions to their upper case wrapper names.Jim Meyering
1997-12-21s/__P/PARAMS/Jim Meyering
1997-10-25Remove old-style xmalloc and xrealloc decls.Jim Meyering
1997-10-23Remove strstr decl.Jim Meyering