OSSP CVS Repository

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

ossp-pkg/var/var.c 1.39 -> 1.40

--- var.c        2001/12/04 14:25:06     1.39
+++ var.c        2001/12/08 16:02:15     1.40
@@ -432,7 +432,9 @@
 static int command(const char *, const char *, const var_config_t *,
                    const char_class_t, var_cb_t, void *, int, tokenbuf_t *);
 static int num_exp(const char *begin, const char *end, int current_index,
-                   int* result, const var_config_t *config);
+                   int* result, const var_config_t *config,
+                   const char_class_t nameclass,
+                   var_cb_t lookup, void* lookup_context);
 
 static int text(const char *begin, const char *end, char varinit,
                 char escape)
@@ -508,11 +510,16 @@
     }
 
 static int num_exp_read_operand(const char *begin, const char *end, int current_index,
-                                int* result, const var_config_t *config)
+                                int* result, const var_config_t *config,
+                                const char_class_t nameclass,
+                                var_cb_t lookup, void* lookup_context)
     {
     const char* p = begin;
+    tokenbuf_t tmp;
     int rc;
 
+    tokenbuf_init(&tmp);
+
     if (begin == end)
         return VAR_ERR_INCOMPLETE_INDEX_SPEC;
 
@@ -520,7 +527,7 @@
 
     if (*p == '(')
         {
-        rc = num_exp(++p, end, current_index, result, config);
+        rc = num_exp(++p, end, current_index, result, config, nameclass, lookup, lookup_context);
         if (rc < 0)
             return rc;
         p += rc;
@@ -530,6 +537,18 @@
             return VAR_ERR_UNCLOSED_BRACKET_IN_INDEX;
         ++p;
         }
+    else if (*p == config->varinit)
+        {
+        rc = variable(p, end, config, nameclass, lookup, lookup_context, 1, &tmp);
+        if (rc < 0)
+            return rc;
+        p += rc;
+
+        rc = num_exp(tmp.begin, tmp.end, current_index, result, config, nameclass, lookup, lookup_context);
+        tokenbuf_free(&tmp);
+        if (rc < 0)
+            return rc;
+        }
     else if (config->current_index && *p == config->current_index)
         {
         ++p;
@@ -567,7 +586,9 @@
     }
 
 static int num_exp(const char *begin, const char *end, int current_index,
-                   int* result, const var_config_t *config)
+                   int* result, const var_config_t *config,
+                   const char_class_t nameclass,
+                   var_cb_t lookup, void* lookup_context)
     {
     const char* p = begin;
     char operator;
@@ -577,7 +598,7 @@
     if (begin == end)
         return VAR_ERR_INCOMPLETE_INDEX_SPEC;
 
-    rc = num_exp_read_operand(p, end, current_index, result, config);
+    rc = num_exp_read_operand(p, end, current_index, result, config, nameclass, lookup, lookup_context);
     if (rc < 0)
         return rc;
     p += rc;
@@ -590,7 +611,7 @@
             {
             operator = *p++;
             printf("Operator is '%c'\n", operator);
-            rc = num_exp(p, end, current_index, &right, config);
+            rc = num_exp(p, end, current_index, &right, config, nameclass, lookup, lookup_context);
             if (rc < 0)
                 return rc;
             p += rc;
@@ -607,7 +628,7 @@
             printf("Operator is '%c'\n", operator);
 
 
-            rc = num_exp_read_operand(p, end, current_index, &right, config);
+            rc = num_exp_read_operand(p, end, current_index, &right, config, nameclass, lookup, lookup_context);
             if (rc < 0)
                 return rc;
             p += rc;
@@ -708,7 +729,7 @@
         printf("Found START-INDEX: %s\n", p);
         ++p;
 
-        rc = num_exp(p, end, 0, &index, config);
+        rc = num_exp(p, end, 0, &index, config, nameclass, lookup, lookup_context);
         if (rc < 0)
             goto error_return;
         if (rc == 0)

CVSTrac 2.0.1