summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2011-07-21 17:11:44 +0200
committerMichael Adam <obnox@samba.org>2011-07-21 17:24:17 +0200
commit8ecf51a553533e8f95e57236903553b3e81b06fc (patch)
tree0cb11c69887dd59e974bc58a451ea644c725cbe9 /source3
parent81e4d1f63d1b14cd1c1265f1d1b571d47cc62ea6 (diff)
downloadsamba-8ecf51a553533e8f95e57236903553b3e81b06fc.tar.gz
samba-8ecf51a553533e8f95e57236903553b3e81b06fc.tar.bz2
samba-8ecf51a553533e8f95e57236903553b3e81b06fc.zip
s3:loadparm: add support for P_CMDLIST to print_parameter - fix build warning.
Diffstat (limited to 'source3')
-rw-r--r--source3/param/loadparm.c18
1 files changed, 14 insertions, 4 deletions
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;