strerror-tld.c

Go to the documentation of this file.
00001 /* strerror-tld.c --- Convert TLD 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 "tld.h"
00027 
00028 #include "gettext.h"
00029 #define _(String) dgettext (PACKAGE, String)
00030 
00050 const char *
00051 tld_strerror (Tld_rc rc)
00052 {
00053   const char *p;
00054 
00055   bindtextdomain (PACKAGE, LOCALEDIR);
00056 
00057   switch (rc)
00058     {
00059     case TLD_SUCCESS:
00060       p = _("Success");
00061       break;
00062 
00063     case TLD_INVALID:
00064       p = _("Code points prohibited by top-level domain");
00065       break;
00066 
00067     case TLD_NODATA:
00068       p = _("Missing input");
00069       break;
00070 
00071     case TLD_MALLOC_ERROR:
00072       p = _("Cannot allocate memory");
00073       break;
00074 
00075     case TLD_ICONV_ERROR:
00076       p = _("System iconv failed");
00077       break;
00078 
00079     case TLD_NO_TLD:
00080       p = _("No top-level domain found in input");
00081       break;
00082 
00083     default:
00084       p = _("Unknown error");
00085       break;
00086     }
00087 
00088   return p;
00089 }

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