From 369350956a08b2f2fd987a463c74608b6d289271 Mon Sep 17 00:00:00 2001 From: Hiltjo Posthuma Date: Sun, 21 Jun 2015 00:12:13 +0200 Subject: remove legacy man pages, remove queue.h, remove sfeed_stats --- sfeed_stats.c | 76 ----------------------------------------------------------- 1 file changed, 76 deletions(-) delete mode 100644 sfeed_stats.c (limited to 'sfeed_stats.c') diff --git a/sfeed_stats.c b/sfeed_stats.c deleted file mode 100644 index ecf970d..0000000 --- a/sfeed_stats.c +++ /dev/null @@ -1,76 +0,0 @@ -#include -#include -#include -#include -#include -#include - -#include "queue.h" -#include "util.h" - -static SLIST_HEAD(fhead, feed) fhead = SLIST_HEAD_INITIALIZER(fhead); -static char *line = NULL; - -int -main(void) -{ - char *fields[FieldLast], timenewestformat[64] = ""; - unsigned long totalfeeds = 0, totalnew = 0, totalitems = 0; - unsigned int isnew; - struct feed *f, *fcur = NULL; - time_t parsedtime, comparetime, timenewest = 0; - size_t size = 0; - int r; - - /* 1 day is old news */ - comparetime = time(NULL) - 86400; - - if(!(fcur = calloc(1, sizeof(struct feed)))) - err(1, "calloc"); - SLIST_INSERT_HEAD(&fhead, fcur, entry); - - while(parseline(&line, &size, fields, FieldLast, '\t', stdin) > 0) { - r = strtotime(fields[FieldUnixTimestamp], &parsedtime); - isnew = (r != -1 && parsedtime >= comparetime) ? 1 : 0; - /* first of feed section or new feed section. */ - if(!totalfeeds || strcmp(fcur->name, fields[FieldFeedName])) { - if(!(f = calloc(1, sizeof(struct feed)))) - err(1, "calloc"); - if(!(f->name = strdup(fields[FieldFeedName]))) - err(1, "strdup"); - - SLIST_INSERT_AFTER(fcur, f, entry); - fcur = f; - - if(r != -1 && parsedtime > timenewest) { - timenewest = parsedtime; - strlcpy(timenewestformat, fields[FieldTimeFormatted], - sizeof(timenewestformat)); - } - if(r != -1 && parsedtime > fcur->timenewest) { - fcur->timenewest = parsedtime; - strlcpy(fcur->timenewestformat, fields[FieldTimeFormatted], - sizeof(fcur->timenewestformat)); - } - totalfeeds++; - } - totalnew += isnew; - fcur->totalnew += isnew; - fcur->total++; - totalitems++; - } - SLIST_FOREACH(f, &fhead, entry) { - if(!f->name || f->name[0] == '\0') - continue; - fprintf(stdout, "%c %-20.20s [%4lu/%-4lu]", - f->totalnew > 0 ? 'N' : ' ', - f->name, f->totalnew, f->total); - if(f->timenewestformat && f->timenewestformat[0]) - fprintf(stdout, " %s", f->timenewestformat); - putchar('\n'); - } - printf(" ================================\n"); - printf("%c %-20.20s [%4lu/%-4lu] %s\n", totalnew > 0 ? 'N' : ' ', "Total:", - totalnew, totalitems, timenewestformat); - return 0; -} -- cgit v1.2.3