aboutsummaryrefslogtreecommitdiffstats
path: root/FICS/obsproc.c
diff options
context:
space:
mode:
authorMarkus Uhlin <markus@nifty-networks.net>2024-04-23 19:22:41 +0200
committerMarkus Uhlin <markus@nifty-networks.net>2024-04-23 19:22:41 +0200
commit9d57b886206d7f423bb0fffbbdae1bab24783b48 (patch)
treeb03915f1f28d5bfaf23c7668a396cf6dba33b7c9 /FICS/obsproc.c
parent2ccd8739eb6b350094fc45a8511e1cc4688c12ec (diff)
Revised ExamineJournal()
Diffstat (limited to 'FICS/obsproc.c')
-rw-r--r--FICS/obsproc.c53
1 files changed, 31 insertions, 22 deletions
diff --git a/FICS/obsproc.c b/FICS/obsproc.c
index 0f6d417..fd0b0f9 100644
--- a/FICS/obsproc.c
+++ b/FICS/obsproc.c
@@ -827,31 +827,40 @@ PRIVATE void ExamineHistory(int p, int p1, int game)
return;
}
-PRIVATE void ExamineJournal(int p,int p1,char slot)
+PRIVATE void
+ExamineJournal(int p, int p1, char slot)
{
- char fname[MAX_FILENAME_SIZE];
- char* name_from = parray[p1].login;
- FILE *fpGame;
+ FILE *fpGame;
+ char *name_from = parray[p1].login;
+ char fname[MAX_FILENAME_SIZE] = { '\0' };
- if ((parray[p1].jprivate) && (p != p1) && (parray[p].adminLevel < ADMIN_ADMIN)) {
- pprintf (p,"Sorry, this journal is private.\n");
- return;
- }
- if (((slot - 'a' - 1) > MAX_JOURNAL) && (parray[p1].adminLevel < ADMIN_ADMIN)
-&& (!titled_player(p,parray[p1].login))) {
- pprintf (p,"%s's maximum journal entry is %c\n",parray[p1].name,toupper((char)(MAX_JOURNAL + 'A' - 1)));
- return;
- }
+ if ((parray[p1].jprivate) &&
+ (p != p1) &&
+ (parray[p].adminLevel < ADMIN_ADMIN)) {
+ pprintf(p, "Sorry, this journal is private.\n");
+ return;
+ }
- sprintf(fname, "%s/%c/%s.%c", journal_dir, name_from[0],name_from,slot);
- fpGame = fopen(fname, "r");
- if (fpGame == NULL) {
- pprintf(p, "Journal entry %c is not available for %s.\n", toupper (slot), parray[p1].name);
- } else {
- ExamineStored(fpGame, p, fname);
- fclose(fpGame);
- }
- return;
+ if (((slot - 'a' - 1) > MAX_JOURNAL) &&
+ (parray[p1].adminLevel < ADMIN_ADMIN) &&
+ (!titled_player(p,parray[p1].login))) {
+ pprintf(p, "%s's maximum journal entry is %c\n",
+ parray[p1].name,
+ toupper((char)(MAX_JOURNAL + 'A' - 1)));
+ return;
+ }
+
+ msnprintf(fname, sizeof fname, "%s/%c/%s.%c", journal_dir, name_from[0],
+ name_from, slot);
+
+ if ((fpGame = fopen(fname, "r")) == NULL) {
+ pprintf(p, "Journal entry %c is not available for %s.\n",
+ toupper(slot),
+ parray[p1].name);
+ } else {
+ ExamineStored(fpGame, p, fname);
+ fclose(fpGame);
+ }
}
PUBLIC int