From 95cc95749a5e783f2b5d2124d783f85820baf937 Mon Sep 17 00:00:00 2001 From: Stephen Gallagher Date: Thu, 17 May 2012 13:54:29 -0400 Subject: Always use positional arguments in translatable strings https://fedorahosted.org/sssd/ticket/1336 --- src/sss_client/pam_sss.c | 4 ++-- src/tools/sss_cache.c | 10 +++++----- src/tools/sss_groupdel.c | 2 +- src/tools/sss_groupmod.c | 4 ++-- src/tools/sss_groupshow.c | 10 +++++----- src/tools/sss_useradd.c | 6 +++--- src/tools/sss_userdel.c | 8 ++++---- src/tools/sss_usermod.c | 4 ++-- src/tools/tools_util.h | 2 +- 9 files changed, 25 insertions(+), 25 deletions(-) diff --git a/src/sss_client/pam_sss.c b/src/sss_client/pam_sss.c index e25792fc0..9dca7e3c7 100644 --- a/src/sss_client/pam_sss.c +++ b/src/sss_client/pam_sss.c @@ -637,7 +637,7 @@ static int user_info_grace_login(pam_handle_t *pamh, memcpy(&grace, buf + sizeof(uint32_t), sizeof(uint32_t)); ret = snprintf(user_msg, sizeof(user_msg), _("Your password has expired. " - "You have %d grace login(s) remaining."), + "You have %1$d grace login(s) remaining."), grace); if (ret < 0 || ret >= sizeof(user_msg)) { D(("snprintf failed.")); @@ -682,7 +682,7 @@ static int user_info_expire_warn(pam_handle_t *pamh, } ret = snprintf(user_msg, sizeof(user_msg), - _("Your password will expire in %d %s."), expire, unit); + _("Your password will expire in %1$d %2$s."), expire, unit); if (ret < 0 || ret >= sizeof(user_msg)) { D(("snprintf failed.")); return PAM_SYSTEM_ERR; diff --git a/src/tools/sss_cache.c b/src/tools/sss_cache.c index d0f2b2871..1b2b29fe7 100644 --- a/src/tools/sss_cache.c +++ b/src/tools/sss_cache.c @@ -169,10 +169,10 @@ bool invalidate_entries(TALLOC_CTX *ctx, struct sysdb_ctx *sysdb, ("Searching for %s with filter %s failed\n", type_rec.type_string, filter)); if (name) { - ERROR("No such %s named %s, skipping\n", + ERROR("No such %1$s named %2$s, skipping\n", type_rec.type_string, name); } else { - ERROR("No objects of type %s in the cache, skipping\n", + ERROR("No objects of type %1$s in the cache, skipping\n", type_rec.type_string); } return false; @@ -184,14 +184,14 @@ bool invalidate_entries(TALLOC_CTX *ctx, struct sysdb_ctx *sysdb, if (c_name == NULL) { DEBUG(SSSDBG_MINOR_FAILURE, ("Something bad happened, can't find attribute %s", SYSDB_NAME)); - ERROR("Couldn't invalidate %s", type_rec.type_string); + ERROR("Couldn't invalidate %1$s", type_rec.type_string); iret = false; } else { ret = invalidate_entry(ctx, sysdb, c_name, entry_type); if (ret != EOK) { DEBUG(SSSDBG_MINOR_FAILURE, ("Couldn't invalidate %s %s", type_rec.type_string, c_name)); - ERROR("Couldn't invalidate %s %s", type_rec.type_string, c_name); + ERROR("Couldn't invalidate %1$s %2$s", type_rec.type_string, c_name); iret = false; } } @@ -452,7 +452,7 @@ errno_t init_context(int argc, const char *argv[], struct cache_tool_ctx **tctx) ret = init_domains(ctx, domain); if (ret != EOK) { if (domain) { - ERROR("Could not open domain %s\n", domain); + ERROR("Could not open domain %1$s\n", domain); } else { ERROR("Could not open available domains\n"); } diff --git a/src/tools/sss_groupdel.c b/src/tools/sss_groupdel.c index 09f73504d..70030cab4 100644 --- a/src/tools/sss_groupdel.c +++ b/src/tools/sss_groupdel.c @@ -98,7 +98,7 @@ int main(int argc, const char **argv) if ((tctx->octx->gid < tctx->local->id_min) || (tctx->local->id_max && tctx->octx->gid > tctx->local->id_max)) { - ERROR("Group %s is outside the defined ID range for domain\n", + ERROR("Group %1$s is outside the defined ID range for domain\n", tctx->octx->name); ret = EXIT_FAILURE; goto fini; diff --git a/src/tools/sss_groupmod.c b/src/tools/sss_groupmod.c index 47134aedf..abab4f57f 100644 --- a/src/tools/sss_groupmod.c +++ b/src/tools/sss_groupmod.c @@ -152,7 +152,7 @@ int main(int argc, const char **argv) /* Check group names in the LOCAL domain */ ret = check_group_names(tctx, tctx->octx->addgroups, &badgroup); if (ret != EOK) { - ERROR("Cannot find group %s in local domain, " + ERROR("Cannot find group %1$s in local domain, " "only groups in local domain are allowed\n", badgroup); ret = EXIT_FAILURE; goto fini; @@ -179,7 +179,7 @@ int main(int argc, const char **argv) /* Check group names in the LOCAL domain */ ret = check_group_names(tctx, tctx->octx->rmgroups, &badgroup); if (ret != EOK) { - ERROR("Cannot find group %s in local domain, " + ERROR("Cannot find group %1$s in local domain, " "only groups in local domain are allowed\n", badgroup); ret = EXIT_FAILURE; goto fini; diff --git a/src/tools/sss_groupshow.c b/src/tools/sss_groupshow.c index 764e32416..0eecd3a96 100644 --- a/src/tools/sss_groupshow.c +++ b/src/tools/sss_groupshow.c @@ -559,26 +559,26 @@ static void print_group_info(struct group_info *g, int level) snprintf(fmt, 8, "%%%ds", level*PADDING_SPACES); snprintf(padding, 512, fmt, ""); - printf(_("%s%sGroup: %s\n"), padding, + printf(_("%1$s%2$sGroup: %3$s\n"), padding, g->mpg ? _("Magic Private ") : "", g->name); - printf(_("%sGID number: %d\n"), padding, g->gid); + printf(_("%1$sGID number: %2$d\n"), padding, g->gid); - printf(_("%sMember users: "), padding); + printf(_("%1$sMember users: "), padding); if (g->user_members) { for (i=0; g->user_members[i]; ++i) { printf("%s%s", i>0 ? "," : "", g->user_members[i]); } } - printf(_("\n%sIs a member of: "), padding); + printf(_("\n%1$sIs a member of: "), padding); if (g->memberofs) { for (i=0; g->memberofs[i]; ++i) { printf("%s%s", i>0 ? "," : "", g->memberofs[i]); } } - printf(_("\n%sMember groups: "), padding); + printf(_("\n%1$sMember groups: "), padding); } static void print_recursive(struct group_info **group_members, int level) diff --git a/src/tools/sss_useradd.c b/src/tools/sss_useradd.c index 5ca2612a3..4df7c098e 100644 --- a/src/tools/sss_useradd.c +++ b/src/tools/sss_useradd.c @@ -150,7 +150,7 @@ int main(int argc, const char **argv) /* Check group names in the LOCAL domain */ ret = check_group_names(tctx, tctx->octx->addgroups, &badgroup); if (ret != EOK) { - ERROR("Cannot find group %s in local domain\n", badgroup); + ERROR("Cannot find group %1$s in local domain\n", badgroup); ret = EXIT_FAILURE; goto fini; } @@ -229,7 +229,7 @@ int main(int argc, const char **argv) ERROR("User's home directory already exists, not copying " "data from skeldir\n"); } else if (ret != EOK) { - ERROR("Cannot create user's home directory: %s\n", strerror(ret)); + ERROR("Cannot create user's home directory: %1$s\n", strerror(ret)); ret = EXIT_FAILURE; goto fini; } @@ -240,7 +240,7 @@ int main(int argc, const char **argv) tctx->octx->uid, tctx->octx->gid); if (ret != EOK) { - ERROR("Cannot create user's mail spool: %s\n", strerror(ret)); + ERROR("Cannot create user's mail spool: %1$s\n", strerror(ret)); DEBUG(1, ("Cannot create user's mail spool: [%d][%s].\n", ret, strerror(ret))); ret = EXIT_FAILURE; diff --git a/src/tools/sss_userdel.c b/src/tools/sss_userdel.c index 6d5e82958..0d1c63e4c 100644 --- a/src/tools/sss_userdel.c +++ b/src/tools/sss_userdel.c @@ -227,7 +227,7 @@ int main(int argc, const char **argv) if ((tctx->octx->uid < tctx->local->id_min) || (tctx->local->id_max && tctx->octx->uid > tctx->local->id_max)) { - ERROR("User %s is outside the defined ID range for domain\n", + ERROR("User %1$s is outside the defined ID range for domain\n", tctx->octx->name); ret = EXIT_FAILURE; goto fini; @@ -264,7 +264,7 @@ int main(int argc, const char **argv) break; case EOK: - ERROR("WARNING: The user (uid %lu) was still logged in when " + ERROR("WARNING: The user (uid %1$lu) was still logged in when " "deleted.\n", (unsigned long) tctx->octx->uid); break; @@ -281,7 +281,7 @@ int main(int argc, const char **argv) ret = run_userdel_cmd(tctx); if (ret != EOK) { - ERROR("The post-delete command failed: %s\n", strerror(ret)); + ERROR("The post-delete command failed: %1$s\n", strerror(ret)); goto fini; } @@ -295,7 +295,7 @@ int main(int argc, const char **argv) if (ret == EPERM) { ERROR("Not removing home dir - not owned by user\n"); } else if (ret != EOK) { - ERROR("Cannot remove homedir: %s\n", strerror(ret)); + ERROR("Cannot remove homedir: %1$s\n", strerror(ret)); ret = EXIT_FAILURE; goto fini; } diff --git a/src/tools/sss_usermod.c b/src/tools/sss_usermod.c index dfcde9e56..b761de225 100644 --- a/src/tools/sss_usermod.c +++ b/src/tools/sss_usermod.c @@ -173,7 +173,7 @@ int main(int argc, const char **argv) /* Check group names in the LOCAL domain */ ret = check_group_names(tctx, tctx->octx->addgroups, &badgroup); if (ret != EOK) { - ERROR("Cannot find group %s in local domain, " + ERROR("Cannot find group %1$s in local domain, " "only groups in local domain are allowed\n", badgroup); ret = EXIT_FAILURE; goto fini; @@ -200,7 +200,7 @@ int main(int argc, const char **argv) /* Check group names in the LOCAL domain */ ret = check_group_names(tctx, tctx->octx->rmgroups, &badgroup); if (ret != EOK) { - ERROR("Cannot find group %s in local domain, " + ERROR("Cannot find group %1$s in local domain, " "only groups in local domain are allowed\n", badgroup); ret = EXIT_FAILURE; goto fini; diff --git a/src/tools/tools_util.h b/src/tools/tools_util.h index fccd9d96b..fd26b8905 100644 --- a/src/tools/tools_util.h +++ b/src/tools/tools_util.h @@ -37,7 +37,7 @@ val = getuid(); \ if (val != 0) { \ DEBUG(1, ("Running under %d, must be root\n", val)); \ - ERROR("%s must be run as root\n", prg_name); \ + ERROR("%1$s must be run as root\n", prg_name); \ val = EXIT_FAILURE; \ goto fini; \ } \ -- cgit