aboutsummaryrefslogtreecommitdiff
path: root/compile.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-04-13 15:03:37 -0400
committerBruce Hill <bruce@bruce-hill.com>2024-04-13 15:03:37 -0400
commitfab547ebc84a6f8913e1c5c7cd6b0f4598f5382c (patch)
treea5f980c2ca7bffd73fbfd1354761c3d55f17f500 /compile.c
parent63e6ba596ae8e35727289a69b11d5640bfc5e49e (diff)
Fix issue with empty command line args
Diffstat (limited to 'compile.c')
-rw-r--r--compile.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/compile.c b/compile.c
index 4dcfeb4a..8de13b2c 100644
--- a/compile.c
+++ b/compile.c
@@ -1904,7 +1904,7 @@ static CORD compile_main_arg_parser(env_t *env, const char *module_name, type_t
usage = CORD_all(usage, "<", flag, ">");
}
}
- code = CORD_all(code, "CORD $usage = CORD_all(\"Usage: \", argv[0], ", Text$quoted(usage, false), ");\n",
+ code = CORD_all(code, "CORD $usage = CORD_all(\"Usage: \", argv[0], ", usage ? Text$quoted(usage, false) : "CORD_EMPTY", ");\n",
"#define $USAGE_ERR(...) errx(1, CORD_to_const_char_star(CORD_all(__VA_ARGS__)))\n"
"#define $IS_FLAG(str, flag) (strncmp(str, flag, strlen(flag) == 0 && (str[strlen(flag)] == 0 || str[strlen(flag)] == '=')) == 0)\n");