aboutsummaryrefslogtreecommitdiff
path: root/bin/expr/expr.y
Commit message (Collapse)AuthorAgeFilesLines
* Remove redundant declaration of yyparseKevin Lo2012-05-221-1/+0
| | | | | | | Reported by: tinderbox Notes: svn path=/head/; revision=235771
* 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
* 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-091-115/+95
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* 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
* /*- or .\"- or #- to begin license clauses.Warner Losh2005-01-101-1/+2
| | | | Notes: svn path=/head/; revision=139969
* Create a small library function, check_utility_compat(3), to determineGarrett Wollman2002-10-281-1/+2
| | | | | | | | | | | 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
* EXPR_COMPAT should imply -e, since there is no way to specify it otherwise,Garrett Wollman2002-05-111-0/+1
| | | | | | | 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-101-30/+65
| | | | | | | | | 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-221-8/+11
| | | | | | | parsing for compatibility with old implementations. Notes: svn path=/head/; revision=95278
* Make expr POSIX-compliant, and fix some bugs. Specifically:Garrett Wollman2002-03-221-88/+118
| | | | | | | | | | | | | | | | - 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
* Fix warnings to compile with WARNS=2 on i386 and alphaKris Kennaway2001-05-261-27/+42
| | | | | | | Reviewed by: bde Notes: svn path=/head/; revision=77244
* 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-271-1/+1
| | | | Notes: svn path=/head/; revision=50471
* Revert $FreeBSD$ to $Id$Peter Wemm1997-02-221-1/+1
| | | | Notes: svn path=/head/; revision=22988
* Make the long-awaited change from $Id$ to $FreeBSD$Jordan K. Hubbard1997-01-141-1/+1
| | | | | | | | | | | 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
* 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
* You will find enclosed some changes to make gcc -Wall more happy inJoerg Wunsch1995-03-191-2/+3
| | | | | | | | | | | | /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) Notes: svn path=/head/; revision=7165
* Added $Id$David Greenman1994-09-241-1/+1
| | | | Notes: svn path=/head/; revision=3044
* Explicitly include <sys/types.h> before including <regex.h>. This isBruce Evans1994-09-051-0/+1
| | | | | | | | apparently required by POSIX. It will be required in practice when the bogus inclusion of <sys/types.h> is removed from <stdio.h>. Notes: svn path=/head/; revision=2502
* Allow expressions like "expr 'ABC' : '^.*$' to work as is done in otherJ.T. Conklin1993-10-041-9/+3
| | | | | | | expr implementations. Notes: svn path=/head/; revision=539
* Fix grammar to eliminate support for unary minus expressions -- theyJ.T. Conklin1993-09-141-9/+8
| | | | | | | | weren't supported, they aren't standard, and they caused expr to dump core. Notes: svn path=/head/; revision=468
* 1003.2 requires that lexical comparisons be done in locale specific manner,J.T. Conklin1993-08-171-34/+29
| | | | | | | | | | so we have to use strcoll() instead of strcmp(). 1003.2 requires that a null string be returned if a string does not match a \( \) subexpression. Replaced fprintf/exit with calls to err and errx as appropriate. Notes: svn path=/head/; revision=295
* Update to my latest expr (fixes bugs with comparison and matching operators)J.T. Conklin1993-07-211-42/+7
| | | | | | | Add man page I wrote. Notes: svn path=/head/; revision=181
* added POSIX regex to exprAndrew Moore1993-06-191-53/+39
| | | | Notes: svn path=/head/; revision=31
* Initial import, 0.1 + pk 0.2.4-B1Rodney W. Grimes1993-06-121-0/+594
Notes: svn path=/cvs2svn/branches/unlabeled-1.1.1/; revision=4