From 85fdf0f6b8eef8ce370c6c1c63acfc121c961d9d Mon Sep 17 00:00:00 2001 From: bird Date: Fri, 5 Sep 2008 05:06:31 +0000 Subject: [PATCH] kmk_expr: Fixed regex disabling. git-svn-id: https://www.virtualbox.org/svn/kbuild-mirror/trunk@1739 1093d150-e988-4e3a-8fd4-90e8b09e91e5 --- src/kmk/kmkbuiltin/expr.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/kmk/kmkbuiltin/expr.c b/src/kmk/kmkbuiltin/expr.c index 2206b253..23d7f4f5 100644 --- a/src/kmk/kmkbuiltin/expr.c +++ b/src/kmk/kmkbuiltin/expr.c @@ -13,7 +13,7 @@ #include #ifdef KMK_WITH_REGEX #include -#endif +#endif #include #include #include "err.h" @@ -247,7 +247,7 @@ nexttoken(int pat) } av++; - + if (pat == 0 && p[0] != '\0') { if (p[1] == '\0') { const char *x = "|&=<>+-*/%:()"; @@ -317,11 +317,14 @@ eval5(void) regmatch_t rm[2]; char errbuf[256]; int eval; - struct val *l, *r; + struct val *r; struct val *v; +#endif + struct val *l; l = eval6(); while (token == MATCH) { +#ifdef KMK_WITH_REGEX nexttoken(1); r = eval6(); @@ -359,12 +362,12 @@ eval5(void) regfree(&rp); l = v; +#else + longjmp(g_expr_jmp, errx(2, "regex not supported, sorry.")); +#endif } return l; -#else - longjmp(g_expr_jmp, errx(2, "regex not supported, sorry.")); -#endif } /* Parse and evaluate multiplication and division expressions */ @@ -574,19 +577,19 @@ kmk_builtin_expr(int argc, char *argv[], char **envp) if (!rval) { nexttoken(0); vp = eval0(); - + if (token != EOI) { error(); /* NOTREACHED */ } - + if (vp->type == integer) printf("%d\n", vp->u.i); else printf("%s\n", vp->u.s); - + rval = is_zero_or_null(vp); - } + } /* else: longjmp */ /* cleanup */ -- 2.11.4.GIT