It's not error, when standard command parse reach end of arguments list.
We can define some non-help-printing behavior for this situation.
Change-Id: Ib4bed570f385883d8cda5f79b648cfc31cef1e2a
Signed-off-by: Pawel Szewczyk <p.szewczyk@samsung.com>
static inline bool name_matches(const char *candidate, const char *pattern)
{
- // If string is NULL it suits to all strings
+ // If pattern is NULL it suits only to NULL
+ if (!pattern)
+ return !candidate;
+ // If candidate is NULL it suits to all strings
return (candidate && (strcmp(candidate, pattern) == 0))
|| (!candidate);
}
const Command *next = cmd->getChildren(cmd);
bool found = false;
- // If there is nothing more to parse it's error
- if (argc == 0) {
- executable_command_set(exec, cmd->printHelp, data, NULL);
- return;
- }
-
while (next->parse) {
if (name_matches(next->name, *argv)) {
found = true;