commit d9c9d42c90296f4d901bc249049506a3074df78e
parent 65aef9349943b10659a9d182d46f68f8aeae1353
Author: Paco Esteban <paco@e1e0.net>
Date: Thu, 2 Jul 2020 16:40:31 +0200
add basic version to binary
Diffstat:
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/ssnail.1 b/ssnail.1
@@ -27,6 +27,7 @@
.Op Fl r
.Fl t Ar title
.Fl u Ar main_url
+.Op Fl v
.Ar src_folder
.Ar dst_folder
.Sh DESCRIPTION
@@ -76,6 +77,8 @@ Required to generate index and RSS.
.It Fl u Ar main_url
Main url of the site.
Required.
+.It Fl v
+Prints version and exists.
.It Ar src_folder
Folder where all Markdown and other files are located.
Required.
diff --git a/ssnail.c b/ssnail.c
@@ -33,6 +33,8 @@
#include "helpers.h"
#include "ssnail_error.h"
+#define VERSION "1.0"
+
struct article {
size_t htmlz;
size_t origz;
@@ -73,7 +75,7 @@ static const struct ssnail_error *write_rss(char *, char *, char *, char *);
__dead static void
usage(void)
{
- fprintf(stderr, "usage: %s [-F] [-f footer] [-h header] [-i] [-r] "
+ fprintf(stderr, "usage: %s [-F] [-f footer] [-h header] [-i] [-r] [-v] "
"-t <title> -u <url> src_folder dst_folder\n", getprogname());
exit(1);
}
@@ -110,7 +112,7 @@ main(int argc, char *argv[])
goto done;
}
- while ((ch = getopt(argc, argv, "Ff:h:irt:u:")) != -1) {
+ while ((ch = getopt(argc, argv, "Ff:h:irt:u:v")) != -1) {
switch (ch) {
case 'F':
force = 1;
@@ -151,6 +153,9 @@ main(int argc, char *argv[])
goto done;
}
break;
+ case 'v':
+ printf("%s v%s\n", getprogname(), VERSION);
+ return EXIT_SUCCESS;
default:
usage();
}