add config_path and version items to stats xml-rpc. Fixes ticket #33. Take 2. :)

This commit is contained in:
Ron Pedde 2006-04-10 17:59:10 +00:00
parent bc2faaf75f
commit f83f66130b
3 changed files with 16 additions and 3 deletions

View File

@ -864,7 +864,7 @@ int conf_set_string(char *section, char *key, char *value) {
} }
_conf_dispose_split(valuearray); _conf_dispose_split(valuearray);
} }
} else { } else {
if((err = ll_add_string(section_ll,key,value)) != LL_E_SUCCESS) { if((err = ll_add_string(section_ll,key,value)) != LL_E_SUCCESS) {
DPRINTF(E_LOG,L_CONF,"Error in conf_set_string: " DPRINTF(E_LOG,L_CONF,"Error in conf_set_string: "
"(%s/%s)\n",section,key); "(%s/%s)\n",section,key);
@ -1260,7 +1260,7 @@ void conf_dispose_array(char **argv) {
/** /**
* dump the config to xml * dump the config to xml
* *
* @param pwsc web connection to dump to * @param pwsc web connection to dump to
* @returns TRUE on success, FALSE otherwise * @returns TRUE on success, FALSE otherwise
*/ */
@ -1337,3 +1337,12 @@ int _conf_xml_dump(XMLSTRUCT *pxml, LL *pll, int sublevel, char *parent) {
return TRUE; return TRUE;
} }
/**
* get the filename of the currently runnig config file
*
* @returns path if it exists, or NULL if no config file opened
*/
char *conf_get_filename(void) {
return conf_main_file;
}

View File

@ -49,6 +49,8 @@ extern char *conf_implode(char *section, char *key, char *delimiter);
extern int conf_get_array(char *section, char *key, char ***argvp); extern int conf_get_array(char *section, char *key, char ***argvp);
extern void conf_dispose_array(char **argv); extern void conf_dispose_array(char **argv);
extern char *conf_get_filename(void);
/* FIXME: get enum functions and move to xml-rpc */ /* FIXME: get enum functions and move to xml-rpc */
#include "webserver.h" #include "webserver.h"
extern int conf_xml_dump(WS_CONNINFO *pwsc); extern int conf_xml_dump(WS_CONNINFO *pwsc);

View File

@ -47,7 +47,7 @@ void xml_return_error(WS_CONNINFO *pwsc, int errno, char *errstr) {
pxml=xml_init(pwsc,TRUE); pxml=xml_init(pwsc,TRUE);
xml_push(pxml,"results"); xml_push(pxml,"results");
xml_output(pxml,"status","%d",errno); xml_output(pxml,"status","%d",errno);
xml_output(pxml,"statusstring","%s",errstr); xml_output(pxml,"statusstring","%s",errstr);
@ -353,6 +353,8 @@ void xml_get_stats(WS_CONNINFO *pwsc) {
xml_push(pxml,"misc"); xml_push(pxml,"misc");
xml_output(pxml,"writable_config","%d",conf_iswritable()); xml_output(pxml,"writable_config","%d",conf_iswritable());
xml_output(pxml,"config_path","%s",conf_get_filename());
xml_output(pxml,"version","%s",VERSION);
xml_pop(pxml); /* misc */ xml_pop(pxml); /* misc */
xml_pop(pxml); /* status */ xml_pop(pxml); /* status */