commit - 2c43dcceb6f462a46da93b6e9a6b3c4617e70823
commit + 5777923bb08a51b04537a127c8514186cd276a70
blob - ffa64523bc5495b62ee6ada67128a7e74d5d19bd
blob + cc360c4901c08c5bd5da70304cab9f3e9ba19a71
--- ChangeLog
+++ ChangeLog
+2021-06-29 Omar Polo <op@omarpolo.com>
+
+ * gmid.c (main): use getopt_long, add --help as synonym of -h and -V/--version
+
2021-06-17 Omar Polo <op@omarpolo.com>
* gmid.1: document `log' option
blob - bbfb30857b1c4614cef1947cf1fc26d9317562b4
blob + 7337a9a579a0279c91ea67c8b8585eaadccfcf73
--- gmid.c
+++ gmid.c
#include <errno.h>
#include <fcntl.h>
+#include <getopt.h>
#include <libgen.h>
#include <limits.h>
#include <pwd.h>
#include <signal.h>
#include <string.h>
+static const char *opts = "6c:d:fH:hnP:p:Vvx:";
+
+static struct option longopts[] = {
+ {"help", no_argument, NULL, 'h'},
+ {"version", no_argument, NULL, 'V'},
+ {NULL, 0, NULL, 0},
+};
+
struct fcgi fcgi[FCGI_MAX];
struct vhosthead hosts;
init_config();
- while ((ch = getopt(argc, argv, "6c:d:fH:hnP:p:vx:")) != -1) {
+ while ((ch = getopt_long(argc, argv, opts, longopts, NULL)) != -1) {
switch (ch) {
case '6':
conf.ipv6 = 1;
configless = 1;
break;
+ case 'V':
+ puts("Version: 1.7");
+ return 0;
+
case 'v':
conf.verbose++;
break;