summaryrefslogtreecommitdiff
path: root/source3/utils
diff options
context:
space:
mode:
authorKai Blin <kai@samba.org>2009-08-02 10:26:48 +0200
committerKai Blin <kai@samba.org>2009-08-07 09:54:51 +0200
commit7ced58b93246648ba15b08f99d3f6d8896638650 (patch)
tree187b1fe7035aebd44e337b0fff181586f725f4be /source3/utils
parent9be14ed78d9fd4750772079a4f4173a0dee95cff (diff)
downloadsamba-7ced58b93246648ba15b08f99d3f6d8896638650.tar.gz
samba-7ced58b93246648ba15b08f99d3f6d8896638650.tar.bz2
samba-7ced58b93246648ba15b08f99d3f6d8896638650.zip
s3 net: i18n support for net registry
Diffstat (limited to 'source3/utils')
-rw-r--r--source3/utils/net_registry.c131
-rw-r--r--source3/utils/net_registry_util.c25
2 files changed, 80 insertions, 76 deletions
diff --git a/source3/utils/net_registry.c b/source3/utils/net_registry.c
index d6cdd982c3..711c111275 100644
--- a/source3/utils/net_registry.c
+++ b/source3/utils/net_registry.c
@@ -91,13 +91,14 @@ static WERROR open_key(TALLOC_CTX *ctx, const char *path,
werr = open_hive(tmp_ctx, path, desired_access, &hive, &subkey_name);
if (!W_ERROR_IS_OK(werr)) {
- d_fprintf(stderr, "open_hive failed: %s\n", win_errstr(werr));
+ d_fprintf(stderr, _("open_hive failed: %s\n"),
+ win_errstr(werr));
goto done;
}
werr = reg_openkey(ctx, hive, subkey_name, desired_access, key);
if (!W_ERROR_IS_OK(werr)) {
- d_fprintf(stderr, "reg_openkey failed: %s\n",
+ d_fprintf(stderr, _("reg_openkey failed: %s\n"),
win_errstr(werr));
goto done;
}
@@ -129,15 +130,15 @@ static int net_registry_enumerate(struct net_context *c, int argc,
int ret = -1;
if (argc != 1 || c->display_usage) {
- d_printf("Usage: net registry enumerate <path>\n");
- d_printf("Example: net registry enumerate "
- "'HKLM\\Software\\Samba'\n");
+ d_printf(_("Usage: net registry enumerate <path>\n"));
+ d_printf(_("Example: net registry enumerate "
+ "'HKLM\\Software\\Samba'\n"));
goto done;
}
werr = open_key(ctx, argv[0], REG_KEY_READ, &key);
if (!W_ERROR_IS_OK(werr)) {
- d_fprintf(stderr, "open_key failed: %s\n", win_errstr(werr));
+ d_fprintf(stderr, _("open_key failed: %s\n"), win_errstr(werr));
goto done;
}
@@ -181,38 +182,39 @@ static int net_registry_createkey(struct net_context *c, int argc,
int ret = -1;
if (argc != 1 || c->display_usage) {
- d_printf("Usage: net registry createkey <path>\n");
- d_printf("Example: net registry createkey "
- "'HKLM\\Software\\Samba\\smbconf.127.0.0.1'\n");
+ d_printf(_("Usage: net registry createkey <path>\n"));
+ d_printf(_("Example: net registry createkey "
+ "'HKLM\\Software\\Samba\\smbconf.127.0.0.1'\n"));
goto done;
}
if (strlen(argv[0]) == 0) {
- d_fprintf(stderr, "error: zero length key name given\n");
+ d_fprintf(stderr, _("error: zero length key name given\n"));
goto done;
}
werr = open_hive(ctx, argv[0], REG_KEY_WRITE, &hivekey, &subkeyname);
if (!W_ERROR_IS_OK(werr)) {
- d_fprintf(stderr, "open_hive failed: %s\n", win_errstr(werr));
+ d_fprintf(stderr, _("open_hive failed: %s\n"),
+ win_errstr(werr));
goto done;
}
werr = reg_createkey(ctx, hivekey, subkeyname, REG_KEY_WRITE,
&subkey, &action);
if (!W_ERROR_IS_OK(werr)) {
- d_fprintf(stderr, "reg_createkey failed: %s\n",
+ d_fprintf(stderr, _("reg_createkey failed: %s\n"),
win_errstr(werr));
goto done;
}
switch (action) {
case REG_ACTION_NONE:
- d_printf("createkey did nothing -- huh?\n");
+ d_printf(_("createkey did nothing -- huh?\n"));
break;
case REG_CREATED_NEW_KEY:
- d_printf("createkey created %s\n", argv[0]);
+ d_printf(_("createkey created %s\n"), argv[0]);
break;
case REG_OPENED_EXISTING_KEY:
- d_printf("createkey opened existing %s\n", argv[0]);
+ d_printf(_("createkey opened existing %s\n"), argv[0]);
break;
}
@@ -233,25 +235,26 @@ static int net_registry_deletekey(struct net_context *c, int argc,
int ret = -1;
if (argc != 1 || c->display_usage) {
- d_printf("Usage: net registry deletekey <path>\n");
- d_printf("Example: net registry deletekey "
- "'HKLM\\Software\\Samba\\smbconf.127.0.0.1'\n");
+ d_printf(_("Usage: net registry deletekey <path>\n"));
+ d_printf(_("Example: net registry deletekey "
+ "'HKLM\\Software\\Samba\\smbconf.127.0.0.1'\n"));
goto done;
}
if (strlen(argv[0]) == 0) {
- d_fprintf(stderr, "error: zero length key name given\n");
+ d_fprintf(stderr, _("error: zero length key name given\n"));
goto done;
}
werr = open_hive(ctx, argv[0], REG_KEY_WRITE, &hivekey, &subkeyname);
if (!W_ERROR_IS_OK(werr)) {
- d_fprintf(stderr, "open_hive failed: %s\n", win_errstr(werr));
+ d_fprintf(stderr, _("open_hive failed: %s\n"),
+ win_errstr(werr));
goto done;
}
werr = reg_deletekey(hivekey, subkeyname);
if (!W_ERROR_IS_OK(werr)) {
- d_fprintf(stderr, "reg_deletekey failed: %s\n",
+ d_fprintf(stderr, _("reg_deletekey failed: %s\n"),
win_errstr(werr));
goto done;
}
@@ -273,20 +276,20 @@ static int net_registry_getvalue_internal(struct net_context *c, int argc,
TALLOC_CTX *ctx = talloc_stackframe();
if (argc != 2 || c->display_usage) {
- d_fprintf(stderr, "usage: net rpc registry getvalue <key> "
- "<valuename>\n");
+ d_fprintf(stderr, _("usage: net rpc registry getvalue <key> "
+ "<valuename>\n"));
goto done;
}
werr = open_key(ctx, argv[0], REG_KEY_READ, &key);
if (!W_ERROR_IS_OK(werr)) {
- d_fprintf(stderr, "open_key failed: %s\n", win_errstr(werr));
+ d_fprintf(stderr, _("open_key failed: %s\n"), win_errstr(werr));
goto done;
}
werr = reg_queryvalue(ctx, key, argv[1], &value);
if (!W_ERROR_IS_OK(werr)) {
- d_fprintf(stderr, "reg_queryvalue failed: %s\n",
+ d_fprintf(stderr, _("reg_queryvalue failed: %s\n"),
win_errstr(werr));
goto done;
}
@@ -322,13 +325,13 @@ static int net_registry_setvalue(struct net_context *c, int argc,
TALLOC_CTX *ctx = talloc_stackframe();
if (argc < 4 || c->display_usage) {
- d_fprintf(stderr, "usage: net rpc registry setvalue <key> "
- "<valuename> <type> [<val>]+\n");
+ d_fprintf(stderr, _("usage: net rpc registry setvalue <key> "
+ "<valuename> <type> [<val>]+\n"));
goto done;
}
if (!strequal(argv[2], "multi_sz") && (argc != 4)) {
- d_fprintf(stderr, "Too many args for type %s\n", argv[2]);
+ d_fprintf(stderr, _("Too many args for type %s\n"), argv[2]);
goto done;
}
@@ -344,19 +347,19 @@ static int net_registry_setvalue(struct net_context *c, int argc,
value.v.multi_sz.num_strings = argc - 3;
value.v.multi_sz.strings = (char **)(argv + 3);
} else {
- d_fprintf(stderr, "type \"%s\" not implemented\n", argv[2]);
+ d_fprintf(stderr, _("type \"%s\" not implemented\n"), argv[2]);
goto done;
}
werr = open_key(ctx, argv[0], REG_KEY_WRITE, &key);
if (!W_ERROR_IS_OK(werr)) {
- d_fprintf(stderr, "open_key failed: %s\n", win_errstr(werr));
+ d_fprintf(stderr, _("open_key failed: %s\n"), win_errstr(werr));
goto done;
}
werr = reg_setvalue(key, argv[1], &value);
if (!W_ERROR_IS_OK(werr)) {
- d_fprintf(stderr, "reg_setvalue failed: %s\n",
+ d_fprintf(stderr, _("reg_setvalue failed: %s\n"),
win_errstr(werr));
goto done;
}
@@ -377,20 +380,20 @@ static int net_registry_deletevalue(struct net_context *c, int argc,
int ret = -1;
if (argc != 2 || c->display_usage) {
- d_fprintf(stderr, "usage: net rpc registry deletevalue <key> "
- "<valuename>\n");
+ d_fprintf(stderr, _("usage: net rpc registry deletevalue <key> "
+ "<valuename>\n"));
goto done;
}
werr = open_key(ctx, argv[0], REG_KEY_WRITE, &key);
if (!W_ERROR_IS_OK(werr)) {
- d_fprintf(stderr, "open_key failed: %s\n", win_errstr(werr));
+ d_fprintf(stderr, _("open_key failed: %s\n"), win_errstr(werr));
goto done;
}
werr = reg_deletevalue(key, argv[1]);
if (!W_ERROR_IS_OK(werr)) {
- d_fprintf(stderr, "reg_deletekey failed: %s\n",
+ d_fprintf(stderr, _("reg_deletekey failed: %s\n"),
win_errstr(werr));
goto done;
}
@@ -421,9 +424,9 @@ static int net_registry_getsd(struct net_context *c, int argc,
access_mask = REG_KEY_READ;
if (argc != 1 || c->display_usage) {
- d_printf("Usage: net registry getsd <path>\n");
- d_printf("Example: net registry getsd "
- "'HKLM\\Software\\Samba'\n");
+ d_printf(_("Usage: net registry getsd <path>\n"));
+ d_printf(_("Example: net registry getsd "
+ "'HKLM\\Software\\Samba'\n"));
goto done;
}
if (strlen(argv[0]) == 0) {
@@ -433,13 +436,13 @@ static int net_registry_getsd(struct net_context *c, int argc,
werr = open_key(ctx, argv[0], access_mask, &key);
if (!W_ERROR_IS_OK(werr)) {
- d_fprintf(stderr, "open_key failed: %s\n", win_errstr(werr));
+ d_fprintf(stderr, _("open_key failed: %s\n"), win_errstr(werr));
goto done;
}
werr = reg_getkeysecurity(ctx, key, &secdesc);
if (!W_ERROR_IS_OK(werr)) {
- d_fprintf(stderr, "reg_getkeysecurity failed: %s\n",
+ d_fprintf(stderr, _("reg_getkeysecurity failed: %s\n"),
win_errstr(werr));
goto done;
}
@@ -462,65 +465,65 @@ int net_registry(struct net_context *c, int argc, const char **argv)
"enumerate",
net_registry_enumerate,
NET_TRANSPORT_LOCAL,
- "Enumerate registry keys and values",
- "net registry enumerate\n"
- " Enumerate registry keys and values"
+ N_("Enumerate registry keys and values"),
+ N_("net registry enumerate\n"
+ " Enumerate registry keys and values")
},
{
"createkey",
net_registry_createkey,
NET_TRANSPORT_LOCAL,
- "Create a new registry key",
- "net registry createkey\n"
- " Create a new registry key"
+ N_("Create a new registry key"),
+ N_("net registry createkey\n"
+ " Create a new registry key")
},
{
"deletekey",
net_registry_deletekey,
NET_TRANSPORT_LOCAL,
- "Delete a registry key",
- "net registry deletekey\n"
- " Delete a registry key"
+ N_("Delete a registry key"),
+ N_("net registry deletekey\n"
+ " Delete a registry key")
},
{
"getvalue",
net_registry_getvalue,
NET_TRANSPORT_LOCAL,
- "Print a registry value",
- "net registry getvalue\n"
- " Print a registry value"
+ N_("Print a registry value"),
+ N_("net registry getvalue\n"
+ " Print a registry value")
},
{
"getvalueraw",
net_registry_getvalueraw,
NET_TRANSPORT_LOCAL,
- "Print a registry value (raw format)",
- "net registry getvalueraw\n"
- " Print a registry value (raw format)"
+ N_("Print a registry value (raw format)"),
+ N_("net registry getvalueraw\n"
+ " Print a registry value (raw format)")
},
{
"setvalue",
net_registry_setvalue,
NET_TRANSPORT_LOCAL,
- "Set a new registry value",
- "net registry setvalue\n"
- " Set a new registry value"
+ N_("Set a new registry value"),
+ N_("net registry setvalue\n"
+ " Set a new registry value")
},
{
"deletevalue",
net_registry_deletevalue,
NET_TRANSPORT_LOCAL,
- "Delete a registry value",
- "net registry deletevalue\n"
- " Delete a registry value"
+ N_("Delete a registry value"),
+ N_("net registry deletevalue\n"
+ " Delete a registry value")
},
{
"getsd",
net_registry_getsd,
NET_TRANSPORT_LOCAL,
- "Get security descriptor",
- "net registry getsd\n"
- " Get security descriptor"
+ N_("Get security descriptor"),
+ N_("net registry getsd\n"
+ " Get security descriptor")
},
{ NULL, NULL, 0, NULL, NULL }
};
diff --git a/source3/utils/net_registry_util.c b/source3/utils/net_registry_util.c
index cd291b5c74..3d1919cbf1 100644
--- a/source3/utils/net_registry_util.c
+++ b/source3/utils/net_registry_util.c
@@ -21,34 +21,35 @@
#include "includes.h"
#include "utils/net_registry_util.h"
+#include "utils/net.h"
void print_registry_key(const char *keyname, NTTIME *modtime)
{
- d_printf("Keyname = %s\n", keyname);
- d_printf("Modtime = %s\n",
+ d_printf(_("Keyname = %s\n"), keyname);
+ d_printf(_("Modtime = %s\n"),
modtime
? http_timestring(talloc_tos(), nt_time_to_unix(*modtime))
- : "None");
+ : _("None"));
d_printf("\n");
}
void print_registry_value(const struct registry_value *valvalue, bool raw)
{
if (!raw) {
- d_printf("Type = %s\n",
+ d_printf(_("Type = %s\n"),
reg_type_lookup(valvalue->type));
}
switch(valvalue->type) {
case REG_DWORD:
if (!raw) {
- d_printf("Value = ");
+ d_printf(_("Value = "));
}
d_printf("%d\n", valvalue->v.dword);
break;
case REG_SZ:
case REG_EXPAND_SZ:
if (!raw) {
- d_printf("Value = \"");
+ d_printf(_("Value = \""));
}
d_printf("%s", valvalue->v.sz.str);
if (!raw) {
@@ -60,7 +61,7 @@ void print_registry_value(const struct registry_value *valvalue, bool raw)
uint32 j;
for (j = 0; j < valvalue->v.multi_sz.num_strings; j++) {
if (!raw) {
- d_printf("Value[%3.3d] = \"", j);
+ d_printf(_("Value[%3.3d] = \""), j);
}
d_printf("%s", valvalue->v.multi_sz.strings[j]);
if (!raw) {
@@ -72,15 +73,15 @@ void print_registry_value(const struct registry_value *valvalue, bool raw)
}
case REG_BINARY:
if (!raw) {
- d_printf("Value = ");
+ d_printf(_("Value = "));
}
- d_printf("%d bytes\n", (int)valvalue->v.binary.length);
+ d_printf(_("%d bytes\n"), (int)valvalue->v.binary.length);
break;
default:
if (!raw) {
- d_printf("Value = ");
+ d_printf(_("Value = "));
}
- d_printf("<unprintable>\n");
+ d_printf(_("<unprintable>\n"));
break;
}
}
@@ -88,7 +89,7 @@ void print_registry_value(const struct registry_value *valvalue, bool raw)
void print_registry_value_with_name(const char *valname,
const struct registry_value *valvalue)
{
- d_printf("Valuename = %s\n", valname);
+ d_printf(_("Valuename = %s\n"), valname);
print_registry_value(valvalue, false);
d_printf("\n");
}