about summary refs log tree commit diff
path: root/Src/cond.c
diff options
context:
space:
mode:
Diffstat (limited to 'Src/cond.c')
-rw-r--r--Src/cond.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/Src/cond.c b/Src/cond.c
index 79886a720..ed91f72f3 100644
--- a/Src/cond.c
+++ b/Src/cond.c
@@ -43,6 +43,26 @@ evalcond(Cond c)
 	return evalcond(c->left) && evalcond(c->right);
     case COND_OR:
 	return evalcond(c->left) || evalcond(c->right);
+    case COND_MOD:
+    case COND_MODI:
+	{
+	    Conddef cd;
+
+	    if ((cd = getconddef((c->type == COND_MODI), (char *) c->left, 1))) {
+		if (c->type == COND_MOD) {
+		    int l = arrlen((char **) c->right);
+
+		    if (l < cd->min || (cd->max >= 0 && l > cd->max)) {
+			zerr("unrecognized condition: `-%s'", (char *) c->left, 0);
+			return 0;
+		    }
+		}
+		return cd->handler(cd, (char **) c->right);
+	    }
+	    else
+		zerr("unrecognized condition: `-%s'", (char *) c->left, 0);
+	    return 0;
+	}
     }
     singsub((char **)&c->left);
     untokenize(c->left);