From 51f9d1ecd53f490f2a7383a7e1931ce6d9933e21 Mon Sep 17 00:00:00 2001 From: Kai Blin Date: Thu, 30 Jul 2009 09:00:31 +0200 Subject: s3 net: i18n support for net conf --- source3/utils/net_conf.c | 243 ++++++++++++++++++++++++----------------------- 1 file changed, 123 insertions(+), 120 deletions(-) (limited to 'source3/utils/net_conf.c') diff --git a/source3/utils/net_conf.c b/source3/utils/net_conf.c index 6b0f70adfa..4b511f2faa 100644 --- a/source3/utils/net_conf.c +++ b/source3/utils/net_conf.c @@ -39,104 +39,104 @@ static int net_conf_list_usage(struct net_context *c, int argc, const char **argv) { - d_printf("USAGE: net conf list\n"); + d_printf(_("USAGE: net conf list\n")); return -1; } static int net_conf_import_usage(struct net_context *c, int argc, const char**argv) { - d_printf("USAGE: net conf import [--test|-T] " - "[]\n" - "\t[--test|-T] testmode - do not act, just print " + d_printf(_("USAGE: net conf import [--test|-T] " + "[]\n" + "\t[--test|-T] testmode - do not act, just print " "what would be done\n" - "\t only import service , " - "ignore the rest\n"); + "\t only import service , " + "ignore the rest\n")); return -1; } static int net_conf_listshares_usage(struct net_context *c, int argc, const char **argv) { - d_printf("USAGE: net conf listshares\n"); + d_printf(_("USAGE: net conf listshares\n")); return -1; } static int net_conf_drop_usage(struct net_context *c, int argc, const char **argv) { - d_printf("USAGE: net conf drop\n"); + d_printf(_("USAGE: net conf drop\n")); return -1; } static int net_conf_showshare_usage(struct net_context *c, int argc, const char **argv) { - d_printf("USAGE: net conf showshare \n"); + d_printf(_("USAGE: net conf showshare \n")); return -1; } static int net_conf_addshare_usage(struct net_context *c, int argc, const char **argv) { - d_printf("USAGE: net conf addshare " - "[writeable={y|N} [guest_ok={y|N} []]\n" - "\t the new share name.\n" - "\t the path on the filesystem to export.\n" - "\twriteable={y|N} set \"writeable to \"yes\" or " - "\"no\" (default) on this share.\n" - "\tguest_ok={y|N} set \"guest ok\" to \"yes\" or " - "\"no\" (default) on this share.\n" - "\t optional comment for the new share.\n"); + d_printf(_("USAGE: net conf addshare " + "[writeable={y|N} [guest_ok={y|N} []]\n" + "\t the new share name.\n" + "\t the path on the filesystem to export.\n" + "\twriteable={y|N} set \"writeable to \"yes\" or " + "\"no\" (default) on this share.\n" + "\tguest_ok={y|N} set \"guest ok\" to \"yes\" or " + "\"no\" (default) on this share.\n" + "\t optional comment for the new share.\n")); return -1; } static int net_conf_delshare_usage(struct net_context *c, int argc, const char **argv) { - d_printf("USAGE: net conf delshare \n"); + d_printf(_("USAGE: net conf delshare \n")); return -1; } static int net_conf_setparm_usage(struct net_context *c, int argc, const char **argv) { - d_printf("USAGE: net conf setparm
\n"); + d_printf(_("USAGE: net conf setparm
\n")); return -1; } static int net_conf_getparm_usage(struct net_context *c, int argc, const char **argv) { - d_printf("USAGE: net conf getparm
\n"); + d_printf(_("USAGE: net conf getparm
\n")); return -1; } static int net_conf_delparm_usage(struct net_context *c, int argc, const char **argv) { - d_printf("USAGE: net conf delparm
\n"); + d_printf(_("USAGE: net conf delparm
\n")); return -1; } static int net_conf_getincludes_usage(struct net_context *c, int argc, const char **argv) { - d_printf("USAGE: net conf getincludes
\n"); + d_printf(_("USAGE: net conf getincludes
\n")); return -1; } static int net_conf_setincludes_usage(struct net_context *c, int argc, const char **argv) { - d_printf("USAGE: net conf setincludes
[]*\n"); + d_printf(_("USAGE: net conf setincludes
[]*\n")); return -1; } static int net_conf_delincludes_usage(struct net_context *c, int argc, const char **argv) { - d_printf("USAGE: net conf delincludes
\n"); + d_printf(_("USAGE: net conf delincludes
\n")); return -1; } @@ -248,7 +248,7 @@ static int net_conf_list(struct net_context *c, struct smbconf_ctx *conf_ctx, werr = smbconf_get_config(conf_ctx, mem_ctx, &num_shares, &shares); if (!W_ERROR_IS_OK(werr)) { - d_fprintf(stderr, "Error getting config: %s\n", + d_fprintf(stderr, _("Error getting config: %s\n"), win_errstr(werr)); goto done; } @@ -302,7 +302,7 @@ static int net_conf_import(struct net_context *c, struct smbconf_ctx *conf_ctx, case 2: servicename = talloc_strdup(mem_ctx, argv[1]); if (servicename == NULL) { - d_printf("error: out of memory!\n"); + d_printf(_("error: out of memory!\n")); goto done; } case 1: @@ -315,20 +315,20 @@ static int net_conf_import(struct net_context *c, struct smbconf_ctx *conf_ctx, conf_source = talloc_asprintf(mem_ctx, "file:%s", filename); if (conf_source == NULL) { - d_printf("error: out of memory!\n"); + d_printf(_("error: out of memory!\n")); goto done; } werr = smbconf_init(mem_ctx, &txt_ctx, conf_source); if (!W_ERROR_IS_OK(werr)) { - d_printf("error loading file '%s': %s\n", filename, + d_printf(_("error loading file '%s': %s\n"), filename, win_errstr(werr)); goto done; } if (c->opt_testmode) { - d_printf("\nTEST MODE - " - "would import the following configuration:\n\n"); + d_printf(_("\nTEST MODE - " + "would import the following configuration:\n\n")); } if (servicename != NULL) { @@ -343,7 +343,7 @@ static int net_conf_import(struct net_context *c, struct smbconf_ctx *conf_ctx, werr = smbconf_transaction_start(conf_ctx); if (!W_ERROR_IS_OK(werr)) { - d_printf("error starting transaction: %s\n", + d_printf(_("error starting transaction: %s\n"), win_errstr(werr)); goto done; } @@ -379,7 +379,7 @@ static int net_conf_import(struct net_context *c, struct smbconf_ctx *conf_ctx, */ werr = smbconf_transaction_start(conf_ctx); if (!W_ERROR_IS_OK(werr)) { - d_printf("error starting transaction: %s\n", + d_printf(_("error starting transaction: %s\n"), win_errstr(werr)); goto done; } @@ -397,13 +397,14 @@ static int net_conf_import(struct net_context *c, struct smbconf_ctx *conf_ctx, werr = smbconf_transaction_commit(conf_ctx); if (!W_ERROR_IS_OK(werr)) { - d_printf("error committing transaction: %s\n", + d_printf(_("error committing transaction: " + "%s\n"), win_errstr(werr)); goto done; } werr = smbconf_transaction_start(conf_ctx); if (!W_ERROR_IS_OK(werr)) { - d_printf("error starting transaction: %s\n", + d_printf(_("error starting transaction: %s\n"), win_errstr(werr)); goto done; } @@ -412,7 +413,7 @@ static int net_conf_import(struct net_context *c, struct smbconf_ctx *conf_ctx, werr = smbconf_transaction_commit(conf_ctx); if (!W_ERROR_IS_OK(werr)) { - d_printf("error committing transaction: %s\n", + d_printf(_("error committing transaction: %s\n"), win_errstr(werr)); } else { ret = 0; @@ -423,7 +424,7 @@ static int net_conf_import(struct net_context *c, struct smbconf_ctx *conf_ctx, cancel: werr = smbconf_transaction_cancel(conf_ctx); if (!W_ERROR_IS_OK(werr)) { - d_printf("error cancelling transaction: %s\n", + d_printf(_("error cancelling transaction: %s\n"), win_errstr(werr)); } @@ -480,7 +481,7 @@ static int net_conf_drop(struct net_context *c, struct smbconf_ctx *conf_ctx, werr = smbconf_drop(conf_ctx); if (!W_ERROR_IS_OK(werr)) { - d_fprintf(stderr, "Error deleting configuration: %s\n", + d_fprintf(stderr, _("Error deleting configuration: %s\n"), win_errstr(werr)); goto done; } @@ -517,7 +518,7 @@ static int net_conf_showshare(struct net_context *c, werr = smbconf_get_share(conf_ctx, mem_ctx, sharename, &service); if (!W_ERROR_IS_OK(werr)) { - d_printf("error getting share parameters: %s\n", + d_printf(_("error getting share parameters: %s\n"), win_errstr(werr)); goto done; } @@ -610,7 +611,7 @@ static int net_conf_addshare(struct net_context *c, path = argv[1]; sharename = talloc_strdup(mem_ctx, argv[0]); if (sharename == NULL) { - d_printf("error: out of memory!\n"); + d_printf(_("error: out of memory!\n")); goto done; } @@ -626,20 +627,20 @@ static int net_conf_addshare(struct net_context *c, if (!validate_net_name(sharename, INVALID_SHARENAME_CHARS, strlen(sharename))) { - d_fprintf(stderr, "ERROR: share name %s contains " - "invalid characters (any of %s)\n", + d_fprintf(stderr, _("ERROR: share name %s contains " + "invalid characters (any of %s)\n"), sharename, INVALID_SHARENAME_CHARS); goto done; } if (strequal(sharename, GLOBAL_NAME)) { d_fprintf(stderr, - "ERROR: 'global' is not a valid share name.\n"); + _("ERROR: 'global' is not a valid share name.\n")); goto done; } if (smbconf_share_exists(conf_ctx, sharename)) { - d_fprintf(stderr, "ERROR: share %s already exists.\n", + d_fprintf(stderr, _("ERROR: share %s already exists.\n"), sharename); goto done; } @@ -648,23 +649,23 @@ static int net_conf_addshare(struct net_context *c, if (path[0] != '/') { d_fprintf(stderr, - "Error: path '%s' is not an absolute path.\n", + _("Error: path '%s' is not an absolute path.\n"), path); goto done; } if (sys_stat(path, &sbuf) != 0) { d_fprintf(stderr, - "ERROR: cannot stat path '%s' to ensure " - "this is a directory.\n" - "Error was '%s'.\n", + _("ERROR: cannot stat path '%s' to ensure " + "this is a directory.\n" + "Error was '%s'.\n"), path, strerror(errno)); goto done; } if (!S_ISDIR(sbuf.st_ex_mode)) { d_fprintf(stderr, - "ERROR: path '%s' is not a directory.\n", + _("ERROR: path '%s' is not a directory.\n"), path); goto done; } @@ -675,7 +676,7 @@ static int net_conf_addshare(struct net_context *c, werr = smbconf_create_share(conf_ctx, sharename); if (!W_ERROR_IS_OK(werr)) { - d_fprintf(stderr, "Error creating share %s: %s\n", + d_fprintf(stderr, _("Error creating share %s: %s\n"), sharename, win_errstr(werr)); goto done; } @@ -686,7 +687,7 @@ static int net_conf_addshare(struct net_context *c, werr = smbconf_set_parameter(conf_ctx, sharename, "path", path); if (!W_ERROR_IS_OK(werr)) { - d_fprintf(stderr, "Error setting parameter %s: %s\n", + d_fprintf(stderr, _("Error setting parameter %s: %s\n"), "path", win_errstr(werr)); goto done; } @@ -695,7 +696,7 @@ static int net_conf_addshare(struct net_context *c, werr = smbconf_set_parameter(conf_ctx, sharename, "comment", comment); if (!W_ERROR_IS_OK(werr)) { - d_fprintf(stderr, "Error setting parameter %s: %s\n", + d_fprintf(stderr, _("Error setting parameter %s: %s\n"), "comment", win_errstr(werr)); goto done; } @@ -703,7 +704,7 @@ static int net_conf_addshare(struct net_context *c, werr = smbconf_set_parameter(conf_ctx, sharename, "guest ok", guest_ok); if (!W_ERROR_IS_OK(werr)) { - d_fprintf(stderr, "Error setting parameter %s: %s\n", + d_fprintf(stderr, _("Error setting parameter %s: %s\n"), "'guest ok'", win_errstr(werr)); goto done; } @@ -711,7 +712,7 @@ static int net_conf_addshare(struct net_context *c, werr = smbconf_set_parameter(conf_ctx, sharename, "writeable", writeable); if (!W_ERROR_IS_OK(werr)) { - d_fprintf(stderr, "Error setting parameter %s: %s\n", + d_fprintf(stderr, _("Error setting parameter %s: %s\n"), "writeable", win_errstr(werr)); goto done; } @@ -738,13 +739,13 @@ static int net_conf_delshare(struct net_context *c, } sharename = talloc_strdup(mem_ctx, argv[0]); if (sharename == NULL) { - d_printf("error: out of memory!\n"); + d_printf(_("error: out of memory!\n")); goto done; } werr = smbconf_delete_share(conf_ctx, sharename); if (!W_ERROR_IS_OK(werr)) { - d_fprintf(stderr, "Error deleting share %s: %s\n", + d_fprintf(stderr, _("Error deleting share %s: %s\n"), sharename, win_errstr(werr)); goto done; } @@ -776,20 +777,20 @@ static int net_conf_setparm(struct net_context *c, struct smbconf_ctx *conf_ctx, if (strlen(argv[0]) != 0) { service = talloc_strdup(mem_ctx, argv[0]); if (service == NULL) { - d_printf("error: out of memory!\n"); + d_printf(_("error: out of memory!\n")); goto done; } } param = strlower_talloc(mem_ctx, argv[1]); if (param == NULL) { - d_printf("error: out of memory!\n"); + d_printf(_("error: out of memory!\n")); goto done; } value_str = argv[2]; werr = smbconf_transaction_start(conf_ctx); if (!W_ERROR_IS_OK(werr)) { - d_printf("error starting transaction: %s\n", + d_printf(_("error starting transaction: %s\n"), win_errstr(werr)); goto done; } @@ -797,7 +798,7 @@ static int net_conf_setparm(struct net_context *c, struct smbconf_ctx *conf_ctx, if (!smbconf_share_exists(conf_ctx, service)) { werr = smbconf_create_share(conf_ctx, service); if (!W_ERROR_IS_OK(werr)) { - d_fprintf(stderr, "Error creating share '%s': %s\n", + d_fprintf(stderr, _("Error creating share '%s': %s\n"), service, win_errstr(werr)); goto cancel; } @@ -806,14 +807,14 @@ static int net_conf_setparm(struct net_context *c, struct smbconf_ctx *conf_ctx, werr = smbconf_set_parameter(conf_ctx, service, param, value_str); if (!W_ERROR_IS_OK(werr)) { - d_fprintf(stderr, "Error setting value '%s': %s\n", + d_fprintf(stderr, _("Error setting value '%s': %s\n"), param, win_errstr(werr)); goto cancel; } werr = smbconf_transaction_commit(conf_ctx); if (!W_ERROR_IS_OK(werr)) { - d_printf("error committing transaction: %s\n", + d_printf(_("error committing transaction: %s\n"), win_errstr(werr)); } else { ret = 0; @@ -824,7 +825,7 @@ static int net_conf_setparm(struct net_context *c, struct smbconf_ctx *conf_ctx, cancel: werr = smbconf_transaction_cancel(conf_ctx); if (!W_ERROR_IS_OK(werr)) { - d_printf("error cancelling transaction: %s\n", + d_printf(_("error cancelling transaction: %s\n"), win_errstr(werr)); } @@ -856,13 +857,13 @@ static int net_conf_getparm(struct net_context *c, struct smbconf_ctx *conf_ctx, if (strlen(argv[0]) != 0) { service = talloc_strdup(mem_ctx, argv[0]); if (service == NULL) { - d_printf("error: out of memory!\n"); + d_printf(_("error: out of memory!\n")); goto done; } } param = strlower_talloc(mem_ctx, argv[1]); if (param == NULL) { - d_printf("error: out of memory!\n"); + d_printf(_("error: out of memory!\n")); goto done; } @@ -870,16 +871,16 @@ static int net_conf_getparm(struct net_context *c, struct smbconf_ctx *conf_ctx, if (W_ERROR_EQUAL(werr, WERR_NO_SUCH_SERVICE)) { d_fprintf(stderr, - "Error: given service '%s' does not exist.\n", + _("Error: given service '%s' does not exist.\n"), service); goto done; } else if (W_ERROR_EQUAL(werr, WERR_INVALID_PARAM)) { d_fprintf(stderr, - "Error: given parameter '%s' is not set.\n", + _("Error: given parameter '%s' is not set.\n"), param); goto done; } else if (!W_ERROR_IS_OK(werr)) { - d_fprintf(stderr, "Error getting value '%s': %s.\n", + d_fprintf(stderr, _("Error getting value '%s': %s.\n"), param, win_errstr(werr)); goto done; } @@ -912,7 +913,7 @@ static int net_conf_delparm(struct net_context *c, struct smbconf_ctx *conf_ctx, if (strlen(argv[0]) != 0) { service = talloc_strdup(mem_ctx, argv[0]); if (service == NULL) { - d_printf("error: out of memory!\n"); + d_printf(_("error: out of memory!\n")); goto done; } } @@ -926,16 +927,16 @@ static int net_conf_delparm(struct net_context *c, struct smbconf_ctx *conf_ctx, if (W_ERROR_EQUAL(werr, WERR_NO_SUCH_SERVICE)) { d_fprintf(stderr, - "Error: given service '%s' does not exist.\n", + _("Error: given service '%s' does not exist.\n"), service); goto done; } else if (W_ERROR_EQUAL(werr, WERR_INVALID_PARAM)) { d_fprintf(stderr, - "Error: given parameter '%s' is not set.\n", + _("Error: given parameter '%s' is not set.\n"), param); goto done; } else if (!W_ERROR_IS_OK(werr)) { - d_fprintf(stderr, "Error deleting value '%s': %s.\n", + d_fprintf(stderr, _("Error deleting value '%s': %s.\n"), param, win_errstr(werr)); goto done; } @@ -966,14 +967,14 @@ static int net_conf_getincludes(struct net_context *c, service = talloc_strdup(mem_ctx, argv[0]); if (service == NULL) { - d_printf("error: out of memory!\n"); + d_printf(_("error: out of memory!\n")); goto done; } werr = smbconf_get_includes(conf_ctx, mem_ctx, service, &num_includes, &includes); if (!W_ERROR_IS_OK(werr)) { - d_printf("error getting includes: %s\n", win_errstr(werr)); + d_printf(_("error getting includes: %s\n"), win_errstr(werr)); goto done; } @@ -1006,7 +1007,7 @@ static int net_conf_setincludes(struct net_context *c, service = talloc_strdup(mem_ctx, argv[0]); if (service == NULL) { - d_printf("error: out of memory!\n"); + d_printf(_("error: out of memory!\n")); goto done; } @@ -1019,7 +1020,7 @@ static int net_conf_setincludes(struct net_context *c, werr = smbconf_set_includes(conf_ctx, service, num_includes, includes); if (!W_ERROR_IS_OK(werr)) { - d_printf("error setting includes: %s\n", win_errstr(werr)); + d_printf(_("error setting includes: %s\n"), win_errstr(werr)); goto done; } @@ -1046,13 +1047,13 @@ static int net_conf_delincludes(struct net_context *c, service = talloc_strdup(mem_ctx, argv[0]); if (service == NULL) { - d_printf("error: out of memory!\n"); + d_printf(_("error: out of memory!\n")); goto done; } werr = smbconf_delete_includes(conf_ctx, service); if (!W_ERROR_IS_OK(werr)) { - d_printf("error deleting includes: %s\n", win_errstr(werr)); + d_printf(_("error deleting includes: %s\n"), win_errstr(werr)); goto done; } @@ -1132,7 +1133,7 @@ static int net_conf_run_function(struct net_context *c, int argc, } } - d_printf("Usage:\n"); + d_printf(_("Usage:\n")); for (i=0; table[i].funcname; i++) { if (c->display_usage == false) d_printf("%s %-15s %s\n", whoami, table[i].funcname, @@ -1156,108 +1157,110 @@ int net_conf(struct net_context *c, int argc, const char **argv) "list", net_conf_list, NET_TRANSPORT_LOCAL, - "Dump the complete configuration in smb.conf like " - "format.", - "net conf list\n" - " Dump the complete configuration in smb.conf like " - "format." + N_("Dump the complete configuration in smb.conf like " + "format."), + N_("net conf list\n" + " Dump the complete configuration in smb.conf " + "like format.") }, { "import", net_conf_import, NET_TRANSPORT_LOCAL, - "Import configuration from file in smb.conf format.", - "net conf import\n" - " Import configuration from file in smb.conf format." + N_("Import configuration from file in smb.conf " + "format."), + N_("net conf import\n" + " Import configuration from file in smb.conf " + "format.") }, { "listshares", net_conf_listshares, NET_TRANSPORT_LOCAL, - "List the share names.", - "net conf listshares\n" - " List the share names." + N_("List the share names."), + N_("net conf listshares\n" + " List the share names.") }, { "drop", net_conf_drop, NET_TRANSPORT_LOCAL, - "Delete the complete configuration.", - "net conf drop\n" - " Delete the complete configuration." + N_("Delete the complete configuration."), + N_("net conf drop\n" + " Delete the complete configuration.") }, { "showshare", net_conf_showshare, NET_TRANSPORT_LOCAL, - "Show the definition of a share.", - "net conf showshare\n" - " Show the definition of a share." + N_("Show the definition of a share."), + N_("net conf showshare\n" + " Show the definition of a share.") }, { "addshare", net_conf_addshare, NET_TRANSPORT_LOCAL, - "Create a new share.", - "net conf addshare\n" - " Create a new share." + N_("Create a new share."), + N_("net conf addshare\n" + " Create a new share.") }, { "delshare", net_conf_delshare, NET_TRANSPORT_LOCAL, - "Delete a share.", - "net conf delshare\n" - " Delete a share." + N_("Delete a share."), + N_("net conf delshare\n" + " Delete a share.") }, { "setparm", net_conf_setparm, NET_TRANSPORT_LOCAL, - "Store a parameter.", - "net conf setparm\n" - " Store a parameter." + N_("Store a parameter."), + N_("net conf setparm\n" + " Store a parameter.") }, { "getparm", net_conf_getparm, NET_TRANSPORT_LOCAL, - "Retrieve the value of a parameter.", - "net conf getparm\n" - " Retrieve the value of a parameter." + N_("Retrieve the value of a parameter."), + N_("net conf getparm\n" + " Retrieve the value of a parameter.") }, { "delparm", net_conf_delparm, NET_TRANSPORT_LOCAL, - "Delete a parameter.", - "net conf delparm\n" - " Delete a parameter." + N_("Delete a parameter."), + N_("net conf delparm\n" + " Delete a parameter.") }, { "getincludes", net_conf_getincludes, NET_TRANSPORT_LOCAL, - "Show the includes of a share definition.", - "net conf getincludes\n" - " Show the includes of a share definition." + N_("Show the includes of a share definition."), + N_("net conf getincludes\n" + " Show the includes of a share definition.") }, { "setincludes", net_conf_setincludes, NET_TRANSPORT_LOCAL, - "Set includes for a share.", - "net conf setincludes\n" - " Set includes for a share." + N_("Set includes for a share."), + N_("net conf setincludes\n" + " Set includes for a share.") }, { "delincludes", net_conf_delincludes, NET_TRANSPORT_LOCAL, - "Delete includes from a share definition.", - "net conf setincludes\n" - " Delete includes from a share definition." + N_("Delete includes from a share definition."), + N_("net conf setincludes\n" + " Delete includes from a share definition.") }, {NULL, NULL, 0, NULL, NULL} }; -- cgit