diff options
author | Markus Uhlin <markus@nifty-networks.net> | 2023-12-13 23:02:38 +0100 |
---|---|---|
committer | Markus Uhlin <markus@nifty-networks.net> | 2023-12-13 23:02:38 +0100 |
commit | 39000494c20e9deadd119a499eb0cc476993cd18 (patch) | |
tree | 66092a498b4c2433d53f45eeee0411d3eef00dd3 /FICS/makerank.c | |
parent | 6d07f5828b57cdda7054ee2284b75b5da8d1fc2d (diff) |
Reformatted SetComputers()
Diffstat (limited to 'FICS/makerank.c')
-rw-r--r-- | FICS/makerank.c | 52 |
1 files 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; |