diff options
author | Garrett Wollman <wollman@FreeBSD.org> | 2002-04-22 21:23:09 +0000 |
---|---|---|
committer | Garrett Wollman <wollman@FreeBSD.org> | 2002-04-22 21:23:09 +0000 |
commit | 96ab7da385302856ba4be4d8ce71e755ad4278c7 (patch) | |
tree | 0cabdac92e2713ee366194c0caf44cb311121310 /bin/expr/expr.y | |
parent | ea5b39d029720031b7af8afd5b5b739d3c9070ba (diff) | |
download | src-96ab7da385302856ba4be4d8ce71e755ad4278c7.tar.gz src-96ab7da385302856ba4be4d8ce71e755ad4278c7.zip |
Provide an environment variabloe, EXPR_COMPAT, which disables option
parsing for compatibility with old implementations.
Notes
Notes:
svn path=/head/; revision=95278
Diffstat (limited to 'bin/expr/expr.y')
-rw-r--r-- | bin/expr/expr.y | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/bin/expr/expr.y b/bin/expr/expr.y index bc40bf3e61e0..3026f52bb6d8 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(); |