summaryrefslogtreecommitdiff
path: root/bin/expr
Commit message (Collapse)AuthorAgeFilesLines
* Add the Clang specific -Wmissing-variable-declarations to WARNS=6.Ed Schouten2013-04-191-0/+2
| | | | | | | | | | | | | | | | This compiler flag enforces that that people either mark variables static or use an external declarations for the variable, similar to how -Wmissing-prototypes works for functions. Due to the fact that Yacc/Lex generate code that cannot trivially be changed to not warn because of this (lots of yy* variables), add a NO_WMISSING_VARIABLE_DECLARATIONS that can be used to turn off this specific compiler warning. Announced on: toolchain@ Notes: svn path=/head/; revision=249657
* Remove redundant declaration of yyparseKevin Lo2012-05-221-1/+0
| | | | | | | Reported by: tinderbox Notes: svn path=/head/; revision=235771
* Minor mdoc nits.Joel Dahl2012-05-131-1/+1
| | | | Notes: svn path=/head/; revision=235400
* rm[0].rm_so must be zero (an explicit check is made for zero in theEitan Adler2012-03-191-1/+1
| | | | | | | | | | outer if condition) Reviewed by: se Approved by: cperciva Notes: svn path=/head/; revision=233137
* Whitespace cleanup:Glen Barber2012-02-251-2/+4
| | | | | | | | | | | | o Wrap sentences on to new lines o Cleanup trailing whitespace Found with: textproc/igor MFC after: 1 week X-MFC-With: r232157 Notes: svn path=/head/; revision=232158
* Fix various typos in manual pages.Glen Barber2012-02-251-3/+3
| | | | | | | | | Submitted by: amdmi3 PR: 165431 MFC after: 1 week Notes: svn path=/head/; revision=232157
* Fix style, since this file has just been touched in a major way.Stefan Eßer2011-07-091-96/+75
| | | | | | | No actual code changes. Notes: svn path=/head/; revision=223883
* Some refactoring for easier maintenance of the code. This is a follow-upStefan Eßer2011-07-091-146/+69
| | | | | | | | | to re-establishment of 64bit arithmetic, but is committed separately, to not obscure that conversion. This commit does not change the observed behaviour of expr in any way. Style will be fixed in a follow-up commit. Notes: svn path=/head/; revision=223882
* Make /bin/expr support 64bit numeric range and range checks by default,Stefan Eßer2011-07-092-140/+152
| | | | | | | | | | | | | | | | | | | | | | | | | | | again. This brings back the behaviour of expr in FreeBSD-4, which had been reverted due to an assumed incompatbility with POSIX.1 for FreeBSD-5. This issue has been discussed in the freebsd-standards list, and the consensus was, that POSIX.1 is in fact not violated by this extension, since it affects only cases of POSIX undefined behaviour (overflow of signed long). Other operating systems did upgrade their versions of expr to support 64bit range, after it had been initially brought to FreeBSD. They have used it for a decade without problems, meanwhile. The -e option is retained, but it will only select less strict checking of numeric parameters (leading white-space, leading "+" are allowed and skipped, an empty string is considered to represent 0 in numeric context.) The call of check_utility_compat() as a means of establishing backwards compatibility with FreeBSD-4 is considered obsolete, but preserved in this commit. It is expected to be removed in a later revision of this file. Reviewed by: bde, das, jilles MFC after: 2 month (those parts that do not violate POLA) Notes: svn path=/head/; revision=223881
* expr(1): Add sh(1) versions of examples, remove an incorrect example.Jilles Tjoelker2010-09-091-10/+21
| | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=212390
* Fix markup.Ruslan Ermilov2007-03-041-5/+8
| | | | Notes: svn path=/head/; revision=167210
* Correct typos containing my login name (plus one more in expr.y).Ceri Davies2007-02-181-2/+2
| | | | | | | Found courtesy of a recursive grep in the wrong directory. Notes: svn path=/head/; revision=166813
* Add the new standard EXIT STATUS section where appropriate.Ruslan Ermilov2005-01-161-12/+12
| | | | | | | Sort standard sections in the (documented) preferred order. Notes: svn path=/head/; revision=140353
* Removed harmful empty lines that crept in during the copyrightRuslan Ermilov2005-01-131-1/+0
| | | | | | | header update. Notes: svn path=/head/; revision=140169
* /*- or .\"- or #- to begin license clauses.Warner Losh2005-01-102-2/+4
| | | | Notes: svn path=/head/; revision=139969
* Remove BUGS section that talked about missing multibyte character support.Tim J. Robbins2004-07-121-5/+1
| | | | | | | We have support now that the regular expression routines do. Notes: svn path=/head/; revision=132029
* Document missing multibyte character handling in utilities specifiedTim J. Robbins2004-07-031-1/+5
| | | | | | | by POSIX. Notes: svn path=/head/; revision=131513
* Get this area compiling with the highest WARNS= that it works with.Mark Murray2003-06-131-2/+0
| | | | | | | | | | Obsolete WFORMAT= junk also removed where possible. OK'ed by: obrien Tested on: sparc64, alpha, i386 Notes: svn path=/head/; revision=116282
* mdoc(7) police:Ruslan Ermilov2002-11-261-1/+1
| | | | | | | | | | | 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 Notes: svn path=/head/; revision=107282
* mdoc(7) police: markup fixes.Ruslan Ermilov2002-11-251-3/+3
| | | | | | | Approved by: re Notes: svn path=/head/; revision=107226
* Create a small library function, check_utility_compat(3), to determineGarrett Wollman2002-10-282-32/+34
| | | | | | | | | | | 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. Notes: svn path=/head/; revision=106065
* mdoc(7) police: markup nits.Ruslan Ermilov2002-05-291-11/+11
| | | | Notes: svn path=/head/; revision=97464
* EXPR_COMPAT should imply -e, since there is no way to specify it otherwise,Garrett Wollman2002-05-112-1/+18
| | | | | | | and -e reflects the historic behavior of FreeBSD's expr. Notes: svn path=/head/; revision=96382
* The response to my POSIX interpretation request says that `expr'Garrett Wollman2002-05-102-46/+88
| | | | | | | | | 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. Notes: svn path=/head/; revision=96367
* Provide an environment variabloe, EXPR_COMPAT, which disables optionGarrett Wollman2002-04-222-10/+27
| | | | | | | parsing for compatibility with old implementations. Notes: svn path=/head/; revision=95278
* Disable -Werror when building -- the old version of gcc used on IA32 can'tGarrett Wollman2002-03-231-0/+2
| | | | | | | deal with C99 formats. Notes: svn path=/head/; revision=92997
* Typo (if => of).Garrett Wollman2002-03-221-1/+1
| | | | Notes: svn path=/head/; revision=92984
* Add a word of caution about integer arithmetic range and overflow detection.Garrett Wollman2002-03-221-0/+6
| | | | Notes: svn path=/head/; revision=92983
* Fix a few formatting brainos and make the formatting of the EXAMPLESGarrett Wollman2002-03-221-6/+9
| | | | | | | section somewhat clearer. Notes: svn path=/head/; revision=92982
* Make expr POSIX-compliant, and fix some bugs. Specifically:Garrett Wollman2002-03-222-102/+213
| | | | | | | | | | | | | | | | - 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. Notes: svn path=/head/; revision=92979
* o __P has been reovedWarner Losh2002-02-021-85/+56
| | | | | | | | | | | | | | | 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) Notes: svn path=/head/; revision=90109
* Default to WARNS=2. Binary builds that cannot handle this must explicitlyDavid E. O'Brien2001-12-041-1/+0
| | | | | | | | | set WARNS=0. Reviewed by: mike Notes: svn path=/head/; revision=87323
* Remove whitespace at EOL.Dima Dorfman2001-07-151-14/+14
| | | | Notes: svn path=/head/; revision=79754
* Fix warnings to compile with WARNS=2 on i386 and alphaKris Kennaway2001-05-262-27/+43
| | | | | | | Reviewed by: bde Notes: svn path=/head/; revision=77244
* Prepare for mdoc(7)NG.Ruslan Ermilov2000-12-151-1/+1
| | | | Notes: svn path=/head/; revision=70056
* mdoc(7) police: use the new features of the Nm macro.Ruslan Ermilov2000-11-201-1/+1
| | | | Notes: svn path=/head/; revision=68935
* Add overflow testsStefan Eßer2000-07-221-3/+76
| | | | Notes: svn path=/head/; revision=63755
* Extend numeric operations to support 64 bit numbers.Stefan Eßer2000-07-101-30/+29
| | | | Notes: svn path=/head/; revision=62926
* $Id$ -> $FreeBSD$Peter Wemm1999-08-273-3/+3
| | | | Notes: svn path=/head/; revision=50471
* Add cross-references to test(1) and expr(1) respectively.Joseph Koshy1998-12-181-1/+4
| | | | | | | | PR: docs/9111 Submitted by: Josh Gilliam <josh@quick.net> Notes: svn path=/head/; revision=41915
* Correct use of .Nm.Philippe Charnier1998-05-131-11/+11
| | | | Notes: svn path=/head/; revision=36011
* Simplified using new yacc rules and by not generating y.tab.h.Bruce Evans1998-05-041-10/+4
| | | | Notes: svn path=/head/; revision=35702
* Revert $FreeBSD$ to $Id$Peter Wemm1997-02-223-3/+3
| | | | Notes: svn path=/head/; revision=22988
* Make the long-awaited change from $Id$ to $FreeBSD$Jordan K. Hubbard1997-01-143-3/+3
| | | | | | | | | | | 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. Notes: svn path=/head/; revision=21673
* Backout yacc changesPoul-Henning Kamp1996-06-021-2/+6
| | | | Notes: svn path=/head/; revision=16069
* Use default yacc rule.Poul-Henning Kamp1996-05-301-7/+3
| | | | Notes: svn path=/head/; revision=16012
* ``mv'' -> ``mv -f''Wolfram Schneider1996-05-071-2/+2
| | | | | | | | ``rm'' -> ``rm -f'' so mv/rm may not ask for confirmation if you are not root Notes: svn path=/head/; revision=15679
* Fix some spelling errors.Mike Pritchard1996-01-291-5/+5
| | | | Notes: svn path=/head/; revision=13719
* Fix my own brokeness for the colon operator, when one of the argumentsJoerg Wunsch1995-11-181-33/+31
| | | | | | | | was a valid integer. The actual decision between integer and string is now context-dependant on the operator being used. Notes: svn path=/head/; revision=12378
* expr(1) didn't comply to Posix.2 and its own man page: anyJoerg Wunsch1995-08-041-1/+13
| | | | | | | | | | | 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. Notes: svn path=/head/; revision=9909