summaryrefslogtreecommitdiff
path: root/source3/utils
diff options
context:
space:
mode:
authorKai Blin <kai@samba.org>2009-07-29 23:59:39 +0200
committerKai Blin <kai@samba.org>2009-07-29 23:59:39 +0200
commit358a55e50d0d9143ffdb2bc3df6701307c1fb3df (patch)
treeb6275f5b125db5463df0e0485ca740f84008b307 /source3/utils
parentb429c3c5cbd83231027be9e6efc06e9da42d9114 (diff)
downloadsamba-358a55e50d0d9143ffdb2bc3df6701307c1fb3df.tar.gz
samba-358a55e50d0d9143ffdb2bc3df6701307c1fb3df.tar.bz2
samba-358a55e50d0d9143ffdb2bc3df6701307c1fb3df.zip
s3 net: i18n support for net cache
Diffstat (limited to 'source3/utils')
-rw-r--r--source3/utils/net_afs.c38
-rw-r--r--source3/utils/net_cache.c100
2 files changed, 70 insertions, 68 deletions
diff --git a/source3/utils/net_afs.c b/source3/utils/net_afs.c
index 0f19ec1e12..043be17b91 100644
--- a/source3/utils/net_afs.c
+++ b/source3/utils/net_afs.c
@@ -22,10 +22,10 @@
int net_afs_usage(struct net_context *c, int argc, const char **argv)
{
- d_printf(" net afs key filename\n"
- "\tImports a OpenAFS KeyFile into our secrets.tdb\n\n");
- d_printf(" net afs impersonate <user> <cell>\n"
- "\tCreates a token for user@cell\n\n");
+ d_printf(_(" net afs key filename\n"
+ "\tImports a OpenAFS KeyFile into our secrets.tdb\n\n"));
+ d_printf(_(" net afs impersonate <user> <cell>\n"
+ "\tCreates a token for user@cell\n\n"));
return -1;
}
@@ -35,27 +35,27 @@ int net_afs_key(struct net_context *c, int argc, const char **argv)
struct afs_keyfile keyfile;
if (argc != 2) {
- d_printf("usage: 'net afs key <keyfile> cell'\n");
+ d_printf(_("usage: 'net afs key <keyfile> cell'\n"));
return -1;
}
if (!secrets_init()) {
- d_fprintf(stderr, "Could not open secrets.tdb\n");
+ d_fprintf(stderr, _("Could not open secrets.tdb\n"));
return -1;
}
if ((fd = open(argv[0], O_RDONLY, 0)) < 0) {
- d_fprintf(stderr, "Could not open %s\n", argv[0]);
+ d_fprintf(stderr, _("Could not open %s\n", argv[0]));
return -1;
}
if (read(fd, &keyfile, sizeof(keyfile)) != sizeof(keyfile)) {
- d_fprintf(stderr, "Could not read keyfile\n");
+ d_fprintf(stderr, _("Could not read keyfile\n"));
return -1;
}
if (!secrets_store_afs_keyfile(argv[1], &keyfile)) {
- d_fprintf(stderr, "Could not write keyfile to secrets.tdb\n");
+ d_fprintf(stderr, _("Could not write keyfile to secrets.tdb\n"));
return -1;
}
@@ -68,23 +68,23 @@ int net_afs_impersonate(struct net_context *c, int argc,
char *token;
if (argc != 2) {
- fprintf(stderr, "Usage: net afs impersonate <user> <cell>\n");
+ fprintf(stderr, _("Usage: net afs impersonate <user> <cell>\n"));
exit(1);
}
token = afs_createtoken_str(argv[0], argv[1]);
if (token == NULL) {
- fprintf(stderr, "Could not create token\n");
+ fprintf(stderr, _("Could not create token\n"));
exit(1);
}
if (!afs_settoken_str(token)) {
- fprintf(stderr, "Could not set token into kernel\n");
+ fprintf(stderr, _("Could not set token into kernel\n"));
exit(1);
}
- printf("Success: %s@%s\n", argv[0], argv[1]);
+ printf(_("Success: %s@%s\n"), argv[0], argv[1]);
return 0;
}
@@ -95,17 +95,17 @@ int net_afs(struct net_context *c, int argc, const char **argv)
"key",
net_afs_key,
NET_TRANSPORT_LOCAL,
- "Import an OpenAFS keyfile",
- "net afs key <filename>\n"
- " Import kefile from <filename>."
+ N_("Import an OpenAFS keyfile"),
+ N_("net afs key <filename>\n"
+ " Import kefile from <filename>.")
},
{
"impersonate",
net_afs_impersonate,
NET_TRANSPORT_LOCAL,
- "Get a user token",
- "net afs impersonate <user> <cell>\n"
- " Create token for user@cell"
+ N_("Get a user token"),
+ N_("net afs impersonate <user> <cell>\n"
+ " Create token for user@cell")
},
{NULL, NULL, 0, NULL, NULL}
};
diff --git a/source3/utils/net_cache.c b/source3/utils/net_cache.c
index 36cd12fb82..96306375fa 100644
--- a/source3/utils/net_cache.c
+++ b/source3/utils/net_cache.c
@@ -71,8 +71,8 @@ static void print_cache_entry(const char* keystr, const char* datastr,
timeout_str = alloc_str;
}
- d_printf("Key: %s\t Timeout: %s\t Value: %s %s\n", keystr,
- timeout_str, datastr, timeout > now_t ? "": "(expired)");
+ d_printf(_("Key: %s\t Timeout: %s\t Value: %s %s\n"), keystr,
+ timeout_str, datastr, timeout > now_t ? "": _("(expired)"));
SAFE_FREE(alloc_str);
}
@@ -81,7 +81,8 @@ static void delete_cache_entry(const char* keystr, const char* datastr,
const time_t timeout, void* dptr)
{
if (!gencache_del(keystr))
- d_fprintf(stderr, "Couldn't delete entry! key = %s\n", keystr);
+ d_fprintf(stderr, _("Couldn't delete entry! key = %s\n"),
+ keystr);
}
@@ -154,7 +155,8 @@ static int net_cache_add(struct net_context *c, int argc, const char **argv)
time_t timeout;
if (argc < 3 || c->display_usage) {
- d_printf("\nUsage: net cache add <key string> <data string> <timeout>\n");
+ d_printf(_("\nUsage:\nnet cache add <key string> <data string> "
+ "<timeout>\n"));
return -1;
}
@@ -165,16 +167,16 @@ static int net_cache_add(struct net_context *c, int argc, const char **argv)
/* parse timeout given in command line */
timeout = parse_timeout(timeout_str);
if (!timeout) {
- d_fprintf(stderr, "Invalid timeout argument.\n");
+ d_fprintf(stderr, _("Invalid timeout argument.\n"));
return -1;
}
if (gencache_set(keystr, datastr, timeout)) {
- d_printf("New cache entry stored successfully.\n");
+ d_printf(_("New cache entry stored successfully.\n"));
return 0;
}
- d_fprintf(stderr, "Entry couldn't be added. Perhaps there's already such a key.\n");
+ d_fprintf(stderr, _("Entry couldn't be added. Perhaps there's already such a key.\n"));
return -1;
}
@@ -190,16 +192,16 @@ static int net_cache_del(struct net_context *c, int argc, const char **argv)
const char *keystr = argv[0];
if (argc < 1 || c->display_usage) {
- d_printf("\nUsage: net cache del <key string>\n");
+ d_printf(_("\nUsage: net cache del <key string>\n"));
return -1;
}
if(gencache_del(keystr)) {
- d_printf("Entry deleted.\n");
+ d_printf(_("Entry deleted.\n"));
return 0;
}
- d_fprintf(stderr, "Couldn't delete specified entry\n");
+ d_fprintf(stderr, _("Couldn't delete specified entry\n"));
return -1;
}
@@ -218,7 +220,7 @@ static int net_cache_get(struct net_context *c, int argc, const char **argv)
time_t timeout;
if (argc < 1 || c->display_usage) {
- d_printf("\nUsage: net cache get <key>\n");
+ d_printf(_("\nUsage: net cache get <key>\n"));
return -1;
}
@@ -228,7 +230,7 @@ static int net_cache_get(struct net_context *c, int argc, const char **argv)
return 0;
}
- d_fprintf(stderr, "Failed to find entry\n");
+ d_fprintf(stderr, _("Failed to find entry\n"));
return -1;
}
@@ -245,7 +247,7 @@ static int net_cache_search(struct net_context *c, int argc, const char **argv)
const char* pattern;
if (argc < 1 || c->display_usage) {
- d_printf("Usage: net cache search <pattern>\n");
+ d_printf(_("Usage: net cache search <pattern>\n"));
return -1;
}
@@ -267,9 +269,9 @@ static int net_cache_list(struct net_context *c, int argc, const char **argv)
const char* pattern = "*";
if (c->display_usage) {
- d_printf("Usage:\n"
- "net cache list\n"
- " List all cache entries.\n");
+ d_printf(_("Usage:\n"
+ "net cache list\n"
+ " List all cache entries.\n"));
return 0;
}
gencache_iterate(print_cache_entry, NULL, pattern);
@@ -288,9 +290,9 @@ static int net_cache_flush(struct net_context *c, int argc, const char **argv)
{
const char* pattern = "*";
if (c->display_usage) {
- d_printf("Usage:\n"
- "net cache flush\n"
- " Delete all cache entries.\n");
+ d_printf(_("Usage:\n"
+ "net cache flush\n"
+ " Delete all cache entries.\n"));
return 0;
}
gencache_iterate(delete_cache_entry, NULL, pattern);
@@ -301,9 +303,9 @@ static int net_cache_stabilize(struct net_context *c, int argc,
const char **argv)
{
if (c->display_usage) {
- d_printf("Usage:\n"
- "net cache flush\n"
- " Delete all cache entries.\n");
+ d_printf(_("Usage:\n"
+ "net cache flush\n"
+ " Delete all cache entries.\n"));
return 0;
}
@@ -326,64 +328,64 @@ int net_cache(struct net_context *c, int argc, const char **argv)
"add",
net_cache_add,
NET_TRANSPORT_LOCAL,
- "Add new cache entry",
- "net cache add <key string> <data string> <timeout>\n"
- " Add new cache entry.\n"
- " key string\tKey string to add cache data under.\n"
- " data string\tData to store under given key.\n"
- " timeout\tTimeout for cache data."
+ N_("Add new cache entry"),
+ N_("net cache add <key string> <data string> <timeout>\n"
+ " Add new cache entry.\n"
+ " key string\tKey string to add cache data under.\n"
+ " data string\tData to store under given key.\n"
+ " timeout\tTimeout for cache data.")
},
{
"del",
net_cache_del,
NET_TRANSPORT_LOCAL,
- "Delete existing cache entry by key",
- "net cache del <key string>\n"
- " Delete existing cache entry by key.\n"
- " key string\tKey string to delete."
+ N_("Delete existing cache entry by key"),
+ N_("net cache del <key string>\n"
+ " Delete existing cache entry by key.\n"
+ " key string\tKey string to delete.")
},
{
"get",
net_cache_get,
NET_TRANSPORT_LOCAL,
- "Get cache entry by key",
- "net cache get <key string>\n"
- " Get cache entry by key.\n"
- " key string\tKey string to look up cache entry for."
+ N_("Get cache entry by key"),
+ N_("net cache get <key string>\n"
+ " Get cache entry by key.\n"
+ " key string\tKey string to look up cache entry for.")
},
{
"search",
net_cache_search,
NET_TRANSPORT_LOCAL,
- "Search entry by pattern",
- "net cache search <pattern>\n"
- " Search entry by pattern.\n"
- " pattern\tPattern to search for in cache."
+ N_("Search entry by pattern"),
+ N_("net cache search <pattern>\n"
+ " Search entry by pattern.\n"
+ " pattern\tPattern to search for in cache.")
},
{
"list",
net_cache_list,
NET_TRANSPORT_LOCAL,
- "List all cache entries",
- "net cache list\n"
- " List all cache entries"
+ N_("List all cache entries"),
+ N_("net cache list\n"
+ " List all cache entries")
},
{
"flush",
net_cache_flush,
NET_TRANSPORT_LOCAL,
- "Delete all cache entries",
- "net cache flush\n"
- " Delete all cache entries"
+ N_("Delete all cache entries"),
+ N_("net cache flush\n"
+ " Delete all cache entries")
},
{
"stabilize",
net_cache_stabilize,
NET_TRANSPORT_LOCAL,
- "Move transient cache content to stable storage",
- "net cache stabilize\n"
- " Move transient cache content to stable storage"
+ N_("Move transient cache content to stable storage"),
+ N_("net cache stabilize\n"
+ " Move transient cache content to stable storage")
},
{NULL, NULL, 0, NULL, NULL}
};