Sun Oct 18 03:58:31 2015 UTC ()
Update canna packages to 3.7pl3.

pkgsrc changes:
 - reorganize patch filenames for maintainability
  - patch-ac is also merged into existing patch-dic_phono_Imakefile
 - fix a missed 64 bit time_t issue in libRK
 - add a hook in cmd.tmpl to disable installation of cmd/forcpp and
   cmd/kpdic in canna-lib
 - tweak SUBDIRS patches in Makefiles to avoid unnecessary builds
   for each packages
 - pull various updates to canuum from the original FreeWnn's uum,
   including posix_openpt(3) support, and disable the default but
   obsolete libspt support
 - reorganize curses(3) ops in canuum per curses(3) documents
 - fix misc compiler warnings
 - take maintainership

Upstream changes:

 All changes are noted in ChangeLog and CHANGES.jp in distfile.
 I won't bother to quote ~1700 line ChangeLogs here,
 because this latest 3.7pl3 was released on 2004/05/20 and
 the previous 3.6pl4 was 2003/09/22.
 Highlight points are:
  - binary dictionary format is changed
  - shlib versions are bumped to 1.2 from 1.1
  - new APIs for wchar
  - experimental 64 bit architecture support
  - IPv6 support

Both server and clients (canuum and mule-1.1) are tested on
NetBSD/i386 7.0, NetBSD/amd64 7.0, and NetBSD/luna68k 7.0.
Also thanks to Nobuyoshi SATO, for his initial patch posted
to tech-pkg-ja@.


(tsutsui)
diff -r1.11 -r1.12 pkgsrc/inputmethod/canna/Makefile
diff -r1.11 -r1.12 pkgsrc/inputmethod/canna/distinfo
diff -r1.22 -r1.23 pkgsrc/inputmethod/canna/Makefile.common
diff -r1.14 -r1.15 pkgsrc/inputmethod/canna-canuum/Makefile
diff -r1.14 -r1.15 pkgsrc/inputmethod/canna-dict/Makefile
diff -r1.14 -r1.15 pkgsrc/inputmethod/canna-lib/Makefile
diff -r1.8 -r1.9 pkgsrc/inputmethod/canna-lib/PLIST
diff -r1.7 -r1.8 pkgsrc/inputmethod/canna-lib/buildlink3.mk
diff -r1.23 -r1.24 pkgsrc/inputmethod/canna-server/Makefile
diff -r1.8 -r1.9 pkgsrc/inputmethod/canna-server/PLIST
diff -r0 -r1.1 pkgsrc/inputmethod/canna/patches/patch-Canna.conf
diff -r0 -r1.1 pkgsrc/inputmethod/canna/patches/patch-Imakefile
diff -r0 -r1.1 pkgsrc/inputmethod/canna/patches/patch-canna_widedef.h
diff -r0 -r1.1 pkgsrc/inputmethod/canna/patches/patch-canuum_Imakefile
diff -r0 -r1.1 pkgsrc/inputmethod/canna/patches/patch-canuum_canna.c
diff -r0 -r1.1 pkgsrc/inputmethod/canna/patches/patch-canuum_config.h.in
diff -r0 -r1.1 pkgsrc/inputmethod/canna/patches/patch-canuum_configure
diff -r0 -r1.1 pkgsrc/inputmethod/canna/patches/patch-canuum_configure.in
diff -r0 -r1.1 pkgsrc/inputmethod/canna/patches/patch-canuum_jhlp.c
diff -r0 -r1.1 pkgsrc/inputmethod/canna/patches/patch-canuum_printf.c
diff -r0 -r1.1 pkgsrc/inputmethod/canna/patches/patch-canuum_termcap.c
diff -r0 -r1.1 pkgsrc/inputmethod/canna/patches/patch-canuum_termio.c
diff -r0 -r1.1 pkgsrc/inputmethod/canna/patches/patch-cmd_cmd.tmpl
diff -r0 -r1.1 pkgsrc/inputmethod/canna/patches/patch-lib_RKC_convert.c
diff -r0 -r1.1 pkgsrc/inputmethod/canna/patches/patch-lib_RK_dd.c
diff -r0 -r1.1 pkgsrc/inputmethod/canna/patches/patch-lib_RK_ncache.c
diff -r1.3 -r0 pkgsrc/inputmethod/canna/patches/patch-aa
diff -r1.1 -r0 pkgsrc/inputmethod/canna/patches/patch-ab
diff -r1.1 -r0 pkgsrc/inputmethod/canna/patches/patch-ad
diff -r1.1 -r0 pkgsrc/inputmethod/canna/patches/patch-ae
diff -r1.1 -r0 pkgsrc/inputmethod/canna/patches/patch-af
diff -r1.1 -r0 pkgsrc/inputmethod/canna/patches/patch-ag
diff -r1.1 -r0 pkgsrc/inputmethod/canna/patches/patch-ah
diff -r1.1 -r0 pkgsrc/inputmethod/canna/patches/patch-ai
diff -r1.1 -r0 pkgsrc/inputmethod/canna/patches/patch-aj
diff -r1.1 -r0 pkgsrc/inputmethod/canna/patches/patch-ak
diff -r1.1 -r0 pkgsrc/inputmethod/canna/patches/patch-al
diff -r1.1 -r0 pkgsrc/inputmethod/canna/patches/patch-am
diff -r1.1 -r0 pkgsrc/inputmethod/canna/patches/patch-ao
diff -r1.1 -r0 pkgsrc/inputmethod/canna/patches/patch-ap
diff -r1.2 -r0 pkgsrc/inputmethod/canna/patches/patch-ac
diff -r1.2 -r0 pkgsrc/inputmethod/canna/patches/patch-an
diff -r1.1 -r1.2 pkgsrc/inputmethod/canna/patches/patch-dic_phono_Imakefile

cvs diff -r1.11 -r1.12 pkgsrc/inputmethod/canna/Makefile (expand / switch to unified diff)

--- pkgsrc/inputmethod/canna/Makefile 2010/02/20 10:39:01 1.11
+++ pkgsrc/inputmethod/canna/Makefile 2015/10/18 03:58:31 1.12
@@ -1,15 +1,14 @@ @@ -1,15 +1,14 @@
1# $NetBSD: Makefile,v 1.11 2010/02/20 10:39:01 obache Exp $ 1# $NetBSD: Makefile,v 1.12 2015/10/18 03:58:31 tsutsui Exp $
2 2
3META_PACKAGE= yes 3META_PACKAGE= yes
4 4
5.include "Makefile.common" 5.include "Makefile.common"
6 6
7PKGNAME:= Canna-${CANNA_VERSION} 7PKGNAME:= Canna-${CANNA_VERSION}
8PKGREVISION= 2 
9 8
10DEPENDS+= Canna-server>=${CANNA_VERSION}nb2:../../inputmethod/canna-server 9DEPENDS+= Canna-server>=${CANNA_VERSION}:../../inputmethod/canna-server
11DEPENDS+= Canna-dict>=${CANNA_VERSION}nb1:../../inputmethod/canna-dict 10DEPENDS+= Canna-dict>=${CANNA_VERSION}:../../inputmethod/canna-dict
12 11
13CANNA_MODULE= meta-package 12CANNA_MODULE= meta-package
14 13
15.include "../../mk/bsd.pkg.mk" 14.include "../../mk/bsd.pkg.mk"

cvs diff -r1.11 -r1.12 pkgsrc/inputmethod/canna/distinfo (expand / switch to unified diff)

--- pkgsrc/inputmethod/canna/distinfo 2012/07/03 17:44:39 1.11
+++ pkgsrc/inputmethod/canna/distinfo 2015/10/18 03:58:31 1.12
@@ -1,22 +1,23 @@ @@ -1,22 +1,23 @@
1$NetBSD: distinfo,v 1.11 2012/07/03 17:44:39 joerg Exp $ 1$NetBSD: distinfo,v 1.12 2015/10/18 03:58:31 tsutsui Exp $
2 2
3SHA1 (Canna36p4.tar.gz) = 4edc22e2e4e5c6db42daa2083fabb53aa1ae8168 3SHA1 (Canna37p3.tar.bz2) = e39eece7c70c669dd46dd74b26121a60a2496fde
4RMD160 (Canna36p4.tar.gz) = 7f8bb7f5d87e6b939ff2b84edf58072c75a5d09d 4RMD160 (Canna37p3.tar.bz2) = 33e5eb9e2dc144835db838612897e652acbc60ed
5Size (Canna36p4.tar.gz) = 1455672 bytes 5SHA512 (Canna37p3.tar.bz2) = 82846f2393aa2654dd2c97a93178098b8bd11e5409b584447f1b6fdf303adacc9802e2293cafd98b68af8b69622625ed00aa9712bf270feaa119adfdf4211158
6SHA1 (patch-aa) = 6bb6da1cc2a458ebbcfe09fe19a371d7e8aea7da 6Size (Canna37p3.tar.bz2) = 1263065 bytes
7SHA1 (patch-ab) = b203ad0cb1285ffed0037e0eced3ae298bec5eb9 7SHA1 (patch-Canna.conf) = 81b46285a2b91c07b8497dc6669eb26552391a6c
8SHA1 (patch-ac) = a81a07db87d3b501dedd423e148a8e7e1d1804c4 8SHA1 (patch-Imakefile) = a70dee63ce9ce392b29b76df70479fee45e1a2b9
9SHA1 (patch-ad) = d4b5720c206f81124e0d53e71590de86f66c524c 9SHA1 (patch-canna_widedef.h) = c52cbbe5b55fc4fca6a501eef50fbf5bb878e514
10SHA1 (patch-ae) = 9e8de536052d76d8aeeab2d443dc42450ae53947 10SHA1 (patch-canuum_Imakefile) = 5f4e7970a92d514ec538e4591eaa4f46843654a3
11SHA1 (patch-af) = 2700fc8395895176c16562af66ea5bf0b13d4e10 11SHA1 (patch-canuum_canna.c) = a543a720fba9e2f770d6397d6b05352cfa58f300
12SHA1 (patch-ag) = cb435e54334ead8dba6a9ac9f14368d69d6e3a7c 12SHA1 (patch-canuum_config.h.in) = 98547954e459bd85e5b03fc86f34fb5d1e3eed4b
13SHA1 (patch-ah) = 5d2f01fa4810dafa7a83d02edaec36fc274173fe 13SHA1 (patch-canuum_configure) = c08efb73bb7d93d8c539873c1337be54ed864902
14SHA1 (patch-ai) = b44d683b2c1d489746f1174f8ae6d06ddca66a59 14SHA1 (patch-canuum_configure.in) = a1a6a821b9e9f9baef450ad340cb57a6f20a6989
15SHA1 (patch-aj) = 30d19c8ef9c1129e5214cb9a8a1d8b2b636b0361 15SHA1 (patch-canuum_jhlp.c) = 1d15186608f116cc4fb3e6a9691bb1b701d8b0ec
16SHA1 (patch-ak) = 18b408344b8b617142ced8804990e87b7ae27f56 16SHA1 (patch-canuum_printf.c) = c05ef114fae689855989d5d5eded2f734c62e12e
17SHA1 (patch-al) = f6025d6fb7a3247ef44b0a50ae13b67ef3dad2d9 17SHA1 (patch-canuum_termcap.c) = 958015b3bf4e9f89703e198c1ed28d51ae3f8c4e
18SHA1 (patch-am) = 756aed6fc81a9d75a55d123c8dc00c0932b8df7f 18SHA1 (patch-canuum_termio.c) = df9e68c8fb564ee4c4367acf6b042c253d17e525
19SHA1 (patch-an) = ef892b0837e7b3b5b569a7a9a518df2379c43f1c 19SHA1 (patch-cmd_cmd.tmpl) = f6ec97c273aa84eb84bdd24cbe16aaf7e696e041
20SHA1 (patch-ao) = c577319f50df6624333726cd62b48d869989d881 20SHA1 (patch-dic_phono_Imakefile) = 4e1210517317b57796cad5b350de41e1f0d8157d
21SHA1 (patch-ap) = 3f514037c4d67b2e18b27285370fe2ea84d977cc 21SHA1 (patch-lib_RKC_convert.c) = f196cfa3db3ef163c1869ca6bfd3f22170997aef
22SHA1 (patch-dic_phono_Imakefile) = 3192d7c6e38caf2e5e8378283d673df29c2dc430 22SHA1 (patch-lib_RK_dd.c) = 8055a2a3902e7d4d0cc1d782295c2879311750ec
 23SHA1 (patch-lib_RK_ncache.c) = f322d8b0c23e3b00b6d605ec2a044ac637a3cbfe

cvs diff -r1.22 -r1.23 pkgsrc/inputmethod/canna/Makefile.common (expand / switch to unified diff)

--- pkgsrc/inputmethod/canna/Makefile.common 2015/06/29 11:06:47 1.22
+++ pkgsrc/inputmethod/canna/Makefile.common 2015/10/18 03:58:31 1.23
@@ -1,31 +1,32 @@ @@ -1,31 +1,32 @@
1# $NetBSD: Makefile.common,v 1.22 2015/06/29 11:06:47 ryoon Exp $ 1# $NetBSD: Makefile.common,v 1.23 2015/10/18 03:58:31 tsutsui Exp $
2# 2#
3# Canna common makefile. 3# Canna common makefile.
4# 4#
5# used by inputmethod/canna-canuum/Makefile 5# used by inputmethod/canna-canuum/Makefile
6# used by inputmethod/canna-dict/Makefile 6# used by inputmethod/canna-dict/Makefile
7# used by inputmethod/canna-lib/Makefile 7# used by inputmethod/canna-lib/Makefile
8# used by inputmethod/canna-server/Makefile 8# used by inputmethod/canna-server/Makefile
9 9
10# "Pkgsrc" version. 10# "Pkgsrc" version.
11CANNA_VERSION= 3.6pl4 11CANNA_VERSION= 3.7pl3
12 12
13DISTNAME= Canna${CANNA_VERSION:S|.||:S|pl|p|} 13DISTNAME= Canna${CANNA_VERSION:S|.||:S|pl|p|}
14PKGNAME= Canna-${CANNA_MODULE}-${CANNA_VERSION} 14PKGNAME= Canna-${CANNA_MODULE}-${CANNA_VERSION}
15CATEGORIES= japanese inputmethod 15CATEGORIES= japanese inputmethod
16MASTER_SITES= ${MASTER_SITE_OSDN:=canna/6059/} 16MASTER_SITES= ${MASTER_SITE_OSDN:=canna/9565/}
 17EXTRACT_SUFX= .tar.bz2
17 18
18MAINTAINER= tech-pkg-ja@jp.NetBSD.org 19MAINTAINER= tsutsui@NetBSD.org
19HOMEPAGE= http://canna.osdn.jp/ 20HOMEPAGE= http://canna.osdn.jp/
20COMMENT= Kana-Kanji conversion system (${CANNA_MODULE}) 21COMMENT= Kana-Kanji conversion system (${CANNA_MODULE})
21 22
22FILESDIR= ${.CURDIR}/../../inputmethod/canna/files 23FILESDIR= ${.CURDIR}/../../inputmethod/canna/files
23DISTINFO_FILE= ${.CURDIR}/../../inputmethod/canna/distinfo 24DISTINFO_FILE= ${.CURDIR}/../../inputmethod/canna/distinfo
24PATCHDIR= ${.CURDIR}/../../inputmethod/canna/patches 25PATCHDIR= ${.CURDIR}/../../inputmethod/canna/patches
25 26
26USE_IMAKE= yes 27USE_IMAKE= yes
27CANNA_SPOOL= ${VARBASE}/spool/canna 28CANNA_SPOOL= ${VARBASE}/spool/canna
28CANNA_MODE= 0755 29CANNA_MODE= 0755
29 30
30PKG_GROUPS_VARS+= CANNA_GROUP 31PKG_GROUPS_VARS+= CANNA_GROUP
31PKG_USERS_VARS+= CANNA_USER 32PKG_USERS_VARS+= CANNA_USER

cvs diff -r1.14 -r1.15 pkgsrc/inputmethod/canna-canuum/Makefile (expand / switch to unified diff)

--- pkgsrc/inputmethod/canna-canuum/Makefile 2015/08/18 07:31:10 1.14
+++ pkgsrc/inputmethod/canna-canuum/Makefile 2015/10/18 03:58:31 1.15
@@ -1,31 +1,27 @@ @@ -1,31 +1,27 @@
1# $NetBSD: Makefile,v 1.14 2015/08/18 07:31:10 wiz Exp $ 1# $NetBSD: Makefile,v 1.15 2015/10/18 03:58:31 tsutsui Exp $
2 2
3PKGREVISION= 4 
4CANNA_MODULE= canuum 3CANNA_MODULE= canuum
5 4
6.include "../../inputmethod/canna/Makefile.common" 5.include "../../inputmethod/canna/Makefile.common"
7 6
8MAINTAINER= pkgsrc-users@NetBSD.org 7MAINTAINER= pkgsrc-users@NetBSD.org
9 8
10INSTALLATION_DIRS= ${PKGMANDIR}/ja_JP.EUC/man1 9INSTALLATION_DIRS= ${PKGMANDIR}/ja_JP.EUC/man1
11 10
12CONFIGURE_DIRS= . canuum 11CONFIGURE_DIRS= ${WRKSRC}/canuum
13BUILD_DIRS= canuum 
14 12
15INSTALL_MAKE_FLAGS+= INSTUGIDFLAGS= 13INSTALL_MAKE_FLAGS+= INSTUGIDFLAGS=
16 14
17SPECIAL_PERMS+= bin/canuum ${SETUID_ROOT_PERMS} 
18 
19.include "../../mk/curses.buildlink3.mk" 15.include "../../mk/curses.buildlink3.mk"
20SUBST_CLASSES+= fix_curs 16SUBST_CLASSES+= fix_curs
21SUBST_STAGE.fix_curs= post-patch 17SUBST_STAGE.fix_curs= post-patch
22SUBST_MESSAGE.fix_curs= Fixing curses 18SUBST_MESSAGE.fix_curs= Fixing curses
23SUBST_FILES.fix_curs+= canuum/Imakefile 19SUBST_FILES.fix_curs+= canuum/Imakefile
24SUBST_SED.fix_curs+= -e 's/TERMCAP_LIB = .*/TERMCAP_LIB = -l'${BUILDLINK_LIBNAME.curses}'/g' 20SUBST_SED.fix_curs+= -e 's/TERMCAP_LIB = .*/TERMCAP_LIB = -l'${BUILDLINK_LIBNAME.curses}'/g'
25 21
26.include "../../inputmethod/canna-lib/buildlink3.mk" 22.include "../../inputmethod/canna-lib/buildlink3.mk"
27 23
28pre-configure: 24pre-configure:
29 ${CP} ${PKGSRCDIR}/mk/gnu-config/config.guess ${WRKSRC}/canuum 25 ${CP} ${PKGSRCDIR}/mk/gnu-config/config.guess ${WRKSRC}/canuum
30 ${CP} ${PKGSRCDIR}/mk/gnu-config/config.sub ${WRKSRC}/canuum 26 ${CP} ${PKGSRCDIR}/mk/gnu-config/config.sub ${WRKSRC}/canuum
31 ${LN} -fs ${WRKSRC}/cannaconf.h ${WRKSRC}/canuum 27 ${LN} -fs ${WRKSRC}/cannaconf.h ${WRKSRC}/canuum

cvs diff -r1.14 -r1.15 pkgsrc/inputmethod/canna-dict/Makefile (expand / switch to unified diff)

--- pkgsrc/inputmethod/canna-dict/Makefile 2013/07/12 10:44:55 1.14
+++ pkgsrc/inputmethod/canna-dict/Makefile 2015/10/18 03:58:31 1.15
@@ -1,38 +1,39 @@ @@ -1,38 +1,39 @@
1# $NetBSD: Makefile,v 1.14 2013/07/12 10:44:55 jperkin Exp $ 1# $NetBSD: Makefile,v 1.15 2015/10/18 03:58:31 tsutsui Exp $
2 2
3PKGREVISION= 3 
4CANNA_MODULE= dict 3CANNA_MODULE= dict
5 4
6MAKE_JOBS_SAFE= no 5MAKE_JOBS_SAFE= no
7 6
8.include "../../inputmethod/canna/Makefile.common" 7.include "../../inputmethod/canna/Makefile.common"
9 8
10BUILD_DEPENDS+= Canna-server>=${CANNA_VERSION}:../../inputmethod/canna-server 9BUILD_DEPENDS+= Canna-server>=${CANNA_VERSION}:../../inputmethod/canna-server
11 10
12EVAL_PREFIX+= CANNASERVERBINDIR=Canna-server 11EVAL_PREFIX+= CANNASERVERBINDIR=Canna-server
13.for cmd in MERGE FORCPP FORSORT SPLITWORD MERGEWORD CRXGRAM CRXDIC CRFREQ KPDIC 12.for cmd in MERGE FORCPP FORSORT SPLITWORD MERGEWORD CRXGRAM CRXDIC CRFREQ KPDIC
14CANNA_CMD_SED_SCRIPT+= \ 13CANNA_CMD_SED_SCRIPT+= \
15 -e 's|\(${cmd} = \).*/\(.*\)|\1${CANNASERVERBINDIR}/bin/\2|' 14 -e 's|\(${cmd} = \).*/\(.*\)|\1${CANNASERVERBINDIR}/bin/\2|'
16.endfor 15.endfor
17 16
18CONFIGURE_DIRS= ${DICT_WRKSRC} 
19DICT_WRKSRC= ${WRKSRC}/dic/ideo 17DICT_WRKSRC= ${WRKSRC}/dic/ideo
20CANNA_DICTDIR= ${PREFIX}/libdata/canna 18CANNA_DICTDIR= ${PREFIX}/libdata/canna
21 19
22PKG_GROUPS= ${CANNA_GROUP} 20PKG_GROUPS= ${CANNA_GROUP}
23PKG_USERS= ${CANNA_USER}:${CANNA_GROUP} 21PKG_USERS= ${CANNA_USER}:${CANNA_GROUP}
24 22
25post-patch: 23post-patch:
 24 ${MV} ${WRKSRC}/Imakefile ${WRKSRC}/Imakefile.orig
 25 ${SED} -e 's|\(SUBDIRS = \).*|\1 canna lib/RKindep dic/ideo|' \
 26 ${WRKSRC}/Imakefile.orig > ${WRKSRC}/Imakefile
26 @${MV} ${WRKSRC}/Canna.conf ${WRKSRC}/Canna.conf.orig 27 @${MV} ${WRKSRC}/Canna.conf ${WRKSRC}/Canna.conf.orig
27 @${SED} -e 's|\(DicDir.*=\).*|\1${IMDICTDIR}/canna|' \ 28 @${SED} -e 's|\(DicDir.*=\).*|\1${IMDICTDIR}/canna|' \
28 ${WRKSRC}/Canna.conf.orig > ${WRKSRC}/Canna.conf 29 ${WRKSRC}/Canna.conf.orig > ${WRKSRC}/Canna.conf
29 @for file in `${FIND} ${DICT_WRKSRC} -name Imakefile -print`; do \ 30 @for file in `${FIND} ${DICT_WRKSRC} -name Imakefile -print`; do \
30 ${MV} $$file $$file.orig; \ 31 ${MV} $$file $$file.orig; \
31 ${SED} ${CANNA_CMD_SED_SCRIPT} $$file.orig > $$file; \ 32 ${SED} ${CANNA_CMD_SED_SCRIPT} $$file.orig > $$file; \
32 done 33 done
33 34
34INSTALLATION_DIRS+= ${CANNA_DICTDIR} 35INSTALLATION_DIRS+= ${CANNA_DICTDIR}
35 36
36do-install: 37do-install:
37 ${INSTALL_DATA} ${DICT_WRKSRC}/grammar/fuzokugo.cbd \ 38 ${INSTALL_DATA} ${DICT_WRKSRC}/grammar/fuzokugo.cbd \
38 ${DESTDIR}${CANNA_DICTDIR} 39 ${DESTDIR}${CANNA_DICTDIR}
@@ -62,14 +63,15 @@ do-install: @@ -62,14 +63,15 @@ do-install:
62 ${DESTDIR}${CANNA_DICTDIR}/number.ctd 63 ${DESTDIR}${CANNA_DICTDIR}/number.ctd
63 ${INSTALL_DATA} ${DICT_WRKSRC}/words/software.t \ 64 ${INSTALL_DATA} ${DICT_WRKSRC}/words/software.t \
64 ${DESTDIR}${CANNA_DICTDIR}/software.ctd 65 ${DESTDIR}${CANNA_DICTDIR}/software.ctd
65 ${INSTALL_DATA} ${DICT_WRKSRC}/words/suffix.t \ 66 ${INSTALL_DATA} ${DICT_WRKSRC}/words/suffix.t \
66 ${DESTDIR}${CANNA_DICTDIR}/suffix.ctd 67 ${DESTDIR}${CANNA_DICTDIR}/suffix.ctd
67 68
68REQD_DIRS_PERMS+= ${CANNA_DICTDIR} ${CANNA_USER} ${CANNA_GROUP} 0775 69REQD_DIRS_PERMS+= ${CANNA_DICTDIR} ${CANNA_USER} ${CANNA_GROUP} 0775
69.for d in fuzokugo.cbd bushu.cld dics.dir iroha.cbd iroha.cld \ 70.for d in fuzokugo.cbd bushu.cld dics.dir iroha.cbd iroha.cld \
70 chimei.ctd hojomwd.ctd hojoswd.ctd kanasmpl.ctd katakana.ctd \ 71 chimei.ctd hojomwd.ctd hojoswd.ctd kanasmpl.ctd katakana.ctd \
71 keishiki.ctd necgaiji.ctd number.ctd software.ctd suffix.ctd 72 keishiki.ctd necgaiji.ctd number.ctd software.ctd suffix.ctd
72SPECIAL_PERMS+= ${CANNA_DICTDIR}/${d} ${CANNA_USER} ${CANNA_GROUP} 0664 73SPECIAL_PERMS+= ${CANNA_DICTDIR}/${d} ${CANNA_USER} ${CANNA_GROUP} 0664
73.endfor 74.endfor
74 75
 76.include "../../inputmethod/canna-lib/buildlink3.mk"
75.include "../../mk/bsd.pkg.mk" 77.include "../../mk/bsd.pkg.mk"

cvs diff -r1.14 -r1.15 pkgsrc/inputmethod/canna-lib/Makefile (expand / switch to unified diff)

--- pkgsrc/inputmethod/canna-lib/Makefile 2012/10/06 14:25:10 1.14
+++ pkgsrc/inputmethod/canna-lib/Makefile 2015/10/18 03:58:31 1.15
@@ -1,30 +1,29 @@ @@ -1,30 +1,29 @@
1# $NetBSD: Makefile,v 1.14 2012/10/06 14:25:10 asau Exp $ 1# $NetBSD: Makefile,v 1.15 2015/10/18 03:58:31 tsutsui Exp $
2 2
3PKGREVISION= 3 
4CANNA_MODULE= lib 3CANNA_MODULE= lib
5 4
6.include "../../inputmethod/canna/Makefile.common" 5.include "../../inputmethod/canna/Makefile.common"
7 6
8# (1) Change SUBDIRS. 7# (1) Change SUBDIRS.
9# (2) Don't install `forcpp', `kpdic'. 8# (2) Don't install `forcpp', `kpdic'.
10# 9#
11post-patch: 10post-patch:
12 @${MV} ${WRKSRC}/Imakefile ${WRKSRC}/Imakefile.orig 11 @${MV} ${WRKSRC}/Imakefile ${WRKSRC}/Imakefile.orig
13 @${SED} -e 's|\(SUBDIRS = lib canna\).*\( misc\)|\1 cmd/forcpp cmd/kpdic dic/phono\2|' \ 12 @${SED} -e 's|\(SUBDIRS = lib canna\).*\( misc\)|\1 cmd/forcpp cmd/kpdic dic/phono\2|' \
14 -e 's|\(SGSDIR = \).*|\1 lib canna dic/phono misc doc|' \ 13 -e 's|\(SGSDIR = \).*|\1 lib canna dic/phono misc doc|' \
15 ${WRKSRC}/Imakefile.orig > ${WRKSRC}/Imakefile 14 ${WRKSRC}/Imakefile.orig > ${WRKSRC}/Imakefile
16.for f in forcpp kpdic 15.for f in forcpp kpdic
17 @${MV} ${WRKSRC}/cmd/${f}/Imakefile ${WRKSRC}/cmd/${f}/Imakefile.orig 16 @${MV} ${WRKSRC}/cmd/${f}/Imakefile ${WRKSRC}/cmd/${f}/Imakefile.orig
18 @${SED} -e '/InstallProgram/d' ${WRKSRC}/cmd/${f}/Imakefile.orig \ 17 @${SED} -e '/^#define TargetName/a\${.newline}#define DontInstallProgram' ${WRKSRC}/cmd/${f}/Imakefile.orig \
19 > ${WRKSRC}/cmd/${f}/Imakefile 18 > ${WRKSRC}/cmd/${f}/Imakefile
20.endfor 19.endfor
21 20
22MAKE_ENV+= AWK=${AWK:Q} 21MAKE_ENV+= AWK=${AWK:Q}
23 22
24post-extract: 23post-extract:
25 ${CP} ${FILESDIR}/dic-phono-filter.awk ${WRKSRC}/dic/phono/ 24 ${CP} ${FILESDIR}/dic-phono-filter.awk ${WRKSRC}/dic/phono/
26 25
27post-configure: 26post-configure:
28 @${LN} -s ${WRKSRC}/server/*.h ${WRKSRC}/include 27 @${LN} -s ${WRKSRC}/server/*.h ${WRKSRC}/include
29 28
30.include "../../mk/bsd.pkg.mk" 29.include "../../mk/bsd.pkg.mk"

cvs diff -r1.8 -r1.9 pkgsrc/inputmethod/canna-lib/PLIST (expand / switch to unified diff)

--- pkgsrc/inputmethod/canna-lib/PLIST 2009/06/14 18:01:29 1.8
+++ pkgsrc/inputmethod/canna-lib/PLIST 2015/10/18 03:58:31 1.9
@@ -1,34 +1,36 @@ @@ -1,34 +1,36 @@
1@comment $NetBSD: PLIST,v 1.8 2009/06/14 18:01:29 joerg Exp $ 1@comment $NetBSD: PLIST,v 1.9 2015/10/18 03:58:31 tsutsui Exp $
2include/canna/RK.h 2include/canna/RK.h
3include/canna/jrkanji.h 3include/canna/jrkanji.h
4include/canna/keydef.h 4include/canna/keydef.h
5include/canna/mfdef.h 5include/canna/mfdef.h
 6include/canna/pubconf.h
 7include/canna/sysdep.h
6lib/libRKC.a 8lib/libRKC.a
7lib/libRKC.so 9lib/libRKC.so
8lib/libRKC.so.1 10lib/libRKC.so.1
9lib/libRKC.so.1.1 11lib/libRKC.so.1.2
10lib/libRKC16.a 12lib/libRKC16.a
11lib/libRKC16.so 13lib/libRKC16.so
12lib/libRKC16.so.1 14lib/libRKC16.so.1
13lib/libRKC16.so.1.1 15lib/libRKC16.so.1.2
14lib/libcanna.a 16lib/libcanna.a
15lib/libcanna.so 17lib/libcanna.so
16lib/libcanna.so.1 18lib/libcanna.so.1
17lib/libcanna.so.1.1 19lib/libcanna.so.1.2
18lib/libcanna16.a 20lib/libcanna16.a
19lib/libcanna16.so 21lib/libcanna16.so
20lib/libcanna16.so.1 22lib/libcanna16.so.1
21lib/libcanna16.so.1.1 23lib/libcanna16.so.1.2
22man/ja_JP.EUC/man3/RkBgnBun.3 24man/ja_JP.EUC/man3/RkBgnBun.3
23man/ja_JP.EUC/man3/RkCloseRoma.3 25man/ja_JP.EUC/man3/RkCloseRoma.3
24man/ja_JP.EUC/man3/RkCvtEuc.3 26man/ja_JP.EUC/man3/RkCvtEuc.3
25man/ja_JP.EUC/man3/RkCvtHan.3 27man/ja_JP.EUC/man3/RkCvtHan.3
26man/ja_JP.EUC/man3/RkCvtHira.3 28man/ja_JP.EUC/man3/RkCvtHira.3
27man/ja_JP.EUC/man3/RkCvtKana.3 29man/ja_JP.EUC/man3/RkCvtKana.3
28man/ja_JP.EUC/man3/RkCvtRoma.3 30man/ja_JP.EUC/man3/RkCvtRoma.3
29man/ja_JP.EUC/man3/RkCvtZen.3 31man/ja_JP.EUC/man3/RkCvtZen.3
30man/ja_JP.EUC/man3/RkDefineDic.3 32man/ja_JP.EUC/man3/RkDefineDic.3
31man/ja_JP.EUC/man3/RkDeleteDic.3 33man/ja_JP.EUC/man3/RkDeleteDic.3
32man/ja_JP.EUC/man3/RkEndBun.3 34man/ja_JP.EUC/man3/RkEndBun.3
33man/ja_JP.EUC/man3/RkEnlarge.3 35man/ja_JP.EUC/man3/RkEnlarge.3
34man/ja_JP.EUC/man3/RkFinalize.3 36man/ja_JP.EUC/man3/RkFinalize.3

cvs diff -r1.7 -r1.8 pkgsrc/inputmethod/canna-lib/buildlink3.mk (expand / switch to unified diff)

--- pkgsrc/inputmethod/canna-lib/buildlink3.mk 2009/03/20 19:24:46 1.7
+++ pkgsrc/inputmethod/canna-lib/buildlink3.mk 2015/10/18 03:58:31 1.8
@@ -1,12 +1,12 @@ @@ -1,12 +1,12 @@
1# $NetBSD: buildlink3.mk,v 1.7 2009/03/20 19:24:46 joerg Exp $ 1# $NetBSD: buildlink3.mk,v 1.8 2015/10/18 03:58:31 tsutsui Exp $
2 2
3BUILDLINK_TREE+= Canna-lib 3BUILDLINK_TREE+= Canna-lib
4 4
5.if !defined(CANNA_LIB_BUILDLINK3_MK) 5.if !defined(CANNA_LIB_BUILDLINK3_MK)
6CANNA_LIB_BUILDLINK3_MK:= 6CANNA_LIB_BUILDLINK3_MK:=
7 7
8BUILDLINK_API_DEPENDS.Canna-lib+= Canna-lib>=3.6pl4 8BUILDLINK_API_DEPENDS.Canna-lib+= Canna-lib>=3.7pl3
9BUILDLINK_PKGSRCDIR.Canna-lib?= ../../inputmethod/canna-lib 9BUILDLINK_PKGSRCDIR.Canna-lib?= ../../inputmethod/canna-lib
10.endif # CANNA_LIB_BUILDLINK3_MK 10.endif # CANNA_LIB_BUILDLINK3_MK
11 11
12BUILDLINK_TREE+= -Canna-lib 12BUILDLINK_TREE+= -Canna-lib

cvs diff -r1.23 -r1.24 pkgsrc/inputmethod/canna-server/Makefile (expand / switch to unified diff)

--- pkgsrc/inputmethod/canna-server/Makefile 2013/07/12 10:44:55 1.23
+++ pkgsrc/inputmethod/canna-server/Makefile 2015/10/18 03:58:31 1.24
@@ -1,37 +1,36 @@ @@ -1,37 +1,36 @@
1# $NetBSD: Makefile,v 1.23 2013/07/12 10:44:55 jperkin Exp $ 1# $NetBSD: Makefile,v 1.24 2015/10/18 03:58:31 tsutsui Exp $
2 2
3PKGREVISION= 5 
4CANNA_MODULE= server 3CANNA_MODULE= server
5 4
6.include "../../inputmethod/canna/Makefile.common" 5.include "../../inputmethod/canna/Makefile.common"
7 6
8PKG_DESTDIR_SUPPORT= destdir 7PKG_DESTDIR_SUPPORT= destdir
9 8
10INSTALL_TARGET= instserver 9INSTALL_TARGET= instserver
11 10
12MESSAGE_SUBST+= CANNA_USER=${CANNA_USER} 11MESSAGE_SUBST+= CANNA_USER=${CANNA_USER}
13MESSAGE_SUBST+= CANNA_GROUP=${CANNA_GROUP} 12MESSAGE_SUBST+= CANNA_GROUP=${CANNA_GROUP}
14 13
15PKG_GROUPS= ${CANNA_GROUP} 14PKG_GROUPS= ${CANNA_GROUP}
16PKG_USERS= ${CANNA_USER}:${CANNA_GROUP} 15PKG_USERS= ${CANNA_USER}:${CANNA_GROUP}
17 16
18MAKE_DIRS+= ${IMDICTDIR} 17MAKE_DIRS+= ${IMDICTDIR}
19OWN_DIRS+= ${IMDICTDIR}/canna 18OWN_DIRS+= ${IMDICTDIR}/canna
20OWN_DIRS+= ${IMDICTDIR}/canna/canna 19OWN_DIRS+= ${IMDICTDIR}/canna/canna
21OWN_DIRS_PERMS+= ${CANNA_SPOOL} \ 20OWN_DIRS_PERMS+= ${CANNA_SPOOL} \
22 ${CANNA_USER} ${CANNA_GROUP} ${CANNA_MODE} 21 ${CANNA_USER} ${CANNA_GROUP} ${CANNA_MODE}
23 22
24RCD_SCRIPTS= canna 23RCD_SCRIPTS= canna
25 24
26.include "../../inputmethod/canna-lib/buildlink3.mk" 25.include "../../inputmethod/canna-lib/buildlink3.mk"
27 26
28post-patch: 27post-patch:
29 ${MV} ${WRKSRC}/Imakefile ${WRKSRC}/Imakefile.orig 28 ${MV} ${WRKSRC}/Imakefile ${WRKSRC}/Imakefile.orig
30 ${SED} -e 's|\(SUBDIRS = \).*|\1 canna lib server cmd doc|' \ 29 ${SED} -e 's|\(SUBDIRS = \).*|\1 canna lib/RK lib/RKindep server cmd doc|' \
31 -e 's|\(SERVERDIR = \).*|\1 server cmd doc|' \ 30 -e 's|\(SERVERDIR = \).*|\1 server cmd doc|' \
32 ${WRKSRC}/Imakefile.orig > ${WRKSRC}/Imakefile 31 ${WRKSRC}/Imakefile.orig > ${WRKSRC}/Imakefile
33 ${MV} ${WRKSRC}/Canna.conf ${WRKSRC}/Canna.conf.orig 32 ${MV} ${WRKSRC}/Canna.conf ${WRKSRC}/Canna.conf.orig
34 ${SED} -e 's|\(DicDir.*=\).*|\1${IMDICTDIR}/canna|' \ 33 ${SED} -e 's|\(DicDir.*=\).*|\1${IMDICTDIR}/canna|' \
35 ${WRKSRC}/Canna.conf.orig > ${WRKSRC}/Canna.conf 34 ${WRKSRC}/Canna.conf.orig > ${WRKSRC}/Canna.conf
36 35
37.include "../../mk/bsd.pkg.mk" 36.include "../../mk/bsd.pkg.mk"

cvs diff -r1.8 -r1.9 pkgsrc/inputmethod/canna-server/PLIST (expand / switch to unified diff)

--- pkgsrc/inputmethod/canna-server/PLIST 2014/03/11 14:05:02 1.8
+++ pkgsrc/inputmethod/canna-server/PLIST 2015/10/18 03:58:31 1.9
@@ -1,19 +1,20 @@ @@ -1,19 +1,20 @@
1@comment $NetBSD: PLIST,v 1.8 2014/03/11 14:05:02 jperkin Exp $ 1@comment $NetBSD: PLIST,v 1.9 2015/10/18 03:58:31 tsutsui Exp $
2bin/addwords 2bin/addwords
3bin/canlisp 3bin/canlisp
4bin/cannacheck 4bin/cannacheck
5bin/cannastat 5bin/cannastat
6bin/catdic 6bin/catdic
 7bin/chkconc
7bin/chmoddic 8bin/chmoddic
8bin/cpdic 9bin/cpdic
9bin/crfreq 10bin/crfreq
10bin/crxdic 11bin/crxdic
11bin/crxgram 12bin/crxgram
12bin/cshost 13bin/cshost
13bin/ctow 14bin/ctow
14bin/delwords 15bin/delwords
15bin/dicar 16bin/dicar
16bin/dpbindic 17bin/dpbindic
17bin/dpromdic 18bin/dpromdic
18bin/dpxdic 19bin/dpxdic
19bin/forcpp 20bin/forcpp

File Added: pkgsrc/inputmethod/canna/patches/patch-Canna.conf
$NetBSD: patch-Canna.conf,v 1.1 2015/10/18 03:58:31 tsutsui Exp $

- Handle pkgsrc environments
- Enable IPv6 support
- Fix shlib options

--- Canna.conf.orig	2004-05-19 15:48:47.000000000 +0000
+++ Canna.conf
@@ -109,12 +109,12 @@
 # define DefErrDir $(cannaPrefix)/log
 # define DefLibCannaDir $(cannaExecPrefix)/lib
 #else 
-# define DefCannaPrefix /usr/local/canna
+# define DefCannaPrefix ${PREFIX}
 # ifdef ObsoleteInstallDir
 #  define DefErrDir /usr/spool/canna
 #  define DefLibCannaDir /usr/lib
 # else
-#  define DefErrDir /var/log
+#  define DefErrDir ${CANNA_SPOOL}
 #  define DefLibCannaDir $(cannaExecPrefix)/lib
 # endif
 #endif
@@ -148,7 +148,7 @@ XCOMM cannaLibDir = /var/lib/canna
 XCOMM cannaLibDir = /var/db/canna
 cannaLibDir = DefCannaLibDir
 XCOMM cannaManDir = $(cannaPrefix)/share/man
-cannaManDir = $(cannaPrefix)/man
+cannaManDir = $(cannaPrefix)/$(PKGMANDIR)
 cannaIncDir = $(cannaPrefix)/include/canna
 
 libCannaDir = DefLibCannaDir
@@ -158,7 +158,7 @@ ErrDir  = DefErrDir
 #define SupportOldWchar 1
 
 /* IPv6を用いる場合は1と定義してください */
-#define UseInet6 0 /* requires newer IPv6 implementation */
+#define UseInet6 1 /* requires newer IPv6 implementation */
 
 /* 3.2系から3.6系までの形式の辞書を作る場合はこれを定義してください */
 /* #define DIC_3_6_COMPAT */
@@ -169,8 +169,8 @@ ErrDir  = DefErrDir
 #define ModernElfLink NO /* experimental */
 
 
-cannaOwner = bin
-cannaGroup = bin
+cannaOwner = ${CANNA_USER}
+cannaGroup = ${CANNA_GROUP}
 
 #ifdef InstallAsUser
 cannaOwnerGroup =
@@ -235,7 +235,7 @@ cannaLight = 1
  * コマンド類をリンクする時は、次を YES にしてくだい。
  */
 /* #define UseInstalledLibCanna YES */
-#define UseInstalledLibCanna NO
+#define UseInstalledLibCanna YES
 
 DicDir   = $(cannaLibDir)/dic
 
@@ -279,9 +279,9 @@ DicDir   = $(cannaLibDir)/dic
 
 #if UseInstalledLibCanna
 DEPCANNALIB = $(libCannaDir)/CannaDepLibraryName(canna)
-CANNALIB = -L$(libCannaDir) -lcanna $(DLLIB)
+CANNALIB = -Wl,-rpath,$(libCannaDir) -L$(libCannaDir) -lcanna $(DLLIB)
 DEPCANNALIB16 = $(libCannaDir)/CannaDepLibraryName(canna16)
-CANNALIB16 = -L$(libCannaDir) -lcanna16 $(DLLIB)
+CANNALIB16 = -Wl,-rpath,$(libCannaDir) -L$(libCannaDir) -lcanna16 $(DLLIB)
 #else
 DEPCANNALIB = $(CANNASRC)/CannaDepLibraryName(canna)
 CANNALIB = -L$(CANNASRC) -lcanna $(DLLIB)
@@ -330,7 +330,7 @@ UILIB_DEFINES = $(cannaDsoRevDef) $(CANN
 SCRIPTS_DEFINES = $(CANNA_DEFINES)
 
 #ifdef JAPANESEMAN
-JMNLOCALE = ja
+JMNLOCALE = ja_JP.EUC
 #endif
 
 /* USE_OBSOLETE_STYLE_FILENAME を定義するための定義 */

File Added: pkgsrc/inputmethod/canna/patches/patch-Imakefile
$NetBSD: patch-Imakefile,v 1.1 2015/10/18 03:58:31 tsutsui Exp $

Explicitly install man pages.

--- Imakefile.orig	2004-05-19 15:39:22.000000000 +0000
+++ Imakefile
@@ -166,7 +166,7 @@ instserver::
 	for i in $(SERVERDIR) ;\
 	do \
 		(cd $$i ; echo "installing" "in $(CURRENT_DIR)/$$i..."; \
-		$(MAKE) $(MFLAGS) DESTDIR='$(DESTDIR)' install); \
+		$(MAKE) $(MFLAGS) DESTDIR='$(DESTDIR)' install install.man); \
 	done
 
 instclient::
@@ -174,7 +174,7 @@ instclient::
 	for i in $(CLIENTDIR) ;\
 	do \
 		(cd $$i ; echo "installing" "in $(CURRENT_DIR)/$$i..."; \
-		$(MAKE) $(MFLAGS) DESTDIR='$(DESTDIR)' install); \
+		$(MAKE) $(MFLAGS) DESTDIR='$(DESTDIR)' install install.man); \
 	done
 
 instsgs::

File Added: pkgsrc/inputmethod/canna/patches/patch-canna_widedef.h
$NetBSD: patch-canna_widedef.h,v 1.1 2015/10/18 03:58:31 tsutsui Exp $

DragonFly wchar_t support.

--- canna/widedef.h.orig	2003-12-27 17:15:20.000000000 +0000
+++ canna/widedef.h
@@ -36,7 +36,10 @@
 # include <machine/ansi.h>
 #endif
 
-#if (defined(__FreeBSD__) && __FreeBSD_version < 500000) \
+#if defined(__DragonFly__)
+# include <wchar.h>
+# define _WCHAR_T
+#elif (defined(__FreeBSD__) && __FreeBSD_version < 500000) \
     || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__APPLE__)
 # ifdef _BSD_WCHAR_T_
 #  undef _BSD_WCHAR_T_

File Added: pkgsrc/inputmethod/canna/patches/patch-canuum_Imakefile
$NetBSD: patch-canuum_Imakefile,v 1.1 2015/10/18 03:58:31 tsutsui Exp $

Disable obsolete libspt because posix_openpt(3) or openpty(3) is enough for us.

--- canuum/Imakefile.orig	2004-05-19 15:39:22.000000000 +0000
+++ canuum/Imakefile
@@ -17,9 +17,15 @@ TERMCAP_LIB = -ltermcap
 INSTUGIDFLAGS = 
      CANNASRC = $(CANNAROOT)/lib/canna16
       DEFINES = -DCANNA -DJAPANESE $(SIGNAL_DEFINES) -DHAVE_CONFIG_H \
-		-DCONFIG_TERMINFO -DUSE_LIBSPT
-     INCLUDES = -I$(CANNAROOT)/include -I. `libspt-config --cflags`
-SYS_LIBRARIES = $(TERMCAP_LIB) `libspt-config --libs`
+		-DCONFIG_TERMINFO
+     INCLUDES = -I$(CANNAROOT)/include -I.
+SYS_LIBRARIES = $(TERMCAP_LIB)
+
+XCOMM XXX required only for openpty(3)
+#if (defined(LinuxArchitecture) && \
+     (LinuxCLibMajorVersion == 6) && (LinuxCLibMinorVersion < 1))
+SYS_LIBRARIES += -lutil  
+#endif
 
          SRCS = header.c printf.c termio.c termcap.c \
 		screen.c cursor.c jhlp.c xutoj.c canna.c

File Added: pkgsrc/inputmethod/canna/patches/patch-canuum_canna.c
$NetBSD: patch-canuum_canna.c,v 1.1 2015/10/18 03:58:31 tsutsui Exp $

- Appease prototype warnings.
- Remove unnecessary ops.

--- canuum/canna.c.orig	2003-09-17 08:50:52.000000000 +0000
+++ canuum/canna.c
@@ -52,4 +52,16 @@ static char rcsid[] = "$Id: canna.c,v 1.
 #endif
 
+#ifdef HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
+#if STDC_HEADERS
+#  include <string.h>
+#else
+#  if HAVE_STRINGS_H
+#    include <strings.h>
+#  endif
+#endif /* STDC_HEADERS */
+
 #include "commonhd.h"
 #include "sdefine.h"
@@ -95,6 +107,4 @@ static char rcsid[] = "$Id: canna.c,v 1.
 #define NOREDRAW      0
 
-extern	int	errno;
-
 static int maxmodelen;
 static int maxwidth = 0;
@@ -1239,8 +1249,6 @@ int flag;
 
 #ifdef TERMINFO
-  int fd, res;
 
-  fd = open("/dev/null", O_WRONLY, &res);
-  setupterm(term, fd, (int *)0);
+  setupterm(term, 0, NULL);
 
   cannakeyentry(key_f1,    CANNA_KEY_F1);
@@ -1271,5 +1279,4 @@ int flag;
 #endif
 
-  resetterm();
 #endif
 

File Added: pkgsrc/inputmethod/canna/patches/patch-canuum_config.h.in
$NetBSD: patch-canuum_config.h.in,v 1.1 2015/10/18 03:58:31 tsutsui Exp $

Check openpty(3), posix_openpt(3), and ptsname(3).

--- canuum/config.h.in.orig	2004-05-19 15:48:58.000000000 +0000
+++ canuum/config.h.in
@@ -83,6 +83,9 @@
 /* Define to 1 if you have the `killpg' function. */
 #undef HAVE_KILLPG
 
+/* Define to 1 if you have the <libutil.h> header file. */
+#undef HAVE_LIBUTIL_H
+
 /* Define to 1 if you have the <malloc.h> header file. */
 #undef HAVE_MALLOC_H
 
@@ -98,6 +101,15 @@
 /* Define to 1 if you have the `memset' function. */
 #undef HAVE_MEMSET
 
+/* Define to 1 if you have the openpty function.  */
+#undef HAVE_OPENPTY
+
+/* Define to 1 if you have the posix_openpt function.  */
+#undef HAVE_POSIX_OPENPT
+
+/* Define to 1 if you have the ptsname function.  */
+#undef HAVE_PTSNAME
+
 /* Define to 1 if you have the <ncurses.h> header file. */
 #undef HAVE_NCURSES_H
 
@@ -200,12 +212,18 @@
 /* Define to 1 if you have the <unistd.h> header file. */
 #undef HAVE_UNISTD_H
 
+/* Define to 1 if you have the <util.h> header file. */
+#undef HAVE_UTIL_H
+
 /* Define to 1 if you have the `vsyslog' function. */
 #undef HAVE_VSYSLOG
 
 /* Define to 1 if you have the `wait3' function. */
 #undef HAVE_WAIT3
 
+/* Define to 1 if you have the util library (-lutil).  */
+#undef HAVE_LIBUTIL
+
 /* Define to the address where bug reports for this package should be sent. */
 #undef PACKAGE_BUGREPORT
 

File Added: pkgsrc/inputmethod/canna/patches/patch-canuum_configure
$NetBSD: patch-canuum_configure,v 1.1 2015/10/18 03:58:31 tsutsui Exp $

Check openpty(3), posix_openpt(3), and ptsname(3).

--- canuum/configure.orig	2004-05-19 15:48:55.000000000 +0000
+++ canuum/configure
@@ -1001,6 +1001,46 @@ fi
 
 
 
+echo $ac_n "checking for openpty in -lutil""... $ac_c" 1>&6
+echo "configure:1006: checking for openpty in -lutil" >&5
+ac_lib_var=`echo util'_'openpty | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lutil  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 1014 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char openpty();
+
+int main() {
+openpty()
+; return 0; }
+EOF
+if { (eval echo configure:1025: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  HAVE_LIBUTIL='have_libutil'
+else
+  echo "$ac_t""no" 1>&6
+fi
+
 
 # If we find X, set shell vars x_includes and x_libraries to the
 # paths, otherwise set no_x=yes.
@@ -1421,7 +1461,7 @@ for ac_hdr in fcntl.h sgtty.h syslog.h u
 	sys/file.h sys/ioctl.h sys/time.h sys/types.h sys/param.h \
 	malloc.h strings.h memory.h \
 	curses.h ncurses.h term.h termio.h \
-	termcap.h sgtty.h sys/termio.h termios.h
+	termcap.h sgtty.h sys/termio.h termios.h libutil.h util.h 
 
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
@@ -2079,10 +2119,11 @@ fi
 for ac_func in random drand48 fchmod getopt \
 	gethostname select socket closesocket setsockopt send recv \
 	FD_SET \
-	getdtablesize getrlimit syslog vsyslog setenv snprintf
+	getdtablesize getrlimit syslog vsyslog setenv snprintf \
+	ptsname posix_openpt openpty
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:2086: checking for $ac_func" >&5
+echo "configure:2127: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else

File Added: pkgsrc/inputmethod/canna/patches/patch-canuum_configure.in
$NetBSD: patch-canuum_configure.in,v 1.1 2015/10/18 03:58:31 tsutsui Exp $

Check openpty(3), posix_openpt(3), and ptsname(3).

--- canuum/configure.in.orig	2003-03-24 04:15:22.000000000 +0000
+++ canuum/configure.in
@@ -378,6 +378,8 @@ AC_CHECK_LIB(socket, connect)
 AC_CHECK_LIB(bind, getservbyname)
 AC_CHECK_LIB(nsl, gethostbyname)
 ])dnl not CANNA
+dnl libutil only needed by uum with openpty... (determine later)
+AC_CHECK_LIB(util, openpty, [HAVE_LIBUTIL='have_libutil'])
 
 dnl
 dnl Checks for header files.
@@ -390,7 +392,7 @@ AC_CHECK_HEADERS(fcntl.h sgtty.h syslog.
 	sys/file.h sys/ioctl.h sys/time.h sys/types.h sys/param.h \
 	malloc.h strings.h memory.h \
 	curses.h ncurses.h term.h termio.h \
-	termcap.h sgtty.h sys/termio.h termios.h
+	termcap.h sgtty.h sys/termio.h termios.h libutil.h util.h 
 )
 dnl If you don't use ansidecl.h, use this (and modify Wnn/jserver/error.c)
 dnl AC_CHECK_HEADERS(stdarg.h varargs.h, break)
@@ -508,7 +510,8 @@ dnl AC_FUNC_WAIT3
 AC_CHECK_FUNCS(random drand48 fchmod getopt \
 	gethostname select socket closesocket setsockopt send recv \
 	FD_SET \
-	getdtablesize getrlimit syslog vsyslog setenv snprintf)
+	getdtablesize getrlimit syslog vsyslog setenv snprintf \
+	ptsname posix_openpt openpty)
 dnl for bcopy/index -> memcpy/strchr conversion (preparation):
 AC_CHECK_FUNCS(bcopy bzero bcmp index rindex \
 	memcpy memmove memset strchr strrchr)
@@ -520,6 +523,14 @@ AC_CHECK_FUNCS(mkdir vasprintf, ,
 [JS_SUPPORTOBJS="${JS_SUPPORTOBJS} ${ac_func}.o"])
 AC_SUBST(JS_SUPPORTOBJS)
 
+dnl
+dnl File Existence
+dnl Checking file at compile time may bring false result when cross-
+dnl compiling. So, one have to check generated config.h and edit it
+dnl if necessary after running configure.
+dnl
+dnl AC_CHECK_FILE(/dev/ptmx, AC_DEFINE(HAVE_DEV_PTMX, 1, [/dev/ptmx found]),)
+AC_CHECK_FILES(/dev/ptmx,,)
 
 dnl
 dnl Creating Makefiles.

File Added: pkgsrc/inputmethod/canna/patches/patch-canuum_jhlp.c
$NetBSD: patch-canuum_jhlp.c,v 1.1 2015/10/18 03:58:31 tsutsui Exp $

Pull various fixes include support for openpty(3), posix_openpt(3),
and ptsname(3) etc. from the latest FreeWnn-1.1.1-a023

--- canuum/jhlp.c.orig	2004-04-26 21:48:37.000000000 +0000
+++ canuum/jhlp.c
@@ -11,9 +11,11 @@
  *                 1987, 1988, 1989, 1990, 1991, 1992
  * Copyright OMRON Corporation. 1987, 1988, 1989, 1990, 1991, 1992, 1999
  * Copyright ASTEC, Inc. 1987, 1988, 1989, 1990, 1991, 1992
- * Copyright FreeWnn Project 1999, 2000, 2002
+ * Copyright FreeWnn Project 1999, 2000, 2002, 2003, 2006, 2009, 2013
+ * Copyright Canna Project 2002
+ * Copyright Taketo Kabe 2003
  *
- * Maintainer:  FreeWnn Project   <freewnn@tomo.gr.jp>
+ * Maintainer:  FreeWnn Project
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -31,7 +33,7 @@
  */
 
 #ifndef lint
-static char *rcs_id = "jhlp.c,v 1.13 2002/08/26 09:27:21 aono Exp";
+static char *rcs_id = "jhlp.c,v 1.26 2013/09/02 11:01:40 itisango Exp";
 #endif /* lint */
 
 #ifdef HAVE_CONFIG_H
@@ -39,6 +41,7 @@ static char *rcs_id = "jhlp.c,v 1.13 200
 #endif
 
 #include <stdio.h>
+#include <sys/types.h>
 #include <setjmp.h>
 #include <signal.h>
 #if STDC_HEADERS
@@ -54,12 +57,20 @@ static char *rcs_id = "jhlp.c,v 1.13 200
 #endif /* STDC_HEADERS */
 #include <errno.h>
 #include <sys/ioctl.h>
+#include <sys/stat.h>
 #ifdef HAVE_SYS_PARAM_H
 #  include <sys/param.h>
 #endif
-#include <sys/stat.h>
-#include <sys/time.h>
-#include <sys/types.h>
+#if TIME_WITH_SYS_TIME
+#  include <sys/time.h>
+#  include <time.h>
+#else
+#  if HAVE_SYS_TIME_H
+#    include <sys/time.h>
+#  else
+#    include <time.h>
+#  endif /* HAVE_SYS_TIME_H */
+#endif /* TIME_WITH_SYS_TIME */
 #if HAVE_FCNTL_H
 #  include <fcntl.h>
 #endif
@@ -67,56 +78,68 @@ static char *rcs_id = "jhlp.c,v 1.13 200
 #ifdef HAVE_UNISTD_H
 #  include <unistd.h>
 #endif
+#if HAVE_SYS_WAIT_H
+#  include <sys/wait.h>
+#endif
+#ifdef HAVE_LIBUTIL_H
+#  include <libutil.h>
+#endif
+#ifdef HAVE_UTIL_H
+#include <util.h>
+#endif
 #ifdef UX386
 #include <sys/kdef.h>
 #endif
 
-#include "commonhd.h"
-#include "sdefine.h"
-#include "sheader.h"
-#include "wnn_config.h"
-#include "wnn_os.h"
-
-
-jmp_buf kk_env;
-
-
-#ifdef HAVE_WAIT3
-#       include <sys/wait.h>
-#endif /* HAVE_WAIT3 */
-
-#ifdef USE_LIBSPT
-# include <libspt.h>
+/* Solaris 2.x needs termio.h , so include both. */
+#if HAVE_TERMIOS_H
+#  include <termios.h>
+#endif
+#if HAVE_TERMIO_H
+#  include <termio.h>
 #endif
 
 #if defined(HAVE_TERMIOS_H)
-# include <termios.h>
-# define USE_TERMIOS
+/* #  include <termios.h> */
+#  define USE_TERMIOS 1
 #elif defined(HAVE_TERMIO_H)
-# include <termio.h>
-# define USE_TERMIO
+/* #  include <termio.h> */
+#  define USE_TERMIO  1
 #elif defined(HAVE_SYS_TERMIO_H)
-# include <sys/termio.h>
-# define USE_TERMIO
+#  include <sys/termio.h>
+#  define USE_TERMIO  1
 #elif defined(HAVE_SGTTY_H)
-# include <sgtty.h>
-# define USE_SGTTY
+#  include <sgtty.h>
+#  define USE_SGTTY
 #else
-# error "No termio header."
-#endif
+#  error "No termio header."
+#endif /* HAVE_TERMIOS_H */
 
-#ifdef linux
-/* # define USE_LINUX_TERM */
+#ifdef USE_LIBSPT
+#  include <libspt.h>
 #endif
 
+/*
+ * Enable old Linux specific code.
+ * We hope you don't have to use this #define ...
+ * (We will remove this #define and related code in near future.)
+ */
+/* #define USE_LINUX_TERM */
+
+
+#include "sdefine.h"
+
+#include "commonhd.h"
+#include "sheader.h"
+#include "wnn_config.h"
+#include "wnn_os.h"
+
 #ifdef nec_ews_svr2
-#include <sys/jtermio.h>
+#  include <sys/jtermio.h>
 #endif /* nec_ews_svr2 */
-
 #if defined(uniosu)
 #       include <sys/pty.h>
 #endif /* defined(uniosu) */
-
 #ifdef SVR4
 #include <sys/stropts.h>
 #include <sys/euc.h>
@@ -132,11 +155,12 @@ jmp_buf kk_env;
 
 #define ERROR -1
 
+jmp_buf kk_env;
 #ifdef TIOCSSIZE
 struct ttysize pty_rowcol;
 #endif /* TIOCSSIZE */
 
-int ttyfd;
+int ttyfd;			/* master tty */
 
 char *tname;                    /* terminal name */
 char *cmdnm = "csh";            /* char *cmdnm = "csh"; */
@@ -145,28 +169,33 @@ int child_id;
 char *prog;
 #ifdef USE_LIBSPT
 spt_handle *spth = NULL;
-int need_utmp_clear = 0;
 #endif
+int need_utmp_clear = 0;
 
-extern char *optarg;
-extern int optind;
-
-extern char *ttyname ();
-
-static void save_signals ();
-static void restore_signals ();
-
-static RETSIGTYPE terminate_handler ();
-static void do_end (), open_pty (), open_ttyp (), do_main (), exec_cmd (), parse_options (), setsize (), get_rubout (), usage (), change_size (), default_usage ();
-static void j_term_save (), j_term_restore (), j_term_p_init (int);
+static void save_signals (void);
+static void restore_signals (void);
+static RETSIGTYPE terminate_handler (int);
+static void do_end (void);
+static void open_pty (void);
+static void open_pty_traditional (void);
+static void open_ttyp (void);
+static void do_main (void);
+static void exec_cmd (char **);
+static void parse_options (int, char **);
+static void setsize (void);
+static void get_rubout (void);
+static void usage (char *);
+static void change_size (void);
+static void default_usage (void);
+static void j_term_save (void);
+static void j_term_restore (void);
+static void j_term_p_init (int);
+static unsigned char keyin0 (void);
+static void uum_err (char *);
 
-/** メイン */
 int
-main (argc, argv)
-     int argc;
-     char **argv;
+main (int argc, char **argv)
 {
-
   char *name;
   char *p;
   char nlspath[64];
@@ -174,7 +203,7 @@ main (argc, argv)
   char *server_env;
   char errprefix[1024] = "error";
   int i;
-  extern char *get_server_env ();
+  extern char *get_server_env (char *);
 
   prog = argv[0];
   flow_control = FLOW_CONTROL;
@@ -344,7 +373,7 @@ main (argc, argv)
     }
 
   j_term_save ();
-  /* do_end() is allowed after here */
+  /* do_end () is allowed from here */
   save_signals ();
 
 #ifdef TERMCAP
@@ -377,6 +406,9 @@ main (argc, argv)
 
   ttyfd = 0;
   open_pty ();
+/* It is normal to open tty here, before fork().
+   Don't know why linux is different.
+   So temporally comment it out to make it as other OSes. */
 #ifndef USE_LINUX_TERM
   open_ttyp ();
 #endif
@@ -387,7 +419,7 @@ main (argc, argv)
   switch (init_uum ())
     {                           /* initialize of kana-kanji henkan */
     case -1:
-      terminate_handler ();
+      terminate_handler (-1);
       break;
     case -2:
       epilogue ();
@@ -399,7 +431,7 @@ main (argc, argv)
 
   if (j_term_init () == ERROR)
     {
-      err ("term initialize fault.");
+      uum_err ("term initialize fault.");
     }
 
 #ifndef CANNA
@@ -415,7 +447,7 @@ main (argc, argv)
         }
       flush ();
     }
-#endif /* !CANNA */
+#endif /* CANNA */
 
   puteustring (MSG_GET (1),
                /*
@@ -434,6 +466,7 @@ main (argc, argv)
 #endif /* defined(uniosu) */
 
   do_main ();
+  return 0;
 }
 
 /*
@@ -441,7 +474,7 @@ main (argc, argv)
  */
 
 static int
-do_h_opt ()
+do_h_opt (void)
 {
   henkan_off_flag = 1;
   defined_by_option |= OPT_WAKING_UP_MODE;
@@ -449,7 +482,7 @@ do_h_opt ()
 }
 
 static int
-do_H_opt ()
+do_H_opt (void)
 {
   henkan_off_flag = 0;
   defined_by_option |= OPT_WAKING_UP_MODE;
@@ -458,42 +491,42 @@ do_H_opt ()
 
 #ifdef  JAPANESE
 int
-do_u_opt ()
+do_u_opt (void)
 {
   pty_c_flag = J_EUJIS;
   return 0;
 }
 
 int
-do_j_opt ()
+do_j_opt (void)
 {
   pty_c_flag = J_JIS;
   return 0;
 }
 
 int
-do_s_opt ()
+do_s_opt (void)
 {
   pty_c_flag = J_SJIS;
   return 0;
 }
 
 int
-do_U_opt ()
+do_U_opt (void)
 {
   tty_c_flag = J_EUJIS;
   return 0;
 }
 
 int
-do_J_opt ()
+do_J_opt (void)
 {
   tty_c_flag = J_JIS;
   return 0;
 }
 
 int
-do_S_opt ()
+do_S_opt (void)
 {
   tty_c_flag = J_SJIS;
   return 0;
@@ -502,28 +535,28 @@ do_S_opt ()
 
 #ifdef  CHINESE
 int
-do_b_opt ()
+do_b_opt (void)
 {
   pty_c_flag = C_BIG5;
   return 0;
 }
 
 int
-do_t_opt ()
+do_t_opt (void)
 {
   pty_c_flag = C_ECNS11643;
   return 0;
 }
 
 int
-do_B_opt ()
+do_B_opt (void)
 {
   tty_c_flag = C_BIG5;
   return 0;
 }
 
 int
-do_T_opt ()
+do_T_opt (void)
 {
   tty_c_flag = C_ECNS11643;
   return 0;
@@ -532,14 +565,14 @@ do_T_opt ()
 
 #ifdef KOREAN
 int
-do_u_opt ()
+do_u_opt (void)
 {
   pty_c_flag = K_EUKSC;
   return 0;
 }
 
 int
-do_U_opt ()
+do_U_opt (void)
 {
   tty_c_flag = K_EUKSC;
   return 0;
@@ -547,14 +580,14 @@ do_U_opt ()
 #endif /* KOREAN */
 
 static int
-do_P_opt ()
+do_P_opt (void)
 {
   sleep (20);
   return 0;
 }
 
 static int
-do_x_opt ()
+do_x_opt (void)
 {
   flow_control = 0;
   defined_by_option |= OPT_FLOW_CTRL;
@@ -562,7 +595,7 @@ do_x_opt ()
 }
 
 static int
-do_X_opt ()
+do_X_opt (void)
 {
   flow_control = 1;
   defined_by_option |= OPT_FLOW_CTRL;
@@ -570,7 +603,7 @@ do_X_opt ()
 }
 
 static int
-do_k_opt ()
+do_k_opt (void)
 {
   strncpy(uumkey_name_in_uumrc, optarg, PATHNAMELEN-1);
   uumkey_name_in_uumrc[PATHNAMELEN-1] = '\0';
@@ -583,7 +616,7 @@ do_k_opt ()
 }
 
 static int
-do_c_opt ()
+do_c_opt (void)
 {
   strncpy(convkey_name_in_uumrc, optarg, PATHNAMELEN-1);
   convkey_name_in_uumrc[PATHNAMELEN-1] = '\0';
@@ -596,7 +629,7 @@ do_c_opt ()
 }
 
 static int
-do_r_opt ()
+do_r_opt (void)
 {
   strncpy(rkfile_name_in_uumrc, optarg, PATHNAMELEN-1);
   rkfile_name_in_uumrc[PATHNAMELEN-1] = '\0';
@@ -609,14 +642,14 @@ do_r_opt ()
 }
 
 static int
-do_l_opt ()
+do_l_opt (void)
 {
   conv_lines = atoi (optarg);
   return 0;
 }
 
 static int
-do_D_opt ()
+do_D_opt (void)
 {
   strncpy(def_servername, optarg, PATHNAMELEN-1);
   def_servername[PATHNAMELEN-1] = '\0';
@@ -629,7 +662,7 @@ do_D_opt ()
 }
 
 static int
-do_n_opt ()
+do_n_opt (void)
 {
   strncpy(username, optarg, PATHNAMELEN-1);
   username[PATHNAMELEN-1] = '\0';
@@ -641,13 +674,13 @@ do_n_opt ()
 }
 
 static int
-do_v_opt ()
+do_v_opt (void)
 {
   defined_by_option |= OPT_VERBOSE;
   return 0;
 }
 
-static int (*do_opt[]) () =
+static int (*do_opt[]) (void) =
 {
   do_h_opt,                     /* 'h' : waking_up_in_henkan_mode */
     do_H_opt,                   /* 'H' : waking_up_no_henkan_mode */
@@ -693,43 +726,31 @@ parse_options (argc, argv)
 /** tty に対する ioctl のセット */
 
 #ifdef USE_SGTTY
-#if defined(BSD43) || defined(DGUX) /* should be "defined(LPASS8)"? */
-#  define SET_PASS8
-#endif
+#  if defined(BSD43) || defined(DGUX) /* should be "defined(LPASS8)"? */
+#    define SET_PASS8  1
+#  endif
+
 struct sgttyb savetmio;
-struct sgttyb ttyb_def =
-{ B9600, B9600, 0x7f, 0x15, EVENP | ODDP | ECHO | CRMOD };
+struct sgttyb ttyb_def = { B9600, B9600, 0x7f, 0x15,
+			   EVENP | ODDP | ECHO | CRMOD };
 int local_mode_def = LCRTBS | LCRTERA | LCRTKIL | LCTLECH | LPENDIN | LDECCTQ;
-
 /* added later */
 struct tchars tcharsv;
 struct ltchars ltcharsv;
 struct sgttyb ttyb;
 int local_mode;
-#ifdef SET_PASS8
+#  ifdef SET_PASS8
 static int local_mode_sv;
-#endif
-
+#  endif
 
 static void
-get_rubout ()
+get_rubout (void)
 {
-#ifdef nodef
-  if (savetmio.sg_erase == UNDEF_STTY)
-    {
-      rubout_code = RUBOUT;
-    }
-  else
-    {
-#endif
-      rubout_code = savetmio.sg_erase;
-#ifdef nodef
-    }
-#endif
+  rubout_code = savetmio.sg_erase;
 }
 
 int
-j_term_init ()
+j_term_init (void)
 {
   struct sgttyb buf;
 
@@ -737,43 +758,42 @@ j_term_init ()
   buf.sg_flags |= RAW;
   buf.sg_flags &= ~ECHO;
   ioctl (ttyfd, TIOCSETP, &buf);
-#ifdef SET_PASS8
+#  ifdef SET_PASS8
   ioctl (ttyfd, TIOCLSET, &local_mode);
-#endif
+#  endif
 
   return 0;
 }
 
 static void
-j_term_save ()
+j_term_save (void)
 {
   ioctl (ttyfd, TIOCGETC, &tcharsv);
   ioctl (ttyfd, TIOCGLTC, &ltcharsv);
   if (ioctl (ttyfd, TIOCGETP, &ttyb))
     ttyb = ttyb_def;
   savetmio = ttyb;
-#ifdef SET_PASS8
+#  ifdef SET_PASS8
   if (ioctl (ttyfd, TIOCLGET, &local_mode_sv))
     local_mode_sv = local_mode_def;
-  local_mode = local_mode_sv | LPASS8;  /* set PASS8 */
-#else /* !SET_PASS8 */
+  local_mode = local_mode_sv | LPASS8;	/* set PASS8 */
+#  else  /* !SET_PASS8 */
   if (ioctl (ttyfd, TIOCLGET, &local_mode))
     local_mode = local_mode_def;
-#endif /* !SET_PASS8 */
+#  endif /* !SET_PASS8 */
 }
 
 static void
-j_term_restore ()
+j_term_restore (void)
 {
   ioctl (ttyfd, TIOCSETP, &savetmio);
-#ifdef SET_PASS8
+#  ifdef SET_PASS8
   ioctl (ttyfd, TIOCLSET, &local_mode_sv);
-#endif /* SET_PASS8 */
+#  endif /* SET_PASS8 */
 }
 
 static void
-j_term_p_init (ttypfd)
-  int ttypfd;
+j_term_p_init (int ttypfd)
 {
   int word;
   ioctl (ttypfd, TIOCSETC, &tcharsv);
@@ -791,35 +811,33 @@ j_term_p_init (ttypfd)
 #if defined(USE_TERMIO) || defined(USE_TERMIOS)
 
 #ifdef USE_TERMIOS
-# define TERMIO termios
-# define GET_TERMATTR(fd, tio) tcgetattr(fd, tio)
-# define SET_TERMATTR(fd, tio) tcsetattr(fd, TCSADRAIN, tio)
-# define UNDEF_STTY _POSIX_VDISABLE
-# define SET_ATTR_ERROR "error in tcsetattr.\n"
-#else
-# define TERMIO termio
-# define GET_TERMATTR(fd, tio) ioctl(fd, TCGETA, tio)
-# ifdef TCSETAW
-#  define SET_TERMATTR(fd, tio) ioctl(fd, TCSETAW, tio)
-# else
-#  define SET_TERMATTR(fd, tio) ioctl(fd, TCSETA, tio)
-# endif
-# define UNDEF_STTY 0xff
-# define SET_ATTR_ERROR "error in ioctl TCSETA.\n"
-#endif
+#  define TERMIO termios
+#  define GET_TERMATTR(fd, tio) tcgetattr(fd, tio)
+#  define SET_TERMATTR(fd, tio) tcsetattr(fd, TCSADRAIN, tio)
+#  define UNDEF_STTY _POSIX_VDISABLE
+#  define SET_ATTR_ERROR "error in tcsetattr.\n"
+#else /* !USE_TERMIOS */
+#  define TERMIO termio
+#  define GET_TERMATTR(fd, tio) ioctl(fd, TCGETA, tio)
+#  ifdef TCSETAW
+#    define SET_TERMATTR(fd, tio) ioctl(fd, TCSETAW, tio)
+#    define SET_ATTR_ERROR "error in ioctl TCSETAW.\n"
+#  else
+#    define SET_TERMATTR(fd, tio) ioctl(fd, TCSETA, tio)
+#    define SET_ATTR_ERROR "error in ioctl TCSETA.\n"
+#  endif
+#  define UNDEF_STTY 0xff
+#endif /* !USE_TERMIOS */
 #ifdef CERASE
-# define WNN_CERASE CERASE
-#elif defined(CDEL)
-# define WNN_CERASE CDEL
+#  define WNN_CERASE CERASE
 #else
-# define WNN_CERASE 0x7f
+#  define WNN_CERASE 0x7f
 #endif
 
 struct TERMIO savetmio;
 
 static void
-set_default_termio (terms)
-  struct TERMIO *terms;
+set_default_termio (struct TERMIO *terms)
 {
   bzero (terms, sizeof *terms);
   terms->c_iflag = IGNBRK | ICRNL | IXON;
@@ -839,12 +857,12 @@ set_default_termio (terms)
   terms->c_cc[VKILL] = 0x15;
   terms->c_cc[VEOF] = 0x4;
   terms->c_cc[VEOL] = _POSIX_VDISABLE;
-#ifdef VEOL2
+#  ifdef VEOL2
   terms->c_cc[VEOL2] = _POSIX_VDISABLE;
-#endif
+#  endif
   cfsetospeed (terms, B9600);
   cfsetispeed (terms, B9600);
-#else
+#else /* !USE_TERMIOS */
   terms->c_line = 0;
   terms->c_cc[0] = 0x3;
   terms->c_cc[1] = 0x1c;
@@ -854,7 +872,7 @@ set_default_termio (terms)
   terms->c_cc[5] = 0;
   terms->c_cc[6] = 0;
   terms->c_cc[7] = 0;
-#endif
+#endif /* !USE_TERMIOS */
 }
 
 #if defined(uniosu)
@@ -866,7 +884,7 @@ struct auxtermio auxterm = {
 #endif /* defined(uniosu) */
 
 static void
-get_rubout ()
+get_rubout (void)
 {
   if (savetmio.c_cc[VERASE] == UNDEF_STTY)
     {
@@ -879,7 +897,7 @@ get_rubout ()
 }
 
 int
-j_term_init ()
+j_term_init (void)
 {
   struct TERMIO buf1;
 #if defined(uniosu)
@@ -887,33 +905,37 @@ j_term_init ()
 #endif /* defined(uniosu) */
 
   buf1 = savetmio;
-#ifdef USE_LINUX_TERM
+#ifdef linux
   buf1.c_lflag &= ~(ECHONL | ECHOK | ECHOE | ECHO | XCASE | ICANON | ISIG);
   buf1.c_iflag = 0;
   buf1.c_oflag &= ~OPOST;
   buf1.c_cflag |= CS8;
   buf1.c_cc[VMIN] = 1;          /* cf. ICANON */
   buf1.c_cc[VTIME] = 0;
-#else /* !USE_LINUX_TERM */
+  buf1.c_iflag &= ~(ISTRIP | INLCR | IGNCR | ICRNL | IUCLC | IXON);
+#else /* !linux */
   buf1.c_iflag &= ~(ISTRIP | INLCR | IGNCR | ICRNL | IXON);
-#ifdef IUCLC
-  buf1.c_iflag &= IUCLC;
-#endif
+#  ifdef IUCLC
+  buf1.c_iflag &= ~(IUCLC);
+#  endif
   if (flow_control)
     {
       buf1.c_iflag |= IXON;
     }
   buf1.c_lflag &= ~(ECHONL | ECHOK | ECHOE | ECHO | ICANON | ISIG);
-#ifdef XCASE
-  buf1.c_lflag &= XCASE;
-#endif
+#  ifdef XCASE
+  buf1.c_lflag &= ~(XCASE);
+#  endif
+#  ifdef IEXTEN
+  buf1.c_lflag &= ~(IEXTEN);
+#  endif
   buf1.c_oflag = OPOST;
-#ifdef USE_TERMIOS
-  buf1.c_cc[VMIN] = 1;          /* cf. ICANON */
+#  ifdef USE_TERMIOS
+  buf1.c_cc[VMIN] = 1;
   buf1.c_cc[VTIME] = 0;
   cfsetispeed(&buf1, cfgetispeed(&savetmio));
   cfsetospeed(&buf1, cfgetospeed(&savetmio));
-#else /* !USE_TERMIOS */
+#  else /* !USE_TERMIOS */
   buf1.c_cc[VEOF] = 1;          /* cf. ICANON */
   buf1.c_cc[VEOL] = 0;
   /* not needed? cf.ISIG*/
@@ -921,8 +943,8 @@ j_term_init ()
   buf1.c_cc[VQUIT] = WNN_CERASE;
   buf1.c_cc[VERASE] = WNN_CERASE;
   buf1.c_cc[VKILL] = WNN_CERASE;
-#endif /* !USE_TERMIOS */
-#endif /* !USE_LINUX_TERM */
+#  endif /* !USE_TERMIOS */
+#endif /* !linux */
   if (SET_TERMATTR (ttyfd, &buf1) < 0)
     {
       fprintf (stderr, SET_ATTR_ERROR);
@@ -979,12 +1001,12 @@ j_term_init ()
 }
 
 static void
-j_term_save ()
+j_term_save (void)
 {
   if (GET_TERMATTR (ttyfd, &savetmio) < 0)
-    {
-      set_default_termio (&savetmio);
-    }
+  {
+    set_default_termio (&savetmio);
+  }
 #if defined(uniosu)
   if (ioctl (ttyfd, JTERMGET, &savejtmio) < 0)
     {
@@ -995,7 +1017,7 @@ j_term_save ()
 }
 
 static void
-j_term_restore ()
+j_term_restore (void)
 {
   if (SET_TERMATTR (ttyfd, &savetmio) < 0)
     {
@@ -1013,8 +1035,7 @@ j_term_restore ()
 }
 
 static void
-j_term_p_init (ttypfd)
-  int ttypfd;
+j_term_p_init (int ttypfd)
 {
   struct TERMIO buf1;
 #if defined(uniosu)
@@ -1094,20 +1115,18 @@ j_term_p_init (ttypfd)
 #endif /* USE_TERMIO || USE_TERMIOS */
 
 /** signal SIGCHLD を受けた後の処理をする。*/
-/* *INDENT-OFF* */
 RETSIGTYPE
-chld_handler ()
-/* *INDENT-ON* */
+chld_handler (int sig)
 {
 #ifdef HAVE_WAIT3
-#if !defined(_POSIX_VERSION) && defined(HAVE_UNION_WAIT) /* older way */
+#if !defined(_POSIX_VERSION) && defined(HAVE_UNION_WAIT)
   union wait status;
 #else /* POSIX */
   int status;
 #endif
   int pid;
 
-  if ((pid = wait3(&status, WNOHANG | WUNTRACED, NULL)) == child_id)
+  if ((pid = wait3 (&status, WNOHANG | WUNTRACED, NULL)) == child_id)
     {
       if (WIFSTOPPED (status))
         {
@@ -1156,7 +1175,7 @@ chld_handler ()
 
 /** signal SIGTERM を受けた時の処理をする。*/
 static RETSIGTYPE
-terminate_handler ()
+terminate_handler (int sig)
 {
   signal (SIGCHLD, SIG_IGN);
   epilogue_no_close ();
@@ -1169,10 +1188,8 @@ terminate_handler ()
 }
 
 #ifdef  SIGWINCH
-/* *INDENT-OFF* */
 RETSIGTYPE
-resize_handler ()
-/* *INDENT-ON* */
+resize_handler (int sig)
 {
   re_signal (SIGWINCH, resize_handler);
   change_size ();
@@ -1187,10 +1204,10 @@ resize_handler ()
 /** メインループ */
 
 wnn_fd_set sel_ptn;
-int ptyfd = -1;
+int ptyfd;
 
 static void
-do_main ()
+do_main (void)
 {
 #ifndef CANNA
   unsigned char *buf;
@@ -1206,10 +1223,11 @@ do_main ()
       epilogue ();
       do_end ();
     }
-#else /* CANNA */
-  extern void canna_mainloop();
+#else  /* CANNA */
+  extern void canna_mainloop(void);
 #endif /* CANNA */
 
+  WNN_FD_ZERO (&sel_ptn);
   WNN_FD_SET(ptyfd, &sel_ptn);
   WNN_FD_SET(ttyfd, &sel_ptn);
 
@@ -1221,23 +1239,19 @@ do_main ()
 #ifndef CANNA
   for (;;)
     {
-
       ml = kk ();
-
       make_history (return_buf, ml);
       ml = (*code_trans[(internal_code << 2) | pty_c_flag]) (buf, return_buf, sizeof (w_char) * ml);
       if (ml > 0)
         write (ptyfd, buf, ml);
     }
-#else /* CANNA */
+#else  /* CANNA */
   canna_mainloop();
 #endif /* CANNA */
 }
 
-unsigned char keyin0 ();
-
 int
-keyin2 ()
+keyin2 (void)
 {
   int total, ret;
   unsigned char in;
@@ -1259,15 +1273,14 @@ keyin2 ()
 
 /** convert_key nomi okonau key-in function */
 int
-conv_keyin (inkey)
-     char *inkey;
+conv_keyin (char *inkey)
 {
   return keyin1 (keyin2, inkey);
 }
 
 /** キー入力関数 1 */
 int
-keyin ()
+keyin (void)
 {
   char inkey[16];
   return (conv_keyin (inkey));
@@ -1280,10 +1293,7 @@ keyin ()
  */
 
 static void
-throughlike(dest, src, n)
-w_char *dest;
-unsigned char *src;
-int n;
+throughlike(w_char *dest, unsigned char *src, int n)
 {
   while (n-- > 0) {
     *dest++ = (w_char)*src++;
@@ -1291,8 +1301,8 @@ int n;
 }
 
 /** キー入力関数 2 */
-unsigned char
-keyin0 ()
+static unsigned char
+keyin0 (void)
 {
   static unsigned char buf[BUFSIZ];
   static unsigned char outbuf[BUFSIZ];
@@ -1341,7 +1351,7 @@ keyin0 ()
       time_out.tv_sec = 0;
       time_out.tv_usec = 200 * 1000;    /* 200 msec 間待つのだゾ! */
       for (rfds = sel_ptn;
-#ifdef USE_LINUX_TERM
+#ifdef linux
            (sel_ret = select (20, &rfds, 0, 0, NULL)) < 0 && errno == EINTR;
 #else
            (sel_ret = select (20, &rfds, 0, 0, &time_out)) < 0 && errno == EINTR;
@@ -1392,7 +1402,8 @@ keyin0 ()
                       p += j;
                       i -= j;
                     }
-		  WNN_FD_SET(ttyfd, &mask);
+		  WNN_FD_ZERO (&mask);
+		  WNN_FD_SET (ttyfd, &mask);
                   select (32, 0, &mask, 0, 0);
                 }
               pop_cursor ();
@@ -1439,8 +1450,8 @@ keyin0 ()
 #if defined(uniosu)
 /** pty から ioctl がかかった時の処理 */
 int
-arrange_ioctl (jflg)
-     int jflg;                  /* jtermio の j_flg の変換フラグがオフの時 0 オンの時 1 */
+arrange_ioctl (int jflg)
+/* jflg: jtermio の j_flg の変換フラグがオフの時 0 オンの時 1 */
 {
   struct jtermio jbuf1;
   struct TERMIO frombuf;
@@ -1511,11 +1522,10 @@ arrange_ioctl (jflg)
 
 /** 子プロセスを起こす。*/
 
-int ttypfd = -1;
+int ttypfd = -1;	/* slave tty */
 
 static void
-exec_cmd (argv)
-     char **argv;
+exec_cmd (char **argv)
 {
   int i;
 #if defined(USE_LIBSPT) && !defined(USE_LINUX_TERM)
@@ -1525,21 +1535,20 @@ exec_cmd (argv)
 #ifdef BSD42
   int pid;
 #endif
-#ifdef USE_LINUX_TERM
+#endif /* (!USE_LIBSPT && !HAVE_SETSID) || USE_LINUX_TERM */
+#if defined(SIGWINCH) && defined(TIOCSWINSZ) /* || defined(linux) */
   struct winsize win;
-  extern Term_RowWidth, crow;
+  extern int Term_RowWidth;
 #endif
-#endif /* (!USE_LIBSPT && !HAVE_SETSID) || USE_LINUX_TERM */
 
   child_id = fork ();
   if (child_id < 0)
-    err ("cannot fork.");
+    uum_err ("cannot fork.");
   if (!child_id)
     {
       /* --- start changing controlling tty --- */
 #if defined(USE_LIBSPT) && !defined(USE_LINUX_TERM)
 #if defined(SIGWINCH) && defined(TIOCSWINSZ)
-      struct winsize win;
       if (ioctl (ttyfd, TIOCGWINSZ, &win) == 0)
 	ioctl (ttypfd, TIOCSWINSZ, &win);
 #endif /* SIGWINCH && TIOCSWINSZ */
@@ -1547,37 +1556,31 @@ exec_cmd (argv)
       spth = NULL;
       if (spt_detach_ctty () || spt_set_ctty2 (ttypfd))
 	{
-	  err ("cannot change controlling tty.");
+	  uum_err ("cannot change controlling tty.");
 	}
 
 #elif defined(HAVE_SETSID) && !defined(USE_LINUX_TERM) /* !USE_LIBSPT */
 
       int fd;
-#if defined(SIGWINCH) && defined(TIOCSWINSZ)
-      struct winsize win;
+# if defined(SIGWINCH) && defined(TIOCSWINSZ)
       if (ioctl (ttyfd, TIOCGWINSZ, &win) == 0)
 	ioctl (ttypfd, TIOCSWINSZ, &win);
-#endif /* SIGWINCH && TIOCSWINSZ */
+# endif /* SIGWINCH && TIOCSWINSZ */
       setsid ();
-#ifdef TIOCSCTTY
+# ifdef TIOCSCTTY
       ioctl (ttypfd, TIOCSCTTY, 0);
-#else
+# else
       close (open (ttyname (ttypfd), O_WRONLY, 0));
-#endif
+# endif
       if ((fd = open("/dev/tty", O_WRONLY)) < 0)
 	{
-          err ("cannot change controlling tty.");
+	  uum_err ("cannot change controlling tty.");
 	}
       close (fd);
       /* disable utmp logging for now */
 
 #else /* (!USE_LIBSPT && !HAVE_SETSID) || USE_LINUX_TERM */
 
-#if defined(SYSVR2) && !defined(USE_LINUX_TERM)
-      setpgrp ();
-      close (open (ttyname (ttypfd), O_WRONLY, 0));
-#endif /* SYSVR2 */
-
 #ifdef BSD42
 #ifdef TIOCNOTTY
       /* set notty */
@@ -1601,18 +1604,28 @@ exec_cmd (argv)
       close (open (ttyname (ttypfd), O_WRONLY, 0));
       setpgrp (0, pid);
 #endif /* BSD42 */
+#if defined(SYSVR2) && !defined(linux)
+      setpgrp (); /* should setpgrp() AFTER fork() */
+      close (open (ttyname (ttypfd), O_WRONLY, 0));
+#endif /* SYSVR2 */
 
-#ifdef USE_LINUX_TERM
+/* It is bizarre to open tty after fork().
+   So, try to do same as other os.
+   If it does work, we can remove this. */
+# ifdef linux
       setsid ();
       open_ttyp ();
       close (ptyfd);
-      ioctl (ttyfd, TIOCGWINSZ, &win);
       ioctl (ttypfd, TCSETA, &savetmio);
-#endif
+# endif
+# if defined(SIGWINCH) && defined(TIOCSWINSZ) /* || defined(linux) */
+      ioctl (ttyfd, TIOCGWINSZ, &win);
+# endif
+
 #endif /* (!USE_LIBSPT && !HAVE_SETSID) || USE_LINUX_TERM */
       /* --- finish changing controlling tty --- */
 
-#ifndef USE_LINUX_TERM
+#ifndef linux
       setgid (getgid ());
       setuid (getuid ());
 #endif
@@ -1626,7 +1639,7 @@ exec_cmd (argv)
       close (2);
       if (dup (ttypfd) != 0 || dup (ttypfd) != 1 || dup (ttypfd) != 2)
         {
-          err ("redirection fault.");
+          uum_err ("redirection fault.");
         }
 #endif /* !HAVE_DUP2 */
       for (i = WNN_NFD - 1; i > 2; i--)
@@ -1646,15 +1659,18 @@ exec_cmd (argv)
       signal (SIGTTOU, SIG_IGN);
 #endif
 
-#ifdef USE_LINUX_TERM
+#if defined(SIGWINCH) && defined(TIOCSWINSZ) /* || defined(linux) */
       crow = win.ws_row = Term_RowWidth = win.ws_row - conv_lines;
       ioctl (ttyfd, TIOCSWINSZ, &win);
+#endif
+#ifdef linux
       setgid (getgid ());
       setuid (getuid ());
 #endif
       execvp (cmdnm, argv);
-      err ("exec fault.");
+      uum_err ("exec fault.");
     }
+
   /* parent */
 #ifdef USE_LIBSPT
   ttynm = ttyname (0);
@@ -1676,7 +1692,7 @@ exec_cmd (argv)
     {
       spt_perror ("exec_cmd (login_utmp)", r);
     }
-#endif
+#endif /* USE_LIBSPT */
 }
 
 #if !(HAVE_SETENV)
@@ -1687,10 +1703,7 @@ exec_cmd (argv)
  * The 3rd parameter is ignored. It is added for compatibility only.
  */
 int
-setenv (var, value, overwrite)
-     char *var;
-     char *value;
-     int  overwrite;
+setenv (char *var, char *value, int overwrite)
 {
   extern char **environ;
   char **newenv;
@@ -1730,9 +1743,7 @@ setenv (var, value, overwrite)
 
 #ifdef SVR4
 static int
-euc_set (eucioc, ttyfd)
-     eucioc_t *eucioc;
-     int ttyfd;
+euc_set (eucioc_t *eucioc, int ttyfd)
 {
   struct strioctl sb;
 
@@ -1747,9 +1758,8 @@ euc_set (eucioc, ttyfd)
   return (0);
 }
 
-static void
-set_euc_term (ttyfd)
-     int ttyfd;
+static int
+set_euc_term (int ttyfd)
 {
   eucioc_t eucioc;
 
@@ -1765,17 +1775,16 @@ set_euc_term (ttyfd)
   if (euc_set (&eucioc, ttyfd) != 0)
     {
       fprintf (stderr, "eucwidth set failed\n");
-      return;
+      return (1);
     }
-  return;
+  return (0);
 }
 
 #endif /* SVR4 */
 
 #ifdef nec_ews_svr2
 static void
-set_jterm (ttyfd, ttypfd)
-     int ttyfd, ttypfd;
+set_jterm (int ttyfd, int ttypfd)
 {
   struct jtermio buf;
 
@@ -1796,46 +1805,50 @@ set_jterm (ttyfd, ttypfd)
 
 #ifdef sony
 static void
-set_sony_jterm(ttyfd, ttypfd)
-int ttyfd, ttypfd;
+set_sony_jterm (int ttyfd, int ttypfd)
 {
 #ifdef TIOCKGET
   int tmode, jmode = 0;
   struct jtchars jtc;
 
-  if (ioctl(ttyfd, TIOCKGET, &tmode) < 0) {
-    fprintf(stderr, "error in ioctl TIOCKGET.\n");
-    exit(1);
-  }
+  if (ioctl(ttyfd, TIOCKGET, &tmode) < 0)
+    {
+      fprintf(stderr, "error in ioctl TIOCKGET.\n");
+      exit (1);
+    }
   jmode = tmode;
   tmode &= ~(KM_SYSCODE | KM_TTYPE);
-  switch (pty_c_flag) {
-  case J_EUJIS:
-    tmode |= KM_EUC | KM_SYSEUC;
-    break;
-  case J_JIS:
-    tmode |= KM_ASCII;
-    break;
-  case J_SJIS:
-    tmode |= KM_SJIS | KM_SYSSJIS;
-    break;
-  }
-  if (ioctl(ttypfd, TIOCKSET, &tmode) < 0) {
-    fprintf(stderr, "error in ioctl TIOCKSET.\n");
-    exit(1);
-  }
+  switch (pty_c_flag)
+    {
+    case J_EUJIS:
+      tmode |= KM_EUC | KM_SYSEUC;
+      break;
+    case J_JIS:
+      tmode |= KM_ASCII;
+      break;
+    case J_SJIS:
+      tmode |= KM_SJIS | KM_SYSSJIS;
+      break;
+    }
+  if (ioctl(ttypfd, TIOCKSET, &tmode) < 0)
+    {
+      fprintf(stderr, "error in ioctl TIOCKSET.\n");
+      exit (1);
+    }
 #endif /* TIOCKGET */
 
 #ifdef TIOCKGETC    
-  if ((jmode & KM_TTYPE) == KM_JIS) {
-    ioctl(ttyfd, TIOCKGETC, &jtc);
-    jtc.t_ascii = 'B';
-    jtc.t_kanji = 'B';
-    if (ioctl(ttypfd, TIOCKSETC, &jtc) < 0) {
-      fprintf(stderr, "error in ioctl TIOCKSETC.\n");
-      exit(1);
+  if ((jmode & KM_TTYPE) == KM_JIS)
+    {
+      ioctl(ttyfd, TIOCKGETC, &jtc);
+      jtc.t_ascii = 'B';
+      jtc.t_kanji = 'B';
+      if (ioctl(ttypfd, TIOCKSETC, &jtc) < 0)
+	{
+	  fprintf(stderr, "error in ioctl TIOCKSETC.\n");
+	  exit(1);
+	}
     }
-  }
 #endif
 }
 #endif /* sony */
@@ -1843,132 +1856,233 @@ int ttyfd, ttypfd;
 /** ttyp のオープン */
 
 #ifndef USE_LIBSPT
-#define MAXPTYNO (0x10 * (('z' - 'p' + 1) + ('Z' - 'P' + 1)))
-int ptyno;
-char *ptynm = "/dev/pty";
-#ifdef sgi
-extern char *_getpty (int *, int, mode_t, int);
-char *ttypnm = "/dev/ttyqxxx";
-#else
-char *ttypnm = "/dev/tty";
-#endif /* sgi */
+/* ways to get a pty'
+ == Traditional
+   Try opening each /dev/ptyXX and use the succeeded one
+ == SGI IRIX
+   use _getpty()
+ == BSD? (HAVE_OPENPTY)
+   use openpty()
+ == STREAMS (Solaris) (HAVE_PTSNAME)
+   use posix_openpt() (or open /dev/ptmx directly) and ptsname()
+   (see pts(7D) for EXAMPLE)
+*/
+
+#if !defined(sgi) && !defined(HAVE_PTSNAME)
+char tty_master[32]; /*VVVV overflow?*/
+#endif
+char tty_slave [32]; /*VVVV overflow?*/
 
-#ifndef sgi
-static void ptyname ();
+#if defined(BSD43) || defined(DGUX)	/* FOR PASS8 */
+static int local_mode_sv;
 #endif
 #endif /* !USE_LIBSPT */
 
+/* open slave side of pty to ttypfd */
 static void
-open_ttyp ()
+open_ttyp (void)
 {
-  char nmbuf[20];
+#ifndef USE_LIBSPT     /* && !defined(linux) ? */
+  struct stat tstat;
+  char chown_failed = 0;
+  const char *msg_insecure = "Your ttyp (%s) may be insecure from other users, but continue anyway ...\r\n";
+#endif /* !USE_LIBSPT */
 
 #ifdef USE_LIBSPT
   if ((ttypfd = spt_open_slave(spth)) == ERROR)
+#else /* USE_LIBSPT */
+# if defined(sgi)
+  if ((ttypfd = open (tty_slave, O_RDWR)) == ERROR)
+# elif defined(HAVE_PTSNAME)
+  if ((ttypfd = open(tty_slave, O_RDWR)) == ERROR	/* open slave */
+#   if defined(I_PUSH)
+	/* for systems that have STREAMS */
+       || ioctl (ttypfd, I_PUSH, "ptem") == ERROR	/* push ptem */
+       || ioctl (ttypfd, I_PUSH, "ldterm") == ERROR	/* push ldterm */
+#   endif
+     )
+# elif defined (HAVE_OPENPTY)
+  if (ttypfd < 0)		/* already open */
+# else
+  if ((ttypfd = open (tty_slave, O_RDWR, 0)) == ERROR)	/* old method */
+# endif /* sgi */
+#endif /* USE_LIBSPT */
     {
-#elif defined(sgi)
-  if ((ttypfd = open (ttypnm, O_RDWR)) == ERROR)
-    {
-#else
-  ptyname (nmbuf, ttypnm, ptyno);
-  if ((ttypfd = open (nmbuf, O_RDWR, 0)) == ERROR)
-    {
-#endif
-      err ("Can't open ttyp.");
+      perror(tty_slave);	/* debug */
+      uum_err ("Can't open ttyp.");
     }
-#if !defined(USE_LINUX_TERM) && !defined(USE_LIBSPT)
-  chown (nmbuf, getuid (), getgid ());
-  chmod (nmbuf, 0622);
-#endif /* !USE_LINUX_TERM && !USE_LIBSPT */
 #if defined(USE_LIBSPT)
   spt_init_slavefd(spth, ttypfd);
-#elif defined(I_PUSH) && defined(SVR4)
-  ioctl(ttypfd, I_PUSH, "ptem");
-  ioctl(ttypfd, I_PUSH, "ldterm");
-  ioctl(ttypfd, I_PUSH, "ttcompat");
-#endif
-	
+#else	/* USE_LIBSPT */
+/* #if !defined(linux) */
+  if(fstat(ttypfd, &tstat)==0) {
+    if(tstat.st_uid != getuid()) {
+      if(chown (tty_slave, getuid (), getgid ())!=0) {
+	perror("Can't change owner of ttyp.");
+	fprintf(stderr, msg_insecure, tty_slave);
+	chown_failed = 1;
+      }
+    }
+    if((tstat.st_mode & (S_IWGRP | S_IWOTH)) != 0) {
+      /* Ignore message if chown failed (chmod will fail also ...) */
+      if(chmod (tty_slave, 0622)!=0 && chown_failed == 0) {
+	perror("Can't change permission of ttyp.");
+	fprintf(stderr, msg_insecure, tty_slave);
+      }
+    }
+  } else {
+    perror("Can't stat ttyp.");
+    fprintf(stderr, msg_insecure, tty_slave);
+  }
+/* #endif */ /* linux */
+#endif /* USE_LIBSPT */
+
   /*
    * We save terminal settings in main() instead of here.
-   * When USE_LINUX_TERM open_ttyp() is invoked from child!
+   * When defined(linux) open_ttyp() is invoked from child!
    */
 #ifndef USE_LINUX_TERM
   j_term_p_init (ttypfd);
 #endif
 
 #ifdef TIOCSSIZE
-    pty_rowcol.ts_lines = crow; /* instead of lines */
-    pty_rowcol.ts_cols = maxlength; /* instead of columns */
-    ioctl(ttypfd, TIOCSSIZE, &pty_rowcol);
+  pty_rowcol.ts_lines = crow;   /* instead of lines */
+  pty_rowcol.ts_cols = maxlength;       /* instead of columns */
+  ioctl (ttypfd, TIOCSSIZE, &pty_rowcol);
 #endif /* TIOCSSIZE */
 
 #ifdef SVR4
   set_euc_term(ttypfd);
 #endif
-
 #if defined(nec_ews_svr2)
   set_jterm (ttyfd, ttypfd);
 #endif
-
 #ifdef sony
   set_sony_jterm(ttyfd, ttypfd);
 #endif
+}
+
+#if defined(HAVE_PTSNAME) && ! defined(HAVE_POSIX_OPENPT)
+/* Maybe harmless on defined(USE_LIBSPT) */
+#if !defined(HAVE__DEV_PTMX)
+#warning "If not cross compile, you must check pts master device (other than /dev/ptmx)."
+/* but continue anyway. */
+#endif
 
+/* fallback function to posix_openpt */
+static int
+posix_openpt (int flags)
+{
+  return open("/dev/ptmx", flags);
 }
+#endif		/* HAVE_PTSNAME && !HAVE_POSIX_OPENPT */
 
 /** pty のオープン */
-#if defined(USE_LIBSPT)
+/* allocate a new pty master into int ptyfd */
 static void
-open_pty ()
+open_pty (void)
 {
+#if defined(USE_LIBSPT)
   int r;
   r = spt_open_pty(&spth, &ptyfd, NULL, NULL);
   if (r != SPT_E_NONE && r != SPT_E_CHOWN_FAIL)
-    err ("Can't get pty.");
-  return;
-}
+    uum_err ("Can't get pty.");
+
 #elif defined(sgi)
-static void
-open_pty ()
-{
-  char nmbuf[20];
   char *tty_name_buff;
+  extern char *_getpty (int *, int, mode_t, int);
   tty_name_buff = _getpty (&ptyfd, O_RDWR | O_NDELAY, 0600, 0);
   if (tty_name_buff == 0)
-    err ("Can't get pty.");
-  strcpy (ttypnm, tty_name_buff);
-  return;
+    uum_err ("Can't get pty.");
+  strcpy (tty_slave, tty_name_buff);
+
+#elif defined(HAVE_PTSNAME)
+  char *p;
+  ptyfd = posix_openpt(O_RDWR);	/* open master */
+  if (ptyfd < 0)
+    uum_err ("Could not get a pty.");
+  grantpt (ptyfd);		/* change permission of slave */
+  unlockpt (ptyfd);		/* unlock slave */
+
+  p = ptsname (ptyfd);		/* get name of slave */
+  strcpy(tty_slave, p);
+  /* you can't get path of the "master" by ttyname;
+   * only the open filedes ptyfd is available.
+   */
+  /* strcpy (tty_master, "/dev/ptm/x"); */
+
+#elif HAVE_OPENPTY
+  if (openpty(&ptyfd, &ttypfd, tty_slave, NULL, NULL) == ERROR)
+    uum_err ("Could not get a pty.");
+    /* Note: slave tty is ALREADY OPEN as ttypfd */
+  strcpy(tty_master, ttyname(ptyfd));
 
-}
 #else
+  /* Traditional method that search in /dev/ttyXX */
+  open_pty_traditional ();
+#endif /* USE_LIBSPT */
+
+  return;
+}
+
+#if !(USE_LIBSPT) && !(sgi) && !(HAVE_PTSNAME) && !(HAVE_OPENPTY)
 static void
-open_pty ()
+open_pty_traditional (void)
 {
-  char nmbuf[20];
+  int ptyno;
+
+#ifdef hpux
+# define MAXPTYS (11*16)
+# define PTYDEV ";/dev/ptym/pty"
+# define TTYDEV "/dev/pty/tty"
+#else
+# define MAXPTYS 32
+# define PTYDEV "/dev/pty"
+# define TTYDEV "/dev/tty"
+#endif
 
-  for (ptyno = 0; ptyno < MAXPTYNO; ptyno++)
+  for (ptyno = 0; ptyno < MAXPTYS; ptyno++)	/* sysconf? */
     {
-      ptyname (nmbuf, ptynm, ptyno);
-      if ((ptyfd = open (nmbuf, O_RDWR, 0)) != ERROR)
+/*
+ * Change pseudo-devices.
+ * Because FreeBSD's master pseudo-devices are pty[p-sP-S][0-9a-v].
+ * Patched by Hidekazu Kuroki(hidekazu@cs.titech.ac.jp)         1996/8/20
+ */
+#if (defined(BSD) && (BSD >= 199306))   /* 4.4BSD-Lite by Taoka */
+# define PTXNAME(b, PFX, no) \
+    snprintf ((b), sizeof((b)), PFX "%1c%1c", "pqrsPQRS"[((no) >> 5)], "0123456789abcdefghijklmnopqrstuv"[(no) & 0x1f])
+#elif defined(hpux)
+#  define PTXNAME(b, PFX, no) \
+    sprintf ((b), PFX "%1c%1c", "zyxwvutsrqp"[(no)>>4], "fedcba9876543210"[(no)&0x0f])
+#else /* !4.4BSD-Lite, !hpux */
+#  define PTXNAME(b, PFX, no) \
+    sprintf ((b), PFX "%1c%1c", 'p' + ((no) >> 4), "0123456789abcdef"[(no) & 0x0f]);
+#endif /* !4.4BSD-Lite */
+#define PTMNAME(b, no) PTXNAME(b, PTYDEV, no)
+#define PTSNAME(b, no) PTXNAME(b, TTYDEV, no)
+
+      PTMNAME(tty_master, ptyno);
+      fprintf(stderr, "trying master <%s>\n", tty_master);	/* debug */
+      if ((ptyfd = open (tty_master, O_RDWR, 0)) != ERROR)
         {
-#if defined(uniosu)
+# if defined(uniosu)
           if (ioctl (ptyfd, PIOCPKT, 1) < 0)
             {                   /* packet mode on */
               fprintf (stderr, "error in ioctl PIOCPKT.\n");
               exit (1);
             }
-#endif
-	  return;
+# endif /* uniosu */
+	  PTSNAME(tty_slave, ptyno);
+          return;
         }
     }
-  err ("Can't get pty.");
+  uum_err ("Can't get pty.");
 }
-#endif
+#endif /* !(USE_LIBSPT) && !(sgi) && !(HAVE_PTSNAME) && !(HAVE_OPENPTY) */
 
 /** エラーだよ。さようなら。 */
 void
-err (s)
-     char *s;
+uum_err (char *s)
 {
   puts (s);
   fclose (stdout);
@@ -1979,12 +2093,10 @@ err (s)
 
 /** 立つ鳥後を濁さず 終わりの処理 */
 static void
-do_end ()
+do_end (void)
 {
 #ifdef USE_LIBSPT
   int r;
-#else
-  char nmbuf[20];
 #endif
 
   static int do_end_flg = 0;
@@ -1994,29 +2106,28 @@ do_end ()
 
   signal (SIGCHLD, SIG_DFL);
   fcntl (ttyfd, F_SETFL, 0);
-
   j_term_restore ();
 
 #if !defined(USE_LIBSPT) && !defined(sgi)
-  ptyname (nmbuf, ptynm, ptyno);
-  if (chown (nmbuf, 0, 0) == ERROR)
+# ifndef HAVE_PTSNAME
+  if (chown (tty_master, 0, 0) == ERROR)
     {
-      perror (prog);
+      perror ("Can't restore owner of tty_master.");
     }
-  if (chmod (nmbuf, 0666) == ERROR)
+  if (chmod (tty_master, 0666) == ERROR)
     {
-      perror (prog);
+      perror ("Can't restore permission of tty_master.");
     }
 
-  ptyname (nmbuf, ttypnm, ptyno);
-  if (chown (nmbuf, 0, 0) == ERROR)
+  if (chown (tty_slave, 0, 0) == ERROR)
     {
-      perror (prog);
+      perror ("Can't restore owner of ttyp.");
     }
-  if (chmod (nmbuf, 0666) == ERROR)
+  if (chmod (tty_slave, 0666) == ERROR)
     {
-      perror (prog);
+      perror ("Can't restore permission of ttyp.");
     }
+# endif /* HAVE_PTSNAME */
 
 #endif /* !USE_LIBSPT && !sgi */
   close (ttyfd);
@@ -2027,18 +2138,18 @@ do_end ()
     spt_perror(NULL, r);
 #else
   close (ptyfd);
-#endif
+#endif /* USE_LIBSPT */
 
   chdir ("/tmp");               /* to avoid making too many mon.out files */
 
   KILLPG (child_id, SIGHUP);
-  exit (0);
+  _exit (0);
 }
 
 #if defined(uniosu)
 /** 仮名漢字変換を ioctl でオフした時の keyin に代わる関数 */
 int
-ioctl_off ()
+ioctl_off (void)
 {
   static unsigned char buf[BUFSIZ];
   int n;
@@ -2086,44 +2197,15 @@ ioctl_off ()
 }
 #endif /* defined(uniosu) */
 
-
-#if !defined(USE_LIBSPT) && !defined(sgi)
-static void
-ptyname (b, pty, no)
-     char *b, *pty;
-{
-/*
- * Change pseudo-devices.
- * Because FreeBSD's master pseudo-devices are pty[p-sP-S][0-9a-v].
- * Patched by Hidekazu Kuroki(hidekazu@cs.titech.ac.jp)         1996/8/20
- */
-#if (defined(BSD) && (BSD >= 199306))   /* 4.4BSD-Lite by Taoka */
-  sprintf (b, "%s%1c%1c", pty, "pqrsPQRS"[(no >> 5)], (((no & 0x1f) > 9) ? 'a' : '0') + (no & 0x1f));
-#else /* ! 4.4BSD-Lite */
-  sprintf (b, "%s%1c%1x", pty, 'p' + (no >> 4), no & 0x0f);
-  if (no < 0x10 * ('z' - 'p' + 1))
-    {
-      sprintf(b, "%s%1c%1x", pty, 'p' + (no >> 4), no & 0x0f);
-    }
-  else
-    {
-      no -= 0x10 * ('z' - 'p' + 1);
-      sprintf(b, "%s%1c%1x", pty, 'P' + (no >> 4), no & 0x0f);
-    }
-#endif /* ! 4.4BSD-Lite */
-}
-#endif /* !USE_LIBSPT && !sgi */
-
 static void
-default_usage ()
+default_usage (void)
 {
   fprintf (stderr, "%s: Bad -L option\n", prog);
   exit (0);
 }
 
 static void
-usage (optstr)
-     char *optstr;
+usage (char *optstr)
 {
   printf ("usage: prog %s by lang \"%s\"\n", optstr, lang_dir);
   exit (0);
@@ -2139,10 +2221,10 @@ intfnptr sigwinch;
 #endif /* SIGWINCH */
 
 static void
-save_signals ()
+save_signals (void)
 {
   sigpipe = signal (SIGPIPE, SIG_IGN);
-#ifdef USE_LINUX_TERM			    /* XXX */
+#ifdef linux                    /* XXX */
   sighup = signal (SIGHUP, SIG_IGN);
 #endif
   sighup = signal (SIGHUP, terminate_handler);
@@ -2161,7 +2243,7 @@ save_signals ()
 }
 
 static void
-restore_signals ()
+restore_signals (void)
 {
   signal (SIGPIPE, sigpipe);
   signal (SIGHUP, sighup);
@@ -2179,14 +2261,13 @@ restore_signals ()
 #endif /* SIGTSTP */
 }
 
-/* should be "defined(SIGWINCH)"? */
 #if defined(BSD43) || defined(DGUX)
 static void
-setsize ()
+setsize (void)
 {
-  register int i;
+  int i;
   struct winsize win;
-  extern Term_LineWidth, Term_RowWidth, maxlength, crow;
+  extern int Term_LineWidth, Term_RowWidth, maxlength;
 
   if (ioctl (ttyfd, TIOCGWINSZ, &win) < 0)
     {
@@ -2209,11 +2290,11 @@ setsize ()
 
 #ifdef  SIGWINCH
 static void
-change_size ()
+change_size (void)
 {
   register int i;
   struct winsize win;
-  extern Term_LineWidth, Term_RowWidth, maxlength, crow;
+  extern int Term_LineWidth, Term_RowWidth, maxlength;
 
   if (ioctl (ttyfd, TIOCGWINSZ, &win) < 0)
     {

File Added: pkgsrc/inputmethod/canna/patches/patch-canuum_printf.c
$NetBSD: patch-canuum_printf.c,v 1.1 2015/10/18 03:58:31 tsutsui Exp $

Appease prototype warnings.

--- canuum/printf.c.orig	2003-01-04 07:31:02.000000000 +0000
+++ canuum/printf.c
@@ -29,8 +29,18 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
+#ifdef HAVE_CONFIG_H
+#  include <config.h>
+#endif
 
 #include <stdio.h>
+#if STDC_HEADERS
+#  include <string.h>
+#else
+#  if HAVE_STRINGS_H
+#    include <strings.h>
+#  endif
+#endif /* STDC_HEADERS */
 #include "commonhd.h"
 #include "sdefine.h"
 #include "sheader.h"

File Added: pkgsrc/inputmethod/canna/patches/patch-canuum_termcap.c
$NetBSD: patch-canuum_termcap.c,v 1.1 2015/10/18 03:58:31 tsutsui Exp $

Appease warnings.

--- canuum/termcap.c.orig	2004-04-26 21:48:37.000000000 +0000
+++ canuum/termcap.c
@@ -64,21 +64,21 @@ int Term_RowWidth;
 /*
 char    *Term_Bell;
 */
-char *Term_ClrScreen;
-char *Term_ClrEofLine;
+const char *Term_ClrScreen;
+const char *Term_ClrEofLine;
 char *Term_CleEndScreen;
-char *Term_ThrowCursor;
-char *Term_StandOutStart;       /* These variables has value even if terminfo is used. see termio.c. */
-char *Term_StandOutEnd;
+const char *Term_ThrowCursor;
+const char *Term_StandOutStart;       /* These variables has value even if terminfo is used. see termio.c. */
+const char *Term_StandOutEnd;
 static int bold_mode_fun;
-char *Term_BoldOutStart;
-char *Term_BoldOutEnd;
+const char *Term_BoldOutStart;
+const char *Term_BoldOutEnd;
 /*
 int     Term_StandOutBlankNum;
 char    *Term_DelChar;
 */
-char *Term_UnderScoreStart;
-char *Term_UnderScoreEnd;
+const char *Term_UnderScoreStart;
+const char *Term_UnderScoreEnd;
 
 char *Term_KeyPadOn;
 char *Term_KeyPadOff;

File Added: pkgsrc/inputmethod/canna/patches/patch-canuum_termio.c
$NetBSD: patch-canuum_termio.c,v 1.1 2015/10/18 03:58:31 tsutsui Exp $

- Appease prototype warnings.
- Reorganize curses ops.

--- canuum/termio.c.orig	2003-12-27 17:15:21.000000000 +0000
+++ canuum/termio.c
@@ -36,6 +36,11 @@
 #include <stdio.h>
 #if STDC_HEADERS
 #  include <stdlib.h>
+#  include <string.h>
+#else
+#  if HAVE_STRINGS_H
+#    include <strings.h>
+#  endif
 #endif /* STDC_HEADERS */
 
 #include "commonhd.h"
@@ -51,15 +56,15 @@
 extern int putchar ();
 
 extern char Term_Name[];
-extern char *Term_UnderScoreStart;
-extern char *Term_UnderScoreEnd;
-extern char *Term_ClrScreen;
-extern char *Term_ClrEofLine;
-extern char *Term_ThrowCursor;
-extern char *Term_StandOutStart;
-extern char *Term_StandOutEnd;
-extern char *Term_BoldOutStart;
-extern char *Term_BoldOutEnd;
+extern const char *Term_UnderScoreStart;
+extern const char *Term_UnderScoreEnd;
+extern const char *Term_ClrScreen;
+extern const char *Term_ClrEofLine;
+extern const char *Term_ThrowCursor;
+extern const char *Term_StandOutStart;
+extern const char *Term_StandOutEnd;
+extern const char *Term_BoldOutStart;
+extern const char *Term_BoldOutEnd;
 static int bold_mode_fun = 0;
 
 int
@@ -73,7 +78,7 @@ openTermData ()
   char errprefix[1024] = "error";
 
   /* for convert_key --- added by Nide 10/3 */
-  if (NULL == (cp = get_kbd_env ()) || 0 != convert_getterm (cp, (0 != verbose_option)))
+  if (NULL == initscr() || NULL == (cp = get_kbd_env ()) || 0 != convert_getterm (cp, (0 != verbose_option)))
     {
       fprintf (stderr, "Cannot get keyboard information.\n");
       return (-1);
@@ -96,13 +101,8 @@ openTermData ()
       return (-1);
     }
 #endif /* CANNA */
-  setupterm (0, 1, &status);
-  /* This seems needless and causes hangs on Solaris8 + ncurses */
-  /* reset_shell_mode (); */
-  if (status != 1)
-    {
-      return (-1);
-    }
+  reset_shell_mode();
+
 #if defined(uniosu)
   if (jterm < 2)
     {                           /* kanji terminal */
@@ -110,7 +110,7 @@ openTermData ()
       return (-1);
     }
 #endif /* defined(uniosu) */
-  if (save_cursor == (char *) NULL || *save_cursor == NULL || restore_cursor == (char *) NULL || *restore_cursor == NULL || change_scroll_region == (char *) NULL || *change_scroll_region == NULL)
+  if (save_cursor == (char *) NULL || *save_cursor == 0 || restore_cursor == (char *) NULL || *restore_cursor == 0 || change_scroll_region == (char *) NULL || *change_scroll_region == 0)
     {
       fprintf (stderr, "Your terminal is not strong enough. Goodbye !\n");
       return (-1);
@@ -175,7 +175,6 @@ openTermData ()
 void
 closeTermData ()
 {
-  resetterm ();
   reset_shell_mode ();
 }
 

File Added: pkgsrc/inputmethod/canna/patches/patch-cmd_cmd.tmpl
$NetBSD: patch-cmd_cmd.tmpl,v 1.1 2015/10/18 03:58:31 tsutsui Exp $

Add a hook to disable installation of unnecessary commands in canna-lib

--- cmd/cmd.tmpl.orig	2003-09-25 06:30:21.000000000 +0000
+++ cmd/cmd.tmpl
@@ -33,7 +33,9 @@ NormalProgramTarget($(TARGET),$(OBJS),$(
 # else
 NormalProgramTarget($(TARGET),$(OBJS),$(DEPRKINDEPLIB),$(RKINDEPLIB),)
 # endif
+# ifndef DontInstallProgram
 InstallProgram($(TARGET),$(cannaBinDir))
+# endif
 # ifdef ManSrcName
 InstallManPageLong(ManSrcName,$(cannaManDir),$(TARGET))
 # endif

File Added: pkgsrc/inputmethod/canna/patches/patch-lib_RKC_convert.c
$NetBSD: patch-lib_RKC_convert.c,v 1.1 2015/10/18 03:58:31 tsutsui Exp $

Tweak include path to build without configure in unnecessary dirs

--- lib/RKC/convert.c.orig	2004-04-26 21:48:37.000000000 +0000
+++ lib/RKC/convert.c
@@ -30,7 +30,7 @@ static char rcs_id[] = "$Id: convert.c,v
 #include "rkcw.h"
 #include "canna/RK.h"
 #include "rkc.h"
-#include "IRproto.h"
+#include "../server/IRproto.h"
 #include "RKindep/file.h"
 
 #include <sys/types.h>

File Added: pkgsrc/inputmethod/canna/patches/patch-lib_RK_dd.c
$NetBSD: patch-lib_RK_dd.c,v 1.1 2015/10/18 03:58:31 tsutsui Exp $

Fix "64 bit time_t on 32 bit architecture" problem.

--- lib/RK/dd.c.orig	2003-09-17 08:50:52.000000000 +0000
+++ lib/RK/dd.c
@@ -42,6 +42,12 @@ static char rcsid[]="$Id: dd.c,v 1.5 200
 #include <sys/types.h>
 #include <sys/stat.h>
 
+#ifdef HAVE_TIME_T
+#define TIME_T time_t
+#else
+#define TIME_T long
+#endif
+
 #define	Calloc		calloc
 #define cx_gwt		cx_extdata.ptr
 #define	STRCMP(d, s)	strcmp((char *)(d), (char *)(s))
@@ -742,7 +748,7 @@ _RkRealizeDD(dd)
   int ret = -1;
   int tmpres;
   int			fdes;
-  long		tloc;
+  TIME_T		tloc;
 #ifdef __EMX__
   struct stat		statbuf;
 #endif

File Added: pkgsrc/inputmethod/canna/patches/patch-lib_RK_ncache.c
$NetBSD: patch-lib_RK_ncache.c,v 1.1 2015/10/18 03:58:31 tsutsui Exp $

Fix crash problem of cannaserver.

--- lib/RK/ncache.c.orig	2003-09-17 08:50:52.000000000 +0000
+++ lib/RK/ncache.c
@@ -27,7 +27,7 @@ static char rcsid[]="$Id: ncache.c,v 1.2
 #include	"RKintern.h"
 
 #define	NCHASH		101
-#define	hash(x)		((int)((x)%NCHASH))
+#define	hash(x)		((int)(((unsigned long)(x))%NCHASH))
 
 static struct ncache	Nchash[NCHASH];
 static struct ncache	Ncfree;

File Deleted: pkgsrc/inputmethod/canna/patches/Attic/patch-aa

File Deleted: pkgsrc/inputmethod/canna/patches/Attic/patch-ab

File Deleted: pkgsrc/inputmethod/canna/patches/Attic/patch-ad

File Deleted: pkgsrc/inputmethod/canna/patches/Attic/patch-ae

File Deleted: pkgsrc/inputmethod/canna/patches/Attic/patch-af

File Deleted: pkgsrc/inputmethod/canna/patches/Attic/patch-ag

File Deleted: pkgsrc/inputmethod/canna/patches/Attic/patch-ah

File Deleted: pkgsrc/inputmethod/canna/patches/Attic/patch-ai

File Deleted: pkgsrc/inputmethod/canna/patches/Attic/patch-aj

File Deleted: pkgsrc/inputmethod/canna/patches/Attic/patch-ak

File Deleted: pkgsrc/inputmethod/canna/patches/Attic/patch-al

File Deleted: pkgsrc/inputmethod/canna/patches/Attic/patch-am

File Deleted: pkgsrc/inputmethod/canna/patches/Attic/patch-ao

File Deleted: pkgsrc/inputmethod/canna/patches/Attic/patch-ap

File Deleted: pkgsrc/inputmethod/canna/patches/Attic/patch-ac

File Deleted: pkgsrc/inputmethod/canna/patches/Attic/patch-an

cvs diff -r1.1 -r1.2 pkgsrc/inputmethod/canna/patches/patch-dic_phono_Imakefile (expand / switch to unified diff)

--- pkgsrc/inputmethod/canna/patches/patch-dic_phono_Imakefile 2012/07/03 17:44:39 1.1
+++ pkgsrc/inputmethod/canna/patches/patch-dic_phono_Imakefile 2015/10/18 03:58:31 1.2
@@ -1,17 +1,33 @@ @@ -1,17 +1,33 @@
1$NetBSD: patch-dic_phono_Imakefile,v 1.1 2012/07/03 17:44:39 joerg Exp $ 1$NetBSD: patch-dic_phono_Imakefile,v 1.2 2015/10/18 03:58:31 tsutsui Exp $
2 2
3--- dic/phono/Imakefile.orig 2012-06-17 06:10:27.000000000 +0000 3- Tweak canna-dict dirs
 4- avoid use of ${CPP} as generic preprocessor
 5
 6--- dic/phono/Imakefile.orig 2015-10-03 19:39:32.000000000 +0000
4+++ dic/phono/Imakefile 7+++ dic/phono/Imakefile
 8@@ -27,9 +27,9 @@
 9
 10 ROMAJI_DIC_DEF = -DSHIFT
 11
 12- DICDIR = $(cannaLibDir)/dic
 13- SAMPLEDIR = $(cannaLibDir)/sample
 14- SAMPLESRCDIR = $(cannaLibDir)/sample/src
 15+ DICDIR = $(DicDir)
 16+ SAMPLEDIR = $(DicDir)/sample
 17+ SAMPLESRCDIR = $(DicDir)/sample/src
 18
 19 KPDEF = default.kpdef jdaemon.kpdef just.kpdef kaisoku.kpdef kana.kpdef \
 20 lan5.kpdef matsu.kpdef newjis.kpdef romaji.kpdef sokuon.kpdef \
5@@ -54,16 +54,16 @@ AllTarget($(ROMKANA_TABLES)) 21@@ -54,16 +54,16 @@ AllTarget($(ROMKANA_TABLES))
6  22
7 #ifdef __EMX__ 23 #ifdef __EMX__
8 .kpdef.kp: 24 .kpdef.kp:
9- $(FORCPP) -7 < $< | $(CPP) $(ROMAJI_DIC_DEF) | $(FORCPP) -8 | $(KPDIC) > $@ 25- $(FORCPP) -7 < $< | $(CPP) $(ROMAJI_DIC_DEF) | $(FORCPP) -8 | $(KPDIC) > $@
10+ $(FORCPP) -7 < $< | tee ${.TARGET}.before | ${AWK} -f dic-phono-filter.awk | tee ${.TARGET}.after |$(FORCPP) -8 | $(KPDIC) > $@ 26+ $(FORCPP) -7 < $< | tee ${.TARGET}.before | ${AWK} -f dic-phono-filter.awk | tee ${.TARGET}.after |$(FORCPP) -8 | $(KPDIC) > $@
11  27
12 .kpdef.cbp: 28 .kpdef.cbp:
13- $(FORCPP) -7 < $< | $(CPP) $(ROMAJI_DIC_DEF) | $(FORCPP) -8 | $(KPDIC) > $@ 29- $(FORCPP) -7 < $< | $(CPP) $(ROMAJI_DIC_DEF) | $(FORCPP) -8 | $(KPDIC) > $@
14+ $(FORCPP) -7 < $< | tee ${.TARGET}.before | ${AWK} -f dic-phono-filter.awk | tee ${.TARGET}.after | $(FORCPP) -8 | $(KPDIC) > $@ 30+ $(FORCPP) -7 < $< | tee ${.TARGET}.before | ${AWK} -f dic-phono-filter.awk | tee ${.TARGET}.after | $(FORCPP) -8 | $(KPDIC) > $@
15 #else 31 #else
16 .kpdef.kp: 32 .kpdef.kp:
17- $(FORCPP) -7 < $< | $(CPP) $(ROMAJI_DIC_DEF) | $(FORCPP) -8 | $(KPDIC) > `basename $< '.kpdef'`.kp 33- $(FORCPP) -7 < $< | $(CPP) $(ROMAJI_DIC_DEF) | $(FORCPP) -8 | $(KPDIC) > `basename $< '.kpdef'`.kp