From 7204b84beb0f5cfb166e8d56402371d05bece83b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Franti=C5=A1ek=20Dvo=C5=99=C3=A1k?= Date: Mon, 20 Sep 2004 19:30:02 +0000 Subject: Build system improvements: - use replacement functions (macro AC_REPLACE_FUNCS and variable LTLIBOBJS), each function is in a file placed into lib/ directory, it was not necessary, but it looks nice, IMHO - headers cleanups (this was needed): - prototypes of replacement funtions and macros are placed into separate os_internal.h (and included by config.h) - drop include inttypes.h from public xine.h, replaced by custom os_type.h, idea origins from Ogg/Vorbis public headers - disable generating inttypes.h: generated replacement isn't enough for xine-lib but nobody complained (and for M$VC we have special version) - better including headers for win32, let dvdnav use its mutex wrapper - updated M$VC port Result: - xine is compiled nicely by MinGW, CygWin and paritaly M$VC - frontends in M$VC port don't require additional helping headers - moved some platform specific things from xine-utils and win32/contrib to lib/ Finally I can start with real coding. :-) CVS patchset: 6982 CVS date: 2004/09/20 19:30:02 --- lib/basename.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 lib/basename.c (limited to 'lib/basename.c') diff --git a/lib/basename.c b/lib/basename.c new file mode 100644 index 000000000..06f859483 --- /dev/null +++ b/lib/basename.c @@ -0,0 +1,35 @@ +/* + * get base name + * + * (adopted from sh-utils) + */ + +#include "config.h" + +#define FILESYSTEM_PREFIX_LEN(filename) 0 +#define ISSLASH(C) ((C) == '/') + +char *_xine_private_basename(char *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; +} -- cgit v1.2.3