summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Davenport <qball@gmpclient.org>2017-06-27 09:15:55 +0200
committerDave Davenport <qball@gmpclient.org>2017-06-27 09:15:55 +0200
commit193dfa16bc8a8729d587bb8f04d545d91e3209a0 (patch)
treebd199d01c78f03cd3974f5a1aae6037c6c8d925b
parentb9c624d2eef609b2cd3456828b3f0858477b1fbf (diff)
[Config] quick hack to support lists in rasi configuration{} block.
-rw-r--r--source/xrmoptions.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/source/xrmoptions.c b/source/xrmoptions.c
index 05fef439..840cf37c 100644
--- a/source/xrmoptions.c
+++ b/source/xrmoptions.c
@@ -373,15 +373,32 @@ static gboolean __config_parser_set_property ( XrmOption *option, const Property
{
extern const char *PropertyTypeName[];
if ( option->type == xrm_String ) {
- if ( p->type != P_STRING ) {
+ if ( p->type != P_STRING && p->type != P_LIST ) {
*error = g_strdup_printf ( "Option: %s needs to be set with a string not a %s.", option->name, PropertyTypeName[p->type] );
return TRUE;
}
+ gchar *value = NULL;
+ if ( p->type == P_LIST ) {
+ for ( GList *iter = p->value.list; iter != NULL; iter = g_list_next ( iter ) ) {
+ if ( value == NULL ) {
+ value = g_strdup ( (char *) ( iter->data ) );
+ }
+ else {
+ char *nv = g_strjoin ( ",", value, (char *) ( iter->data ), NULL );
+ g_free ( value );
+ value = nv;
+ }
+ }
+ }
+ else {
+ value = g_strdup ( p->value.s );
+ }
+ printf ( "set: %s\n", value );
if ( ( option )->mem != NULL ) {
g_free ( option->mem );
option->mem = NULL;
}
- *( option->value.str ) = g_strdup ( p->value.s );
+ *( option->value.str ) = value;
// Memory
( option )->mem = *( option->value.str );