summary refs log tree commit diff
path: root/config.c
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2026-03-16 23:01:01 -0400
committerJune McEnroe <june@causal.agency>2026-03-16 23:01:01 -0400
commit60cbef45a90054c408a6ccaf043c31670fc37911 (patch)
treea74fee14d5cec7d49ca8f6edaed2f991b7c78ff5 /config.c
parentRemove pounce-palaver and related pieces (diff)
downloadpounce-3.2.tar.gz
pounce-3.2.zip
Make the = between options and values optional HEAD 3.2 master
Diffstat (limited to '')
-rw-r--r--config.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/config.c b/config.c
index 30d7c6c..2310e83 100644
--- a/config.c
+++ b/config.c
@@ -26,7 +26,9 @@
  */
 
 #include <err.h>
+#include <errno.h>
 #include <getopt.h>
+#include <limits.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -95,13 +97,6 @@ int getopt_config(
 			}
 
 			char *equal = &name[len] + strspn(&name[len], WS);
-			if (*equal && *equal != '=') {
-				warnx(
-					"%s:%zu: option `%s' missing equals sign",
-					path, num, option->name
-				);
-				return clean('?');
-			}
 			if (option->has_arg == no_argument && *equal) {
 				warnx(
 					"%s:%zu: option `%s' doesn't allow an argument",
@@ -119,8 +114,11 @@ int getopt_config(
 
 			optarg = NULL;
 			if (*equal) {
-				char *arg = &equal[1] + strspn(&equal[1], WS);
-				optarg = strdup(arg);
+				if (*equal == '=') {
+					optarg = strdup(&equal[1] + strspn(&equal[1], WS));
+				} else {
+					optarg = strdup(equal);
+				}
 				if (!optarg) {
 					warn("getopt_config");
 					return clean('?');