From f96ed9c1f3f0d80d6277bdf6d9c143704fd0fe39 Mon Sep 17 00:00:00 2001 From: DTB Date: Fri, 19 Jul 2024 19:34:37 -0600 Subject: [PATCH] scrut(1): fix syntax error --- src/scrut.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/scrut.c b/src/scrut.c index cb84f33..5e41def 100644 --- a/src/scrut.c +++ b/src/scrut.c @@ -48,8 +48,9 @@ int main(int argc, char *argv[]) { else { sel[p - args] = c; } } - /* straighten out selections */ - for (size_t i = 0, p = sel; i < (sizeof sel) / (sizeof *sel); ++i) { + /* straighten out selections; permute out nulls */ + p = sel; + for (size_t i = 0; i < (sizeof sel) / (sizeof *sel); ++i) { if (sel[i] != '\0') { *p = sel[i]; if (&sel[i] != p++) { sel[i] = '\0'; }