summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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 *);