diff options
author | Florent Thoumie <flz@FreeBSD.org> | 2007-05-19 20:36:56 +0000 |
---|---|---|
committer | Florent Thoumie <flz@FreeBSD.org> | 2007-05-19 20:36:56 +0000 |
commit | d4f0d0048a8755106a4b0445221a19761e746984 (patch) | |
tree | c87184c5bfeaf942c827c5f706186ce9786a2588 /x11/luit | |
parent | e82affd309fc2d8e5ea19b2e003f1296920bd825 (diff) | |
download | ports-d4f0d0048a8755106a4b0445221a19761e746984.tar.gz ports-d4f0d0048a8755106a4b0445221a19761e746984.zip |
Notes
Diffstat (limited to 'x11/luit')
-rw-r--r-- | x11/luit/Makefile | 39 | ||||
-rw-r--r-- | x11/luit/distinfo | 3 | ||||
-rw-r--r-- | x11/luit/files/patch-luit.c | 175 | ||||
-rw-r--r-- | x11/luit/pkg-descr | 5 |
4 files changed, 222 insertions, 0 deletions
diff --git a/x11/luit/Makefile b/x11/luit/Makefile new file mode 100644 index 000000000000..d17bf9d77fc3 --- /dev/null +++ b/x11/luit/Makefile @@ -0,0 +1,39 @@ +# New ports collection makefile for: luit +# Date Created: 17 Feb 2006 +# Whom: Florent Thoumie <flz@FreeBSD.org> +# +# $FreeBSD$ +# + +PORTNAME= luit +PORTVERSION= 1.0.2 +PORTREVISION= 1 +CATEGORIES= x11 + +MAINTAINER= x11@FreeBSD.org +COMMENT= Locale and ISO 2022 support for Unicode terminals. + +XORG_CAT= app +USE_XORG= x11 fontenc + +PLIST_FILES= bin/luit + +CONFIGURE_ARGS= --with-localealiasfile=${LOCALBASE}/share/X11/locale/locale.alias + +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> diff --git a/x11/luit/distinfo b/x11/luit/distinfo new file mode 100644 index 000000000000..092103b77a7f --- /dev/null +++ b/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 diff --git a/x11/luit/files/patch-luit.c b/x11/luit/files/patch-luit.c new file mode 100644 index 000000000000..8a6e7412f00f --- /dev/null +++ b/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); + diff --git a/x11/luit/pkg-descr b/x11/luit/pkg-descr new file mode 100644 index 000000000000..0bed19e2c820 --- /dev/null +++ b/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@FreeBSD.org |