aboutsummaryrefslogtreecommitdiffstats
path: root/FICS
diff options
context:
space:
mode:
authorMarkus Uhlin <markus@nifty-networks.net>2024-01-03 04:06:48 +0100
committerMarkus Uhlin <markus@nifty-networks.net>2024-01-03 04:06:48 +0100
commit3b30aa0c238cd105ca9a8c3b381e7b6589c0afce (patch)
treed42f9834f64b847fd9e8f92de4f0cd93eadbfde6 /FICS
parent47e8547c32b2f01580b5055097ba80220f7f348f (diff)
Replaced sprintf() calls
Diffstat (limited to 'FICS')
-rw-r--r--FICS/makerank.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/FICS/makerank.c b/FICS/makerank.c
index 22dad8a..d8be7f6 100644
--- a/FICS/makerank.c
+++ b/FICS/makerank.c
@@ -128,8 +128,10 @@ LoadEntries(void)
for (letter1 = 'a'; letter1 <= 'z'; letter1++) {
printf("Loading %c's.\n", letter1);
- sprintf(pathInput, "%s/%c", DEFAULT_PLAYERS, letter1);
- sprintf(command, "ls -1 %s", pathInput);
+
+ snprintf(pathInput, sizeof pathInput, "%s/%c", DEFAULT_PLAYERS,
+ letter1);
+ snprintf(command, sizeof command, "ls -1 %s", pathInput);
if ((fpPlayerList = popen(command, "r")) == NULL)
continue;
@@ -147,8 +149,9 @@ LoadEntries(void)
printf("File %c/%s: wrong directory.\n",
letter1, e.name);
} else {
- sprintf(pathInput, "%s/%c/%s", DEFAULT_PLAYERS,
- letter1, e.name);
+ snprintf(pathInput, sizeof pathInput,
+ "%s/%c/%s", DEFAULT_PLAYERS, letter1,
+ e.name);
if (GetPlayerInfo(pathInput, &e)) {
if ((list[n] = malloc(sizeof(ENTRY))) ==
@@ -184,7 +187,7 @@ SetComputers(int n)
char line[100];
int i = 0;
- sprintf(line, "sort -f %s", COMPUTER_FILE);
+ snprintf(line, sizeof line, "sort -f %s", COMPUTER_FILE);
if ((fpComp = popen(line, "r")) == NULL)
return 0;
@@ -255,7 +258,8 @@ makerank(void)
qsort(sortme, sortnum, sizeof(ENTRY *), sortfunc);
printf("Saving to file.\n");
- sprintf(fName, "%s/rank.%s", DEFAULT_STATS, rnames[rtype]);
+ snprintf(fName, sizeof fName, "%s/rank.%s", DEFAULT_STATS,
+ rnames[rtype]);
if ((fp = fopen(fName, "w")) == NULL)
err(1, "%s: fopen", __func__);