From fab547ebc84a6f8913e1c5c7cd6b0f4598f5382c Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Sat, 13 Apr 2024 15:03:37 -0400 Subject: Fix issue with empty command line args --- compile.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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"); -- cgit v1.2.3