diff options
author | Takuji Tanaka <ttk@t-lab.opal.ne.jp> | 2022-09-01 13:49:56 +0000 |
---|---|---|
committer | Takuji Tanaka <ttk@t-lab.opal.ne.jp> | 2022-09-01 13:49:56 +0000 |
commit | e54d39c1730c4a54701d1c12181e64949410b709 (patch) | |
tree | 0954c0f0db6588d1760f7485d3f8eee7e34bc27e /Build/source | |
parent | 4cb3016b0f8aa860bd65af15c7bdb1f9f356d125 (diff) |
ptexenc,(u)ptex,mendex: initialize inflie_enc_auto when firstly used (by H.Kitagawa)
git-svn-id: svn://tug.org/texlive/trunk@64255 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source')
-rw-r--r-- | Build/source/texk/mendexk/ChangeLog | 8 | ||||
-rw-r--r-- | Build/source/texk/mendexk/main.c | 25 | ||||
-rw-r--r-- | Build/source/texk/ptexenc/ChangeLog | 6 | ||||
-rw-r--r-- | Build/source/texk/ptexenc/ptexenc.c | 23 | ||||
-rw-r--r-- | Build/source/texk/web2c/ptexdir/ChangeLog | 6 | ||||
-rw-r--r-- | Build/source/texk/web2c/ptexdir/kanji.c | 7 | ||||
-rw-r--r-- | Build/source/texk/web2c/uptexdir/ChangeLog | 6 | ||||
-rw-r--r-- | Build/source/texk/web2c/uptexdir/kanji.c | 7 |
8 files changed, 55 insertions, 33 deletions
diff --git a/Build/source/texk/mendexk/ChangeLog b/Build/source/texk/mendexk/ChangeLog index 0bb8da67899..686bbb16802 100644 --- a/Build/source/texk/mendexk/ChangeLog +++ b/Build/source/texk/mendexk/ChangeLog @@ -1,3 +1,11 @@ +2022-09-01 Hironori Kitagawa <h_kitagawa2001@yahoo.co.jp> + + * main.c: + Initialization of infile_enc_auto is moved to ptexenc. + Moved calls of KP_entry_filetype() (after checking options). + These changes prevent unwanted looking for texmf.cnf. + https://github.com/texjporg/tex-jp-build/pull/144 + 2022-06-12 TANAKA Takuji <ttk@t-lab.opal.ne.jp> * main.c: diff --git a/Build/source/texk/mendexk/main.c b/Build/source/texk/mendexk/main.c index 299006c1394..51fdd403d9f 100644 --- a/Build/source/texk/mendexk/main.c +++ b/Build/source/texk/mendexk/main.c @@ -40,22 +40,6 @@ int main(int argc, char **argv) fprintf (stderr, "Ignoring bad kanji encoding \"%s\".\n", p); } - p = kpse_var_value ("guess_input_kanji_encoding"); - if (p) { - if (*p == '1' || *p == 'y' || *p == 't') - infile_enc_auto = 1; - free(p); - } - - kp_ist.var_name = "INDEXSTYLE"; - kp_ist.path = DEFAULT_INDEXSTYLES; /* default path. */ - kp_ist.suffix = "ist"; - KP_entry_filetype(&kp_ist); - kp_dict.var_name = "INDEXDICTIONARY"; - kp_dict.path = DEFAULT_INDEXDICTS; /* default path */ - kp_dict.suffix = "dict"; - KP_entry_filetype(&kp_dict); - /* check options */ for (i=1,j=k=0;i<argc && j<256;i++) { @@ -230,6 +214,15 @@ int main(int argc, char **argv) } idxcount=j+fsti; + kp_ist.var_name = "INDEXSTYLE"; + kp_ist.path = DEFAULT_INDEXSTYLES; /* default path. */ + kp_ist.suffix = "ist"; + KP_entry_filetype(&kp_ist); + kp_dict.var_name = "INDEXDICTIONARY"; + kp_dict.path = DEFAULT_INDEXDICTS; /* default path */ + kp_dict.suffix = "dict"; + KP_entry_filetype(&kp_dict); + /* check option errors */ if (idxcount==0) idxcount=fsti=1; diff --git a/Build/source/texk/ptexenc/ChangeLog b/Build/source/texk/ptexenc/ChangeLog index 03e9be4beca..5128834aab8 100644 --- a/Build/source/texk/ptexenc/ChangeLog +++ b/Build/source/texk/ptexenc/ChangeLog @@ -1,3 +1,9 @@ +2022-09-01 Hironori Kitagawa <h_kitagawa2001@yahoo.co.jp> + + * ptexenc.c: Initialize infile_enc_auto only when this variable + is first used (input_line2). + https://github.com/texjporg/tex-jp-build/pull/144 + 2022-06-12 TANAKA Takuji <ttk@t-lab.opal.ne.jp> * ptexenc.c, unicode.c, ptexenc/ptexenc.h, ptexenc/unicode.h: diff --git a/Build/source/texk/ptexenc/ptexenc.c b/Build/source/texk/ptexenc/ptexenc.c index 55c0b155873..42858d47c0d 100644 --- a/Build/source/texk/ptexenc/ptexenc.c +++ b/Build/source/texk/ptexenc/ptexenc.c @@ -42,7 +42,8 @@ const char *ptexenc_version_string = PTEXENCVERSION; #if defined(WIN32) FILE *Poptr; #endif -int infile_enc_auto = 0; +int infile_enc_auto = 2; +/* 0: guess disabled, 1: guess enabled, 2: unspecified */ static int file_enc = ENC_UNKNOWN; static int internal_enc = ENC_UNKNOWN; @@ -990,6 +991,19 @@ char *ptenc_guess_enc(FILE *fp) return enc; } +void ptenc_set_infile_enc_auto(void) +{ + char *p; + if (infile_enc_auto == 2) { + p = kpse_var_value ("guess_input_kanji_encoding"); + if (p) { + if (*p == '1' || *p == 'y' || *p == 't') infile_enc_auto = 1; + free(p); + } + } + if (infile_enc_auto == 2) infile_enc_auto = 0; +} + /* input line with encoding conversion */ long input_line2(FILE *fp, unsigned char *buff, unsigned char *buff2, long pos, const long buffsize, int *lastchar) @@ -1009,7 +1023,9 @@ long input_line2(FILE *fp, unsigned char *buff, unsigned char *buff2, fprintf(stderr, "Detect UTF-8 with BOM #%d\n", fd); #endif /* DEBUG */ } - else if (infile_enc_auto && fd != fileno(stdin)) { + else { + if (infile_enc_auto == 2) ptenc_set_infile_enc_auto(); + if (infile_enc_auto && fd != fileno(stdin)) { char *enc; getc4(fp); getc4(fp); @@ -1024,8 +1040,9 @@ long input_line2(FILE *fp, unsigned char *buff, unsigned char *buff2, infile_enc[fd] = get_file_enc(); } if (enc) free(enc); + } + else infile_enc[fd] = get_file_enc(); } - else infile_enc[fd] = get_file_enc(); } while (last < buffsize-30 && (i=getc4(fp)) != EOF && i!='\n' && i!='\r') { diff --git a/Build/source/texk/web2c/ptexdir/ChangeLog b/Build/source/texk/web2c/ptexdir/ChangeLog index 0d94e1eb225..10c97e55dd8 100644 --- a/Build/source/texk/web2c/ptexdir/ChangeLog +++ b/Build/source/texk/web2c/ptexdir/ChangeLog @@ -1,3 +1,9 @@ +2022-09-01 Hironori Kitagawa <h_kitagawa2001@yahoo.co.jp> + + * kanji.c: Initialization of infile_enc_auto is moved to ptexenc. + This change prevents unwanted looking for texmf.cnf. + https://github.com/texjporg/tex-jp-build/pull/144 + 2022-06-12 TANAKA Takuji <ttk@t-lab.opal.ne.jp> * kanji.[ch], pbibtex.ch: diff --git a/Build/source/texk/web2c/ptexdir/kanji.c b/Build/source/texk/web2c/ptexdir/kanji.c index 0926f7b37ca..65fa9bb8cce 100644 --- a/Build/source/texk/web2c/ptexdir/kanji.c +++ b/Build/source/texk/web2c/ptexdir/kanji.c @@ -95,11 +95,4 @@ void init_default_kanji (const_string file_str, const_string internal_str) if (!set_enc_string (p, NULL)) fprintf (stderr, "Ignoring bad kanji encoding \"%s\".\n", p); } - - p = kpse_var_value ("guess_input_kanji_encoding"); - if (p) { - if (*p == '1' || *p == 'y' || *p == 't') - infile_enc_auto = 1; - free(p); - } } diff --git a/Build/source/texk/web2c/uptexdir/ChangeLog b/Build/source/texk/web2c/uptexdir/ChangeLog index b3eeef3ffbe..2ae4ffc4d86 100644 --- a/Build/source/texk/web2c/uptexdir/ChangeLog +++ b/Build/source/texk/web2c/uptexdir/ChangeLog @@ -1,3 +1,9 @@ +2022-09-01 Hironori Kitagawa <h_kitagawa2001@yahoo.co.jp> + + * kanji.c: Initialization of infile_enc_auto is moved to ptexenc. + This change prevents unwanted looking for texmf.cnf. + https://github.com/texjporg/tex-jp-build/pull/144 + 2022-07-23 TANAKA Takuji <ttk@t-lab.opal.ne.jp> * uptex-m.ch, upbibtex.ch, updvitype.ch, uppltotf.ch, uptftopl.ch, diff --git a/Build/source/texk/web2c/uptexdir/kanji.c b/Build/source/texk/web2c/uptexdir/kanji.c index e61f549de61..ea336cf9c2e 100644 --- a/Build/source/texk/web2c/uptexdir/kanji.c +++ b/Build/source/texk/web2c/uptexdir/kanji.c @@ -519,13 +519,6 @@ void init_default_kanji (const_string file_str, const_string internal_str) if (!set_enc_string (p, NULL)) fprintf (stderr, "Ignoring bad kanji encoding \"%s\".\n", p); } - - p = kpse_var_value ("guess_input_kanji_encoding"); - if (p) { - if (*p == '1' || *p == 'y' || *p == 't') - infile_enc_auto = 1; - free(p); - } } void init_default_kanji_select(void) |