00001 /* strerror-pr29.c --- Convert PR29 errors into text. 00002 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Simon 00003 * Josefsson 00004 * 00005 * This file is part of GNU Libidn. 00006 * 00007 * GNU Libidn is free software; you can redistribute it and/or 00008 * modify it under the terms of the GNU Lesser General Public 00009 * License as published by the Free Software Foundation; either 00010 * version 2.1 of the License, or (at your option) any later version. 00011 * 00012 * GNU Libidn is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 * Lesser General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU Lesser General Public 00018 * License along with GNU Libidn; if not, write to the Free Software 00019 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 00020 * 00021 */ 00022 00023 #ifdef HAVE_CONFIG_H 00024 # include "config.h" 00025 #endif 00026 00027 #include "pr29.h" 00028 00029 #include "gettext.h" 00030 #define _(String) dgettext (PACKAGE, String) 00031 00049 const char * 00050 pr29_strerror (Pr29_rc rc) 00051 { 00052 const char *p; 00053 00054 bindtextdomain (PACKAGE, LOCALEDIR); 00055 00056 switch (rc) 00057 { 00058 case PR29_SUCCESS: 00059 p = _("Success"); 00060 break; 00061 00062 case PR29_PROBLEM: 00063 p = _("String not idempotent under Unicode NFKC normalization"); 00064 break; 00065 00066 case PR29_STRINGPREP_ERROR: 00067 p = _("String preparation failed"); 00068 break; 00069 00070 default: 00071 p = _("Unknown error"); 00072 break; 00073 } 00074 00075 return p; 00076 }