git: f7d0c259cce5 - main - japanese/kterm: Resurrect kterm-6.2.0
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 07 Jan 2024 17:31:35 UTC
The branch main has been updated by hrs:
URL: https://cgit.FreeBSD.org/ports/commit/?id=f7d0c259cce55b0da69350975d6f896f030eaa6f
commit f7d0c259cce55b0da69350975d6f896f030eaa6f
Author: Hiroki Sato <hrs@FreeBSD.org>
AuthorDate: 2024-01-07 17:30:34 +0000
Commit: Hiroki Sato <hrs@FreeBSD.org>
CommitDate: 2024-01-07 17:30:34 +0000
japanese/kterm: Resurrect kterm-6.2.0
---
MOVED | 1 -
japanese/Makefile | 1 +
japanese/kterm/Makefile | 106 +++++++++++++++++++++++++++++
japanese/kterm/distinfo | 5 ++
japanese/kterm/files/dot.termcap | 4 ++
japanese/kterm/files/extra-patch-Tektronix | 11 +++
japanese/kterm/files/extra-patch-Xaw3d | 11 +++
japanese/kterm/files/extra-patch-neXtaw | 11 +++
japanese/kterm/files/patch-Imakefile | 37 ++++++++++
japanese/kterm/files/patch-KTerm.ad | 92 +++++++++++++++++++++++++
japanese/kterm/files/patch-VTPrsTbl.c | 11 +++
japanese/kterm/files/patch-VTparse.h | 7 ++
japanese/kterm/files/patch-charproc.c | 26 +++++++
japanese/kterm/files/patch-main.c | 91 +++++++++++++++++++++++++
japanese/kterm/files/patch-menu.c | 26 +++++++
japanese/kterm/files/patch-scrollbar.c | 26 +++++++
japanese/kterm/files/patch-util.c | 65 ++++++++++++++++++
japanese/kterm/pkg-descr | 9 +++
japanese/kterm/pkg-plist | 7 ++
19 files changed, 546 insertions(+), 1 deletion(-)
diff --git a/MOVED b/MOVED
index 9b21ea0ca2a6..5df38907494b 100644
--- a/MOVED
+++ b/MOVED
@@ -2299,7 +2299,6 @@ devel/rubygem-aws-sdk-s31122|devel/rubygem-aws-sdk-s3|2023-07-09|Remove obsolete
devel/rubygem-google-protobuf322|devel/rubygem-google-protobuf|2023-07-09|Remove obsoleted port. Use devel/rubygem-google-protobuf instead
devel/rubygem-grape15|devel/rubygem-grape|2023-07-09|Remove obsoleted port. Use devel/rubygem-grape instead
textproc/rubygem-nokogiri114|textproc/rubygem-nokogiri|2023-07-09|Remove obsoleted port. Use textproc/rubygem-nokogiri instead
-japanese/kterm||2023-07-12|Has expired: Last upstream release was in 2011
graphics/gmic-qt@krita|graphics/krita-gmic-plugin|2023-07-14|Forked to a seperate project
devel/capstone5|devel/capstone|2023-07-15|Keep the latest version without any pkgnamesufix
games/naev-data||2023-07-15|Remove obsoleted port. Now games/naev installs data files
diff --git a/japanese/Makefile b/japanese/Makefile
index 512c96098470..a9f5eb53099c 100644
--- a/japanese/Makefile
+++ b/japanese/Makefile
@@ -143,6 +143,7 @@
SUBDIR += kiten
SUBDIR += kon2-14dot
SUBDIR += kon2-16dot
+ SUBDIR += kterm
SUBDIR += latex-jlisting
SUBDIR += leafrogue
SUBDIR += less
diff --git a/japanese/kterm/Makefile b/japanese/kterm/Makefile
new file mode 100644
index 000000000000..f93f8f122bfa
--- /dev/null
+++ b/japanese/kterm/Makefile
@@ -0,0 +1,106 @@
+PORTNAME= kterm
+PORTVERSION= 6.2.0
+DISTVERSIONPREFIX= v
+DISTVERSIONSUFFIX= .fb6
+PORTREVISION= 17
+CATEGORIES= japanese x11
+MASTER_SITES= LOCAL/hrs:pcemu
+DISTFILES= pcemu1.01alpha.tar.gz:pcemu
+DIST_SUBDIR= ${PORTNAME}
+
+MAINTAINER= hrs@FreeBSD.org
+COMMENT= Xterm variant with Japanese support
+WWW= https://bogytech.blogspot.jp/search/label/kterm
+
+LICENSE= MIT
+
+USES= iconv imake xorg
+USE_GITHUB= yes
+GH_ACCOUNT= hrs-allbsd
+USE_XORG= ice sm x11 xaw xext xmu xpm xt
+
+CFLAGS+= -Wno-return-type
+
+PORTDOCS= README.kt README.wallpaper.ja dot.termcap
+
+OPTIONS_DEFINE= TEKTRONIXEMU VGAFONT DOCS
+OPTIONS_DEFAULT=DEFAULT
+OPTIONS_SINGLE= SCROLLBAR
+OPTIONS_SINGLE_SCROLLBAR= DEFAULT XAW3DLIB NEXTAWLIB
+OPTIONS_SUB= yes
+
+NEXTAWLIB_DESC= with neXtaw scrollbar
+TEKTRONIXEMU_DESC= Tektronix emulation
+VGAFONT_DESC= install VGA font
+XAW3DLIB_DESC= with Xaw3d scrollbar
+
+NEXTAWLIB_LIB_DEPENDS= libneXtaw.so:x11-toolkits/neXtaw
+VGAFONT_EXTRACT_DEPENDS= \
+ ${LOCALBASE}/bin/bdftopcf:x11-fonts/bdftopcf
+VGAFONT_BUILD_DEPENDS= \
+ ${LOCALBASE}/bin/mkfontscale:x11-fonts/mkfontscale
+VGAFONT_USES= fonts
+XAW3DLIB_LIB_DEPENDS= libXaw3d.so:x11-toolkits/Xaw3d
+
+.include <bsd.port.options.mk>
+
+.if ${OPSYS} == FreeBSD && ( ${OSVERSION} >= 1400079 || ( ${OSVERSION} >= 1302505 && ${OSVERSION} < 1400000 ))
+CFLAGS+= -Wno-error=int-conversion
+.endif
+
+post-extract-VGAFONT-on:
+ ${EXTRACT_CMD} ${EXTRACT_BEFORE_ARGS} \
+ ${DISTDIR}/${DIST_SUBDIR}/pcemu1.01alpha.tar.gz \
+ ${EXTRACT_AFTER_ARGS} -C ${WRKDIR} pcemu1.01alpha/vga.bdf
+ cd ${WRKDIR}/pcemu1.01alpha && \
+ ${LOCALBASE}/bin/bdftopcf vga.bdf | ${GZIP_CMD} > vga.pcf.gz
+
+post-extract-TEKTRONIXEMU-on:
+ echo "#undef KTERM_NOTEK" >> ${WRKSRC}/kterm.h
+post-extract-TEKTRONIXEMU-off:
+ echo "#undef KTERM_NOTEK" >> ${WRKSRC}/kterm.h
+ echo "#define KTERM_NOTEK" >> ${WRKSRC}/kterm.h
+
+post-extract-XAW3DLIB-on:
+ echo "#undef KTERM_XAW3D" >> ${WRKSRC}/kterm.h
+ echo "#undef USE_XAW3DLIB" >> ${WRKSRC}/kterm.h
+ echo "#define KTERM_XAW3D" >> ${WRKSRC}/kterm.h
+ echo "#define USE_XAW3DLIB" >> ${WRKSRC}/kterm.h
+post-extract-XAW3DLIB-off:
+ echo "#undef KTERM_XAW3D" >> ${WRKSRC}/kterm.h
+
+post-extract-NEXTAWLIB-on:
+ echo "#undef KTERM_XAW3D" >> ${WRKSRC}/kterm.h
+ echo "#undef USE_NEXTAWLIB" >> ${WRKSRC}/kterm.h
+ echo "#define KTERM_XAW3D" >> ${WRKSRC}/kterm.h
+ echo "#define USE_NEXTAWLIB" >> ${WRKSRC}/kterm.h
+post-extract-NEXTAWLIB-off:
+ echo "#undef KTERM_XAW3D" >> ${WRKSRC}/kterm.h
+
+post-extract:
+ ${ECHO_CMD} "#undef InstallXtermSetUID" >> ${WRKSRC}/kterm.h
+ ${ECHO_CMD} "#define InstallXtermSetUID 0" >> ${WRKSRC}/kterm.h
+
+post-build:
+ ${ICONV_CMD} -f iso-2022-jp -t utf-8 ${WRKSRC}/kterm.jman \
+ | ${GZIP_CMD} > ${WRKSRC}/kterm.1.gz
+pre-install:
+ ${MKDIR} ${STAGEDIR}${MANPREFIX}/man/ja.UTF-8/man1
+post-install:
+ ${INSTALL_MAN} ${WRKSRC}/kterm.1.gz \
+ ${STAGEDIR}${MANPREFIX}/man/ja.UTF-8/man1
+pre-install-DOCS-on:
+ ${MKDIR} ${STAGEDIR}${DOCSDIR}
+pre-install-VGAFONT-on:
+ ${MKDIR} ${STAGEDIR}${FONTSDIR}
+post-install-DOCS-on:
+ ${INSTALL_DATA} \
+ ${WRKSRC}/README.kt \
+ ${WRKSRC}/README.wallpaper.ja \
+ ${FILESDIR}/dot.termcap \
+ ${STAGEDIR}${DOCSDIR}
+post-install-VGAFONT-on:
+ ${INSTALL_DATA} ${WRKDIR}/pcemu1.01alpha/vga.pcf.gz \
+ ${STAGEDIR}${FONTSDIR}
+
+.include <bsd.port.mk>
diff --git a/japanese/kterm/distinfo b/japanese/kterm/distinfo
new file mode 100644
index 000000000000..6ee876300d38
--- /dev/null
+++ b/japanese/kterm/distinfo
@@ -0,0 +1,5 @@
+TIMESTAMP = 1487003137
+SHA256 (kterm/pcemu1.01alpha.tar.gz) = 0936d3e3b8b6ef36078b40983d10b66971206142ab489c096cc29e94b17852ea
+SIZE (kterm/pcemu1.01alpha.tar.gz) = 316257
+SHA256 (kterm/hrs-allbsd-kterm-v6.2.0.fb6_GH0.tar.gz) = 8ebde513d5d765b43c4a8ac44f8e4b8dc452871f661fd7311c20955cf124d487
+SIZE (kterm/hrs-allbsd-kterm-v6.2.0.fb6_GH0.tar.gz) = 276713
diff --git a/japanese/kterm/files/dot.termcap b/japanese/kterm/files/dot.termcap
new file mode 100644
index 000000000000..2d56ef5ab2dd
--- /dev/null
+++ b/japanese/kterm/files/dot.termcap
@@ -0,0 +1,4 @@
+ktermc|kanji terminal with 16 colors:\
+ :op=\E[m:pa#64:Co#8:AF=\E[3%dm:AB=\E[4%dm:\
+ :mb=\E[5m:md=\E[1m:mr=\E[7m:mh=\E[2m:me=\E[m:\
+ :tc=kterm:
diff --git a/japanese/kterm/files/extra-patch-Tektronix b/japanese/kterm/files/extra-patch-Tektronix
new file mode 100644
index 000000000000..46c4ddac0f70
--- /dev/null
+++ b/japanese/kterm/files/extra-patch-Tektronix
@@ -0,0 +1,11 @@
+--- ./kterm.h.orig Fri Jul 12 14:01:37 1996
++++ ./kterm.h Thu Aug 16 01:34:54 2001
+@@ -35,7 +35,7 @@
+ #define KTERM_XIM /* XIM protocol */
+ #define KTERM_KINPUT2 /* Kinput2 protocol */
+ #define KTERM_COLOR /* color sequence */
+-#define KTERM_NOTEK /* disables Tektronix emulation */
++#undef KTERM_NOTEK /* disables Tektronix emulation */
+ #undef KTERM_XAW3D /* Xaw3d -DARROW_SCROLLBAR support */
+
+ #endif /* !_KTERM_H_ */
diff --git a/japanese/kterm/files/extra-patch-Xaw3d b/japanese/kterm/files/extra-patch-Xaw3d
new file mode 100644
index 000000000000..ab1e0db5c5f9
--- /dev/null
+++ b/japanese/kterm/files/extra-patch-Xaw3d
@@ -0,0 +1,11 @@
+--- ./kterm.h.org Thu Jul 11 22:01:37 1996
++++ ./kterm.h Fri Nov 1 05:22:15 1996
+@@ -36,6 +36,7 @@
+ #define KTERM_KINPUT2 /* Kinput2 protocol */
+ #define KTERM_COLOR /* color sequence */
+ #define KTERM_NOTEK /* disables Tektronix emulation */
+-#undef KTERM_XAW3D /* Xaw3d -DARROW_SCROLLBAR support */
++#define KTERM_XAW3D /* Xaw3d -DARROW_SCROLLBAR support */
++#define USE_XAW3DLIB
+
+ #endif /* !_KTERM_H_ */
diff --git a/japanese/kterm/files/extra-patch-neXtaw b/japanese/kterm/files/extra-patch-neXtaw
new file mode 100644
index 000000000000..fae1ae770f29
--- /dev/null
+++ b/japanese/kterm/files/extra-patch-neXtaw
@@ -0,0 +1,11 @@
+--- ./kterm.h.org Thu Jul 11 22:01:37 1996
++++ ./kterm.h Fri Nov 1 05:22:15 1996
+@@ -36,6 +36,7 @@
+ #define KTERM_KINPUT2 /* Kinput2 protocol */
+ #define KTERM_COLOR /* color sequence */
+ #define KTERM_NOTEK /* disables Tektronix emulation */
+-#undef KTERM_XAW3D /* Xaw3d -DARROW_SCROLLBAR support */
++#define KTERM_XAW3D /* Xaw3d -DARROW_SCROLLBAR support */
++#define USE_NEXTAWLIB
+
+ #endif /* !_KTERM_H_ */
diff --git a/japanese/kterm/files/patch-Imakefile b/japanese/kterm/files/patch-Imakefile
new file mode 100644
index 000000000000..f12653a87eeb
--- /dev/null
+++ b/japanese/kterm/files/patch-Imakefile
@@ -0,0 +1,37 @@
+--- Imakefile.orig 2016-11-04 21:41:21 UTC
++++ Imakefile
+@@ -13,6 +13,16 @@ XCOMM $Id: Imakefile,v 6.3 1996/07/12 05:01:03 kagotan
+ XPOLL_DEF = -DNO_XPOLL_H
+ #endif
+
++#ifdef USE_XAW3DLIB
++#undef XawClientLibs
++#define XawClientLibs -lXaw3d $(XMULIB) $(XTOOLLIB) $(XLIB)
++#endif
++
++#ifdef USE_NEXTAWLIB
++#undef XawClientLibs
++#define XawClientLibs -lneXtaw $(XMULIB) $(XTOOLLIB) $(XLIB)
++#endif
++
+ /*
+ * add -DWTMP and -DLASTLOG if you want them.
+ */
+@@ -27,7 +37,7 @@ XCOMM $Id: Imakefile,v 6.3 1996/07/12 05:01:03 kagotan
+ OSMAJORVERSION = OSMajorVersion
+ OSMINORVERSION = OSMinorVersion
+
+- MAIN_DEFINES = -DUTMP $(TTYGROUPDEF) $(PUCCPTYDDEF) \
++ MAIN_DEFINES = $(TTYGROUPDEF) $(PUCCPTYDDEF) \
+ -DOSMAJORVERSION=$(OSMAJORVERSION) \
+ -DOSMINORVERSION=$(OSMINORVERSION)
+ MISC_DEFINES = /* -DALLOWLOGFILEEXEC */
+@@ -72,7 +82,7 @@ XCOMM $Id: Imakefile,v 6.3 1996/07/12 05:01:03 kagotan
+ #endif
+ #endif
+
+- TERMCAPLIB = TermcapLibrary
++ TERMCAPLIB = TermcapLibrary -lutil
+
+ AllTarget($(PROGRAMS))
+
diff --git a/japanese/kterm/files/patch-KTerm.ad b/japanese/kterm/files/patch-KTerm.ad
new file mode 100644
index 000000000000..94c638f11184
--- /dev/null
+++ b/japanese/kterm/files/patch-KTerm.ad
@@ -0,0 +1,92 @@
+--- KTerm.ad.orig 2016-11-04 21:41:21 UTC
++++ KTerm.ad
+@@ -52,37 +52,43 @@ KTerm.JoinSession:False
+
+ *fontMenu.Label: VT Fonts
+ *fontMenu*fontdefault*Label: Default
+-*VT100*fontList: -*-fixed-medium-r-normal--14-*,\
+- -*-gothic-medium-r-normal--14-*,\
+- -*-mincho-medium-r-normal--14-*
+-!*VT100*boldFontList: -*-fixed-bold-r-normal--14-*,\
+-! -*-gothic-bold-r-normal--14-*,\
+-! -*-mincho-bold-r-normal--14-*
++*VT100*fontList: -alias-fixed-medium-r-normal--14-*-*-*-c-*-*-*,\
++ -*-fixed-medium-r-normal--14-*-*-*-c-*-*-*,\
++ -*-gothic-medium-r-normal--14-*-*-*-c-*-*-*,\
++ -*-mincho-medium-r-normal--14-*-*-*-c-*-*-*
++!*VT100*boldFontList: -*-fixed-bold-r-normal--14-*-c-*,\
++! -*-gothic-bold-r-normal--14-*-c-*,\
++! -*-mincho-bold-r-normal--14-*-c-*
+ *fontMenu*font1*Label: Unreadable
+-*VT100*fontList1: -*-fixed-medium-r-normal--2-*,\
+- -*-gothic-medium-r-normal--2-*,\
+- -*-mincho-medium-r-normal--2-*
+-*VT100*font1: -misc-nil-medium-r-normal--2-*-misc-fontspecific
++*VT100*fontList1: -*-fixed-medium-r-normal--2-*-c-*,\
++ -*-gothic-medium-r-normal--2-*-c-*,\
++ -*-mincho-medium-r-normal--2-*-c-*
++*VT100*font1: -misc-nil-medium-r-normal--2-*-c-*-misc-fontspecific
+ *fontMenu*font2*Label: Tiny
+-*VT100*fontList2: -*-fixed-medium-r-normal--14-*,\
+- -*-gothic-medium-r-normal--14-*,\
+- -*-mincho-medium-r-normal--14-*
++*VT100*fontList2: -alias-fixed-medium-r-normal--8-*-*-*-c-*-*-*,\
++ -*-fixed-medium-r-normal--8-*-*-*-c-*-*-*,\
++ -*-gothic-medium-r-normal--8-*-*-*-c-*-*-*,\
++ -*-mincho-medium-r-normal--8-*-*-*-c-*-*-*
+ *fontMenu*font3*Label: Small
+-*VT100*fontList3: -*-fixed-medium-r-normal--16-*,\
+- -*-gothic-medium-r-normal--16-*,\
+- -*-mincho-medium-r-normal--16-*
++*VT100*fontList3: -alias-fixed-medium-r-normal--12-*-*-*-c-*-*-*,\
++ -*-fixed-medium-r-normal--12-*-*-*-c-*-*-*,\
++ -*-gothic-medium-r-normal--12-*-*-*-c-*-*-*,\
++ -*-mincho-medium-r-normal--12-*-*-*-c-*-*-*
+ *fontMenu*font4*Label: Medium
+-*VT100*fontList4: -*-fixed-medium-r-normal--18-*,\
+- -*-gothic-medium-r-normal--18-*,\
+- -*-mincho-medium-r-normal--18-*
++*VT100*fontList4: -alias-fixed-medium-r-normal--16-*-*-*-c-*-*-*,\
++ -*-fixed-medium-r-normal--16-*-*-*-c-*-*-*,\
++ -*-gothic-medium-r-normal--16-*-*-*-c-*-*-*,\
++ -*-mincho-medium-r-normal--16-*-*-*-c-*-*-*
+ *fontMenu*font5*Label: Large
+-*VT100*fontList5: -*-fixed-medium-r-normal--24-*,\
+- -*-gothic-medium-r-normal--24-*,\
+- -*-mincho-medium-r-normal--24-*
++*VT100*fontList5: -alias-fixed-medium-r-normal--20-*-*-*-c-*-*-*,\
++ -*-fixed-medium-r-normal--20-*-*-*-c-*-*-*,\
++ -*-gothic-medium-r-normal--20-*-*-*-c-*-*-*,\
++ -*-mincho-medium-r-normal--20-*-*-*-c-*-*-*
+ *fontMenu*font6*Label: Huge
+-*VT100*fontList6: -*-fixed-medium-r-normal--26-*,\
+- -*-gothic-medium-r-normal--26-*,\
+- -*-mincho-medium-r-normal--26-*
++*VT100*fontList6: -alias-fixed-medium-r-normal--24-*-*-*-c-*-*-*,\
++ -*-fixed-medium-r-normal--24-*-*-*-c-*-*-*,\
++ -*-gothic-medium-r-normal--24-*-*-*-c-*-*-*,\
++ -*-mincho-medium-r-normal--24-*-*-*-c-*-*-*
+ *fontMenu*fontescape*Label: Escape Sequence
+ *fontMenu*fontsel*Label: Selection
+ !fontescape and fontsel overridden by application
+@@ -132,5 +138,18 @@ KTerm.JoinSession:False
+ *tek4014*font3: 6x13
+ *tek4014*fontSmall: 6x10
+
+-*VT100*translations: #override Shift<Key>space: \
+- begin-conversion(_JAPANESE_CONVERSION)
++!This can be useful if you have an IntelliMouse. It maps the button
++!events generated by the wheel
++*VT100*Translations: #override \
++ !Ctrl <Btn4Down>: scroll-back(1,halfpage) \n\
++ !Lock Ctrl <Btn4Down>: scroll-back(1,halfpage) \n\
++ !Lock @Num_Lock Ctrl <Btn4Down>: scroll-back(1,halfpage) \n\
++ ! @Num_Lock Ctrl <Btn4Down>: scroll-back(1,halfpage) \n\
++ <Btn4Down>: scroll-back(5,line) \n\
++ !Ctrl <Btn5Down>: scroll-forw(1,halfpage) \n\
++ !Lock Ctrl <Btn5Down>: scroll-forw(1,halfpage) \n\
++ !Lock @Num_Lock Ctrl <Btn5Down>: scroll-forw(1,halfpage) \n\
++ ! @Num_Lock Ctrl <Btn5Down>: scroll-forw(1,halfpage) \n\
++ <Btn5Down>: scroll-forw(5,line)
++*VT100.translations: #override \
++ Shift<Key>space: begin-conversion(_JAPANESE_CONVERSION)
diff --git a/japanese/kterm/files/patch-VTPrsTbl.c b/japanese/kterm/files/patch-VTPrsTbl.c
new file mode 100644
index 000000000000..2c72f8dc42d5
--- /dev/null
+++ b/japanese/kterm/files/patch-VTPrsTbl.c
@@ -0,0 +1,11 @@
+--- VTPrsTbl.c.orig 2016-11-04 21:41:21 UTC
++++ VTPrsTbl.c
+@@ -490,7 +490,7 @@ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ /* X Y Z [ */
+-CASE_GROUND_STATE,
++CASE_ECH,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
diff --git a/japanese/kterm/files/patch-VTparse.h b/japanese/kterm/files/patch-VTparse.h
new file mode 100644
index 000000000000..43d8d4ee7340
--- /dev/null
+++ b/japanese/kterm/files/patch-VTparse.h
@@ -0,0 +1,7 @@
+--- VTparse.h.orig 2016-11-04 21:41:21 UTC
++++ VTparse.h
+@@ -118,3 +118,4 @@
+ #define CASE_SCS_STATE 77
+ #define CASE_GSET_VERSION_STATE 78
+ #define CASE_GSET_VERSION 79
++#define CASE_ECH 80
diff --git a/japanese/kterm/files/patch-charproc.c b/japanese/kterm/files/patch-charproc.c
new file mode 100644
index 000000000000..f2686d39232d
--- /dev/null
+++ b/japanese/kterm/files/patch-charproc.c
@@ -0,0 +1,26 @@
+--- charproc.c.orig 2016-11-04 21:41:21 UTC
++++ charproc.c
+@@ -103,8 +103,8 @@ extern jmp_buf VTend;
+ extern XtAppContext app_con;
+ extern Widget toplevel;
+ extern void exit();
+-extern char *malloc();
+-extern char *realloc();
++extern void *malloc();
++extern void *realloc();
+ extern fd_set Select_mask;
+ extern fd_set X_mask;
+ extern fd_set pty_mask;
+@@ -1974,6 +1974,12 @@ static void VTparse()
+ }
+ parsestate = groundtable;
+ break;
++
++ case CASE_ECH:
++ /* ECH */
++ ClearRightN(screen, param[0] < 1 ? 1 : param[0]);
++ parsestate = groundtable;
++ break;
+
+ case CASE_IL:
+ /* IL */
diff --git a/japanese/kterm/files/patch-main.c b/japanese/kterm/files/patch-main.c
new file mode 100644
index 000000000000..720d727b0c18
--- /dev/null
+++ b/japanese/kterm/files/patch-main.c
@@ -0,0 +1,91 @@
+--- main.c.orig 2016-11-04 21:41:21 UTC
++++ main.c
+@@ -211,7 +211,9 @@ static Bool IsPts = False;
+ #undef FIOCLEX
+ #undef FIONCLEX
+ #define setpgrp2 setpgrp
++#ifndef USE_POSIX_TERMIOS
+ #include <sgtty.h>
++#endif
+ #include <sys/resource.h>
+ #endif
+ #ifdef sco
+@@ -237,7 +239,7 @@ static Bool IsPts = False;
+ #define HAS_UTMP_UT_HOST
+ #endif
+ #else /* } !SYSV { */ /* BSD systems */
+-#ifndef linux
++#if !defined(linux) && !defined(USE_POSIX_TERMIOS)
+ #include <sgtty.h>
+ #endif
+ #include <sys/resource.h>
+@@ -294,7 +296,7 @@ extern Time_t time ();
+ #define ttyslot() 1
+ #endif /* apollo */
+
+-#ifdef SVR4
++#if defined(SVR4) || (defined(__FreeBSD__) && __FreeBSD_version >= 900007)
+ #include <utmpx.h>
+ #define setutent setutxent
+ #define getutent getutxent
+@@ -320,6 +322,10 @@ extern struct utmp *getutid __((struct utmp *_Id));
+ int Ptyfd;
+ #endif /* PUCC_PTYD */
+
++#ifdef __FreeBSD__
++#include <libutil.h> /* openpty() */
++#endif
++
+ #ifdef sequent
+ #define USE_GET_PSEUDOTTY
+ #endif
+@@ -1360,6 +1366,8 @@ char **argv;
+ d_tio.c_cc[VDISCARD] = CFLUSH;
+ d_tio.c_cc[VWERASE] = CWERASE;
+ d_tio.c_cc[VLNEXT] = CLNEXT;
++ d_tio.c_cc[VMIN] = 1;
++ d_tio.c_cc[VTIME] = 0;
+ #endif /* } */
+ #ifdef TIOCSLTC /* { */
+ d_ltc.t_suspc = CSUSP; /* t_suspc */
+@@ -1408,6 +1416,8 @@ char **argv;
+ d_tio.c_cc[VQUIT] = CQUIT; /* '^\' */
+ d_tio.c_cc[VEOF] = CEOF; /* '^D' */
+ d_tio.c_cc[VEOL] = CEOL; /* '^@' */
++ d_tio.c_cc[VMIN] = 1;
++ d_tio.c_cc[VTIME] = 0;
+ #ifdef VSWTCH
+ d_tio.c_cc[VSWTCH] = CSWTCH; /* usually '^Z' */
+ #endif
+@@ -1722,11 +1732,11 @@ char **argv;
+ case 'u': case 'U':
+ term->flags |= UTF8_KANJI;
+ update_utf8mode();
+- make_unicode_map();
+ break;
+ default:
+ break;
+ }
++ make_unicode_map();
+ }
+ #endif /* KTERM_KANJIMODE */
+
+@@ -1973,6 +1983,10 @@ char *name;
+ get_pty (pty)
+ int *pty;
+ {
++#if 1
++ int tty;
++ return (openpty(pty, &tty, ttydev, NULL, NULL));
++#else
+ #ifdef __osf__
+ int tty;
+ return (openpty(pty, &tty, ttydev, NULL, NULL));
+@@ -2076,6 +2090,7 @@ get_pty (pty)
+ #endif /* __sgi or umips else */
+ #endif /* USE_GET_PSEUDOTTY else */
+ #endif /* ATT else */
++#endif /* !0 */
+ }
+
+ /*
diff --git a/japanese/kterm/files/patch-menu.c b/japanese/kterm/files/patch-menu.c
new file mode 100644
index 000000000000..a04c3b8a9e93
--- /dev/null
+++ b/japanese/kterm/files/patch-menu.c
@@ -0,0 +1,26 @@
+--- menu.c.orig 2016-11-04 21:41:21 UTC
++++ menu.c
+@@ -843,6 +843,7 @@ static void do_jismode (gw, closure, data)
+ update_eucmode();
+ update_sjismode();
+ update_utf8mode();
++ make_unicode_map();
+ }
+
+
+@@ -867,6 +868,7 @@ static void do_eucmode (gw, closure, data)
+ update_eucmode();
+ update_sjismode();
+ update_utf8mode();
++ make_unicode_map();
+ }
+ }
+
+@@ -891,6 +893,7 @@ static void do_sjismode (gw, closure, data)
+ update_eucmode();
+ update_sjismode();
+ update_utf8mode();
++ make_unicode_map();
+ }
+ }
+
diff --git a/japanese/kterm/files/patch-scrollbar.c b/japanese/kterm/files/patch-scrollbar.c
new file mode 100644
index 000000000000..947a78548e30
--- /dev/null
+++ b/japanese/kterm/files/patch-scrollbar.c
@@ -0,0 +1,26 @@
+--- scrollbar.c.orig 2016-11-04 21:41:21 UTC
++++ scrollbar.c
+@@ -49,6 +49,7 @@ extern int BackgroundPixmapIsOn;
+ static void ScrollTextTo();
+ static void ScrollTextUpDownBy();
+
++extern Boolean SendMousePosition();
+
+ /* resize the text window for a terminal screen, modifying the
+ * appropriate WM_SIZE_HINTS and taking advantage of bit gravity.
+@@ -555,6 +556,7 @@ void HandleScrollForward (gw, event, params, nparams)
+ XtermWidget w = (XtermWidget) gw;
+ register TScreen *screen = &w->screen;
+
++ if (SendMousePosition(gw, event)) return;
+ ScrollTextUpDownBy (gw, (XtPointer) NULL,
+ (XtPointer)params_to_pixels (screen, params, (int) *nparams));
+ return;
+@@ -571,6 +573,7 @@ void HandleScrollBack (gw, event, params, nparams)
+ XtermWidget w = (XtermWidget) gw;
+ register TScreen *screen = &w->screen;
+
++ if (SendMousePosition(gw, event)) return;
+ ScrollTextUpDownBy (gw, (XtPointer) NULL,
+ (XtPointer)-params_to_pixels (screen, params, (int) *nparams));
+ return;
diff --git a/japanese/kterm/files/patch-util.c b/japanese/kterm/files/patch-util.c
new file mode 100644
index 000000000000..f0877f9d9c5d
--- /dev/null
+++ b/japanese/kterm/files/patch-util.c
@@ -0,0 +1,65 @@
+--- util.c.orig 2016-11-04 21:41:21 UTC
++++ util.c
+@@ -36,6 +36,7 @@
+
+ #include <stdio.h>
+
++static void ClearInLine(TScreen *screen, int row, int col, int len);
+ static void horizontal_copy_area();
+ static void vertical_copy_area();
+
+@@ -706,6 +707,54 @@ register TScreen *screen;
+ /*
+ * Clear last part of cursor's line, inclusive.
+ */
++ClearRightN (screen, n)
++register TScreen *screen;
++register int n;
++{
++ int i;
++ int len = (screen->max_col - screen->cur_col + 1);
++
++ if (n < 0) /* the remainder of the line */
++ n = screen->max_col + 1;
++ if (n == 0) /* default for 'ECH' */
++ n = 1;
++
++ if (len > n)
++ len = n;
++
++ ClearInLine(screen, screen->cur_row, screen->cur_col, len);
++}
++
++/*
++ * Clear the given row, for the given range of columns.
++ */
++static void
++ClearInLine(TScreen *screen, int row, int col, int len)
++{
++ if (col + len >= screen->max_col + 1) {
++ len = screen->max_col + 1 - col;
++ }
++
++ if (screen->cursor_state)
++ HideCursor();
++
++ screen->do_wrap = 0;
++
++ if (row - screen->topline <= screen->max_row) {
++ if (!AddToRefresh(screen)) {
++ if (screen->scroll_amt)
++ FlushScroll(screen);
++ XClearArea(screen->display,
++ VWindow(screen),
++ CursorX (screen, col),
++ CursorY (screen, row),
++ len * FontWidth(screen),
++ FontHeight(screen),
++ FALSE);
++ }
++ }
++}
++
+ ClearRight (screen)
+ register TScreen *screen;
+ {
diff --git a/japanese/kterm/pkg-descr b/japanese/kterm/pkg-descr
new file mode 100644
index 000000000000..bf35e4c93ee9
--- /dev/null
+++ b/japanese/kterm/pkg-descr
@@ -0,0 +1,9 @@
+Kterm is an xterm replacement with Japanese (Kanji) support. It also
+understands ANSI color sequences. This version is 6.2.0, available
+from the X11R6 contrib tape.
+
+This package includes the following additional patches:
+
+ - Xaw3d arrow-style scrollbars
+ - neXtaw NeXT-style scrollbars
+ - kterm background-wallpaper support
diff --git a/japanese/kterm/pkg-plist b/japanese/kterm/pkg-plist
new file mode 100644
index 000000000000..fc808fe8b33b
--- /dev/null
+++ b/japanese/kterm/pkg-plist
@@ -0,0 +1,7 @@
+@mode 4511
+bin/kterm
+@mode 0444
+man/ja.UTF-8/man1/kterm.1.gz
+man/man1/kterm.1.gz
+lib/X11/app-defaults/KTerm
+%%VGAFONT%%%%FONTSDIR%%/vga.pcf.gz