commit - 3b21cca385c403247960cfe9385dda1d56f28670
commit + f98e9045aef95fe28972d477ee549974c7cefb9f
blob - 3801306c4c6e1ee019b5b3cb1e5e57d3b9f55b78
blob + 472bedff33446af49b6954e29dcbc93ff2361ba2
--- ChangeLog
+++ ChangeLog
2021-06-29 Omar Polo <op@omarpolo.com>
+
+ * gmid.c (main): add -D to define macros from the cmd line
* parse.y (yylex): allow to define macros in the config file
blob - 4fcd5c208da21e5bdd56265a31662c058a456ccd
blob + 93e189561ec10c5b61f69da26f0608dcab452fd0
--- gmid.c
+++ gmid.c
#include <signal.h>
#include <string.h>
-static const char *opts = "6c:d:fH:hnP:p:Vvx:";
+static const char *opts = "6c:D:d:fH:hnP:p:Vvx:";
static struct option longopts[] = {
{"help", no_argument, NULL, 'h'},
{
fprintf(stderr,
"Version: " GMID_STRING "\n"
- "Usage: %s [-fnv] [-c config] [-P pidfile]\n"
+ "Usage: %s [-fnv] [-c config] [-D macro=value] [-P pidfile]\n"
" %s [-6hVv] [-d certs-dir] [-H hostname] [-p port] [-x cgi] [dir]\n",
getprogname(),
getprogname());
config_path = absolutify_path(optarg);
break;
+ case 'D':
+ if (cmdline_symset(optarg) == -1)
+ errx(1, "invalid macro: %s", optarg);
+ break;
+
case 'd':
certs_dir = optarg;
configless = 1;