aboutsummaryrefslogtreecommitdiffstats
path: root/FICS
diff options
context:
space:
mode:
authorMarkus Uhlin <markus@nifty-networks.net>2023-12-31 01:18:39 +0100
committerMarkus Uhlin <markus@nifty-networks.net>2023-12-31 01:18:39 +0100
commite971eb6745177f3d5b626e2387d74cb712c24e0f (patch)
tree73352629a944e2e667301d03446116536f8b8d13 /FICS
parent7909b32588eeccc4f16d3a3f7475927e03d7715a (diff)
Reformatted LoadMsgs()
Diffstat (limited to 'FICS')
-rw-r--r--FICS/playerdb.c61
1 files changed, 34 insertions, 27 deletions
diff --git a/FICS/playerdb.c b/FICS/playerdb.c
index f01a8ba..a51dbb4 100644
--- a/FICS/playerdb.c
+++ b/FICS/playerdb.c
@@ -2014,35 +2014,42 @@ PRIVATE int SaveThisMsg (int which, char *line)
}
}
-PRIVATE int LoadMsgs(int p, int which, textlist **Head)
- /* which=0 to load all messages; it's (p1+1) to load messages only from
- p1, and it's -(p1+1) to load all messages EXCEPT those from p1. */
+/*
+ * which = 0 to load all messages;
+ * it's (p1 + 1) to load messages only from p1;
+ * and it's -(p1 + 1) to load all messages EXCEPT those from p1.
+ */
+PRIVATE int
+LoadMsgs(int p, int which, textlist **Head)
{
- FILE *fp;
- textlist **Cur = Head;
- char fName[MAX_FILENAME_SIZE];
- char line[MAX_LINE_SIZE];
- int n=0, nSave=0;
+ FILE *fp;
+ char fName[MAX_FILENAME_SIZE];
+ char line[MAX_LINE_SIZE];
+ int n = 0, nSave = 0;
+ textlist** Cur = Head;
- *Head = NULL;
- GetMsgFile (p, fName);
- fp = fopen(fName, "r");
- if (fp == NULL) {
- return -1;
- }
- while (!feof(fp)) {
- fgets(line, MAX_LINE_SIZE, fp);
- if (feof(fp))
- break;
- if (SaveThisMsg(which, line)) {
- SaveTextListEntry(Cur, line, ++n);
- Cur = &(*Cur)->next;
- nSave++;
- }
- else n++;
- }
- fclose (fp);
- return nSave;
+ *Head = NULL;
+ GetMsgFile(p, fName);
+
+ if ((fp = fopen(fName, "r")) == NULL)
+ return -1;
+
+ while (!feof(fp)) {
+ fgets(line, sizeof line, fp);
+
+ if (feof(fp))
+ break;
+
+ if (SaveThisMsg(which, line)) {
+ SaveTextListEntry(Cur, line, ++n);
+ Cur = &(*Cur)->next;
+ nSave++;
+ } else
+ n++;
+ }
+
+ fclose(fp);
+ return nSave;
}
/*