summaryrefslogtreecommitdiff
path: root/Build/source/texk/kpathsea/make-suffix.c
diff options
context:
space:
mode:
authorPeter Breitenlohner <peb@mppmu.mpg.de>2011-07-28 08:51:08 +0000
committerPeter Breitenlohner <peb@mppmu.mpg.de>2011-07-28 08:51:08 +0000
commitcfae1fdf8a2e58edcf68f3a64e9caa75922e0e22 (patch)
treeb34b92941b15a57c2f8c29208ffa9aca4134e4ac /Build/source/texk/kpathsea/make-suffix.c
parentce679aa3ad2f099253cf4266614a3cf7164d4dcd (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/make-suffix.c')
-rw-r--r--Build/source/texk/kpathsea/make-suffix.c36
1 files changed, 27 insertions, 9 deletions
diff --git a/Build/source/texk/kpathsea/make-suffix.c b/Build/source/texk/kpathsea/make-suffix.c
index c578ab2b7a6..9264aaeb405 100644
--- a/Build/source/texk/kpathsea/make-suffix.c
+++ b/Build/source/texk/kpathsea/make-suffix.c
@@ -1,6 +1,6 @@
/* make-suffix.c: unconditionally add a filename suffix.
- Copyright 1992, 1993, 1995, 2008 Karl Berry.
+ Copyright 1992, 1993, 1995, 2008, 2011 Karl Berry.
Copyright 2001, 2005 Olaf Weber.
This library is free software; you can redistribute it and/or
@@ -27,24 +27,42 @@ make_suffix (const_string s, const_string suffix)
{
string new_s;
const_string dot_pos = strrchr (s, '.');
- const_string slash_pos;
+ const_string p;
+#if defined(WIN32)
+ string q;
+#endif
- for (slash_pos = s + strlen (s) - 1; slash_pos > dot_pos && slash_pos > s;
- slash_pos--) {
- if (IS_DIR_SEP (*slash_pos))
- break;
- }
+ if (dot_pos)
+ for (p = dot_pos + 1; *p; p++) {
+ if (IS_DIR_SEP (*p)) {
+ dot_pos = NULL;
+ break;
+ }
+#if defined(WIN32)
+ else if (IS_KANJI(p))
+ p++;
+#endif
+ }
- if (dot_pos == NULL || slash_pos > dot_pos )
+ if (dot_pos == NULL)
new_s = concat3 (s, ".", suffix);
else
{
unsigned past_dot_index = dot_pos + 1 - s;
new_s = (string)xmalloc (past_dot_index + strlen (suffix) + 1);
- strncpy (new_s, s, dot_pos + 1 - s);
+ strncpy (new_s, s, past_dot_index);
strcpy (new_s + past_dot_index, suffix);
}
+#if defined(WIN32)
+ for (q = new_s; *q; q++) {
+ if (*q == '\\')
+ *q = '/';
+ else if (IS_KANJI(q))
+ q++;
+ }
+#endif
+
return new_s;
}