diff options
author | Gregor Beck <gbeck@sernet.de> | 2010-09-20 15:01:40 +0200 |
---|---|---|
committer | Michael Adam <obnox@samba.org> | 2010-09-22 06:30:00 +0200 |
commit | 0afc83c25556fc8162415738d1e8743009c4837c (patch) | |
tree | 2e2b277a24e409e32f939e9c5d803e101f9fd59e /source3/utils | |
parent | e7c2724c8148d837d60b5e6cb6204ac5ea28164c (diff) | |
download | samba-0afc83c25556fc8162415738d1e8743009c4837c.tar.gz samba-0afc83c25556fc8162415738d1e8743009c4837c.tar.bz2 samba-0afc83c25556fc8162415738d1e8743009c4837c.zip |
s3-net: add command registry convert
Signed-off-by: Michael Adam <obnox@samba.org>
Diffstat (limited to 'source3/utils')
-rw-r--r-- | source3/utils/net_registry.c | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/source3/utils/net_registry.c b/source3/utils/net_registry.c index 3c2e20e6ba..1139e45bef 100644 --- a/source3/utils/net_registry.c +++ b/source3/utils/net_registry.c @@ -1039,8 +1039,61 @@ done: } /**@}*/ +/******************************************************************************/ +/** + * @defgroup net_registry_convert Convert + * @ingroup net_registry + * @{ + */ + +static int net_registry_convert(struct net_context *c, int argc, + const char **argv) +{ + int ret; + void* mem_ctx; + const char* in_opt = NULL; + const char* out_opt = NULL; + + if (argc < 2 || argc > 4|| c->display_usage) { + d_printf("%s\n%s", + _("Usage:"), + _("net registry convert <in> <out> [in_opt] [out_opt]\n" + "net registry convert <in> <out> [out_opt]\n")); + d_printf("%s\n%s", + _("Example:"), + _("net registry convert in.reg out.reg regedit4,enc=CP1252\n")); + return -1; + } + + mem_ctx = talloc_stackframe(); + + switch (argc ) { + case 2: + break; + case 3: + out_opt = argv[2]; + break; + case 4: + out_opt = argv[3]; + in_opt = argv[2]; + break; + default: + assert(false); + } + + + ret = reg_parse_file(argv[0], (struct reg_parse_callback*) + reg_format_file(mem_ctx, argv[1], out_opt), + in_opt); + + talloc_free(mem_ctx); + + return ret; +} +/**@}*/ /******************************************************************************/ + int net_registry(struct net_context *c, int argc, const char **argv) { int ret = -1; @@ -1150,6 +1203,14 @@ int net_registry(struct net_context *c, int argc, const char **argv) N_("net registry export\n" " Export .reg file") }, + { + "convert", + net_registry_convert, + NET_TRANSPORT_LOCAL, + N_("Convert .reg file"), + N_("net registry convert\n" + " Convert .reg file") + }, { NULL, NULL, 0, NULL, NULL } }; |