--- xxgdb-1.12.orig/debian/preinst
+++ xxgdb-1.12/debian/preinst
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+set -e
+
+# Remove xaw-wrappers stuff.
+if [ "$1" = upgrade ] && dpkg --compare-versions "$2" lt-nl 1.12-11; then
+	if [ "$2" = 1.12-10 ]; then
+		update-alternatives --remove xxgdb /usr/bin/xxgdb.real
+	else
+		update-alternatives --remove xxgdb /usr/X11R6/bin/xxgdb.real
+	fi
+
+	if [ -n "$(type -path update-xaw-wrappers)" ]; then
+		update-xaw-wrappers
+	fi
+fi
+
+#DEBHELPER#
--- xxgdb-1.12.orig/debian/rules
+++ xxgdb-1.12/debian/rules
@@ -0,0 +1,101 @@
+#!/usr/bin/make -f
+# Sample debian/rules that uses debhelper.
+# This file is public domain software, originally written by Joey Hess. 
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+CFLAGS = -Wall -g
+ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
+CFLAGS += -O0
+else
+CFLAGS += -O2
+endif
+
+export CC = gcc
+
+build: build-stamp
+build-stamp: patch
+	dh_testdir
+
+	# Add here commands to compile the package.
+	xmkmf -a
+	$(MAKE) CDEBUGFLAGS='$(CFLAGS) -DUNIX98' \
+		ICELIB= EXTENSIONLIB= SMLIB= XMULIB= LIBDIR=/usr/lib
+	sed '1,/XXGDB history/d;/------------/d' XXGDB_README \
+		> debian/upstream.changelog
+	touch build-stamp
+
+clean: clean1 unpatch
+clean1:
+	dh_testdir
+	dh_testroot
+	dh_prep
+	dh_clean debian/upstream.changelog
+
+	# Add here commands to clean up after the build process.
+	test ! -f Makefile || { $(MAKE) clean && rm Makefile; }
+
+install: build-stamp
+	dh_testdir
+	dh_testroot
+	dh_prep
+	dh_installdirs usr/share/pixmaps/
+
+	# Add here commands to install the package into debian/<packagename>
+	install -o root -g root -m 644 debian/mini.debug.xpm debian/xxgdb/usr/share/pixmaps/
+	$(MAKE) DESTDIR=`pwd`/debian/xxgdb \
+		BINDIR=/usr/bin LIBDIR=/usr/lib install \
+		MANPATH=/usr/share/man MANSUFFIX=1 install.man
+
+# Build architecture-independent files here.
+binary-indep: build install
+# We have nothing to do by default.
+
+# Build architecture-dependent files here.
+binary-arch: build install
+	dh_testdir
+	dh_testroot
+#	dh_installdebconf	
+	dh_installdocs README README.NEW_INTERFACE XXGDB_README XDBX_README
+	dh_installexamples
+	dh_installmenu
+#	dh_installlogrotate
+#	dh_installemacsen
+#	dh_installpam
+#	dh_installmime
+#	dh_installinit
+	dh_installcron
+	dh_installman
+	dh_installinfo
+#	dh_undocumented
+	dh_installchangelogs debian/upstream.changelog
+	dh_link
+	dh_strip
+	dh_compress
+	dh_fixperms
+#	dh_makeshlibs
+	dh_installdeb
+#	dh_perl
+	dh_shlibdeps
+	dh_gencontrol
+	dh_md5sums
+	dh_builddeb
+
+
+# And now the simple things for dpatch. Here we only apply/unapply the patches.
+# You can do more things with dpatch, like having patches only applied on
+# a special architecture - see the non-dh version of the sample for this!
+patch: patch-stamp
+patch-stamp:
+	dpatch apply-all
+	dpatch cat-all >patch-stamp
+	touch patch-stamp
+
+unpatch:
+	dpatch deapply-all
+	rm -rf patch-stamp debian/patched
+
+binary: binary-indep binary-arch
+.PHONY: binary clean binary-indep binary-arch build install patch unpatch \
+	clean1
--- xxgdb-1.12.orig/debian/README.Debian
+++ xxgdb-1.12/debian/README.Debian
@@ -0,0 +1,28 @@
+xxgdb for DEBIAN
+----------------------
+
+This is a non-maintainer release, done just to fix things up a bit so
+that xxgdb can be built directly from source.  Also, I moved the package
+over to using debhelper; this included writing my own debhelper program,
+dh_installxaw, to install xaw-wrappers files.  It's included in the
+debian/ directory of the source distribution.
+
+The original maintainer hasn't actually uploaded a new package in a good
+long time, so perhaps this should be considered orphaned.
+
+I changed the source most times it used an #ifdef SYSV so that the
+code now tests for more reasonable #ifdef names - presumably someone could
+finish the job and convert this over to autoconf.  Among other things,
+this means that a patch to the X include files is no longer necessary
+to get xxgdb to build.
+
+If someone is looking at this later and wondering if linux architectures
+really need all the -D notations, well, maybe not.  The fact is that all
+the -DHAVE_* constants in the Imakefile reflect reality, so I saw little
+harm in defining them.  Also, the -DNO_SCANDIR is necessary because,
+although glibc does include scandir, it does not allow for modification
+of the filenames as the xxgdb code which uses scandir would like to do.
+Also, the struct dirent used in scandir does not contain the d_namlen
+element, which causes that code to fail to compile.
+
+Daniel Martin <fizbin@debian.org>, Sun, 24 Jan 1999 10:43:17 -0500
--- xxgdb-1.12.orig/debian/mini.debug.xpm
+++ xxgdb-1.12/debian/mini.debug.xpm
@@ -0,0 +1,27 @@
+/* XPM */
+static char *mini[] = {
+/* width height num_colors chars_per_pixel */
+"    16    14        6            1",
+/* colors */
+". c #b2b2b2",
+"# c #000000",
+"a c #ff0000",
+"b c #cccccc",
+"c c #7f7f7f",
+"d c #ffffff",
+/* pixels */
+"......#####.....",
+"....##a...a##...",
+"...##..aaa..##..",
+"..##.baaaaa####.",
+"..###cadaa##..#.",
+".##.##daa##ac.##",
+".##.a##a##aaa.##",
+".#.aaa###aaaaa.#",
+".##.aa####aaa.##",
+".##aa##ab##aca##",
+"..#.##aaba##..#.",
+"..###baabaa####.",
+"...##..aca..##..",
+".....#######...."
+};
--- xxgdb-1.12.orig/debian/control
+++ xxgdb-1.12/debian/control
@@ -0,0 +1,15 @@
+Source: xxgdb
+Section: devel
+Priority: optional
+Maintainer: Joey Schulze <joey@debian.org>
+Standards-Version: 3.8.4
+Build-Depends: debhelper (>= 7.1), dpatch, libxaw7-dev, libx11-dev,
+ libxt-dev, x11proto-core-dev, xutils-dev
+
+Package: xxgdb
+Architecture: any
+Depends: ${misc:Depends}, gdb, ${shlibs:Depends}
+Description: An X front-end to the GNU debugger gdb
+ xxgdb is a simple but powerful graphical interface to the GNU
+ debugger gdb.  A more powerful (but slower and much bigger) interface
+ is available in the ddd package.
--- xxgdb-1.12.orig/debian/compat
+++ xxgdb-1.12/debian/compat
@@ -0,0 +1 @@
+7
--- xxgdb-1.12.orig/debian/menu
+++ xxgdb-1.12/debian/menu
@@ -0,0 +1,2 @@
+?package(xxgdb): needs="X11" section="Applications/Programming" hints="Debuggers" \
+  title="X GNU Debugger" command="xxgdb" icon="/usr/share/pixmaps/mini.debug.xpm"
--- xxgdb-1.12.orig/debian/changelog
+++ xxgdb-1.12/debian/changelog
@@ -0,0 +1,215 @@
+xxgdb (1.12-17) unstable; urgency=low
+
+  * Import NMU
+  * Remove debian/upstream.changelog, create it dynamically
+  * Fix broken changelog handling
+  * Fix NMU patch xxgdb
+  * Remove README.source again, the use of dpatch is evident and
+    dpkg-source -x works well, thus no need for this optional file
+  * Adjust call to update-xaw-wrappers  
+
+ -- Joey Schulze <joey@infodrom.org>  Fri, 11 Jun 2010 20:58:08 +0200
+
+xxgdb (1.12-16.1) unstable; urgency=low
+
+  [ Jari Aalto ]
+  * Non-maintainer upload.
+    - Update to packaging format "3.0 (quilt)".
+  * debian/changelog
+    - Delete obsolete Emacs variables from the end.
+  * debian/compat
+    - Update to 7.
+  * debian/control
+    - (Build-Depends): update obsolete xutils to xutils-dev
+      and x-dev x11proto-core-dev (important; Closes: #515425).
+      Update to debhelper 7.1.
+    - (Depends): add ${misc:Depends}.
+    - (Standards-Version): update to 3.8.4.
+  * debian/copyright
+    - Write full upstream URL.
+  * debian/patches
+    - Convert dpatch into quilt.
+    - (Number 20): Fix manual page.
+  * debian/preinst
+    - Fix Lintian command-with-path-in-maintainer-script.
+  * debian/README.source
+    - New file.
+  * debian/preinst
+    - Arrange "set -e" differently for Lintian.
+  * debian/rules
+    - (CC): Add. Export variable for xmkmf(1).
+    - (DH_COMPAT): remove.
+    - (clean1, install): update dh_clean to dh_prep.
+      Add dh_clean.
+      Fix lintian debian-rules-ignores-make-clean-error.
+    - (get-changelog): New target.
+  * debian/source/format
+    - New file.
+  * debian/upstream.changelog
+    - New file. See debian/rule::get-changelog.
+  * debian/watch
+    - New file.
+
+ -- Jari Aalto <jari.aalto@cante.net>  Tue, 11 May 2010 10:57:37 +0300
+
+xxgdb (1.12-16) unstable; urgency=low
+
+  * Add dependency against xutils-dev, required after it was removed from
+    xutils (closes: Bug#485731)
+
+ -- Joey Schulze <joey@infodrom.org>  Wed, 11 Jun 2008 10:04:34 +0200
+
+xxgdb (1.12-15) unstable; urgency=low
+
+  * Converted package to dpatch
+  * Clean up code to make it -Wall clean [010-gcc-wall.dpatch]
+  * Stop linking against libICE, libXext, libSM and libXmu since they're
+    not used
+
+ -- Joey Schulze <joey@infodrom.org>  Sat, 17 May 2008 11:18:31 +0200
+
+xxgdb (1.12-14) unstable; urgency=low
+
+  * New maintainer
+  * Added support for GNU/kFreeBSD, thanks to Petr Salinger
+    <Petr.Salinger@seznam.cz> [005-kfreebsd.dpatch] (closes: Bug#398569)
+  * nroff corrections by Nicolas François
+    <nicolas.francois@centraliens.net> [006-nroff-fixes.dpatch] (closes: Bug#350502)
+  * Spelling improvements by Florian Zumbiehl <florz@gmx.de>
+    [debian/control] (closes: Bug#300051)
+  * Applied patch to sort file menu by Michael Kebe
+    <michael.kebe@gmail.com> [007-sort-filemenu.dpatch] (closes: Bug#480226)
+  * Bump Standards-Version
+  * Support Unix98 ptys, patch basis by Francesco Paolo Lovergine
+    <frankie@debian.org> [008-unix98-ptys.dpatch] (closes: Bug#150046, Bug#344644)
+  * Move Unix socket into home directory to prevent symlink attacks
+    [009-iowinttypid.dpatch]
+  * Adjusted menu section
+
+ -- Joey Schulze <joey@infodrom.org>  Fri, 16 May 2008 16:17:58 +0200
+
+xxgdb (1.12-13.2) unstable; urgency=high
+
+  * Non-maintainer upload.
+  * move pixmap out from /usr/X11R6/. Thanks to Andreas Henriksson.
+    Closes: #370203
+
+ -- Andreas Barth <aba@not.so.argh.org>  Tue, 12 Dec 2006 14:34:33 +0000
+
+xxgdb (1.12-13.1) unstable; urgency=high
+
+  * Non-maintainer upload.
+  * Split xlibs-dev build-dep (Closes: #346870).
+
+ -- Luk Claes <luk@debian.org>  Fri, 20 Jan 2006 17:29:39 +0100
+
+xxgdb (1.12-13) unstable; urgency=low
+
+  * Rebuilt to remove the /usr/doc symlink
+  * Color table for mini.debug.xpm now uses only the standard colors
+    in /usr/share/pixmaps/cmap.xpm
+  * Standard updated.
+
+ -- Francesco Paolo Lovergine <frankie@debian.org>  Fri, 13 Dec 2002 14:23:51 +0100
+
+xxgdb (1.12-12) unstable; urgency=high
+
+  * New maintainer.
+  * Editing now works correctly in dialogWindow. Changed dialog.c in order
+    to have DeleteWord() and DeleteLine() working good and introduced
+    a new function DeleteChar(). This should be caused by the new Xaw7
+    library, but there is no more an upstream to follow-up this error :(
+    [004-backspace.dpatch] (Closes: #130199)
+
+ -- Francesco Paolo Lovergine <frankie@debian.org>  Mon, 21 Jan 2002 13:55:44 +0100
+
+xxgdb (1.12-11) unstable; urgency=high
+
+  * QA upload.
+  * Added libxaw7-dev to Build-Depends.  Removed xaw-wrappers stuff.
+    Closes: #119096.
+  * Updated maintainer address to <packages@qa.debian.org>.
+  * Conforms to Standards version 3.5.6.
+  * debian/copyright: Updated upstream URL.
+
+ -- Matej Vela <vela@debian.org>  Thu, 15 Nov 2001 20:21:51 +0100
+
+xxgdb (1.12-10) unstable; urgency=medium
+
+  * Package is orphaned; maintainer set to Debian QA Group.
+  * Moved to debhelper 3 and current xaw-wrappers (>= 0.90).
+    Closes: #37114, #89700.
+  * Conforms to Standards version 3.5.2:
+    * xutils added to Build-Depends.  Closes: #90252.
+    * Install into /usr rather than /usr/X11R6.
+    * debian/rules: Support the `debug' build option.
+  * debian/mini.debug.xpm: Install into /usr/X11R6/include/X11/pixmaps
+    rather than /usr/share/icons.  Closes: #34950, #43563.
+  * debian/menu: Provide `hints="Debuggers"'.  Closes: #80069.
+  * calldbx.c: Use x-terminal-emulator [002-x-terminal.dpatch]
+  * debian/copyright: Updated.
+
+ -- Matej Vela <vela@debian.org>  Thu, 29 Mar 2001 17:32:18 +0200
+
+xxgdb (1.12-9.4) unstable; urgency=low
+
+  * Non-maintainer upload
+  * Fix dh_installxaw so that it tries to use Debian::Debhelper:Dh_Lib,
+    not just Dh_Lib.
+  * Applied patch from Sean 'Shaleh' Perry, adding Build-Depends
+  * Recompile for woody, which fixes the app-defaults issue (closes:
+    #86028)
+
+ -- Tollef Fog Heen <tfheen@debian.org>  Sat, 17 Mar 2001 17:10:28 +0100
+
+xxgdb (1.12-9.3) unstable; urgency=low
+
+  * Adjustments for alpha architecture
+
+ -- Daniel Martin <fizbin@debian.org>  Tue,  2 Feb 1999 08:35:19 -0600
+
+xxgdb (1.12-9.2) frozen unstable; urgency=low
+
+  * Can now be compiled from source (fixes #32206)
+  * Wraps xaw libraries (fixes #32207)
+  * Converted to debhelper
+  * Non-maintainer upload - this package should probably be orphaned
+
+ -- Daniel Martin <fizbin@debian.org>  Sun, 24 Jan 1999 02:33:20 -0500
+
+xxgdb (1.12-9.1) unstable; urgency=low
+
+  * Non-maintainer release.
+  * Libc6 compile.
+
+ -- Martin Mitchell <martin@debian.org>  Fri,  7 Nov 1997 18:49:09 +1100
+
+xxgdb (1.12-9) frozen unstable; urgency=low
+
+  * included  frozen (bo) to distribution
+
+ -- Helmut Geyer <Helmut.Geyer@iwr.uni-heidelberg.de>  Fri, 18 Apr 1997 01:03:03 +0200
+
+xxgdb (1.12-8) unstable; urgency=low
+
+  * added support for menu
+
+ -- Helmut Geyer <Helmut.Geyer@iwr.uni-heidelberg.de>  Sat, 5 Apr 1997 11:48:48 +0200
+
+xxgdb (1.12-7) unstable stable; urgency=low
+
+  * fixed documentation locations (Bug #6069)
+
+ -- Helmut Geyer <Helmut.Geyer@iwr.uni-heidelberg.de>  Wed, 19 Feb 1997 19:02:13 +0100
+
+xxgdb (1.12-6) unstable stable; urgency=low
+
+  * fixed debian/rules
+
+ -- Helmut Geyer <Helmut.Geyer@iwr.uni-heidelberg.de>  Sun, 6 Oct 1996 09:17:05 +0200
+
+xxgdb (1.12-5) unstable stable; urgency=LOW
+
+  * new source format
+
+ -- Helmut Geyer <Helmut.Geyer@iwr.uni-heidelberg.de>  Thu, 3 Oct 1996 11:49:52 +0200
--- xxgdb-1.12.orig/debian/watch
+++ xxgdb-1.12/debian/watch
@@ -0,0 +1,3 @@
+version=3
+ftp://ftp.x.org/contrib/utilities/xxgdb-([\d.]+).tar.gz
+
--- xxgdb-1.12.orig/debian/copyright
+++ xxgdb-1.12/debian/copyright
@@ -0,0 +1,105 @@
+This is Debian's prepackaged version of the X11 frontend xxgdb to the GNU
+debugger, gdb.
+
+This package was assembled by Helmut Geyer <Helmut.Geyer@iwr.uni-heidelberg.de>
+from the sources available from:
+
+     ftp://ftp.x.org/contrib/utilities/xxgdb-1.12.tar.gz
+
+/*****************************************************************************
+ *
+ *  xdbx - X Window System interface to the dbx debugger
+ *
+ *  Copyright 1989 The University of Texas at Austin
+ *  Copyright 1990 Microelectronics and Computer Technology Corporation
+ *
+ *  Permission to use, copy, modify, and distribute this software and its
+ *  documentation for any purpose and without fee is hereby granted,
+ *  provided that the above copyright notice appear in all copies and that
+ *  both that copyright notice and this permission notice appear in
+ *  supporting documentation, and that the name of The University of Texas
+ *  and Microelectronics and Computer Technology Corporation (MCC) not be 
+ *  used in advertising or publicity pertaining to distribution of
+ *  the software without specific, written prior permission.  The
+ *  University of Texas and MCC makes no representations about the 
+ *  suitability of this software for any purpose.  It is provided "as is" 
+ *  without express or implied warranty.
+ *
+ *  THE UNIVERSITY OF TEXAS AND MCC DISCLAIMS ALL WARRANTIES WITH REGARD TO
+ *  THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ *  FITNESS, IN NO EVENT SHALL THE UNIVERSITY OF TEXAS OR MCC BE LIABLE FOR
+ *  ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
+ *  RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
+ *  CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ *  CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ *  Author:  	Po Cheung
+ *  Created:   	March 10, 1989
+ * 
+ *****************************************************************************
+ * 
+ *  xxgdb - X Window System interface to the gdb debugger
+ *  
+ * 	Copyright 1990,1994 Thomson Consumer Electronics, Inc.
+ *  
+ *  Permission to use, copy, modify, and distribute this software and its
+ *  documentation for any purpose and without fee is hereby granted,
+ *  provided that the above copyright notice appear in all copies and that
+ *  both that copyright notice and this permission notice appear in
+ *  supporting documentation, and that the name of Thomson Consumer
+ *  Electronics (TCE) not be used in advertising or publicity pertaining
+ *  to distribution of the software without specific, written prior
+ *  permission.  TCE makes no representations about the suitability of
+ *  this software for any purpose.  It is provided "as is" without express
+ *  or implied warranty.
+ *
+ *  TCE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ *  ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+ *  SHALL TCE BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES
+ *  OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ *  WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ *  ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ *  SOFTWARE.
+ *
+ *  Adaptation to GDB:  Pierre Willard
+ *  XXGDB Created:   	December, 1990
+ *
+ *****************************************************************************
+ *
+ *  Modifications for use under System V
+ *
+ *      Copyright 1990 Bull Worldwide Information Systems, Inc.
+ *
+ *  Permission to use, copy, modify, and distribute this software and its
+ *  documentation for any purpose and without fee is hereby granted,
+ *  provided that the above copyright notice appear in all copies and that
+ *  both that copyright notice and this permission notice appear in
+ *  supporting documentation, and that the name of Bull Worldwide
+ *  Information Systems not be used in advertising or publicity pertaining
+ *  to distribution of the software without specific, written prior
+ *  permission.  Bull makes no representations about the suitability of
+ *  this software for any purpose.  It is provided "as is" without express
+ *  or implied warranty.
+ *
+ *  BULL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ *  ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+ *  SHALL BULL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES
+ *  OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ *  WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ *  ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ *  SOFTWARE.
+ *
+ *  Adaptation to SYSV: James Tsillas
+ *                      March, 1991
+ *
+ *****************************************************************************
+ *
+ *	Note that this software uses some files which are 
+ *  Copyright (C) 1985 Free Software Foundation, Inc.
+ *	See copyright header in regex.c and regex.h.
+ *
+ *****************************************************************************/
+
+The source of the Debian package is managed through CVS.  It is publicly
+available at <http://cvs.infodrom.org/xxgdb/?cvsroot=debian> or
+as <:pserver:anonymous@cvs.infodrom.org/var/cvs/debian/xxgdb/>.
--- xxgdb-1.12.orig/debian/patches/006-nroff-fixes.dpatch
+++ xxgdb-1.12/debian/patches/006-nroff-fixes.dpatch
@@ -0,0 +1,67 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 006-nroff-fixes.dpatch by Nicolas Francois <nicolas.francois@centraliens.net> 
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: nroff corrections
+
+@DPATCH@
+diff -urNad xxgdb-1.12~/xxgdb.man xxgdb-1.12/xxgdb.man
+--- xxgdb-1.12~/xxgdb.man	1996-10-02 10:59:45.000000000 +0200
++++ xxgdb-1.12/xxgdb.man	2008-05-16 17:40:25.000000000 +0200
+@@ -1,4 +1,4 @@
+-.TH XXGDB 1.10 "November 1994" "X Version 11"
++.TH XXGDB 1 "November 1994" "X Version 11"
+ .SH NAME
+ xxgdb \- X window system interface to the gdb debugger.
+ .SH SYNOPSIS
+@@ -34,16 +34,16 @@
+ \fIXxgdb\fP accepts all of the standard X Toolkit command line options 
+ (see \fIX\fP(1)), and all the gdb options (see \fIgdb\fP(1)), plus
+ the following xxgdb specific options:
+-.IP -db_name debuggername
++.IP "-db_name debuggername"
+ Specify the name of the debugger to override the default "gdb".
+ WARNING : by default prompt is the name of the debugger enclosed in
+ parenthesis followed by a space. So if the prompt is still "(gdb) ",
+ you HAVE TO use -db_prompt "gdb"
+-.IP -db_prompt promptstring
++.IP "-db_prompt promptstring"
+ Specify to xxgdb what is the debugger prompt. The default is to
+ expect the prompt to be the name of the debugger enclosed in
+ parenthesis followed by a space (eg, "(gdb) ").
+-.IP -i filename
++.IP "-i filename"
+ Specify the filename of initial gdb command file. The default
+ is ".gdbinit".
+ .IP -nx
+@@ -168,7 +168,7 @@
+ Print the arguments of the selected frame.
+ .IP "\fBshow display\fP"
+ Show the names of currently displayed expressions.
+-	.IP "\fBlocals\fP"
++.IP "\fBlocals\fP"
+ Print the local variables of the selected frame.
+ .IP "\fBstack\fP"
+ Print a backtrace of the entire stack.
+@@ -285,7 +285,7 @@
+ .IP \fBdisplayWindow\fP
+ If True, the display window appears on start up. (False)
+ .IP \fBdelimiters\fP
+-The set of delimiters for word selection. (" !%^&*()+=~|;:{},/#<?\"\n\t")
++The set of delimiters for word selection. (" !%^&*()+=~|;:{},/#<?\\"\\n\\t")
+ .IP \fBstop_color\fP
+ Color of the stop sign. (Red)
+ .IP \fBarrow_color\fP
+@@ -323,9 +323,12 @@
+ X(1), gdb(1)
+ .SH COPYRIGHT
+ Copyright 1989 The University of Texas at Austin.
++.br
+ Copyright 1990 Microelectronics and Computer Technology Corporation.
++.br
+ Copyright 1990-1994 Thomson Consumer Electronics, Inc.
+ .SH AUTHOR
+ Po Cheung.
++.br
+ Pierre Willard.
+ 
--- xxgdb-1.12.orig/debian/patches/009-iowinttypid.dpatch
+++ xxgdb-1.12/debian/patches/009-iowinttypid.dpatch
@@ -0,0 +1,70 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 009-iowinttypid.dpatch by Joey Schulze <joey@infodrom.org>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: Move Unix socket into home directory to prevent symlink attacks
+
+@DPATCH@
+diff -urNad xxgdb-1.12~/calldbx.c xxgdb-1.12/calldbx.c
+--- xxgdb-1.12~/calldbx.c	2008-05-16 17:50:07.000000000 +0200
++++ xxgdb-1.12/calldbx.c	2008-05-16 17:50:07.000000000 +0200
+@@ -232,7 +232,12 @@
+ void
+ create_io_window ()
+ {
+-    int pid = fork();
++    char sockname[FILENAME_MAX];
++    int pid;
++
++    snprintf(sockname, sizeof(sockname), "%s/%s", getenv("HOME"), "iowindowtty");
++
++    pid = fork();
+     if (pid == -1)
+     {
+ 	printf("unable to fork\n");
+@@ -245,12 +250,12 @@
+ 
+ 	sock = socket(AF_UNIX, SOCK_DGRAM, 0);
+ 	name.sun_family = AF_UNIX;
+-	strcpy(name.sun_path, "/tmp/iowindowtty");
++	strcpy(name.sun_path, sockname);
+ 	bind(sock, (struct sockaddr*)&name, sizeof(struct sockaddr_un));
+ 	read(sock, ttypid, 40);
+ 	sscanf(ttypid, "%[a-z/0-9],%d", iowintty, &iowinpid);
+ 	close(sock);
+-	unlink("/tmp/iowindowtty");
++	unlink(sockname);
+     }
+     else
+     {
+@@ -259,7 +264,7 @@
+ 	if (execlp("x-terminal-emulator", "x-terminal-emulator", "-e", XXGDBIOWIN, NULL))
+ 	{
+ 	    printf("exec of 'x-terminal-emulator -e %s' failed\n", XXGDBIOWIN);
+-	    unlink("/tmp/iowindowtty");
++	    unlink(sockname);
+ 	}
+ 	}
+ }
+diff -urNad xxgdb-1.12~/xxgdbiowin.c xxgdb-1.12/xxgdbiowin.c
+--- xxgdb-1.12~/xxgdbiowin.c	2008-05-16 17:50:07.000000000 +0200
++++ xxgdb-1.12/xxgdbiowin.c	2008-05-16 17:50:07.000000000 +0200
+@@ -24,6 +24,8 @@
+     int sock;
+     struct sockaddr_un name;
+     char ttypid[40];
++    char sockname[FILENAME_MAX];
++
+ #if 0 /* for debug only */
+ {
+ 	char *myname;
+@@ -43,7 +45,8 @@
+ #endif
+     sock = socket(AF_UNIX, SOCK_DGRAM, 0);
+     name.sun_family = AF_UNIX;
+-    strcpy(name.sun_path, "/tmp/iowindowtty");
++    snprintf(sockname, sizeof(sockname), "%s/%s", getenv("HOME"), "iowindowtty");
++    strcpy(name.sun_path, sockname);
+     sendto(sock, ttypid, 40, 0, 
+ 	   (struct sockaddr*)&name, sizeof(struct sockaddr_un));
+     close(sock);
--- xxgdb-1.12.orig/debian/patches/002-x-terminal.dpatch
+++ xxgdb-1.12/debian/patches/002-x-terminal.dpatch
@@ -0,0 +1,22 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 002-x-terminal.dpatch by Matej Vela <vela@debian.org>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: Use x-terminal-emulator
+
+@DPATCH@
+diff -urNad xxgdb-1.12~/calldbx.c xxgdb-1.12/calldbx.c
+--- xxgdb-1.12~/calldbx.c	1996-10-02 10:59:45.000000000 +0200
++++ xxgdb-1.12/calldbx.c	2008-05-16 17:20:34.000000000 +0200
+@@ -229,9 +229,9 @@
+     {
+ 	/* child */
+ 	/* printf("xterm xterm -l -e xxgdbiowin\n");*/
+-	if (execlp("xterm", "xterm", "-e", "xxgdbiowin", 0))
++	if (execlp("x-terminal-emulator", "x-terminal-emulator", "-e", XXGDBIOWIN, NULL))
+ 	{
+-	    printf("exec of 'xterm -e xxgdbiowin' fails\n");
++	    printf("exec of 'x-terminal-emulator -e %s' failed\n", XXGDBIOWIN);
+ 	    unlink("/tmp/iowindowtty");
+ 	}
+ 	}
--- xxgdb-1.12.orig/debian/patches/008-unix98-ptys.dpatch
+++ xxgdb-1.12/debian/patches/008-unix98-ptys.dpatch
@@ -0,0 +1,83 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 008-unix98-ptys.dpatch by Francesco Paolo Lovergine <frankie@debian.org> and Joey Schulze <joey@infodrom.org>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: Support Unix98 PTYs
+
+@DPATCH@
+diff -urNad xxgdb-1.12~/calldbx.c xxgdb-1.12/calldbx.c
+--- xxgdb-1.12~/calldbx.c	1996-10-02 10:59:45.000000000 +0200
++++ xxgdb-1.12/calldbx.c	2008-05-16 17:44:05.000000000 +0200
+@@ -85,8 +85,10 @@
+ #include        <sys/un.h>
+ #endif /* CREATE_IO_WINDOW */
+ 
+-#ifdef SVR4
++#if defined(SVR4) || defined(UNIX98)
+ #define MASTER_CLONE "/dev/ptmx"
++#endif
++#ifdef SVR4
+ #include <sys/types.h>
+ #include <sys/stat.h>
+ #include <sys/stropts.h>
+@@ -125,13 +127,14 @@
+ {
+     int master;
+     
+-#ifdef SVR4				/* (MJH) Use STREAMS */
++#if defined(SVR4) || defined(UNIX98)
+ 
+     if((master = open(MASTER_CLONE, O_RDWR)) < 0)
+ 	perror(MASTER_CLONE);
+     else
+ 	return master;
+-#else
++#endif
++#if !defined(SVR4) && !defined(UNIX98)
+     int  i;
+     char c;
+ 
+@@ -150,7 +153,7 @@
+ #ifndef sco
+ 	}
+ #endif
+-#endif /* SVR4 */
++#endif /* !defined(SVR4) && !defined(UNIX98) */
+ 
+ #ifdef GDB
+     fprintf(stderr, "xxgdb: all ptys in use\n");
+@@ -166,6 +169,25 @@
+ {
+     int slave;
+ 
++#if defined(UNIX98)
++
++    int n;
++    int zero=0;
++    char ptsname[16];
++
++    if (ioctl(master, TIOCGPTN, &n) < 0)
++	exit(2);
++    snprintf(ptsname,sizeof(ptsname),"/dev/pts/%i", n);
++    if (ioctl(master, TIOCSPTLCK, &zero) < 0)
++	exit(3);
++    if ((slave = open(ptsname, O_RDWR)) < 0) {
++	perror(ptsname);
++	exit(4);
++    }
++    return slave;
++
++#else
++    
+ #ifdef SVR4				/* (MJH) */
+     char *slave_name = "unknown";
+     extern char *ptsname(int master);
+@@ -193,6 +215,8 @@
+ 	    }
+     return slave;
+ #endif /* SVR4 */
++
++#endif /* UNIX98 */
+ }
+ 
+ #ifdef CREATE_IO_WINDOW 
--- xxgdb-1.12.orig/debian/patches/00list
+++ xxgdb-1.12/debian/patches/00list
@@ -0,0 +1,11 @@
+001-imakefile
+002-x-terminal
+003-debian-patch
+004-backspace
+005-kfreebsd
+006-nroff-fixes
+007-sort-filemenu
+008-unix98-ptys
+009-iowinttypid
+010-gcc-wall
+020-xxgdb.man-fixes
--- xxgdb-1.12.orig/debian/patches/007-sort-filemenu.dpatch
+++ xxgdb-1.12/debian/patches/007-sort-filemenu.dpatch
@@ -0,0 +1,35 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 007-sort-filemenu.dpatch by Michael Kebe <michael.kebe@gmail.com>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: Sort files in file menu
+
+@DPATCH@
+diff -urNad xxgdb-1.12~/filemenu.c xxgdb-1.12/filemenu.c
+--- xxgdb-1.12~/filemenu.c	1994-08-29 21:38:28.000000000 +0200
++++ xxgdb-1.12/filemenu.c	2008-05-16 17:41:54.000000000 +0200
+@@ -220,6 +220,15 @@
+ #endif /* not SYSV */
+ 
+ 
++#ifdef NO_SCANDIR
++/* Compare function for qsort()
++ */
++int filenamecmp(const void *a, const void *b) {
++    return strcmp(*(char **)a, *(char **)b);
++}
++#endif
++
++
+ /*  Scans the working directory for files selected by InList(), sorted
+  *  alphabetically, and stored in an array of pointers to directory
+  *  entries called namelist.
+@@ -307,6 +316,8 @@
+ 
+ #ifdef SYSV 
+     closedir(WorkingDir);
++    nfiles = i;
++    qsort(filelist, nfiles-1, sizeof(filelist[0]), filenamecmp);
+ #else
+     XtFree((XtPointer) namelist);
+ #endif
--- xxgdb-1.12.orig/debian/patches/004-backspace.dpatch
+++ xxgdb-1.12/debian/patches/004-backspace.dpatch
@@ -0,0 +1,86 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 004-backspace.dpatch by Francesco Paolo Lovergine <frankie@debian.org>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: Properly support backspace key
+
+@DPATCH@
+diff -urNad xxgdb-1.12~/dialog.c xxgdb-1.12/dialog.c
+--- xxgdb-1.12~/dialog.c	1995-06-20 00:15:13.000000000 +0200
++++ xxgdb-1.12/dialog.c	2008-05-16 17:31:45.000000000 +0200
+@@ -130,8 +130,8 @@
+     Cardinal	 	i;
+ 
+     textblock.firstPos = 0;
+-    textblock.length   = 0;
+-    textblock.ptr      = "";
++    textblock.length   = 1;
++    textblock.ptr      = " ";
+ 
+     pos = XawTextGetInsertionPoint(w); 
+     if (pos <= StartPos)
+@@ -142,6 +142,30 @@
+     XawTextSetInsertionPoint(w, i);
+ }
+ 
++/*  Erases the preceding word.
++ *  Simulates the action of the WERASE character (ctrl-W).
++ */
++/* ARGSUSED */
++void DeleteChar(w, event, params, num_params)
++    Widget w;
++    XEvent *event;
++    String *params;
++    Cardinal *num_params;
++{
++    XawTextBlock    	textblock;
++    XawTextPosition	pos;
++
++    textblock.firstPos = 0;
++    textblock.length   = 1;
++    textblock.ptr      = " ";
++
++    pos = XawTextGetInsertionPoint(w); 
++    if (pos > StartPos) {
++    	XawTextReplace(w, pos-1, pos, &textblock);
++    	XawTextSetInsertionPoint(w, pos-1);
++    }
++}
++
+ 
+ /*  Deletes the entire current input line.
+  *  simulates the action of the KILL character (ctrl-U).
+@@ -159,8 +183,8 @@
+     char		*s;
+ 
+     textblock.firstPos = 0;
+-    textblock.length   = 0;
+-    textblock.ptr      = "";
++    textblock.length   = 1;
++    textblock.ptr      = " ";
+ 
+     pos = XawTextGetInsertionPoint(w); 
+     if (w == dialogWindow) {
+@@ -307,6 +331,7 @@
+ 	{"SigQuit", 	(XtActionProc) SigQuit},
+ 	{"InsertSpace", (XtActionProc) InsertSpace},
+ 	{"Dispatch", 	(XtActionProc) Dispatch},
++	{"DeleteChar", 	(XtActionProc) DeleteChar},
+         {NULL, NULL}
+     };
+ 
+@@ -316,10 +341,10 @@
+  	Ctrl<Key>|:	SigQuit()\n\
+  	Ctrl<Key>W:	DeleteWord()\n\
+  	Ctrl<Key>U:	DeleteLine()\n\
+- 	Ctrl<Key>H:	InsertSpace() delete-previous-character()\n\
+- 	<Key>Delete:	InsertSpace() delete-previous-character()\n\
+- 	<Key>BackSpace:	InsertSpace() delete-previous-character()\n\
+- 	<Key>Return:	newline() Dispatch()\n\
++ 	Ctrl<Key>H:	DeleteChar()\n\
++ 	<Key>Delete:	DeleteChar()\n\
++ 	<Key>BackSpace:	DeleteChar()\n\
++ 	<Key>Return:	newline()Dispatch()\n\
+     ";
+ 
+     n = 0;
--- xxgdb-1.12.orig/debian/patches/005-kfreebsd.dpatch
+++ xxgdb-1.12/debian/patches/005-kfreebsd.dpatch
@@ -0,0 +1,21 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 005-kfreebsd.dpatch by Petr Salinger <Petr.Salinger@seznam.cz>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: Support GNU/kFreeBSD
+
+@DPATCH@
+diff -urNad xxgdb-1.12~/Imakefile xxgdb-1.12/Imakefile
+--- xxgdb-1.12~/Imakefile	1996-10-02 10:59:44.000000000 +0200
++++ xxgdb-1.12/Imakefile	2008-05-16 17:37:48.000000000 +0200
+@@ -62,6 +62,10 @@
+ DEFINES = -DSYSV $(DEFGDB)
+ #endif
+ 
++#if defined(KFreeBSDArchitecture)
++DEFINES = -DHAVE_SIGNAL_H -DHAVE_WAITPID -DHAVE_KILLPG -DNO_SCANDIR $(DEFGDB) -DBSD
++#endif
++
+ #if defined(NeXTArchitecture) || defined(NextArchitecture)
+ #if OSMajorVersion == 3
+ #if OSMinorVersion == 0
--- xxgdb-1.12.orig/debian/patches/020-xxgdb.man-fixes.dpatch
+++ xxgdb-1.12/debian/patches/020-xxgdb.man-fixes.dpatch
@@ -0,0 +1,46 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 020-xxgdb.man-fixes.dpatch by Jari Aalto <jari.aalto@cante.net>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: Hyphenation fixes in xxgdb.man
+
+@DPATCH@
+
+diff --git a/xxgdb.man b/xxgdb.man
+index 9ef9235..239e31c 100644
+--- a/xxgdb.man
++++ b/xxgdb.man
+@@ -15,12 +15,12 @@ variables and data structures, and to browse source files and functions.
+ \fIXxgdb\fP allows initial gdb commands stored in the file \fI.gdbinit\fP 
+ to be executed immediately after the symbolic information is 
+ read.  If \fI.gdbinit\fP does not exist in the current directory, the 
+-user's home directory is searched (\fI~/.gdbinit\fP). Option -nx
+-can be used to prevent xxgdb from executing this file. Option -i
++user's home directory is searched (\fI\~/.gdbinit\fP). Option \-nx
++can be used to prevent xxgdb from executing this file. Option \-i
+ can be used to change the file name of command file.
+ .LP
+ \fIObjfile\fP is an object file produced by a compiler with the
+-appropriate option (-g) specified to produce symbol table
++appropriate option (\-g) specified to produce symbol table
+ information for gdb.
+ .LP
+ If a file named \fIcore\fP exists in the current directory or a
+@@ -38,7 +38,7 @@ the following xxgdb specific options:
+ Specify the name of the debugger to override the default "gdb".
+ WARNING : by default prompt is the name of the debugger enclosed in
+ parenthesis followed by a space. So if the prompt is still "(gdb) ",
+-you HAVE TO use -db_prompt "gdb"
++you HAVE TO use \-db_prompt "gdb"
+ .IP "-db_prompt promptstring"
+ Specify to xxgdb what is the debugger prompt. The default is to
+ expect the prompt to be the name of the debugger enclosed in
+@@ -47,7 +47,7 @@ parenthesis followed by a space (eg, "(gdb) ").
+ Specify the filename of initial gdb command file. The default
+ is ".gdbinit".
+ .IP -nx
+-Do not execute .gdbinit file (or file specified with -i)
++Do not execute .gdbinit file (or file specified with \-i)
+ .IP -bigicon
+ Uses a 64x64 icon instead of the default 48x48 icon.
+ .SH SUBWINDOWS
--- xxgdb-1.12.orig/debian/patches/010-gcc-wall.dpatch
+++ xxgdb-1.12/debian/patches/010-gcc-wall.dpatch
@@ -0,0 +1,415 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 010-gcc-wall.dpatch by Joey Schulze <joey@infodrom.org>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: Clean up code so that it is -Wall clean
+
+@DPATCH@
+diff -urNad xxgdb~/calldbx.c xxgdb/calldbx.c
+--- xxgdb~/calldbx.c	2008-05-17 10:05:14.000000000 +0200
++++ xxgdb/calldbx.c	2008-05-17 10:05:14.000000000 +0200
+@@ -112,7 +112,6 @@
+ static XtInputId	dbxInputId;		/* dbx input id */
+ #ifndef SVR4				/* (MJH) */
+ static char 	pty[11] = "/dev/pty??";	/* master side of pseudo-terminal */
+-static char 	tty[11] = "/dev/tty??";	/* slave side of pseudo-terminal */
+ #endif /* SVR4 */
+ extern char	*dbxprompt;
+ 
+diff -urNad xxgdb~/calldbx.h xxgdb/calldbx.h
+--- xxgdb~/calldbx.h	1970-01-01 01:00:00.000000000 +0100
++++ xxgdb/calldbx.h	2008-05-17 10:05:14.000000000 +0200
+@@ -0,0 +1,73 @@
++/*****************************************************************************
++ *
++ *  xdbx - X Window System interface to the dbx debugger
++ *
++ *  Copyright 1989 The University of Texas at Austin
++ *  Copyright 1990 Microelectronics and Computer Technology Corporation
++ *
++ *  Permission to use, copy, modify, and distribute this software and its
++ *  documentation for any purpose and without fee is hereby granted,
++ *  provided that the above copyright notice appear in all copies and that
++ *  both that copyright notice and this permission notice appear in
++ *  supporting documentation, and that the name of The University of Texas
++ *  and Microelectronics and Computer Technology Corporation (MCC) not be 
++ *  used in advertising or publicity pertaining to distribution of
++ *  the software without specific, written prior permission.  The
++ *  University of Texas and MCC makes no representations about the 
++ *  suitability of this software for any purpose.  It is provided "as is" 
++ *  without express or implied warranty.
++ *
++ *  THE UNIVERSITY OF TEXAS AND MCC DISCLAIMS ALL WARRANTIES WITH REGARD TO
++ *  THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
++ *  FITNESS, IN NO EVENT SHALL THE UNIVERSITY OF TEXAS OR MCC BE LIABLE FOR
++ *  ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
++ *  RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
++ *  CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
++ *  CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
++ *
++ *  Author:  	Po Cheung
++ *  Created:   	March 10, 1989
++ * 
++ *****************************************************************************
++ * 
++ *  xxgdb - X Window System interface to the gdb debugger
++ *  
++ * 	Copyright 1990,1993 Thomson Consumer Electronics, Inc.
++ *  
++ *  Permission to use, copy, modify, and distribute this software and its
++ *  documentation for any purpose and without fee is hereby granted,
++ *  provided that the above copyright notice appear in all copies and that
++ *  both that copyright notice and this permission notice appear in
++ *  supporting documentation, and that the name of Thomson Consumer
++ *  Electronics (TCE) not be used in advertising or publicity pertaining
++ *  to distribution of the software without specific, written prior
++ *  permission.  TCE makes no representations about the suitability of
++ *  this software for any purpose.  It is provided "as is" without express
++ *  or implied warranty.
++ *
++ *  TCE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
++ *  ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
++ *  SHALL TCE BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES
++ *  OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
++ *  WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
++ *  ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
++ *  SOFTWARE.
++ *
++ *****************************************************************************/
++
++/*  calldbx.h
++ *
++ *    Export public functions defined in calldbx.c
++ */
++
++#ifndef _CALLDBX_H_
++#define _CALLDBX_H_
++
++#ifdef CREATE_IO_WINDOW
++
++void create_io_window ();
++void close_io_window ();
++
++#endif
++
++#endif /* _CALLDBX_H_ */
+diff -urNad xxgdb~/command.c xxgdb/command.c
+--- xxgdb~/command.c	2008-05-17 10:05:14.000000000 +0200
++++ xxgdb/command.c	2008-05-17 10:05:14.000000000 +0200
+@@ -96,6 +96,7 @@
+ #endif
+ #include <sys/wait.h>
+ #include "global.h"
++#include "calldbx.h"
+ 
+ #define	 REVERSE	0
+ #define	 FORWARD	1
+@@ -195,9 +196,9 @@
+ 		s = funcname;
+ 		while (*s == ' ') s++;	/* skip leading spaces (if any) */
+ 		if ((*s >= '0') && (*s <= '9'))
+-			sprintf(command, "%s *%s\n",client_data,funcname);
++			sprintf(command, "%s *%s\n",(char *)client_data,funcname);
+ 		else
+-			sprintf(command, "%s %s\n",client_data,funcname);
++			sprintf(command, "%s %s\n",(char *)client_data,funcname);
+ 		XFree (funcname);   /* AJK */
+ 		}
+ 	else
+@@ -206,7 +207,7 @@
+ 			{
+ 			pos = XawTextGetInsertionPoint(sourceWindow);
+ 			line = TextPositionToLine(pos);
+-			sprintf(command, "%s %d\n",client_data,line);
++			sprintf(command, "%s %d\n",(char *)client_data,line);
+ 			}
+ 		else
+ 			{
+diff -urNad xxgdb~/dbx.c xxgdb/dbx.c
+--- xxgdb~/dbx.c	2008-05-17 10:05:10.000000000 +0200
++++ xxgdb/dbx.c	2008-05-17 10:05:14.000000000 +0200
+@@ -72,6 +72,7 @@
+  *    query_dbx():	Send a command to dbx and process it.
+  */
+ #include <stdio.h>
++#include <stdlib.h>
+ #include <unistd.h>
+ #include "global.h"
+ 
+@@ -124,7 +125,7 @@
+  */
+ void debug_init()
+ {
+-    static visited = False;
++    static int visited = False;
+ 
+     if (!visited) {
+ 	visited = True;
+diff -urNad xxgdb~/filemenu.c xxgdb/filemenu.c
+--- xxgdb~/filemenu.c	2008-05-17 10:05:14.000000000 +0200
++++ xxgdb/filemenu.c	2008-05-17 10:05:14.000000000 +0200
+@@ -83,6 +83,7 @@
+ 
+ #ifdef NO_SCANDIR 
+ #include <stdio.h>
++#include <stdlib.h>
+ #include <sys/param.h>
+ #include <sys/types.h>
+ #include <dirent.h>
+diff -urNad xxgdb~/gdb_parser.c xxgdb/gdb_parser.c
+--- xxgdb~/gdb_parser.c	2008-05-17 10:05:14.000000000 +0200
++++ xxgdb/gdb_parser.c	2008-05-17 10:05:14.000000000 +0200
+@@ -81,6 +81,7 @@
+ #include 	<string.h>
+ #include 	<stdio.h>
+ #include	<errno.h>
++#include	"calldbx.h"
+ 
+ extern Boolean	Prompt;			/* True when gdb prompt arrives */
+ 
+diff -urNad xxgdb~/regex.c xxgdb/regex.c
+--- xxgdb~/regex.c	2008-05-17 10:05:14.000000000 +0200
++++ xxgdb/regex.c	2008-05-17 10:05:14.000000000 +0200
+@@ -124,8 +124,6 @@
+ 
+ #ifdef sparc
+ #include <alloca.h>
+-#else
+-#pragma alloca
+ #endif
+ #define FAILURE_STACK   20000           /* max failure stack size */
+ 
+@@ -307,7 +305,8 @@
+       pending_exact -= (-(int)c); \
+   }
+ 
+-static int store_jump (), insert_jump ();
++void store_jump ();
++void insert_jump ();
+ 
+ char *
+ re_compile_pattern (pattern, size, bufp)
+@@ -690,7 +689,7 @@
+ /* Store where `from' points a jump operation to jump to where `to' points.
+   `opcode' is the opcode to store. */
+ 
+-static int
++void
+ store_jump (from, opcode, to)
+      char *from, *to;
+      char opcode;
+@@ -707,7 +706,7 @@
+ 
+    If you call this function, you must zero out pending_exact.  */
+ 
+-static int
++void
+ insert_jump (op, from, to, current_end)
+      char op;
+      char *from, *to, *current_end;
+@@ -738,7 +737,10 @@
+   register char *fastmap = bufp->fastmap;
+   register unsigned char *p = pattern;
+   register unsigned char *pend = pattern + size;
+-  register int j, k;
++  register int j;
++#ifdef emacs
++  register int k;
++#endif
+   unsigned char *translate = (unsigned char *) bufp->translate;
+ 
+   unsigned char *stackb[NFAILURES];
+@@ -896,6 +898,9 @@
+ 		  fastmap[j] = 1;
+ 	      }
+ 	  break;
++
++	default:
++	  break;
+ 	}
+ 
+       /* Get here means we have successfully found the possible starting
+@@ -1570,6 +1575,9 @@
+ 	      while (--mcnt);
+ 	    }
+ 	  break;
++
++	default:
++	  break;
+ 	}
+       continue;    /* Successfully matched one pattern command; keep matching */
+ 
+diff -urNad xxgdb~/signals.c xxgdb/signals.c
+--- xxgdb~/signals.c	2008-05-17 10:05:14.000000000 +0200
++++ xxgdb/signals.c	2008-05-17 10:05:14.000000000 +0200
+@@ -49,6 +49,7 @@
+  */
+ 
+ #include <stdio.h>
++#include <stdlib.h>
+ #include <signal.h>
+ #ifdef	_POSIX_SOURCE
+ #include <sys/types.h>
+diff -urNad xxgdb~/source.c xxgdb/source.c
+--- xxgdb~/source.c	2008-05-17 10:05:10.000000000 +0200
++++ xxgdb/source.c	2008-05-17 10:05:14.000000000 +0200
+@@ -363,7 +363,7 @@
+ #endif /* EDIT_BUTTON */
+ 
+ /* fixes keybindings in source window */
+-extern PopupSearch();
++extern void PopupSearch();
+ void Search(w, event, params, num_params)
+     Widget w;
+     XEvent *event;
+diff -urNad xxgdb~/windows.c xxgdb/windows.c
+--- xxgdb~/windows.c	2008-05-17 10:05:10.000000000 +0200
++++ xxgdb/windows.c	2008-05-17 10:05:14.000000000 +0200
+@@ -201,8 +201,6 @@
+      Widget client_data;
+      XtPointer call_data;
+ {
+-  Arg 	args[MAXARGS];
+-  Cardinal 	n;
+   Boolean       ToggleState;
+ 
+   XtVaGetValues(w, XtNstate, &ToggleState, NULL);
+diff -urNad xxgdb~/windows.h xxgdb/windows.h
+--- xxgdb~/windows.h	1970-01-01 01:00:00.000000000 +0100
++++ xxgdb/windows.h	2008-05-17 10:08:13.000000000 +0200
+@@ -0,0 +1,70 @@
++/*****************************************************************************
++ *
++ *  xdbx - X Window System interface to the dbx debugger
++ *
++ *  Copyright 1989 The University of Texas at Austin
++ *  Copyright 1990 Microelectronics and Computer Technology Corporation
++ *
++ *  Permission to use, copy, modify, and distribute this software and its
++ *  documentation for any purpose and without fee is hereby granted,
++ *  provided that the above copyright notice appear in all copies and that
++ *  both that copyright notice and this permission notice appear in
++ *  supporting documentation, and that the name of The University of Texas
++ *  and Microelectronics and Computer Technology Corporation (MCC) not be 
++ *  used in advertising or publicity pertaining to distribution of
++ *  the software without specific, written prior permission.  The
++ *  University of Texas and MCC makes no representations about the 
++ *  suitability of this software for any purpose.  It is provided "as is" 
++ *  without express or implied warranty.
++ *
++ *  THE UNIVERSITY OF TEXAS AND MCC DISCLAIMS ALL WARRANTIES WITH REGARD TO
++ *  THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
++ *  FITNESS, IN NO EVENT SHALL THE UNIVERSITY OF TEXAS OR MCC BE LIABLE FOR
++ *  ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
++ *  RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
++ *  CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
++ *  CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
++ *
++ *  Author:  	Po Cheung
++ *  Created:   	March 10, 1989
++ * 
++ *****************************************************************************
++ * 
++ *  xxgdb - X Window System interface to the gdb debugger
++ *  
++ * 	Copyright 1990,1993 Thomson Consumer Electronics, Inc.
++ *  
++ *  Permission to use, copy, modify, and distribute this software and its
++ *  documentation for any purpose and without fee is hereby granted,
++ *  provided that the above copyright notice appear in all copies and that
++ *  both that copyright notice and this permission notice appear in
++ *  supporting documentation, and that the name of Thomson Consumer
++ *  Electronics (TCE) not be used in advertising or publicity pertaining
++ *  to distribution of the software without specific, written prior
++ *  permission.  TCE makes no representations about the suitability of
++ *  this software for any purpose.  It is provided "as is" without express
++ *  or implied warranty.
++ *
++ *  TCE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
++ *  ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
++ *  SHALL TCE BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES
++ *  OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
++ *  WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
++ *  ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
++ *  SOFTWARE.
++ *
++ *****************************************************************************/
++
++/*  windows.h
++ *
++ *    Export public functions defined in windows.c
++ */
++
++#ifndef _WINDOWS_H_
++#define _WINDOWS_H_
++
++#include <X11/Xos.h>
++
++void State_Transient(Widget w, Widget client_data, XtPointer call_data);
++
++#endif /* _WINDOWS_H_ */
+diff -urNad xxgdb~/xdbx.c xxgdb/xdbx.c
+--- xxgdb~/xdbx.c	2008-05-17 10:05:14.000000000 +0200
++++ xxgdb/xdbx.c	2008-05-17 10:05:14.000000000 +0200
+@@ -83,6 +83,7 @@
+ #include "global.h"
+ #include "bitmaps.h"
+ #include "patchlevel.h"
++#include "windows.h"
+ 
+ #define VERSION	"2.1"
+ #define Offset(field) (XtOffset(XdbxResources *, field))
+@@ -458,7 +459,7 @@
+     return dbxargv;
+ }
+ 
+-void main(argc, argv)
++int main(argc, argv)
+ int argc;
+ char **argv;
+ {
+@@ -503,4 +504,6 @@
+ #endif /* NEW_INTERFACE */
+ 
+     XtAppMainLoop(app_context);
++
++    return 0;
+ }
+diff -urNad xxgdb~/xxgdbiowin.c xxgdb/xxgdbiowin.c
+--- xxgdb~/xxgdbiowin.c	2008-05-17 10:05:14.000000000 +0200
++++ xxgdb/xxgdbiowin.c	2008-05-17 10:05:14.000000000 +0200
+@@ -8,6 +8,7 @@
+ #include <sys/un.h>
+ #include <stdio.h>
+ #include <stdlib.h>
++#include <unistd.h>
+ 
+ #if ( defined(SYSV) || defined(SVR4) ) && !defined(HPUX) && !defined(linux)
+ #define signal sigset
+@@ -19,7 +20,7 @@
+ {
+ }
+ 
+-main ()
++int main ()
+ {
+     int sock;
+     struct sockaddr_un name;
+@@ -57,10 +58,17 @@
+ #ifdef SVR4
+     setpgid(0,0);
+ #else
++#ifdef linux
++    setpgrp();
++#else
+     setpgrp(0,0);
+ #endif
++#endif
+     close(0);
+     close(1);
+     while (1) pause();
++
++    /* not reached */
++    return 0;
+ }
+ 
--- xxgdb-1.12.orig/debian/patches/001-imakefile.dpatch
+++ xxgdb-1.12/debian/patches/001-imakefile.dpatch
@@ -0,0 +1,65 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 001-imakefile.dpatch by 
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: Debian adjustments to Imakefile
+
+@DPATCH@
+diff -urNad xxgdb-1.12~/Imakefile xxgdb-1.12/Imakefile
+--- xxgdb-1.12~/Imakefile	1996-10-02 10:59:44.000000000 +0200
++++ xxgdb-1.12/Imakefile	2008-05-16 17:37:24.000000000 +0200
+@@ -1,8 +1,9 @@
+ 
+ #define TARGET_IS_GDB 1
++#define USE_IO_WINDOW 1
+ 
+ #if TARGET_IS_GDB
+-DEFGDB =  -DGDB -DCREATE_IO_WINDOW -g
++DEFGDB =  -DGDB -DUNDISPWIN 
+ #else
+ DEFGDB = 
+ #endif
+@@ -59,7 +60,7 @@
+ #endif
+ 
+ #ifdef LinuxArchitecture
+-DEFINES = -DSYSV $(DEFGDB)
++DEFINES = -DHAVE_SIGNAL_H -DHAVE_WAITPID -DHAVE_KILLPG -DNO_SCANDIR $(DEFGDB)
+ #endif
+ 
+ #if defined(NeXTArchitecture) || defined(NextArchitecture)
+@@ -75,9 +76,17 @@
+ #endif
+ 
+ # Add to use new multi window format
+-#DEFINES+=-DNEW_INTERFACE
++DEFINES+=-DNEW_INTERFACE
+ # Add to open all windows at startup
+-#DEFINES+=-DOPEN_ALL_WINDOWS
++DEFINES+=-DOPEN_ALL_WINDOWS
++#if USE_IO_WINDOW
++
++	  SRCS1 = xxgdbiowin.c
++	  OBJS1 = xxgdbiowin.o
++
++DEFINES+=-DCREATE_IO_WINDOW -DXXGDBIOWIN=\"$(LIBDIR)/xxgdb/xxgdbiowin\"
++
++#endif
+ 
+ mallocc = #malloc.c
+ malloco = #malloc.o
+@@ -97,6 +106,14 @@
+ 
+ ComplexProgramTarget(xxgdb)
+ 
++#if USE_IO_WINDOW
++AllTarget(xxgdbiowin)
++
++NormalProgramTarget(xxgdbiowin,$(OBJS1),NullParameter,NullParameter,NullParameter)
++
++InstallProgram(xxgdbiowin,$(LIBDIR)/xxgdb)
++#endif
++
+ #else
+ 
+ ComplexProgramTarget(xdbx)
--- xxgdb-1.12.orig/debian/patches/003-debian-patch.dpatch
+++ xxgdb-1.12/debian/patches/003-debian-patch.dpatch
@@ -0,0 +1,610 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 003-debian-patch.dpatch by misc maintainers
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: Misc Debian related patch up to 1.12-13
+
+@DPATCH@
+diff -urNad xxgdb-1.12~/XDbx.OLD_INTERFACE xxgdb-1.12/XDbx.OLD_INTERFACE
+--- xxgdb-1.12~/XDbx.OLD_INTERFACE	1970-01-01 01:00:00.000000000 +0100
++++ xxgdb-1.12/XDbx.OLD_INTERFACE	2008-05-16 17:39:25.000000000 +0200
+@@ -0,0 +1,62 @@
++!
++! Xdbx 2.1 Application defaults file
++!
++
++*background: 				snow1
++*foreground: 				black
++*fileWindow*background:			snow2
++*messageWindow.background:		snow2
++*commandWindow.background: 		snow2
++*Scrollbar.foreground: 			black
++
++*allowShellResize:              	True
++*borderWidth:				1
++*font:                          	fixed
++*vpane.width:                   	550
++*fileWindow*font:     			variable
++*fileLabel.width:     			500
++*lineLabel.width:     			50
++*sourceForm.preferredPaneSize:  	320
++*sourceWindow.leftMargin:       	35
++*sourceWindow.scrollHorizontal:		whenNeeded
++*sourceWindow.translations:		#override \n\
++	<Btn1Down>:     SelectStart() SelectWord() \n\
++	Shift<Btn1Up>:  Update(warp) SelectEnd() PrintSelection() \n\
++	<Btn1Up>:       Update(warp) SelectEnd() \n\
++	<Key>Down:      next-line() Update()\n\
++	<Key>Up:        previous-line() Update() \n\
++	Ctrl<Key>L:     redraw-display() Update() \n\
++	Ctrl<Key>N:     next-line() Update() \n\
++	Ctrl<Key>P:     previous-line() Update() \n\
++	Ctrl<Key>V:     next-page() Update() \n\
++	Ctrl<Key>Z:     scroll-one-line-up() Update() \n\
++	Meta<Key>V:     previous-page() Update() \n\
++	Meta<Key>Z:     scroll-one-line-down() Update() \n\
++	:Meta<Key>\>:   end-of-file() Update() \n\
++	:Meta<Key>]:    forward-paragraph() Update() \n\
++	:Meta<Key>[:    backward-paragraph() Update()
++*messageWindow*font:  			variable
++*messageWindow.min:  			30
++*messageWindow.max:  			30
++*dialogWindow.preferredPaneSize:	200
++*dialogWindow.resizeToPreferred:	True
++*dialogWindow.translations:		#override \n\
++	<Btn1Down>:     SelectStart() SelectWord() \n\
++	Shift<Btn1Up>:  SelectEnd() PrintSelection() \n\
++	<Btn1Up>:       SelectEnd() \n
++*commandWindow.preferredPaneSize:	135
++*commandWindow.skipAdjust:		True
++!*commandWindow.hSpace:			14
++!*commandWindow.vSpace:			10
++!*Command.height:                	20
++!*Command.width:                 	60
++*List.columnSpacing:            	10
++*displayWindow.preferredPaneSize:	50
++*displayWindow.skipAdjust:      	True
++*displayWindow.scrollVertical:		whenNeeded
++*displayWindow.scrollHorizontal:	whenNeeded
++*displayWindow.translations:		#override \n\
++	<Btn1Down>:             SelectStart() SelectWord() \n\
++	Shift<Btn1Up>:          SelectEnd() PrintSelection() \n\
++	<Btn1Up>:               SelectEnd() \n
++*popup*showGrip:			False
+diff -urNad xxgdb-1.12~/XDbx.ad xxgdb-1.12/XDbx.ad
+--- xxgdb-1.12~/XDbx.ad	1996-10-02 10:59:44.000000000 +0200
++++ xxgdb-1.12/XDbx.ad	2008-05-16 17:39:25.000000000 +0200
+@@ -1,6 +1,6 @@
+ !
+-! Xdbx 2.1 Application defaults file
+-!
++! XXgdb 1.08 Application defaults file with NEW_INTERFACE
++! (derived from Xdbx 2.1 app-defaults)
+ 
+ *background: 				snow1
+ *foreground: 				black
+@@ -9,15 +9,23 @@
+ *commandWindow.background: 		snow2
+ *Scrollbar.foreground: 			black
+ 
+-*allowShellResize:              	True
++XDbx.geometry:				+0+0
++*allowShellResize:			True
+ *borderWidth:				1
+-*font:                          	fixed
+-*vpane.width:                   	550
++*font:					fixed
++*vpane.width:                      	550
+ *fileWindow*font:     			variable
+ *fileLabel.width:     			500
+ *lineLabel.width:     			50
+-*sourceForm.preferredPaneSize:  	320
+-*sourceWindow.leftMargin:       	35
++*sourceShell.geometry:          	550x260+0+380
++*sourceForm.top:                   	ChainTop
++*sourceForm.bottom:                	ChainBottom
++*sourceForm.left:                  	ChainLeft
++*sourceForm.right:                 	ChainRight
++*sourceForm.fromVert:              	fileWindow
++*sourceWindow.width:               	558
++*sourceWindow.height:              	220
++*sourceWindow.leftMargin:          	35
+ *sourceWindow.scrollHorizontal:		whenNeeded
+ *sourceWindow.translations:		#override \n\
+ 	<Btn1Down>:     SelectStart() SelectWord() \n\
+@@ -38,25 +46,30 @@
+ *messageWindow*font:  			variable
+ *messageWindow.min:  			30
+ *messageWindow.max:  			30
+-*dialogWindow.preferredPaneSize:	200
++*dialogWindow.preferredPaneSize:	240
+ *dialogWindow.resizeToPreferred:	True
+ *dialogWindow.translations:		#override \n\
+ 	<Btn1Down>:     SelectStart() SelectWord() \n\
+ 	Shift<Btn1Up>:  SelectEnd() PrintSelection() \n\
+ 	<Btn1Up>:       SelectEnd() \n
+-*commandWindow.preferredPaneSize:	135
+-*commandWindow.skipAdjust:		True
+-!*commandWindow.hSpace:			14
+-!*commandWindow.vSpace:			10
+-!*Command.height:                	20
+-!*Command.width:                 	60
+-*List.columnSpacing:            	10
+-*displayWindow.preferredPaneSize:	50
+-*displayWindow.skipAdjust:      	True
++*commandShell.geometry:            	180x394+590+0
++*commandWindow.hSpace:			6
++*commandWindow.vSpace:			6
++*Command.height:                   	20
++*Command.width:                    	78
++*List.columnSpacing:               	10
++*displayShell.geometry:            	+590+450
++*displayWindow.top:                	ChainTop
++*displayWindow.bottom:             	ChainBottom
++*displayWindow.left:               	ChainLeft
++*displayWindow.right:              	ChainRight
++*displayWindow.width:              	300
++*displayWindow.height:             	100
+ *displayWindow.scrollVertical:		whenNeeded
+ *displayWindow.scrollHorizontal:	whenNeeded
+ *displayWindow.translations:		#override \n\
+ 	<Btn1Down>:             SelectStart() SelectWord() \n\
+ 	Shift<Btn1Up>:          SelectEnd() PrintSelection() \n\
+ 	<Btn1Up>:               SelectEnd() \n
+-*popup*showGrip:			False
++*popup*showGrip:  			False
++*bindings:                         	emacs
+diff -urNad xxgdb-1.12~/calldbx.c xxgdb-1.12/calldbx.c
+--- xxgdb-1.12~/calldbx.c	2008-05-16 17:39:25.000000000 +0200
++++ xxgdb-1.12/calldbx.c	2008-05-16 17:39:25.000000000 +0200
+@@ -73,7 +73,7 @@
+ #include <stdlib.h>
+ #include <string.h>
+ #include <fcntl.h>
+-#include "global.h"
++#include <sys/ioctl.h>
+ #if !(defined(OLDSUNOS) || defined(BSD))
+ #include <termio.h>
+ #else
+@@ -81,16 +81,18 @@
+ #endif
+ 
+ #ifdef CREATE_IO_WINDOW
++#include        <signal.h>
+ #include	<sys/socket.h>
+ #include        <sys/un.h>
+ #endif /* CREATE_IO_WINDOW */
+ 
++#include "global.h"
++
+ #ifdef SVR4
+ #define MASTER_CLONE "/dev/ptmx"
+ #include <sys/types.h>
+ #include <sys/stat.h>
+ #include <sys/stropts.h>
+-#include <signal.h>
+ #endif /* SVR4 */
+ 
+ #if (defined(BSD) && (BSD < 44)) || defined(ultrix)
+@@ -114,6 +116,7 @@
+ 
+ #ifdef CREATE_IO_WINDOW
+ char            iowintty[] = "/dev/ttyp0";
++char            savetty[] = "/dev/tty??";
+ int             iowinpid = 0;
+ #endif /* CREATE_IO_WINDOW */
+ /*
+@@ -143,7 +146,7 @@
+ 	for (i=0; i<8; i++) {
+ #endif
+ 	    pty[8] = c;
+-	    pty[9] = "0123456789abcdef"[i];
++	    pty[9] = "0123456789abcdef"[i]; 
+ 	    if ((master = open(pty, O_RDWR)) >= 0) 
+ 		return (master); 
+ 	}
+@@ -236,6 +239,20 @@
+ 	}
+ 	}
+ }
++
++void
++close_io_window()
++{
++	static char ttycommand[50];
++
++	kill (iowinpid, SIGTERM);
++	iowinpid = 0;
++	iowintty[8] = pty[8];
++	iowintty[9] = pty[9];
++	sprintf(ttycommand, "tty %s\n", iowintty);
++	query_gdb (ttycommand, PARSE_OFF | ECHO_OFF | FILTER_OFF);
++}
++
+ #endif /* CREATE_IO_WINDOW */
+ 
+ /* ARGSUSED */
+diff -urNad xxgdb-1.12~/command.c xxgdb-1.12/command.c
+--- xxgdb-1.12~/command.c	1996-10-02 10:59:45.000000000 +0200
++++ xxgdb-1.12/command.c	2008-05-16 17:39:25.000000000 +0200
+@@ -138,6 +138,18 @@
+     AppendDialogText(command);
+ }
+ 
++void toggle_io_window( w, client_data, call_data )
++    Widget w;
++    XtPointer client_data;
++    XtPointer call_data;
++{	
++	if (client_data == (XtPointer)1) {
++		xxgdb_command("iowin\n", FALSE);
++	} else {
++		if(iowinpid) close_io_window();
++	}
++}
++
+ #if !defined(GDB) && defined(BSD)	/* >>>>>>>>>> NOT USED FOR GDB <<<<<<<<<<<<<<< */
+ 
+ /* ARGSUSED */
+@@ -383,24 +395,25 @@
+     XtPointer client_data;
+     XtPointer call_data;
+ {
+-#ifdef SYSV 
++#ifdef HAVE_WAITPID 
+     int status;
+ #else
+     union wait status;
+-#endif /* SYSV */
++#endif /* HAVE_WAITPID */
+ 
++    if (iowinpid) close_io_window();
+     write_dbx("quit\n");
+     XtDestroyApplicationContext(app_context);
+     kill(dbxpid, SIGKILL);
+-#ifdef SYSV
++#ifdef HAVE_WAITPID
+ #if 1 /* instead of ifdef SVR4 */
+ 	status = waitpid(dbxpid, (int *)0, WNOHANG);	/* (MJH) */
+ #else
+ 	waitpid(&status, NULL, WNOHANG);
+ #endif	/* SVR4 */
+-#else	/* not SYSV */
++#else	/* not HAVE_WAITPID */
+     wait3(&status, WNOHANG, NULL);
+-#endif /* SYSV */
++#endif /* HAVE_WAITPID */
+     exit(0);
+ }
+ 
+@@ -829,6 +842,10 @@
+     button[i++] = AddButton (parent, "yes", DoIt, "y\n");                         /* AJK */
+     button[i++] = AddButton (parent, "no", DoIt, "n\n");                          /* AJK */
+     button[i++] = AddButton (parent, "quit", Quit, NULL);
++#ifdef CREATE_IO_WINDOW
++    button[i++] = AddButton (parent, "I/O Win", toggle_io_window, (XtPointer)1 );
++    button[i++] = AddButton (parent, "no I/O Win", toggle_io_window, (XtPointer)0 );
++#endif
+ #else	/* >>>>>>>>>> IF NOT GDB <<<<<<<<<<<<<<< */
+ 
+ 
+diff -urNad xxgdb-1.12~/defs.h xxgdb-1.12/defs.h
+--- xxgdb-1.12~/defs.h	1994-12-03 02:33:33.000000000 +0100
++++ xxgdb-1.12/defs.h	2008-05-16 17:39:25.000000000 +0200
+@@ -144,6 +144,10 @@
+ #define	SECLASTCH(s)	(s[strlen(s)-2])
+ 
+ #ifdef SUNOS4
++#define USE_DIRENT
++#endif
++
++#ifdef USE_DIRENT
+ typedef struct dirent 	Directory;
+ #else
+ typedef struct direct 	Directory;
+diff -urNad xxgdb-1.12~/dialog.c xxgdb-1.12/dialog.c
+--- xxgdb-1.12~/dialog.c	1995-06-20 00:15:13.000000000 +0200
++++ xxgdb-1.12/dialog.c	2008-05-16 17:39:25.000000000 +0200
+@@ -235,11 +235,11 @@
+ {
+ #ifndef GDB
+     FalseSignal = TRUE;
+-#ifdef SYSV /* (PW)13AUG92:  change SVR4 into SYSV */ /* (MJH) */
++#ifndef HAVE_KILLPG
+    kill(-(dbxpid), SIGINT);
+ #else
+    killpg(dbxpid, SIGINT);
+-#endif /* SYSV */
++#endif /* HAVE_KILLPG */
+ #else      
+ 	write_dbx("\003");	/* (PW)18FEB91 : seems to work better */
+ #endif	/* GDB */
+@@ -282,11 +282,11 @@
+ {
+     FalseSignal = TRUE;
+ 
+-#ifdef SYSV /* (PW)13AUG92:  change SVR4 into SYSV */ /* (MJH) */
++#ifndef HAVE_KILLPG
+     kill(-(dbxpid), SIGQUIT);
+ #else
+     killpg(dbxpid, SIGQUIT);
+-#endif /* SYSV */
++#endif /* HAVE_KILLPG */
+ }
+ 
+ 
+diff -urNad xxgdb-1.12~/filemenu.c xxgdb-1.12/filemenu.c
+--- xxgdb-1.12~/filemenu.c	1994-08-29 21:38:28.000000000 +0200
++++ xxgdb-1.12/filemenu.c	2008-05-16 17:39:25.000000000 +0200
+@@ -81,7 +81,7 @@
+ #include <X11/Xos.h>
+ #include <sys/stat.h>
+ 
+-#ifdef SYSV 
++#ifdef NO_SCANDIR 
+ #include <stdio.h>
+ #include <sys/param.h>
+ #include <sys/types.h>
+@@ -94,13 +94,13 @@
+ #define	S_IEXEC	00100		/* execute/search permission, owner */
+ #endif
+ #endif	/* _POSIX_SOURCE */
+-#else	/* SYSV */
++#else	/* NO_SCANDIR */
+ #ifdef SUNOS4
+ #include <dirent.h>
+ #else
+ #include <sys/dir.h>
+ #endif
+-#endif /* SYSV */
++#endif /* NO_SCANDIR */
+ #include "global.h"
+ 
+ #define MAXCOLUMNS      8               /* max number of columns in file menu */
+@@ -185,7 +185,7 @@
+  *    text files 
+  *    executable files
+  */
+-#ifndef SYSV
++#ifndef NO_SCANDIR
+ static int InList(entry)
+ Directory *entry;
+ {
+@@ -217,7 +217,7 @@
+     }
+     return True;
+ }
+-#endif /* not SYSV */
++#endif /* not NO_SCANDIR */
+ 
+ 
+ /*  Scans the working directory for files selected by InList(), sorted
+@@ -228,7 +228,7 @@
+ static void ScanDir(dir)
+ char *dir;
+ {
+-#ifndef SYSV 
++#ifndef NO_SCANDIR 
+     extern 	alphasort();
+     Directory   **namelist;
+ #else
+@@ -238,7 +238,7 @@
+ #endif
+     register int		i,j;
+ 
+-#ifdef SYSV 
++#ifdef NO_SCANDIR 
+     if(!(WorkingDir = opendir(dir)))
+       {
+ 	UpdateMessageWindow("scandir: cannot open %s", dir);
+@@ -262,7 +262,7 @@
+     filelist = (char **) XtMalloc((nfiles+1) * sizeof(char *));
+     i = 0;
+     for (j=0; j<nfiles; j++) {
+-#ifdef SYSV 
++#ifdef NO_SCANDIR 
+       WorkingDirEntry = readdir(WorkingDir);
+       if(!strcmp(WorkingDirEntry->d_name, "."))
+ 	  strcpy(store, "./");
+@@ -298,14 +298,14 @@
+ 	}
+ 	 if(store[0])    
+ 	   filelist[i++] = XtNewString(store);
+-#else /* not SYSV */
++#else /* not NO_SCANDIR */
+       filelist[i++] = XtNewString(namelist[j]->d_name);
+       XtFree((XtPointer) namelist[j]);
+ #endif
+     }
+     filelist[i++] = NULL;
+ 
+-#ifdef SYSV 
++#ifdef NO_SCANDIR 
+     closedir(WorkingDir);
+ #else
+     XtFree((XtPointer) namelist);
+diff -urNad xxgdb-1.12~/gdb_handler.c xxgdb-1.12/gdb_handler.c
+--- xxgdb-1.12~/gdb_handler.c	1995-04-19 18:46:22.000000000 +0200
++++ xxgdb-1.12/gdb_handler.c	2008-05-16 17:39:25.000000000 +0200
+@@ -85,7 +85,7 @@
+  *    query_gdb():			Send command to gdb.
+  */
+ 
+-#ifdef SYSV 
++#ifdef HAVE_SIGNAL_H 
+ #   include <signal.h>
+ #endif
+ 
+diff -urNad xxgdb-1.12~/gdb_parser.c xxgdb-1.12/gdb_parser.c
+--- xxgdb-1.12~/gdb_parser.c	1996-10-02 10:59:45.000000000 +0200
++++ xxgdb-1.12/gdb_parser.c	2008-05-16 17:39:25.000000000 +0200
+@@ -1355,7 +1355,8 @@
+ int echo;
+ {
+ #ifdef CREATE_IO_WINDOW
+-	if (command && (!strcmp(command,"iowin\n")))	/* test for 'iowin' command */
++	if (command) {
++             if(!strcmp(command,"iowin\n")) /* test for 'iowin' command */
+ 		{
+ 		if (echo)
+ 			AppendDialogText(command);
+@@ -1368,7 +1369,12 @@
+ 			}
+ 		return TRUE;
+ 		}
++	     if(!strcmp(command,"noiowin\n")) {
++		if (iowinpid) close_io_window ();
++		return TRUE;
++	     }
+ #endif /* CREATE_IO_WINDOW */
++	}
+ 		
+ 	return FALSE;
+ }
+diff -urNad xxgdb-1.12~/global.h xxgdb-1.12/global.h
+--- xxgdb-1.12~/global.h	1996-01-20 18:05:11.000000000 +0100
++++ xxgdb-1.12/global.h	2008-05-16 17:39:25.000000000 +0200
+@@ -76,14 +76,23 @@
+ #endif
+ #endif
+ 
+-#if defined(SYSV) && !defined(MAX)
++#if !defined(MAX)
+ #define MAX(a,b)	((a)>(b)?(a):(b))
+ #define MIN(a,b)	((a)>(b)?(b):(a))
++#endif
++#ifdef SYSV
+ #ifdef sco
+ #include <unistd.h>
+ #endif
+ #endif
+ 
++/* Old SYSV dependencies */
++#ifdef SYSV
++#define NO_SCANDIR
++#undef HAVE_KILLPG
++#define HAVE_WAITPID
++#define HAVE_SIGNAL_H
++#endif
+ /* calldbx.c */
+ 
+ extern void		calldbx();		/* fork child, exec dbx */
+diff -urNad xxgdb-1.12~/regex.c xxgdb-1.12/regex.c
+--- xxgdb-1.12~/regex.c	1996-10-02 10:59:45.000000000 +0200
++++ xxgdb-1.12/regex.c	2008-05-16 17:39:25.000000000 +0200
+@@ -1774,7 +1774,7 @@
+ {
+   puts (string);
+ #ifdef CREATE_IO_WINDOW
+-  if (iowinpid) kill(iowinpid, SIGKILL);
++  if (iowinpid) kill(iowinpid, SIGTERM);
+   iowinpid = 0;
+ #endif /* CREATE_IO_WINDOW */
+   exit (1);
+diff -urNad xxgdb-1.12~/signals.c xxgdb-1.12/signals.c
+--- xxgdb-1.12~/signals.c	1996-10-02 10:59:45.000000000 +0200
++++ xxgdb-1.12/signals.c	2008-05-16 17:39:25.000000000 +0200
+@@ -80,7 +80,7 @@
+       case SIGTERM : fprintf(stderr, "Soft kill\n"); break;
+     }
+ #ifdef CREATE_IO_WINDOW
+-    if (iowinpid) kill(iowinpid, SIGKILL);
++    if (iowinpid) kill(iowinpid, SIGTERM);
+     iowinpid = 0;
+     sleep(10);
+ #endif /* CREATE_IO_WINDOW */
+@@ -92,17 +92,17 @@
+ 
+ static void quit_handler(int sig)
+ {
+-	int pid;
+-#ifdef SYSV 
++	pid_t pid;
++#ifdef HAVE_WAITPID
+     int status;
+ #else
+     union wait status;
+-#endif /* SYSV */
++#endif /* HAVE_WAITPID */
+ 
+     /*  wait for the child to report its status; if the child has died, 
+      *  exit gracefully.
+      */
+-#ifdef SYSV 
++#ifdef HAVE_WAITPID 
+ #if 1  /* instead of ifdef SVR4 */
+ 	pid = waitpid((pid_t)0, &status, WNOHANG|WUNTRACED);	/* (MJH) */
+ #else
+@@ -110,7 +110,7 @@
+ #endif /* SVR4 */
+ #else
+    pid =  wait3(&status, WNOHANG|WUNTRACED, NULL);
+-#endif /* SYSV */
++#endif /* HAVE_WAITPID */
+ 
+ #ifdef EDIT_BUTTON
+     /* dont die if sub edit process dies */
+@@ -123,7 +123,7 @@
+ 		{
+ #ifdef CREATE_IO_WINDOW
+ 		if (iowinpid)
+-			kill(iowinpid, SIGKILL);
++			kill(iowinpid, SIGTERM);
+ 		iowinpid = 0;
+ #endif /* CREATE_IO_WINDOW */
+ 		if (debug) {
+diff -urNad xxgdb-1.12~/xdbx.c xxgdb-1.12/xdbx.c
+--- xxgdb-1.12~/xdbx.c	1995-04-21 04:37:31.000000000 +0200
++++ xxgdb-1.12/xdbx.c	2008-05-16 17:39:25.000000000 +0200
+@@ -74,7 +74,7 @@
+ #define XGDBVERSION	"1.12"
+ #endif
+ 
+-#ifdef SYSV 
++#if defined(SYSV) || defined(linux)
+ #   include <stdio.h>
+ #   include <stdlib.h>
+ #   include <sys/param.h>
+diff -urNad xxgdb-1.12~/xxgdb.man xxgdb-1.12/xxgdb.man
+--- xxgdb-1.12~/xxgdb.man	1996-10-02 10:59:45.000000000 +0200
++++ xxgdb-1.12/xxgdb.man	2008-05-16 17:39:25.000000000 +0200
+@@ -100,12 +100,15 @@
+ scrollbar.  Dragging the MIDDLE mouse button down moves the thumb along
+ and changes the text displayed.
+ 
+-.SH IOWIN COMMAND
++.SH IOWIN and NOIOWIN COMMAND
+ If compiled, with the right option, xxgdb can use a separate io window
+ to talk to gdb, so program output is not confused with gdb output.
+ Type command 'iowin' in Dialogue Window to create io window. If you
+ get 'Undefined command' error message, then xxgdb was not compiled for
+ that feature. The program xxgdbiowin is used for this io window.
++.LP
++If xxgdb was compiled with iowin support, typing 'noiowin' will close
++the io window and reset the controlling terminal of the debugger. 
+ 
+ .SH COMMAND BUTTONS
+ .SS "Execution Commands"
+@@ -198,6 +201,10 @@
+ Send 'n' (no) to gdb. To be used when gdb requires a yes/no response.
+ .IP "\fBquit\fP"
+ Exit \fIxxgdb\fP.
++.IP "\fBI/O Win\fP"
++Create io window.
++.IP "\fBNo I/O Win\fP"
++Delete io window.
+ 
+ .LP
+ .SS "Displaying C Data Structures
+diff -urNad xxgdb-1.12~/xxgdbiowin.c xxgdb-1.12/xxgdbiowin.c
+--- xxgdb-1.12~/xxgdbiowin.c	1996-10-02 10:59:45.000000000 +0200
++++ xxgdb-1.12/xxgdbiowin.c	2008-05-16 17:39:25.000000000 +0200
+@@ -9,7 +9,7 @@
+ #include <stdio.h>
+ #include <stdlib.h>
+ 
+-#if ( defined(SYSV) || defined(SVR4) ) && !defined(HPUX)
++#if ( defined(SYSV) || defined(SVR4) ) && !defined(HPUX) && !defined(linux)
+ #define signal sigset
+ #endif
+ 
--- xxgdb-1.12.orig/debian/source/format
+++ xxgdb-1.12/debian/source/format
@@ -0,0 +1 @@
+1.0
