diff options
author | František Dvořák <valtri@users.sourceforge.net> | 2003-11-04 14:38:26 +0000 |
---|---|---|
committer | František Dvořák <valtri@users.sourceforge.net> | 2003-11-04 14:38:26 +0000 |
commit | cad449ce4a6de420b36a155f9da8c575307c66a1 (patch) | |
tree | 58a2ec33904072d59ac44f39562aeb592e0d5f4f /src/xine-utils/utils.c | |
parent | bef16c72dc26ec32050c0382c92678f960dca719 (diff) | |
download | xine-lib-cad449ce4a6de420b36a155f9da8c575307c66a1.tar.gz xine-lib-cad449ce4a6de420b36a155f9da8c575307c66a1.tar.bz2 |
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
Diffstat (limited to 'src/xine-utils/utils.c')
-rw-r--r-- | src/xine-utils/utils.c | 43 |
1 files changed, 42 insertions, 1 deletions
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 |