summaryrefslogtreecommitdiff
path: root/src/expr.c
AgeCommit message (Collapse)Author
2007-07-23Update all copyright notices to use the newer form.Jim Meyering
2007-07-10Change "version 2" to "version 3" in all copyright notices.Jim Meyering
2007-06-15Don't include "quote.h" when it is not used.Jim Meyering
* src/md5sum.c: Remove unnecessary inclusion of "quote.h". * src/expr.c: Likewise. * src/shred.c: Likewise. * Makefile.maint (sc_prohibit_quote_without_use): New rule. * src/c99-to-c89.diff: Adjust offsets.
2007-03-28Help translators include translation team's web or email address.Jim Meyering
* src/system.h (emit_bug_reporting_address): New function. * src/base64.c: Use it rather than a literal printf. * src/basename.c, src/cat.c, src/chgrp.c, src/chmod.c: * src/chown.c, src/chroot.c, src/cksum.c, src/comm.c, src/cp.c: * src/csplit.c, src/cut.c, src/date.c, src/dd.c, src/df.c: * src/dircolors.c, src/dirname.c, src/du.c, src/echo.c, src/env.c: * src/expand.c, src/expr.c, src/factor.c, src/fmt.c, src/fold.c: * src/head.c, src/hostid.c, src/hostname.c, src/id.c, src/install.c: * src/join.c, src/kill.c, src/link.c, src/ln.c, src/logname.c: * src/ls.c, src/md5sum.c, src/mkdir.c, src/mkfifo.c, src/mknod.c: * src/mv.c, src/nice.c, src/nl.c, src/nohup.c, src/od.c: * src/paste.c, src/pathchk.c, src/pinky.c, src/pr.c, src/printenv.c: * src/printf.c, src/ptx.c, src/pwd.c, src/readlink.c, src/rm.c: * src/rmdir.c, src/seq.c, src/setuidgid.c, src/shred.c, src/shuf.c: * src/sleep.c, src/sort.c, src/split.c, src/stat.c, src/stty.c: * src/su.c, src/sum.c, src/sync.c, src/system.h, src/tac.c: * src/tail.c, src/tee.c, src/test.c, src/touch.c, src/tr.c: * src/true.c, src/tsort.c, src/tty.c, src/uname.c, src/unexpand.c: * src/uniq.c, src/unlink.c, src/uptime.c, src/users.c, src/wc.c: * src/who.c, src/whoami.c, src/yes.c: Likewise.
2007-01-11Avoid a leak in expr's implementation of the ":" (match) operator.Jim Meyering
* src/expr.c (docolon): Free the regexp buffer using regfree, rather than doing it manually, being careful to set fastmap to NULL first. Free any re_regs.start and .end members, if necessary.
2006-10-25* src/cat.c (infile): Add "const" to declaration.Jim Meyering
* src/csplit.c (prefix): Likewise. * src/printf.c (cfcc_msg): Likewise. * src/tail.c (valid_file_spec): Likewise. * src/cut.c (cut_file): Likewise, for a parameter. * src/expr.c (str_value): Likewise. * src/fold.c (fold_file): Likewise. * src/pr.c (init_header): Likewise. * src/dircolors.c (dc_parse_stream): Likewise, for a local. * src/tr.c (make_printable_str): Likewise. * src/nl.c (body_type, header_type, footer_type, current_type): (separator_str, build_type_arg, nl_file): Likewise, for many. * src/paste.c (main): Don't assign a read-only string to 'optarg'. * src/tac.c (separator, tac_seekable, copy_to_temp): Likewise.
2006-09-11(eval6): Fix buffer overrun, or bad performance, ifPaul Eggert
substr's last operand is very large. Performance problem reported by Sebastian Kreft.
2006-06-08(eval4): Detect overflow properly when multiplying INTMAX_MIN * -1.Paul Eggert
2006-06-07Don't claim x86 behavior is erroneous in a comment.Paul Eggert
2006-06-07(integer_overflow): New function.Paul Eggert
(eval4, eval3): Check for integer overflow.
2006-04-12Clear the RE_NO_EMPTY_RANGES re syntax option, as this is a less intrusivePaul Eggert
change from the old (Emacs) behavior, and POSIX allows us to treat [z-a] as an empty range.
2006-04-12(docolon): Set re_syntax_options to a value that is compatible withPaul Eggert
what POSIX requires. Also, don't let anchors match newline; this fixes an incompatibility with tradition and with POSIX. Don't warn about leading ^. POSIX says it is unspecified whether ^ is a special character, which means that implementations can either treat it as special or not, but either way a warning is not allowed (unless the regexp is otherwise invalid). Instead, anchor the expression but treat ^ as an anchor; this is the traditional behavior (e.g., Solaris 10). (eval4, eval3, eval2): Treat non-numeric args, division by zero, and the like as invalid expressions (exit status 2), not as failure of 'expr' (exit status 3). This is more consistent with how Solaris behaves.
2006-04-11(docolon): Allocate and use a fastmap.Paul Eggert
Don't bother allocating a buffer.
2005-09-13(docolon): Add IF_LINT check to avoid GCC warning.Paul Eggert
2005-09-09* src/expr.c (docolon): 64-bit regex fixes.Paul Eggert
2005-06-16whoops: Adding quote(...) isn't enough :)Jim Meyering
remove quotes from the string, too.
2005-06-16Don't embed `this'-style quotes in format strings.Jim Meyering
Include "quote.h". Rather than this: error (..., "...`%s'...", arg); do this: error (..., "...%s...", quote (arg));
2005-05-27Include strnumcmp.h, xstrtol.h.Paul Eggert
(looks_like_integer): New function. (toarith): Use it. Also, use xstrtoimax rather than rolling our own diagnostics. (eval2): Don't look for trouble if !evaluate; this simplifies things. Compare numbers using string comparison, so that overflow is not possible.
2005-05-26(toarith): Fix a sign error introduced on 2005-01-14.Jim Meyering
2005-05-14Update FSF postal mail address.Jim Meyering
2005-05-14Update FSF postal mail address.Jim Meyering
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