diff options
author | Michael Adam <obnox@samba.org> | 2007-12-29 00:05:23 +0100 |
---|---|---|
committer | Michael Adam <obnox@samba.org> | 2007-12-29 00:05:58 +0100 |
commit | dfa8d9356cea0dd6a1b013a72c3d68c026deb511 (patch) | |
tree | 0211fa31dd40ba233aea1e1bdb6a6f8e7e1cfebe /source3/libnet/libnet_conf.c | |
parent | 245537f9bd1bddc496da0155012c34a2c7a18668 (diff) | |
download | samba-dfa8d9356cea0dd6a1b013a72c3d68c026deb511.tar.gz samba-dfa8d9356cea0dd6a1b013a72c3d68c026deb511.tar.bz2 samba-dfa8d9356cea0dd6a1b013a72c3d68c026deb511.zip |
Move format_value() to libnet_conf.c.
Michael
(This used to be commit 3422a5048ad4b7f789ec233356885d78dbdacf9a)
Diffstat (limited to 'source3/libnet/libnet_conf.c')
-rw-r--r-- | source3/libnet/libnet_conf.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c index 93e13009a4..5389d856b3 100644 --- a/source3/libnet/libnet_conf.c +++ b/source3/libnet/libnet_conf.c @@ -222,6 +222,40 @@ done: return werr; } +char *format_value(TALLOC_CTX *mem_ctx, struct registry_value *value) +{ + char *result = NULL; + + /* what if mem_ctx = NULL? */ + + switch (value->type) { + case REG_DWORD: + result = talloc_asprintf(mem_ctx, "%d", value->v.dword); + break; + case REG_SZ: + case REG_EXPAND_SZ: + result = talloc_asprintf(mem_ctx, "%s", value->v.sz.str); + break; + case REG_MULTI_SZ: { + uint32 j; + for (j = 0; j < value->v.multi_sz.num_strings; j++) { + result = talloc_asprintf(mem_ctx, "\"%s\" ", + value->v.multi_sz.strings[j]); + } + break; + } + case REG_BINARY: + result = talloc_asprintf(mem_ctx, "binary (%d bytes)", + (int)value->v.binary.length); + break; + default: + result = talloc_asprintf(mem_ctx, "<unprintable>"); + break; + } + return result; +} + + /********************************************************************** * * The actual net conf api functions, that are exported. |