diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2005-09-06 15:44:08 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:36:33 -0500 |
commit | db400b4a58d834cca165f1fc6ad84e9f5ace280f (patch) | |
tree | b8d263fa67d0c25e5c6da04d0eded595e1273f03 /source4/lib/registry/tools | |
parent | 622b75f4dceaeb5c7a0ef9396abaf6faf63ab443 (diff) | |
download | samba-db400b4a58d834cca165f1fc6ad84e9f5ace280f.tar.gz samba-db400b4a58d834cca165f1fc6ad84e9f5ace280f.tar.bz2 samba-db400b4a58d834cca165f1fc6ad84e9f5ace280f.zip |
r10052: Add 'print' command
(This used to be commit d99c9e2817fbbe2a0a34910672c8473889bc6176)
Diffstat (limited to 'source4/lib/registry/tools')
-rw-r--r-- | source4/lib/registry/tools/regshell.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/source4/lib/registry/tools/regshell.c b/source4/lib/registry/tools/regshell.c index 08da5ae2fd..24979943b3 100644 --- a/source4/lib/registry/tools/regshell.c +++ b/source4/lib/registry/tools/regshell.c @@ -35,6 +35,7 @@ * ch - change hive * info - show key info * save - save hive + * print - print value * help * exit */ @@ -123,6 +124,26 @@ static struct registry_key *cmd_ck(TALLOC_CTX *mem_ctx, struct registry_context return new; } +static struct registry_key *cmd_print(TALLOC_CTX *mem_ctx, struct registry_context *ctx,struct registry_key *cur, int argc, char **argv) +{ + struct registry_value *value; + WERROR error; + + if (argc != 2) { + fprintf(stderr, "Usage: print <valuename>"); + return NULL; + } + + error = reg_key_get_value_by_name(mem_ctx, cur, argv[1], &value); + if (!W_ERROR_IS_OK(error)) { + fprintf(stderr, "No such value '%s'\n", argv[1]); + return NULL; + } + + printf("%s\n%s\n", str_regtype(value->data_type), reg_val_data_string(mem_ctx, value)); + return NULL; +} + static struct registry_key *cmd_ls(TALLOC_CTX *mem_ctx, struct registry_context *ctx,struct registry_key *cur, int argc, char **argv) { int i; @@ -208,6 +229,7 @@ static struct { {"ck", "cd", "Change current key", cmd_ck }, {"info", "i", "Show detailed information of a key", cmd_info }, {"list", "ls", "List values/keys in current key", cmd_ls }, + {"print", "p", "Print value", cmd_print }, {"mkkey", "mkdir", "Make new key", cmd_mkkey }, {"rmval", "rm", "Remove value", cmd_rmval }, {"rmkey", "rmdir", "Remove key", cmd_rmkey }, |