about summary refs log tree commit diff
path: root/config.c
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2024-05-22 20:59:47 -0400
committerJune McEnroe <june@causal.agency>2024-05-22 20:59:47 -0400
commit7cfd4a9c8525096fd43e6a33a55b8b175e4e1fdb (patch)
tree18d19b00a5b932c6d5bc5b848090d0bb9c7878ab /config.c
parentRemove use of sysexits.h (diff)
downloadcatgirl-7cfd4a9c8525096fd43e6a33a55b8b175e4e1fdb.tar.gz
catgirl-7cfd4a9c8525096fd43e6a33a55b8b175e4e1fdb.zip
Make the = between options and values optional
Documentation upcoming with wider improvements to the manual,
hopefully.
Diffstat (limited to '')
-rw-r--r--config.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/config.c b/config.c
index be88f2f..e568e40 100644
--- a/config.c
+++ b/config.c
@@ -97,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",
@@ -121,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('?');