From 9125da7fbf599c7e83aad575774c288ed463fca1 Mon Sep 17 00:00:00 2001 From: David Sommerseth Date: Tue, 2 Dec 2008 21:36:49 +0100 Subject: Added dumping of config settings in database as well as only config file --- eurephiadm/eurephiadm.c | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) (limited to 'eurephiadm') diff --git a/eurephiadm/eurephiadm.c b/eurephiadm/eurephiadm.c index cba5a7f..f9dc7ed 100644 --- a/eurephiadm/eurephiadm.c +++ b/eurephiadm/eurephiadm.c @@ -66,7 +66,8 @@ static const eurephiadm_functions cmdline_functions[] = { {"help", 0, NULL, "This help screen", NULL, cmd_Help}, {"logout", 1, NULL, "Logout from an open session", NULL, cmd_Logout}, {"listusers", 1, NULL, "List all registered users", NULL, cmd_ListUsers}, - {"show-settings", 0, NULL, "List all config variables", NULL, cmd_ShowCfg}, + {"show-config", 1, NULL, "List all config settings", NULL, cmd_ShowCfg}, + {"show-configfile", 0, NULL, "List only config file settings", NULL, cmd_ShowCfg}, {NULL, 0, NULL, NULL, NULL} }; @@ -120,13 +121,25 @@ int cmd_Logout(eurephiaCTX *ctx, eurephiaSESSION *sess, eurephiaVALUES *cfg, int } int cmd_ShowCfg(eurephiaCTX *ctx, eurephiaSESSION *sess, eurephiaVALUES *cfg, int argc, char **argv) { - eurephiaVALUES *ptr = NULL; + void dump_values(eurephiaVALUES *vls) { + eurephiaVALUES *ptr = NULL; + fprintf(stdout, "----------------------------------------------------------------------\n"); + for( ptr = vls; ptr != NULL; ptr = ptr->next) { + fprintf(stdout, "%20s = %s\n", ptr->key, ptr->val); + } + fprintf(stdout, "----------------------------------------------------------------------\n"); + } - fprintf(stdout, "Confuriation settings:\n"); - for( ptr = cfg; ptr != NULL; ptr = ptr->next) { - fprintf(stdout, "%20s = %s\n", ptr->key, ptr->val); + if( cfg != NULL ) { + fprintf(stdout, "\n** eurephiadm configuration settings (config file) **\n"); + dump_values(cfg); + fprintf(stdout, "\n"); + } + if( ctx != NULL ) { + fprintf(stdout, "** eurephia configuration settings (set in database) **\n"); + dump_values(ctx->dbc->config); + fprintf(stdout, "\n"); } - fprintf(stdout, "\n"); return 0; } -- cgit