From 8ecf51a553533e8f95e57236903553b3e81b06fc Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Thu, 21 Jul 2011 17:11:44 +0200 Subject: s3:loadparm: add support for P_CMDLIST to print_parameter - fix build warning. --- source3/param/loadparm.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'source3/param/loadparm.c') diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c index afa1bf06a6..27266964d5 100644 --- a/source3/param/loadparm.c +++ b/source3/param/loadparm.c @@ -7526,6 +7526,8 @@ bool lp_set_option(const char *option) static void print_parameter(struct parm_struct *p, void *ptr, FILE * f) { + /* For the seperation of lists values that we print below */ + const char *list_sep = ", "; int i; switch (p->type) { @@ -7563,15 +7565,23 @@ static void print_parameter(struct parm_struct *p, void *ptr, FILE * f) break; } + case P_CMDLIST: + list_sep = " "; + /* fall through */ case P_LIST: if ((char ***)ptr && *(char ***)ptr) { char **list = *(char ***)ptr; for (; *list; list++) { /* surround strings with whitespace in double quotes */ - if ( strchr_m( *list, ' ' ) ) - fprintf(f, "\"%s\"%s", *list, ((*(list+1))?", ":"")); - else - fprintf(f, "%s%s", *list, ((*(list+1))?", ":"")); + if (*(list+1) == NULL) { + /* last item, no extra separator */ + list_sep = ""; + } + if ( strchr_m( *list, ' ' ) ) { + fprintf(f, "\"%s\"%s", *list, list_sep); + } else { + fprintf(f, "%s%s", *list, list_sep); + } } } break; -- cgit