summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Build/source/texk/mendexk/ChangeLog16
-rw-r--r--Build/source/texk/mendexk/convert.c7
-rw-r--r--Build/source/texk/mendexk/fread.c6
-rw-r--r--Build/source/texk/mendexk/fwrite.c7
-rw-r--r--Build/source/texk/mendexk/kp.c6
-rw-r--r--Build/source/texk/mendexk/main.c42
-rw-r--r--Build/source/texk/mendexk/mendex.h8
-rw-r--r--Build/source/texk/mendexk/pageread.c5
-rw-r--r--Build/source/texk/mendexk/sort.c5
-rw-r--r--Build/source/texk/mendexk/styfile.c6
10 files changed, 70 insertions, 38 deletions
diff --git a/Build/source/texk/mendexk/ChangeLog b/Build/source/texk/mendexk/ChangeLog
index b7543c6a21d..adb4c079f78 100644
--- a/Build/source/texk/mendexk/ChangeLog
+++ b/Build/source/texk/mendexk/ChangeLog
@@ -1,3 +1,19 @@
+2012-10-16 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * convert.c: Move common #include's from here ...
+ * fread.c: ... and here ...
+ * fwrite.c: ... and here ...
+ * main.c: ... and here ...
+ * pageread.c: ... and here ...
+ * sort.c: ... and here ...
+ * styfile.c: ... and here ...
+ * mendex.h: ... to here and add '#include <c-auto.h>'.
+ * kp.c: Add '#include "mendex.h"' for common #include's.
+
+ Avoid TL vs W32TeX diffs.
+ * main.c: Use "PTEX_KANJI_ENC" and "guess_input_kanji_encoding".
+ [WIN32}: Add command line option '-T' (from W32TeX).
+
2012-09-06 Peter Breitenlohner <peb@mppmu.mpg.de>
* main.c [WIN32]: Use "sjis" file encoding (from W32TeX).
diff --git a/Build/source/texk/mendexk/convert.c b/Build/source/texk/mendexk/convert.c
index 55f81af0768..66b31bca246 100644
--- a/Build/source/texk/mendexk/convert.c
+++ b/Build/source/texk/mendexk/convert.c
@@ -1,12 +1,9 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
+#include "mendex.h"
-#include <kpathsea/config.h>
#include <kpathsea/tex-file.h>
#include <kpathsea/variable.h>
#include <ptexenc/ptexenc.h>
-#include "mendex.h"
+
#include "qsort.h"
#include "exkana.h"
diff --git a/Build/source/texk/mendexk/fread.c b/Build/source/texk/mendexk/fread.c
index 0b6778ff6ef..0ae9151ffb1 100644
--- a/Build/source/texk/mendexk/fread.c
+++ b/Build/source/texk/mendexk/fread.c
@@ -1,11 +1,7 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
+#include "mendex.h"
-#include <kpathsea/config.h>
#include <kpathsea/tex-file.h>
#include <ptexenc/ptexenc.h>
-#include "mendex.h"
#include "exkana.h"
#include "exvar.h"
diff --git a/Build/source/texk/mendexk/fwrite.c b/Build/source/texk/mendexk/fwrite.c
index 5fb4c56fa36..8c187827c8b 100644
--- a/Build/source/texk/mendexk/fwrite.c
+++ b/Build/source/texk/mendexk/fwrite.c
@@ -1,12 +1,9 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
+#include "mendex.h"
+
#include <stdarg.h>
-#include <kpathsea/config.h>
#include <kpathsea/tex-file.h>
#include <ptexenc/ptexenc.h>
-#include "mendex.h"
#include "exkana.h"
#include "exvar.h"
diff --git a/Build/source/texk/mendexk/kp.c b/Build/source/texk/mendexk/kp.c
index 63d4bd6163d..c43453f7857 100644
--- a/Build/source/texk/mendexk/kp.c
+++ b/Build/source/texk/mendexk/kp.c
@@ -1,7 +1,9 @@
/* Written by K.Asayayam Sep. 1995 */
-#include <kpathsea/kpathsea.h>
-#include <string.h>
+#include "mendex.h"
+#include <kpathsea/expand.h>
+#include <kpathsea/pathsearch.h>
+
#include "kp.h"
/* KP_get_path(char *var, char *def_val)
diff --git a/Build/source/texk/mendexk/main.c b/Build/source/texk/mendexk/main.c
index a6436ce4009..13cda874e7e 100644
--- a/Build/source/texk/mendexk/main.c
+++ b/Build/source/texk/mendexk/main.c
@@ -1,12 +1,7 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <kpathsea/config.h>
+#include "mendex.h"
#include <kpathsea/tex-file.h>
#include <kpathsea/variable.h>
#include <ptexenc/ptexenc.h>
-#include "mendex.h"
#include "kana.h"
#include "var.h"
@@ -30,14 +25,34 @@ int main(int argc, char **argv)
{
int i,j,cc=0,startpagenum=-1,ecount=0;
const char *envbuff;
+ char *p;
+
+ enable_UPTEX (false); /* disable */
#ifdef WIN32
_setmaxstdio(2048);
set_enc_string("sjis", "euc");
+ sjisterminal = 0;
#else
set_enc_string(NULL, "euc");
#endif
kpse_set_program_name(argv[0], "mendex");
+
+ p = getenv ("PTEX_KANJI_ENC");
+ if (p) {
+ if (!set_enc_string (p, NULL))
+ fprintf (stderr, "Ignoring bad kanji encoding \"%s\".\n", p);
+ }
+
+#ifdef WIN32
+ p = kpse_var_value ("guess_input_kanji_encoding");
+ if (p) {
+ if (*p == '1' || *p == 'y' || *p == 't')
+ infile_enc_auto = 1;
+ free(p);
+ }
+#endif
+
kp_ist.var_name = "INDEXSTYLE";
kp_ist.path = DEFAULT_INDEXSTYLES; /* default path. */
kp_ist.suffix = "ist";
@@ -154,6 +169,12 @@ int main(int argc, char **argv)
set_enc_string("SJIS", NULL);
break;
+#ifdef WIN32
+ case 'T':
+ sjisterminal = 1;
+ break;
+#endif
+
case 'U':
set_enc_string("UTF8", NULL);
break;
@@ -162,7 +183,11 @@ int main(int argc, char **argv)
fprintf(stderr,"mendex - Japanese index processor, %s (%s).\n",VERSION, get_enc_string());
fprintf(stderr," Copyright 2009 ASCII MEDIA WORKS.(ptex-staff@ml.asciimw.jp)\n");
fprintf(stderr,"usage:\n");
- fprintf(stderr,"%% mendex [-ilqrcg] [-s sty] [-d dic] [-o ind] [-t log] [-p no] [idx0 idx1 ...]\n");
+ fprintf(stderr,"%% mendex [-ilqrcgfEJS"
+#ifdef WIN32
+ "T"
+#endif
+ "U] [-s sty] [-d dic] [-o ind] [-t log] [-p no] [idx0 idx1 ...]\n");
fprintf(stderr,"options:\n");
fprintf(stderr,"-i use stdin as the input file.\n");
fprintf(stderr,"-l use letter ordering.\n");
@@ -179,6 +204,9 @@ int main(int argc, char **argv)
fprintf(stderr,"-E EUC mode.\n");
fprintf(stderr,"-J JIS mode.\n");
fprintf(stderr,"-S ShiftJIS mode.\n");
+#ifdef WIN32
+ fprintf(stderr,"-T ShiftJIS terminal.\n");
+#endif
fprintf(stderr,"-U UTF-8 mode.\n");
fprintf(stderr,"idx... input files.\n");
exit(0);
diff --git a/Build/source/texk/mendexk/mendex.h b/Build/source/texk/mendexk/mendex.h
index c071733b482..2c5c2611b7f 100644
--- a/Build/source/texk/mendexk/mendex.h
+++ b/Build/source/texk/mendexk/mendex.h
@@ -1,3 +1,11 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <c-auto.h>
+
+#include <kpathsea/config.h>
+
#ifdef WIN32
#define nkf_open fopen
#define nkf_close fclose
diff --git a/Build/source/texk/mendexk/pageread.c b/Build/source/texk/mendexk/pageread.c
index 1d6f574395b..b77fb2931d9 100644
--- a/Build/source/texk/mendexk/pageread.c
+++ b/Build/source/texk/mendexk/pageread.c
@@ -1,9 +1,6 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
+#include "mendex.h"
#include <kpathsea/tex-file.h>
-#include "mendex.h"
static inline int
bfgetc (FILE *stream)
diff --git a/Build/source/texk/mendexk/sort.c b/Build/source/texk/mendexk/sort.c
index 7ec44785f20..6c925e4df36 100644
--- a/Build/source/texk/mendexk/sort.c
+++ b/Build/source/texk/mendexk/sort.c
@@ -1,8 +1,3 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <kpathsea/config.h>
#include "mendex.h"
#include "qsort.h"
diff --git a/Build/source/texk/mendexk/styfile.c b/Build/source/texk/mendexk/styfile.c
index f56a3f139d4..9179a34904c 100644
--- a/Build/source/texk/mendexk/styfile.c
+++ b/Build/source/texk/mendexk/styfile.c
@@ -1,11 +1,7 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
+#include "mendex.h"
-#include <kpathsea/config.h>
#include <kpathsea/tex-file.h>
#include <ptexenc/ptexenc.h>
-#include "mendex.h"
#include "exvar.h"