commit 47ee7e8870884e01a3b5bef63094d30cbae59d52 from: Markus Uhlin date: Mon Dec 2 19:56:52 2024 UTC Usage of strcspn() commit - 5742f90fdcbeda996e2dd69c5c3da2da99c44a41 commit + 47ee7e8870884e01a3b5bef63094d30cbae59d52 blob - d851c536d22a7e67940876435748638d8793a27a blob + 05671adab582c9a401ab1001182c2cbefa290688 --- FICS/makerank.c +++ 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++;