aboutsummaryrefslogtreecommitdiff
path: root/find.cc
diff options
context:
space:
mode:
authorShinichiro Hamaji <shinichiro.hamaji@gmail.com>2015-07-31 16:10:34 +0900
committerShinichiro Hamaji <shinichiro.hamaji@gmail.com>2015-08-03 14:12:00 +0900
commit39970310a89b06bc59c5d35e82bbb3c12109ed31 (patch)
tree20f56e4df4d9c5fc5c3075907ecd7ede40bb83c9 /find.cc
parent0876e09854a143f18fb7e2aa457c3762bf465265 (diff)
downloadkati-39970310a89b06bc59c5d35e82bbb3c12109ed31.tar.gz
[C++] Better find command detection
Diffstat (limited to 'find.cc')
-rw-r--r--find.cc6
1 files changed, 5 insertions, 1 deletions
diff --git a/find.cc b/find.cc
index f7e7508..bc83b5f 100644
--- a/find.cc
+++ b/find.cc
@@ -539,6 +539,8 @@ class FindCommandParser {
if (!GetNextToken(&tok) || !tok.empty())
return false;
return true;
+ } else {
+ return false;
}
}
}
@@ -676,8 +678,10 @@ FindCommand::FindCommand()
bool FindCommand::Parse(const string& cmd) {
FindCommandParser fcp(cmd, this);
- if (cmd.find("find ") == string::npos)
+ size_t found = cmd.find("find ");
+ if (found == string::npos || (found != 0 && !isspace(cmd[found-1]))) {
return false;
+ }
if (!fcp.Parse())
return false;