You are viewing a plain text version of this content. The canonical link for it is here.
Posted to docs@httpd.apache.org by co...@apache.org on 2002/03/27 22:21:50 UTC

cvs commit: httpd-docs-1.3/apidoc api.xml

coar        02/03/27 13:21:50

  Modified:    apidoc   api.xml
  Log:
  Not tested, but I *think* it's right..
  
  Revision  Changes    Path
  1.6       +42 -1     httpd-docs-1.3/apidoc/api.xml
  
  Index: api.xml
  ===================================================================
  RCS file: /home/cvs/httpd-docs-1.3/apidoc/api.xml,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -u -r1.5 -r1.6
  --- api.xml	3 Nov 2001 12:38:03 -0000	1.5
  +++ api.xml	27 Mar 2002 21:21:50 -0000	1.6
  @@ -8896,7 +8896,48 @@
     <definition>
      <declaration>void ap_table_do(int (*comp) (void *d, const char *k, const char *val), 
                    void *rec, const table *t, ...);</declaration>
  -   <description />
  +   <description>
  +     <para>The <literal>ap_table_do()</literal> routine will step through
  +     all entries in the specified table and invoke the designated callback
  +     routine for each entry.  The callback routine will be passed three
  +     arguments: the arbitrary pointer specified in the
  +     <literal>ap_table_do()</literal> call and two
  +     <literal>const char *</literal> arguments for the
  +     key and value of the table entry being processed.</para>
  +     <para>The variable portion of <literal>ap_table_do()</literal>'s
  +     argument list may consist of zero or more
  +     <literal>const char *</literal> strings, and must end with a
  +     <literal>NULL</literal> value.  If any strings are passed,
  +     only those entries in the table with keys that match the strings
  +     will be processed.  If the variable argument list is empty (<i>i.e.</i>,
  +     consists of only the <literal>NULL</literal> terminator), all
  +     entries in the table will be processed.</para>
  +     <para>The example fragment demonstrates processing both of
  +     all entries and of only entries with specific keys.</para>
  +     <para>The table traversal will stop if the callback routine returns
  +      zero value.</para>
  +     <example>
  +       <text>static int print_pair(int *counter, const char *key, const char *value)
  +{
  +    printf("%4d. ['%s'] = '%s'\n", *counter, key, value);
  +    (*counter)++;
  +    return 1;
  +}
  +
  +int entry_num;
  +entry_num = 0;
  +printf("All table entries:\n");
  +ap_table_do((int (*) (int *c, const char *k, const char *v))
  +            print_pair,
  +            &amp;entry_num, table_to_traverse, NULL);
  +
  +entry_num = 0;
  +printf("Table entries for keys 'a' and/or 'b':\n");
  +ap_table_do((int (*) (int *c, const char *k, const char *v))
  +            print_pair,
  +            &amp;entry_num, table_to_traverse, "a", "b", NULL);</text>
  +     </example>
  +   </description>
      <seealso>
       <ref>SA-tables</ref>
      </seealso>
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: docs-unsubscribe@httpd.apache.org
For additional commands, e-mail: docs-help@httpd.apache.org