Commit Graph

48 Commits

Author SHA1 Message Date
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
jtc 42f840d29d Fix spelling error in Copyright notice 1994-01-29 01:43:03 +00:00
jtc e04c8e0705 Fix spelling errors. 1994-01-11 02:10:48 +00:00
jtc bff56be25a Fix insignificant memory leak. 1993-11-16 23:08:49 +00:00
jtc 5ce3d664fb Use new POSIX.2 compatible regex routines in C library instead of -lgnuregex. 1993-11-11 01:29:52 +00:00
jtc 441c51a9d5 Document the new, less restrictive, behavior of the matching operator. 1993-10-04 22:06:59 +00:00
jtc d143e6f175 Allow expressions like "expr 'ABC' : '^.*$' to work as is done in other
expr implementations.
1993-10-04 21:57:27 +00:00
jtc 74b68a49cf Fix grammar to eliminate support for unary minus expressions -- they
weren't supported, they aren't standard, and they caused expr to dump
core.
1993-09-14 22:45:57 +00:00
jtc a5102d01b8 Document the fact that expr is POSIX.2 compliant. 1993-08-28 04:21:00 +00:00
jtc 3ed5680e46 Use err() routine for error messages.
If string does not match \( \) subexpression, return a null string.
1993-08-17 16:01:23 +00:00
jtc 04b0d37be1 Document that string comparisons are done using the locale specific
collation sequence.
1993-08-16 23:22:49 +00:00
jtc e9c8ee33b0 expr is supposed to do string comparisons using the locale specific
collation sequence, so use strcoll instead of strcmp.
1993-08-16 23:20:22 +00:00
mycroft 57b5a6be2d Oops. This one does need a single-entry SRCS, because it's generated at
compile time.  Lose.
1993-08-06 01:20:44 +00:00
mycroft 210cab4541 Add RCS identifiers, remove some completely useless RCS logs and patchkit
headers, and a few other insignificant changes.
1993-08-02 17:18:41 +00:00
mycroft 11ad3ef4f1 Makefile 1993-08-02 17:15:26 +00:00
jtc 78bf9d408e Add a manual page. 1993-07-20 20:16:25 +00:00
jtc 6a320fc0a3 Now truely POSIX 1003.2 (D11.2) compliant. 1993-07-20 01:10:55 +00:00
jtc aabfaec2f5 Don't coerce strings to int in comparisons. 1993-07-20 00:52:57 +00:00
jtc 476e1b5964 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.
1993-07-20 00:29:41 +00:00
jtc 68028dc2de Updated to POSIX regular expression routines.
(Previous checkin was aborted by stray ^C)
1993-06-14 19:59:07 +00:00
jtc 3aef70381b Use POSIX regular expression routines.
Remove TODO file, as I've allready done everything that there was to do.
1993-06-14 19:56:06 +00:00
cgd ac2edf58ea update for latest version of patches from jtconklin@kaleida.com 1993-06-05 22:25:44 +00:00
cgd a5668e87e6 added J.T. Conklin's changes to get parens working fine, etc. 1993-03-23 20:19:35 +00:00
cgd 06be60083d changed "Id" to "Header" for rcsids 1993-03-23 00:22:59 +00:00
cgd 346aa5dd48 added rcs ids to all files 1993-03-22 08:04:00 +00:00
cgd e541169ce2 after 0.2.2 "stable" patches applied 1993-03-21 18:04:42 +00:00
cgd 61f282557f initial import of 386bsd-0.1 sources 1993-03-21 09:45:37 +00:00