summaryrefslogtreecommitdiffstats
path: root/parse.c
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2016-06-07 19:16:31 -0400
committerTavian Barnes <tavianator@tavianator.com>2016-06-07 19:16:31 -0400
commit3f2c4850a6bc41813e344babe2956408755c338f (patch)
treefa84c16c150497a657e4a1bbd2f93cd2f88a8d0b /parse.c
parent6245a80b56b025fd6604a35e268062db809e5845 (diff)
downloadbfs-3f2c4850a6bc41813e344babe2956408755c338f.tar.xz
Warn on things like "-not -maxdepth 1".
Diffstat (limited to 'parse.c')
-rw-r--r--parse.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/parse.c b/parse.c
index 320561d..a94a668 100644
--- a/parse.c
+++ b/parse.c
@@ -1353,6 +1353,8 @@ static struct expr *parse_factor(struct parser_state *state) {
if (strcmp(arg, "(") == 0) {
++state->argv;
+ state->non_option_seen = true;
+
struct expr *expr = parse_expr(state);
if (!expr) {
return NULL;
@@ -1369,6 +1371,7 @@ static struct expr *parse_factor(struct parser_state *state) {
return expr;
} else if (strcmp(arg, "!") == 0 || strcmp(arg, "-not") == 0) {
char **argv = state->argv++;
+ state->non_option_seen = true;
struct expr *factor = parse_factor(state);
if (!factor) {
@@ -1431,6 +1434,7 @@ static struct expr *parse_term(struct parser_state *state) {
char **argv = &fake_and_arg;
if (strcmp(arg, "-a") == 0 || strcmp(arg, "-and") == 0) {
argv = state->argv++;
+ state->non_option_seen = true;
}
struct expr *lhs = term;
@@ -1491,6 +1495,7 @@ static struct expr *parse_clause(struct parser_state *state) {
}
char **argv = state->argv++;
+ state->non_option_seen = true;
struct expr *lhs = clause;
struct expr *rhs = parse_term(state);
@@ -1538,6 +1543,7 @@ static struct expr *parse_expr(struct parser_state *state) {
}
char **argv = state->argv++;
+ state->non_option_seen = true;
struct expr *lhs = expr;
struct expr *rhs = parse_clause(state);