Commit e8548a14 e8548a14f1268da5cefe45656c7518148a504c75 by Sergey Poznyakoff

Use mu_true_answer_p()

1 parent d12f61a6
......@@ -139,7 +139,7 @@ parse_headers (FILE *fp, compose_env_t *env)
header_destroy (&header, NULL);
p = ml_readline (_("Edit again?"));
if (*p == 'y' || *p == 'Y')
if (mu_true_answer_p (p) == 1)
return -1;
else
return 1;
......
......@@ -63,7 +63,7 @@ extern char *strchrnul __P((const char *s, int c_in));
#define MH_CONTEXT_FILE "context"
#define DEFAULT_ALIAS_FILE MHLIBDIR "/MailAliases"
#define is_true(arg) ((arg)==NULL||(arg)[0] == 'y')
#define is_true(arg) ((arg) == NULL||mu_true_answer_p (arg) == 1)
enum mh_opcode
{
......
......@@ -256,7 +256,7 @@ mh_vgetyn (const char *fmt, va_list ap)
while (1)
{
char *p;
int len;
int len, rc;
vfprintf (stdout, fmt, ap);
fprintf (stdout, "? ");
......@@ -269,17 +269,13 @@ mh_vgetyn (const char *fmt, va_list ap)
while (*p && isspace (*p))
p++;
switch (p[0])
{
case 'y':
case 'Y':
return 1;
case 'n':
case 'N':
return 0;
}
rc = mu_true_answer_p (p);
if (rc >= 0)
return rc;
/* TRANSLATORS: See msgids "nN" and "yY". */
fprintf (stdout, _("Please answer yes or no: "));
}
return 0; /* to pacify gcc */
......
......@@ -117,16 +117,12 @@ static int sieve_print_locus = 1; /* Should the log messages include the
static int
is_true_p (char *p)
{
int rc;
if (!p)
return 1;
/* TRANSLATORS: This is the list of characters meaning 'Yes'. Please,
preserve yY in your translation, e.g., for German:
msgstr "yYjJ";
*/
if (strchr (_("yY"), *p))
return 1;
return 0;
if ((rc = mu_true_answer_p (p)) == -1)
return 0;
return rc;
}
static error_t
......