From 9ca4205b38e5f8a5f631449e1db070ae2ff2a297 Mon Sep 17 00:00:00 2001 From: Markus Uhlin Date: Wed, 20 Dec 2023 00:06:44 +0100 Subject: Reformatted rscan_news() plus 'time_t' fixes --- FICS/command.c | 43 ++++++++++++++++++++++++++----------------- 1 file changed, 26 insertions(+), 17 deletions(-) (limited to 'FICS/command.c') diff --git a/FICS/command.c b/FICS/command.c index a6b403b..5ee2f46 100644 --- a/FICS/command.c +++ b/FICS/command.c @@ -534,26 +534,35 @@ void boot_out(int p, int p1) net_close_connection(fd); } -PUBLIC void rscan_news(FILE *fp, int p, int lc) { +PUBLIC void +rscan_news(FILE *fp, int p, int lc) +{ + char *junkp; + char count[10]; + char junk[MAX_LINE_SIZE]; + long int lval; + time_t crtime; - char junk[MAX_LINE_SIZE], count[10]; - int crtime; - char *junkp; + fgets(junk, MAX_LINE_SIZE, fp); - fgets(junk, MAX_LINE_SIZE, fp); - if (feof(fp)) - return; - sscanf(junk, "%d %s", &crtime, count); + if (feof(fp)) + return; - if (crtime - lc < 0) - return; - else { - rscan_news(fp, p, lc); - junkp = junk; - junkp = nextword(junkp); - junkp = nextword(junkp); - pprintf(p, "%3s (%s) %s", count, fix_time(strltime(&crtime)), junkp); - } + sscanf(junk, "%ld %s", &lval, count); + crtime = lval; + + if ((crtime - lc) < 0) + return; + else { + rscan_news(fp, p, lc); + + junkp = junk; + junkp = nextword(junkp); + junkp = nextword(junkp); + + pprintf(p, "%3s (%s) %s", count, fix_time(strltime(&crtime)), + junkp); + } } PRIVATE void -- cgit v1.2.3