#define PROGRAM_DESCRIPTION "Output the state of a memcached cluster."
/* Prototypes */
-void options_parse(int argc, char *argv[]);
+static void options_parse(int argc, char *argv[]);
+static void print_server_listing(memcached_st *memc, memcached_stat_st *stat,
+ memcached_server_st *server_list);
static int opt_verbose= 0;
static int opt_displayflag= 0;
int main(int argc, char *argv[])
{
- unsigned int x;
memcached_return rc;
memcached_st *memc;
memcached_stat_st *stat;
}
server_list= memcached_server_list(memc);
+ print_server_listing(memc, stat, server_list);
+
+ free(stat);
+ free(opt_servers);
+
+ memcached_free(memc);
+
+ return 0;
+}
+
+static void print_server_listing(memcached_st *memc, memcached_stat_st *stat,
+ memcached_server_st *server_list)
+{
+ unsigned int x;
+ memcached_return rc;
printf("Listing %u Server\n\n", memcached_server_count(memc));
for (x= 0; x < memcached_server_count(memc); x++)
list= memcached_stat_get_keys(memc, &stat[x], &rc);
printf("Server: %s (%u)\n", memcached_server_name(memc, server_list[x]),
- memcached_server_port(memc, server_list[x]));
+ memcached_server_port(memc, server_list[x]));
for (ptr= list; *ptr; ptr++)
{
memcached_return rc;
free(list);
printf("\n");
}
-
- free(stat);
- free(opt_servers);
-
- memcached_free(memc);
-
- return 0;
}
-void options_parse(int argc, char *argv[])
+static void options_parse(int argc, char *argv[])
{
memcached_programs_help_st help_options[]=
{