2
0
mirror of https://github.com/sudo-project/sudo.git synced 2025-08-31 14:25:15 +00:00

Call gettext() on parameters for warning()/warningx() instead of

having warning() do it for us.
This commit is contained in:
Todd C. Miller
2012-11-25 09:34:04 -05:00
parent 15c69e0e3f
commit 7b3d268687
31 changed files with 205 additions and 216 deletions

View File

@@ -205,7 +205,7 @@ set_default(char *var, char *val, int op)
break;
}
if (!cur->name) {
warningx(N_("unknown defaults entry `%s'"), var);
warningx(_("unknown defaults entry `%s'"), var);
debug_return_bool(false);
}
@@ -213,20 +213,20 @@ set_default(char *var, char *val, int op)
case T_LOGFAC:
if (!store_syslogfac(val, cur, op)) {
if (val)
warningx(N_("value `%s' is invalid for option `%s'"),
warningx(_("value `%s' is invalid for option `%s'"),
val, var);
else
warningx(N_("no value specified for `%s'"), var);
warningx(_("no value specified for `%s'"), var);
debug_return_bool(false);
}
break;
case T_LOGPRI:
if (!store_syslogpri(val, cur, op)) {
if (val)
warningx(N_("value `%s' is invalid for option `%s'"),
warningx(_("value `%s' is invalid for option `%s'"),
val, var);
else
warningx(N_("no value specified for `%s'"), var);
warningx(_("no value specified for `%s'"), var);
debug_return_bool(false);
}
break;
@@ -234,16 +234,16 @@ set_default(char *var, char *val, int op)
if (!val) {
/* Check for bogus boolean usage or lack of a value. */
if (!ISSET(cur->type, T_BOOL) || op != false) {
warningx(N_("no value specified for `%s'"), var);
warningx(_("no value specified for `%s'"), var);
debug_return_bool(false);
}
}
if (ISSET(cur->type, T_PATH) && val && *val != '/') {
warningx(N_("values for `%s' must start with a '/'"), var);
warningx(_("values for `%s' must start with a '/'"), var);
debug_return_bool(false);
}
if (!store_str(val, cur, op)) {
warningx(N_("value `%s' is invalid for option `%s'"), val, var);
warningx(_("value `%s' is invalid for option `%s'"), val, var);
debug_return_bool(false);
}
break;
@@ -251,12 +251,12 @@ set_default(char *var, char *val, int op)
if (!val) {
/* Check for bogus boolean usage or lack of a value. */
if (!ISSET(cur->type, T_BOOL) || op != false) {
warningx(N_("no value specified for `%s'"), var);
warningx(_("no value specified for `%s'"), var);
debug_return_bool(false);
}
}
if (!store_int(val, cur, op)) {
warningx(N_("value `%s' is invalid for option `%s'"), val, var);
warningx(_("value `%s' is invalid for option `%s'"), val, var);
debug_return_bool(false);
}
break;
@@ -264,12 +264,12 @@ set_default(char *var, char *val, int op)
if (!val) {
/* Check for bogus boolean usage or lack of a value. */
if (!ISSET(cur->type, T_BOOL) || op != false) {
warningx(N_("no value specified for `%s'"), var);
warningx(_("no value specified for `%s'"), var);
debug_return_bool(false);
}
}
if (!store_uint(val, cur, op)) {
warningx(N_("value `%s' is invalid for option `%s'"), val, var);
warningx(_("value `%s' is invalid for option `%s'"), val, var);
debug_return_bool(false);
}
break;
@@ -277,12 +277,12 @@ set_default(char *var, char *val, int op)
if (!val) {
/* Check for bogus boolean usage or lack of a value. */
if (!ISSET(cur->type, T_BOOL) || op != false) {
warningx(N_("no value specified for `%s'"), var);
warningx(_("no value specified for `%s'"), var);
debug_return_bool(false);
}
}
if (!store_float(val, cur, op)) {
warningx(N_("value `%s' is invalid for option `%s'"), val, var);
warningx(_("value `%s' is invalid for option `%s'"), val, var);
debug_return_bool(false);
}
break;
@@ -290,18 +290,18 @@ set_default(char *var, char *val, int op)
if (!val) {
/* Check for bogus boolean usage or lack of a value. */
if (!ISSET(cur->type, T_BOOL) || op != false) {
warningx(N_("no value specified for `%s'"), var);
warningx(_("no value specified for `%s'"), var);
debug_return_bool(false);
}
}
if (!store_mode(val, cur, op)) {
warningx(N_("value `%s' is invalid for option `%s'"), val, var);
warningx(_("value `%s' is invalid for option `%s'"), val, var);
debug_return_bool(false);
}
break;
case T_FLAG:
if (val) {
warningx(N_("option `%s' does not take a value"), var);
warningx(_("option `%s' does not take a value"), var);
debug_return_bool(false);
}
cur->sd_un.flag = op;
@@ -310,22 +310,22 @@ set_default(char *var, char *val, int op)
if (!val) {
/* Check for bogus boolean usage or lack of a value. */
if (!ISSET(cur->type, T_BOOL) || op != false) {
warningx(N_("no value specified for `%s'"), var);
warningx(_("no value specified for `%s'"), var);
debug_return_bool(false);
}
}
if (!store_list(val, cur, op)) {
warningx(N_("value `%s' is invalid for option `%s'"), val, var);
warningx(_("value `%s' is invalid for option `%s'"), val, var);
debug_return_bool(false);
}
break;
case T_TUPLE:
if (!val && !ISSET(cur->type, T_BOOL)) {
warningx(N_("no value specified for `%s'"), var);
warningx(_("no value specified for `%s'"), var);
debug_return_bool(false);
}
if (!store_tuple(val, cur, op)) {
warningx(N_("value `%s' is invalid for option `%s'"), val, var);
warningx(_("value `%s' is invalid for option `%s'"), val, var);
debug_return_bool(false);
}
break;
@@ -580,7 +580,7 @@ check_defaults(int what, bool quiet)
}
if (cur->name == NULL) {
if (!quiet)
warningx(N_("unknown defaults entry `%s'"), def->var);
warningx(_("unknown defaults entry `%s'"), def->var);
rc = false;
}
}