summaryrefslogtreecommitdiff
path: root/Build
diff options
context:
space:
mode:
authorTakuji Tanaka <ttk@t-lab.opal.ne.jp>2020-12-05 04:56:57 +0000
committerTakuji Tanaka <ttk@t-lab.opal.ne.jp>2020-12-05 04:56:57 +0000
commitfdfd72a0140c77f696caca8485d4ac50968f822c (patch)
tree94c6c47f8b3d0b0632eaa995caf0c69ad3f43400 /Build
parent1264a5c78919c58e6aab959da0c951d7921efac6 (diff)
kpathsea: Add win32_fprintf(), win32_perror() (Windows only)
git-svn-id: svn://tug.org/texlive/trunk@57072 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build')
-rw-r--r--Build/source/texk/kpathsea/ChangeLog5
-rw-r--r--Build/source/texk/kpathsea/knj.c55
-rw-r--r--Build/source/texk/kpathsea/knj.h6
3 files changed, 64 insertions, 2 deletions
diff --git a/Build/source/texk/kpathsea/ChangeLog b/Build/source/texk/kpathsea/ChangeLog
index 3ac05e0d20b..b784ee2a535 100644
--- a/Build/source/texk/kpathsea/ChangeLog
+++ b/Build/source/texk/kpathsea/ChangeLog
@@ -1,3 +1,8 @@
+2020-12-05 TANAKA Takuji <ttk@t-lab.opal.ne.jp>
+
+ * knj.[ch]: Add new functions win32_fprintf(), win32_perror().
+ (Windows only)
+
2020-10-24 Akira Kakuto <kakuto@w32tex.org>
* readable.c, knj.c: More than one adjacent directory
diff --git a/Build/source/texk/kpathsea/knj.c b/Build/source/texk/kpathsea/knj.c
index 32d5885e8ea..6aed564ed9f 100644
--- a/Build/source/texk/kpathsea/knj.c
+++ b/Build/source/texk/kpathsea/knj.c
@@ -1,7 +1,7 @@
/* knj.c: check for 2-Byte Kanji (CP 932, SJIS) codes.
Copyright 2010, 2016, 2018 Akira Kakuto.
- Copyright 2013, 2016 TANAKA Takuji.
+ Copyright 2013, 2016, 2020 TANAKA Takuji.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -558,6 +558,23 @@ kpathsea_win32_vfprintf(kpathsea kpse, FILE *fp, const char *format, va_list arg
}
int
+kpathsea_win32_fprintf(kpathsea kpse, FILE *fp, const char *format, ...)
+{
+ int ret, count;
+ va_list argp;
+
+ count = 0;
+ va_start(argp, format);
+ ret = kpathsea_win32_vfprintf(kpse, fp, format, argp);
+ if (ret==EOF) {
+ return EOF;
+ }
+ count += ret;
+ va_end(argp);
+ return count;
+}
+
+int
kpathsea_win32_puts(kpathsea kpse, const char *str)
{
if (kpathsea_win32_fputs(kpse, str, stdout)==EOF) {
@@ -613,6 +630,19 @@ kpathsea_win32_putc(kpathsea kpse, int c, FILE *fp)
return c;
}
+void
+kpathsea_win32_perror(kpathsea kpse, const char *str)
+{
+ wchar_t *wstr;
+
+ if (kpse->File_system_codepage != CP_UTF8)
+ return perror(str);
+
+ wstr = get_wstring_from_utf8(str, wstr=NULL);
+ _wperror(wstr);
+ free(wstr);
+}
+
int
kpathsea_IS_KANJI(kpathsea kpse, const char *p)
{
@@ -710,6 +740,23 @@ win32_vfprintf(FILE *fp, const char *format, va_list argp)
}
int
+win32_fprintf(FILE *fp, const char *format, ...)
+{
+ int ret, count;
+ va_list argp;
+
+ count = 0;
+ va_start(argp, format);
+ ret = kpathsea_win32_vfprintf(kpse_def, fp, format, argp);
+ if (ret==EOF) {
+ return EOF;
+ }
+ count += ret;
+ va_end(argp);
+ return count;
+}
+
+int
win32_puts(const char *str)
{
return kpathsea_win32_puts(kpse_def, str);
@@ -721,6 +768,12 @@ win32_putc(int c, FILE *fp)
return kpathsea_win32_putc(kpse_def, c, fp);
}
+void
+win32_perror(const char *str)
+{
+ kpathsea_win32_perror(kpse_def, str);
+}
+
int
IS_KANJI(const char *p)
{
diff --git a/Build/source/texk/kpathsea/knj.h b/Build/source/texk/kpathsea/knj.h
index d373a55408d..81e7944feb1 100644
--- a/Build/source/texk/kpathsea/knj.h
+++ b/Build/source/texk/kpathsea/knj.h
@@ -1,7 +1,7 @@
/* knj.h: check for 2-Byte Kanji (CP 932, SJIS) codes.
Copyright 2010, 2014, 2016 Akira Kakuto.
- Copyright 2013, 2014 TANAKA Takuji.
+ Copyright 2013, 2014, 2020 TANAKA Takuji.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -38,7 +38,9 @@ extern KPSEDLL int kpathsea_win32_ungetc(kpathsea kpse, int c, FILE *fp);
extern KPSEDLL int kpathsea_win32_fputs(kpathsea kpse, const char *str, FILE *fp);
extern KPSEDLL int kpathsea_win32_puts(kpathsea kpse, const char *str);
extern KPSEDLL int kpathsea_win32_vfprintf(kpathsea kpse, FILE *fp, const char *format, va_list argp);
+extern KPSEDLL int kpathsea_win32_fprintf(kpathsea kpse, FILE *fp, const char *format, ...);
extern KPSEDLL int kpathsea_win32_putc(kpathsea kpse, int c, FILE *fp);
+extern KPSEDLL void kpathsea_win32_perror(kpathsea kpse, const char *str);
extern KPSEDLL int kpathsea_IS_KANJI(kpathsea kpse, const char *p);
extern KPSEDLL char *kpathsea_get_fsyscp_from_wstring(kpathsea kpse, const wchar_t *w,char *mb);
extern KPSEDLL wchar_t *kpathsea_get_wstring_from_fsyscp(kpathsea kpse, const char *mb,wchar_t *w);
@@ -61,7 +63,9 @@ extern KPSEDLL int win32_ungetc(int c, FILE *fp);
extern KPSEDLL int win32_fputs(const char *str, FILE *fp);
extern KPSEDLL int win32_puts(const char *str);
extern KPSEDLL int win32_vfprintf(FILE *fp, const char *format, va_list argp);
+extern KPSEDLL int win32_fprintf(FILE *fp, const char *format, ...);
extern KPSEDLL int win32_putc(int c, FILE *fp);
+extern KPSEDLL void win32_perror(const char *str);
extern KPSEDLL int IS_KANJI(const char *p);
extern KPSEDLL char *get_fsyscp_from_wstring(const wchar_t *w,char *mb);
extern KPSEDLL wchar_t *get_wstring_from_fsyscp(const char *mb,wchar_t *w);