summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c/lib/openclose.c
diff options
context:
space:
mode:
authorPeter Breitenlohner <peb@mppmu.mpg.de>2010-04-20 06:33:49 +0000
committerPeter Breitenlohner <peb@mppmu.mpg.de>2010-04-20 06:33:49 +0000
commitc069df30824ac859800243880e32f7dbdd6a9735 (patch)
tree79aa9f28ec870179384b1408e6d70e33ec703bec /Build/source/texk/web2c/lib/openclose.c
parent24b38822a35c7e7092f43ae7899072b8a41be5be (diff)
build system: some cleanup and better pTeX integration
git-svn-id: svn://tug.org/texlive/trunk@17940 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/web2c/lib/openclose.c')
-rw-r--r--Build/source/texk/web2c/lib/openclose.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/Build/source/texk/web2c/lib/openclose.c b/Build/source/texk/web2c/lib/openclose.c
index a753cceb8de..a0d5f0bb35a 100644
--- a/Build/source/texk/web2c/lib/openclose.c
+++ b/Build/source/texk/web2c/lib/openclose.c
@@ -8,6 +8,9 @@
#include <kpathsea/tex-file.h>
#include <kpathsea/variable.h>
#include <kpathsea/absolute.h>
+#ifdef PTEX
+#include <ptexenc/ptexenc.h>
+#endif
/* The globals we use to communicate. */
extern string nameoffile;
@@ -188,6 +191,12 @@ open_input (FILE **f_ptr, int filefmt, const_string fopen_mode)
free (fname);
/* This fopen is not allowed to fail. */
+#ifdef PTEX
+ if (filefmt == kpse_tex_format ||
+ filefmt == kpse_bib_format) {
+ *f_ptr = nkf_open (nameoffile + 1, fopen_mode);
+ } else
+#endif
*f_ptr = xfopen (nameoffile + 1, fopen_mode);
}
}
@@ -274,7 +283,11 @@ close_file (FILE *f)
if (!f)
return;
+#ifdef PTEX
+ if (nkf_close (f) == EOF) {
+#else
if (fclose (f) == EOF) {
+#endif
/* It's not always nameoffile, we might have opened something else
in the meantime. And it's not easy to extract the filenames out
of the pool array. So just punt on the filename. Sigh. This