From cad449ce4a6de420b36a155f9da8c575307c66a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Franti=C5=A1ek=20Dvo=C5=99=C3=A1k?= Date: Tue, 4 Nov 2003 14:38:26 +0000 Subject: Final patches for compiling xine under MSVC: - basename() is added to xine-utils, if it isn't found by configure - macros with variable number of arguments are simplified to ignore additional arguments (only for MSVC), lprintf macro simplified with full functionality - minor update for building a52, some preparation for ffmpeg CVS patchset: 5687 CVS date: 2003/11/04 14:38:26 --- src/xine-utils/utils.c | 43 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) (limited to 'src/xine-utils/utils.c') diff --git a/src/xine-utils/utils.c b/src/xine-utils/utils.c index b3286c11a..be5220231 100644 --- a/src/xine-utils/utils.c +++ b/src/xine-utils/utils.c @@ -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.18 2003/09/16 02:11:45 storri Exp $ + * $Id: utils.c,v 1.19 2003/11/04 14:38:26 valtri Exp $ * */ #define _POSIX_PTHREAD_SEMANTICS 1 /* for 5-arg getpwuid_r on solaris */ @@ -200,3 +200,44 @@ void xine_hexdump (char *buf, int length) { printf("-"); printf("\n"); } + + +#ifndef HAVE_BASENAME + +#define FILESYSTEM_PREFIX_LEN(filename) 0 +#define ISSLASH(C) ((C) == '/') + +/* + * get base name + * + * (adopted from sh-utils) + */ +char *basename (char const *name) { + char const *base = name + FILESYSTEM_PREFIX_LEN (name); + char const *p; + + for (p = base; *p; p++) + { + if (ISSLASH (*p)) + { + /* Treat multiple adjacent slashes like a single slash. */ + do p++; + while (ISSLASH (*p)); + + /* If the file name ends in slash, use the trailing slash as + the basename if no non-slashes have been found. */ + if (! *p) + { + if (ISSLASH (*base)) + base = p - 1; + break; + } + + /* *P is a non-slash preceded by a slash. */ + base = p; + } + } + + return (char *) base; +} +#endif -- cgit v1.2.3