Fix: Templates only work when they end with a space or a }
authorNikolas Garofil <garo@dunaldi.garofil.be>
Mon, 23 Nov 2009 11:58:20 +0000 (12:58 +0100)
committerNikolas Garofil <garo@dunaldi.garofil.be>
Mon, 23 Nov 2009 11:58:20 +0000 (12:58 +0100)
src/template.c

index 4cbf21d..e20faf5 100644 (file)
@@ -203,7 +203,7 @@ char *find_and_replace_templates(const char *inbuf)
                if (!(*p))
                        break;
 
-               if (strncmp(p, "$template", 9) && strncmp(p, "${template", 10)) {
+               if (strncmp(p, "$template", strlen("$template")) && strncmp(p, "${template", strlen("${template"))) {
                        *(o++) = *(p++);
                        continue;
                }
@@ -235,7 +235,8 @@ char *find_and_replace_templates(const char *inbuf)
                        }
                } else {
                        templ = p + 1;
-                       while (*p && !isspace(*p))
+                       p += strlen("$template");
+                       while (*p && isdigit(*p))
                                p++;
                        args = NULL;
                }