diff options
author | Peter Breitenlohner <peb@mppmu.mpg.de> | 2011-07-28 08:51:08 +0000 |
---|---|---|
committer | Peter Breitenlohner <peb@mppmu.mpg.de> | 2011-07-28 08:51:08 +0000 |
commit | cfae1fdf8a2e58edcf68f3a64e9caa75922e0e22 (patch) | |
tree | b34b92941b15a57c2f8c29208ffa9aca4134e4ac /Build/source/texk/kpathsea/xbasename.c | |
parent | ce679aa3ad2f099253cf4266614a3cf7164d4dcd (diff) |
kpathsea: More changes to reduce diffs with W32TeX
git-svn-id: svn://tug.org/texlive/trunk@23256 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/kpathsea/xbasename.c')
-rw-r--r-- | Build/source/texk/kpathsea/xbasename.c | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/Build/source/texk/kpathsea/xbasename.c b/Build/source/texk/kpathsea/xbasename.c index df066d68a6c..e725ce71c95 100644 --- a/Build/source/texk/kpathsea/xbasename.c +++ b/Build/source/texk/kpathsea/xbasename.c @@ -1,6 +1,6 @@ /* xbasename.c: return the last element in a path. - Copyright 1992, 1994, 1995, 1996, 2008 Karl Berry. + Copyright 1992, 1994, 1995, 1996, 2008, 2011 Karl Berry. Copyright 2005 Olaf Weber. This library is free software; you can redistribute it and/or @@ -28,18 +28,17 @@ const_string xbasename (const_string name) { - const_string base = NULL; - unsigned len; - - for (len = strlen(name); len > 0; len--) { - if (IS_DIR_SEP(name[len - 1]) || IS_DEVICE_SEP(name[len - 1])) { - base = name + len; - break; - } + const_string base = name; + const_string p; + + for (p = name; *p; p++) { + if (IS_DIR_SEP(*p) || IS_DEVICE_SEP(*p)) + base = p + 1; +#if defined(WIN32) + else if (IS_KANJI(p)) + p++; +#endif } - if (!base) - base = name; - return base; } |