diff options
author | Richard Braun <rbraun@sceen.net> | 2017-05-28 12:41:35 +0200 |
---|---|---|
committer | Richard Braun <rbraun@sceen.net> | 2017-05-28 12:41:35 +0200 |
commit | 59a91b90800cad7268579d9e1e222710b45aa4cc (patch) | |
tree | 578a8c45999942337952e60ce84400e399930beb /shell.c | |
parent | 48c267a4ad218af8732e013c64b793166939a33e (diff) |
shell: fix completion
More precisely, fix completion when all commands share the same first
characters.
Diffstat (limited to 'shell.c')
-rw-r--r-- | shell.c | 13 |
1 files changed, 7 insertions, 6 deletions
@@ -303,15 +303,16 @@ shell_cmd_complete(const char *str, unsigned long *sizep, next = next->ls_next; } - if (size != 0) { - while ((cmd->name[size - 1] != '\0') - && (cmd->name[size - 1] == next->name[size - 1])) { - size++; - } + if (size == 0) { + size = 1; + } - size--; + while ((cmd->name[size - 1] != '\0') + && (cmd->name[size - 1] == next->name[size - 1])) { + size++; } + size--; *sizep = size; return ERR_AGAIN; } |