Skip to content

Commit

Permalink
[C++] Better find command detection
Browse files Browse the repository at this point in the history
  • Loading branch information
shinh committed Aug 3, 2015
1 parent 0876e09 commit 3997031
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion find.cc
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,8 @@ class FindCommandParser {
if (!GetNextToken(&tok) || !tok.empty())
return false;
return true;
} else {
return false;
}
}
}
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 3997031

Please sign in to comment.