diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2005-08-30 13:58:48 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:35:02 -0500 |
commit | a3a7881d39d0c294d0cd2ce13203478fb889b07c (patch) | |
tree | 4f2a78f93e9a369cd6658f2f6ef180b8f27ebe70 /source4/lib/util_strlist.c | |
parent | f3c121eb748b37a8b60d353d371bed9b79d0e37c (diff) | |
download | samba-a3a7881d39d0c294d0cd2ce13203478fb889b07c.tar.gz samba-a3a7881d39d0c294d0cd2ce13203478fb889b07c.tar.bz2 samba-a3a7881d39d0c294d0cd2ce13203478fb889b07c.zip |
r9798: Add generic functions for handling smb.conf files (the parameters don't to be pre-declared). Also doesn't use any globals, so multiple files can be loaded at once.
Currently uses the prefix "param" for all functions and structures; suggestions for better ones are welcome...
Remove old smb.conf-parsing code from libsamba3.
(This used to be commit 414e5f7f6dc38a8fde3b61d524a664f56f9ea592)
Diffstat (limited to 'source4/lib/util_strlist.c')
-rw-r--r-- | source4/lib/util_strlist.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/source4/lib/util_strlist.c b/source4/lib/util_strlist.c index d5c4d91585..8efa1f92d2 100644 --- a/source4/lib/util_strlist.c +++ b/source4/lib/util_strlist.c @@ -22,7 +22,7 @@ /* build a null terminated list of strings from a input string and a - separator list. The sepatator list must contain characters less than + separator list. The separator list must contain characters less than or equal to 0x2f for this to work correctly on multi-byte strings */ const char **str_list_make(TALLOC_CTX *mem_ctx, const char *string, const char *sep) @@ -70,6 +70,25 @@ const char **str_list_make(TALLOC_CTX *mem_ctx, const char *string, const char * return ret; } +/* join a list back to one string */ +char *str_list_join(TALLOC_CTX *mem_ctx, const char **list, char seperator) +{ + char *ret = NULL; + int i; + + if (list[0] == NULL) + return talloc_strdup(mem_ctx, ""); + + ret = talloc_strdup(mem_ctx, list[0]); + + for (i = 1; list[i]; i++) { + ret = talloc_asprintf_append(ret, "%c%s", seperator, list[i]); + } + + return ret; +} + + /* return the number of elements in a string list */ |