diff options
author | Shinichiro Hamaji <shinichiro.hamaji@gmail.com> | 2015-07-31 16:10:34 +0900 |
---|---|---|
committer | Shinichiro Hamaji <shinichiro.hamaji@gmail.com> | 2015-08-03 14:12:00 +0900 |
commit | 39970310a89b06bc59c5d35e82bbb3c12109ed31 (patch) | |
tree | 20f56e4df4d9c5fc5c3075907ecd7ede40bb83c9 /find.cc | |
parent | 0876e09854a143f18fb7e2aa457c3762bf465265 (diff) | |
download | kati-39970310a89b06bc59c5d35e82bbb3c12109ed31.tar.gz |
[C++] Better find command detection
Diffstat (limited to 'find.cc')
-rw-r--r-- | find.cc | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -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; |