From: Frantisek D. <va...@us...> - 2004-05-09 17:42:33
|
Update of /cvsroot/xine/xine-lib/src/xine-utils In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28642/src/xine-utils Modified Files: utils.c xineutils.h Log Message: Valid error description for gethostbyname. Obsolete function hstrerror() has no replacement, so it's used, but with configure check. Index: utils.c =================================================================== RCS file: /cvsroot/xine/xine-lib/src/xine-utils/utils.c,v retrieving revision 1.26 retrieving revision 1.27 diff -u -r1.26 -r1.27 --- utils.c 6 Apr 2004 19:20:16 -0000 1.26 +++ utils.c 9 May 2004 17:42:24 -0000 1.27 @@ -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. * @@ -27,19 +27,28 @@ #endif #include "xineutils.h" +#include "xineintl.h" #include <errno.h> #include <pwd.h> +#include <netdb.h> + #if HAVE_EXECINFO_H #include <execinfo.h> #endif + #if HAVE_UCONTEXT_H #include <ucontext.h> #endif + #ifdef HAVE_LANGINFO_CODESET #include <langinfo.h> #endif +#if HAVE_LIBGEN_H +#include <libgen.h> +#endif + typedef struct { char *language; @@ -508,16 +517,17 @@ #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 @@ } 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 +} Index: xineutils.h =================================================================== RCS file: /cvsroot/xine/xine-lib/src/xine-utils/xineutils.h,v retrieving revision 1.86 retrieving revision 1.87 diff -u -r1.86 -r1.87 --- xineutils.h 28 Apr 2004 00:38:09 -0000 1.86 +++ xineutils.h 9 May 2004 17:42:24 -0000 1.87 @@ -33,9 +33,6 @@ #include <stdarg.h> #include <inttypes.h> #include <pthread.h> -#if HAVE_LIBGEN_H -# include <libgen.h> -#endif #ifdef XINE_COMPILE # include "attributes.h" @@ -1097,12 +1094,15 @@ */ char *xine_get_system_encoding(void); -#ifndef HAVE_BASENAME /** * get base name */ -char *basename (char const *name); -#endif +char *xine_basename (char *name); + +/** + * get error descriptions in DNS lookups + */ +const char *xine_hstrerror(int err); #ifdef WIN32 char *exec_path_append_subdir(char * string); |