commit - 64923c4b5e7b04f634d578539ccbe12d34d63995
commit + dc7619245dfed3a4b315225e08e20016fa51919b
blob - 84f636fb62d9845169224dd2c4160fb1d95aa06c
blob + 35ed1fc0b58d95616cdff9e3ec506daed556ab1a
--- telescope.1
+++ telescope.1
.Sh SYNOPSIS
.Nm
.Bk -words
-.Op Fl hn
+.Op Fl hnv
.Op Fl c Pa config
.Op Ar URL
.Ek
also features tabs, bookmarks and out-of-band TOFU verification.
.Pp
The arguments are as follows:
-.Bl -tag -width tenletters
-.It Fl h
+.Bl -tag -width xxxxxxxxxxxxx
+.It Fl h , Fl -help
Display version and usage.
.It Fl n
Configtest mode.
By default
.Pa $HOME/.telescope/config
is loaded.
+.It Fl v , Fl -version
+Display version.
.El
.Sh TOFU
.Nm
blob - fd35a63325dd30c4aeb327a6d15f21273aa30761
blob + 8d35fc4661b3de028d157dd30c33f1d6c924a3cb
--- telescope.c
+++ telescope.c
#include <sys/socket.h>
#include <errno.h>
+#include <getopt.h>
#include <limits.h>
#include <signal.h>
#include <stdio.h>
#include "parser.h"
#include "telescope.h"
#include "ui.h"
+
+static struct option longopts[] = {
+ {"help", no_argument, NULL, 'h'},
+ {"version", no_argument, NULL, 'v'},
+ {NULL, 0, NULL, 0},
+};
+
+static const char *opts = "c:hnT:v";
static struct imsgev *iev_fs, *iev_net;
static void __attribute__((noreturn))
usage(int r)
{
- fprintf(stderr, "USAGE: %s [-hn] [-c config] [url]\n", getprogname());
+ fprintf(stderr, "USAGE: %s [-hnv] [-c config] [url]\n",
+ getprogname());
fprintf(stderr, "version: " PACKAGE " " VERSION "\n");
exit(r);
}
strlcpy(path, getenv("HOME"), sizeof(path));
strlcat(path, "/.telescope/config", sizeof(path));
- while ((ch = getopt(argc, argv, "c:hnT:")) != -1) {
+ while ((ch = getopt_long(argc, argv, opts, longopts, NULL)) != -1) {
switch (ch) {
case 'c':
fail = 1;
*optarg);
}
break;
+ case 'v':
+ printf("%s %s\n", PACKAGE_NAME, PACKAGE_VERSION);
+ exit(0);
+ break;
default:
usage(1);
}