Author: rhuijben
Date: Thu Oct 29 08:43:14 2015
New Revision: 1711193
URL: http://svn.apache.org/viewvc?rev=1711193&view=rev
Log:
* test/serf_get.c
(print_usage): Use the same algorithm as apr_getopt_long() to determine how
many options there are in the list.
Modified:
serf/trunk/test/serf_get.c
Modified: serf/trunk/test/serf_get.c
URL:
http://svn.apache.org/viewvc/serf/trunk/test/serf_get.c?rev=1711193&r1=1711192&r2=1711193&view=diff
==============================================================================
--- serf/trunk/test/serf_get.c (original)
+++ serf/trunk/test/serf_get.c Thu Oct 29 08:43:14 2015
@@ -520,12 +520,12 @@ static const apr_getopt_option_t options
static void print_usage(apr_pool_t *pool)
{
- int i;
+ int i = 0;
puts("serf_get [options] URL\n");
puts("Options:");
- for (i = 0; i < sizeof(options) / sizeof(apr_getopt_option_t); i++) {
+ while (options[i].optch > 0) {
const apr_getopt_option_t* o = &options[i];
if (o->optch <= 255) {
@@ -540,6 +540,8 @@ static void print_usage(apr_pool_t *pool
o->name ? "--" : "\t",
o->name ? o->name : "",
o->description);
+
+ i++;
}
}