From 7b49af8a47a0346e3659ea76073f8b15b5c0654d Mon Sep 17 00:00:00 2001 From: Markus Uhlin Date: Mon, 8 Apr 2024 22:28:10 +0200 Subject: Switched to the usage of warn() --- FICS/ratings.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/FICS/ratings.c b/FICS/ratings.c index e3dd748..f37cf3d 100644 --- a/FICS/ratings.c +++ b/FICS/ratings.c @@ -30,6 +30,8 @@ #include "stdinclude.h" #include "common.h" +#include + #include "command.h" #include "comproc.h" #include "config.h" @@ -321,7 +323,7 @@ load_ratings(void) STATS_VERSION); if ((fp = fopen(fname, "r")) == NULL) { - fprintf(stderr, "FICS: Can't read ratings data!\n"); + warn("%s: can't read ratings data", __func__); return; } @@ -377,7 +379,7 @@ save_ratings(void) STATS_VERSION); if ((fp = fopen(fname, "w")) == NULL) { - fprintf(stderr, "FICS: Can't write ratings data!\n"); + warn("%s: can't write ratings data", __func__); return; } @@ -1426,14 +1428,14 @@ UpdateRank(int type, char *addName, statistics *sNew, char *delName) return; if ((fp = fopen(RankFile, "r")) == NULL) { - fprintf(stderr, "Can't open rank file to update.\n"); + warn("%s: can't open rank file to update", __func__); return; } snprintf(TmpRankFile, sizeof TmpRankFile, "%s/tmpRank", sdir); if ((fptemp = fopen(TmpRankFile, "w")) == NULL) { - fprintf(stderr, "Unable to open rank file for updating.\n"); + warn("%s: unable to open rank file for updating", __func__); return; } @@ -1469,10 +1471,8 @@ UpdateRank(int type, char *addName, statistics *sNew, char *delName) snprintf(command, sizeof command, "mv %s %s", TmpRankFile, RankFile); system(command); #else - if (rename(TmpRankFile, RankFile) == -1) { - (void) fprintf(stderr, "FICS: %s: warning: rename(): %s\n", - __func__, strerror(errno)); - } + if (rename(TmpRankFile, RankFile) == -1) + warn("%s: rename()", __func__); UNUSED_VAR(command); #endif } -- cgit v1.2.3