--- xitalk-1.1.11.orig/lib/system.xitalkrc
+++ xitalk-1.1.11/lib/system.xitalkrc
@@ -60,5 +60,5 @@
 CONFIGS_BEGIN
 #This file
 TITLE = Default xinitrc
-FILE = /usr/local/lib/system.xitalkrc
+FILE = /etc/xitalkrc
 CONFIGS_END
--- xitalk-1.1.11.orig/xitalk.c
+++ xitalk-1.1.11/xitalk.c
@@ -9,7 +9,6 @@
 extern char pty_name[12];
 extern char *tty;
 pid_t pid;
-pid_t pid2;
 
 response_struct *send_line_for_pattern_match (char *buf2, node * patterns)
     {
@@ -73,7 +72,6 @@
     {
     write_user_outof_utmp ();
     kill (pid, SIGTERM);
-    kill (pid2, SIGTERM);
     exit (0);
     }
 
--- xitalk-1.1.11.orig/debian/dirs
+++ xitalk-1.1.11/debian/dirs
@@ -0,0 +1,7 @@
+etc
+usr/bin
+usr/X11R6/bin
+usr/X11R6/man/man1
+usr/share/pixmaps/xitalk
+usr/share/sounds/xitalk
+usr/share/lintian/overrides
--- xitalk-1.1.11.orig/debian/control
+++ xitalk-1.1.11/debian/control
@@ -0,0 +1,16 @@
+Source: xitalk
+Maintainer: Chris Reed <cr212@iname.com>
+Section: x11
+Priority: optional
+Build-Depends: debhelper (>> 3.0.0), libxaw-dev, flex
+Standards-Version: 3.5.6
+
+Package: xitalk
+Architecture: any
+Depends: ${shlibs:Depends}
+Recommends: talk | ytalk
+Suggests: talkd
+Description: Talk intercept utility for X
+ xitalk logs you in on a pseudo terminal.  If you then disable messages in all
+ your xterms, xitalk will receive all talk requests/ writes.  It can then
+ start a [y]talk session, play a sound, etc.
--- xitalk-1.1.11.orig/debian/rules
+++ xitalk-1.1.11/debian/rules
@@ -0,0 +1,76 @@
+#!/usr/bin/make -f
+export DH_COMPAT=3
+
+build: build-stamp
+build-stamp:
+	dh_testdir
+	./configure --libdir=/usr/share/pixmaps
+	sed -e 's/#define HAVE_UTMPX_H/\/* #undef HAVE_UTMPX_H *\//' config.h > config.h.tmp
+	mv config.h.tmp config.h
+	make
+	cd dumb-write && make dwrite
+	touch build-stamp
+
+clean:
+	dh_testdir
+	dh_testroot
+	rm -f build-stamp
+	-make clean
+	cd regexp; make clean; cd ..
+	rm -f dumb-write/dwrite
+	rm -f config.cache config.status config.log Makefile config.h regexp/Makefile lex.yy.c
+	dh_clean
+
+install: build
+	dh_testdir
+	dh_testroot
+	dh_clean -k
+	dh_installdirs
+
+	install -g utmp -m 2755 xitalk debian/xitalk/usr/X11R6/bin
+	install -g tty -m 2755 dumb-write/dwrite debian/xitalk/usr/bin
+	install -m 644 xitalk.1 debian/xitalk/usr/X11R6/man/man1
+	install -m 644 lib/system.xitalkrc debian/xitalk/etc/xitalkrc
+	install -m 644 debian/lintian debian/xitalk/usr/share/lintian/overrides/xitalk
+
+	install -m 644 lib/mail.xbm debian/xitalk/usr/share/pixmaps/xitalk
+	install -m 644 lib/mail.xpm debian/xitalk/usr/share/pixmaps/xitalk
+	install -m 644 lib/talk.xbm debian/xitalk/usr/share/pixmaps/xitalk
+	install -m 644 lib/talk.xpm debian/xitalk/usr/share/pixmaps/xitalk
+	install -m 644 lib/wall.xbm debian/xitalk/usr/share/pixmaps/xitalk
+	install -m 644 lib/wall.xpm debian/xitalk/usr/share/pixmaps/xitalk
+	install -m 644 lib/write.xbm debian/xitalk/usr/share/pixmaps/xitalk
+	install -m 644 lib/write.xpm debian/xitalk/usr/share/pixmaps/xitalk
+	install -m 644 lib/xitalk.xbm debian/xitalk/usr/share/pixmaps/xitalk
+	install -m 644 lib/xitalk.xpm debian/xitalk/usr/share/pixmaps/xitalk
+
+	install -m 644 lib/ding.au debian/xitalk/usr/share/sounds/xitalk
+	install -m 644 lib/drumroll.au debian/xitalk/usr/share/sounds/xitalk
+	install -m 644 lib/message.au debian/xitalk/usr/share/sounds/xitalk
+	install -m 644 lib/glassbreak.snd debian/xitalk/usr/share/sounds/xitalk
+
+
+binary-arch: build install
+	dh_testdir
+	dh_testroot
+	dh_installdocs
+	dh_installmenu
+	dh_installman debian/dwrite.1
+	dh_installexamples lib/sample.xitalkrc lib/sample2.xitalkrc
+	dh_undocumented
+	dh_installchangelogs
+	dh_strip
+	dh_compress
+	dh_fixperms --exclude=xitalk --exclude=dwrite
+	dh_makeshlibs
+	dh_installdeb
+	dh_shlibdeps
+	dh_gencontrol
+	dh_md5sums
+	dh_builddeb
+
+source diff:                                                                  
+	@echo >&2 'source and diff are obsolete - use dpkg-source -b'; false
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary
--- xitalk-1.1.11.orig/debian/conffiles
+++ xitalk-1.1.11/debian/conffiles
@@ -0,0 +1 @@
+/etc/xitalkrc
--- xitalk-1.1.11.orig/debian/changelog
+++ xitalk-1.1.11/debian/changelog
@@ -0,0 +1,76 @@
+xitalk (1.1.11-9.1) unstable; urgency=low
+
+  * Non-maintainer upload
+  * Moved man page to /usr/share/man. Closes:#91097.
+  * Added Standards-Version and Build-Depends. Closes:#86926, Closes:#95190.
+  * Moved pixmaps to /usr/share/pixmaps/xitalk.
+  * Moved sample sounds to /usr/share/sounds/xitalk.
+
+ -- A Lee <alee@debian.org>  Wed, 21 Nov 2001 16:06:52 +0900
+
+xitalk (1.1.11-9) unstable; urgency=low
+
+  * Remove /usr/doc/xitalk/examples, as it shouldn't be there
+
+ -- Chris Reed <cr212@iname.com>  Sun,  5 Dec 1999 23:35:44 +0000
+
+xitalk (1.1.11-8) unstable; urgency=low
+
+  * Really fix maintainer e-mail address (change control file too...)
+
+ -- Chris Reed <cr212@iname.com>  Sun, 24 Oct 1999 18:37:14 +0100
+
+xitalk (1.1.11-7) unstable; urgency=low
+
+  * Fixed maintainer e-mail address.
+  * Build with more recent debhelper.
+
+ -- Chris Reed <cr212@iname.com>  Thu, 16 Sep 1999 22:43:31 +0100
+
+xitalk (1.1.11-6) unstable; urgency=low
+
+  * Modified debian/rules to make xitalk setuid after dh_fixperms, so it 
+    does end up setuid.  (Fixes #37463)
+
+ -- Chris Reed <cr212@cam.ac.uk>  Tue, 11 May 1999 11:59:27 +0100
+
+xitalk (1.1.11-5) unstable; urgency=low
+
+  * Included Christian <meder@isr.uni-stuttgart.de>'s patch for sparc 
+    (disable use of UTMPX because it's incompatible with glibc2.1) 
+    (Fixes #32818)
+  * Recompile against glibc 2.1
+  * Move /usr/X11R6/lib/xitalk to /usr/X11R6/lib/X11/xitalk (Fixes #33439)
+
+ -- Chris Reed <cr212@cam.ac.uk>  Sat,  8 May 1999 15:14:01 +0100
+
+xitalk (1.1.11-4) unstable; urgency=low
+
+  * Fixed bug wrt killing processes (Fixes #29681)
+  * Fixed declaration of strncpy in regexp/regsub.c (Fixes #29722)
+
+ -- Chris Reed <cr212@cam.ac.uk>  Thu, 19 Nov 1998 19:45:08 +0000
+
+xitalk (1.1.11-3) unstable; urgency=low
+
+  * Actually re-compile dwrite, thus removing libc5 dependency
+
+ -- Chris Reed <cr212@cam.ac.uk>  Thu, 30 Jul 1998 22:35:42 +0100
+
+xitalk (1.1.11-2) unstable; urgency=low
+
+  * Changed priority to optional
+
+ -- Chris Reed <cr212@cam.ac.uk>  Tue,  9 Jun 1998 02:04:44 +0100
+
+xitalk (1.1.11-1) unstable; urgency=low
+  
+  * Initial release
+  * Changed /usr/[local]/lib/system.xitalkrc to /etc/xitalkrc
+  * dwrite not included as it can cause inconvenience
+
+ -- Chris Reed <cr212@cam.ac.uk>  Thu, 30 Apr 1998 15:40:27 +0100
+
+Local variables:
+mode: debian-changelog
+End:
--- xitalk-1.1.11.orig/debian/lintian
+++ xitalk-1.1.11/debian/lintian
@@ -0,0 +1,2 @@
+xitalk: setgid-binary usr/bin/dwrite 2755 root/tty
+xitalk: setgid-binary usr/X11R6/bin/xitalk 2755 root/utmp
--- xitalk-1.1.11.orig/debian/dwrite.1
+++ xitalk-1.1.11/debian/dwrite.1
@@ -0,0 +1,110 @@
+.\" Copyright (c) 1989, 1993
+.\"	The Regents of the University of California.  All rights reserved.
+.\"
+.\" This code is derived from software contributed to Berkeley by
+.\" Jef Poskanzer and Craig Leres of the Lawrence Berkeley Laboratory.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\"    notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\"    notice, this list of conditions and the following disclaimer in the
+.\"    documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\"    must display the following acknowledgement:
+.\"	This product includes software developed by the University of
+.\"	California, Berkeley and its contributors.
+.\" 4. Neither the name of the University nor the names of its contributors
+.\"    may be used to endorse or promote products derived from this software
+.\"    without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\"     @(#)write.1	8.1 (Berkeley) 6/6/93
+.\"
+.Dd June 6, 1993
+.Dt WRITE 1
+.Os
+.Sh NAME
+.Nm dwrite
+.Nd send a message to another user
+.Sh SYNOPSIS
+.Nm dwrite
+.Ar user
+.Op Ar ttyname
+.Sh DESCRIPTION
+.Nm Write
+allows you to communicate with other users, by copying lines from
+your terminal to theirs.
+.Pp
+When you run the
+.Nm write
+command, the user you are writing to gets a message of the form:
+.Pp
+.Dl Message from yourname@yourhost on yourtty at hh:mm ...
+.Pp
+Any further lines you enter will be copied to the specified user's
+terminal.
+If the other user wants to reply, they must run
+.Nm write
+as well.
+.Pp
+When you are done, type an end-of-file or interrupt character.
+The other user will see the message
+.Ql EOF
+indicating that the
+conversation is over.
+.Pp
+You can prevent people (other than the super-user) from writing to you
+with the
+.Xr mesg 1
+command.
+Some commands, for example
+.Xr nroff 1
+and
+.Xr pr 1 ,
+disallow writing automatically, so that your output isn't overwritten.
+.Pp
+If the user you want to write to is logged in on more than one terminal,
+you can specify which terminal to write to by specifying the terminal
+name as the second operand to the
+.Nm write
+command.
+Alternatively, you can let
+.Nm write
+select one of the terminals \- it will pick the one with the shortest
+idle time.
+This is so that if the user is logged in at work and also dialed up from
+home, the message will go to the right place.
+.Pp
+The traditional protocol for writing to someone is that the string
+.Ql \-o ,
+either at the end of a line or on a line by itself, means that it's the
+other person's turn to talk.
+The string
+.Ql oo
+means that the person believes the conversation to be
+over.
+.Sh SEE ALSO
+.Xr mesg 1 ,
+.Xr talk 1 ,
+.Xr who 1
+.Sh HISTORY
+A
+.Nm
+command appeared in
+.At v6 .
+This is a dumbed down version from the xitalk package, and does not require
+to be run from a tty.  Thus you can use it in xitalkrc scripts.
--- xitalk-1.1.11.orig/debian/README.Debian
+++ xitalk-1.1.11/debian/README.Debian
@@ -0,0 +1,10 @@
+This package contains xitalk, a talk intercepter for X. To use effectively,
+
+i) Run it from your .xsession (or similar) 
+
+ii) Arrange for all xterms, etc. to not log in utmp, by passing them the -ut
+option or set the utmpInhibit resource to True
+
+iii) Or execute 'mesg n' in every xterm. (This is slightly harder if
+anything).
+
--- xitalk-1.1.11.orig/debian/copyright
+++ xitalk-1.1.11/debian/copyright
@@ -0,0 +1,7 @@
+This package was put together by Chris Reed <cr212@cam.ac.uk>, using source
+available at http://www.csn.ul.ie/~caolan/publink/X/xitalk/
+
+The upstream maintainer of xitalk is Charles Blake <cblake@ucsd.edu>.
+
+xitalk is copyrighted under the GPL, a copy of which can be found in
+/usr/share/common-licenses/GPL on debian systems.
--- xitalk-1.1.11.orig/Makefile.in
+++ xitalk-1.1.11/Makefile.in
@@ -1,3 +1,6 @@
+# Added Debian requirement of -g to CFLAGS
+# Chris Reed <cr212@cam.ac.uk> 30/4/98
+
 #COMPILE_FLAGS=-Wwrite-strings -Wall -Wstrict-prototypes
 #OPTOMIZE=-fomit-frame-pointer -O2
 
@@ -26,7 +29,7 @@
 mandir = @mandir@
 mylibdir = $(libdir)/xitalk
 
-CFLAGS = @CFLAGS@ @DEFS@ -DLIBDIR=\"$(mylibdir)\" -I. 
+CFLAGS = @CFLAGS@ @DEFS@ -DLIBDIR=\"$(mylibdir)\" -I.  -g
 
 MKINSTALLDIRS = $(srcdir)/mkinstalldirs
 
--- xitalk-1.1.11.orig/main.c
+++ xitalk-1.1.11/main.c
@@ -12,7 +12,6 @@
 extern char pty_name[12];
 extern char *tty;
 extern pid_t pid;
-extern pid_t pid2;
 
 int main (int argc, char **argv)
     {
@@ -25,60 +24,51 @@
 
     signal_handle (SIGCHLD, reaper);
 
-    if (pid < (pid_t) 0)
-        {
+    if(pipe(p))
+       	{
+       	fprintf(stderr, "Pipe failed.\n");
+       	return(-1);
+       	}
+    pid=fork();
+    if(pid==(pid_t) 0)
+      	{
+       	setuid(getuid());
+       	open_window (argc, argv, fd1, p[1]);
+       	}
+    else if(pid < (pid_t) 0)
+       	{
         /* The fork failed. */
         fprintf (stderr, "Fork failed.\n");
         return (-1);
         }
-    else
-        {
-        if(pipe(p))
-        	{
-        	fprintf(stderr, "Pipe failed.\n");
-        	return(-1);
-        	}
-        pid2=fork();
-        if(pid2==(pid_t) 0)
-        	{
-        	setuid(getuid());
-        	open_window (argc, argv, fd1, p[1]);
-        	}
-        else if(pid2 < (pid_t) 0)
-        	{
-	        /* The fork failed. */
-	        fprintf (stderr, "Fork failed.\n");
-	        return (-1);
-	        }
-	else    
-	    	{
-        	char throwaway[255];
-        	int i=0;
-        	do
-        		{
-        		if(read(p[0], &throwaway[i], 1))
-        			i++;
-        		if(i>255) {
-        			throwaway[255]=0;
-        			break;
-        			}
-        		} while(throwaway[i-1]);
-        	write_user_into_utmp (throwaway);
-	        /* :-) */
-	        signal_handle (SIGQUIT, write_user_outof_utmp_and_quit);
-	        signal_handle (SIGTERM, write_user_outof_utmp_and_quit);
-		signal_handle (SIGSEGV, write_user_outof_utmp_and_quit); 
-	        signal_handle (SIGHUP, write_user_outof_utmp_and_quit);
-        	signal_handle (SIGINT, write_user_outof_utmp_and_quit);
-        	signal_handle (SIGPIPE, write_user_outof_utmp_and_quit);
-        	signal_handle (SIGINT, write_user_outof_utmp_and_quit);
-        	signal_handle (SIGCHLD, write_user_outof_utmp_and_quit);
-        	signal_handle (SIGALRM, SIG_IGN);
-        	/* wheee */
-        	pause();
-        	write_user_outof_utmp_and_quit(15);
-        	}
-        }
+    else    
+    	{
+       	char throwaway[255];
+       	int i=0;
+       	do
+       		{
+       		if(read(p[0], &throwaway[i], 1))
+       			i++;
+       		if(i>255) {
+       			throwaway[255]=0;
+       			break;
+       			}
+       		} while(throwaway[i-1]);
+       	write_user_into_utmp (throwaway);
+        /* :-) */
+        signal_handle (SIGQUIT, write_user_outof_utmp_and_quit);
+        signal_handle (SIGTERM, write_user_outof_utmp_and_quit);
+	signal_handle (SIGSEGV, write_user_outof_utmp_and_quit); 
+        signal_handle (SIGHUP, write_user_outof_utmp_and_quit);
+       	signal_handle (SIGINT, write_user_outof_utmp_and_quit);
+       	signal_handle (SIGPIPE, write_user_outof_utmp_and_quit);
+       	signal_handle (SIGINT, write_user_outof_utmp_and_quit);
+       	signal_handle (SIGCHLD, write_user_outof_utmp_and_quit);
+       	signal_handle (SIGALRM, SIG_IGN);
+       	/* wheee */
+       	pause();
+      	write_user_outof_utmp_and_quit(15);
+       	}
     return (0);
     }
 
--- xitalk-1.1.11.orig/regexp/regsub.c
+++ xitalk-1.1.11/regexp/regsub.c
@@ -22,6 +22,11 @@
 #include <config.h>
 
 #include <stdio.h>
+
+/* For strncpy */
+
+#include <string.h>
+
 #include <regexp.h>
 #include "regmagic.h"
 
@@ -45,7 +50,6 @@
 	register char c;
 	register int no;
 	register int len;
-	extern char *strncpy();
 
 	if (prog == NULL || source == NULL || dest == NULL) {
 		regerror("NULL parm to regsub");
--- xitalk-1.1.11.orig/xwin.c
+++ xitalk-1.1.11/xwin.c
@@ -793,8 +793,8 @@
     	if (i <= 0)
 		{
 		free(filename);
-		filename = (char *) malloc(strlen (LIBDIR) + strlen("system.xitalkrc") +2);
-		sprintf(filename,"%s/system.xitalkrc",LIBDIR);
+		filename = (char *) malloc(strlen ("/etc") + strlen("xitalkrc") +2);
+		sprintf(filename,"%s/xitalkrc","/etc");
 		i = unpriv_open(filename,R_OK);
 		}
 
