OSSP CVS Repository

ossp - Difference in ossp-pkg/var/var.c versions 1.76 and 1.77
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [History

ossp-pkg/var/var.c 1.76 -> 1.77

--- var.c        2002/03/04 11:53:27     1.76
+++ var.c        2002/03/04 12:01:53     1.77
@@ -447,6 +447,25 @@
 static int parse_numexp (var_t *var, var_parse_t *ctx, const char *begin, const char *end, int *result, int *failed);
 static int parse_name   (var_t *var, var_parse_t *ctx, const char *begin, const char *end);
 
+/* parse pattern text */
+static int 
+parse_pattern(
+    var_t *var, var_parse_t *ctx,
+    const char *begin, const char *end)
+{
+    const char *p;
+
+    /* parse until '/' */
+    for (p = begin; p != end && *p != '/'; p++) {
+        if (*p == var->syntax.escape) {
+            if (p + 1 == end)
+                return VAR_ERR_INCOMPLETE_QUOTED_PAIR;
+            p++;
+        }
+    }
+    return (p - begin);
+}
+
 /* parse substitution text */
 static int 
 parse_substext(
@@ -1283,9 +1302,10 @@
             if (*p != '/')
                 return VAR_ERR_MALFORMATTED_REPLACE;
             p++;
-            rc = parse_substext_or_variable(var, ctx, p, end, &search);
+            rc = parse_pattern(var, ctx, p, end);
             if (rc < 0)
                 goto error_return;
+            tokenbuf_set(&search, p, p + rc, 0);
             p += rc;
             if (*p != '/') {
                 rc = VAR_ERR_MALFORMATTED_REPLACE;

CVSTrac 2.0.1