diff options
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | src/input/input_http.c | 6 | ||||
-rw-r--r-- | src/xine-engine/input_rip.c | 6 | ||||
-rw-r--r-- | src/xine-utils/utils.c | 38 | ||||
-rw-r--r-- | src/xine-utils/xineutils.h | 14 |
5 files changed, 48 insertions, 18 deletions
diff --git a/configure.ac b/configure.ac index 2c6d26433..3b321fc99 100644 --- a/configure.ac +++ b/configure.ac @@ -1400,7 +1400,7 @@ dnl Some extra checks. dnl --------------------------------------------- AC_CHECK_LIB(posix4, sched_get_priority_min) -AC_CHECK_FUNCS([vsscanf sigaction sigset getpwuid_r nanosleep strsep strpbrk setenv basename]) +AC_CHECK_FUNCS([vsscanf sigaction sigset getpwuid_r nanosleep strsep strpbrk setenv basename hstrerror]) AC_FUNC_FSEEKO AC_CHECK_HEADERS(byteswap.h malloc.h execinfo.h ucontext.h sys/mman.h sys/mixer.h libgen.h) diff --git a/src/input/input_http.c b/src/input/input_http.c index 12e20bd5b..5d8dfad6d 100644 --- a/src/input/input_http.c +++ b/src/input/input_http.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. * @@ -19,7 +19,7 @@ * * input plugin for http network streams * - * $Id: input_http.c,v 1.87 2004/05/04 22:26:13 tmattern Exp $ + * $Id: input_http.c,v 1.88 2004/05/09 17:42:23 valtri Exp $ */ #ifdef HAVE_CONFIG_H @@ -173,7 +173,7 @@ static int _x_use_proxy(http_input_class_t *this, const char *host) { if ((info = gethostbyname(host)) == NULL) { xine_log(this->xine, XINE_LOG_MSG, _("input_http: gethostbyname(%s) failed: %s\n"), host, - strerror(errno)); + xine_hstrerror(h_errno)); return 1; } if (!info->h_name) return 1; diff --git a/src/xine-engine/input_rip.c b/src/xine-engine/input_rip.c index dd524dff7..8035fc94a 100644 --- a/src/xine-engine/input_rip.c +++ b/src/xine-engine/input_rip.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. * @@ -29,7 +29,7 @@ * - it's possible speeder saving streams in the xine without playing: * xine stream_mrl#save:file.raw\;noaudio\;novideo * - * $Id: input_rip.c,v 1.21 2003/12/25 21:57:28 valtri Exp $ + * $Id: input_rip.c,v 1.22 2004/05/09 17:42:23 valtri Exp $ */ /* TODO: @@ -570,7 +570,7 @@ input_plugin_t *_x_rip_plugin_get_instance (xine_stream_t *stream, const char *f this->savepos = 0; fnc = strdup(filename); - target_basename = basename(fnc); + target_basename = xine_basename(fnc); dir_file_concat(target, MAX_TARGET_LEN, stream->xine->save_path, target_basename); strcpy(target_no, target); 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 <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 @@ 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 +} diff --git a/src/xine-utils/xineutils.h b/src/xine-utils/xineutils.h index 083d409be..8334562d6 100644 --- a/src/xine-utils/xineutils.h +++ b/src/xine-utils/xineutils.h @@ -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: xineutils.h,v 1.86 2004/04/28 00:38:09 komadori Exp $ + * $Id: xineutils.h,v 1.87 2004/05/09 17:42:24 valtri Exp $ * */ #ifndef XINEUTILS_H @@ -33,9 +33,6 @@ extern "C" { #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 @@ void xine_list_delete_current (xine_list_t *l); */ 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); |