OSSP CVS Repository

ossp - Difference in ossp-pkg/var/var.pod versions 1.8 and 1.9
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [History

ossp-pkg/var/var.pod 1.8 -> 1.9

--- var.pod      2001/11/20 15:46:35     1.8
+++ var.pod      2001/12/03 10:51:27     1.9
@@ -201,6 +201,9 @@
         char varinit;
         char startdelim;
         char enddelim;
+        char startindex;
+        char endindex;
+        char current_index;
         char escape;
         char *namechars;
     } var_config_t;
@@ -218,6 +221,9 @@
         '$',              /* varinit */
         '{',              /* startdelim */
         '}',              /* enddelim */
+        '[',              /* startindex */
+        ']',              /* endindex */
+        '#',              /* current_index */
         '\\',             /* escape */
         "a-zA-Z0-9_"      /* namechars */
     };
@@ -304,7 +310,7 @@
 function, which adheres to the var_cb_t function interface:
 
     int lookup(void *context,
-               const char *varname, size_t name_len,
+               const char *varname, size_t name_len, int index,
                const char **data, size_t *data_len,
                size_t *buffer_size);
 
@@ -336,6 +342,14 @@
 The "name_len" parameter contains the length of the variable name
 "varname" points to.
 
+=item int index
+
+The contents of this interger determines which entry of a variable
+array to look-up. If the variable specification that led to the
+execution of the lookup function did not contain an index, zero is
+provided per default. If "index" is negative, the callback must return
+the number of entries of the variable array.
+
 =item const char **data
 
 This is a pointer to the location where the callback function should
@@ -409,12 +423,15 @@
 getenv(3) to lookup variables and to return them to var_expand():
 
     int env_lookup(void *context,
-        const char *varname, size_t name_len,
+        const char *varname, size_t name_len, int index,
         const char **data, size_t *data_len,
         size_t *buffer_size)
     {
         char tmp[256];
 
+        if (index != 0)
+            return VAR_ERR_ARRAY_LOOKUPS_ARE_UNSUPPORTED;
+
         if (name_len > sizeof(tmp) - 1) {
         /* Callback can't expand variable names longer than
            sizeof(tmp) characters. */
@@ -841,6 +858,8 @@
 var_unescape() encountered the backslash ('\') as the last character
 of the input buffer.
 
+=item VAR_ERR_ARRAY_LOOKUPS_ARE_UNSUPPORTED
+
 =back
 
 =head1 SO ALSO

CVSTrac 2.0.1