summaryrefslogtreecommitdiff
path: root/help.c
diff options
context:
space:
mode:
Diffstat (limited to 'help.c')
-rw-r--r--help.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/help.c b/help.c
index 372728f..97567c4 100644
--- a/help.c
+++ b/help.c
@@ -145,7 +145,7 @@ static void list_commands_in_dir(struct cmdnames *cmds,
len = buf.len;
while ((de = readdir(dir)) != NULL) {
- int entlen;
+ size_t entlen;
if (!starts_with(de->d_name, prefix))
continue;
@@ -156,8 +156,7 @@ static void list_commands_in_dir(struct cmdnames *cmds,
continue;
entlen = strlen(de->d_name) - prefix_len;
- if (ends_with(de->d_name, ".exe"))
- entlen -= 4;
+ strip_suffix(de->d_name, ".exe", &entlen);
add_cmdname(cmds, de->d_name + prefix_len, entlen);
}