From 4b94c5bf811ef1c35f26b69ecc558a9e1c0d9d26 Mon Sep 17 00:00:00 2001 From: Hiltjo Posthuma Date: Fri, 2 Jan 2015 21:26:36 +0100 Subject: sfeed: add -v flag to display program version --- sfeed.1 | 8 ++++++-- sfeed.c | 7 ++++++- 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); -- cgit v1.2.3