summaryrefslogtreecommitdiffstats
path: root/bin/expr/expr.y
diff options
context:
space:
mode:
authorwollman <wollman@FreeBSD.org>2002-04-22 21:23:09 +0000
committerwollman <wollman@FreeBSD.org>2002-04-22 21:23:09 +0000
commite46c2e6ba94761edeaba49e1fa820140066e3ea8 (patch)
tree0cabdac92e2713ee366194c0caf44cb311121310 /bin/expr/expr.y
parentd4c507ea29a089a017b39ff7d76624177ec4bb5b (diff)
downloadFreeBSD-src-e46c2e6ba94761edeaba49e1fa820140066e3ea8.zip
FreeBSD-src-e46c2e6ba94761edeaba49e1fa820140066e3ea8.tar.gz
Provide an environment variabloe, EXPR_COMPAT, which disables option
parsing for compatibility with old implementations.
Diffstat (limited to 'bin/expr/expr.y')
-rw-r--r--bin/expr/expr.y19
1 files changed, 11 insertions, 8 deletions
diff --git a/bin/expr/expr.y b/bin/expr/expr.y
index bc40bf3..3026f52 100644
--- a/bin/expr/expr.y
+++ b/bin/expr/expr.y
@@ -270,14 +270,17 @@ main(int argc, char *argv[])
int c;
setlocale (LC_ALL, "");
- while ((c = getopt(argc, argv, "")) != -1)
- switch (c) {
- default:
- fprintf(stderr, "usage: expr [--] expression\n");
- exit(ERR_EXIT);
- }
-
- av = argv + optind;
+ if (getenv("EXPR_COMPAT") != NULL) {
+ av = argv + 1;
+ } else {
+ while ((c = getopt(argc, argv, "")) != -1)
+ switch (c) {
+ default:
+ fprintf(stderr,"usage: expr [--] expression\n");
+ exit(ERR_EXIT);
+ }
+ av = argv + optind;
+ }
yyparse();
OpenPOWER on IntegriCloud