diff options
author | Takuji Tanaka <ttk@t-lab.opal.ne.jp> | 2022-12-22 12:28:48 +0000 |
---|---|---|
committer | Takuji Tanaka <ttk@t-lab.opal.ne.jp> | 2022-12-22 12:28:48 +0000 |
commit | b59f1b8ee635405865045db9ec4da3c7bec464f0 (patch) | |
tree | ea9df1061c526426da4b30cd00c5ddcc16d982dc /Build/source/texk/ptexenc/ptexenc.c | |
parent | be432865de783ed058a21fbaea1016e635525a39 (diff) |
uptex-{sjis,euc}: accept file names with JIS X 0208 (H.Kitagawa)
git-svn-id: svn://tug.org/texlive/trunk@65330 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/ptexenc/ptexenc.c')
-rw-r--r-- | Build/source/texk/ptexenc/ptexenc.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/Build/source/texk/ptexenc/ptexenc.c b/Build/source/texk/ptexenc/ptexenc.c index 6d74a71cecb..461565d2c17 100644 --- a/Build/source/texk/ptexenc/ptexenc.c +++ b/Build/source/texk/ptexenc/ptexenc.c @@ -1150,6 +1150,10 @@ void clear_infile_enc(FILE *fp) { infile_enc[fileno(fp)] = ENC_UNKNOWN; } +long ptenc_conv_first_line(long pos, long last, unsigned char *buff, const long buffsize) +{ + return last; +} #else /* !WIN32 */ static const_string in_filter = NULL; static FILE *piped_fp[NOFILE]; @@ -1361,4 +1365,21 @@ int ptenc_get_command_line_args(int *p_ac, char ***p_av) return 0; } +long ptenc_conv_first_line(long pos, long last, unsigned char *buff, const long buffsize) + /* return new last */ +{ + unsigned char *old, *new_buf; long new_last, i; + if (internal_enc==ENC_UPTEX) return last; /* no conversion needed */ + old = xmalloc(last-pos+2); + if (old==NULL) return last; + strncpy(old, buff+pos, last-pos+1); old[last-pos+1]='\0'; + new_buf = ptenc_from_utf8_string_to_internal_enc(old); + if (new_buf==NULL) { free(old); return last; } + new_last=pos+strlen(new_buf)-1; + if (new_last>=buffsize) new_last=buffsize-1; + for (i=0;i<strlen(new_buf); i++) buff[pos+i]=new_buf[i]; + free(old); free(new_buf); + return new_last; +} + #endif /* !WIN32 */ |