Use mu_true_answer_p()
Showing
4 changed files
with
13 additions
and
21 deletions
... | @@ -139,7 +139,7 @@ parse_headers (FILE *fp, compose_env_t *env) | ... | @@ -139,7 +139,7 @@ parse_headers (FILE *fp, compose_env_t *env) |
139 | 139 | ||
140 | header_destroy (&header, NULL); | 140 | header_destroy (&header, NULL); |
141 | p = ml_readline (_("Edit again?")); | 141 | p = ml_readline (_("Edit again?")); |
142 | if (*p == 'y' || *p == 'Y') | 142 | if (mu_true_answer_p (p) == 1) |
143 | return -1; | 143 | return -1; |
144 | else | 144 | else |
145 | return 1; | 145 | return 1; | ... | ... |
... | @@ -63,7 +63,7 @@ extern char *strchrnul __P((const char *s, int c_in)); | ... | @@ -63,7 +63,7 @@ extern char *strchrnul __P((const char *s, int c_in)); |
63 | #define MH_CONTEXT_FILE "context" | 63 | #define MH_CONTEXT_FILE "context" |
64 | #define DEFAULT_ALIAS_FILE MHLIBDIR "/MailAliases" | 64 | #define DEFAULT_ALIAS_FILE MHLIBDIR "/MailAliases" |
65 | 65 | ||
66 | #define is_true(arg) ((arg)==NULL||(arg)[0] == 'y') | 66 | #define is_true(arg) ((arg) == NULL||mu_true_answer_p (arg) == 1) |
67 | 67 | ||
68 | enum mh_opcode | 68 | enum mh_opcode |
69 | { | 69 | { | ... | ... |
... | @@ -256,7 +256,7 @@ mh_vgetyn (const char *fmt, va_list ap) | ... | @@ -256,7 +256,7 @@ mh_vgetyn (const char *fmt, va_list ap) |
256 | while (1) | 256 | while (1) |
257 | { | 257 | { |
258 | char *p; | 258 | char *p; |
259 | int len; | 259 | int len, rc; |
260 | 260 | ||
261 | vfprintf (stdout, fmt, ap); | 261 | vfprintf (stdout, fmt, ap); |
262 | fprintf (stdout, "? "); | 262 | fprintf (stdout, "? "); |
... | @@ -269,17 +269,13 @@ mh_vgetyn (const char *fmt, va_list ap) | ... | @@ -269,17 +269,13 @@ mh_vgetyn (const char *fmt, va_list ap) |
269 | 269 | ||
270 | while (*p && isspace (*p)) | 270 | while (*p && isspace (*p)) |
271 | p++; | 271 | p++; |
272 | |||
273 | switch (p[0]) | ||
274 | { | ||
275 | case 'y': | ||
276 | case 'Y': | ||
277 | return 1; | ||
278 | case 'n': | ||
279 | case 'N': | ||
280 | return 0; | ||
281 | } | ||
282 | 272 | ||
273 | rc = mu_true_answer_p (p); | ||
274 | |||
275 | if (rc >= 0) | ||
276 | return rc; | ||
277 | |||
278 | /* TRANSLATORS: See msgids "nN" and "yY". */ | ||
283 | fprintf (stdout, _("Please answer yes or no: ")); | 279 | fprintf (stdout, _("Please answer yes or no: ")); |
284 | } | 280 | } |
285 | return 0; /* to pacify gcc */ | 281 | return 0; /* to pacify gcc */ | ... | ... |
... | @@ -117,16 +117,12 @@ static int sieve_print_locus = 1; /* Should the log messages include the | ... | @@ -117,16 +117,12 @@ static int sieve_print_locus = 1; /* Should the log messages include the |
117 | static int | 117 | static int |
118 | is_true_p (char *p) | 118 | is_true_p (char *p) |
119 | { | 119 | { |
120 | int rc; | ||
120 | if (!p) | 121 | if (!p) |
121 | return 1; | 122 | return 1; |
122 | /* TRANSLATORS: This is the list of characters meaning 'Yes'. Please, | 123 | if ((rc = mu_true_answer_p (p)) == -1) |
123 | preserve yY in your translation, e.g., for German: | 124 | return 0; |
124 | 125 | return rc; | |
125 | msgstr "yYjJ"; | ||
126 | */ | ||
127 | if (strchr (_("yY"), *p)) | ||
128 | return 1; | ||
129 | return 0; | ||
130 | } | 126 | } |
131 | 127 | ||
132 | static error_t | 128 | static error_t | ... | ... |
-
Please register or sign in to post a comment