diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2019-04-21 17:03:29 -0400 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2019-04-21 17:03:29 -0400 |
commit | cdb96f1a6ab4b8bbcca35c48cd8c232e50c04390 (patch) | |
tree | 08814c07171ce9f643d321ef03974845c9219f44 /parse.c | |
parent | ec0cffd71a257cef03475ff5d189b2057db4426b (diff) | |
download | bfs-cdb96f1a6ab4b8bbcca35c48cd8c232e50c04390.tar.xz |
parse: Allow things like -uid ++10
GNU find does too.
Diffstat (limited to 'parse.c')
-rw-r--r-- | parse.c | 12 |
1 files changed, 9 insertions, 3 deletions
@@ -658,10 +658,16 @@ static const char *parse_icmp(const struct parser_state *state, const char *str, * Check if a string could be an integer comparison. */ static bool looks_like_icmp(const char *str) { - if (str[0] == '-' || str[0] == '+') { - ++str; + int i; + + // One +/- for the comparison flag, one for the sign + for (i = 0; i < 2; ++i) { + if (str[i] != '-' && str[i] != '+') { + break; + } } - return str[0] >= '0' && str[0] <= '9'; + + return str[i] >= '0' && str[i] <= '9'; } /** |