summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHiltjo Posthuma <hiltjo@codemadness.org>2018-03-11 18:32:43 +0100
committerHiltjo Posthuma <hiltjo@codemadness.org>2018-03-11 18:32:43 +0100
commitfbe7d9926bbdafdfb42609aa614ba50a172f3150 (patch)
treec648a87f3058ea0fcbe80141d3d41c11bcf32ba4
parenta28aa0400b28a7655f39e0d2a07a7163c326f052 (diff)
sfeed_tail improvements
keep sfeed_tail until sfeed is reworked to support tail -f (eventually)
-rw-r--r--README1
-rw-r--r--sfeed_tail.c28
-rw-r--r--util.h4
3 files changed, 13 insertions, 20 deletions
diff --git a/README b/README
index b5bbd03..c1ebdc1 100644
--- a/README
+++ b/README
@@ -111,6 +111,7 @@ sfeed_opml_export - Generate an OPML XML file from a sfeedrc config file.
sfeed_opml_import - Generate a sfeedrc config file from an OPML XML file.
sfeed_mbox - Format feed data (TSV) to mbox.
sfeed_plain - Format feed data (TSV) to a plain-text list.
+sfeed_tail - format unseen feed data (TSV) to a plain-text list.
sfeed_update - Update feeds and merge with old feeds in the directory
$HOME/.sfeed/feeds by default.
sfeed_web - Find urls to RSS/Atom feed from a webpage.
diff --git a/sfeed_tail.c b/sfeed_tail.c
index cf0a0ba..18ccb3a 100644
--- a/sfeed_tail.c
+++ b/sfeed_tail.c
@@ -1,3 +1,5 @@
+#include <sys/types.h>
+
#include <ctype.h>
#include <err.h>
#include <locale.h>
@@ -107,26 +109,16 @@ printfeed(FILE *fp, const char *feedname)
if (firsttime)
continue;
- /* output parsed line: it may not be the same as the input. */
- for (i = 0; i < FieldLast; i++) {
- if (i)
- putchar('\t');
- fputs(fields[i], stdout);
+ if (feedname[0]) {
+ printutf8pad(stdout, feedname, 15, ' ');
+ fputs(" ", stdout);
}
- putchar('\n');
- fflush(stdout);
-
-#if 0
- if (fields[FieldFeedName][0])
- printf("%-15.15s ", fields[FieldFeedName]);
- else if (feedname[0])
- printf("%-15.15s ", feedname);
- printf("%04d-%02d-%02d %02d:%02d ",
- tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday,
- tm->tm_hour, tm->tm_min);
+
+ fprintf(stdout, "%04d-%02d-%02d %02d:%02d ",
+ tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday,
+ tm->tm_hour, tm->tm_min);
printutf8pad(stdout, fields[FieldTitle], 70, ' ');
printf(" %s\n", fields[FieldLink]);
-#endif
}
}
@@ -168,7 +160,7 @@ main(int argc, char *argv[])
fclose(fp);
}
}
- // DEBUG: TODO: gc first run.
+ /* DEBUG: TODO: gc first run. */
gc();
sleep(sleepsecs);
diff --git a/util.h b/util.h
index 2d1a184..4542e4e 100644
--- a/util.h
+++ b/util.h
@@ -31,8 +31,8 @@ struct uri {
};
enum {
- FieldUnixTimestamp = 0, FieldTitle, FieldLink,
- FieldContent, FieldContentType, FieldId, FieldAuthor, FieldLast
+ FieldUnixTimestamp = 0, FieldTitle, FieldLink, FieldContent,
+ FieldContentType, FieldId, FieldAuthor, FieldLast
};
int absuri(char *, size_t, const char *, const char *);