summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhrs <hrs@FreeBSD.org>2013-05-05 15:53:04 +0000
committerhrs <hrs@FreeBSD.org>2013-05-05 15:53:04 +0000
commita7293a2ec74dd6a5473f8ee82b9bb88c3e813d64 (patch)
treef5a93b795cdf7846d17f91ddacdef65b64d247e9
parenta5f331f5aaecbc09bbbc4e2d64e1ac62a4cdb728 (diff)
downloadFreeBSD-ports-a7293a2ec74dd6a5473f8ee82b9bb88c3e813d64.zip
FreeBSD-ports-a7293a2ec74dd6a5473f8ee82b9bb88c3e813d64.tar.gz
- Fix fork() and select() in skkserv. It didn't work properly.
- Trim old-style header.
-rw-r--r--japanese/skkserv/Makefile13
-rw-r--r--japanese/skkserv/files/patch-skkserv.c124
-rw-r--r--japanese/skkserv/files/patch-skkserv.h5
-rw-r--r--japanese/skkserv/pkg-descr7
4 files changed, 130 insertions, 19 deletions
diff --git a/japanese/skkserv/Makefile b/japanese/skkserv/Makefile
index d03bb72..f1f2583 100644
--- a/japanese/skkserv/Makefile
+++ b/japanese/skkserv/Makefile
@@ -1,13 +1,9 @@
-# New ports collection makefile for: skkserv
-# Date created: 31 Oct 1998
-# Whom: Shigeyuki FUKUSHIMA <shige@kuis.kyoto-u.ac.jp>
-#
+# Created by: Shigeyuki FUKUSHIMA <shige@kuis.kyoto-u.ac.jp>
# $FreeBSD$
-#
PORTNAME= skkserv
PORTVERSION= 9.6
-PORTREVISION= 4
+PORTREVISION= 5
CATEGORIES= japanese
MASTER_SITES= ${MASTER_SITE_PORTS_JP}
DISTNAME= skk${PORTVERSION}
@@ -20,8 +16,9 @@ RUN_DEPENDS= ${LOCALBASE}/share/skk/${SKKJISYO}:${PORTSDIR}/japanese/skk-jisyo
USE_RC_SUBR= skkserv
WRKSRC= ${WRKDIR}/skk-${PORTVERSION}
GNU_CONFIGURE= yes
+CONFIGURE_ARGS+=--with-jisyo=${SKKJISYO} \
+ --libexecdir=${PREFIX}/sbin
MAKE_ARGS= SUBDIRS='skkserv'
-CONFIGURE_ARGS+= --with-jisyo=${SKKJISYO} --libexecdir=${PREFIX}/sbin
PLIST_FILES= sbin/skkserv
USERS= skkserv
GROUPS= skkserv
@@ -30,6 +27,6 @@ SKKJISYO_SIZE?= L
SKKJISYO?= SKK-JISYO.${SKKJISYO_SIZE}
do-install:
- @${INSTALL_PROGRAM} ${WRKSRC}/skkserv/skkserv ${PREFIX}/sbin
+ ${INSTALL_PROGRAM} ${WRKSRC}/skkserv/skkserv ${PREFIX}/sbin
.include <bsd.port.mk>
diff --git a/japanese/skkserv/files/patch-skkserv.c b/japanese/skkserv/files/patch-skkserv.c
index 665b8d8..2b3cdd3 100644
--- a/japanese/skkserv/files/patch-skkserv.c
+++ b/japanese/skkserv/files/patch-skkserv.c
@@ -1,5 +1,5 @@
--- skkserv/skkserv.c.orig 1997-01-21 04:16:36.000000000 +0900
-+++ skkserv/skkserv.c 2011-07-02 23:48:44.000000000 +0900
++++ skkserv/skkserv.c 2013-05-06 00:49:10.000000000 +0900
@@ -102,6 +102,8 @@
#define err(m) \
@@ -87,7 +87,42 @@
set_hname();
/* make socket */
-@@ -232,9 +270,11 @@
+@@ -192,8 +230,18 @@
+ mkjtab();
+
+ if (!debug) {
++ pid_t pid;
+ /* parent process exits now */
+- if (fork() != 0) exit(0);
++ pid = fork();
++ if (pid != 0) {
++ if (pid == -1)
++ err("fork");
++ exit(0);
++ }
++ /* child process */
++#ifdef __FreeBSD__
++ daemon(0, 0);
++#else
+
+ fclose(stdin);
+ fclose(stdout);
+@@ -215,6 +263,7 @@
+ signal(SIGHUP, SIG_IGN);
+ if (fork() != 0) exit(0);
+ #endif
++#endif
+ } else { /* debug mode */
+ fprintf(errout, "SKK-JISYO is %s\n", jname);
+ fflush(errout);
+@@ -226,15 +275,18 @@
+ /* 1993/6/5 by kam, re-read dictionary by "INT" signal */
+
+ nclients = 0;
++ fprintf(errout, "leave main\n");
+ main_loop();
+ }
+
showusage()
{
fprintf(stderr,
@@ -101,7 +136,7 @@
exit(1);
}
-@@ -249,27 +289,41 @@
+@@ -249,27 +301,41 @@
bzero((char*)&sin, sizeof(sin));
sin.sin_family = AF_INET;
@@ -149,7 +184,7 @@
if (debug) {
fprintf(errout, "file descriptor for initsock is %d\n", initsock);
fflush(errout);
-@@ -382,6 +436,10 @@
+@@ -382,6 +448,10 @@
code = KANA_END;
while ((c = fgetc(jisho)) != EOF) {
@@ -160,7 +195,39 @@
target = ((c & 0xff)<< 8) | (fgetc(jisho) & 0xff);
if (target == STRMARK) {
fgets(buf, BUFSIZE, jisho);
-@@ -476,7 +534,7 @@
+@@ -452,10 +522,17 @@
+ * server main loop
+ */
+
++struct rfds {
++ fd_set fds;
++ int maxfd;
++};
++
++struct rfds getrfds(void);
++
+ main_loop()
+ {
++ struct rfds r;
+ fd_set readfds, writefds, exceptfds;
+- fd_set getrfds();
+ struct sockaddr_in from;
+ int len;
+ register int i;
+@@ -463,8 +540,10 @@
+ FD_ZERO(&writefds);
+ FD_ZERO(&exceptfds);
+ for(;;) { /* infinite loop; waiting for client's request */
+- readfds = getrfds();
+- if (select(MAXDTAB, &readfds, &writefds, &exceptfds, NULL) < 0) {
++ r = getrfds();
++ fprintf(errout, "before select: r.maxfd = %d\n", r.maxfd);
++ readfds = r.fds;
++ if (select(r.maxfd + 1, &readfds, &writefds, &exceptfds, NULL) < 0) {
+ if (errno == EINTR) /* if signal happens */
+ continue;
+ err("select error; something wrong happened with the socket");
+@@ -476,7 +555,7 @@
if (FD_ISSET(initsock, &readfds)) {
len = sizeof(from);
@@ -169,3 +236,50 @@
err("accept error; something wrong happened with the socket");
}
if (nclients >= MAXDTAB - 3 - debug * 2) {
+@@ -498,10 +577,12 @@
+
+ if (debug) {
+ fprintf(errout, "number of clients %d\n", nclients);
+- fprintf(errout, "file descriptors of clients are :");
++ if (nclients) {
++ fprintf(errout, "file descriptors of clients are:");
+ for (i = 0; i < nclients; i ++)
+- fprintf(errout, "%d:", clientsock[i]);
++ fprintf(errout, " %d%s", clientsock[i], (i < nclients - 1) ? "," : "");
+ fputs("\n", errout);
++ }
+ fflush(errout);
+ }
+ }
+@@ -511,16 +592,24 @@
+ * get bit pattern of read file descriptor
+ */
+
+-fd_set getrfds()
++struct rfds
++getrfds(void)
+ {
+- fd_set rfds;
++ struct rfds r;
+ register int i;
+
+- FD_ZERO(&rfds);
+- FD_SET(initsock, &rfds);
+- for (i = 0; i < nclients; i ++)
+- FD_SET(clientsock[i], &rfds);
+- return (rfds);
++ FD_ZERO(&r.fds);
++ FD_SET(initsock, &r.fds);
++ r.maxfd = initsock;
++ for (i = 0; i < nclients; i ++) {
++ if (clientsock[i] > 0) {
++ FD_SET(clientsock[i], &r.fds);
++ if (clientsock[i] > r.maxfd)
++ r.maxfd = clientsock[i];
++ }
++ }
++
++ return (r);
+ }
+
+ /*
diff --git a/japanese/skkserv/files/patch-skkserv.h b/japanese/skkserv/files/patch-skkserv.h
index e6a6149..07a412f 100644
--- a/japanese/skkserv/files/patch-skkserv.h
+++ b/japanese/skkserv/files/patch-skkserv.h
@@ -1,5 +1,5 @@
--- skkserv/skkserv.h.orig 1997-01-21 04:16:36.000000000 +0900
-+++ skkserv/skkserv.h 2011-07-02 23:07:17.000000000 +0900
++++ skkserv/skkserv.h 2013-05-05 23:59:34.000000000 +0900
@@ -37,6 +37,8 @@
/* Necessary for SunOS 3.x and maybe other old systems */
@@ -9,7 +9,7 @@
#include <sys/types.h>
#ifdef HAVE_SYS_IOCTL_H
-@@ -44,9 +46,11 @@
+@@ -44,9 +46,12 @@
#endif
#include <sys/socket.h>
#include <netinet/in.h>
@@ -18,6 +18,7 @@
#include <signal.h>
#include <errno.h>
+#include <pwd.h>
++#include <unistd.h>
#ifndef DEFAULT_JISYO
#define DEFAULT_JISYO "/usr/local/share/emacs/SKK-JISYO.L"
diff --git a/japanese/skkserv/pkg-descr b/japanese/skkserv/pkg-descr
index 889d9ae..b7348cf 100644
--- a/japanese/skkserv/pkg-descr
+++ b/japanese/skkserv/pkg-descr
@@ -1,7 +1,6 @@
SKK (Simple Kana Kanji Convertor) is a very fast and efficient Japanese input
-method system, written in emacs-lisp. SKK runs on NEmacs (Japanized Emacs18),
-Mule (MULtilingual Emacs), and Demacs (DOS version of Emacs18/NEmacs).
-
-WWW: http://openlab.ring.gr.jp/skk/index.html
+method system, written in emacs-lisp.
This package is the skk-jisyo server.
+
+WWW: http://openlab.ring.gr.jp/skk/index.html
OpenPOWER on IntegriCloud