summaryrefslogtreecommitdiff
path: root/shell.c
diff options
context:
space:
mode:
Diffstat (limited to 'shell.c')
-rw-r--r--shell.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/shell.c b/shell.c
index 3f5c7c6..84c1823 100644
--- a/shell.c
+++ b/shell.c
@@ -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;
}