commit ac7c88fc13a04eb9a096e1adebbbfb35aa3498df
parent dd8ab03c7685498c22ab2833b742004014588696
Author: hhvn <dev@hhvn.uk>
Date: Sun, 6 Jun 2021 00:49:16 +0100
main.c hfingerd.8: toggle verbosity
Diffstat:
2 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/hfingerd.8 b/hfingerd.8
@@ -6,12 +6,14 @@
.Nd hhvn's finger daemon
.Sh SYNOPSIS
.Nm
-.Op Fl Cc
+.Op Fl vCc
.Op Fl h Ar host
.Op Fl p Ar port
.Op Fl f Ar planfile
.Sh OPTIONS
.Bl -tag -width "-f planfile"
+.It Fl v
+Turn on verbosity
.It Fl C
Turn off CGI
.It Fl c
diff --git a/main.c b/main.c
@@ -22,13 +22,15 @@
char *host = "localhost",
*port = "79",
*planfile = ".plan";
-int usecgi = 1; /* except this bool */
+/* except bools */
+int usecgi = 1,
+ verbosebool = 0;
char *argv0;
void
usage(void) {
- printf("usage: %s [-Cc] [-h host] [-p port] [-f planfile]\n", basename(argv0));
+ printf("usage: %s [-vCc] [-h host] [-p port] [-f planfile]\n", basename(argv0));
exit(EXIT_USAGE);
}
@@ -36,6 +38,9 @@ int
verbose(const char *format, ...) {
va_list ap;
+ if (!verbosebool)
+ return 0;
+
va_start(ap, format);
vfprintf(stderr, format, ap);
va_end(ap);
@@ -154,6 +159,9 @@ main(int argc, char *argv[]) {
case 'C':
usecgi = 0;
break;
+ case 'v':
+ verbosebool = 1;
+ break;
} ARGEND;
memset(&hints, 0, sizeof(hints));