aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/rc/exec.c
diff options
context:
space:
mode:
authorNicholas <nbnoll@eml.cc>2021-11-15 18:54:20 -0800
committerNicholas <nbnoll@eml.cc>2021-11-15 18:54:20 -0800
commita93cc453bd8072e7d79ebe8f00614e1b99eb5852 (patch)
tree12f85f32daf8fce0387b07db6a960b21e3889faf /src/cmd/rc/exec.c
parent5baa63ab502c98f6f62368302d92b6b90f9fcd26 (diff)
Feat: added match keyword
However, it is not tested in the slightest.
Diffstat (limited to 'src/cmd/rc/exec.c')
-rw-r--r--src/cmd/rc/exec.c22
1 files changed, 22 insertions, 0 deletions
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
@@ -712,6 +712,28 @@ Xgoto(void)
}
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)
{
Word *p; // pattern