strerror-idna.c

Go to the documentation of this file.
00001 /* strerror-idna.c --- Convert IDNA errors into text.
00002  * Copyright (C) 2004  Simon Josefsson
00003  *
00004  * This file is part of GNU Libidn.
00005  *
00006  * GNU Libidn is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU Lesser General Public
00008  * License as published by the Free Software Foundation; either
00009  * version 2.1 of the License, or (at your option) any later version.
00010  *
00011  * GNU Libidn is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  * Lesser General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU Lesser General Public
00017  * License along with GNU Libidn; if not, write to the Free Software
00018  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
00019  *
00020  */
00021 
00022 #if HAVE_CONFIG_H
00023 # include "config.h"
00024 #endif
00025 
00026 #include "idna.h"
00027 
00028 #include "gettext.h"
00029 #define _(String) dgettext (PACKAGE, String)
00030 
00064 const char *
00065 idna_strerror (Idna_rc rc)
00066 {
00067   const char *p;
00068 
00069   bindtextdomain (PACKAGE, LOCALEDIR);
00070 
00071   switch (rc)
00072     {
00073     case IDNA_SUCCESS:
00074       p = _("Success");
00075       break;
00076 
00077     case IDNA_STRINGPREP_ERROR:
00078       p = _("String preparation failed");
00079       break;
00080 
00081     case IDNA_PUNYCODE_ERROR:
00082       p = _("Punycode failed");
00083       break;
00084 
00085     case IDNA_CONTAINS_NON_LDH:
00086       p = _("Non-digit/letter/hyphen in input");
00087       break;
00088 
00089     case IDNA_CONTAINS_MINUS:
00090       p = _("Forbidden leading or trailing minus sign (`-')");
00091       break;
00092 
00093     case IDNA_INVALID_LENGTH:
00094       p = _("Output would be too large or too small");
00095       break;
00096 
00097     case IDNA_NO_ACE_PREFIX:
00098       p = _("Input does not start with ACE prefix (`xn--')");
00099       break;
00100 
00101     case IDNA_ROUNDTRIP_VERIFY_ERROR:
00102       p = _("String not idempotent under ToASCII");
00103       break;
00104 
00105     case IDNA_CONTAINS_ACE_PREFIX:
00106       p = _("Input already contain ACE prefix (`xn--')");
00107       break;
00108 
00109     case IDNA_ICONV_ERROR:
00110       p = _("System iconv failed");
00111       break;
00112 
00113     case IDNA_MALLOC_ERROR:
00114       p = _("Cannot allocate memory");
00115       break;
00116 
00117     case IDNA_DLOPEN_ERROR:
00118       p = _("System dlopen failed");
00119       break;
00120 
00121     default:
00122       p = _("Unknown error");
00123       break;
00124     }
00125 
00126   return p;
00127 }

Generated on Wed Sep 13 10:20:31 2006 for libidn by  doxygen 1.4.7