From 39000494c20e9deadd119a499eb0cc476993cd18 Mon Sep 17 00:00:00 2001 From: Markus Uhlin Date: Wed, 13 Dec 2023 23:02:38 +0100 Subject: Reformatted SetComputers() --- FICS/makerank.c | 52 ++++++++++++++++++++++++++++------------------------ 1 file changed, 28 insertions(+), 24 deletions(-) diff --git a/FICS/makerank.c b/FICS/makerank.c index b53c722..db59d0e 100644 --- a/FICS/makerank.c +++ b/FICS/makerank.c @@ -134,31 +134,35 @@ int LoadEntries(void) return (n); } -int SetComputers(int n) +static int +SetComputers(int n) { - FILE *fpComp; - int i = 0; - char line[100], comp[30]; - - sprintf(line, "sort -f %s", COMPUTER_FILE); - fpComp = popen(line, "r"); - if (fpComp == NULL) - return 0; - while (i < n) { - fgets(comp, 29, fpComp); - if (feof(fpComp)) - break; - comp[strlen(comp) - 1] = '\0'; - - while (i < n && strcasecmp(list[i]->name, comp) < 0) - i++; - - if (i < n && strcasecmp(list[i]->name, comp) == 0) { - list[i++]->computer = 1; - } - } - pclose(fpComp); - return(1); + FILE *fpComp; + char comp[30]; + char line[100]; + int i = 0; + + sprintf(line, "sort -f %s", COMPUTER_FILE); + + if ((fpComp = popen(line, "r")) == NULL) + return 0; + + while (i < n) { + fgets(comp, 29, fpComp); + + if (feof(fpComp)) + break; + + comp[strlen(comp) - 1] = '\0'; + + while (i < n && strcasecmp(list[i]->name, comp) < 0) + i++; + if (i < n && strcasecmp(list[i]->name, comp) == 0) + list[i++]->computer = 1; + } + + pclose(fpComp); + return 1; } int rtype; -- cgit v1.2.3