aboutsummaryrefslogtreecommitdiffstats
path: root/FICS/utils.c
diff options
context:
space:
mode:
authorMarkus Uhlin <markus@nifty-networks.net>2023-12-25 18:07:52 +0100
committerMarkus Uhlin <markus@nifty-networks.net>2023-12-25 18:07:52 +0100
commitb23aae3ef68623cd2afe167f1fbf7301a216560b (patch)
treeed5aed3068e504a9f1c03f6f3354df6e043a0909 /FICS/utils.c
parent436c2c2bf609ee2da75bf416c4aba9ced14445a1 (diff)
Reformatted pmore_file()
Diffstat (limited to 'FICS/utils.c')
-rw-r--r--FICS/utils.c64
1 files changed, 34 insertions, 30 deletions
diff --git a/FICS/utils.c b/FICS/utils.c
index ad7e6ee..0f2e8ba 100644
--- a/FICS/utils.c
+++ b/FICS/utils.c
@@ -430,39 +430,43 @@ PUBLIC int psend_logoutfile(int p, char *dir, char *file)
return 0;
}
-PUBLIC int pmore_file(int p)
+PUBLIC int
+pmore_file(int p)
{
- FILE *fp;
- char tmp[MAX_LINE_SIZE];
- int lcount = parray[p].d_height - 1;
+ FILE *fp;
+ char tmp[MAX_LINE_SIZE];
+ int lcount = (parray[p].d_height - 1);
- if (!parray[p].last_file) {
- pprintf(p, "There is no more.\n");
- return -1;
- }
- fp = fopen(parray[p].last_file, "r");
- if (!fp) {
- pprintf(p, "File not found!\n");
- return -1;
- }
- fseek(fp, parray[p].last_file_byte, SEEK_SET);
+ if (!parray[p].last_file) {
+ pprintf(p, "There is no more.\n");
+ return -1;
+ }
- while (!feof(fp) && (--lcount > 0)) {
- fgets(tmp, MAX_LINE_SIZE, fp);
- if (!feof(fp)) {
- net_send_string(parray[p].socket, tmp, 1);
- }
- }
- if (!feof(fp)) {
- parray[p].last_file_byte = ftell(fp);
- pprintf(p, "Type [next] to see next page.\n");
- } else {
- rfree(parray[p].last_file);
- parray[p].last_file = NULL;
- parray[p].last_file_byte = 0L;
- }
- fclose(fp);
- return 0;
+ if ((fp = fopen(parray[p].last_file, "r")) == NULL) {
+ pprintf(p, "File not found!\n");
+ return -1;
+ }
+
+ fseek(fp, parray[p].last_file_byte, SEEK_SET);
+
+ while (!feof(fp) && --lcount > 0) {
+ fgets(tmp, MAX_LINE_SIZE, fp);
+
+ if (!feof(fp))
+ net_send_string(parray[p].socket, tmp, 1);
+ }
+
+ if (!feof(fp)) {
+ parray[p].last_file_byte = ftell(fp);
+ pprintf(p, "Type [next] to see next page.\n");
+ } else {
+ rfree(parray[p].last_file);
+ parray[p].last_file = NULL;
+ parray[p].last_file_byte = 0L;
+ }
+
+ fclose(fp);
+ return 0;
}
PUBLIC int