Update.
[libidn.git] / lib / strerror-pr29.c
blobab429f4767d1b56aab72e50dba16fa687ac64bd6
1 /* strerror-pr29.c --- Convert PR29 errors into text.
2 * Copyright (C) 2004 Simon Josefsson
4 * This file is part of GNU Libidn.
6 * GNU Libidn is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * GNU Libidn is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with GNU Libidn; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
22 #include "pr29.h"
24 #include "gettext.h"
25 #define _(String) dgettext (PACKAGE, String)
27 /**
28 * pr29_strerror - return string describing pr29 error code
29 * @rc: an #Pr29_rc return code.
31 * Convert a return code integer to a text string. This string can be
32 * used to output a diagnostic message to the user.
34 * PR29_SUCCESS: Successful operation. This value is guaranteed to
35 * always be zero, the remaining ones are only guaranteed to hold
36 * non-zero values, for logical comparison purposes.
37 * PR29_PROBLEM: A problem sequence was encountered.
38 * PR29_STRINGPREP_ERROR: The character set conversion failed (only
39 * for pr29_8() and pr29_8z()).
41 * Return value: Returns a pointer to a statically allocated string
42 * containing a description of the error with the return code @rc.
43 **/
44 const char *
45 pr29_strerror (Pr29_rc rc)
47 const char *p;
49 bindtextdomain (PACKAGE, LOCALEDIR);
51 switch (rc)
53 case PR29_SUCCESS:
54 p = _("Success");
55 break;
57 case PR29_PROBLEM:
58 p = _("String not idempotent under Unicode NFKC normalization");
59 break;
61 case PR29_STRINGPREP_ERROR:
62 p = _("String preparation failed");
63 break;
65 default:
66 p = _("Unknown error");
67 break;
70 return p;