summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWormHeamer2026-01-01 19:57:19 -0500
committerWormHeamer2026-01-01 19:57:19 -0500
commit01bdae2bde27f764c9c422380040ff21de0579b3 (patch)
treeff2e2ca2a95cfecc84e5760e27a65252fcde23aa
parent590172e546b3ce9da482efd25e8e0a260eb7833a (diff)
don't sort options if empty pattern, don't list .o files
-rw-r--r--main.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/main.c b/main.c
index 3367bee..46c440b 100644
--- a/main.c
+++ b/main.c
@@ -1140,7 +1140,8 @@ u32 sort_opt_idx(u32 *dest, Str *src, u32 n, Str pat, Arena *scratch) {
scrn++;
}
}
- qsort_opt(dest, scr, scrn);
+ if (pat.n > 0)
+ qsort_opt(dest, scr, scrn);
return scrn;
}
@@ -1184,7 +1185,9 @@ again:
DA_APUSH(&opt, &e.scratch, S(".."));
while ((de = readdir(d))) {
if (de->d_name[0] == '.') continue;
- Str n = str_dup(str_from_cstr(de->d_name), &e.scratch);
+ Str dn = str_from_cstr(de->d_name);
+ if (str_ends(dn, S(".o"))) continue;
+ Str n = str_dup(dn, &e.scratch);
DA_APUSH(&opt, &e.scratch, n);
}
int o = select_opt(opt.v, opt.n, S("File: "));