svn commit: samba r10052 - in branches/SAMBA_4_0/source/lib/registry/tools: .

jelmer at samba.org jelmer at samba.org
Tue Sep 6 15:44:09 GMT 2005


Author: jelmer
Date: 2005-09-06 15:44:08 +0000 (Tue, 06 Sep 2005)
New Revision: 10052

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=10052

Log:
Add 'print' command

Modified:
   branches/SAMBA_4_0/source/lib/registry/tools/regshell.c


Changeset:
Modified: branches/SAMBA_4_0/source/lib/registry/tools/regshell.c
===================================================================
--- branches/SAMBA_4_0/source/lib/registry/tools/regshell.c	2005-09-06 15:39:26 UTC (rev 10051)
+++ branches/SAMBA_4_0/source/lib/registry/tools/regshell.c	2005-09-06 15:44:08 UTC (rev 10052)
@@ -35,6 +35,7 @@
  * ch - change hive
  * info - show key info
  * save - save hive
+ * print - print value
  * help
  * exit
  */
@@ -123,6 +124,26 @@
 	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 @@
 	{"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 },



More information about the samba-cvs mailing list