summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAkira Kakuto <kakuto@fuk.kindai.ac.jp>2013-06-24 22:48:43 +0000
committerAkira Kakuto <kakuto@fuk.kindai.ac.jp>2013-06-24 22:48:43 +0000
commit04ce8d1155f2fd81d8519f3156e5b8345a1412a5 (patch)
treed168232ea4895819fdb41c46de7dc15ba68375f8
parent46641b6545659d40a665d64d0e7239bed2235c73 (diff)
unify two win32lib.c's in w32 sources.
git-svn-id: svn://tug.org/texlive/trunk@30906 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Build/source/texk/kpathsea/ChangeLog6
-rw-r--r--Build/source/texk/kpathsea/progname.c5
-rw-r--r--Build/source/texk/kpathsea/texmf.cnf4
-rw-r--r--Build/source/texk/kpathsea/win32lib.c12
4 files changed, 24 insertions, 3 deletions
diff --git a/Build/source/texk/kpathsea/ChangeLog b/Build/source/texk/kpathsea/ChangeLog
index 9bd7511929c..0ae9186f549 100644
--- a/Build/source/texk/kpathsea/ChangeLog
+++ b/Build/source/texk/kpathsea/ChangeLog
@@ -1,3 +1,9 @@
+2013-06-25 Akira Kakuto <kakuto@fuk.kindai.ac.jp>
+
+ * win32lib.c: Unify two win32lib.c's in w32 sources.
+ * progname.c, texmf.cnf: Define SELFAUTOGRANDPARENT to give a
+ robust TEXMFLOCAL.
+
2013-06-16 Peter Breitenlohner <peb@mppmu.mpg.de>
* configure.ac: New conditional have_EXEEXT.
diff --git a/Build/source/texk/kpathsea/progname.c b/Build/source/texk/kpathsea/progname.c
index 01f2710c7aa..9fcc44d8cf9 100644
--- a/Build/source/texk/kpathsea/progname.c
+++ b/Build/source/texk/kpathsea/progname.c
@@ -486,7 +486,7 @@ kpathsea_set_program_name (kpathsea kpse, const_string argv0,
const_string progname)
{
const_string ext;
- string sdir, sdir_parent, sdir_grandparent;
+ string sdir, sdir_parent, sdir_grandparent, sdir_greatgrandparent;
string s = getenv ("KPATHSEA_DEBUG");
#ifdef WIN32
string debug_output = getenv("KPATHSEA_DEBUG_OUTPUT");
@@ -665,6 +665,8 @@ kpathsea_set_program_name (kpathsea kpse, const_string argv0,
kpathsea_xputenv (kpse, "SELFAUTODIR", fix_selfdir (sdir_parent));
sdir_grandparent = xdirname (sdir_parent);
kpathsea_xputenv (kpse, "SELFAUTOPARENT", fix_selfdir (sdir_grandparent));
+ sdir_greatgrandparent = xdirname (sdir_grandparent);
+ kpathsea_xputenv (kpse, "SELFAUTOGRANDPARENT", fix_selfdir (sdir_greatgrandparent));
#if defined(WIN32) || defined(__CYGWIN__)
mk_suffixlist(kpse);
@@ -673,6 +675,7 @@ kpathsea_set_program_name (kpathsea kpse, const_string argv0,
free (sdir);
free (sdir_parent);
free (sdir_grandparent);
+ free (sdir_greatgrandparent);
kpse->invocation_short_name
= xstrdup (xbasename (kpse->invocation_name));
diff --git a/Build/source/texk/kpathsea/texmf.cnf b/Build/source/texk/kpathsea/texmf.cnf
index 15bb966626c..36227bb14f8 100644
--- a/Build/source/texk/kpathsea/texmf.cnf
+++ b/Build/source/texk/kpathsea/texmf.cnf
@@ -61,7 +61,7 @@ TEXMFDIST = $TEXMFROOT/texmf-dist
TEXMFMAIN = $TEXMFDIST
% Local additions to the distribution trees.
-TEXMFLOCAL = $TEXMFROOT/../texmf-local
+TEXMFLOCAL = $SELFAUTOGRANDPARENT/texmf-local
% TEXMFSYSVAR, where *-sys store cached runtime data.
TEXMFSYSVAR = $TEXMFROOT/texmf-var
@@ -502,7 +502,7 @@ $SELFAUTODIR/texmf-local/web2c,\
$SELFAUTODIR/texmf-dist/web2c,\
$SELFAUTODIR/texmf/web2c,\
\
-$SELFAUTOPARENT/../texmf-local/web2c,\
+$SELFAUTOGRANDPARENT/texmf-local/web2c,\
$SELFAUTOPARENT,\
\
$SELFAUTOPARENT/share/texmf-local/web2c,\
diff --git a/Build/source/texk/kpathsea/win32lib.c b/Build/source/texk/kpathsea/win32lib.c
index c25fdfd931c..0f1d353b745 100644
--- a/Build/source/texk/kpathsea/win32lib.c
+++ b/Build/source/texk/kpathsea/win32lib.c
@@ -42,6 +42,12 @@ int win32_pclose (FILE *f)
__int64
xftell64 (FILE *f, const char *filename)
{
+#if _MSC_VER > 1200
+ __int64 where;
+ where = _ftelli64(f);
+ if (where < (__int64)0)
+ FATAL_PERROR(filename);
+#else
__int64 where, filepos;
int fd;
@@ -56,12 +62,17 @@ xftell64 (FILE *f, const char *filename)
where = (__int64)(f->_ptr - f->_base);
else
where = filepos - f->_cnt;
+#endif
return where;
}
void
xfseek64 (FILE *f, __int64 offset, int wherefrom, const char *filename)
{
+#if _MSC_VER > 1200
+ if (_fseeki64(f, offset, wherefrom) < (__int64)0)
+ FATAL_PERROR(filename);
+#else
if(wherefrom == SEEK_CUR) {
offset += xftell64(f, filename);
wherefrom = SEEK_SET;
@@ -69,6 +80,7 @@ xfseek64 (FILE *f, __int64 offset, int wherefrom, const char *filename)
fflush(f);
if (_lseeki64(fileno(f), offset, wherefrom) < (__int64)0)
FATAL_PERROR(filename);
+#endif
}