Commit Graph

56 Commits

Author SHA1 Message Date
jilles
45eae14854 expr(1): Add sh(1) versions of examples, remove an incorrect example.
The three examples are better done using sh(1) itself these days.

The example
  expr -- "$a" : ".*"
is incorrect in the general case, as "$a" may be an operator.

MFC after:	2 weeks
2010-09-09 21:59:53 +00:00
ru
cabb128e11 Fix markup. 2007-03-04 19:52:07 +00:00
ceri
0eef1e3be2 Correct typos containing my login name (plus one more in expr.y).
Found courtesy of a recursive grep in the wrong directory.
2007-02-18 19:48:59 +00:00
ru
ffd9fd4c0e Add the new standard EXIT STATUS section where appropriate.
Sort standard sections in the (documented) preferred order.
2005-01-16 16:41:59 +00:00
ru
f88c29d9b1 Removed harmful empty lines that crept in during the copyright
header update.
2005-01-13 08:46:19 +00:00
imp
a76898b849 /*- or .\"- or #- to begin license clauses. 2005-01-10 08:39:26 +00:00
tjr
3805bd4f25 Remove BUGS section that talked about missing multibyte character support.
We have support now that the regular expression routines do.
2004-07-12 10:46:55 +00:00
tjr
82e3e73431 Document missing multibyte character handling in utilities specified
by POSIX.
2004-07-03 02:03:44 +00:00
markm
aafc494847 Get this area compiling with the highest WARNS= that it works with.
Obsolete WFORMAT= junk also removed where possible.

OK'ed by:	obrien
Tested on:	sparc64, alpha, i386
2003-06-13 07:04:02 +00:00
ru
10c48e457c mdoc(7) police:
Revert to using the .Tn POSIX and .Tn ANSI instead of \*[Px] and \*[Ai]
strings; using these strings is unsafe in troff mode, as they include a
change in a font size.

Approved by:	re
2002-11-26 17:55:41 +00:00
ru
15c2be19db mdoc(7) police: markup fixes.
Approved by:	re
2002-11-25 13:20:30 +00:00
wollman
d47f5a7e94 Create a small library function, check_utility_compat(3), to determine
whether a named utility should behave in FreeBSD 4.x-compatible mode
or in a standard mode (default standard).  The configuration is done
malloc(3)-style, with either an environment variable or a symlink.

Update expr(1) to use this new interface.
2002-10-28 00:15:43 +00:00
ru
9f5e5c2002 mdoc(7) police: markup nits. 2002-05-29 15:18:35 +00:00
wollman
a04093f9b6 EXPR_COMPAT should imply -e, since there is no way to specify it otherwise,
and -e reflects the historic behavior of FreeBSD's expr.
2002-05-11 03:08:12 +00:00
wollman
e11cb46ee8 The response to my POSIX interpretation request says that `expr'
is required to be oblivious to overflow and to use the data type `long'.
(Division by zero is undefined in ISO C so it's still OK to check for it
here.)  Add a new `-e' flag to get the old, more useful behavior.
2002-05-10 22:59:29 +00:00
wollman
e46c2e6ba9 Provide an environment variabloe, EXPR_COMPAT, which disables option
parsing for compatibility with old implementations.
2002-04-22 21:23:09 +00:00
wollman
7282a3b32e Disable -Werror when building -- the old version of gcc used on IA32 can't
deal with C99 formats.
2002-03-23 00:44:00 +00:00
wollman
d1fbde7cf6 Typo (if => of). 2002-03-22 20:49:29 +00:00
wollman
dc0ab81475 Add a word of caution about integer arithmetic range and overflow detection. 2002-03-22 20:46:59 +00:00
wollman
c1037fd271 Fix a few formatting brainos and make the formatting of the EXAMPLES
section somewhat clearer.
2002-03-22 20:38:44 +00:00
wollman
2e02d4aae7 Make expr POSIX-compliant, and fix some bugs. Specifically:
- expr must conform to the Utility Syntax Guidelines, so use
getopt() to eat the (non-existent) options.

- Use the Standard type intmax_t for arithmetic.

- If an argument cannot be *completely* converted to an integer, then
it is a string.

Additionally make some style cleanups near the modified lines.  This
utility is still not completely style-compliant.
2002-03-22 20:18:26 +00:00
imp
3fc8df52e3 o __P has been reoved
o Old-style K&R declarations have been converted to new C89 style
o register has been removed
o prototype for main() has been removed (gcc3 makes it an error)
o int main(int argc, char *argv[]) is the preferred main definition.
o Attempt to not break style(9) conformance for declarations more than
  they already are.
o gc some #ifdef sun ... #endif code

Approved by: arch@, new style(9)
2002-02-02 06:36:49 +00:00
obrien
099f8ecbe9 Default to WARNS=2. Binary builds that cannot handle this must explicitly
set WARNS=0.

Reviewed by:	mike
2001-12-04 01:57:47 +00:00
dd
a145482cf6 Remove whitespace at EOL. 2001-07-15 07:53:42 +00:00
kris
a942467a46 Fix warnings to compile with WARNS=2 on i386 and alpha
Reviewed by:	bde
2001-05-26 20:45:25 +00:00
ru
d4cb36bcfe Prepare for mdoc(7)NG. 2000-12-15 17:37:31 +00:00
ru
be1f850a8f mdoc(7) police: use the new features of the Nm macro. 2000-11-20 11:39:41 +00:00
se
ba74a67e5a Add overflow tests 2000-07-22 10:59:36 +00:00
se
a835dde9d7 Extend numeric operations to support 64 bit numbers. 2000-07-10 21:30:55 +00:00
peter
66312e4a8d $Id$ -> $FreeBSD$ 1999-08-27 23:15:48 +00:00
jkoshy
1f0db97d01 Add cross-references to test(1) and expr(1) respectively.
PR: 		docs/9111
Submitted by:	Josh Gilliam <josh@quick.net>
1998-12-18 03:16:47 +00:00
charnier
f18d7e3d59 Correct use of .Nm. 1998-05-13 07:43:56 +00:00
bde
c41c6ae044 Simplified using new yacc rules and by not generating y.tab.h. 1998-05-04 18:41:16 +00:00
peter
83b3c2c161 Revert $FreeBSD$ to $Id$ 1997-02-22 14:13:04 +00:00
jkh
808a36ef65 Make the long-awaited change from $Id$ to $FreeBSD$
This will make a number of things easier in the future, as well as (finally!)
avoiding the Id-smashing problem which has plagued developers for so long.

Boy, I'm glad we're not using sup anymore.  This update would have been
insane otherwise.
1997-01-14 07:20:47 +00:00
phk
cb0af0dbc3 Backout yacc changes 1996-06-02 17:05:48 +00:00
phk
8ed246fa9a Use default yacc rule. 1996-05-30 20:44:09 +00:00
wosch
9f795376b3 `mv'' -> `mv -f''
``rm'' -> ``rm -f''
so mv/rm may not ask for confirmation if you are not root
1996-05-07 23:19:49 +00:00
mpp
ddfba9f1d0 Fix some spelling errors. 1996-01-29 22:53:24 +00:00
joerg
7191d72bfa Fix my own brokeness for the colon operator, when one of the arguments
was a valid integer.  The actual decision between integer and string
is now context-dependant on the operator being used.
1995-11-18 18:05:03 +00:00
joerg
3e48994129 expr(1) didn't comply to Posix.2 and its own man page: any
comparisions have been made as string comparisions, even in cases
where both operands clearly qualified as integers.

The fix is to make the parser properly analyzing whether an operand is
a valid integer or not.
1995-08-04 17:08:07 +00:00
rgrimes
1888033949 Remove trailing whitespace.
Reviewed by:	phk
1995-05-30 00:07:29 +00:00
joerg
c6030c6511 You will find enclosed some changes to make gcc -Wall more happy in
/usr/src/bin. Note that some patches are still needed in that directory.

I (Joerg) finished most of Philippe's cleanup.  /bin/sh will still
need *allot* of work, however.

Submitted by:	charnier@lirmm.fr (Philippe Charnier)
1995-03-19 13:29:28 +00:00
dg
8722740e7f Added $Id$ 1994-09-24 02:59:15 +00:00
bde
ebb7b36c3a Explicitly include <sys/types.h> before including <regex.h>. This is
apparently required by POSIX.  It will be required in practice when
the bogus inclusion of <sys/types.h> is removed from <stdio.h>.
1994-09-05 13:03:50 +00:00
jkh
30d7ba45a9 Fix gross spelling and typographical errors pointed out by Keith Bostic. 1994-04-24 01:22:07 +00:00
rich
b5e37926b7 Take -lgnuregex back out. Linking with it causes 'make install' to fail. 1994-02-03 04:23:11 +00:00
jtc
914df1fcc6 Document the new, less restrictive, behavior of the matching operator. 1993-10-04 22:07:27 +00:00
jtc
c2f64d013c Allow expressions like "expr 'ABC' : '^.*$' to work as is done in other
expr implementations.
1993-10-04 21:58:53 +00:00
jtc
d3452ecc7d 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:49:52 +00:00