From 47ee7e8870884e01a3b5bef63094d30cbae59d52 Mon Sep 17 00:00:00 2001 From: Markus Uhlin Date: Mon, 2 Dec 2024 20:56:52 +0100 Subject: Usage of strcspn() --- FICS/makerank.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/FICS/makerank.c b/FICS/makerank.c index d851c53..05671ad 100644 --- a/FICS/makerank.c +++ b/FICS/makerank.c @@ -171,7 +171,7 @@ LoadEntries(void) break; len = strlen(e.name); - e.name[len - 1] = '\0'; + e.name[strcspn(e.name, "\n")] = '\0'; if (e.name[0] != letter1) { printf("File %c/%s: wrong directory.\n", @@ -226,7 +226,7 @@ SetComputers(int n) feof(fpComp)) break; - comp[strlen(comp) - 1] = '\0'; + comp[strcspn(comp, "\n")] = '\0'; while (i < n && strcasecmp(list[i]->name, comp) < 0) i++; -- cgit v1.2.3