while ((de = readdir(dir)) != NULL) {
const char *ent;
- int entlen;
+ size_t entlen;
if (!skip_prefix(de->d_name, prefix, &ent))
continue;
continue;
entlen = strlen(ent);
- if (has_extension(ent, ".exe"))
- entlen -= 4;
+ strip_suffix(ent, ".exe", &entlen);
add_cmdname(cmds, ent, entlen);
}