summaryrefslogtreecommitdiff
path: root/Build/source/texk/kpathsea/xbasename.c
diff options
context:
space:
mode:
authorPeter Breitenlohner <peb@mppmu.mpg.de>2011-08-04 11:56:32 +0000
committerPeter Breitenlohner <peb@mppmu.mpg.de>2011-08-04 11:56:32 +0000
commit1491bd20a6acc228027bb0ef69f72b48aa6a572d (patch)
treebf28cbb1c4453dcaa76bbffe5d08a957fea30408 /Build/source/texk/kpathsea/xbasename.c
parentbe0be9e57afa091468dd619092180640d8c29a38 (diff)
kpathsea: More changes to reduce diffs with W32TeX
git-svn-id: svn://tug.org/texlive/trunk@23405 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/kpathsea/xbasename.c')
-rw-r--r--Build/source/texk/kpathsea/xbasename.c27
1 files changed, 25 insertions, 2 deletions
diff --git a/Build/source/texk/kpathsea/xbasename.c b/Build/source/texk/kpathsea/xbasename.c
index e725ce71c95..c66da1cf622 100644
--- a/Build/source/texk/kpathsea/xbasename.c
+++ b/Build/source/texk/kpathsea/xbasename.c
@@ -31,8 +31,31 @@ xbasename (const_string name)
const_string base = name;
const_string p;
- for (p = name; *p; p++) {
- if (IS_DIR_SEP(*p) || IS_DEVICE_SEP(*p))
+ if (NAME_BEGINS_WITH_DEVICE(name))
+ base += 2;
+
+ else if (IS_UNC_NAME(name)) {
+ unsigned limit;
+
+ for (limit = 2; name[limit] && !IS_DIR_SEP (name[limit]); limit++)
+#if defined(WIN32)
+ if (IS_KANJI(name+limit)) limit++
+#endif
+ ;
+ if (name[limit++] && name[limit] && !IS_DIR_SEP (name[limit])) {
+ for (; name[limit] && !IS_DIR_SEP (name[limit]); limit++)
+#if defined(WIN32)
+ if (IS_KANJI(name+limit)) limit++
+#endif
+ ;
+ } else
+ /* malformed UNC name, backup */
+ limit = 0;
+ base += limit;
+ }
+
+ for (p = base; *p; p++) {
+ if (IS_DIR_SEP(*p))
base = p + 1;
#if defined(WIN32)
else if (IS_KANJI(p))