[Midnightbsd-cvs] mports: x11/luit: Added luit-1.0.2, Locale and ISO 2022 support for

ctriv at midnightbsd.org ctriv at midnightbsd.org
Thu Oct 4 01:24:47 EDT 2007


Log Message:
-----------
Added luit-1.0.2, Locale and ISO 2022 support for Unicode terminals

Added Files:
-----------
    mports/x11/luit:
        Makefile (r1.1)
        distinfo (r1.1)
        pkg-descr (r1.1)
    mports/x11/luit/files:
        patch-luit.c (r1.1)

-------------- next part --------------
--- /dev/null
+++ x11/luit/pkg-descr
@@ -0,0 +1,5 @@
+This package contains luit, a filter than can be run between an arbitrary
+application and a UTF-8 terminal emulator.
+
+- Joel Dahl
+joel at FreeBSD.org
--- /dev/null
+++ x11/luit/Makefile
@@ -0,0 +1,38 @@
+# New ports collection makefile for:	luit
+# Date Created:				17 Feb 2006
+# Whom:					Florent Thoumie <flz at FreeBSD.org>
+#
+# $FreeBSD: ports/x11/luit/Makefile,v 1.2 2007/06/02 20:03:29 rafan Exp $
+# $MidnightBSD: mports/x11/luit/Makefile,v 1.1 2007/10/04 05:24:44 ctriv Exp $
+#
+
+PORTNAME=	luit
+PORTVERSION=	1.0.2
+CATEGORIES=	x11
+
+MAINTAINER=	ports at MidnightBSD.org
+COMMENT=	Locale and ISO 2022 support for Unicode terminals
+LICENSE=	x11
+
+XORG_CAT=	app
+USE_XORG=	x11 fontenc
+
+PLIST_FILES=	bin/luit
+
+MAN1=		luit.1
+
+.if !defined(WITH_SETUID_LUIT)
+pre-everything::
+	@${ECHO_MSG} "If you want to use xterm with locales in a secure manner, luit must be"
+	@${ECHO_MSG} "installed setuid.  If you want to do this, define WITH_SETUID_LUIT when"
+	@${ECHO_MSG} "installing this port (either in /etc/make.conf or on command line with"
+	@${ECHO_MSG} "install target)."
+.endif
+
+post-install:
+.if defined(WITH_SETUID_LUIT)
+	${CHOWN} root:wheel ${PREFIX}/bin/luit
+	${CHMOD} 04711 ${PREFIX}/bin/luit
+.endif
+
+.include <bsd.port.mk>
--- /dev/null
+++ x11/luit/distinfo
@@ -0,0 +1,3 @@
+MD5 (xorg/app/luit-1.0.2.tar.bz2) = aacda46598ce3af8ca16e2a8132db1b2
+SHA256 (xorg/app/luit-1.0.2.tar.bz2) = c0c4d76df0350c626df7ce62bf3df7915f9959557d76abce96222857d782389c
+SIZE (xorg/app/luit-1.0.2.tar.bz2) = 99235
--- /dev/null
+++ x11/luit/files/patch-luit.c
@@ -0,0 +1,175 @@
+--- luit-1.0.2/luit.c	Wed Nov  8 22:21:35 2006
++++ luit.c	Sun May 20 00:51:20 2007
+@@ -45,6 +45,8 @@
+ #include "charset.h"
+ #include "iso2022.h"
+ 
++static int p2c_waitpipe[2];
++static int c2p_waitpipe[2];
+ static Iso2022Ptr inputState = NULL, outputState = NULL;
+ 
+ static char *child_argv0 = NULL;
+@@ -434,17 +436,6 @@
+     return 0;
+ }
+         
+-static void
+-sigwinchHandler(int sig)
+-{
+-    sigwinch_queued = 1;
+-}
+-
+-static void
+-sigchldHandler(int sig)
+-{
+-    sigchld_queued = 1;
+-}
+ 
+ static int
+ condom(int argc, char **argv)
+@@ -455,7 +446,6 @@
+     char *path;
+     char **child_argv;
+     int rc;
+-    int val;
+ 
+     rc = parseArgs(argc, argv, child_argv0,
+                    &path, &child_argv);
+@@ -473,30 +463,9 @@
+         perror("Couldn't drop priviledges");
+         exit(1);
+     }
+-#ifdef SIGWINCH
+-    installHandler(SIGWINCH, sigwinchHandler);
+-#endif
+-    installHandler(SIGCHLD, sigchldHandler);
+-
+-    rc = copyTermios(0, pty);
+-    if(rc < 0)
+-        FatalError("Couldn't copy terminal settings\n");
+-
+-    rc = setRawTermios();
+-    if(rc < 0)
+-        FatalError("Couldn't set terminal to raw\n");
+-
+-    val = fcntl(0, F_GETFL, 0);
+-    if(val >= 0) {
+-        fcntl(0, F_SETFL, val | O_NONBLOCK);
+-    }
+-    val = fcntl(pty, F_GETFL, 0);
+-    if(val >= 0) {
+-        fcntl(pty, F_SETFL, val | O_NONBLOCK);
+-    }
+-
+-    setWindowSize(0, pty);
+ 
++    pipe(p2c_waitpipe);
++    pipe(c2p_waitpipe);
+     pid = fork();
+     if(pid < 0) {
+         perror("Couldn't fork");
+@@ -505,12 +474,12 @@
+ 
+     if(pid == 0) {
+         close(pty);
+-#ifdef SIGWINCH
+-        installHandler(SIGWINCH, SIG_DFL);
+-#endif
+-        installHandler(SIGCHLD, SIG_DFL);
++	close(p2c_waitpipe[1]);
++	close(c2p_waitpipe[0]);
+         child(line, path, child_argv);
+     } else {
++	close(p2c_waitpipe[0]);
++	close(c2p_waitpipe[1]);
+         free(child_argv);
+         free(path);
+         free(line);
+@@ -525,11 +494,11 @@
+ {
+     int tty;
+     int pgrp;
++    char tmp[10];
+ 
+     close(0);
+     close(1);
+     close(2);
+-
+     pgrp = setsid();
+     if(pgrp < 0) {
+         kill(getppid(), SIGABRT);
+@@ -541,6 +510,7 @@
+         kill(getppid(), SIGABRT);
+         exit(1);
+     }
++    write(c2p_waitpipe[1],"1",1);
+     
+     if(tty != 0)
+         dup2(tty, 0);
+@@ -552,22 +522,66 @@
+     if(tty > 2)
+         close(tty);
+     
++    read(p2c_waitpipe[0],tmp,1);
++    close(c2p_waitpipe[1]);
++    close(p2c_waitpipe[0]);
+     execvp(path, argv);
+     perror("Couldn't exec");
+     exit(1);
+ }
+ 
++static void
++sigwinchHandler(int sig) {
++    sigwinch_queued = 1;
++}
++
++static void
++sigchldHandler(int sig)
++{
++    sigchld_queued = 1;
++}
++
+ void
+ parent(int pid, int pty)
+ {
+     unsigned char buf[BUFFER_SIZE];
+     int i;
++    int val;
+     int rc;
++    char tmp[10];
+ 
++    read(c2p_waitpipe[0],tmp,1);
+     if(verbose) {
+         reportIso2022(outputState);
+     }
+ 
++#ifdef SIGWINCH
++    installHandler(SIGWINCH, sigwinchHandler);
++#endif
++    installHandler(SIGCHLD, sigchldHandler);
++
++    rc = copyTermios(0, pty);
++    if(rc < 0)
++        FatalError("Couldn't copy terminal settings\n");
++
++    rc = setRawTermios();
++    if(rc < 0)
++        FatalError("Couldn't set terminal to raw\n");
++
++    val = fcntl(0, F_GETFL, 0);
++    if(val >= 0) {
++        fcntl(0, F_SETFL, val | O_NONBLOCK);
++    }
++    val = fcntl(pty, F_GETFL, 0);
++    if(val >= 0) {
++        fcntl(pty, F_SETFL, val | O_NONBLOCK);
++    }
++
++    setWindowSize(0, pty);
++
++    write(p2c_waitpipe[1],"1",1);
++    close(c2p_waitpipe[0]);
++    close(p2c_waitpipe[1]);
+     for(;;) {
+         rc = waitForInput(0, pty);
+ 


More information about the Midnightbsd-cvs mailing list