History log of /src/bin/expr |
Revision | Date | Author | Comments |
1.16 | 02-Feb-2018 |
mrg | branches: 1.16.4; convert HAVE_GCC handling to modern GCC release numbering: - HAVE_GCC=5 is now the default (vs. HAVE_GCC=53 we've been using for GCC 5.4 and GCC 5.5.) - remove some more GCC 4.8 code. we don't support GCC 4 here. - adjust set lists to gcc=5 from gcc=53.
add some basic HAVE_GCC=6 handling (totally unused so far.)
|
1.15 | 01-Apr-2016 |
mrg | for GCC 5.3 pass -fwrapv as this relies upon well-defined integer overflow.
|
1.14 | 19-Sep-2000 |
jdolecek | reimplement expr using lexical parser generated by yacc highlights: * / is treated correctly depending upon context (addresses PR # 10995) * use 64 bit arithmetic, so expr is able to process integer values from -(2**63) to (2**63 - 1) * checks for integer over- & underflows added * error messages improved, more error checking added
add AUTHOR section to manpage add BUGS section, and mention possible drawbacks with other expr implementations
XXX the old expr treated empty string in arithmetic expressions as if it was 0 XXX this behaviour has been retained
|
1.13 | 20-Jul-1997 |
christos | Remove WARNS=1 from all the subdirectory Makefiles, and add it to Makefile.inc now that all /bin has been cleaned.
|
1.12 | 20-Jul-1997 |
christos | Fix compiler warnings; add WARNS=1
|
1.11 | 21-Mar-1995 |
cgd | convert to new RCS id conventions.
|
1.10 | 16-Jul-1994 |
jtc | Re-implemented with a recursive descent parser. Fixed subtle bug wrt. comparing integers when either one hasn't been coersed from a string --- while avoiding an even subtler bug found in GNU expr.
|
1.9 | 11-Nov-1993 |
jtc | Use new POSIX.2 compatible regex routines in C library instead of -lgnuregex.
|
1.8 | 06-Aug-1993 |
mycroft | Oops. This one does need a single-entry SRCS, because it's generated at compile time. Lose.
|
1.7 | 02-Aug-1993 |
mycroft | Add RCS identifiers, remove some completely useless RCS logs and patchkit headers, and a few other insignificant changes.
|
1.6 | 20-Jul-1993 |
jtc | Add a manual page.
|
1.5 | 14-Jun-1993 |
jtc | Use POSIX regular expression routines. Remove TODO file, as I've allready done everything that there was to do.
|
1.4 | 23-Mar-1993 |
cgd | changed "Id" to "Header" for rcsids
|
1.3 | 22-Mar-1993 |
cgd | added rcs ids to all files
|
1.2 | 21-Mar-1993 |
cgd | after 0.2.2 "stable" patches applied
|
1.1 | 21-Mar-1993 |
cgd | branches: 1.1.1; Initial revision
|
1.1.1.1 | 21-Mar-1993 |
cgd | initial import of 386bsd-0.1 sources
|
1.16.4.2 | 21-Apr-2020 |
martin | Ooops, restore accidently removed files from merge mishap
|
1.16.4.1 | 21-Apr-2020 |
martin | Sync with HEAD
|
1.1 | 21-Mar-1993 |
cgd | branches: 1.1.1; Initial revision
|
1.1.1.2 | 01-Mar-1995 |
mycroft | Clean up deleted files.
|
1.1.1.1 | 21-Mar-1993 |
cgd | initial import of 386bsd-0.1 sources
|
1.41 | 28-Jun-2025 |
rillig | expr.1: delete misleading example
The result of the example expression would be 0 even if the operator precedence were inverted.
Fixes PR bin/57670.
|
1.40 | 15-Mar-2025 |
rillig | expr: improve portability, fix typo
Suggested by Robert Elz.
|
1.39 | 15-Mar-2025 |
rillig | expr.1: sync with latest changes, improve wording
|
1.38 | 28-Aug-2022 |
hgutch | branches: 1.38.4; Change back various occurrences of \*[Le], \*[Ge] (less/greater equal) and \*(ua (upwards arrow) to literal "<=", ">=" and "^" whenever appropriate (e.g., in code examples).
|
1.37 | 03-Jul-2017 |
wiz | branches: 1.37.6; Remove workaround for ancient HTML generation code.
|
1.36 | 23-Aug-2016 |
sevan | Mark email addresses as mailto links, heads up by Sascha Wildner. Move email addresses to same line as author name. Do not split the third author entry on to a new line. Public domain is not licensed by definition, heads up by Robert Elz.
|
1.35 | 23-Aug-2016 |
sevan | Instruction to not split the line needs to be stated separately.
|
1.34 | 23-Aug-2016 |
sevan | Add HISTORY section Credit author of initial implementation in AUTHORS section Bump date Remove contraction highlighted by textproc/igor
|
1.33 | 12-Aug-2012 |
wiz | Improvements: wording, punctuation, macro usage.
From patch by Bug Hunting.
|
1.32 | 09-May-2012 |
jdf | Remove an unnecessary space in the manpage. Patch provided by Bug Hunting.
|
1.31 | 23-Mar-2011 |
dholland | branches: 1.31.4; minor usage nit
|
1.30 | 24-May-2010 |
joerg | Explicitly quote | and : meant as separate operator. Kill trailing whitespace. Don't use \Z' with obscure character entity. Reorder sections to canonical order.
|
1.29 | 30-Apr-2008 |
martin | Convert TNF licenses to new 2 clause variant
|
1.28 | 23-Apr-2004 |
wiz | branches: 1.28.24; Grammar improvement by Patrick Welche.
|
1.27 | 20-Apr-2004 |
wiz | Add some articles; use No instead of Li in one place (more correct, see e.g. PostScript output); bump date for previous.
|
1.26 | 20-Apr-2004 |
jdolecek | add support for 'length' keyword, for compatibility with GNU expr
|
1.25 | 21-Dec-2003 |
wiz | Add some articles.
|
1.24 | 21-Dec-2003 |
jdolecek | add a note explaining empty string matching via : this adresses bin/23810 by VaX#n8
bump date and update copyright
|
1.23 | 29-Mar-2003 |
perry | spelling errors, some from Igor Sobrado in PR 19670
|
1.22 | 14-Feb-2003 |
grant | 'NetBSD.org'
|
1.21 | 25-Sep-2002 |
wiz | New policy: New sentences start on a new line. Patches by Robert Elz <kre at munnari oz au>, with minimal changes by me.
|
1.20 | 19-Feb-2002 |
pooka | rewritten in NetBSD 1.6 -> rewritten for NetBSD 1.6
|
1.19 | 08-Feb-2002 |
ross | Generate <>& symbolically. I'm avoiding .../dist/... directories for now.
|
1.18 | 20-Dec-2001 |
wiz | Use standard headers, sort sections.
|
1.17 | 18-Oct-2001 |
wiz | Quote `:' correctly.
|
1.16 | 07-May-2001 |
jdolecek | Fix the operator precedence list to match reality. Operators were incorrectly grouped there.
|
1.15 | 30-Oct-2000 |
jdolecek | list parenthesis usage similar way as other operators document operator precedence rename section BUGS to COMPATIBILITY, add paragraph about -- handling
|
1.14 | 19-Sep-2000 |
jdolecek | reimplement expr using lexical parser generated by yacc highlights: * / is treated correctly depending upon context (addresses PR # 10995) * use 64 bit arithmetic, so expr is able to process integer values from -(2**63) to (2**63 - 1) * checks for integer over- & underflows added * error messages improved, more error checking added
add AUTHOR section to manpage add BUGS section, and mention possible drawbacks with other expr implementations
XXX the old expr treated empty string in arithmetic expressions as if it was 0 XXX this behaviour has been retained
|
1.13 | 04-Sep-2000 |
kleink | For commands and utilities, use EXIT STATUS rather than RETURN VALUES as appropriate (and documented in mdoc(7)).
|
1.12 | 28-Aug-2000 |
hubertf | Add 'RETURN VALUE' section header.
|
1.11 | 14-Jan-2000 |
mjl | branches: 1.11.4; On memory allocation failure, return 3 as per POSIX. (from OpenBSD)
|
1.10 | 20-Oct-1997 |
enami | Fix .Nm usage.
|
1.9 | 28-Apr-1995 |
jtc | Winning Strategies has placed this code into the Public Domain
|
1.8 | 21-Mar-1995 |
cgd | convert to new RCS id conventions.
|
1.7 | 29-Jan-1994 |
jtc | Fix spelling error in Copyright notice
|
1.6 | 11-Jan-1994 |
jtc | Fix spelling errors.
|
1.5 | 04-Oct-1993 |
jtc | Document the new, less restrictive, behavior of the matching operator.
|
1.4 | 28-Aug-1993 |
jtc | Document the fact that expr is POSIX.2 compliant.
|
1.3 | 16-Aug-1993 |
jtc | Document that string comparisons are done using the locale specific collation sequence.
|
1.2 | 02-Aug-1993 |
mycroft | Makefile
|
1.1 | 20-Jul-1993 |
jtc | Add a manual page.
|
1.11.4.1 | 28-Aug-2000 |
hubertf | Pull up to netbsd-1-5 branch, OK'd by thorpej:
Log Message: > Add 'RETURN VALUE' section header.
Files & Revisionis: > cvs rdiff -r1.19 -r1.20 basesrc/bin/cat/cat.1 > cvs rdiff -r1.12 -r1.13 basesrc/bin/chmod/chmod.1 > cvs rdiff -r1.14 -r1.15 basesrc/bin/cp/cp.1 > cvs rdiff -r1.8 -r1.9 basesrc/bin/dd/dd.1 > cvs rdiff -r1.9 -r1.10 basesrc/bin/echo/echo.1 > cvs rdiff -r1.11 -r1.12 basesrc/bin/expr/expr.1 > cvs rdiff -r1.25 -r1.26 basesrc/bin/ls/ls.1 > cvs rdiff -r1.10 -r1.11 basesrc/bin/mkdir/mkdir.1 > cvs rdiff -r1.23 -r1.24 basesrc/bin/mt/mt.1 > cvs rdiff -r1.12 -r1.13 basesrc/bin/mv/mv.1 > cvs rdiff -r1.16 -r1.17 basesrc/bin/pwd/pwd.1 > cvs rdiff -r1.9 -r1.10 basesrc/bin/rm/rm.1 > cvs rdiff -r1.11 -r1.12 basesrc/bin/rmdir/rmdir.1 > cvs rdiff -r1.35 -r1.36 basesrc/bin/sh/sh.1 > cvs rdiff -r1.11 -r1.12 basesrc/bin/sleep/sleep.1 > cvs rdiff -r1.20 -r1.21 basesrc/bin/stty/stty.1
|
1.28.24.1 | 18-May-2008 |
yamt | sync with head.
|
1.31.4.2 | 30-Oct-2012 |
yamt | sync with head
|
1.31.4.1 | 23-May-2012 |
yamt | sync with head.
|
1.37.6.2 | 21-Apr-2020 |
martin | Ooops, restore accidently removed files from merge mishap
|
1.37.6.1 | 21-Apr-2020 |
martin | Sync with HEAD
|
1.38.4.1 | 02-Aug-2025 |
perseant | Sync with HEAD
|
1.13 | 19-Sep-2000 |
jdolecek | reimplement expr using lexical parser generated by yacc highlights: * / is treated correctly depending upon context (addresses PR # 10995) * use 64 bit arithmetic, so expr is able to process integer values from -(2**63) to (2**63 - 1) * checks for integer over- & underflows added * error messages improved, more error checking added
add AUTHOR section to manpage add BUGS section, and mention possible drawbacks with other expr implementations
XXX the old expr treated empty string in arithmetic expressions as if it was 0 XXX this behaviour has been retained
|
1.12 | 14-Jan-2000 |
mjl | On memory allocation failure, return 3 as per POSIX. (from OpenBSD)
|
1.11 | 09-Nov-1999 |
drochner | Since our gcc doesn't warn about NULL format strings anymore, we can fix the incorrect err(1, "%s", "") et al. Closes PR bin/7592 by cgd.
|
1.10 | 04-Nov-1998 |
christos | branches: 1.10.6; cast is*() to unsigned char
|
1.9 | 28-Jul-1998 |
mycroft | Be more retentive about use of NOTREACHED and noreturn.
|
1.8 | 28-Jul-1998 |
mycroft | Delint.
|
1.7 | 27-Jul-1998 |
mycroft | Slight code reduction.
|
1.6 | 27-Jul-1998 |
mycroft | __AUDIT__ cleanup.
|
1.5 | 20-Jul-1997 |
christos | Fix compiler warnings; add WARNS=1
|
1.4 | 04-Jun-1996 |
cgd | don't spew an error message if setlocale(LC_ALL, ""); fails. This is for consistency with other programs, and because currently it can never actually succeeed if LANG is set to something other than "C". Sent in by me in PR 2486, approved by jtc).
|
1.3 | 28-Apr-1995 |
jtc | branches: 1.3.6; Winning Strategies has placed this code into the Public Domain
|
1.2 | 21-Mar-1995 |
cgd | convert to new RCS id conventions.
|
1.1 | 16-Jul-1994 |
jtc | Re-implemented with a recursive descent parser. Fixed subtle bug wrt. comparing integers when either one hasn't been coersed from a string --- while avoiding an even subtler bug found in GNU expr.
|
1.3.6.1 | 04-Jun-1996 |
cgd | pull up from trunk: >don't spew an error message if setlocale(LC_ALL, ""); fails. This is for >consistency with other programs, and because currently it can never >actually succeeed if LANG is set to something other than "C".
|
1.10.6.1 | 27-Dec-1999 |
wrstuden | Pull up to last week's -current.
|
1.55 | 29-Jun-2025 |
rillig | expr: use characters instead of bytes for ":" and "length"
Required by POSIX.
|
1.54 | 12-Apr-2025 |
rillig | expr: sort grammar rules by operator precedence
For easier reading; no functional change intended.
|
1.53 | 15-Mar-2025 |
rillig | expr: ensure that the result of '|' is never empty
Required by POSIX since at least 2004.
|
1.52 | 15-Mar-2025 |
rillig | expr: only skip '--' once
|
1.51 | 15-Mar-2025 |
rillig | expr: clean up
|
1.50 | 15-Mar-2025 |
rillig | expr: don't evaluate irrelevant conditions
|
1.49 | 15-Mar-2025 |
rillig | expr: clean up grammar and code
|
1.48 | 15-Mar-2025 |
rillig | expr: extract expression evaluation functions from the grammar
|
1.47 | 14-Mar-2025 |
rillig | expr: fix out-of-bounds memory read for empty command line argument
|
1.46 | 11-Jun-2020 |
kamil | branches: 1.46.8; Fix typo
|
1.45 | 27-Jun-2018 |
kamil | branches: 1.45.2; Add a missing check to handle correctly 0 * 0 in expr(1)
|
1.44 | 27-Jun-2018 |
kamil | Improve the * operator handling in expr(1)
Fixes overflow detection in expressions INT * -UINT.
Detected with libFuzzer & UBSan.
|
1.43 | 14-Jun-2018 |
christos | remove notreached
|
1.42 | 14-Jun-2018 |
christos | return to caller instead of exit(2)
|
1.41 | 13-Jun-2018 |
kamil | Detect properly overflow in expr(1) for 0 + INT
|
1.40 | 12-Jun-2018 |
kamil | Rework perform_arith_op() in expr(1) to omit Undefined Behavior
The current implementation of operations - + * / % could cause Undefined Behavior and in narrow cases (INT64_MIN / -1 and INT64_MIN % -1) SIGFPE and crash duping core.
Detected with MKSANITIZER enabled for the Undefined Behavior variation: # eval expr '4611686018427387904 + 4611686018427387904' /public/src.git/bin/expr/expr.y:315:12: runtime error: signed integer overflow: 4611686018427387904 + 4611686018427387904 cannot be represented in type 'long'
All bin/t_expr ATF tests pass now in a sanitized userland.
Sponsored by <The NetBSD Foundation>
|
1.39 | 05-Sep-2016 |
sevan | branches: 1.39.12; Drop main() prototype.
|
1.38 | 15-Mar-2012 |
joerg | Add __printflike attribution to use vprintf and friends with an argument as format string.
|
1.37 | 25-Aug-2011 |
joerg | branches: 1.37.2; Mark yyerror as dead.
|
1.36 | 20-Jan-2009 |
joerg | Revert for now, pending discussion of how expr should behave in the case of pre-POSIX expressions.
|
1.35 | 20-Jan-2009 |
joerg | SUS says that expr must support "--" to prevent interpretation of negative numbers as options.
|
1.34 | 30-Apr-2008 |
martin | Normalize TNF license, move to 2 clause.
|
1.33 | 17-Mar-2006 |
rumble | branches: 1.33.18; Handle asprintf failing to allocate.
|
1.32 | 01-Jun-2005 |
lukem | appease gcc -Wuninitialized
|
1.31 | 20-Apr-2004 |
jdolecek | add support for 'length' keyword, for compatibility with GNU expr
|
1.30 | 20-Mar-2004 |
jdolecek | explicitly use REG_BASIC when calling regcomp(3), instead of 0
|
1.29 | 14-Feb-2003 |
grant | 'NetBSD.org'
|
1.28 | 16-Sep-2001 |
wiz | Use {g,s}etprogname, and some other KNF stuff. Patch by Petri Koistinen.
|
1.27 | 06-May-2001 |
jmc | Various cleanups/fixes. Change the add/subtract overflow checks to use an unsigned to do the op and then cast back into the signed var to check the signs.
Make multiply shortcut on either right or left being 0. Make multiply's overflow test not fail on simple cases like 1 * -1 Make the multiple overflow test pass all the regress tests.
|
1.26 | 05-May-2001 |
jmc | Various changes to fix bugs in PR bin/12838.
Make sure all precendence is spelled out correctly (comparison does not have the same level as the arithmetic operators..) Break the arithemtic operators into 2 classes (+- are lower than */%) Restructure the arithmetic code into a function either class above can call. Finally, add a whole suite of regression tests (checked in separately) which the previous code failed on 3 of them.
|
1.25 | 25-Apr-2001 |
simonb | Spell occurred correctly.
|
1.24 | 04-Feb-2001 |
christos | remove redundant declaration of yyparse
|
1.23 | 30-Oct-2000 |
jdolecek | add a hack to properly handle '--' as first argument - it's ignored if it would cause syntax error, otherwise treated as common string; this is so that both 'expr -- : .' and 'expr -- foo : .' works This addresses standards/11230 by Ben Harris.
while here, make all global variables but main() static, use const more
|
1.22 | 29-Oct-2000 |
thorpej | The "&" operator has a higer precedence than "|".
|
1.21 | 27-Oct-2000 |
jdolecek | also credit J.T. Conklin in copyright message
|
1.20 | 26-Oct-2000 |
jdolecek | fix operator precedence - | or & have lower priority than arithmetic operations, compare, or : This should fix bin/11318 by Love <lha@stacken.kth.se>
|
1.19 | 29-Sep-2000 |
jdolecek | in regexp handling code, fix the format passed to asprintf() to be actually in intended form - use "%.*s" and not incorrect "%*s"
Bug found by Launey Thomas <ljt@alum.mit.edu> and reported in private e-mail.
|
1.18 | 21-Sep-2000 |
jdolecek | Fix bug in regexp handling, caused not quite complete conversion from old expr.c. This fixes PR # 11060.
While here, convert the code to use asprintf() instead of strdup() followed by truncating of new string and move definition of errstr to block where it's used.
|
1.17 | 19-Sep-2000 |
jdolecek | reimplement expr using lexical parser generated by yacc highlights: * / is treated correctly depending upon context (addresses PR # 10995) * use 64 bit arithmetic, so expr is able to process integer values from -(2**63) to (2**63 - 1) * checks for integer over- & underflows added * error messages improved, more error checking added
add AUTHOR section to manpage add BUGS section, and mention possible drawbacks with other expr implementations
XXX the old expr treated empty string in arithmetic expressions as if it was 0 XXX this behaviour has been retained
|
1.16 | 16-Jul-1994 |
mycroft | Clean up deleted files.
|
1.15 | 10-Jul-1994 |
cgd | don't forget a cast, and thereby fix the regexp problems on big-endian machines
|
1.14 | 16-Nov-1993 |
jtc | branches: 1.14.2; Fix insignificant memory leak.
|
1.13 | 04-Oct-1993 |
jtc | Allow expressions like "expr 'ABC' : '^.*$' to work as is done in other expr implementations.
|
1.12 | 14-Sep-1993 |
jtc | Fix grammar to eliminate support for unary minus expressions -- they weren't supported, they aren't standard, and they caused expr to dump core.
|
1.11 | 17-Aug-1993 |
jtc | Use err() routine for error messages. If string does not match \( \) subexpression, return a null string.
|
1.10 | 16-Aug-1993 |
jtc | expr is supposed to do string comparisons using the locale specific collation sequence, so use strcoll instead of strcmp.
|
1.9 | 20-Jul-1993 |
jtc | Now truely POSIX 1003.2 (D11.2) compliant.
|
1.8 | 20-Jul-1993 |
jtc | Don't coerce strings to int in comparisons.
|
1.7 | 20-Jul-1993 |
jtc | integer arguments were not coerced to strings for the `:' operator. bad things: core dumps, etc. will happen if integer values make it up the parse tree.
|
1.6 | 14-Jun-1993 |
jtc | Updated to POSIX regular expression routines. (Previous checkin was aborted by stray ^C)
|
1.5 | 05-Jun-1993 |
cgd | update for latest version of patches from jtconklin@kaleida.com
|
1.4 | 23-Mar-1993 |
cgd | added J.T. Conklin's changes to get parens working fine, etc.
|
1.3 | 23-Mar-1993 |
cgd | changed "Id" to "Header" for rcsids
|
1.2 | 22-Mar-1993 |
cgd | added rcs ids to all files
|
1.1 | 21-Mar-1993 |
cgd | branches: 1.1.1; Initial revision
|
1.1.1.1 | 21-Mar-1993 |
cgd | initial import of 386bsd-0.1 sources
|
1.14.2.1 | 10-Jul-1994 |
cgd | fix regexp problems. from trunk.
|
1.33.18.1 | 18-May-2008 |
yamt | sync with head.
|
1.37.2.1 | 17-Apr-2012 |
yamt | sync with head
|
1.39.12.2 | 28-Jul-2018 |
pgoyette | Sync with HEAD
|
1.39.12.1 | 25-Jun-2018 |
pgoyette | Sync with HEAD
|
1.45.2.2 | 21-Apr-2020 |
martin | Ooops, restore accidently removed files from merge mishap
|
1.45.2.1 | 21-Apr-2020 |
martin | Sync with HEAD
|
1.46.8.1 | 02-Aug-2025 |
perseant | Sync with HEAD
|