aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOmar Polo <op@omarpolo.com>2022-09-08 21:34:29 +0000
committerOmar Polo <op@omarpolo.com>2022-09-08 21:34:29 +0000
commitaae8f6bf2b6be18c8bb4fc46c2df679110fe9d96 (patch)
tree69a40c5956d65168894b8a6d2bdb04e3887bfd8b
parent3eabd37fe7586fca2ca5f83411849ff7dd4cebd2 (diff)
change the flags to be consistent with other OpenBSD daemons
-d is `debug' (run in the foreground) -f to load the configuration file adjust regress and contrib accordingly
-rw-r--r--ChangeLog4
-rw-r--r--contrib/gmid.service2
-rw-r--r--gmid.817
-rw-r--r--gmid.c14
-rw-r--r--regress/lib.sh6
5 files changed, 24 insertions, 19 deletions
diff --git a/ChangeLog b/ChangeLog
index 6540752..f2365fd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2022-09-08 Omar Polo <op@omarpolo.com>
+
+ * gmid.c (main): change the flags to be consisent with other OpenBSD daemons
+
2022-09-07 Omar Polo <op@omarpolo.com>
* ge.c (main): add `ge': small program to quickly export a directory over Gemini.
diff --git a/contrib/gmid.service b/contrib/gmid.service
index 3090f38..ce216f9 100644
--- a/contrib/gmid.service
+++ b/contrib/gmid.service
@@ -8,7 +8,7 @@ Wants=network-online.target
Type=simple
User=gmid
Group=nobody
-ExecStart=/usr/local/bin/gmid -f -c /etc/gmid.conf
+ExecStart=/usr/local/bin/gmid -d -f /etc/gmid.conf
ExecStop=/bin/kill -TERM $MAINPID
ExecReload=/bin/kill -HUP $MAINPID
Restart=on-failure
diff --git a/gmid.8 b/gmid.8
index f1581ce..91cbbbc 100644
--- a/gmid.8
+++ b/gmid.8
@@ -20,9 +20,9 @@
.Sh SYNOPSIS
.Nm
.Bk -words
-.Op Fl fhnVv
-.Op Fl c Ar config
+.Op Fl dhnVv
.Op Fl D Ar macro Ns = Ns Ar value
+.Op Fl f Ar config
.Op Fl P Ar pidfile
.Ek
.Sh DESCRIPTION
@@ -38,10 +38,6 @@ rereads the configuration file when it receives
.Pp
The options are as follows:
.Bl -tag -width 14m
-.It Fl c Ar config
-Specifies the configuration file.
-The default is
-.Pa /etc/gmid.conf .
.It Fl D Ar macro Ns = Ns Ar value
Define
.Ar macro
@@ -51,8 +47,13 @@ on the command line.
Overrides the definition of
.Ar macro
in the config file if present.
-.It Fl f
-Stays and logs on the foreground.
+.It Fl d
+Debug mode.
+Do not daemonize and log to stderr.
+.It Fl f Ar config
+Specifies the configuration file.
+The default is
+.Pa /etc/gmid.conf .
.It Fl h , Fl -help
Print the usage and exit.
.It Fl n
diff --git a/gmid.c b/gmid.c
index 61e7dc7..83e3be7 100644
--- a/gmid.c
+++ b/gmid.c
@@ -27,7 +27,7 @@
#include <signal.h>
#include <string.h>
-static const char *opts = "c:D:fhnP:Vv";
+static const char *opts = "D:df:hnP:Vv";
static const struct option longopts[] = {
{"help", no_argument, NULL, 'h'},
@@ -356,7 +356,7 @@ usage(void)
{
fprintf(stderr,
"Version: " GMID_STRING "\n"
- "Usage: %s [-fnv] [-c config] [-D macro=value] [-P pidfile]\n",
+ "Usage: %s [-dhnVv] [-D macro=value] [-f config] [-P pidfile]\n",
getprogname());
}
@@ -453,20 +453,20 @@ main(int argc, char **argv)
while ((ch = getopt_long(argc, argv, opts, longopts, NULL)) != -1) {
switch (ch) {
- case 'c':
- config_path = absolutify_path(optarg);
- break;
-
case 'D':
if (cmdline_symset(optarg) == -1)
fatal("could not parse macro definition: %s",
optarg);
break;
- case 'f':
+ case 'd':
conf.foreground = 1;
break;
+ case 'f':
+ config_path = absolutify_path(optarg);
+ break;
+
case 'h':
usage();
return 0;
diff --git a/regress/lib.sh b/regress/lib.sh
index e8da907..fe47fb6 100644
--- a/regress/lib.sh
+++ b/regress/lib.sh
@@ -92,8 +92,8 @@ EOF
}
checkconf() {
- if ! $gmid -n -c reg.conf >/dev/null 2>&1; then
- $gmid -n -c reg.conf
+ if ! $gmid -n -f reg.conf >/dev/null 2>&1; then
+ $gmid -n -f reg.conf
fi
}
@@ -158,7 +158,7 @@ run() {
return
fi
- $gmid -P gmid.pid -c reg.conf
+ $gmid -P gmid.pid -f reg.conf
# give gmid time to bind the port, otherwise we end up
# executing gg when gmid isn't ready yet.