From a93cc453bd8072e7d79ebe8f00614e1b99eb5852 Mon Sep 17 00:00:00 2001 From: Nicholas Date: Mon, 15 Nov 2021 18:54:20 -0800 Subject: Feat: added match keyword However, it is not tested in the slightest. --- src/cmd/rc/exec.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'src/cmd/rc/exec.c') diff --git a/src/cmd/rc/exec.c b/src/cmd/rc/exec.c index 62375df..2bdaebd 100644 --- a/src/cmd/rc/exec.c +++ b/src/cmd/rc/exec.c @@ -711,6 +711,28 @@ Xgoto(void) runner->code.i = runner->code.exe[runner->code.i].i; } +void +Xmatch(void) +{ + Word *p; + Word *s; + + for(p=runner->args->word; p; p=p->link){ + for(s=runner->args->link->word; s; s=s->link){ + if(match(s->str, p->str, 0)) + goto match; + } + } +nomatch: + runner->status = 0; + goto cleanup; +match: + runner->status = 1; +cleanup: + poplist(); + poplist(); +} + void Xcase(void) { -- cgit v1.2.1