--- xdrawchem-1.9.9.orig/debian/rules
+++ xdrawchem-1.9.9/debian/rules
@@ -0,0 +1,69 @@
+#!/usr/bin/make -f
+
+export QTDIR=/usr/share/qt3
+
+package=xdrawchem
+CXXFLAGS = -g -Wall
+
+include /usr/share/dpatch/dpatch.make
+
+ifeq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
+  CXXFLAGS += -O2
+endif
+
+configure: configure-stamp 
+configure-stamp: patch-stamp
+	dh_testdir
+	autoreconf -i
+	CXXFLAGS="$(CXXFLAGS)" ./configure --prefix=/usr
+	touch configure-stamp
+
+build: build-stamp
+build-stamp: configure-stamp
+	dh_testdir
+	$(MAKE) 
+	touch build-stamp
+
+install: build
+	dh_testdir
+	dh_testroot
+	dh_clean -k
+	dh_installdirs
+	$(MAKE) install DESTDIR=$(CURDIR)/debian/xdrawchem \
+		INSTDIR=$(CURDIR)/debian/xdrawchem/usr/bin \
+		INSTRING=$(CURDIR)/debian/xdrawchem/usr/share/xdrawchem
+
+clean: unpatch
+	dh_testdir
+	dh_testroot
+	-rm -f build-stamp configure-stamp patch-stamp
+	-$(MAKE) distclean
+	-rm openbabel/math/*.o
+	-rm -f `find . -name "*~"`
+	dh_clean
+
+binary-indep: build install
+
+binary-arch: build install
+	dh_testdir
+	dh_testroot
+	dh_installdocs
+	dh_installexamples
+	dh_installmenu
+	dh_installman
+	dh_installchangelogs HISTORY.txt
+	dh_install xdrawchem/xdc.xpm usr/share/pixmaps
+	dh_install debian/xdrawchem.desktop usr/share/applications
+	dh_link
+	dh_strip
+	dh_compress -Xhtml/HISTORY.txt -Xhtml/GPL.txt -Xhtml/COPYRIGHT.txt
+	dh_fixperms
+	dh_installdeb
+	dh_shlibdeps
+	dh_gencontrol
+	dh_md5sums
+	dh_builddeb
+	
+binary: binary-indep binary-arch
+
+.PHONY: binary binary-arch binary-indep clean 
--- xdrawchem-1.9.9.orig/debian/README.debian
+++ xdrawchem-1.9.9/debian/README.debian
@@ -0,0 +1,7 @@
+xdrawchem for Debian
+----------------------
+
+Comments regarding the Package
+ - The original source for this packages is under rapid update and modifications by the author, Brian Herger.
+
+Warren Stramiello <stramiello@debian.org>, Wed,  9 May 2001 16:02:28 -0400
--- xdrawchem-1.9.9.orig/debian/menu
+++ xdrawchem-1.9.9/debian/menu
@@ -0,0 +1,2 @@
+?package(xdrawchem):needs="X11" section="Apps/Science"\
+  title="xdrawchem" command="/usr/bin/xdrawchem"
--- xdrawchem-1.9.9.orig/debian/dirs
+++ xdrawchem-1.9.9/debian/dirs
@@ -0,0 +1,3 @@
+usr/bin
+usr/share/man/man1
+usr/share/doc/xdrawchem/html
--- xdrawchem-1.9.9.orig/debian/watch
+++ xdrawchem-1.9.9/debian/watch
@@ -0,0 +1,22 @@
+# Example watch control file for uscan
+# Rename this file to "watch" and then you can run the "uscan" command
+# to check for upstream updates and more.
+# See uscan(1) for format
+
+# Compulsory line, this is a version 3 file
+version=3
+
+# Uncomment to examine a Webpage 
+# <Webpage URL> <string match>
+#http://www.example.com/downloads.php #PACKAGE#-(.*)\.tar\.gz
+
+# Uncomment to examine a Webserver directory
+#http://www.example.com/pub/#PACKAGE#-(.*)\.tar\.gz
+
+# Uncommment to examine a FTP server
+#ftp://ftp.example.com/pub/#PACKAGE#-(.*)\.tar\.gz debian uupdate
+
+# Uncomment to find new files on sourceforge, for debscripts >= 2.9
+http://sf.net/xdrawchem/xdrawchem-(.*)\.tar\.gz
+
+
--- xdrawchem-1.9.9.orig/debian/xdrawchem.1
+++ xdrawchem-1.9.9/debian/xdrawchem.1
@@ -0,0 +1,74 @@
+.\"     Title: XDRAWCHEM
+.\"    Author: Warren Stramiello <stramiello@debian.org>
+.\" Generator: DocBook XSL Stylesheets v1.71.0 <http://docbook.sf.net/>
+.\"      Date: 11/14/2006
+.\"    Manual: User manuals
+.\"    Source: xdrawchem
+.\"
+.TH "XDRAWCHEM" "1" "11/14/2006" "xdrawchem" "User manuals"
+.\" disable hyphenation
+.nh
+.\" disable justification (adjust text to left margin only)
+.ad l
+.SH "NAME"
+xdrawchem \- open\-source chemical structures editor similar to ChemDraw
+.SH "SYNOPSIS"
+.HP 10
+\fBxdrawchem\fR [\fIINPUT\-FILE\fR] [\fBOPTION(S)\fR...] [\fIOUTPUT\-FILE\fR]
+.SH "DESCRIPTION"
+.PP
+\fBxdrawchem\fR
+is a program that attempts to duplicate the functionality of
+ChemDraw, a molecule structure drawing application. It operates in much the same fashion, and should be highly familiar to users of
+ChemDraw.
+.PP
+\fBxdrawchem\fR
+has file compatibility with Chemdraw and MDL files. It can also create images in popular formats like PNG and EPS.
+.SH "OPTIONS"
+.PP
+\fBxdrawchem\fR
+accepts the following options:
+.PP
+\fB\-png\fR \fIOUTPUT\-FILE\fR
+.RS 3n
+Create a PNG image of an input file and exit.
+.RE
+.PP
+\fB\-t \-png\fR \fIOUTPUT\-FILE\fR
+.RS 3n
+Create a transparent PNG image of an input file and exit.
+.RE
+.PP
+\fB\-3d\fR \fIOUTPUT\-FILE\fR
+.RS 3n
+Create a Make 3D model of input file and output a MDL mofile.
+.RE
+.PP
+\fB\-h\fR, \fB\-\-help\fR
+.RS 3n
+Show summary of options.
+.RE
+.PP
+\fB\-v\fR, \fB\-\-version\fR
+.RS 3n
+Show version of program.
+.RE
+.SH "AUTHORS"
+.PP
+\fBWarren Stramiello\fR <\&stramiello@debian.org\&>
+.sp -1n
+.IP "" 3n
+Wrote this manpage for the Debian GNU/Linux system.
+.PP
+\fBDaniel Leidert\fR <\&daniel.leidert@wgdd.de\&>
+.sp -1n
+.IP "" 3n
+Updates for this manpage.
+.SH "COPYRIGHT"
+Copyright \(co 2004\-2005 Warren Stramiello
+.br
+Copyright \(co 2005\-2006 Daniel Leidert
+.br
+.PP
+This manpage was written for the Debian distribution, but may be used by others.
+.br
--- xdrawchem-1.9.9.orig/debian/xdrawchem.desktop
+++ xdrawchem-1.9.9/debian/xdrawchem.desktop
@@ -0,0 +1,10 @@
+[Desktop Entry]
+Version=1.0
+Encoding=UTF-8
+Name=xdrawchem Chemistry Editor
+GenericName=Chemistry Editor
+Comment=Edit chemical structures and reactions
+Type=Application
+Exec=xdrawchem
+Icon=xdc
+Categories=Education;Science;Chemistry;
--- xdrawchem-1.9.9.orig/debian/xdrawchem.manpages
+++ xdrawchem-1.9.9/debian/xdrawchem.manpages
@@ -0,0 +1 @@
+debian/xdrawchem.1
--- xdrawchem-1.9.9.orig/debian/compat
+++ xdrawchem-1.9.9/debian/compat
@@ -0,0 +1 @@
+4
--- xdrawchem-1.9.9.orig/debian/control
+++ xdrawchem-1.9.9/debian/control
@@ -0,0 +1,17 @@
+Source: xdrawchem
+Section: science
+Priority: optional
+Maintainer: Warren Stramiello <stramiello@debian.org>
+Uploaders: Michael Banck <mbanck@debian.org>
+Build-Depends: debhelper (>= 4), dpatch, automake1.9, autoconf, libtool, libqt3-mt-dev (>= 3:3.3.4-4), libqt3-compat-headers, libopenbabel-dev (>= 2.0.0-1)
+Build-Conflicts: autoconf2.13, automake1.4, libqt4-dev
+Standards-Version: 3.7.2
+
+Package: xdrawchem
+Architecture: any
+Depends: ${shlibs:Depends}
+Description: Chemical structures and reactions editor
+ Xdrawchem is a 2D editor for chemical structures and reactions.  It 
+ mirrors the abilities of the commercial ChemDraw suite and has file 
+ compatibility with it as well as other chemical formats through 
+ OpenBabel.
--- xdrawchem-1.9.9.orig/debian/copyright
+++ xdrawchem-1.9.9/debian/copyright
@@ -0,0 +1,27 @@
+This package was debianized by Warren Stramiello stramiello@debian.org on
+Wed,  9 May 2001 16:02:28 -0400.
+
+It was downloaded from http://www.prism.gatech.edu/~gte067k/xdrawchem/
+
+XDrawChem is (C) 2001 by Bryan Herger.  All rights reserved.
+
+Portions copyright by Christoph Steinbeck, the JChemPaint project and
+others.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+ 
+You should have received a copy of the GNU General Public License
+along with this package; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+02110-1301, USA.
+
+On Debian GNU/Linux systems, the complete text of the GNU General
+Public License can be found in `/usr/share/common-licenses/GPL'.
--- xdrawchem-1.9.9.orig/debian/changelog
+++ xdrawchem-1.9.9/debian/changelog
@@ -0,0 +1,251 @@
+xdrawchem (1.9.9-4.1) unstable; urgency=medium
+
+  * Non-maintainer upload.
+  * debian/patches/04_shellescape.dpatch:
+    - Fix location of patched files (Closes: #560527).
+
+ -- Luca Falavigna <dktrkranz@debian.org>  Wed, 14 Jul 2010 14:59:08 +0000
+
+xdrawchem (1.9.9-4) unstable; urgency=low
+
+  [ Li Daobing ]
+  * debian/xdrawchem.desktop: fix warning for desktop-file-validate.
+  * FTBFS with GCC 4.3: missing #includes (Closes: #417776)
+    - debian/patches/05_ftbfs_with_gcc_4.3.dpatch: added
+    - debian/patches/00list: updated
+  * debian/watch: added
+  * build conflicts with libqt4-dev
+
+  [ Michael Banck ]
+  * debian/patches/06_online_search_crash.patch: New patch by Tom
+    Mortimer-Jones; fixes crash when not choosing a result from an
+    online search. (Closes Malone: #112644)
+
+ -- Michael Banck <mbanck@debian.org>  Mon, 14 May 2007 14:06:41 +0200
+
+xdrawchem (1.9.9-3) unstable; urgency=medium
+
+  [ Daniel Leidert ]
+  * debian/copyright: Fixed outdated FSF address (fixes lintian warning).
+  * debian/control (Standards-Version): Changed to latest standards version
+    3.7.2 (fixes lintian warning).
+    (Build-Depends): Fixed debhelper version dependency to fit compat level
+    (fixes linda error).
+    (Build-Conflicts): Added build-conflicts in accordance to autotools-dev
+    README.Debian.
+  * debian/docs: Removed GPL.txt, COPYRIGHT.txt and HISTORY.txt, which are in
+    the html docs too. Further the information they provide is already
+    available as changelog.gz, copyright and /usr/share/common-licenses/GPL.
+  * debian/rules: Cleaned.
+    - Added dh_clean to clean target instead of removing the debhelper files
+      manually.
+    - Removed documentation movement.
+    - Avoid compression of html/*.txt.
+  * debian/xdrawchem.manpages: Added (fixes lintian warning).
+  * debian/xdrawchem.1: Updated manpage.
+  * debian/patches/02_documentation_root.dpatch: Fixed.
+    - doc/Makefile.am (htmldir): Install documentation into
+      /usr/share/doc/xdrawchem/html.
+    - doc/HISTORY.txt: Update the outdated copy from HISTORY.txt.
+    - xdrawchem/application.cpp (ApplicationWindow::NewManual): Removed
+      leading RingDir variable in the manual path, so that it points to the
+      right location.
+      (ApplicationWindow::HelpTopic): Also fix the path for the topic-specific
+      help.
+
+  [ Michael Banck ]
+  * Set urgency to medium.
+
+ -- Michael Banck <mbanck@debian.org>  Tue, 14 Nov 2006 23:01:52 +0100
+
+xdrawchem (1.9.9-2) unstable; urgency=high
+
+  * Urgency high due to RC bug fix.
+  * Sync with Ubuntu.
+  * debian/patches/04_shellescape.dpatch: New patch by Steinar H.
+    Gunderson, fixes handling of filenames with non-ascii characters.
+    (Closes: #360490)
+  * debian/rules (configure-stamp): Run autoreconf.
+  * debian/control (Build-Depends): Added automake1.9, autoconf and
+    libtool.
+
+ -- Michael Banck <mbanck@debian.org>  Mon, 13 Nov 2006 00:04:48 +0100
+
+xdrawchem (1.9.9-1ubuntu1) edgy; urgency=low
+
+  * Re-sync with Debian
+  * Add desktop file from Phil Bull. (Closes Malone: #36446)
+  * Install icon file in /usr/share/pixmaps
+
+ -- Barry deFreese <bddebian@comcast.net>  Wed, 12 Jul 2006 22:54:52 -0400
+
+xdrawchem (1.9.9-1) unstable; urgency=low
+
+  * New upstream release.
+  * Switch to dpatch and debhelper.
+  * Switch to openbabel-2.0 (Closes: #360490)
+  * Bumped Standards-Version to 3.6.2.
+
+ -- Michael Banck <mbanck@debian.org>  Sat, 22 Apr 2006 00:25:24 +0200
+
+xdrawchem (1.9.8-2) unstable; urgency=low
+
+  * Rewrote short and long descriptions (Closes: #337069)
+  * Look for online documentation in /usr/share/doc/xdrawchem rather
+    than /usr/share/xdrawchem/doc (Closes: #337752)
+  * Applied patch by Jens Seidel to fix german translation 
+    (Closes: #313855)
+
+ -- Michael Banck <mbanck@debian.org>  Sun, 20 Nov 2005 18:07:30 +0100
+
+xdrawchem (1.9.8-1) unstable; urgency=low
+
+  * New upstream release
+  * Build-Depend on g++-4.0 transitioned package versions of 
+    libopenbabel and libqt3-mt (Closes: #323422)
+
+ -- Michael Banck <mbanck@debian.org>  Mon, 22 Aug 2005 00:27:40 +0200
+
+xdrawchem (1.9.6-1) unstable; urgency=low
+
+  * New upstream release
+    - Selecting 'Cut' from the context menu no longer produces a 
+      segfault (Closes: #303440)
+
+ -- Michael Banck <mbanck@debian.org>  Sun, 19 Jun 2005 14:48:05 +0200
+
+xdrawchem (1.9.4-3) unstable; urgency=low
+
+  * Added some more bogus warnings to xdrawchem/boshcp.cpp. 
+
+ -- Michael Banck <mbanck@debian.org>  Fri,  8 Apr 2005 00:40:30 +0200
+
+xdrawchem (1.9.4-2) unstable; urgency=low
+
+  * Added a bogus warning to xdrawchem/boshcp.cpp to translate
+    activity to the buildds. 
+
+ -- Michael Banck <mbanck@debian.org>  Tue,  5 Apr 2005 18:40:14 +0200
+
+xdrawchem (1.9.4-1) unstable; urgency=low
+
+  * New upstream release (Closes: #292288)
+    - EPS export now supports color (Closes: #292289)
+  * Quote values in menu entry (Thanks, Li Daobing)
+  * Honor 'noopt' in DEB_BUILD_OPTIONS (Thanks, Li Daobing)
+
+ -- Michael Banck <mbanck@debian.org>  Fri,  1 Apr 2005 02:03:18 +0200
+
+xdrawchem (1.8.5-1) unstable; urgency=low
+
+  * New upstream release (Closes: #261504)
+    - Italian translation has been integrated (Closes: #239160)
+
+ -- Michael Banck <mbanck@debian.org>  Sat,  7 Aug 2004 03:14:47 +0200
+
+xdrawchem (1.7.8-2) unstable; urgency=low
+
+  * debian/menu: Changed section from math to science 
+
+ -- Michael Banck <mbanck@debian.org>  Sun, 28 Mar 2004 14:45:33 +0200
+
+xdrawchem (1.7.8-1) unstable; urgency=low
+
+  * New upstream release
+  * debian/xdrawchem.1: Updated manpage
+  * debian/*ex: Removed unneeded debhelper template files
+
+ -- Michael Banck <mbanck@debian.org>  Thu,  4 Mar 2004 21:39:55 +0100
+
+xdrawchem (1.7.6-1) unstable; urgency=low
+
+  * Michael Banck joined as co-maintainer
+  * New upstream release
+    - 'Find on Internet/CAS' seems to work properly now (Closes: #215410)
+  * A recompile brings back dependencies (Closes: #215406)
+  * debian/control: 
+    - Added Build-Depends on libopenbabel-dev
+    - Added myself to Uploaders:
+  * debian/rules: Use CXXFLAGS=-g, as -O2 lets g++ choke on chemdata_rxn.cpp
+  * config.guess, config.sub: Updated from latest version in
+    autotools-dev (Closes: #202528)
+  * Acknowledge NMUs (Closes: #98056, #99919, #120810, #121872, #171945,
+    #125526, #119421, #135784)
+
+ -- Michael Banck <mbanck@debian.org>  Mon, 19 Jan 2004 01:13:58 +0100
+
+xdrawchem (1.7.4-0.1) unstable; urgency=low
+
+  * Maintainer Release (Back Finally!)
+  * New upstream release
+
+ -- Warren Stramiello <stramiello@debian.org>  Thu,  31 Jul 2003 21:03:18 -0400
+
+xdrawchem (1.7.3-0.1) unstable; urgency=low
+
+  * Non Maintainer Upload
+  * New upstream release (Closes: #171945)
+    - This seems to fix segfaults when removing bonds (Closes: #179979)
+  * debian/rules:
+    - Export $QTDIR
+    - Added a configure-target to debian/rules and removed the now
+      unneccesary variables from the $MAKE call
+    - Put html-documentation under /usr/share/doc/xdrawchem/html
+    - Changed call from clean to distclean in clean-target
+  * debian/control: 
+    - Removed Recommends on openbabel as it is now part of the source tree
+    - Use libqt3 as Build-Depends (Closes: #198550)
+  * openbabel/Makefile.in:
+    - Remove object files in openbabel/math on clean, too
+    - Don't install the babel executable, xdrawchem is linked
+      statically to libopenbabel.a
+    - Put the openbabel data files into /usr/share/xdrawchem to prevent
+      conflicts with the openbabel package
+  * configure: Add openbabel/version.h to ac_config_files
+
+ -- Michael Banck <mbanck@debian.org>  Sat, 19 Jul 2003 15:19:31 +0200
+
+xdrawchem (1.0-0.1) unstable; urgency=low
+
+  * Non Maintainer Upload, with permission
+  * New upstream release (Closes: #135784)
+  * Fixed description (Closes: #125526)
+  * Moved Ring templates from /usr/lib/xdrawchem to
+    /usr/share/xdrawchem (Closes: #121872)
+  * Added INSTRING and MOC to Debian build-target
+  * Added a Recommends: openbabel as xdrawchem can now take advantage
+    of babel for import/export
+
+ -- Michael Banck <mbanck@gmx.net>  Thu, 28 Feb 2002 19:47:52 +0100
+
+xdrawchem (0.99.4-0.1) unstable; urgency=low
+
+  * Non Maintainer Upload, with permission
+  * New upstream release (Closes: #119421)
+  * Included templates in /usr/lib/xdrawchem (Closes: #107628, #98056)
+  * Fixed Menu entry (Closes: #120810)
+  * Fixed manpage (Closes: #99919) and included it in the Debian diff
+  * Added Build-depends
+  * Changed debian/copyright to point to /usr/share/common-licenses/GPL
+  * Added HISTORY.txt as upstream ChangeLog
+  * Fixed Copyright notice in debian/copyright 
+
+ -- Michael Banck <mbanck@gmx.net>  Tue, 27 Nov 2001 20:07:46 +0100
+
+xdrawchem (0.85-1.1) unstable; urgency=low
+
+  * NMU
+  * render2d.cpp: add #include <stdlib.h> for abs() prototype
+    (Closes: #104973)
+
+ -- Branden Robinson <branden@debian.org>  Fri, 28 Sep 2001 12:35:58 -0500
+
+xdrawchem (0.85-1) unstable; urgency=low
+
+  * Initial release.
+
+ -- Warren Stramiello <stramiello@debian.org>  Wed,  9 May 2001 16:02:28 -0400
+
+Local variables:
+mode: debian-changelog
+End:
--- xdrawchem-1.9.9.orig/debian/docs
+++ xdrawchem-1.9.9/debian/docs
@@ -0,0 +1,2 @@
+README.txt
+TODO.txt
--- xdrawchem-1.9.9.orig/debian/patches/06_online_search_crash.dpatch
+++ xdrawchem-1.9.9/debian/patches/06_online_search_crash.dpatch
@@ -0,0 +1,22 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 06_online_search_crash.dpatch by Tom Mortimer-Jones 
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: Fixes crash if no result is select after an internet search.
+
+@DPATCH@
+--- xdrawchem/xdrawchem/netchoosedialog.cpp.old	2007-05-13 22:30:12.000000000 +0100
++++ xdrawchem/xdrawchem/netchoosedialog.cpp	2007-05-13 22:30:51.000000000 +0100
+@@ -102,7 +102,9 @@
+ 
+ void NetChooseDialog::OK() {
+   // save SMILES string of selected item
+-  fn = lv->selectedItem()->text(4);
+-  fn.replace("\"", "");  // strip quotes
+-  accept();
++  if(lv->selectedItem() != 0){
++    fn = lv->selectedItem()->text(4);
++    fn.replace("\"", "");  // strip quotes
++    accept();
++  }
+ }
--- xdrawchem-1.9.9.orig/debian/patches/00list
+++ xdrawchem-1.9.9/debian/patches/00list
@@ -0,0 +1,6 @@
+01_de_translation_fixes.dpatch
+02_documentation_root.dpatch
+03_boshcp.h_provoke_warnings.dpatch
+04_shellescape.dpatch
+05_ftbfs_with_gcc_4.3.dpatch
+06_online_search_crash.dpatch
--- xdrawchem-1.9.9.orig/debian/patches/04_shellescape.dpatch
+++ xdrawchem-1.9.9/debian/patches/04_shellescape.dpatch
@@ -0,0 +1,186 @@
+#! /bin/sh -e
+## 04_shellescape.dpatch
+##
+# DP: Description: Handle non-ascii chars when calling
+# DP:              system() with filenames
+# DP: Related bugs: #375724
+# DP: Patch Author: Steinar H. Gunderson <sgunderson@bigfoot.com>
+# DP: Dpatch author: Michael Banck <mbanck@debian.org>
+# DP: Upstream status: Not reported
+# DP: Date: 12 Nov 2006
+
+[ -f debian/patches/00patch-opts ] && . debian/patches/00patch-opts
+patch_opts="${patch_opts:--f --no-backup-if-mismatch}"
+
+if [ $# -ne 1 ]; then
+    echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
+    exit 1
+fi
+case "$1" in
+       -patch) patch $patch_opts -p1 < $0;;
+       -unpatch) patch $patch_opts -p1 -R < $0;;
+        *)
+                echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
+                exit 1;;
+esac
+
+exit 0
+@DPATCH@
+diff -Nur xdrawchem-1.9.9/xdrawchem/application.cpp ../xdrawchem-1.9.9/xdrawchem/application.cpp
+--- xdrawchem-1.9.9/xdrawchem/application.cpp	2005-11-16 04:01:55.000000000 +0100
++++ xdrawchem-1.9.9/xdrawchem/application.cpp	2006-07-09 12:45:51.000000000 +0200
+@@ -79,6 +79,7 @@
+ #include "xruler.h"
+ #include "dyk.h"
+ #include "charsel.h"
++#include "escape.h"
+ 
+ // main window icon
+ #include "xdc.xpm"
+@@ -871,14 +872,12 @@
+     }
+     if (sendto == 1) {
+       std::cout << "Ghemical: ";
+-      exportFileName.prepend("ghemical ");
+-      passfail = system(exportFileName.ascii());
++      passfail = system("ghemical " + shell_escape(exportFileName));
+       std::cout << passfail << std::endl;
+     }
+     if (sendto == 2) {
+       std::cout << "KryoMol: ";
+-      exportFileName.prepend("kryomol ");
+-      passfail = system(exportFileName.ascii());
++      passfail = system("kryomol " + shell_escape(exportFileName));
+       std::cout << passfail << std::endl;
+     }
+     if (passfail != 0) {
+@@ -1340,8 +1339,7 @@
+       QString n1, cmd1;
+       n1.setNum( getpid() );
+       n1.prepend("/tmp/");
+-      cmd1 = "convert > " + n1;
+-      system( cmd1.ascii() );
++      system( "convert > " + shell_escape(n1) );
+ 
+       QFile f1( n1 );
+       f1.open(IO_ReadOnly);
+@@ -1352,8 +1350,7 @@
+ 	imagemagick = true;
+       }
+ 
+-      cmd1 = "rm " + n1;
+-      system( cmd1.ascii() );
++      system( "rm " + shell_escape(n1) );
+ 
+       QPixmap tosave;
+       // use "tosave" with ImageMagick to specify size
+@@ -1369,11 +1366,9 @@
+ 	n1.append(".eps");
+ 	r->SaveEPS(n1);
+ 	//cmd1 = "convert -antialias " + n1 + " " + picfile;
+-	cmd1 = "convert -antialias -size " +sizehint + " " + n1 + " -resize " 
+-	  + sizehint + " " + picfile;
+-	system( cmd1.ascii() );
+-	cmd1 = "rm " + n1;
+-	system( cmd1.ascii() );
++	system( "convert -antialias -size " + shell_escape(sizehint) + " " + shell_escape(n1) + " -resize "
++		+ shell_escape(sizehint) + " " + shell_escape(picfile));
++	system( "rm " + shell_escape(n1) );
+ 	was_saved = true;
+       } else {
+ 	tosave = r->MakePixmap( fd.isTransparent() );
+@@ -1404,8 +1399,7 @@
+   QString n1, cmd1;
+   n1.setNum( getpid() );
+   n1.prepend("/tmp/");
+-  cmd1 = "convert > " + n1;
+-  system( cmd1.ascii() );
++  system( "convert > " + shell_escape(n1) );
+   
+   QFile f1( n1 );
+   f1.open(IO_ReadOnly);
+@@ -1416,8 +1410,7 @@
+     imagemagick = true;
+   }
+ 
+-  cmd1 = "rm " + n1;
+-  system( cmd1.ascii() );
++  system( "rm " + shell_escape(n1) );
+ 
+   QPixmap tosave;
+   tosave = r->MakePixmap( ni_tflag );
+@@ -1431,11 +1424,9 @@
+     n1 = ni_savefile;
+     n1.append(".eps");
+     r->SaveEPS(n1);
+-    cmd1 = "convert -antialias -size " +sizehint + " " + n1 + " -resize " 
+-      + sizehint + " " + ni_savefile;
+-    system( cmd1.ascii() );
+-    cmd1 = "rm " + n1;
+-    system( cmd1.ascii() );
++    system( "convert -antialias -size " + shell_escape(sizehint) + " " + shell_escape(n1) + 
++       + " -resize " + shell_escape(sizehint) + " " + shell_escape(ni_savefile) );
++    system( "rm " + shell_escape(n1) );
+     was_saved = true;
+   } else {
+     was_saved = tosave.save(ni_savefile, "PNG");
+diff -Nur xdrawchem-1.9.9/xdrawchem/escape.cpp ../xdrawchem-1.9.9/xdrawchem/escape.cpp
+--- xdrawchem-1.9.9/xdrawchem/escape.cpp	1970-01-01 01:00:00.000000000 +0100
++++ xdrawchem-1.9.9/xdrawchem/escape.cpp	2006-07-09 12:41:42.000000000 +0200
+@@ -0,0 +1,9 @@
++#include "escape.h"
++
++QCString shell_escape(const QString &str)
++{
++	QString ret = str;
++	ret.replace("'", "\\'");
++	ret.replace("\\", "\\\\");
++	return "'" + ret.local8Bit() + "'";
++}
+diff -Nur xdrawchem-1.9.9/xdrawchem/escape.h ../xdrawchem-1.9.9/xdrawchem/escape.h
+--- xdrawchem-1.9.9/xdrawchem/escape.h	1970-01-01 01:00:00.000000000 +0100
++++ xdrawchem-1.9.9/xdrawchem/escape.h	2006-07-09 12:41:48.000000000 +0200
+@@ -0,0 +1,8 @@
++#ifndef ESCAPE_H
++#define ESCAPE_H
++
++#include <qstring.h>
++
++QCString shell_escape(const QString &str);
++
++#endif
+diff -Nur xdrawchem-1.9.9/xdrawchem/Makefile.am ../xdrawchem-1.9.9/xdrawchem/Makefile.am
+--- xdrawchem-1.9.9/xdrawchem/Makefile.am	2005-07-20 04:27:54.000000000 +0200
++++ xdrawchem-1.9.9/xdrawchem/Makefile.am	2006-07-09 12:38:58.000000000 +0200
+@@ -13,7 +13,7 @@
+ gobject.moc.cpp        peptidebuilder.moc.cpp   xruler.moc.cpp\
+ graphdialog.moc.cpp    previewwidget.moc.cpp    charsel.moc.cpp\
+ biotools.moc.cpp       textshapedialog.moc.cpp
+-xdrawchem_SOURCES = application.cpp application_ring.cpp arrow.cpp biotools.cpp bond.cpp bondedit.cpp boshcp.cpp bracket.cpp cdx2cdxml.cpp cdxml_reader.cpp charsel.cpp chemdata.cpp chemdata_cdx.cpp chemdata_cdxml.cpp chemdata_cml.cpp chemdata_edit.cpp chemdata_mdl.cpp chemdata_rw.cpp chemdata_rxn.cpp chemdata_tools.cpp chemdata_xdc.cpp chemdata_xml.cpp crings_dialog.cpp curvearrow.cpp drawable.cpp fixeddialog.cpp graphdialog.cpp graphwidget.cpp helpwindow.cpp main.cpp molecule.cpp molecule_1h_nmr.cpp molecule_smiles.cpp molecule_sssr.cpp molecule_tools_1.cpp molecule_tools_2.cpp molinfodialog.cpp myfiledialog.cpp netaccess.cpp netchoosedialog.cpp netdialog.cpp pagesetupdialog.cpp peptidebuilder.cpp previewwidget.cpp render2d.cpp render2d_draw.cpp render2d_event.cpp render2d_print.cpp render2d_select.cpp render2d_text.cpp ringdialog.cpp sdg.cpp smilesdialog.cpp symbol.cpp text.cpp textshapedialog.cpp to3d.cpp xdc_toolbutton.cpp xml_cml.cpp xml_reader.cpp ioiface.cpp application_ob.cpp chemdata_event.cpp molecule_obmol.cpp tooldialog.cpp ngw.cpp tool_1h_nmr.cpp tool_13c_nmr.cpp tool_ir.cpp gobject.cpp tool_2d3d.cpp xruler.cpp dyk.cpp retro.cpp application.moc.cpp    graphwidget.moc.cpp   render2d.moc.cpp\
++xdrawchem_SOURCES = application.cpp application_ring.cpp arrow.cpp biotools.cpp bond.cpp bondedit.cpp boshcp.cpp bracket.cpp cdx2cdxml.cpp cdxml_reader.cpp charsel.cpp chemdata.cpp chemdata_cdx.cpp chemdata_cdxml.cpp chemdata_cml.cpp chemdata_edit.cpp chemdata_mdl.cpp chemdata_rw.cpp chemdata_rxn.cpp chemdata_tools.cpp chemdata_xdc.cpp chemdata_xml.cpp crings_dialog.cpp curvearrow.cpp drawable.cpp escape.cpp fixeddialog.cpp graphdialog.cpp graphwidget.cpp helpwindow.cpp main.cpp molecule.cpp molecule_1h_nmr.cpp molecule_smiles.cpp molecule_sssr.cpp molecule_tools_1.cpp molecule_tools_2.cpp molinfodialog.cpp myfiledialog.cpp netaccess.cpp netchoosedialog.cpp netdialog.cpp pagesetupdialog.cpp peptidebuilder.cpp previewwidget.cpp render2d.cpp render2d_draw.cpp render2d_event.cpp render2d_print.cpp render2d_select.cpp render2d_text.cpp ringdialog.cpp sdg.cpp smilesdialog.cpp symbol.cpp text.cpp textshapedialog.cpp to3d.cpp xdc_toolbutton.cpp xml_cml.cpp xml_reader.cpp ioiface.cpp application_ob.cpp chemdata_event.cpp molecule_obmol.cpp tooldialog.cpp ngw.cpp tool_1h_nmr.cpp tool_13c_nmr.cpp tool_ir.cpp gobject.cpp tool_2d3d.cpp xruler.cpp dyk.cpp retro.cpp application.moc.cpp    graphwidget.moc.cpp   render2d.moc.cpp\
+ arrow.moc.cpp          helpwindow.moc.cpp       ringdialog.moc.cpp\
+ bondedit.moc.cpp       http.moc.cpp             smilesdialog.moc.cpp\
+ bond.moc.cpp           molecule.moc.cpp         symbol.moc.cpp\
+diff -Nur xdrawchem-1.9.9/xdrawchem/molinfodialog.cpp ../xdrawchem-1.9.9/xdrawchem/molinfodialog.cpp
+--- xdrawchem-1.9.9/xdrawchem/molinfodialog.cpp	2005-08-07 22:00:19.000000000 +0200
++++ xdrawchem-1.9.9/xdrawchem/molinfodialog.cpp	2006-07-09 12:46:49.000000000 +0200
+@@ -4,6 +4,7 @@
+ #include "molinfodialog.h"
+ #include "helpwindow.h"
+ #include "defs.h"
++#include "escape.h"
+ 
+ // defined in main.cpp
+ extern QString RingDir;
+@@ -64,9 +65,9 @@
+   QString ffurl, ffcmd;
+ 
+   ffurl = "http://pubchem.ncbi.nlm.nih.gov/summary/summary.cgi?cid=" + pcc;
+-  ffcmd = "firefox " + ffurl + " &";
++  ffcmd = "firefox " + shell_escape(ffurl) + " &";
+   std::cout << ffcmd << std::endl;
+-  system(ffcmd.ascii());
++  system( ffcmd );
+   QClipboard *cb = QApplication::clipboard();
+ 
+   // Copy text into the clipboard
--- xdrawchem-1.9.9.orig/debian/patches/01_de_translation_fixes.dpatch
+++ xdrawchem-1.9.9/debian/patches/01_de_translation_fixes.dpatch
@@ -0,0 +1,56 @@
+#! /bin/sh -e
+## 01_de_translation_fixes.dpatch 
+##
+# DP: Description: German translation fixes
+# DP: Related bugs: #313855
+# DP: Patch Author: Jens Seidel
+# DP: Dpatch author: Michael Banck <mbanck@debian.org>
+# DP: Upstream status: Not applied
+# DP: Date: 08 Jan 2006
+
+[ -f debian/patches/00patch-opts ] && . debian/patches/00patch-opts
+patch_opts="${patch_opts:--f --no-backup-if-mismatch}"
+
+if [ $# -ne 1 ]; then
+    echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
+    exit 1
+fi
+case "$1" in
+       -patch) patch $patch_opts -p1 < $0;;
+       -unpatch) patch $patch_opts -p1 -R < $0;;
+        *)
+                echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
+                exit 1;;
+esac
+
+exit 0
+@DPATCH@
+--- xdrawchem-1.9.4/translation/xdrawchem-de.po	2005-06-11 16:42:52.000000000 +0200
++++ xdrawchem-1.9.4/translation/xdrawchem-de.po	2005-06-14 14:22:18.000000000 +0200
+@@ -916,7 +916,7 @@
+ "Cannot convert the molecule.\n"
+ "Conversion failed in ioiface.cpp"
+ msgstr ""
+-"Molekül kann nicht konvertiert werden.Konvertierung fehlgeschlagen in "
++"Molekül kann nicht konvertiert werden. Konvertierung fehlgeschlagen in "
+ "ioiface.cpp."
+ 
+ #: application_ob.cpp:228 tool_2d3d.cpp:133
+@@ -1560,7 +1560,7 @@
+ "It's possible to attach rings to structures by selecting a ring and clicking "
+ "on an atom."
+ msgstr ""
+-"Um ein Template (z.B Ring) an eine bestehende Struktur anzuhängen, wählen "
++"Um ein Template (z.B. Ring) an eine bestehende Struktur anzuhängen, wählen "
+ "Sie das Template und klicken Sie dann auf das Verbindungsatom."
+ 
+ #: dyk.cpp:67
+@@ -2454,7 +2454,7 @@
+ 
+ #: ringdialog.cpp:37
+ msgid "Ring tool"
+-msgstr "Teemplate-Werkzeug"
++msgstr "Template-Werkzeug"
+ 
+ #: ringdialog.cpp:41
+ msgid "Choose a structure from list:"
--- xdrawchem-1.9.9.orig/debian/patches/03_boshcp.h_provoke_warnings.dpatch
+++ xdrawchem-1.9.9/debian/patches/03_boshcp.h_provoke_warnings.dpatch
@@ -0,0 +1,127 @@
+#! /bin/sh -e
+## 03_boshcp.h_provoke_warnings.dpatch
+##
+# DP: Description: Provoke warnings while compiling boshcp.cpp
+# DP:              to prevent buildd timeouts.
+# DP: Related bugs: #313855
+# DP: Patch Author: Michael Banck <mbanck@debian.org>
+# DP: Dpatch author: Michael Banck <mbanck@debian.org>
+# DP: Upstream status: Not appropriate
+# DP: Date: 08 Jan 2006
+
+[ -f debian/patches/00patch-opts ] && . debian/patches/00patch-opts
+patch_opts="${patch_opts:--f --no-backup-if-mismatch}"
+
+if [ $# -ne 1 ]; then
+    echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
+    exit 1
+fi
+case "$1" in
+       -patch) patch $patch_opts -p1 < $0;;
+       -unpatch) patch $patch_opts -p1 -R < $0;;
+        *)
+                echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
+                exit 1;;
+esac
+
+exit 0
+@DPATCH@
+--- xdrawchem-1.9.9.orig/xdrawchem/boshcp.cpp
++++ xdrawchem-1.9.9/xdrawchem/boshcp.cpp
+@@ -129,6 +129,11 @@
+       ht.put("=CSB(//)", HOSECodeShiftRange("=CSB(//)", 143.1, 5.0, "S", 143.1, 143.1, 1, 1));
+       ht.put("=CSF(//)", HOSECodeShiftRange("=CSF(//)", 166.5, 5.0, "S", 166.5, 166.5, 1, 1));
+       ht.put("=CSX(//)", HOSECodeShiftRange("=CSX(//)", 129.4, 16.0, "S", 150.3, 114.7, 17, 26));
++      prepTable2();
++    }
++
++#warning foo // Debian bogosity
++  void BremserOneSphereHOSECodePredictor::prepTable2() {
+       ht.put("=CSY(//)", HOSECodeShiftRange("=CSY(//)", 114.3, 10.1, "S", 125.5, 92.1, 24, 46));
+       ht.put("=CSI(//)", HOSECodeShiftRange("=CSI(//)", 77.3, 14.5, "S", 82.2, 73.1, 2, 4));
+       ht.put("=CS(//)", HOSECodeShiftRange("=CS(//)", 125.7, 24.0, "D", 190.2, 33.2, 258, 562));
+@@ -231,6 +236,11 @@
+       ht.put("=NX(//)", HOSECodeShiftRange("=NX(//)", 166.2, 5.0, "D", 166.2, 166.2, 1, 2));
+       ht.put("=N(//)", HOSECodeShiftRange("=N(//)", 118.5, 93.6, "T", 170.5, 22.9, 11, 24));
+       ht.put("=S=S(//)", HOSECodeShiftRange("=S=S(//)", 192.7, 5.0, "S", 192.8, 192.6, 1, 4));
++      prepTable3();
++    }
++
++#warning foo // Debian bogosity
++  void BremserOneSphereHOSECodePredictor::prepTable3() {
+       ht.put("=SC$C(//)", HOSECodeShiftRange("=SC$C(//)", 152.4, 5.0, "S", 152.4, 152.4, 1, 1));
+       ht.put("=SC$O(//)", HOSECodeShiftRange("=SC$O(//)", 207.5, 5.0, "S", 214.3, 200.7, 2, 2));
+       ht.put("=SC$N(//)", HOSECodeShiftRange("=SC$N(//)", 191.1, 24.5, "S", 198.1, 182.0, 4, 4));
+@@ -330,6 +340,11 @@
+       ht.put("*N*NF(//)", HOSECodeShiftRange("*N*NF(//)", 168.7, 11.9, "S", 174.0, 156.9, 6, 12));
+       ht.put("*N*NX(//)", HOSECodeShiftRange("*N*NX(//)", 164.2, 12.8, "S", 177.0, 142.1, 22, 54));
+       ht.put("*N*NY(//)", HOSECodeShiftRange("*N*NY(//)", 153.5, 5.0, "S", 153.6, 153.4, 1, 2));
++      prepTable4();
++    }
++
++#warning foo // Debian bogosity
++  void BremserOneSphereHOSECodePredictor::prepTable4() {
+       ht.put("*N*NI(//)", HOSECodeShiftRange("*N*NI(//)", 129.8, 5.0, "S", 130.2, 129.4, 1, 2));
+       ht.put("*N*N(//)", HOSECodeShiftRange("*N*N(//)", 152.2, 13.8, "D", 167.8, 127.9, 124, 372));
+       ht.put("*P*P(//)", HOSECodeShiftRange("*P*P(//)", 26.2, 5.0, "D", 26.2, 26.2, 1, 1));
+@@ -407,10 +422,7 @@
+       ht.put("C$$NY(//)", HOSECodeShiftRange("C$$NY(//)", 71.8, 5.0, "D", 71.8, 71.8, 1, 1));
+       ht.put("C$N(//)", HOSECodeShiftRange("C$N(//)", 50.1, 14.0, "T", 74.9, 38.3, 248, 615));
+       ht.put("C$S$$(//)", HOSECodeShiftRange("C$S$$(//)", 62.4, 5.7, "T", 67.7, 56.6, 12, 20));
+-      prepTable2();
+-    }
+ 
+-  void BremserOneSphereHOSECodePredictor::prepTable2() {
+       ht.put("C$S$XX(//)", HOSECodeShiftRange("C$S$XX(//)", 93.9, 5.0, "S", 93.9, 93.9, 1, 1));
+       ht.put("C$S$(//)", HOSECodeShiftRange("C$S$(//)", 59.1, 14.8, "T", 62.7, 52.8, 4, 4));
+       ht.put("C$SS(//)", HOSECodeShiftRange("C$SS(//)", 67.5, 25.1, "D", 71.6, 44.8, 2, 7));
+@@ -433,6 +445,11 @@
+       ht.put("C$XYY(//)", HOSECodeShiftRange("C$XYY(//)", 64.5, 5.0, "S", 64.5, 64.5, 1, 1));
+       ht.put("C$XY(//)", HOSECodeShiftRange("C$XY(//)", 57.5, 5.0, "D", 57.5, 57.5, 1, 1));
+       ht.put("C$X(//)", HOSECodeShiftRange("C$X(//)", 43.1, 5.0, "T", 49.1, 40.5, 27, 72));
++      prepTable5();
++    }
++
++#warning foo // Debian bogosity
++  void BremserOneSphereHOSECodePredictor::prepTable5() {
+       ht.put("C$YYY(//)", HOSECodeShiftRange("C$YYY(//)", 36.5, 5.0, "S", 44.6, 28.4, 2, 2));
+       ht.put("C$YY(//)", HOSECodeShiftRange("C$YY(//)", 34.4, 7.6, "D", 39.4, 31.3, 6, 7));
+       ht.put("C$Y(//)", HOSECodeShiftRange("C$Y(//)", 30.1, 6.8, "T", 35.5, 25.0, 10, 21));
+@@ -532,6 +549,11 @@
+       ht.put("CN$$X(//)", HOSECodeShiftRange("CN$$X(//)", 90.7, 5.0, "D", 93.3, 88.1, 2, 2));
+       ht.put("CN$$(//)", HOSECodeShiftRange("CN$$(//)", 76.1, 8.0, "T", 85.0, 68.9, 20, 37));
+       ht.put("CNN(//)", HOSECodeShiftRange("CNN(//)", 76.3, 22.3, "D", 153.0, 40.7, 73, 178));
++      prepTable6();
++    }
++
++#warning foo // Debian bogosity
++  void BremserOneSphereHOSECodePredictor::prepTable6() {
+       ht.put("CNS$$(//)", HOSECodeShiftRange("CNS$$(//)", 70.0, 18.0, "D", 73.3, 61.6, 2, 4));
+       ht.put("CNS$(//)", HOSECodeShiftRange("CNS$(//)", 62.9, 5.0, "D", 62.9, 62.9, 1, 1));
+       ht.put("CNSS(//)", HOSECodeShiftRange("CNSS(//)", 72.4, 5.0, "S", 72.4, 72.4, 1, 1));
+@@ -632,6 +654,11 @@
+       ht.put("S$$(//)", HOSECodeShiftRange("S$$(//)", 40.5, 5.8, "Q", 52.6, 30.9, 56, 169));
+       ht.put("S$S$(//)", HOSECodeShiftRange("S$S$(//)", 68.6, 5.0, "T", 69.7, 65.9, 2, 4));
+       ht.put("S$S(//)", HOSECodeShiftRange("S$S(//)", 51.6, 5.6, "T", 53.1, 49.8, 2, 4));
++      prepTable7();
++    }
++
++#warning foo // Debian bogosity
++  void BremserOneSphereHOSECodePredictor::prepTable7() {
+       ht.put("S$(//)", HOSECodeShiftRange("S$(//)", 40.6, 7.0, "Q", 57.0, 34.8, 34, 94));
+       ht.put("SSS(//)", HOSECodeShiftRange("SSS(//)", 56.7, 29.9, "D", 69.3, 41.7, 3, 5));
+       ht.put("SSP$(//)", HOSECodeShiftRange("SSP$(//)", 44.1, 5.0, "D", 44.1, 44.1, 1, 1));
+--- xdrawchem-1.9.9.orig/xdrawchem/boshcp.h
++++ xdrawchem-1.9.9/xdrawchem/boshcp.h
+@@ -178,6 +178,11 @@
+ 	
+   void prepareHashTable();
+   void prepTable2();
++  void prepTable3();
++  void prepTable4();
++  void prepTable5();
++  void prepTable6();
++  void prepTable7();
+ };
+ 
+ #endif
--- xdrawchem-1.9.9.orig/debian/patches/02_documentation_root.dpatch
+++ xdrawchem-1.9.9/debian/patches/02_documentation_root.dpatch
@@ -0,0 +1,119 @@
+#! /bin/sh -e
+## 02_documentation_root.dpatch
+##
+# DP: Description: Set documentation root properly
+# DP: Related bugs: #337752
+# DP: Patch Author: Michael Banck <mbanck@debian.org>
+# DP: Dpatch author: Michael Banck <mbanck@debian.org>
+# DP: Upstream status: Debian specific
+# DP: Date: 08 Jan 2006
+
+[ -f debian/patches/00patch-opts ] && . debian/patches/00patch-opts
+patch_opts="${patch_opts:--f --no-backup-if-mismatch}"
+
+if [ $# -ne 1 ]; then
+    echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
+    exit 1
+fi
+case "$1" in
+       -patch) patch $patch_opts -p1 < $0;;
+       -unpatch) patch $patch_opts -p1 -R < $0;;
+        *)
+                echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
+                exit 1;;
+esac
+
+exit 0
+@DPATCH@
+diff -urNad xdrawchem-1.9.9~/doc/HISTORY.txt xdrawchem-1.9.9/doc/HISTORY.txt
+--- xdrawchem-1.9.9~/doc/HISTORY.txt	2005-03-23 13:39:21.000000000 +0100
++++ xdrawchem-1.9.9/doc/HISTORY.txt	2006-11-14 19:03:05.000000000 +0100
+@@ -1,9 +1,58 @@
++version 1.9.9:
++Updated code to use OpenBabel 2.0 (or later).
++Fixed a bug when loading files with OpenBabel. Atoms are now labeled correctly.
++Fixed bug #1255229, relating to correct rendering of super- and subscripts.
++Added a feature to send 3-D structures to external programs ghemical and
++  KryoMol.  More programs will be added on request.
++Removed canonical SMILES generation.  This feature was dependent on a cgi-bin
++  script that will not run on xdrawchem.org's new host.  InChI, the new NIST-
++  IUPAC standard, should be used for canonicalization.
++
++version 1.9.8:
++Worked on bug #1236716 and #1255229, regarding XDrawChem's rendering 
++  of text typed into the QTextEdit mini text editor.
++Fixed bug #1254917, relating to segfaults when drawing symbols.
++Updated database back-end to use data parsed from the PubChem Compounds
++  database, and updated XDrawChem to link to PubChem compound records where
++  available.
++
++version 1.9.7:
++Fixed sf.net bug #1221480 pertaining to QPainter errors.
++Added antibody (Symbol) and biotin (pre-defined functional group).
++Added support for InChI output (Tools menu; Internet access required).
++Fixed a bug where drawing temporarily goes blank after certain tools or 
++  functions are used.
++
++version 1.9.6:
++Resolved sf.net bug #1200630 relating to loading and saving formatted text.
++Resolved sf.net bug #1198595, relating to segfaults in the IR tool.
++Updated to use newer Qt classes (e.g., QPtrLst instead of QList).  Many thanks
++  to Gerd Fleischer for contributing a very large patch.
++Added text shape options.
++Fill color can be set for ellipse/rectangle bracket types.
++Updated paint/print functions to use a single global painter object.  Print
++  and images should look the same as what you drew on screen now!  Image size
++  is now passed to ImageMagick (if available) so images should be same size
++  as on-screen.
++
++version 1.9.5:
++Removed m4 / autom4te stuff from CVS and distributions!
++Added arrow, symbol, ring drawing change suggested in tracker #1175966.
++Resolved Edit > Cut bug, tracker #1178101.
++Fixed some oddities with point moves and double bond spacing.
++Tinkered with PNG output to produce nicer looking images.
++-- This feature is implemented two ways, and works better if ImageMagick
++-- is installed.
++Added a "hot key" function for quick editing of atoms and labels.
++
+ version 1.9.4:
+ (contributed) Fixed buggy pointer references related to bug #1158842.
+ Added Edit > Insert symbol dialog.
+ Improvements to BUILD3D code now yield better results for fused rings,
+   aromtics, and other double bonds.
+ Updated Polish language file.
++Releases will be made using "cvs export" rather than "cvs checkout"; see
++  sf.net bug #1169699.
+ 
+ version 1.9.3:
+ Fixed issue with color selection and color in EPS files.
+diff -urNad xdrawchem-1.9.9~/doc/Makefile.am xdrawchem-1.9.9/doc/Makefile.am
+--- xdrawchem-1.9.9~/doc/Makefile.am	2006-11-14 19:02:50.000000000 +0100
++++ xdrawchem-1.9.9/doc/Makefile.am	2006-11-14 19:03:01.000000000 +0100
+@@ -1,4 +1,4 @@
+-htmldir = $(pkgdatadir)/doc
++htmldir = $(datadir)/doc/$(PACKAGE)/html
+ html_DATA = index.html arrowtool.png       draw.html\
+ functions.html   subscript.png \
+ boldtool.png        edit.html          GPL.txt          superscript.png\
+diff -urNad xdrawchem-1.9.9~/xdrawchem/application.cpp xdrawchem-1.9.9/xdrawchem/application.cpp
+--- xdrawchem-1.9.9~/xdrawchem/application.cpp	2006-11-14 19:02:50.000000000 +0100
++++ xdrawchem-1.9.9/xdrawchem/application.cpp	2006-11-14 19:03:01.000000000 +0100
+@@ -1653,7 +1653,7 @@
+ void ApplicationWindow::NewManual() {
+   QString home;
+ #ifdef UNIX
+-  home = RingDir + "doc/index.html";
++  home = "/usr/share/doc/xdrawchem/html/index.html";
+ #else
+   home = RingDir + "doc\\index.html";
+ #endif
+@@ -1664,7 +1664,7 @@
+ void ApplicationWindow::HelpTopic(QString topic) {
+   QString home;
+ #ifdef UNIX
+-  home = RingDir + "doc/" + topic;
++  home = "/usr/share/doc/xdrawchem/html/" + topic;
+ #else
+   home = RingDir + "doc\\" + topic;
+ #endif
--- xdrawchem-1.9.9.orig/debian/patches/05_ftbfs_with_gcc_4.3.dpatch
+++ xdrawchem-1.9.9/debian/patches/05_ftbfs_with_gcc_4.3.dpatch
@@ -0,0 +1,15 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 05_ftbfs_with_gcc_4.3.dpatch by LI Daobing <lidaobing@gmail.com>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: No description.
+
+@DPATCH@
+diff -urNad xdrawchem~/xdrawchem/molinfodialog.cpp xdrawchem/xdrawchem/molinfodialog.cpp
+--- xdrawchem~/xdrawchem/molinfodialog.cpp	2005-08-08 04:00:19.000000000 +0800
++++ xdrawchem/xdrawchem/molinfodialog.cpp	2007-04-11 18:26:59.000000000 +0800
+@@ -1,3 +1,4 @@
++#include <cstdlib>
+ #include <qapplication.h>
+ #include <qclipboard.h>
+ 
