Commit Graph

76 Commits

Author SHA1 Message Date
martin 8eba9df29f Normalize TNF license, move to 2 clause. 2008-04-30 13:39:13 +00:00
martin 11a6dbe728 Convert TNF licenses to new 2 clause variant 2008-04-30 13:10:46 +00:00
rumble 2174dda221 Handle asprintf failing to allocate. 2006-03-17 14:43:11 +00:00
lukem 5760da6393 appease gcc -Wuninitialized 2005-06-01 15:12:18 +00:00
wiz 6af689d38b Grammar improvement by Patrick Welche. 2004-04-23 13:28:58 +00:00
wiz a423ef4af0 Add some articles; use No instead of Li in one place
(more correct, see e.g. PostScript output); bump date for previous.
2004-04-20 20:47:47 +00:00
jdolecek c92704dc53 add support for 'length' keyword, for compatibility with GNU expr 2004-04-20 19:44:51 +00:00
jdolecek 217903eeea explicitly use REG_BASIC when calling regcomp(3), instead of 0 2004-03-20 08:45:05 +00:00
wiz 00c8cf496c Add some articles. 2003-12-21 11:18:25 +00:00
jdolecek 83f8b02df2 add a note explaining empty string matching via :
this adresses bin/23810 by VaX#n8

bump date and update copyright
2003-12-21 10:02:46 +00:00
perry 83237da0b1 spelling errors, some from Igor Sobrado in PR 19670 2003-03-29 18:25:22 +00:00
grant a15c6f031f 'NetBSD.org' 2003-02-14 16:17:30 +00:00
wiz 14dfaa4b03 New policy: New sentences start on a new line.
Patches by Robert Elz <kre at munnari oz au>, with minimal changes by me.
2002-09-25 15:18:36 +00:00
pooka 2b1fe1903a rewritten in NetBSD 1.6 -> rewritten for NetBSD 1.6 2002-02-19 21:14:45 +00:00
ross dc5571b22e Generate <>& symbolically. I'm avoiding .../dist/... directories for now. 2002-02-08 01:21:55 +00:00
wiz e0ab876efe Use standard headers, sort sections. 2001-12-20 20:05:12 +00:00
wiz 880b4d21b9 Quote `:' correctly. 2001-10-18 11:00:03 +00:00
wiz 7a64806dbc Use {g,s}etprogname, and some other KNF stuff. Patch by Petri Koistinen. 2001-09-16 13:42:10 +00:00
jdolecek 3b932d2fe1 Fix the operator precedence list to match reality. Operators were incorrectly
grouped there.
2001-05-07 10:14:43 +00:00
jmc 64e6a11adc 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.
2001-05-06 06:20:39 +00:00
jmc a7755cce7c 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.
2001-05-05 06:57:57 +00:00
simonb 6f6fe2f3ad Spell occurred correctly. 2001-04-25 02:33:08 +00:00
christos a66a2e0ad0 remove redundant declaration of yyparse 2001-02-04 19:51:14 +00:00
jdolecek 9ad5bf10de list parenthesis usage similar way as other operators
document operator precedence
rename section BUGS to COMPATIBILITY, add paragraph about -- handling
2000-10-30 16:20:12 +00:00
jdolecek 5888f4d21c 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
2000-10-30 14:55:02 +00:00
thorpej 401ea1afda The "&" operator has a higer precedence than "|". 2000-10-29 17:16:02 +00:00
jdolecek c13c5901f2 also credit J.T. Conklin in copyright message 2000-10-27 21:40:02 +00:00
jdolecek fb2525abf5 fix operator precedence - | or & have lower priority than
arithmetic operations, compare, or :
This should fix bin/11318 by Love <lha@stacken.kth.se>
2000-10-26 23:10:21 +00:00
jdolecek fd6eeb2e1d 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.
2000-09-29 17:49:21 +00:00
jdolecek a82fc402d8 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.
2000-09-21 20:32:24 +00:00
jdolecek 3a4441e3d4 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
2000-09-19 17:20:00 +00:00
kleink 2caf6aacdd For commands and utilities, use EXIT STATUS rather than RETURN VALUES as
appropriate (and documented in mdoc(7)).
2000-09-04 07:30:07 +00:00
hubertf 1cb54f68ac Add 'RETURN VALUE' section header. 2000-08-28 02:11:04 +00:00
mjl 5a14e8cac6 On memory allocation failure, return 3 as per POSIX. (from OpenBSD) 2000-01-14 07:14:41 +00:00
drochner 85cbf55d16 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.
1999-11-09 15:06:30 +00:00
christos cdd6e9ea70 cast is*() to unsigned char 1998-11-04 14:11:12 +00:00
mycroft ee9e50eacb Be more retentive about use of NOTREACHED and noreturn. 1998-07-28 11:41:40 +00:00
mycroft 1381f68431 Delint. 1998-07-28 05:15:46 +00:00
mycroft ac70c0c5ed Slight code reduction. 1998-07-27 17:55:17 +00:00
mycroft 0e2f9ea923 __AUDIT__ cleanup. 1998-07-27 17:06:48 +00:00
enami c3872193cf Fix .Nm usage. 1997-10-20 08:50:59 +00:00
christos 23edbe3557 Remove WARNS=1 from all the subdirectory Makefiles, and add it to Makefile.inc
now that all /bin has been cleaned.
1997-07-20 22:36:20 +00:00
christos 1ebc470e07 Fix compiler warnings; add WARNS=1 1997-07-20 17:32:57 +00:00
cgd ad8b41fa2a 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).
1996-06-04 20:41:15 +00:00
jtc 528957a005 Winning Strategies has placed this code into the Public Domain 1995-04-28 23:19:22 +00:00
cgd 49f0ad8601 convert to new RCS id conventions. 1995-03-21 09:01:59 +00:00
mycroft 4c34be6b52 Clean up deleted files. 1995-03-01 00:00:00 +00:00
mycroft abe60a1e07 Clean up deleted files. 1994-07-16 00:17:15 +00:00
jtc b9e9314bd7 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.
1994-07-16 00:17:03 +00:00
cgd 00dc18214f don't forget a cast, and thereby fix the regexp problems on big-endian machines 1994-07-10 23:51:11 +00:00