1 /* GNU Mailutils -- a suite of utilities for electronic mail
2 Copyright (C) 1999-2021 Free Software Foundation, Inc.
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 3 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General
15 Public License along with this library. If not, see
16 <http://www.gnu.org/licenses/>. */
17
18 #if HAVE_CONFIG_H
19 # include <config.h>
20 #endif
21
22 #include <string.h>
23 #include <mailutils/cctype.h>
24 #include <mailutils/nls.h>
25
26 int
mu_true_answer_p(const char * p)27 mu_true_answer_p (const char *p)
28 {
29 if (!p)
30 return -1;
31
32 while (*p && mu_isspace (*p))
33 p++;
34
35 if (*p)
36 {
37 /* TRANSLATORS: This is a list of characters which start
38 an affirmative answer. Whenever possible, please preserve
39 'yY' in your translation, e.g., for Euskara:
40
41 msgstr "yYbB";
42 */
43 if (strchr (_("yY"), *p))
44 return 1;
45
46 /* TRANSLATORS: This is a list of characters which start
47 a negative answer. Whenever possible, please preserve
48 'nN' in your translation, e.g., for Euskara:
49
50 msgstr "nNeE";
51 */
52 else if (strchr (_("nN"), *p))
53 return 0;
54 }
55 return -1;
56 }
57
58