From be2070e8aa26110339dd8dfce992687cbd10f584 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Franti=C5=A1ek=20Dvo=C5=99=C3=A1k?= Date: Sun, 9 May 2004 17:42:23 +0000 Subject: Valid error description for gethostbyname. Obsolete function hstrerror() has no replacement, so it's used, but with configure check. CVS patchset: 6503 CVS date: 2004/05/09 17:42:23 --- src/xine-utils/utils.c | 38 ++++++++++++++++++++++++++++++++++---- 1 file changed, 34 insertions(+), 4 deletions(-) (limited to 'src/xine-utils/utils.c') diff --git a/src/xine-utils/utils.c b/src/xine-utils/utils.c index 98f2ed2c4..9d2c02f4f 100644 --- a/src/xine-utils/utils.c +++ b/src/xine-utils/utils.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2000-2003 the xine project + * Copyright (C) 2000-2004 the xine project * * This file is part of xine, a free video player. * @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: utils.c,v 1.26 2004/04/06 19:20:16 valtri Exp $ + * $Id: utils.c,v 1.27 2004/05/09 17:42:24 valtri Exp $ * */ #define _POSIX_PTHREAD_SEMANTICS 1 /* for 5-arg getpwuid_r on solaris */ @@ -27,19 +27,28 @@ #endif #include "xineutils.h" +#include "xineintl.h" #include #include +#include + #if HAVE_EXECINFO_H #include #endif + #if HAVE_UCONTEXT_H #include #endif + #ifdef HAVE_LANGINFO_CODESET #include #endif +#if HAVE_LIBGEN_H +#include +#endif + typedef struct { char *language; @@ -508,16 +517,17 @@ char *xine_get_system_encoding(void) { #ifndef HAVE_BASENAME - #define FILESYSTEM_PREFIX_LEN(filename) 0 #define ISSLASH(C) ((C) == '/') +#endif /* * get base name * * (adopted from sh-utils) */ -char *basename (char const *name) { +char *xine_basename (char *name) { +#ifndef HAVE_BASENAME char const *base = name + FILESYSTEM_PREFIX_LEN (name); char const *p; @@ -544,5 +554,25 @@ char *basename (char const *name) { } return (char *) base; +#else + return basename(name); +#endif } + +/** + * get error descriptions in DNS lookups + */ +const char *xine_hstrerror(int err) { +#ifndef HAVE_HSTRERROR + switch (err) { + case 0: return _("No error"); + case HOST_NOT_FOUND: return _("Unknown host"); + case NO_DATA: return _("No address associated with name"); + case NO_RECOVERY: return _("Unknown server error"); + case TRY_AGAIN: return _("Host name lookup failure"); + default: return _("Unknown error"); + } +#else + return hstrerror(err); #endif +} -- cgit v1.2.3