summaryrefslogtreecommitdiff
path: root/Build
diff options
context:
space:
mode:
authorPeter Breitenlohner <peb@mppmu.mpg.de>2011-07-26 10:20:07 +0000
committerPeter Breitenlohner <peb@mppmu.mpg.de>2011-07-26 10:20:07 +0000
commit8d4af963a232f6c2cdbf510179c05af4140d3264 (patch)
tree919ffa0fb8d422560c77a04760bb2001729e9070 /Build
parentb682bb00112f1062d00240543c0a0038413d148a (diff)
kpathsea: More changes to reduce diffs with W32TeX
git-svn-id: svn://tug.org/texlive/trunk@23230 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build')
-rw-r--r--Build/source/texk/kpathsea/ChangeLog17
-rw-r--r--Build/source/texk/kpathsea/Makefile.am7
-rw-r--r--Build/source/texk/kpathsea/Makefile.in22
-rw-r--r--Build/source/texk/kpathsea/config.h15
-rw-r--r--Build/source/texk/kpathsea/db.c24
-rw-r--r--Build/source/texk/kpathsea/expand.c9
-rw-r--r--Build/source/texk/kpathsea/hash.c8
-rw-r--r--Build/source/texk/kpathsea/knj.c32
-rw-r--r--Build/source/texk/kpathsea/knj.h28
-rw-r--r--Build/source/texk/kpathsea/path-elt.c7
-rw-r--r--Build/source/texk/kpathsea/progname.c4
-rw-r--r--Build/source/texk/kpathsea/tilde.c16
-rw-r--r--Build/source/texk/kpathsea/truncate.c12
-rw-r--r--Build/source/texk/kpathsea/variable.c9
-rw-r--r--Build/source/texk/kpathsea/xdirname.c17
-rw-r--r--Build/source/texk/kpathsea/xgetcwd.c14
16 files changed, 221 insertions, 20 deletions
diff --git a/Build/source/texk/kpathsea/ChangeLog b/Build/source/texk/kpathsea/ChangeLog
index 5e4022d6d68..981844422b8 100644
--- a/Build/source/texk/kpathsea/ChangeLog
+++ b/Build/source/texk/kpathsea/ChangeLog
@@ -1,3 +1,20 @@
+2011-07-26 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ More diffs between TeX Live and W32TeX.
+ * knj.[ch]: New files from Akira's W32TeX.
+ * progname.c (kpathsea_set_program_name): Set is_cp932_system.
+ * Makefile.am, config.h: Adapt.
+
+ * db.c, expand.c, hash, path-elt.c, tilde.c, truncate.c,
+ variable.c, xdirname.c, xgetcwd.c:
+ Test for 2-Byte Kanji (CP 932, SJIS) codes.
+
+ * db.c (kpathsea_db_search, kpathsea_db_search_list): Cast
+ aliases to `void *' because MSVC warns for a `const_string *'
+ argument when expecting `void *'.
+
+ * config.h, db.c, hash.c: #define and use TRANSFORM.
+
2011-07-25 Peter Breitenlohner <peb@mppmu.mpg.de>
Minor changes to reduce diffs between TeX Live and W32TeX.
diff --git a/Build/source/texk/kpathsea/Makefile.am b/Build/source/texk/kpathsea/Makefile.am
index 46c23b67523..2dfb4a97213 100644
--- a/Build/source/texk/kpathsea/Makefile.am
+++ b/Build/source/texk/kpathsea/Makefile.am
@@ -1,6 +1,6 @@
## Makefile.am for the TeX Live subdirectory texk/kpathsea/
##
-## Copyright (C) 2009 - 2011 Peter Breitenlohner <tex-live@tug.org>
+## Copyright (C) 2009-2011 Peter Breitenlohner <tex-live@tug.org>
## You may freely use, modify and/or distribute this file.
##
ACLOCAL_AMFLAGS = -I ../../m4
@@ -86,9 +86,12 @@ libkpathsea_la_SOURCES = \
xstat.c \
xstrdup.c
+if WIN32
if MINGW32
libkpathsea_la_SOURCES += mingw32.c
endif MINGW32
+libkpathsea_la_SOURCES += knj.c
+endif WIN32
$(libkpathsea_la_OBJECTS): paths.h kpathsea.h
@@ -132,6 +135,7 @@ kpseinclude_HEADERS = \
fontmap.h \
getopt.h \
hash.h \
+ knj.h \
lib.h \
line.h \
magstep.h \
@@ -194,6 +198,7 @@ kpathsea.h: Makefile paths.h
(cd $(srcdir) && ls -1 *.h) \
| sed -e '/^config\.h/d' \
-e '/^paths\.h/d' \
+ -e '/^knj\.h/d' \
-e '/^kpathsea\.h/d' \
-e '/^mingw32\.h/d' \
-e '/^win32lib\.h/d' \
diff --git a/Build/source/texk/kpathsea/Makefile.in b/Build/source/texk/kpathsea/Makefile.in
index bfeff0bc299..a03c429db52 100644
--- a/Build/source/texk/kpathsea/Makefile.in
+++ b/Build/source/texk/kpathsea/Makefile.in
@@ -38,7 +38,8 @@ PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
-@MINGW32_TRUE@am__append_1 = mingw32.c
+@MINGW32_TRUE@@WIN32_TRUE@am__append_1 = mingw32.c
+@WIN32_TRUE@am__append_2 = knj.c
bin_PROGRAMS = kpseaccess$(EXEEXT) kpsereadlink$(EXEEXT) \
kpsestat$(EXEEXT) kpsewhich$(EXEEXT)
subdir = .
@@ -114,8 +115,9 @@ am__libkpathsea_la_SOURCES_DIST = tex-file.c absolute.c atou.c cnf.c \
uppercasify.c variable.c version.c xbasename.c xcalloc.c \
xdirname.c xfopen.c xfseek.c xfseeko.c xftell.c xftello.c \
xgetcwd.c xmalloc.c xopendir.c xputenv.c xrealloc.c xstat.c \
- xstrdup.c mingw32.c
-@MINGW32_TRUE@am__objects_1 = libkpathsea_la-mingw32.lo
+ xstrdup.c mingw32.c knj.c
+@MINGW32_TRUE@@WIN32_TRUE@am__objects_1 = libkpathsea_la-mingw32.lo
+@WIN32_TRUE@am__objects_2 = libkpathsea_la-knj.lo
am_libkpathsea_la_OBJECTS = libkpathsea_la-tex-file.lo \
libkpathsea_la-absolute.lo libkpathsea_la-atou.lo \
libkpathsea_la-cnf.lo libkpathsea_la-concat.lo \
@@ -144,7 +146,7 @@ am_libkpathsea_la_OBJECTS = libkpathsea_la-tex-file.lo \
libkpathsea_la-xgetcwd.lo libkpathsea_la-xmalloc.lo \
libkpathsea_la-xopendir.lo libkpathsea_la-xputenv.lo \
libkpathsea_la-xrealloc.lo libkpathsea_la-xstat.lo \
- libkpathsea_la-xstrdup.lo $(am__objects_1)
+ libkpathsea_la-xstrdup.lo $(am__objects_1) $(am__objects_2)
libkpathsea_la_OBJECTS = $(am_libkpathsea_la_OBJECTS)
libkpathsea_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
@@ -376,7 +378,7 @@ libkpathsea_la_SOURCES = tex-file.c absolute.c atou.c cnf.c concat.c \
variable.c version.c xbasename.c xcalloc.c xdirname.c xfopen.c \
xfseek.c xfseeko.c xftell.c xftello.c xgetcwd.c xmalloc.c \
xopendir.c xputenv.c xrealloc.c xstat.c xstrdup.c \
- $(am__append_1)
+ $(am__append_1) $(am__append_2)
kpseincludedir = ${includedir}/kpathsea
nodist_kpseinclude_HEADERS = \
c-auto.h \
@@ -410,6 +412,7 @@ kpseinclude_HEADERS = \
fontmap.h \
getopt.h \
hash.h \
+ knj.h \
lib.h \
line.h \
magstep.h \
@@ -663,6 +666,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libkpathsea_la-getopt1.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libkpathsea_la-hash.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libkpathsea_la-kdefault.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libkpathsea_la-knj.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libkpathsea_la-kpathsea.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libkpathsea_la-line.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libkpathsea_la-magstep.Plo@am__quote@
@@ -1122,6 +1126,13 @@ libkpathsea_la-mingw32.lo: mingw32.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libkpathsea_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libkpathsea_la-mingw32.lo `test -f 'mingw32.c' || echo '$(srcdir)/'`mingw32.c
+libkpathsea_la-knj.lo: knj.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libkpathsea_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libkpathsea_la-knj.lo -MD -MP -MF $(DEPDIR)/libkpathsea_la-knj.Tpo -c -o libkpathsea_la-knj.lo `test -f 'knj.c' || echo '$(srcdir)/'`knj.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libkpathsea_la-knj.Tpo $(DEPDIR)/libkpathsea_la-knj.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='knj.c' object='libkpathsea_la-knj.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libkpathsea_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libkpathsea_la-knj.lo `test -f 'knj.c' || echo '$(srcdir)/'`knj.c
+
mostlyclean-libtool:
-rm -f *.lo
@@ -1780,6 +1791,7 @@ kpathsea.h: Makefile paths.h
(cd $(srcdir) && ls -1 *.h) \
| sed -e '/^config\.h/d' \
-e '/^paths\.h/d' \
+ -e '/^knj\.h/d' \
-e '/^kpathsea\.h/d' \
-e '/^mingw32\.h/d' \
-e '/^win32lib\.h/d' \
diff --git a/Build/source/texk/kpathsea/config.h b/Build/source/texk/kpathsea/config.h
index 515bd97f644..eef952d7113 100644
--- a/Build/source/texk/kpathsea/config.h
+++ b/Build/source/texk/kpathsea/config.h
@@ -1,7 +1,7 @@
/* config.h: master configuration file, included first by all compilable
source files (not headers).
- Copyright 1993, 1995, 1996, 1997, 2008, 2010 Karl Berry.
+ Copyright 1993, 1995, 1996, 1997, 2008, 2010, 2011 Karl Berry.
Copyright 2000, 2003, 2004, 2005 Olaf Weber.
This library is free software; you can redistribute it and/or
@@ -95,6 +95,7 @@
but before "lib.h". FP.
*/
#if defined (WIN32) || defined (_WIN32)
+#include <kpathsea/knj.h>
#ifdef __MINGW32__
#include <kpathsea/mingw32.h>
#else
@@ -102,6 +103,18 @@
#endif
#endif
+/* Transform filename characters for use in hash tables. */
+#if defined(MONOCASE_FILENAMES)
+#if defined(WIN32) && !defined(__i386_pc_gnu__)
+/* This is way faster under Win32. */
+#define TRANSFORM(x) ((unsigned)CharLower((LPTSTR)(BYTE)(x)))
+#else
+#define TRANSFORM(x) (tolower(x))
+#endif
+#else
+#define TRANSFORM(x) (x)
+#endif
+
#include <kpathsea/debug.h> /* Runtime tracing. */
#include <kpathsea/lib.h> /* STREQ, etc. */
#include <kpathsea/types.h> /* <sys/types.h>, boolean, string, etc. */
diff --git a/Build/source/texk/kpathsea/db.c b/Build/source/texk/kpathsea/db.c
index 760748ecf9d..86ac3786875 100644
--- a/Build/source/texk/kpathsea/db.c
+++ b/Build/source/texk/kpathsea/db.c
@@ -95,6 +95,9 @@ db_build (kpathsea kpse, hash_table_type *table, const_string db_filename)
string top_dir = (string)xmalloc (len + 1);
string cur_dir = NULL; /* First thing in ls-R might be a filename. */
FILE *db_file = fopen (db_filename, FOPEN_R_MODE);
+#if defined(WIN32)
+ string pp;
+#endif
strncpy (top_dir, db_filename, len);
top_dir[len] = 0;
@@ -103,6 +106,16 @@ db_build (kpathsea kpse, hash_table_type *table, const_string db_filename)
while ((line = read_line (db_file)) != NULL) {
len = strlen (line);
+#if defined(WIN32)
+ for (pp = line; *pp; pp++) {
+ if (IS_KANJI(pp)) {
+ pp++;
+ continue;
+ }
+ *pp = TRANSFORM(*pp);
+ }
+#endif
+
/* A line like `/foo:' = new dir foo. Allow both absolute (/...)
and explicitly relative (./...) names here. It's a kludge to
pass in the directory name with the trailing : still attached,
@@ -503,7 +516,11 @@ kpathsea_db_search (kpathsea kpse, const_string name,
unsigned len = 1; /* Have NULL element already allocated. */
for (r = aliases; *r; r++)
len++;
+ /* This is essentially
XRETALLOC (aliases, len + 1, const_string);
+ except that MSVC warns without the cast to `void *'. */
+ aliases = (const_string *) xrealloc ((void *) aliases,
+ (len + 1) * sizeof(const_string));
for (i = len; i > 0; i--) {
aliases[i] = aliases[i - 1];
}
@@ -579,7 +596,7 @@ kpathsea_db_search (kpathsea kpse, const_string name,
free (orig_dirs);
}
- free (aliases);
+ free ((void *) aliases);
/* If we had to break up NAME, free the TEMP_STR. */
if (temp_str)
@@ -673,7 +690,8 @@ kpathsea_db_search_list (kpathsea kpse, const_string* names,
unsigned len = 1; /* Have NULL element already allocated. */
for (r = aliases; *r; r++)
len++;
- XRETALLOC (aliases, len + 1, const_string);
+ aliases = (const_string *) xrealloc ((void *) aliases,
+ (len + 1) * sizeof(const_string));
for (i = len; i > 0; i--) {
aliases[i] = aliases[i - 1];
}
@@ -744,7 +762,7 @@ kpathsea_db_search_list (kpathsea kpse, const_string* names,
free (orig_dirs);
}
- free (aliases);
+ free ((void *) aliases);
if (temp_str)
free (temp_str);
}
diff --git a/Build/source/texk/kpathsea/expand.c b/Build/source/texk/kpathsea/expand.c
index 895a627b510..f1199559f17 100644
--- a/Build/source/texk/kpathsea/expand.c
+++ b/Build/source/texk/kpathsea/expand.c
@@ -1,6 +1,6 @@
/* expand.c: general expansion.
- Copyright 1993, 1994, 1995, 1996, 1997, 1998, 2005, 2008, 2009
+ Copyright 1993, 1994, 1995, 1996, 1997, 1998, 2005, 2008, 2009, 2011
Karl Berry & Olaf Weber.
This library is free software; you can redistribute it and/or
@@ -296,7 +296,6 @@ static void expand_append (str_list_type* partial,
}
-
static str_list_type
brace_expand (kpathsea kpse, const_string *text)
{
@@ -305,6 +304,12 @@ brace_expand (kpathsea kpse, const_string *text)
result = str_list_init();
partial = str_list_init();
for (p = *text; *p && *p != '}'; ++p) {
+#if defined(WIN32)
+ if (IS_KANJI(p)) {
+ p++;
+ continue;
+ }
+#endif
/* FIXME: Should be IS_ENV_SEP(*p) */
if (*p == ENV_SEP || *p == ',') {
expand_append(&partial, *text, p);
diff --git a/Build/source/texk/kpathsea/hash.c b/Build/source/texk/kpathsea/hash.c
index 49fa50b3797..8232eae5ac4 100644
--- a/Build/source/texk/kpathsea/hash.c
+++ b/Build/source/texk/kpathsea/hash.c
@@ -35,7 +35,13 @@ hash (hash_table_type table, const_string key)
/* Our keys aren't often anagrams of each other, so no point in
weighting the characters. */
while (*key != 0)
- n = (n + n + *key++) % table.size;
+#if defined(WIN32)
+ if (IS_KANJI(key)) {
+ n = (n + n + (unsigned)(*key++)) % table.size;
+ n = (n + n + (unsigned)(*key++)) % table.size;
+ } else
+#endif
+ n = (n + n + TRANSFORM (*key++)) % table.size;
return n;
}
diff --git a/Build/source/texk/kpathsea/knj.c b/Build/source/texk/kpathsea/knj.c
new file mode 100644
index 00000000000..4feddbc1d40
--- /dev/null
+++ b/Build/source/texk/kpathsea/knj.c
@@ -0,0 +1,32 @@
+/* knj.c: check for 2-Byte Kanji (CP 932, SJIS) codes.
+
+ Copyright 2010, 2011 Akira Kakuto.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this library; if not, see <http://www.gnu.org/licenses/>. */
+
+#include <kpathsea/config.h>
+
+KPSEDLL int is_cp932_system;
+
+int isknj(int c)
+{
+ c &= 0xff;
+ return((c>=0x81 && c<=0x9f) || (c>=0xe0 && c<=0xfc));
+}
+
+int isknj2(int c)
+{
+ c &= 0xff;
+ return(c>=0x40 && c<=0xfc && c!=0x7f);
+}
diff --git a/Build/source/texk/kpathsea/knj.h b/Build/source/texk/kpathsea/knj.h
new file mode 100644
index 00000000000..710bd154304
--- /dev/null
+++ b/Build/source/texk/kpathsea/knj.h
@@ -0,0 +1,28 @@
+/* knj.h: check for 2-Byte Kanji (CP 932, SJIS) codes.
+
+ Copyright 2010, 2011 Akira Kakuto.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this library; if not, see <http://www.gnu.org/licenses/>. */
+
+#ifndef KPATHSEA_KNJ_H
+#define KPATHSEA_KNJ_H
+
+extern KPSEDLL int is_cp932_system;
+
+extern KPSEDLL int isknj(int c);
+extern KPSEDLL int isknj2(int c);
+
+#define IS_KANJI(p) is_cp932_system && isknj(*(p)) && isknj2(*(p+1))
+
+#endif /* not KPATHSEA_KNJ_H */
diff --git a/Build/source/texk/kpathsea/path-elt.c b/Build/source/texk/kpathsea/path-elt.c
index 68a18490976..841fb36f5cb 100644
--- a/Build/source/texk/kpathsea/path-elt.c
+++ b/Build/source/texk/kpathsea/path-elt.c
@@ -53,6 +53,13 @@ element (kpathsea kpse, const_string passed_path, boolean env_p)
brace_level = 0;
while (*p != 0 && !(brace_level == 0
&& (env_p ? IS_ENV_SEP (*p) : IS_DIR_SEP (*p)))) {
+#if defined(WIN32)
+ if (IS_KANJI(p)) {
+ p++;
+ p++;
+ continue;
+ }
+#endif
if (*p == '{') ++brace_level;
else if (*p == '}') --brace_level;
++p;
diff --git a/Build/source/texk/kpathsea/progname.c b/Build/source/texk/kpathsea/progname.c
index 49d3bf8bc0b..69dca71b86b 100644
--- a/Build/source/texk/kpathsea/progname.c
+++ b/Build/source/texk/kpathsea/progname.c
@@ -449,7 +449,7 @@ mk_suffixlist (kpathsea kpse)
if (*q)
n++;
kpse->suffixlist = (char **) xmalloc ((n + 2) * sizeof (char *));
- p = (char **)kpse->suffixlist;
+ p = kpse->suffixlist;
*p = xstrdup (".dll");
p++;
q = v;
@@ -489,6 +489,8 @@ kpathsea_set_program_name (kpathsea kpse, const_string argv0,
}
#if defined(WIN32)
+ is_cp932_system = (GetACP () == 932);
+
/* Set various info about user. Among many things,
ensure that HOME is set. */
init_user_info();
diff --git a/Build/source/texk/kpathsea/tilde.c b/Build/source/texk/kpathsea/tilde.c
index 5d4c6274b0e..2f3ff76bb01 100644
--- a/Build/source/texk/kpathsea/tilde.c
+++ b/Build/source/texk/kpathsea/tilde.c
@@ -1,7 +1,7 @@
/* tilde.c: expand user's home directories.
Copyright 1997, 1998, 2005, Olaf Weber.
- Copyright 1993, 1995, 1996, 1997, 2008 Karl Berry.
+ Copyright 1993, 1995, 1996, 1997, 2008, 2011 Karl Berry.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -41,10 +41,24 @@ kpathsea_tilde_expand (kpathsea kpse, string name)
string expansion;
const_string home;
const_string prefix;
+#if defined(WIN32)
+ string p;
+#endif
(void)kpse; /* currenty not used */
assert (name);
+#if defined(WIN32)
+ for (p = name; *p; p++) {
+ if (IS_KANJI(p)) {
+ p++;
+ continue;
+ }
+ if (*p == '\\')
+ *p = '/';
+ }
+#endif
+
/* If there is a leading "!!", set prefix to "!!", otherwise use
the empty string. After this, we can test whether a prefix was
found by checking *prefix, and it is safe to unconditionally
diff --git a/Build/source/texk/kpathsea/truncate.c b/Build/source/texk/kpathsea/truncate.c
index a4ea938f394..17427e97ceb 100644
--- a/Build/source/texk/kpathsea/truncate.c
+++ b/Build/source/texk/kpathsea/truncate.c
@@ -1,6 +1,6 @@
/* truncate.c: truncate too-long components in a filename.
- Copyright 1993, 1995, 2008, 2010 Karl Berry.
+ Copyright 1993, 1995, 2008, 2010, 2011 Karl Berry.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -39,6 +39,16 @@ kpathsea_truncate_filename (kpathsea kpse, const_string name)
for (; *name; name++)
{
+#if defined(WIN32)
+ if (IS_KANJI(name)) {
+ if (c_len < NAME_MAX) {
+ ret[ret_len++] = *name++;
+ ret[ret_len++] = *name;
+ }
+ c_len += 2;
+ continue;
+ }
+#endif
if (IS_DIR_SEP (*name) || IS_DEVICE_SEP (*name))
{ /* At a directory delimiter, reset component length. */
c_len = 0;
diff --git a/Build/source/texk/kpathsea/variable.c b/Build/source/texk/kpathsea/variable.c
index 535c7581b38..4198f043d10 100644
--- a/Build/source/texk/kpathsea/variable.c
+++ b/Build/source/texk/kpathsea/variable.c
@@ -1,6 +1,6 @@
/* variable.c: variable expansion.
- Copyright 1993, 1994, 1995, 1996, 2008, 2009 Karl Berry.
+ Copyright 1993, 1994, 1995, 1996, 2008, 2009, 2011 Karl Berry.
Copyright 1997, 1999, 2001, 2002, 2005 Olaf Weber.
This library is free software; you can redistribute it and/or
@@ -220,8 +220,13 @@ kpathsea_var_expand (kpathsea kpse, const_string src)
/* ${: scan ahead for matching delimiter, then expand. */
const_string var_end = ++s;
- while (*var_end && !IS_VAR_END_DELIMITER (*var_end))
+ while (*var_end && !IS_VAR_END_DELIMITER (*var_end)) {
+#if defined(WIN32)
+ if (IS_KANJI(var_end))
+ var_end++;
+#endif
var_end++;
+ }
if (! *var_end) {
WARNING1 ("%s: No matching } for ${", src);
diff --git a/Build/source/texk/kpathsea/xdirname.c b/Build/source/texk/kpathsea/xdirname.c
index 62da3d95c9c..8b3585ecea8 100644
--- a/Build/source/texk/kpathsea/xdirname.c
+++ b/Build/source/texk/kpathsea/xdirname.c
@@ -1,6 +1,6 @@
/* xdirname.c: return the directory part of a path.
- Copyright 1999, 2008 Karl Berry.
+ Copyright 1999, 2008, 2011 Karl Berry.
Copyright 2005 Olaf Weber.
This library is free software; you can redistribute it and/or
@@ -30,6 +30,9 @@ xdirname (const_string name)
{
string ret;
unsigned limit = 0, loc;
+#if defined(WIN32)
+ string p;
+#endif
/* Ignore a NULL name. */
if (!name)
@@ -76,6 +79,17 @@ xdirname (const_string name)
ret[loc] = '\0';
}
+#if defined(WIN32)
+ for (p = ret; *p; p++) {
+ if (IS_KANJI(p)) {
+ p++;
+ continue;
+ }
+ if (*p == '\\')
+ *p = '/';
+ }
+#endif
+
return ret;
}
@@ -116,4 +130,3 @@ Local variables:
standalone-compile-command: "gcc -g -I. -I.. -DTEST xdirname.c kpathsea.a"
End:
*/
-
diff --git a/Build/source/texk/kpathsea/xgetcwd.c b/Build/source/texk/kpathsea/xgetcwd.c
index bde9102d845..79f1d832055 100644
--- a/Build/source/texk/kpathsea/xgetcwd.c
+++ b/Build/source/texk/kpathsea/xgetcwd.c
@@ -49,11 +49,25 @@ xgetcwd (void)
-- Olaf Weber <infovore@xs4all.nl */
#if defined (HAVE_GETCWD) && !defined (GETCWD_FORKS)
char path[PATH_MAX + 1];
+#if defined(WIN32)
+ string pp;
+#endif
if (getcwd (path, PATH_MAX + 1) == NULL) {
FATAL_PERROR ("getcwd");
}
+#if defined(WIN32)
+ for (pp = path; *pp; pp++) {
+ if (IS_KANJI(pp)) {
+ pp++;
+ continue;
+ }
+ if (*pp == '\\')
+ *pp = '/';
+ }
+#endif
+
return xstrdup (path);
#elif defined (HAVE_GETWD)
char path[PATH_MAX + 1];