From 7170ac01c4f4603586661761ba685d2d3c2d69bc Mon Sep 17 00:00:00 2001 From: Martijn Dekker Date: Wed, 4 Sep 2024 14:19:03 +0100 Subject: [PATCH] mamake: %{VAR|script}/%{VAR@script}: expand MAM vars (re: f58153d4) A minor omission: %{...} was not expanded in the one-line scriptlet before passing it to the shell. While the Mamfiles don't currently use or require this, it's only logical to do so. src/cmd/INIT/mamake.c: substitute(): case '|': - When adding the script code to the buffer, use a recursive substitute() call instead of an append() call. --- src/cmd/INIT/mamake.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/cmd/INIT/mamake.c b/src/cmd/INIT/mamake.c index 0164a402738e..5a1c98d8e0be 100644 --- a/src/cmd/INIT/mamake.c +++ b/src/cmd/INIT/mamake.c @@ -28,7 +28,7 @@ * coded for portability */ -#define RELEASE_DATE "2024-08-24" +#define RELEASE_DATE "2024-09-94" static char id[] = "\n@(#)$Id: mamake (ksh 93u+m) " RELEASE_DATE " $\0\n"; #if _PACKAGE_ast @@ -892,7 +892,7 @@ static void substitute(Buf_t *buf, char *s) int valid_sh_name; /* if set, the variable name is valid in sh(1) */ int newexp; /* if set, %{...}, otherwise ${...} */ char *vnterm; /* pointer to byte following variable name */ - char **argv; /* argument list for %{var^arbitrary sh(1) commands} */ + char **argv; /* argument list for %{variable@sh script} */ while (c = *s++) { @@ -1069,7 +1069,7 @@ static void substitute(Buf_t *buf, char *s) add(scr, '<'), append(scr, in); add(scr, '>'), append(scr, out), add(scr, '\n'); n = *s, *s = 0; /* change final '}' to string terminator */ - append(scr, t); + substitute(scr, t); q = use(scr); if ((argv ? (argv[2] = q, execute_v(NULL, argv)) : execute(NULL, q)) != 0) error_out("expansion script error", t);