Fix:Core:Make commands accept whitespace
authortinloaf <tinloaf@ffa7fe5e-494d-0410-b361-a75ebd5db220>
Sun, 5 Apr 2009 13:38:06 +0000 (13:38 +0000)
committertinloaf <tinloaf@ffa7fe5e-494d-0410-b361-a75ebd5db220>
Sun, 5 Apr 2009 13:38:06 +0000 (13:38 +0000)
git-svn-id: https://navit.svn.sourceforge.net/svnroot/navit/trunk@2185 ffa7fe5e-494d-0410-b361-a75ebd5db220

navit/navit/command.c

index 2fd6382..54cba86 100644 (file)
@@ -131,6 +131,11 @@ get_op(struct context *ctx, int test, ...)
 {
        char *op,*ret=NULL;
        va_list ap;
+
+       while (g_ascii_isspace(*ctx->expr)) {
+               ctx->expr++;
+       }
+
        va_start(ap, test);
        while ((op = va_arg(ap, char *))) {
                if (!strncmp(ctx->expr, op, strlen(op))) {
@@ -303,6 +308,11 @@ eval_value(struct context *ctx, struct result *res) {
        res->var=NULL;
        res->attrnlen=0;
        res->attrn=NULL;
+
+       while (g_ascii_isspace(*op)) {
+               op++;
+       }
+
        if (op[0] >= 'a' && op[0] <= 'z') {
                res->attr.type=attr_none;
                res->var=op;