summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHiltjo Posthuma <hiltjo@codemadness.org>2015-01-02 21:26:36 +0100
committerHiltjo Posthuma <hiltjo@codemadness.org>2015-01-02 21:26:36 +0100
commit4b94c5bf811ef1c35f26b69ecc558a9e1c0d9d26 (patch)
tree15ff6b4b6110088c0c36e0db87367a69fb226283
parent86993965de423bdd9f4cfb146929a1cdd9fbc0b2 (diff)
sfeed: add -v flag to display program version
-rw-r--r--sfeed.18
-rw-r--r--sfeed.c7
2 files changed, 12 insertions, 3 deletions
diff --git a/sfeed.1 b/sfeed.1
index f641b83..edf5676 100644
--- a/sfeed.1
+++ b/sfeed.1
@@ -5,12 +5,16 @@
.Nm sfeed
.Nd simple RSS and Atom parser
.Sh SYNOPSIS
-.Nm sfeed
-.Op Ar suffix string
+.Nm
+.Op Ar suffix string | Fl Ar v
.Sh DESCRIPTION
.Nm
reads RSS or Atom feed data (XML) from stdin. It writes the feed data in a
tab-separated format to stdout.
+.Sh OPTIONS
+.Bl -tag -width 17n
+.It Fl v
+show program version
.Sh TAB-SEPARATED FORMAT FIELDS
.Pp
The items are saved in a TSV-like format except newlines, tabs and
diff --git a/sfeed.c b/sfeed.c
index 39b8a04..0d334ff 100644
--- a/sfeed.c
+++ b/sfeed.c
@@ -727,8 +727,13 @@ xml_handler_end_element(XMLParser *p, const char *name, size_t namelen, int issh
int
main(int argc, char *argv[])
{
- if(argc > 1)
+ if(argc > 1) {
append = argv[1];
+ if(!strcmp(argv[1], "-v")) {
+ printf("%s\n", VERSION);
+ return 0;
+ }
+ }
/* init strings and initial memory pool size */
string_buffer_init(&ctx.item.timestamp, 64);