Sort plugins by type when printing them

Signed-off-by: Lon Hohberger <lon@users.sourceforge.net>
This commit is contained in:
Lon Hohberger 2010-01-04 14:12:40 -05:00
parent 22a2dd65f3
commit 2707d32a87
3 changed files with 32 additions and 7 deletions

View File

@ -36,7 +36,7 @@ MODULE_PATH=${libdir}/${PACKAGE_NAME}
#
# Module sources
#
fence_virtd_SOURCES = main.c plugin.c
fence_virtd_SOURCES = main.c plugin.c config.c
libvirt_so_SOURCES = libvirt.c virt.c uuid-test.c
null_so_SOURCES = null.c
libvirt_qpid_so_SOURCES = uuid-test.c

View File

@ -13,6 +13,9 @@
#include <debug.h>
#include <syslog.h>
/* configure.c */
int do_configure(config_object_t *config, const char *filename);
void
usage(void)
@ -21,6 +24,7 @@ usage(void)
printf(" -F Do not daemonize.\n");
printf(" -f <file> Use <file> as configuration file.\n");
printf(" -d <level> Set debugging level to <level>.\n");
printf(" -c Configuration mode.\n");
}
@ -37,11 +41,11 @@ main(int argc, char **argv)
listener_context_t listener_ctx = NULL;
backend_context_t backend_ctx = NULL;
int debug_set = 0, foreground = 0;
int opt;
int opt, configure = 0;
config = sc_init();
while ((opt = getopt(argc, argv, "Ff:d:")) != EOF) {
while ((opt = getopt(argc, argv, "Ff:d:c")) != EOF) {
switch(opt) {
case 'F':
printf("Background mode disabled\n");
@ -54,6 +58,9 @@ main(int argc, char **argv)
case 'd':
debug_set = atoi(optarg);
break;
case 'c':
configure = 1;
break;
case 'h':
case '?':
usage();
@ -63,6 +70,10 @@ main(int argc, char **argv)
}
}
if (configure) {
return do_configure(config, config_file);
}
if (sc_parse(config, config_file) != 0) {
printf("Failed to parse %s\n", config_file);
return -1;

View File

@ -94,14 +94,28 @@ void
plugin_dump(void)
{
plugin_list_t *p;
int x;
int x, y;
y = 0;
list_for(&server_plugins, p, x) {
if (p->type == PLUGIN_BACKEND) {
printf("backend: %s %s\n",
if (!y) {
y = 1;
printf("Available backends:\n");
}
printf(" %s %s\n",
p->backend->name, p->backend->version);
} else if (p->type == PLUGIN_LISTENER) {
printf("listener: %s %s\n",
}
}
y = 0;
list_for(&server_plugins, p, x) {
if (p->type == PLUGIN_LISTENER) {
if (!y) {
y = 1;
printf("Available listeners:\n");
}
printf(" %s %s\n",
p->listener->name, p->listener->version);
}
}