aboutsummaryrefslogtreecommitdiffstats
path: root/FICS
diff options
context:
space:
mode:
authorMarkus Uhlin <markus@nifty-networks.net>2023-12-25 17:17:46 +0100
committerMarkus Uhlin <markus@nifty-networks.net>2023-12-25 17:17:46 +0100
commit1d3cda0e62bb6550f2a455855f8a970271d825f0 (patch)
tree174a9fa27f41f9e80e5c8c071bc1e112ee7af5bb /FICS
parente302a970a874bc202505fa1d95d595b14f43a609 (diff)
Reformatted lines_file()
Diffstat (limited to 'FICS')
-rw-r--r--FICS/utils.c34
1 files changed, 19 insertions, 15 deletions
diff --git a/FICS/utils.c b/FICS/utils.c
index f77841b..7b2b0bf 100644
--- a/FICS/utils.c
+++ b/FICS/utils.c
@@ -750,23 +750,27 @@ PUBLIC int truncate_file(char *file, int lines)
return 0;
}
-/* Warning, if lines in the file are greater than 1024 bytes in length, this
- won't work! */
-PUBLIC int lines_file(char *file)
+/*
+ * XXX: If lines in the file are greater than 1024 bytes in length,
+ * this won't work!
+ */
+PUBLIC int
+lines_file(char *file)
{
- FILE *fp;
- int lcount = 0;
- char tmp[MAX_LINE_SIZE];
+ FILE *fp;
+ char tmp[MAX_LINE_SIZE];
+ int lcount = 0;
- fp = fopen(file, "r");
- if (!fp)
- return 0;
- while (!feof(fp)) {
- if (fgets(tmp, MAX_LINE_SIZE, fp))
- lcount++;
- }
- fclose(fp);
- return lcount;
+ if ((fp = fopen(file, "r")) == NULL)
+ return 0;
+
+ while (!feof(fp)) {
+ if (fgets(tmp, MAX_LINE_SIZE, fp))
+ lcount++;
+ }
+
+ fclose(fp);
+ return lcount;
}
PUBLIC int