From 7e8656313d0926efa7cafda54fc7f359bb16c8f9 Mon Sep 17 00:00:00 2001 From: moritz Date: Wed, 18 Mar 2009 19:55:20 +0000 Subject: [PATCH] Repair some fallout from previous commits, and work more on Win32 builds. git-svn-id: https://svn.xiph.org/trunk/ezstream@15795 0101bb08-14d6-0310-b084-bc0e0c8e3800 --- configure.in | 13 ++++++++++- src/compat.c | 6 +++--- src/ezstream.c | 2 +- src/ezstream.h | 50 ++++++++++++++++++++++++++++--------------- win32/ezstream.vcproj | 4 ++-- 5 files changed, 51 insertions(+), 24 deletions(-) diff --git a/configure.in b/configure.in index e499b2d..0417daf 100644 --- a/configure.in +++ b/configure.in @@ -228,13 +228,24 @@ dnl ####################### AC_CHECK_FUNCS([ \ arc4random \ basename \ - gettimeofday \ getopt \ + gettimeofday \ nl_langinfo \ + pclose \ + _pclose \ + popen \ + _popen \ random \ setlocale \ + snprintf \ + _snprintf \ srandomdev \ stat \ + _stat \ + strncasecmp \ + strnicmp \ + strtoll \ + _strtoi64 \ ]) AC_REPLACE_FUNCS([ \ diff --git a/src/compat.c b/src/compat.c index 78442a4..11efc72 100644 --- a/src/compat.c +++ b/src/compat.c @@ -18,9 +18,9 @@ # define PATH_SEPARATORS "/" #endif /* !PATH_SEPARATORS */ -char * local_basename(const char *); +const char *path_separators = PATH_SEPARATORS; -static const char *path_separators = PATH_SEPARATORS; +char * local_basename(const char *); static inline int is_separator(int); @@ -83,7 +83,7 @@ local_basename(const char *path) * list as the default. */ if (endp == path && is_separator(*endp)) { - bname[0] = PATH_SEPARATOR; + bname[0] = path_separators[0]; bname[1] = '\0'; return (bname); } diff --git a/src/ezstream.c b/src/ezstream.c index e15f254..46ec685 100644 --- a/src/ezstream.c +++ b/src/ezstream.c @@ -1044,7 +1044,7 @@ getProgname(const char *argv0) if (argv0 == NULL) return ((char *)"ezstream"); - p = strrchr(argv0, PATH_SEPARATOR); + p = strrchr(argv0, path_separators[0]); if (p == NULL) p = (char *)argv0; else diff --git a/src/ezstream.h b/src/ezstream.h index c7bf3e4..5a8b002 100644 --- a/src/ezstream.h +++ b/src/ezstream.h @@ -57,25 +57,38 @@ # endif /* WIN32 */ #endif /* !_PATH_DEVNULL */ +#if !defined(HAVE_PCLOSE) && defined(HAVE__PCLOSE) +# define pclose _pclose +#endif /* !HAVE_PCLOSE && HAVE__PCLOSE */ +#if !defined(HAVE_POPEN) && defined(HAVE__POPEN) +# define popen _popen +#endif /* !HAVE_POPEN && HAVE__POPEN */ +#if !defined(HAVE_SNPRINTF) && defined(HAVE__SNPRINTF) +# define snprintf _snprintf +#endif /* !HAVE_SNPRINTF && HAVE__SNPRINTF */ +#if !defined(HAVE_STAT) && defined(HAVE__STAT) +# define stat _stat +#endif /* !HAVE_STAT && HAVE__STAT */ +#if !defined(HAVE_STRNCASECMP) && defined(HAVE_STRNICMP) +# define strncasecmp strnicmp +#endif /* !HAVE_STRNCASECMP && HAVE_STRNICMP */ +#if !defined(HAVE_STRTOLL) && defined(HAVE__STRTOI64) +# define strtoll _strtoi64 +#endif /* !HAVE_STRTOLL && HAVE__STRTOI64 */ + +#ifndef S_IRGRP +# define S_IRGRP 0 +# define S_IWGRP 0 +# define S_IXGRP 0 +#endif /* !S_IRGRP */ +#ifndef S_IROTH +# define S_IROTH 0 +# define S_IWOTH 0 +# define S_IXOTH 0 +#endif /* !S_IROTH */ + #ifdef WIN32 # include - -# define pclose _pclose -# define popen _popen -# define snprintf _snprintf -# define stat _stat -# define strncasecmp strnicmp -# ifndef __GNUC__ -# define strtoll _strtoi64 -# endif /* !__GNUC__ */ - -# define S_IRGRP 0 -# define S_IROTH 0 -# define S_IWGRP 0 -# define S_IWOTH 0 -# define S_IXGRP 0 -# define S_IXOTH 0 - # define sleep(a) Sleep((a) * 1000) #endif /* WIN32 */ @@ -98,6 +111,9 @@ extern char *optarg; extern int local_getopt(int, char * const *, const char *); + +extern const char *path_separators; + extern char * local_basename(const char *); diff --git a/win32/ezstream.vcproj b/win32/ezstream.vcproj index 16e5be4..35992b5 100644 --- a/win32/ezstream.vcproj +++ b/win32/ezstream.vcproj @@ -244,11 +244,11 @@ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" >