From 64ba9f7bcc4bb3b53c0cab303c230855a1443a42 Mon Sep 17 00:00:00 2001 From: Pavel Machek Date: Fri, 2 Jun 2000 08:01:12 +0000 Subject: Do not try to divide by zero. --- filter/filter.c | 3 ++- filter/test.conf | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'filter') diff --git a/filter/filter.c b/filter/filter.c index 232a2d2..776ad55 100644 --- a/filter/filter.c +++ b/filter/filter.c @@ -283,7 +283,8 @@ interpret(struct f_inst *what) TWOARGS_C; switch (res.type = v1.type) { case T_VOID: runtime( "Can not operate with values of type void" ); - case T_INT: res.val.i = v1.val.i / v2.val.i; break; + case T_INT: if (v2.val.i == 0) runtime( "Mother told me not to divide by 0" ); + res.val.i = v1.val.i / v2.val.i; break; case T_IP: if (v2.type != T_INT) runtime( "Operator / is /" ); break; diff --git a/filter/test.conf b/filter/test.conf index c1d5977..1b635cb 100644 --- a/filter/test.conf +++ b/filter/test.conf @@ -1,5 +1,6 @@ /* * This is an example configuration file. + * FIXME: add all examples from docs here. */ # Yet another comment -- cgit v1.2.3