aruu

[MIRROR] Actual replacement for Busybox | suckless
git clone https://git.daat.foo/aruu.git
Log | Files | Refs | README | LICENSE

commit abd19f7e2d601e8272593483c103e35ae570fb4e
parent 44c68abc4fa45da0318c98023d6229fb315f0b24
Author: xplshn <anto@xplshn.com.ar>
Date:   Mon, 23 Nov 2026 01:22:26 -0300

make: ?=

Diffstat:
Acmd/dev/ninqu/ninqu | 0
Mcmd/posix/make/parser.c | 28++++++++++++++++++++++++++++
2 files changed, 28 insertions(+), 0 deletions(-)

diff --git a/cmd/dev/ninqu/ninqu b/cmd/dev/ninqu/ninqu Binary files differ. diff --git a/cmd/posix/make/parser.c b/cmd/posix/make/parser.c @@ -1119,6 +1119,15 @@ repeat: break; } error("unexpected character '+'"); + case '?': + if (nextc() == '=') { + token[0] = '?'; + token[1] = '='; + token[2] = '\0'; + tok = '?'; + break; + } + error("unexpected character '?'"); case '!': if (nextc() == '=') { token[0] = '!'; @@ -1309,6 +1318,22 @@ assign_append(char *macros[], int where, int n) free(defs); } +/* ?= sets a macro only when nothing, the environment included, has */ +static void +assign_default(char *macros[], int where, int n) +{ + char *defs; + + if (n != 1) + error("invalid macro definition"); + + skipspaces(); + defs = readmacrodef(); + if (*getmacro(*macros) == '\0') + setmacro(*macros, defs, where, NOEXPORT); + free(defs); +} + static void assign_shell(char *macros[], int where, int n) { @@ -1380,6 +1405,9 @@ parseinput(int where) case '+': assign_append(targets, where, n); break; + case '?': + assign_default(targets, where, n); + break; case '!': assign_shell(targets, where, n); break;