hnb (1.9.18-9) debian-dir only changes

Summary

 debian/changelog                                                   |  237 +
 debian/changelog.upstream                                          |    1 
 debian/compat                                                      |    1 
 debian/control                                                     |   25 
 debian/copyright                                                   |   65 
 debian/dirs                                                        |    1 
 debian/doc-base                                                    |   10 
 debian/docs                                                        |    3 
 debian/examples                                                    |    1 
 debian/manpages                                                    |    1 
 debian/menu                                                        |    5 
 debian/patches/00_fix_man_section.patch                            |   10 
 debian/patches/01_quotations_instead_of_quotes.patch               |   24 
 debian/patches/02_recrusive_expand_collapse.patch                  |   73 
 debian/patches/03_hnbrc.patch                                      |  590 ++
 debian/patches/04_unset_done_when_toggeling_todo.patch             |   13 
 debian/patches/05_return_null_if_node_is_null.patch                |   14 
 debian/patches/07_postscript_todo.patch                            |   51 
 debian/patches/08_fix_implicitly_converted_pointer.patch           |   13 
 debian/patches/09_make_all_callbacks_return_void.patch             | 2036 ++++++++++
 debian/patches/10_cursor_bug.patch                                 |   92 
 debian/patches/11_makefile_doc.patch                               |   35 
 debian/patches/12_makefiles_cflags.patch                           |   22 
 debian/patches/14_binary_autosave.patch                            |   46 
 debian/patches/15_document_export.patch                            |   31 
 debian/patches/16_refer_to_documentation_in_man.patch              |   16 
 debian/patches/17_wrap_long_words.patch                            |   47 
 debian/patches/18_todo_bullet_configurable.patch                   |   41 
 debian/patches/19_decouple_cursor.patch                            |   16 
 debian/patches/20_call_setlocale.patch                             |   21 
 debian/patches/21_link_against_ncursesw.patch                      |   10 
 debian/patches/22_set_encoding_to_utf-8_in_exported_files.patch    |   24 
 debian/patches/23_fix_spelling_errors_in_man_page.patch            |   27 
 debian/patches/24_mark_node_as_not_temporary.patch                 |   19 
 debian/patches/50_debian_use_sensible-browser_instead_of_w3m.patch |   28 
 debian/patches/series                                              |   24 
 debian/rules                                                       |   67 
 debian/source.lintian-overrides                                    |    1 
 debian/watch                                                       |    1 
 39 files changed, 3742 insertions(+)

    
download this patch

Patch contents

--- hnb-1.9.18.orig/debian/manpages
+++ hnb-1.9.18/debian/manpages
@@ -0,0 +1 @@
+doc/hnb.1
--- hnb-1.9.18.orig/debian/changelog.upstream
+++ hnb-1.9.18/debian/changelog.upstream
@@ -0,0 +1 @@
+The upstream changelog of hnb is included in /usr/share/doc/hnb/README.gz.
--- hnb-1.9.18.orig/debian/menu
+++ hnb-1.9.18/debian/menu
@@ -0,0 +1,5 @@
+?package(hnb):\
+  needs="text" \
+  section="Applications/Data Management" \
+  title="Hierarchical notebook"\
+  command="/usr/bin/hnb"
--- hnb-1.9.18.orig/debian/compat
+++ hnb-1.9.18/debian/compat
@@ -0,0 +1 @@
+7
--- hnb-1.9.18.orig/debian/watch
+++ hnb-1.9.18/debian/watch
@@ -0,0 +1 @@
+# hnb 1.9.18 has been removed from hnb.sf.net.
--- hnb-1.9.18.orig/debian/source.lintian-overrides
+++ hnb-1.9.18/debian/source.lintian-overrides
@@ -0,0 +1 @@
+hnb: source-contains-prebuilt-binary
--- hnb-1.9.18.orig/debian/doc-base
+++ hnb-1.9.18/debian/doc-base
@@ -0,0 +1,10 @@
+Document: hnb
+Title: Introduction to hnb
+Author: Øyvind Kolås
+Abstract: This manual describes what hnb is
+ and how it can be used.
+Section: Data Management
+
+Format: HTML
+Index: /usr/share/doc/hnb/Documentation.html
+Files: /usr/share/doc/hnb/Documentation.html
--- hnb-1.9.18.orig/debian/rules
+++ hnb-1.9.18/debian/rules
@@ -0,0 +1,67 @@
+#!/usr/bin/make -f
+# -*- makefile -*-
+# vim: set ft=make:
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+include /usr/share/quilt/quilt.make
+
+CFLAGS = -Wall -g
+
+ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
+	CFLAGS += -O0
+else
+	CFLAGS += -O2
+endif
+export CFLAGS
+
+.PHONY: build build-indep build-arch
+build: build-indep build-arch
+build-indep:
+build-arch: build-stamp
+build-stamp: $(QUILT_STAMPFN)
+	dh_testdir
+	$(MAKE) --always-make src/hnbrc.inc
+	$(MAKE) --always-make -C src init_subsystems.c
+	$(MAKE) CPPFLAGS="-I/usr/include/ncursesw" src/hnb
+	$(MAKE) --always-make -C doc Documentation.html
+	touch $@
+
+.PHONY: clean
+clean: unpatch
+	dh_testdir
+	dh_testroot
+	$(RM) src/hnbrc.inc src/init_subsystems.* doc/Documentation.html
+	$(MAKE) clean
+	dh_clean build-stamp
+
+.PHONY: install
+install: build
+	dh_testdir
+	dh_testroot
+	dh_prep
+	dh_installdirs
+	install -m0755 src/hnb $(CURDIR)/debian/hnb/usr/bin
+
+.PHONY: binary binary-indep binary-arch
+binary: binary-indep binary-arch
+binary-indep:
+binary-arch: build install
+	dh_testdir
+	dh_testroot
+	dh_installchangelogs debian/changelog.upstream
+	dh_installdocs
+	dh_installexamples
+	dh_installmenu
+	dh_installman
+	dh_link
+	dh_strip
+	dh_compress -X Documentation.hnb
+	dh_fixperms
+	dh_installdeb
+	dh_shlibdeps
+	dh_gencontrol
+	dh_md5sums
+	dh_builddeb
+
--- hnb-1.9.18.orig/debian/changelog
+++ hnb-1.9.18/debian/changelog
@@ -0,0 +1,237 @@
+hnb (1.9.18-9) unstable; urgency=low
+
+  * Mark node as not temporary when finishing an edit.  Merged from lhnb.
+    (Patch 24, Closes: #574118)
+  * Bump standards version to 3.9.2.
+  * Add the targets binary-indep and binary-arch to debian/rules.
+
+ -- Carsten Hey <carsten@debian.org>  Mon, 29 Aug 2011 16:06:20 +0200
+
+hnb (1.9.18-8) unstable; urgency=low
+
+  [ Carsten Hey ]
+  * Update default hnbrc (Patch 03; update offset in dependent patch 50):
+    + Adapt search key bindings to be more intuitive (at least for vi users,
+      others presumably don't try these keys):
+      - "N" does now search backwards instead of forward in context search.
+      - The key binding for "P" in context search has been removed.
+    + Do some whitespace fixes, hnb is very fussy about whitespaces in ascii
+      mode, which is the recommended way to edit this file.
+    + Change symbol for undone todo entries in alternative bullet style from
+      "!" to "_".
+  * Add patches required for wide character support.  Besides applying
+    below-mentioned patches, adding correct calculation of the cursor position
+    in ui_edit.c is required for wide character support:
+    + Make drawing the cursor independent from *data, this eases adding wide
+      character  support to hnb.  Since we don't have full wide character
+      support yet, this patch uses addch() and inch() instead of add_wch() and
+      in_wch().  (Patch 19)
+    + Call setlocale("LC_ALL") on startup of hnb.  (Patch 20)
+    + Link against the wide character variant of libncurses and adapt build
+      dependency.  (Patch 21).
+  * Set encoding to UTF-8 in exported files.  (Patch 22)
+  * Fix spelling errors in man page.  (Patch 23)
+  * Override pedantic lintian warning "source-contains-prebuilt-binary" since
+    we don't have an upstream to report this to.
+  * Add ${misc:Depends} to debian/control.
+  * Bump standards version to 3.9.1.
+  * New maintainer address, also update debian/copyright.
+
+  [ Axel Beckert ]
+  * Add myself as uploader.
+
+ -- Carsten Hey <carsten@debian.org>  Mon, 30 Aug 2010 22:50:30 +0200
+
+hnb (1.9.18-7) unstable; urgency=low
+
+  * Upload to unstable again.
+  * Make appearance of todo bullets configurable, this patch has been merged
+    from lhnb, a hnb fork by Tomáš Janoušek.
+  * Mention lhnb in debian/copyright.
+  * Add an alternative bullet style to default hnbrc and reformat hnbrc.  The
+    alternative style uses less columns than the original style.
+
+ -- Carsten Hey <c.hey@web.de>  Thu, 19 Feb 2009 07:58:50 +0100
+
+hnb (1.9.18-6) experimental; urgency=low
+
+  * Fixed a character lost bug in word wrapping.  Thanks to Tomáš Janoušek for
+    the patch.
+  * Bump dh compat level to 7, update build dependency and use dh_prep instead
+    of dh_clean -k.
+
+ -- Carsten Hey <c.hey@web.de>  Sat, 31 Jan 2009 13:03:34 +0100
+
+hnb (1.9.18-5) experimental; urgency=low
+
+  * Upload to experimental.  Lenny is in hard freeze and these changes are not
+    targeted for Lenny.
+  * Wrap words that are longer than one line.  This patch has been written by
+    Tomáš Janoušek <tomi@nomi.cz> in 2007.
+  * Merge hnbrc.vi into hnbrc and add some macros which change e.g. the
+    keybindings.  Also improve the vi-like keybindings.  (Closes: #292889)
+  * Enable some additional editing commands in hnbrc, e.g. ^B, ^F and ^D.
+  * Update alternative color scheme so that it does not assume a terminal with
+    dark background color anymore.
+  * Mention orphaning by upstream in long description.  (Closes: #303711)
+  * Mention additional contributors in debian/copyright.
+  * README includes upstream's changelog, thus add a new upstream changelog
+    file which points to README.
+  * Disable watch file.  hnb 1.9.18 has been removed from sourceforge.net.
+
+ -- Carsten Hey <c.hey@web.de>  Wed, 28 Jan 2009 08:27:13 +0100
+
+hnb (1.9.18-4) unstable; urgency=low
+
+  * New maintainer.  Thanks James Morrison!  (Closes: #465888)
+  * Fix broken cursor.  (Closes: #339613)
+  * Save recovery files in hnb's native format and choose a different naming
+    scheme.  Thanks to Steve Pomeroy.  (Closes: #340061)
+  * Don't lose fresh nodes created in search mode after pressing left key.
+    This is achieved through a adapted configuration file and thus does not
+    fix bug #405117 for old installations.
+  * Use sensible-browser instead of w3m. (Closes: #396370)
+  * Document exporting via shell command.  (Closes: #223268)
+  * Don't compress Documentation.hnb.  It is supposed to be read by our users
+    with one simple command.  Document this in hnb(1).
+  * Fix line breaks in alternate hnbrc file.
+  * Build cleanly twice in a row and regenerate the documentation, the
+    configuration file and init_subsystems.c.  Also handle CFLAGS correctly.
+  * libxml has been silently disabled by a previous upload, remove build
+    dependency.
+  * Maintain patches using quilt, add build dependency.
+  * Bump compat level to 5, update build dependency.
+  * Bump Standards-Version to 3.8.0.
+  * Move menu item from section Apps/Tools to Applications/Data Management.
+  * Update debian/copyright, update watch file, update description and add a
+    doc-base control file.
+  * Don't ignore errors in make clean.
+
+ -- Carsten Hey <c.hey@web.de>  Fri, 27 Jun 2008 16:15:39 +0200
+
+hnb (1.9.18-3) unstable; urgency=low
+
+  * Make all callbacks return void*.  (Closes: #325645, #267438)
+
+ -- James Morrison <phython@debian.org>  Sun, 18 Sep 2005 14:02:09 -0700
+
+hnb (1.9.18-2) unstable; urgency=low
+
+  * Fix implicitly converted pointer.  (Closes: #325352)
+
+ -- James Morrison <phython@debian.org>  Sun, 28 Aug 2005 11:31:24 -0700
+
+hnb (1.9.18-1) unstable; urgency=low
+
+  * New upstream version.  (Closes: #291961)
+  * Add todo markup to postscript output.  (Closes: #268968)
+
+ -- James Morrison <phython@debian.org>  Mon, 21 Mar 2005 00:08:48 -0400
+
+hnb (1.9.17-4) unstable; urgency=low
+
+  * Add recursive expand/collapse. (Closes: #248798)
+  * Update maintainer, properly this time!
+  * Unset 'done' flag when toggling off a todo item. (Closes: #231256)
+  * Return NULL if node is NULL in node_get. (Closes: #245875)
+  * Provide an alternate hnbrc file. (Closes: #228413)
+
+ -- James Morrison <phython@debian.org>  Wed, 26 May 2004 00:08:48 -0400
+
+hnb (1.9.17-3) unstable; urgency=low
+
+  * New debian maintainer. (Closes: #236689)
+  * Quote menu items.
+  * Use quotations instead of quotes.
+  * Convert to non-native package.
+
+ -- James Morrison <phython@debian.org>  Fri, 23 Apr 2004 10:28:58 -0400
+
+hnb (1.9.17-2) unstable; urgency=low
+
+  * Orphaning the package.
+
+ -- Tore Anderson <tore@debian.org>  Sun,  7 Mar 2004 20:18:51 +0100
+
+hnb (1.9.17-1) unstable; urgency=low
+
+  * New upstream release, closes: #186963.
+    - No longer crashes when writing to a read-only database, closes: #146494.
+  * debian/hnb.dirs, debian/hnb.docs, debian/hnb.examples, debian/rules,
+    debian/hnb.manpages (new):
+    - Adapted to the new upstream release.
+  * debian/control, debian/copyright:
+    - New maintainer.
+  * debian/control:
+    - Up Standards-Version to 3.6.1.0, no changes required.
+    - Correct spelling errors, closes: #124738.
+    - Up debhelper dependency to version 4.0.0 or greater.
+  * debian/rules, debian/compat (new):
+    - Declare the debhelper compatibility from debian/compat, and increase
+      it to 4 while I'm at it.
+  * debian/changelog:
+    - Remove magic markers for Emacs.
+
+ -- Tore Anderson <tore@debian.org>  Sun, 26 Oct 2003 18:48:10 +0100
+
+hnb (1.8.1-1) unstable; urgency=low
+
+  * New upstream release.
+  * Libxml2 support seems to be working now, enabled at configure
+    (and added libxml2 dependency).
+
+ -- Andras Bali <bali@debian.org>  Thu,  6 Sep 2001 21:56:29 +0200
+
+hnb (1.7-1) unstable; urgency=low
+
+  * New upstream release.
+
+ -- Andras Bali <bali@debian.org>  Mon,  9 Jul 2001 21:26:52 +0200
+
+hnb (1.6.4-1) unstable; urgency=low
+
+  * New upstream release.
+
+ -- Andras Bali <bali@debian.org>  Thu,  7 Jun 2001 19:37:57 +0200
+
+hnb (1.6.2-1) unstable; urgency=low
+
+  * New upstream release.
+
+ -- Andras Bali <bali@debian.org>  Sun, 27 May 2001 19:59:27 +0200
+
+hnb (1.5-1) unstable; urgency=low
+
+  * New upstream release.
+
+ -- Andras Bali <bali@debian.org>  Thu, 24 May 2001 17:18:51 +0200
+
+hnb (1.4-1) unstable; urgency=low
+
+  * New upstream release.
+
+ -- Andras Bali <bali@debian.org>  Wed, 16 May 2001 01:14:19 +0200
+
+hnb (1.3-1) unstable; urgency=low
+
+  * New upstream release.
+
+ -- Andras Bali <bali@debian.org>  Mon, 14 May 2001 23:13:40 +0200
+
+hnb (1.2-1) unstable; urgency=low
+
+  * New upstream release.
+
+ -- Andras Bali <bali@debian.org>  Sat, 12 May 2001 22:36:13 +0200
+
+hnb (1.1b-1) unstable; urgency=low
+
+  * New upstream release.
+
+ -- Andras Bali <bali@debian.org>  Thu, 10 May 2001 18:48:36 +0200
+
+hnb (1.0-1) unstable; urgency=low
+
+  * Initial Release (Closes: #95245).
+
+ -- Andras Bali <drewie@bigfoot.com>  Wed, 25 Apr 2001 20:00:16 +0200
--- hnb-1.9.18.orig/debian/copyright
+++ hnb-1.9.18/debian/copyright
@@ -0,0 +1,65 @@
+This package was debianized by Andras Bali <drewie@bigfoot.com> on
+Wed, 25 Apr 2001 20:00:16 +0200.
+It was then adopted by:
+Tore Anderson <tore@debian.org> on Oct 26th 2003,
+James Morrison <phython@debian.org> on Fri, 23 Apr 2004,
+Carsten Hey <carsten@debian.org> on Fri Feb 29 2008.
+
+
+It was downloaded from http://hnb.sourceforge.net/.files/.
+
+Copyright: (c) 2000-2004 Øyvind Kolås <pippin@users.sourceforge.net>
+
+
+lhnb, a hnb fork from which some patches have been merged, is maintained by
+Tomáš Janoušek <tomi@nomi.cz>.  It can be found at http://work.lisk.in/ and
+http://git.nomi.cz/?p=tomi/lhnb;a=summary.
+
+
+hnb authors/contributors:
+
+    Øyvind Kolås       <pippin@users.sourceforge.net>
+        project maintainer
+    Andras BALI        <drewie@bigfoot.com>
+        Debian Package
+        manual page
+    Karsten Hilbert    <Karsten.Hilbert@gmx.net>
+        pipe export
+    Martin van Beilen  <bln@simlab.dhs.org>
+        various todo/done issues in the code
+    Andrew J Weber     <orang@imonk.com>
+        libxml2 import/export
+    Tore Anderson      <tore@debian.org>
+        Debian Package
+    James Morrison     <phython@debian.org>
+        Debian Package
+    Carsten Hey        <carsten@debian.org>
+        Debian Package
+    Osamu Aoki         <osamu@debian.org>
+        original mutt/vi-like keybindings
+    Steve Pomeroy      <steve@staticfree.info>
+        binary_autosave.patch
+    Tomáš Janoušek     <tomi@nomi.cz>
+        author of lhnb
+
+
+License:
+
+  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 of the License, 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 program; if not, write to the Free Software
+  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+  02110-1301, USA.
+
+On Debian systems, the complete text of the GNU General Public License,
+version 2, can be found in /usr/share/common-licenses/GPL-2. Newer
+versions of this license can be found in the same directory.
--- hnb-1.9.18.orig/debian/dirs
+++ hnb-1.9.18/debian/dirs
@@ -0,0 +1 @@
+usr/bin
--- hnb-1.9.18.orig/debian/control
+++ hnb-1.9.18/debian/control
@@ -0,0 +1,25 @@
+Source: hnb
+Section: misc
+Priority: optional
+Maintainer: Carsten Hey <carsten@debian.org>
+Uploaders: Axel Beckert <abe@debian.org>
+Build-Depends: debhelper (>= 7), libncursesw5-dev, quilt
+Standards-Version: 3.9.2
+Homepage: http://hnb.sourceforge.net/
+
+Package: hnb
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Description: hierarchical notebook
+ Hnb is an ncurses program to organize many kinds of data in one place, for
+ example addresses, todo lists, ideas, book reviews or to store snippets of
+ brainstorming, to make a structured packing list or just to take random notes.
+ It can export ascii, html and xml, supports todo checkboxes, checkbox trees
+ with percentages, priorities, preferences, searching and more.
+ .
+ Hnb is orphaned upstream. Though the current Debian maintainer tries to keep
+ hnb in a usable and releasable state he does not plan to add many new
+ features. If you are interested in hnb and want to become its new upstream
+ maintainer please contact the original author and the Debian maintainer.
+ .
+ Hnb does currently not support UTF-8.
--- hnb-1.9.18.orig/debian/examples
+++ hnb-1.9.18/debian/examples
@@ -0,0 +1 @@
+doc/hnbrc
--- hnb-1.9.18.orig/debian/docs
+++ hnb-1.9.18/debian/docs
@@ -0,0 +1,3 @@
+README
+doc/Documentation.hnb
+doc/Documentation.html
--- hnb-1.9.18.orig/debian/patches/series
+++ hnb-1.9.18/debian/patches/series
@@ -0,0 +1,24 @@
+00_fix_man_section.patch
+01_quotations_instead_of_quotes.patch
+02_recrusive_expand_collapse.patch
+03_hnbrc.patch
+04_unset_done_when_toggeling_todo.patch
+05_return_null_if_node_is_null.patch
+07_postscript_todo.patch
+08_fix_implicitly_converted_pointer.patch
+09_make_all_callbacks_return_void.patch
+10_cursor_bug.patch
+11_makefile_doc.patch
+12_makefiles_cflags.patch
+14_binary_autosave.patch
+15_document_export.patch
+16_refer_to_documentation_in_man.patch
+17_wrap_long_words.patch
+18_todo_bullet_configurable.patch
+19_decouple_cursor.patch
+20_call_setlocale.patch
+21_link_against_ncursesw.patch
+22_set_encoding_to_utf-8_in_exported_files.patch
+23_fix_spelling_errors_in_man_page.patch
+24_mark_node_as_not_temporary.patch
+50_debian_use_sensible-browser_instead_of_w3m.patch
--- hnb-1.9.18.orig/debian/patches/18_todo_bullet_configurable.patch
+++ hnb-1.9.18/debian/patches/18_todo_bullet_configurable.patch
@@ -0,0 +1,41 @@
+hnb (1.9.18-7)  * Make appearance of todo bullets configurable, this patch has
+                  been merged from lhnb.
+
+--- hnb.orig/src/ui_draw.c
++++ hnb/src/ui_draw.c
+@@ -297,7 +297,10 @@ static int draw_spacing (int line, int c
+ static char bullet_leaf[4] = "  ·";
+ static char bullet_parent[4] = "  +";
+ static char bullet_parent_expanded[4] = "  -";
+-
++static char bullet_todo_leaf_undone[4] = "[ ]";
++static char bullet_todo_leaf_done[4] = "[X]";
++static char bullet_todo_parent_undone[4] = "[ ]";
++static char bullet_todo_parent_done[4] = "[X]";
+ 
+ 
+ static int draw_bullet (int line, int col, int width, Node *node,
+@@ -323,11 +326,11 @@ static int draw_bullet (int line, int co
+ 				break;
+ 			case 0:
+ 				if (drawmode != drawmode_test)
+-					addstr ("[ ]");
++					addstr ((node_right (node)) ? bullet_todo_parent_undone : bullet_todo_leaf_undone);
+ 				break;
+ 			case 2000:
+ 				if (drawmode != drawmode_test)
+-					addstr ("[X]");
++					addstr ((node_right (node)) ? bullet_todo_parent_done : bullet_todo_leaf_done);
+ 				break;
+ 			default:{
+ 				char str[100];
+@@ -846,5 +849,8 @@ the field should be");
+ 	cli_add_string ("bullet_leaf", bullet_leaf, "");
+ 	cli_add_string ("bullet_parent", bullet_parent, "");
+ 	cli_add_string ("bullet_parent_expanded", bullet_parent_expanded, "");
+-
++	cli_add_string ("bullet_todo_parent_undone", bullet_todo_parent_undone, "");
++	cli_add_string ("bullet_todo_parent_done", bullet_todo_parent_done, "");
++	cli_add_string ("bullet_todo_leaf_undone", bullet_todo_leaf_undone, "");
++	cli_add_string ("bullet_todo_leaf_done", bullet_todo_leaf_done, "");
+ }
--- hnb-1.9.18.orig/debian/patches/00_fix_man_section.patch
+++ hnb-1.9.18/debian/patches/00_fix_man_section.patch
@@ -0,0 +1,10 @@
+hnb (1.9.1?-?)  * Put man page in proper section.
+
+--- hnb-1.9.18.orig/doc/hnb.1
++++ hnb-1.9.18/doc/hnb.1
+@@ -1,4 +1,4 @@
+-.TH HNB SECTION "May 15, 2001"
++.TH HNB 1 "MAY 15, 2001"
+ .SH NAME
+ hnb \- Hierarchical notebook
+ .SH SYNOPSIS
--- hnb-1.9.18.orig/debian/patches/20_call_setlocale.patch
+++ hnb-1.9.18/debian/patches/20_call_setlocale.patch
@@ -0,0 +1,21 @@
+hnb (1.9.18-8)  * Call setlocale("LC_ALL") on startup of hnb.
+
+--- hnb.orig/src/hnb.c
++++ hnb/src/hnb.c
+@@ -36,6 +36,7 @@
+ #include <string.h>
+ #include <unistd.h>
+ #include <sys/stat.h>
++#include <locale.h>
+ 
+ #include "tree.h"
+ 
+@@ -179,6 +180,8 @@ int main (int argc, char **argv)
+ 
+ 	init_subsystems ();
+ 
++	setlocale(LC_ALL, "");
++
+ 	if (cmdline.usage) {
+ 		usage (argv[0]);
+ 		exit (0);
--- hnb-1.9.18.orig/debian/patches/10_cursor_bug.patch
+++ hnb-1.9.18/debian/patches/10_cursor_bug.patch
@@ -0,0 +1,92 @@
+hnb (1.9.18-4)  * Fix broken cursor.  This bug was introduced with the previous
+                  patch which made all callbacks return void* and made hnb
+                  work on architectures where size of pointer is not equal to
+                  the size of integer, e.g. many 64-bit architectures.
+                  (Closes: #339613)
+
+--- hnb-1.9.18.orig/src/evilloop.c
++++ hnb-1.9.18/src/evilloop.c
+@@ -146,7 +146,7 @@ Node *evilloop (Node *pos)
+ 	while (!quit_hnb) {
+ 		Tbinding *binding;
+ 
+-		ui_draw (pos, inputbuf, 0);
++		ui_draw (pos, inputbuf, 0, 0);
+ 		binding = parsekey (ui_input (), ui_current_scope);
+ 		do {
+ 
+--- hnb-1.9.18.orig/src/tree_misc.c
++++ hnb-1.9.18/src/tree_misc.c
+@@ -250,7 +250,7 @@ static void* remove_cmd (int argc, char 
+ 
+ 		ui_current_scope = ui_scope_confirm;
+ 		docmdf (pos, "status 'node has children, really remove?'");
+-		ui_draw (pos, "", 0);
++		ui_draw (pos, "", 0, 0);
+ 		ui_current_scope = tempscope;
+ 		c = parsekey (ui_input (), ui_scope_confirm);
+ 		if (c->action == ui_action_confirm) {
+@@ -285,7 +285,7 @@ static void* commandline_cmd (int argc, 
+ 
+ 	do {
+ 		strcpy (commandline, "");
+-		ui_draw (pos, "", 0);
++		ui_draw (pos, "", 0, 0);
+ 		ui_getstr ("commandline interface, enter blank command to cancel",
+ 				   commandline);
+ 
+--- hnb-1.9.18.orig/src/ui_draw.c
++++ hnb-1.9.18/src/ui_draw.c
+@@ -691,7 +691,7 @@ extern int hnb_nodes_down;
+ #define MAXLINES 512
+ static int line_nodeno[MAXLINES] = { 0 };
+ 
+-void ui_draw (Node *node, char *input, int edit_mode)
++void ui_draw (Node *node, char *input, int edit_mode, int cursor_pos)
+ {
+ 	int lines;
+ 
+@@ -780,8 +780,8 @@ void ui_draw (Node *node, char *input, i
+ 		line_nodeno[active_line] = node_no (node);
+ 
+ 		if (edit_mode) {
+-			lines = draw_item (active_line, strlen(input) - 1,
+-					   node, drawmode_edit);
++			lines = draw_item (active_line, cursor_pos, node,
++					   drawmode_edit);
+ 		} else {
+ 			lines = draw_item (active_line, strlen (input), node,
+ 					   drawmode_completion);
+--- hnb-1.9.18.orig/src/ui_draw.h
++++ hnb-1.9.18/src/ui_draw.h
+@@ -6,7 +6,7 @@
+    is owerwritten with the value input
+ */
+ 
+-void ui_draw (Node *node, char *input, int edit_mode);
++void ui_draw (Node *node, char *input, int edit_mode, int cursor_pos);
+ 
+ void set_status (char *message);
+ #endif
+--- hnb-1.9.18.orig/src/ui_edit.c
++++ hnb-1.9.18/src/ui_edit.c
+@@ -81,7 +81,7 @@ static void* ui_edit_cmd (int argc, char
+ 
+ 	while (!stop) {
+ 		node_set (pos, TEXT, input);
+-		ui_draw (pos, input, 1);
++		ui_draw (pos, "", 1, cursor_pos);
+ 		c = parsekey (ui_input (), ui_scope_nodeedit);
+ 		switch (c->action) {
+ 			case ui_action_right:
+--- hnb-1.9.18.orig/src/ui_menu.c
++++ hnb-1.9.18/src/ui_menu.c
+@@ -29,7 +29,7 @@ static int xpos_forcol(int colno){
+ 
+ static void draw_menu(Node *pos, int cur_col, int cur_row){
+ 	int row,col;
+-	ui_draw(pos,"",0);
++	ui_draw(pos, "", 0, 0);
+ 		
+ 	for(col=0;col<MENU_MAX_COLS;col++)
+ 		for(row=0;row<MENU_MAX_ROWS;row++){
--- hnb-1.9.18.orig/debian/patches/19_decouple_cursor.patch
+++ hnb-1.9.18/debian/patches/19_decouple_cursor.patch
@@ -0,0 +1,16 @@
+hnb (1.9.18-8)  * Make drawing the cursor independent from *data, this eases
+                  adding wide character support to hnb.   Since we don't have
+                  full wide-character support yet, this patch uses addch() and
+                  inch() instead of add_wch() and in_wch().
+
+--- hnb.orig/src/ui_draw.c
++++ hnb/src/ui_draw.c
+@@ -249,7 +249,7 @@ static int draw_textblock (int line_star
+ 		} else {
+ 			ui_style (ui_style_selected);
+ 		}
+-		addch (data[cursor_pos]);
++		addch(A_CHARTEXT & inch());
+ 		if (node_right (node)) {
+ 			ui_style (ui_style_parentnode);
+ 		} else {
--- hnb-1.9.18.orig/debian/patches/03_hnbrc.patch
+++ hnb-1.9.18/debian/patches/03_hnbrc.patch
@@ -0,0 +1,590 @@
+hnb (1.9.17-4)  * Add recursive expand/collapse to hnbrc.  (Closes: #248798)
+hnb (1.9.17-4)  * Provide an alternate hnbrc file.  (Closes: #228413)
+hnb (1.9.18-4)  * Workaround for missing new nodes in search mode.
+                  (See: #405117)
+hnb (1.9.18-5)  * Merge hnbrc.vi into hnbrc and add some macros which change
+                  e.g. the keybindings.  Also improve the vi-like keybindings.
+                  (Closes: #292889)
+hnb (1.9.18-5)  * Enable some additional editing commands in hnbrc, e.g. ^B,
+                  ^F and ^D.
+hnb (1.9.18-5)  * Update alternative color scheme so that it does not assume a
+                  terminal with dark background color anymore.
+hnb (1.9.18-7)  * Add an alternative bullet style to default hnbrc and
+                  reformat hnbrc.  The alternative style uses less columns
+                  than the original style.
+hnb (1.9.18-8)  * Adapt search key bindings to be more intuitive (at least for
+                  vi users, others presumably don't try these keys):
+                  - "N" does now search backwards instead of forward in
+                    context search.
+                  - The key binding for "P" in context search has been
+                    removed.
+                * Do some whitespace fixes, hnb is very fussy about whitespaces
+                  in ascii mode, which is the recommended way to edit this file.
+                * Change symbol for undone todo entries in alternative bullet
+                  style from "!" to "_".
+
+--- hnb.orig/doc/hnbrc
++++ hnb/doc/hnbrc
+@@ -1,59 +1,118 @@
+-# configuration file for hnb,
++# configuration file for hnb
+ #
+-# use a tab-spacing of 4 when editing this file, or edit it thorugh
+-# hnb with "hnb -a ~/.hnbrc" to take advantage of the indentation in it
++# Use tabs when editing this file, or edit it through hnb with
++# "hnb -a ~/.hnbrc" to take advantage of the indentation in it.
++#
++# There are some macros which change e.g. the keybindings or look of hnb.
++# Search for "configuration macro" in this file to find more out about them.
++# Please note that these macros must be run after they have been defined.
+ #
+-# (please be aware that this is the configuration file for a development version,
+-#  things might change drastically soon,.. or perhaps later)
+ 
+-##### bullets
+-	# what kind of bullets are displayed before each item
+-	##### samples
+-		#bullet_parent          "  -"
+-		#bullet_parent          "  *"
+-		#bullet_parent          "  ·"
+-		#bullet_parent_expanded "  +"
+-		#bullet_parent_expanded "  *"
+-		#bullet_parent_expanded "  ·"
+-		#bullet_leaf            "  *"
+-		#bullet_leaf            "  -"
+-	bullet_leaf            "  ·"
+-	bullet_parent          "  +"
+-	bullet_parent_expanded "  -"
+-	
+ ##### user interface
+-	##### display format
+-		# defining how each node is displayed, the display string syntax is
+-		# interpreted as follows:
+-		#
+-		#   spaces turn into real spaces, i means indentation, - means bullet,
+-		#   d means the real data of the node, x is a temporary placeholder for
+-		#   upcoming column-types,. (for debugging only)
+-		#
+-		#   i and x can take an argument specifying how many characters wide
+-		#   the field should be
+-		#
+-		#   until further features are added, only the multiplier after
+-		#   indentation actually does something
+-		#   # indicates node number (actually line number when used as a folding editor)
++	##### display format / bullets
++		#
++		# display_format:
++		#
++		#   Defining how each node is displayed, the display string
++		#   syntax is interpreted as follows:
++		#
++		#   - Spaces turn into real spaces, i means indentation, -
++		#     means bullet, d means the real data of the node, x is
++		#     a temporary placeholder for upcoming column-types (for
++		#     debugging only).
++		#
++		#   - i and x can take an argument specifying how many
++		#     characters wide the field should be.
++		#
++		#   - Until further features are added, only the multiplier
++		#     after indentation actually does something. # indicates
++		#     the node number (actually line number when used as a
++		#     folding editor).
++		#
++		# bullets:
++		#
++		#   What kind of bullets are displayed before each item,
++		#   possible items and their default values are:
++		#
++		#   - bullet_leaf               "  -"
++		#   - bullet_parent             "  +"
++		#   - bullet_parent_expanded    "  *"
++		#   - bullet_todo_parent_undone "[ ]"
++		#   - bullet_todo_parent_done   "[X]"
++		#   - bullet_todo_leaf_undone   "[ ]"
++		#   - bullet_todo_leaf_done     "[X]"
++		#
+ 		##### samples
+-			#display_format # "i4- d"
+-		display_format "i4- d"
++			#display_format "i4- d"
++			#display_format "i2-d"
++			#display_format "# i4- d"
++			#display_format "#i2-d"
++			#
++			#bullet_parent          "  +"
++			#bullet_parent          "  *"
++			#bullet_parent          "  ·"
++			#bullet_parent_expanded "  *"
++			#bullet_parent_expanded "  +"
++			#bullet_parent_expanded "  ·"
++			#bullet_leaf            "  -"
++			#bullet_leaf            "  *"
++		
++		macro define bullets_standard
++			
++			display_format "i4- d"
++			
++			bullet_leaf               "  -"
++			bullet_parent             "  +"
++			bullet_parent_expanded    "  *"
++			bullet_todo_parent_undone "[ ]"
++			bullet_todo_parent_done   "[X]"
++			bullet_todo_leaf_undone   "[_]"
++			bullet_todo_leaf_done     "[X]"
++			
++			end
++		
++		macro define bullets_alternate
++			
++			display_format "i2-d"
++			
++			bullet_leaf               " -"
++			bullet_parent             " +"
++			bullet_parent_expanded    " *"
++			bullet_todo_parent_undone " _"
++			bullet_todo_parent_done   " X"
++			bullet_todo_leaf_undone   " _"
++			bullet_todo_leaf_done     " X"
++			
++			end
++		
++		##### configuration macro (bullets):
++		#
++		# To switch to the alternative bullet scheme enable
++		# "bullet_alternate" and disable "bullet_standard".
++		#
++		macro bullets_standard
++		#macro bullets_alternate
+ 		
+ 	##### fixed focus
+-		# lock the selection bar to a position 1/3 down the screen
++		#
++		# Lock the selection bar to a position 1/3 down the screen.
++		#
++		# 1=true, 0=false.
++		#
+ 		fixedfocus "0"
+ 		
+-	
+ ##### external commands
+ 	##### http:// handler
+-		# what command is executed when a user wants a action performed on a
+-		# entry containing an URL
+-		# 
++		#
++		# What command is executed when a user wants a action performed
++		# on a entry containing an URL.
++		#
+ 		# * is substituted for the URL
+ 		#
+-		# the X ones have their error and standard output redirected to dev/null
+-		# and are put into the background to keep hnb running afterwards
++		# The X ones have their error and standard output redirected to
++		# dev/null and are put into the background to keep hnb running
++		# afterwards.
++		#
+ 		##### samples
+ 			#web_command "opera -remote 'openURL(*)'			> /dev/null 2>&1 &"
+ 			#web_command "netscape -remote 'openURL(*)'		> /dev/null 2>&1 &"
+@@ -62,27 +121,29 @@
+ 			#web_command "mozilla -remote 'openURL(*,new-window)'	> /dev/null 2>&1 &"
+ 			#web_command "konqueror *				> /dev/null 2>&1 &"
+ 			#web_command "galeon -n					> /dev/null 2>&1 &"
+-			web_command "w3m *"
+ 			#web_command "lynx *"
+ 			#web_commend "rxvt -fn fixed -rv +sb -e w3m *		> /dev/null 2>&1 &"
+ 			#web_command "opera -remote 'openURL(*,new-window)'	> /dev/null 2>&1 &"
++		web_command "w3m *"
+ 		
+ 	##### mail@handler
+-		# what command is executed when a user wants a action performed on a
+-		# entry containing a mail-address
+-		# 
++		#
++		# What command is executed when a user wants a action performed
++		# on a entry containing a mail-address.
++		#
+ 		# * is substituted for the mail-address
+ 		#
+-		## samples
++		##### samples
+ 			#mail_command "xterm -rv pine *				> /dev/null 2>&1 &"
+ 			#mail_command "xterm -rv +sb -e mutt *			> /dev/null 2>&1 &"
+ 			#mail_command "pine *"
+ 		mail_command "mutt *"
+ 		
+ 	##### spell checking
+-		# the spell-checker used
+ 		#
+-		## samples
++		# The spell-checker used.
++		#
++		##### samples
+ 			#spell_command "aspell -c"
+ 			#spell_command "ispell -x"
+ 			#spell_command "ispell -x -damerican"
+@@ -91,41 +152,58 @@
+ 			#spell_command "ispell -x -dnynorsk"
+ 		spell_command "ispell -x"
+ 		
+-	
+ ##### file formats
+ 	##### Default Format
++		#
+ 		# hnb, opml, xml, ascii  are possible choices
++		#
+ 		format "hnb"
+ 		
+ 	##### Remember current position in tree
+-		# wheter hnb remembers the current position in a file, (currently
+-		# supported by the hnb DTD only, but might easily be extended since
+-		# it fakes it with a XML comment) 1=true 0=false
++		#
++		# Whether hnb remembers the current position in a file
++		# (currently supported by the hnb DTD only, but might easily
++		# be extended since it fakes it with a XML comment).
++		#
++		# 1=true, 0=false.
++		#
+ 		savepos	"1"
+ 		
+ 	##### XML format
+ 		##### XML Cuddling
+-			# When loading xml files, should data be allowed on 
++			#
++			# When loading xml files, should data be allowed on
+ 			# the same line as tags?
++			#
+ 			xml_cuddle "0"
++			
+ 	##### Autosave
+-		# when nodes_changed reaches above threshold, invoke autosave
++		#
++		# When nodes_changed reaches above threshold, invoke
++		# autosave.
++		#
+ 		autosave_threshold "15"
+ 		autosave_threshold_nodes_changed "0"
+-	
+-		# if change has occured but is less than threshold, save when number
+-		# of "ticks"/keypresses, invoke autosave
++		
++		#
++		# If change has occurred but is less than threshold, save when
++		# number of "ticks"/keypresses, invoke autosave.
++		#
+ 		autosave_timeout    "50"
+ 		autosave_timer     "0"
+-			
+ 		
+-	
+ ##### Color/style
+-	# color scheme configuration, syntax is:
++	#
++	# Color scheme configuration, syntax is:
++	#
+ 	# "style <item>  <foreground/background> <attribute,[attribute]>"
+-	# legal items are shown below
+-	# colors are: blue, cyan, green, red, magenta, yellow, black and white
+-	# attributes are: normal, reverse, bold, underline
++	#
++	# Legal items are shown below.
++	#
++	# Colors are: blue, cyan, green, red, magenta, yellow, black and white.
++	#
++	# Attributes are: normal, reverse, bold and underline.
++	#
+ 	
+ 	macro define 'style_standard'	
+ 		style menuitem       default/default reverse
+@@ -138,8 +216,8 @@
+ 		style background     default/default normal
+ 		end
+ 	macro define 'style_alternate'	
+-		style menuitem       red/white normal
+-		style menutext       black/white    normal
++		style menuitem       red/default     normal
++		style menutext       default/default normal
+ 		style parentnode     default/default bold
+ 		style node           default/default normal
+ 		style bullet         yellow/default    normal
+@@ -148,14 +226,21 @@
+ 		style background     default/default normal
+ 		end
+ 	
++	##### configuration macro (color scheme):
++	#
++	# To switch to the alternative color scheme enable
++	# "style_alternate" and disable "style_standard".
++	#
+ 	macro style_standard
++	#macro style_alternate
++	
+ ##### key-bindings
+ 	#
+-	# syntax: 
++	# Syntax:
+ 	#   "bind <scope[,scope[...]]>  <key>   <action>"
+ 	#
+-	# multiple actions can be chained together by using the virtual key ".."
+-	# as the following key-binding
++	# Multiple actions can be chained together by using the virtual key
++	# ".." as the following key-binding.
+ 	#
+ 	##################################################
+ 	
+@@ -197,7 +282,9 @@
+ 		bind ^A 'action'
+ 		bind up    up
+ 		bind down  down
+-		bind left  left
++		bind left  right
++		bind ..    left
++		bind ..    left
+ 		bind right right
+ 		bind npage pagedown
+ 		bind ppage pageup
+@@ -238,15 +325,76 @@
+ 		
+ 		bind + expand
+ 		bind - collapse
++		bind ] "expand --subtree"
++		bind [ "collapse --subtree"
+ 		
+ 		bind ^Z restore_state
+ 		
++		macro define keybinding_standard
++			end
++		
++		macro define keybinding_vi
++			status   "Mutt/Vi-like keybind by Osamu Aoki 2004 osamu@debian.org"
++			helptext "ESC| menu || |return| edit || |o| insert line || |s| save || |q| save&quit || |:| cmdline"
++			bind q   'context quitsave'
++			bind :   'commandline'
++			bind E   'context export'
++			bind L   'context import'
++			bind /   'macro m_search'
++			bind G   'context grab'
++			bind ..  'save_state'
++			bind  A  'action'
++			bind k   up
++			bind j   down
++			bind h   right
++			bind ..  left
++			bind ..  left
++			bind l   right
++			bind z   pagedown
++			bind Z   pageup
++			bind i   edit
++			bind a   edit
++			bind o   insert_below
++			bind ..  edit
++			bind O   up
++			bind ..  insert_below
++			bind ..  edit
++			bind T   toggle_todo
++			bind D   toggle_done
++			bind w   save
++			bind s   save
++			bind y   copy
++			bind d   save_state
++			bind ..  cut
++			bind p   paste
++			bind ..  down
++			bind S   save_state
++			bind ..  sort
++			bind H   "movenode left"
++			bind L   "movenode right"
++			bind K   "movenode up"
++			bind J   "movenode down"
++			bind u   restore_state
++			# Use "bind any ignore" instead to skip the warnings.
++			bind any unbound
++			end
++		
++		##### configuration macro (keybindings):
++		#
++		# To switch to the alternative keybindings enable
++		# "keybinding_vi" and disable "keybinding_standard".
++		#
++		macro keybinding_standard
++		#macro keybinding_vi
++		
+ 	context nodeedit
+-		helptext "editing node |  |ESC| revert || |return| confirm"
++		helptext "editing node |  |ESC| revert || |return| confirm || |^S| split || |^J| join"
+ 		bind up    up
+ 		bind down  down
+ 		bind left  left
++		bind ^B    left
+ 		bind right right
++		bind ^F    right
+ 		
+ 		bind return  confirm
+ 		bind esc     cancel
+@@ -262,7 +410,10 @@
+ 		bind ^E   eol
+ 		bind end  eol
+ 		
++		bind ^D   delete
+ 		bind del  delete
++		# bkill_word is currently not implemented.
++		bind ^W   bkill_word
+ 		
+ 	context lineedit
+ 		helptext lineedit
+@@ -270,7 +421,9 @@
+ 		bind up      up
+ 		bind down    down
+ 		bind left    left
++		bind ^B      left
+ 		bind right   right
++		bind ^F      right
+ 		
+ 		bind return  confirm
+ 		bind esc     cancel
+@@ -278,7 +431,10 @@
+ 		
+ 		bind backspace backspace
+ 		bind backspace2 backspace
++		bind ^D         delete
+ 		bind del        delete
++		# bkill_word is currently not implemented.
++		bind ^W   bkill_word
+ 		
+ 		bind ^A   bol
+ 		bind home bol
+@@ -294,7 +450,8 @@
+ 		
+ 		bind any    cancel
+ 		
+-	context quitsave
++	macro define 'quitsave_standard'
++		context quitsave
+ 		helptext "Save on exit? |    | Y |es | J |a || | N |o || |ESC| cancel"
+ 		bind Y  save
+ 		bind .. quit
+@@ -314,6 +471,27 @@
+ 		bind esc "context main"
+ 		bind any unbound
+ 		
++		end
++		
++	macro define 'quitsave_alternate'
++		context quitsave
++		helptext "Save on exit? | |return| confirm || |x| exit without saving || |ESC| cancel"
++		bind return save
++		bind .. quit
++		bind x  quit
++		bind esc "context main"
++		bind any unbound
++		end
++		
++	##### configuration macro (quit/save dialog):
++	#
++	# To switch to the alternative save/quit dialog enable
++	# "quitsave_alternate" and disable "quitsave_standard".
++	#
++	macro quitsave_standard
++	#macro quitsave_alternate
++		
++	
+ 	context spellcheck
+ 		helptext "Spellchecking |   |Space| next node |ESC| cancel |F6,Return| confirm changes"
+ 		
+@@ -433,12 +611,12 @@
+ 		helptext "Searching |  |ESC| cancel || | n |ext || | p |revious || |space|/|return| go"
+ 		bind down   'search -f "$query"'
+ 		bind up     'search -b "$query"'
+-		bind P      'search -b "$query"'
+ 		bind p      'search -b "$query"'
+ 		bind n      'search -f "$query"'
+-		bind N      'search -f "$query"'
++		bind N      'search -b "$query"'
+ 		
+ 		bind return "context main"
++		bind space "context main"
+ 		
+ 		bind esc    "context main"
+ 		bind ..     restore_state
+@@ -492,13 +670,17 @@
+ 		bind esc 'context main'
+ 		bind any unbound
+ 		
+-			
+ 	##### key related options
+ 		##### escdelay
+-			# how long the program should wait before accepting that ESC(27d) is the
+-			# ESC key and not the start of an escape sequence
+-			# increase this number if you are using hnb over a slow network link
+-			# value given is in ms (1/1000seconds)
++			#
++			# How long the program should wait before accepting
++			# that ESC(27d) is the ESC key and not the start of an
++			# escape sequence.
++			#
++			# Increase this number if you are using hnb over a slow
++			# network.
++			#
++			# Link value given is in ms (1/1000seconds).
+ 			#
+ 			escdelay 100
+ ##### menu definition
+@@ -512,7 +694,7 @@
+ 				go root
+ 				export_$format $db_file
+ 				restore_state
+-			end
++				end
+ 		menu "File" "revert   " "revert"		
+ 		menu "File" "------------" ""
+ 		menu "File" "export    ^E" "context export"
+@@ -526,7 +708,7 @@
+ 				status "file: \"$db_file\" format:$format"
+ 				mem
+ 				stats			
+-			end
++				end
+ 		menu "File" "------------" ""
+ 		menu "File" "exit      ^Q" "context quitsave"
+ 	##### edit
+@@ -537,17 +719,19 @@
+ 		menu "Edit" "---------" ""
+ 		menu "Edit" "Search ^F" "macro m_search"
+ 	##### entry
+-		menu "Entry" "--------------" ""
+-		menu "Entry" "edit    return" "edit"
+-		menu "Entry" "delete     del" "remove"
+-		menu "Entry" "--------------" ""
+-		menu "Entry" "do action   ^A" "action"
+-		menu "Entry" "indent      >" "indent"
+-		menu "Entry" "outdent     <" "outdent"
+-		menu "Entry" "toggle todo ^T" "toggle_todo"
+-		menu "Entry" "toggle done ^D" "toggle_done"
+-		menu "Entry" "expand      +" "expand"
+-		menu "Entry" "collapse    -" "collapse"
++		menu "Entry" "-------------------" ""
++		menu "Entry" "edit         return" "edit"
++		menu "Entry" "delete          del" "remove"
++		menu "Entry" "-------------------" ""
++		menu "Entry" "do action        ^A" "action"
++		menu "Entry" "indent            >" "indent"
++		menu "Entry" "outdent           <" "outdent"
++		menu "Entry" "toggle todo      ^T" "toggle_todo"
++		menu "Entry" "toggle done      ^D" "toggle_done"
++		menu "Entry" "expand            +" "expand"
++		menu "Entry" "expand subtree    ]" "expand --subtree"
++		menu "Entry" "collapse          -" "collapse"
++		menu "Entry" "collapse subtree  [" "collapse --subtree"
+ 	##### level
+ 		menu "Level" "------------" ""
+ 		menu "Level" "sort      ^S" "sort -a"
+@@ -558,6 +742,6 @@
+ 	macro define m_about
+ 		status "hnb - hierarchical notebook   http://hnb.sourceforge.net/"
+ 		status "(c) Øyvind Kolås 2001-2003    pippin@users.sourceforge.net"
+-	end
++		end
+ 	
+ 	macro m_about
--- hnb-1.9.18.orig/debian/patches/05_return_null_if_node_is_null.patch
+++ hnb-1.9.18/debian/patches/05_return_null_if_node_is_null.patch
@@ -0,0 +1,14 @@
+hnb (1.9.17-4)  * Return NULL if node is NULL in node_get.  (Closes: #245875)
+
+--- hnb-1.9.18.orig/src/node.c
++++ hnb-1.9.18/src/node.c
+@@ -88,6 +88,9 @@ void node_set (Node *node, char *name, c
+ {
+ 	Node_AttItem *att;
+ 
++	if (node == NULL)
++		return;
++
+ 	att = node->attrib;
+ 	while (att) {
+ 		if (!strcmp (att->name, name)) {
--- hnb-1.9.18.orig/debian/patches/08_fix_implicitly_converted_pointer.patch
+++ hnb-1.9.18/debian/patches/08_fix_implicitly_converted_pointer.patch
@@ -0,0 +1,13 @@
+hnb (1.9.18-2)  * Fix implicitly converted pointer.  (Closes: #325352)
+
+--- hnb-1.9.18.orig/src/tree.h
++++ hnb-1.9.18/src/tree.h
+@@ -124,6 +124,8 @@ void node_swap (Node *nodeA, Node *nodeB
+ */
+ Node *node_recurse (Node *node);
+ 
++Node *node_traverse_right_of (Node *stop, Node *node);
++
+ /* returns the previous node, doing a recursive traversal of the tree backwards
+ 
+ 	Returns: next back recursive node or 0 if none
--- hnb-1.9.18.orig/debian/patches/24_mark_node_as_not_temporary.patch
+++ hnb-1.9.18/debian/patches/24_mark_node_as_not_temporary.patch
@@ -0,0 +1,19 @@
+hnb (1.9.18-9)
+
+commit 5a1585ae74aabd6e08f1b55e3d587630049f2779
+Author: Tomas Janousek <tomi@nomi.cz>
+Date:   Tue May 31 21:01:02 2011 +0200
+
+    Mark node as not temporary when finishing an edit.
+
+--- hnb-1.9.18.orig/src/ui_edit.c
++++ hnb-1.9.18/src/ui_edit.c
+@@ -142,6 +142,8 @@ static void* ui_edit_cmd (int argc, char
+ 			case ui_action_confirm:
+ 				input[strlen (input) - 1] = 0;
+ 				node_set (pos, TEXT, input);
++				if (node_getflag (pos, F_temp))
++					node_setflag (pos, F_temp, 0);
+ 				stop = 1;
+ 				docmd(pos, "tree_changed");  
+ 				break;
--- hnb-1.9.18.orig/debian/patches/21_link_against_ncursesw.patch
+++ hnb-1.9.18/debian/patches/21_link_against_ncursesw.patch
@@ -0,0 +1,10 @@
+hnb (1.9.18-8)  * Link against the wide character variant of libncurses.
+
+--- hnb.orig/src/Makefile
++++ hnb/src/Makefile
+@@ -1,4 +1,4 @@
+-LIBS=-lncurses libcli/libcli.a
++LIBS=-lncursesw libcli/libcli.a
+ CFLAGS ?= -Wall -pedantic
+ override CFLAGS += -I.. -Ilibcli -DHAVE_CONFIG_H
+ 
--- hnb-1.9.18.orig/debian/patches/16_refer_to_documentation_in_man.patch
+++ hnb-1.9.18/debian/patches/16_refer_to_documentation_in_man.patch
@@ -0,0 +1,16 @@
+hnb (1.9.18-4)  * Refer to documentation in man page.
+
+--- hnb-1.9.18.orig/doc/hnb.1
++++ hnb-1.9.18/doc/hnb.1
+@@ -49,8 +49,9 @@ The default configuration file. To load 
+ use the \fB-rc\fP command-line option.
+ 
+ .SH SEE ALSO
+-For more information on the usage of the program, load the tutorial or
+-press \fBF1\fP in the program.
++For more information on the usage of the program, load the tutorial using
++\fBhnb \-\-tutorial\fP and consult Documentation.hnb.  On Debian systems
++you can read it with \fBhnb /usr/share/doc/hnb/Documentation.hnb\fP
+ 
+ hnb homepage: http://hnb.sourceforge.net
+ .SH AUTHOR
--- hnb-1.9.18.orig/debian/patches/04_unset_done_when_toggeling_todo.patch
+++ hnb-1.9.18/debian/patches/04_unset_done_when_toggeling_todo.patch
@@ -0,0 +1,13 @@
+hnb (1.9.17-4)  * Unset 'done' flag when toggling off a todo item.
+                  (Closes: #231256)
+
+--- hnb-1.9.18.orig/src/tree_todo.c
++++ hnb-1.9.18/src/tree_todo.c
+@@ -269,6 +269,7 @@ static int toggle_todo_cmd (int argc, ch
+ 		node_set(pos,"done","no");
+ 	} else {
+ 		node_unset(pos,"type");
++		node_unset(pos,"done");
+ 	}
+ 
+ 	return (int) pos;
--- hnb-1.9.18.orig/debian/patches/50_debian_use_sensible-browser_instead_of_w3m.patch
+++ hnb-1.9.18/debian/patches/50_debian_use_sensible-browser_instead_of_w3m.patch
@@ -0,0 +1,28 @@
+hnb (1.9.18-4)  * Use sensible-browser instead of w3m.  (Closes: #396370)
+
+--- hnb.orig/doc/hnbrc
++++ hnb/doc/hnbrc
+@@ -124,7 +124,7 @@
+ 			#web_command "lynx *"
+ 			#web_commend "rxvt -fn fixed -rv +sb -e w3m *		> /dev/null 2>&1 &"
+ 			#web_command "opera -remote 'openURL(*,new-window)'	> /dev/null 2>&1 &"
+-		web_command "w3m *"
++		web_command "sensible-browser *"
+ 		
+ 	##### mail@handler
+ 		#
+@@ -654,11 +654,11 @@
+ 		bind any unbound
+ 		
+ 	context user_browser
+-		helptext "Browser action: | |F1| w3m replace hnb  |F2| w3m in rxvt  |F3| Opera, new tab  |F4| Mozilla new window"
+-		bind f1 'browser_command "w3m *"'
++		helptext "Browser action: | |F1| sensible-browser replace hnb  |F2| sensible-browser in xterm  |F3| Opera, new tab  |F4| Mozilla new window"
++		bind f1 'browser_command "sensible-browser *"'
+ 		bind .. 'context main'
+ 		
+-		bind f2 'web_commend "xterm -T \"w3m spawned from hnb\" -fn fixed -rv +sb -e w3m * > /dev/null 2>&1 &"'
++		bind f2 'web_commend "xterm -T \"sensible-browser spawned from hnb\" -fn fixed -rv +sb -e sensible-browser * > /dev/null 2>&1 &"'
+ 		bind .. 'context main'
+ 		
+ 		bind f3 'web_command "opera -remote 'openURL(*,new-window)' > /dev/null 2>&1 &"'
--- hnb-1.9.18.orig/debian/patches/14_binary_autosave.patch
+++ hnb-1.9.18/debian/patches/14_binary_autosave.patch
@@ -0,0 +1,46 @@
+hnb (1.9.18-4)  * Save recovery files in hnb's native format and choose a
+                  different naming scheme.  Thanks to Steve Pomeroy.
+                  (Closes: #340061)
+
+--- hnb-1.9.18.orig/src/autosave.c
++++ hnb-1.9.18/src/autosave.c
+@@ -38,7 +38,7 @@ static void autosave_invoke(Node *pos){
+ 		{
+ 			char buf[4096];
+ 			
+-			sprintf (buf, "export_binary %s_hnb_rescue", prefs.db_file);		
++			sprintf (buf, "export_hnb %s~", prefs.db_file);
+ 			docmd (node_root(pos), buf);
+ 			cli_outfunf("autosaved, %i nodes changed\n",nodes_changed);
+ 		}
+--- hnb-1.9.18.orig/src/file.c
++++ hnb-1.9.18/src/file.c
+@@ -164,7 +164,7 @@ static void* cmd_save (int argc,char **a
+ 			char buf[4096];
+ 			char swapfile[4096];
+ 
+-			sprintf(swapfile,"%s_hnb_rescue",prefs.db_file);
++			sprintf(swapfile,"%s~",prefs.db_file);
+ 			remove(swapfile);
+ 			docmd (pos, "autosave_threshold_nodes_changed 0");
+ 
+--- hnb-1.9.18.orig/src/hnb.c
++++ hnb-1.9.18/src/hnb.c
+@@ -239,7 +239,7 @@ int main (int argc, char **argv)
+ 	   	  stat(prefs.db_file, &statbuf);
+ 		  file_modified=statbuf.st_ctime;
+ 		  
+-		  sprintf(recovery_file, "%s_hnb_rescue", prefs.db_file);
++		  sprintf(recovery_file, "%s~", prefs.db_file);
+ 		  tfile = fopen(recovery_file, "r");
+ 		  if(tfile){
+ 			  char response[1024]="_";
+@@ -314,7 +314,7 @@ o)pen read_only\n\
+ 		{
+ 			char buf[4096];
+ 			if(recover)
+-			sprintf (buf, "import_binary %s", file_to_load);
++			sprintf (buf, "import_hnb %s", file_to_load);
+ 			else
+ 			sprintf (buf, "import_%s %s", prefs.format,  file_to_load);
+ 
--- hnb-1.9.18.orig/debian/patches/15_document_export.patch
+++ hnb-1.9.18/debian/patches/15_document_export.patch
@@ -0,0 +1,31 @@
+hnb (1.9.18-4)  * Document exporting via shell command.  (Closes: #223268)
+
+--- hnb-1.9.18.orig/doc/Documentation.hnb
++++ hnb-1.9.18/doc/Documentation.hnb
+@@ -52,7 +52,6 @@
+ 			<node><data>hnb [options] [filename] [-e &quot;comand&quot; [&quot;command&quot; [&quot;command&quot; ..]]]</data></node>
+ 			<node><data>options:</data>
+ 				<node><data>-h or --help show recognized options</data></node>
+-				<node><data></data></node>
+ 				<node><data>-a or --ascii use tab indented ASCII for loading/saving database</data>
+ 					<node><data>ASCII doesn&apos;t remember attributes like to-do status, done etc.</data></node>
+ 				</node>
+@@ -61,10 +60,14 @@
+ 				<node><data>--hnb use hnb DTD for loading/saving database, this is the default unless you&apos;ve changed it in the preferences file</data></node>
+ 			</node>
+ 			<node><data>running commands</data>
+-				<node><data>by running</data>
+-					<node><data>hnb -e &quot;go_root&quot; &quot;oexport_htmlcss test.html&quot;</data></node>
+-				</node>
+-				<node><data>hnb will load the default database, go to the start of the database, and export it with the htmlcss filter to a file called test.html</data></node>
++				<node><data>By running</data></node>
++				<node><data>hnb -e &quot;go root&quot; &quot;export_htmlcss test.html&quot;</data></node>
++				<node><data>hnb will load the default database, go to the start of the database, and export it with the htmlcss filter to a file called test.html.</data></node>
++				<node><data>The HTML version of this documentation is generated through</data></node>
++				<node><data>hnb -rc /dev/null Documentation.hnb -e &quot;go root&quot; &quot;export_htmlcss Documentation.html&quot;</data></node>
++				<node><data>An example for exporting an hnb file to various output formats is the following</data></node>
++				<node><data>hnb file.hnb -e &quot;go root&quot; &quot;export_opml export.opml&quot; &quot;export_html export.html&quot; &quot;export_ascii export.txt&quot; &quot;export_htmlcss export_css.html&quot; &quot;export_ps export.ps&quot;</data></node>
++				<node><data>To get a list of all available commands type ? in command mode (per default mapped to F5).</data></node>
+ 			</node>
+ 		</node>
+ 		<node><data>In the latest version hnb also contains a menu that can be invoked by pressing ESC, more commands are available by invoking the commandline (F5).</data></node>
--- hnb-1.9.18.orig/debian/patches/22_set_encoding_to_utf-8_in_exported_files.patch
+++ hnb-1.9.18/debian/patches/22_set_encoding_to_utf-8_in_exported_files.patch
@@ -0,0 +1,24 @@
+hnb (1.9.18-8)  * Set encoding to UTF-8 in exported files.
+
+--- hnb.orig/src/file_hnb.c
++++ hnb/src/file_hnb.c
+@@ -121,7 +121,7 @@ static void* export_hnb (int argc, char 
+ 		return node;
+ 	}
+ 
+-	fprintf (file, "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?><?hnb pos=\"%s\"?>\n\
++	fprintf (file, "<?xml version=\"1.0\" encoding=\"UTF-8\"?><?hnb pos=\"%s\"?>\n\
+ <!-- generated by hnb %s (http://hnb.sourceforge.net) -->\n\
+ \n\
+ <!DOCTYPE tree[\n\
+--- hnb.orig/src/file_opml.c
++++ hnb/src/file_opml.c
+@@ -107,7 +107,7 @@ static void* export_opml (int argc, char
+ 	}
+ 
+ 	fprintf (file,
+-		"<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>"
++		"<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
+ 		"<?pos=\"%s\"?>\n"
+ 		" <!-- generated by hnb %s (http://hnb.sourceforge.net/) -->\n",
+ 	 	argc == 3 ? argv[2] : "1", VERSION);
--- hnb-1.9.18.orig/debian/patches/12_makefiles_cflags.patch
+++ hnb-1.9.18/debian/patches/12_makefiles_cflags.patch
@@ -0,0 +1,22 @@
+hnb (1.9.18-4)  * Correctly handle CFLAGS.  Normally CPPFLAGS should be used
+                  for preprocessor options, but this would require more lines
+                  to be patched.
+
+--- hnb.orig/src/Makefile
++++ hnb/src/Makefile
+@@ -1,5 +1,6 @@
+ LIBS=-lncurses libcli/libcli.a
+-CFLAGS=-I.. -Ilibcli -DHAVE_CONFIG_H -Wall -pedantic -g
++CFLAGS ?= -Wall -pedantic
++override CFLAGS += -I.. -Ilibcli -DHAVE_CONFIG_H
+ 
+ CFILES=$(wildcard *.c)
+ OBJS=$(patsubst %.c,%.o,$(CFILES))
+--- hnb.orig/src/libcli/Makefile
++++ hnb/src/libcli/Makefile
+@@ -1,4 +1,4 @@
+-CFLAGS = -Wall
++# CFLAGS = -Wall
+ 
+ OBJS = cli.o cli_history.o cli_tokenize.o
+ 
--- hnb-1.9.18.orig/debian/patches/02_recrusive_expand_collapse.patch
+++ hnb-1.9.18/debian/patches/02_recrusive_expand_collapse.patch
@@ -0,0 +1,73 @@
+hnb (1.9.17-4)  * Add recursive expand/collapse.  (Closes: #248798)
+
+--- hnb-1.9.18.orig/src/expanded.c
++++ hnb-1.9.18/src/expanded.c
+@@ -26,7 +26,6 @@
+ #include "ctype.h"
+ #include "ui_binding.h"
+ 
+-
+ static int cmd_expand (int argc,char **argv, void *data)
+ {
+ 	Node *pos = (Node *) data;
+@@ -47,6 +46,18 @@ static int cmd_expand (int argc,char **a
+ 			tnode = node_recurse (tnode);
+ 		}
+ 		cli_outfun ("expanded all nodes");
++	} else if(!strcmp(argv[1],"--subtree")) {
++	        node_setflag(pos,F_expanded,1);
++		if(node_right(pos)) {
++
++		  Node *tnode = node_right(pos);
++
++		  while (tnode) {
++		    node_setflag(tnode,F_expanded,1);
++		    tnode = node_traverse_right_of (pos, tnode);
++		  }
++		}
++		cli_outfun ("expanded subtree");
+ 	}
+ 	return (int) pos;
+ }
+@@ -71,6 +82,17 @@ static int cmd_collapse (int argc,char *
+ 			tnode = node_recurse (tnode);
+ 		}
+ 		cli_outfun ("collapsed all nodes");
++	} else if(!strcmp(argv[1],"--subtree")) {
++	        node_setflag(pos,F_expanded,0);
++		if(node_right(pos)) {
++		  Node *tnode = node_right(pos);
++
++		  while (tnode) {
++		    node_setflag(tnode,F_expanded,0);
++		    tnode = node_traverse_right_of (pos, tnode);
++		  }
++		}
++		cli_outfun ("collapsed subtree");
+ 	}
+ 	
+ 	return (int) pos;
+--- hnb-1.9.18.orig/src/tree.c
++++ hnb-1.9.18/src/tree.c
+@@ -47,6 +47,21 @@ Node *node_recurse (Node *node)
+ 	return 0;
+ }
+ 
++Node *node_traverse_right_of (Node *stop, Node *node)
++{
++	if (node_right (node))
++		return node_right (node);
++	if (node_down (node))
++		return node_down (node);
++	while (node_left (node) && (node_left (node) != stop)) {
++		if (node_down (node_left (node)))
++			return node_down (node_left (node));
++		node = node_left (node);
++	}
++
++	return 0;
++}
++
+ Node *node_backrecurse (Node *node)
+ {
+ 	if (node_up (node)) {
--- hnb-1.9.18.orig/debian/patches/07_postscript_todo.patch
+++ hnb-1.9.18/debian/patches/07_postscript_todo.patch
@@ -0,0 +1,51 @@
+hnb (1.9.18-1)  * Add todo markup to postscript output.  (Closes: #268968)
+
+--- hnb-1.9.18.orig/src/file_ps.c
++++ hnb-1.9.18/src/file_ps.c
+@@ -51,12 +51,23 @@ static char *psquote[]={
+ 
+ /* *INDENT-ON* */
+ 
+-static void ps_export_node (FILE * file, int level, int flags, char *data)
++static void ps_export_node (FILE * file, int level, Node *tnode)
+ {
++	char *data = fixnullstring (node_get (tnode, TEXT));
++	char *type = node_get (tnode, "type");
+ 	char *quoted=string_replace(data,psquote);
++	int done;
++
+ 	indent (level, "\t");
+-	fprintf (file, "( ) S 10 ss %i LM 0 a (%s ) P\n", level * 22,
++	if (type && !strcmp (type, "todo")) {
++	  type = node_get (tnode, "done");
++	  done = type ? type[0] == 'y' : 0;
++	  fprintf (file, "( ) S 10 ss %i LM 0 a ([%s]%s ) P\n", level * 22,
++		   done ? "DONE" : "____", quoted);
++	} else {
++	  fprintf (file, "( ) S 10 ss %i LM 0 a (%s ) P\n", level * 22,
+ 			 quoted);
++	}
+ 	free(quoted);
+ }
+ 
+@@ -65,8 +76,7 @@ static int export_ps (int argc, char **a
+ 	Node *node = (Node *) data;
+ 	char *filename = argc==2?argv[1]:"";
+ 	Node *tnode;
+-	int level, flags, startlevel;
+-	char *cdata;
++	int level, startlevel;
+ 	FILE *file;
+ 
+ 	if (!strcmp (filename, "-"))
+@@ -208,9 +218,7 @@ end %% close minidict: *this is importan
+ 
+ 	while ((tnode != 0) & (nodes_left (tnode) >= startlevel)) {
+ 		level = nodes_left (tnode) - startlevel;
+-		flags = node_getflags (tnode);
+-		cdata = fixnullstring (node_get (tnode, TEXT));
+-		ps_export_node (file, level, flags, cdata);
++		ps_export_node (file, level, tnode);
+ 		if (node_up (tnode) && node_up (tnode) == node_backrecurse (tnode))
+ 			fprintf (file, " H\n");
+ 
--- hnb-1.9.18.orig/debian/patches/09_make_all_callbacks_return_void.patch
+++ hnb-1.9.18/debian/patches/09_make_all_callbacks_return_void.patch
@@ -0,0 +1,2036 @@
+hnb (1.9.18-3)  * Make all callbacks return void*.  (Closes: #325645, #267438)
+
+--- hnb-1.9.18.orig/src/actions.c
++++ hnb-1.9.18/src/actions.c
+@@ -32,7 +32,7 @@ static char address[1024]="";*/
+ static char web_command[255] = "galeon -n *";
+ static char mail_command[255] = "rxvt -rv +sb -e mutt *";
+ 
+-static int cmd_system(int argc, char **argv, void *data){
++static void* cmd_system(int argc, char **argv, void *data){
+ 	Node *pos=(Node *)data;
+ 	int ui_was_inited = ui_inited;
+ 	if (argc>1) {
+@@ -42,7 +42,7 @@ static int cmd_system(int argc, char **a
+ 		if (ui_was_inited)
+ 			ui_init ();
+ 	}
+-	return (int)pos;
++	return pos;
+ }
+ 
+ static int action_node (Node *node)
+@@ -76,7 +76,7 @@ static int action_node (Node *node)
+ 					strcat (cd, url);
+ 					strcat (cd, cs + 1);
+ 					cli_outfunf ("shelling out: %s", cmdline);
+-					//strcat(cd,"> /dev/null 2>&1 &");
++					/* strcat(cd,"> /dev/null 2>&1 &"); */
+ 					break;
+ 				} else {
+ 					*cd = *cs;
+@@ -109,7 +109,7 @@ static int action_node (Node *node)
+ 					strcat (cd, mail_address);
+ 					strcat (cd, cs + 1);
+ 					cli_outfunf ("shelling out: %s", cmdline);
+-					//strcat(cd,"> /dev/null 2>&1 &");
++					/* strcat(cd,"> /dev/null 2>&1 &"); */
+ 					break;
+ 				} else {
+ 					*cd = *cs;
+@@ -136,21 +136,21 @@ static int action_node (Node *node)
+  * url/email address substring,.. and launches an app based on that?
+  *
+  */
+-static int cmd_action (int argc, char **argv, void *data)
++static void* cmd_action (int argc, char **argv, void *data)
+ {
+ 	Node *pos = (Node *) data;
+ 	Node *node = node_right (pos);
+ 
+ 	while (node) {
+ 		if (!action_node (node))
+-			return (int) pos;
++			return pos;
+ 		node = node_down (node);
+ 	}
+ 	if (!action_node (pos)) {
+-		return (int) pos;
++		return pos;
+ 	} else {
+ 		cli_outfunf ("nothing to do");
+-		return (int) pos;
++		return pos;
+ 	}
+ 
+ 	/***
+--- hnb-1.9.18.orig/src/autosave.c
++++ hnb-1.9.18/src/autosave.c
+@@ -49,17 +49,17 @@ static void autosave_invoke(Node *pos){
+ 	autosave_timer=0;
+ }
+ 
+-static int tree_changed_cmd (int argc, char **argv, void *data)
++static void* tree_changed_cmd (int argc, char **argv, void *data)
+ {
+ 		/* TODO: add increment handling, for "extreme changes" */
+ 	Node *pos = (Node *) data;
+ 	nodes_changed++;
+ 	if(autosave_threshold<=nodes_changed)
+ 		autosave_invoke(pos);
+-	return (int) pos;
++	return pos;
+ }
+ 
+-static int autosave_check_timeout (int argc, char **argv, void *data)
++static void* autosave_check_timeout (int argc, char **argv, void *data)
+ {
+ 	Node *pos = (Node *) data;
+ 	if(nodes_changed){
+@@ -68,7 +68,7 @@ static int autosave_check_timeout (int a
+ 			autosave_invoke(pos);
+ 		}		
+ 	}
+-	return (int) pos;
++	return pos;
+ }
+ 
+ /*
+--- hnb-1.9.18.orig/src/cal.c
++++ hnb-1.9.18/src/cal.c
+@@ -36,7 +36,7 @@ static char *const mname[] = {
+ 	  "", "January", "February", "March", "April", "May" ,"June", "July",
+ 	  "August", "September", "October", "November" , "December"};
+ 
+-static int insert_cal(int argc, char **argv, void *data){
++static void* insert_cal(int argc, char **argv, void *data){
+ 	Node *pos=(void *)data;
+ 
+ 	int year;
+@@ -45,7 +45,7 @@ static int insert_cal(int argc, char **a
+ 	
+ 	if( (argc!=3) || (atoi(argv[1])>12 )){
+ 		cli_outfunf("usage: %s <month> <year>", argv[0]);
+-		return (int)data;
++		return data;
+ 	}
+ 
+ 	month=atoi(argv[1]);
+@@ -53,7 +53,7 @@ static int insert_cal(int argc, char **a
+ 
+ 	if(prefs.readonly){
+ 		cli_outfun("readonly flag set, avoiding insertion");
+-		return (int)data;
++		return data;
+ 	}
+ 
+ 	
+@@ -102,8 +102,8 @@ static int insert_cal(int argc, char **a
+ 		}
+ 	}	
+ 
+-	docmd(pos,"tree_changed");
+-	return (int)pos;
++	docmd(pos, "tree_changed");
++	return pos;
+ }
+ 
+ /*
+--- hnb-1.9.18.orig/src/cli_macro.c
++++ hnb-1.9.18/src/cli_macro.c
+@@ -80,7 +80,7 @@ static Node *do_macro(MacroT *macro, Nod
+ 	return pos;
+ }
+ 
+-static int cmd_macro (int argc, char **argv, void *data)
++static void* cmd_macro (int argc, char **argv, void *data)
+ {
+ 	Node *pos=(Node *)data;
+ 	if(argc==1){
+@@ -88,7 +88,7 @@ static int cmd_macro (int argc, char **a
+ 	} else if(argc==2){
+ 		MacroT *tmacro=lookup_macro(argv[1]);
+ 		if(tmacro){
+-			return (int)do_macro(tmacro,pos);
++			return do_macro(tmacro,pos);
+ 		} else {
+ 			cli_outfunf("no such macro defined '%s'",argv[1]);
+ 		}
+@@ -97,7 +97,7 @@ static int cmd_macro (int argc, char **a
+ 		if(!strcmp(argv[1],"define") ){
+ 			if(lookup_macro(argv[2])){
+ 				cli_outfunf("error macro %s already exist,.. this might turn out badly,.. " ,argv[2]);
+-				return (int) pos;
++				return pos;
+ 			} else {
+ 				MacroT *tmacro;
+ 				if(!macro){
+@@ -119,7 +119,7 @@ static int cmd_macro (int argc, char **a
+ 			
+ 		}
+ 	}
+-	return (int) pos;
++	return pos;
+ }
+ 
+ 
+--- hnb-1.9.18.orig/src/clipboard.c
++++ hnb-1.9.18/src/clipboard.c
+@@ -29,7 +29,7 @@
+ 
+ static Node *clipboard = NULL;
+ 
+-static int copy_cmd (int argc,char **argv, void *data)
++static void* copy_cmd (int argc,char **argv, void *data)
+ {
+ 	Node *pos = (Node *) data;
+ 
+@@ -39,15 +39,15 @@ static int copy_cmd (int argc,char **arg
+ 	clipboard = node_new ();
+ 
+ 	clipboard = tree_duplicate (pos, clipboard);
+-	return (int) pos;
++	return pos;
+ }
+ 
+-static int cut_cmd (int argc,char **argv, void *data)
++static void* cut_cmd (int argc,char **argv, void *data)
+ {
+ 	Node *pos = (Node *) data;
+ 	if(prefs.readonly){
+ 		cli_outfun("readonly flag set, avoiding tree change");
+-		return (int)data;
++		return data;
+ 	}
+ 
+ 	if (clipboard != NULL) {
+@@ -58,10 +58,10 @@ static int cut_cmd (int argc,char **argv
+ 	clipboard = tree_duplicate (pos, clipboard);
+ 	pos = node_remove (pos);
+ 	docmd(pos,"tree_changed");
+-	return (int) pos;
++	return pos;
+ }
+ 
+-static int paste_cmd (int argc,char **argv, void *data)
++static void* paste_cmd (int argc,char **argv, void *data)
+ {
+ 	Node *pos = (Node *) data;
+ 
+@@ -71,14 +71,14 @@ static int paste_cmd (int argc,char **ar
+ 		Node *temp;
+ 		if(prefs.readonly){
+ 			cli_outfun("readonly flag set, avoiding insertion");
+-			return (int)data;
++			return data;
+ 		}
+ 
+ 		temp = node_insert_down (pos);
+ 		tree_duplicate (clipboard, temp);
+ 		docmd(pos,"tree_changed");
+ 	}
+-	return (int) pos;
++	return pos;
+ }
+ 
+ /*
+--- hnb-1.9.18.orig/src/evilloop.c
++++ hnb-1.9.18/src/evilloop.c
+@@ -123,10 +123,10 @@ static char *keep_inputbuf[]={
+ 
+ int quit_hnb=0;
+ 
+-static int cmd_quit(int argc,char **argv,void *data){
++static void* cmd_quit(int argc,char **argv,void *data){
+ 	Node *pos=(Node *)data;
+ 	quit_hnb=1;
+-	return (int)pos;
++	return pos;
+ }
+ 
+ /*
+--- hnb-1.9.18.orig/src/expanded.c
++++ hnb-1.9.18/src/expanded.c
+@@ -18,15 +18,15 @@
+  * Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+  */
+ 
++#include <string.h>
+ #include "tree.h"
+ #include "cli.h"
+-#define NULL 0
+ 
+ #include "evilloop.h"
+ #include "ctype.h"
+ #include "ui_binding.h"
+ 
+-static int cmd_expand (int argc,char **argv, void *data)
++static void* cmd_expand (int argc,char **argv, void *data)
+ {
+ 	Node *pos = (Node *) data;
+ 	if(argc==1){
+@@ -35,7 +35,7 @@ static int cmd_expand (int argc,char **a
+ 				inputbuf[strlen (inputbuf) + 1] = 0;
+ 				inputbuf[strlen (inputbuf)] = lastbinding->key;
+ 			}
+-			return (int)pos;
++			return pos;
+ 		}
+ 		node_setflag(pos,F_expanded,1);
+ 	} else if((!strcmp(argv[1],"-a"))||(!strcmp(argv[1],"--all"))){
+@@ -59,10 +59,10 @@ static int cmd_expand (int argc,char **a
+ 		}
+ 		cli_outfun ("expanded subtree");
+ 	}
+-	return (int) pos;
++	return pos;
+ }
+ 
+-static int cmd_collapse (int argc,char **argv, void *data)
++static void* cmd_collapse (int argc,char **argv, void *data)
+ {
+ 	Node *pos = (Node *) data;
+ 	if(argc==1){
+@@ -71,7 +71,7 @@ static int cmd_collapse (int argc,char *
+ 				inputbuf[strlen (inputbuf) + 1] = 0;
+ 				inputbuf[strlen (inputbuf)] = lastbinding->key;
+ 			}		
+-			return (int)pos;
++			return pos;
+ 		}
+ 		node_setflag(pos,F_expanded,0);
+ 	} else if((!strcmp(argv[1],"-a"))||(!strcmp(argv[1],"--all"))){
+@@ -95,7 +95,7 @@ static int cmd_collapse (int argc,char *
+ 		cli_outfun ("collapsed subtree");
+ 	}
+ 	
+-	return (int) pos;
++	return pos;
+ }
+ 
+ /*
+--- hnb-1.9.18.orig/src/file.c
++++ hnb-1.9.18/src/file.c
+@@ -150,13 +150,13 @@ int file_check (char *filename)
+ }
+ 
+ 
+-static int cmd_save (int argc,char **argv, void *data)
++static void* cmd_save (int argc,char **argv, void *data)
+ {
+ 	Node *pos = (Node *) data;
+ 
+ 	if(prefs.readonly){
+ 		docmd (pos, "status \"readonly mode, not writing to disk\"\n");
+-		return (int)pos;
++		return pos;
+ 	}
+ 	
+ 	if (prefs.db_file[0] != (char) 255) { /* magic value of tutorial */
+@@ -179,10 +179,10 @@ static int cmd_save (int argc,char **arg
+ 	} else {
+ 		/* make tutorial users initial database, if initial database dont exist */
+ 	}
+-	return (int) pos;
++	return pos;
+ }
+ 
+-static int cmd_revert (int argc,char **argv, void *data)
++static void* cmd_revert (int argc,char **argv, void *data)
+ {
+ 	Node *pos = (Node *) data;
+ 
+@@ -197,7 +197,7 @@ static int cmd_revert (int argc,char **a
+ 			pos=docmd (pos, buf);
+ 		}
+ 	}
+-	return (int) pos;
++	return pos;
+ }
+ 
+ 
+--- hnb-1.9.18.orig/src/file_ascii.c
++++ hnb-1.9.18/src/file_ascii.c
+@@ -34,7 +34,7 @@
+ 
+ static int ascii_margin = -1;
+ 
+-static int import_ascii (int argc, char **argv, void *data)
++static void* import_ascii (int argc, char **argv, void *data)
+ {
+ 	Node *node = (Node *) data;
+ 	char *filename = argc==2?argv[1]:"";
+@@ -46,7 +46,7 @@ static int import_ascii (int argc, char 
+ 	file = fopen (filename, "r");
+ 	if (file == NULL) {
+ 		cli_outfunf ("ascii import, unable to open \"%s\"", filename);
+-		return (int) (node);
++		return node;
+ 	}
+ 
+ 	init_import (&ist, node);
+@@ -73,7 +73,7 @@ static int import_ascii (int argc, char 
+ 	cli_outfunf ("ascii import, imported \"%s\"", filename);
+ 
+ 
+-	return (int) (node);
++	return node;
+ }
+ 
+ static void ascii_export_node (FILE * file, int level, int flags, char *data)
+@@ -95,7 +95,7 @@ static void ascii_export_node (FILE * fi
+ 	}
+ }
+ 
+-static int export_ascii (int argc, char **argv, void *data)
++static void *export_ascii (int argc, char **argv, void *data)
+ {
+ 	Node *node = (Node *) data;
+ 	char *filename = argc==2?argv[1]:"";
+@@ -110,7 +110,7 @@ static int export_ascii (int argc, char 
+ 		file = fopen (filename, "w");
+ 	if (!file) {
+ 		cli_outfunf ("ascii export, unable to open \"%s\"", filename);
+-		return (int) node;
++		return node;
+ 	}
+ 	startlevel = nodes_left (node);
+ 
+@@ -130,7 +130,7 @@ static int export_ascii (int argc, char 
+ 
+ 	cli_outfunf ("ascii export, wrote output to \"%s\"", filename);
+ 
+-	return (int) node;
++	return node;
+ }
+ 
+ 
+--- hnb-1.9.18.orig/src/file_binary.c
++++ hnb-1.9.18/src/file_binary.c
+@@ -76,7 +76,7 @@ static void binary_export_nodes (FILE * 
+ 	}
+ }
+ 
+-static int export_binary (int argc, char **argv, void *data)
++static void* export_binary (int argc, char **argv, void *data)
+ {
+ 	Node *node = (Node *) data;
+ 	char *filename = argc>=2?argv[1]:"";
+@@ -89,7 +89,7 @@ static int export_binary (int argc, char
+ 
+ 	if (!file) {
+ 		cli_outfunf ("binary export, unable to open \"%s\"", filename);
+-		return (int) node;
++		return node;
+ 	}
+ 
+ 	fwrite (&hnb_binary_header, 4, 1, file);
+@@ -99,11 +99,11 @@ static int export_binary (int argc, char
+ 
+ 	cli_outfunf ("binary export, wrote data to \"%s\"", filename);
+ 
+-	return (int) node;
++	return node;
+ }
+ 
+ 
+-static int import_binary (int argc, char **argv, void *data)
++static void* import_binary (int argc, char **argv, void *data)
+ {
+ 	Node *node = (Node *) data;
+ 	char *filename = argc==2?argv[1]:"";
+@@ -117,7 +117,7 @@ static int import_binary (int argc, char
+ 	file = fopen (filename, "r");
+ 	if (!file) {
+ 		cli_outfunf ("binary import, unable to open \"%s\"", filename);
+-		return (int) node;
++		return node;
+ 	}
+ 
+ 	{int header,version;
+@@ -166,7 +166,7 @@ static int import_binary (int argc, char
+ 		node=node_remove(node);
+ 	cli_outfunf("binary import - imported \"%s\"",filename);
+ 	
+-	return (int) node;
++	return node;
+ }
+ 
+ /*
+--- hnb-1.9.18.orig/src/file_help.c
++++ hnb-1.9.18/src/file_help.c
+@@ -42,7 +42,7 @@ static char *helpquote[]={
+ 
+ /* *INDENT-ON* */
+ 
+-static int export_help (int argc, char **argv, void *data)
++static void* export_help (int argc, char **argv, void *data)
+ {
+ 	Node *node = (Node *) data;
+ 	char *filename = argc==2?argv[1]:"";
+@@ -55,7 +55,7 @@ static int export_help (int argc, char *
+ 	if (!file) {
+ 		cli_outfunf ("help export, unable to open \"%s\"", filename);
+ 
+-		return (int) node;
++		return node;
+ 	}
+ 	startlevel = nodes_left (node);
+ 
+@@ -86,10 +86,10 @@ static int export_help (int argc, char *
+ 	fclose (file);
+ 
+ 	cli_outfunf ("help export, wrote data to \"%s\"", filename);
+-	return (int) node;
++	return node;
+ }
+ 
+-static int import_help (int argc, char **argv, void *data)
++static void* import_help (int argc, char **argv, void *data)
+ {
+ 	Node *node = (Node *) data;
+ 	import_state_t ist;
+@@ -100,7 +100,7 @@ static int import_help (int argc, char *
+ 	if (node_getflag (node, F_temp))
+ 		node = node_remove (node);
+ 
+-	return (int) (node);
++	return node;
+ }
+ 
+ /*
+--- hnb-1.9.18.orig/src/file_hnb.c
++++ hnb-1.9.18/src/file_hnb.c
+@@ -105,7 +105,7 @@ static void hnb_export_nodes (FILE * fil
+ 	}
+ }
+ 
+-static int export_hnb (int argc, char **argv, void *data)
++static void* export_hnb (int argc, char **argv, void *data)
+ {
+ 	Node *node = (Node *) data;
+ 	char *filename = argc>=2?argv[1]:"";
+@@ -118,7 +118,7 @@ static int export_hnb (int argc, char **
+ 
+ 	if (!file) {
+ 		cli_outfunf ("hnb export, unable to open \"%s\"", filename);
+-		return (int) node;
++		return node;
+ 	}
+ 
+ 	fprintf (file, "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?><?hnb pos=\"%s\"?>\n\
+@@ -143,11 +143,11 @@ static int export_hnb (int argc, char **
+ 
+ 	cli_outfunf ("hnb export, wrote data to \"%s\"", filename);
+ 
+-	return (int) node;
++	return node;
+ }
+ 
+ 
+-static int import_hnb (int argc, char **argv, void *data)
++static void* import_hnb (int argc, char **argv, void *data)
+ {
+ 	Node *node = (Node *) data;
+ 	char *filename = argc==2?argv[1]:"";
+@@ -170,7 +170,7 @@ static int import_hnb (int argc, char **
+ 	file = fopen (filename, "r");
+ 	if (!file) {
+ 		cli_outfunf ("hnb import, unable to open \"%s\"", filename);
+-		return (int) node;
++		return node;
+ 	}
+ 	s = xml_tok_init (file);
+ 	init_import (&ist, node);
+@@ -180,7 +180,7 @@ static int import_hnb (int argc, char **
+ 			cli_outfunf ("hnb import error, parsing og '%s' line:%i, %s", filename,
+ 						 s->line_no, rdata);
+ 			fclose (file);
+-			return (int) node;
++			return node;
+ 		}
+ 		if (in_tree) {
+ 			if (type == t_tag && !strcmp (rdata, "node")) {
+@@ -263,7 +263,7 @@ static int import_hnb (int argc, char **
+ 
+ 	xml_tok_cleanup (s);
+ 
+-	return (int) node;
++	return node;
+ }
+ 
+ /*
+--- hnb-1.9.18.orig/src/file_html.c
++++ hnb-1.9.18/src/file_html.c
+@@ -52,7 +52,7 @@ static char *htmlquote[]={
+ /* *INDENT-ON* */
+ 
+ 
+-static int export_html (int argc, char **argv, void *data)
++static void* export_html (int argc, char **argv, void *data)
+ {
+ 	Node *node = (Node *) data;
+ 	char *filename = argc==2?argv[1]:"";
+@@ -67,7 +67,7 @@ static int export_html (int argc, char *
+ 		file = fopen (filename, "w");
+ 	if (!file) {
+ 		cli_outfunf ("html export, unable to open \"%s\"", filename);
+-		return (int) node;
++		return node;
+ 	}
+ 
+ 	startlevel = nodes_left (node);
+@@ -130,7 +130,7 @@ static int export_html (int argc, char *
+ 		fclose (file);
+ 
+ 	cli_outfunf ("html export, saved output in \"%s\"", filename);
+-	return (int) node;
++	return node;
+ }
+ 
+ static void htmlcss_export_nodes (FILE * file, Node *node, int level)
+@@ -162,7 +162,7 @@ static void htmlcss_export_nodes (FILE *
+ }
+ 
+ 
+-static int export_htmlcss (int argc, char **argv, void *data)
++static void* export_htmlcss (int argc, char **argv, void *data)
+ {
+ 	Node *node = (Node *) data;
+ 	char *filename = argc==2?argv[1]:"";
+@@ -174,7 +174,7 @@ static int export_htmlcss (int argc, cha
+ 		file = fopen (filename, "w");
+ 	if (!file) {
+ 		cli_outfunf ("html export, unable to open \"%s\"", filename);
+-		return (int) node;
++		return node;
+ 	}
+ 
+ 	fprintf (file, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\
+@@ -182,8 +182,8 @@ static int export_htmlcss (int argc, cha
+ \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n\
+ <html><head>\n\
+ <meta http-equiv=\"Content-type\" content=\"text/html; charset=ISO8859-1\" />\n\
+-<title>tree exported from hnb</title>\n\
+-<style type=\"text/css\" id=\"internalStyle\">\n\
++<title>tree exported from hnb</title>\n");
++	fprintf (file, "<style type=\"text/css\" id=\"internalStyle\">\n\
+ body {\n\
+ 	padding-right: 3em;\n\
+ 	padding-left: 3em;\n\
+@@ -194,8 +194,8 @@ div {\n\
+ 	font-size:   10pt;\n\
+ 	left:        2em;\n\
+ 	padding-right: 2em;\n\
+-}\n\
+-div.level1 {\n\
++}\n");
++	fprintf (file, "div.level1 {\n\
+ 	padding-top: 2.5em;\n\
+ 	font-family: verdana, arial, helvetica, sans-serif; position:relative;\n\
+ 	font-size:   18pt;\n\
+@@ -214,8 +214,8 @@ div.level2 {\n\
+ 	padding-right: 0em;\n\
+ }\n\
+ </style>\n\
+-</head>\n\
+-<body xmlns=\"http://www.w3.org/1999/xhtml\">\n");
++</head>\n");
++	fprintf (file, "<body xmlns=\"http://www.w3.org/1999/xhtml\">\n");
+ 
+ 	htmlcss_export_nodes (file, node, 0);
+ 
+@@ -224,7 +224,7 @@ div.level2 {\n\
+ 		fclose (file);
+ 
+ 	cli_outfunf ("html css export, saved output in \"%s\"", filename);
+-	return (int) node;
++	return node;
+ }
+ 
+ /*
+--- hnb-1.9.18.orig/src/file_opml.c
++++ hnb-1.9.18/src/file_opml.c
+@@ -90,7 +90,7 @@ static void opml_export_nodes (FILE * fi
+ 	}
+ }
+ 
+-static int export_opml (int argc, char **argv, void *data)
++static void* export_opml (int argc, char **argv, void *data)
+ {
+ 	Node *node = (Node *) data;
+ 	char *filename = argc>=2?argv[1]:"";
+@@ -103,12 +103,15 @@ static int export_opml (int argc, char *
+ 
+ 	if (!file) {
+ 		cli_outfunf ("opml export, unable to open \"%s\"", filename);
+-		return (int) node;
++		return node;
+ 	}
+ 
+-	fprintf (file, "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?><?pos=\"%s\"?>\n\
+-<!-- generated by hnb %s (http://hnb.sourceforge.net/) -->\n\
+-<opml version=\"1.0\">\n\
++	fprintf (file,
++		"<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>"
++		"<?pos=\"%s\"?>\n"
++		" <!-- generated by hnb %s (http://hnb.sourceforge.net/) -->\n",
++	 	argc == 3 ? argv[2] : "1", VERSION);
++	fprintf (file, "<opml version=\"1.0\">\n\
+ 	<head>\n\
+ 		<title>outline exported from hnb</title>\n\
+ 		<dateCreated></dateCreated>\n\
+@@ -122,8 +125,7 @@ static int export_opml (int argc, char *
+ 		<windowBottom>200</windowBottom>\n\
+ 		<windowRight>200</windowRight>\n\
+ 		</head>\n\
+-	<body>\n", argc==3?argv[2]:"1",
+-			 VERSION);
++	<body>\n");
+ 
+ 	opml_export_nodes (file, node, 0);
+ 
+@@ -133,10 +135,10 @@ static int export_opml (int argc, char *
+ 
+ 	cli_outfunf ("opml export, wrote data to \"%s\"", filename);
+ 
+-	return (int) node;
++	return node;
+ }
+ 
+-static int import_opml (int argc, char **argv, void *data)
++static void* import_opml (int argc, char **argv, void *data)
+ {
+ 	Node *node = (Node *) data;
+ 	char *filename = argc==2?argv[1]:"";
+@@ -154,7 +156,7 @@ static int import_opml (int argc, char *
+ 	file = fopen (filename, "r");
+ 	if (!file) {
+ 		cli_outfunf ("opml import, unable to open \"%s\"", filename);
+-		return (int) node;
++		return node;
+ 	}
+ 	s = xml_tok_init (file);
+ 	init_import (&ist, node);
+@@ -164,7 +166,7 @@ static int import_opml (int argc, char *
+ 			cli_outfunf ("opml import error, parsing og '%s', line:%i %s", filename,
+ 						 s->line_no, rdata);
+ 			fclose (file);
+-			return (int) node;
++			return node;
+ 		}
+ 		if (in_body) {
+ 			if (type == t_tag && !strcmp (rdata, "outline")) {
+@@ -208,7 +210,7 @@ static int import_opml (int argc, char *
+ 
+ 	cli_outfunf ("opml import - imported \"%s\" %i lines", filename, s->line_no);
+ 	xml_tok_cleanup (s);
+-	return (int) node;
++	return node;
+ }
+ 
+ 
+--- hnb-1.9.18.orig/src/file_ps.c
++++ hnb-1.9.18/src/file_ps.c
+@@ -71,7 +71,7 @@ static void ps_export_node (FILE * file,
+ 	free(quoted);
+ }
+ 
+-static int export_ps (int argc, char **argv, void *data)
++static void* export_ps (int argc, char **argv, void *data)
+ {
+ 	Node *node = (Node *) data;
+ 	char *filename = argc==2?argv[1]:"";
+@@ -85,7 +85,7 @@ static int export_ps (int argc, char **a
+ 		file = fopen (filename, "w");
+ 	if (!file) {
+ 		cli_outfunf ("postscript export, unable to open \"%s\"", filename);
+-		return (int) node;
++		return node;
+ 	}
+ 	startlevel = nodes_left (node);
+ 
+@@ -100,8 +100,8 @@ static int export_ps (int argc, char **a
+ /_Z { /defaults save def } def\n\
+ /ZZ { defaults restore } def\n\
+ /PW { /pw exch def } def 595 PW %% paper width\n\
+-/PH { /ph exch def } def 842 PH %% paper height\n\
+-%% Defaults: tm = text height: rm = text width\n\
++/PH { /ph exch def } def 842 PH %% paper height\n");
++	fprintf (file, "%% Defaults: tm = text height: rm = text width\n\
+ /FM { /fm exch def } def 72 FM %% footer margin\n\
+ /TM { /tm exch def } def 680 TM %% top margin\n\
+ /RM { /rm exch def } def 480 RM %% right margin\n\
+@@ -110,53 +110,57 @@ static int export_ps (int argc, char **a
+ /LG { /lg exch def } def 11 LG %% linespacing\n\
+ \n\
+ /PG { /pg exch def } def 1 PG %% first number\n\
+-/margins { 680 TM 480 RM 0 BM 0 LM } def\n\
+-\n\
+-/MF {	%% fontname newfontname -> -	make a new encoded font \n\
++/margins { 680 TM 480 RM 0 BM 0 LM } def\n\n");
++	fprintf (file,
++"/MF {	%% fontname newfontname -> -	make a new encoded font \n\
+ /newfontname exch def /fontname exch def /fontdict fontname findfont def /newfont fontdict\n\
+ maxlength dict def fontdict { exch dup /FID eq { pop pop } { exch newfont 3 1\n\
+ roll put } ifelse } forall newfont /FontName newfontname put encoding_vector\n\
+ length 256 eq { newfont /Encoding encoding_vector put } if newfontname newfont\n\
+-definefont pop } def\n\
+-\n\
+-/encoding_vector [ /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\
++definefont pop } def\n\n");
++	fprintf (file,
++"/encoding_vector [ /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\
+ 	/.notdef  /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\
+ 	/.notdef  /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\
+ 	/.notdef  /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\
+-	/.notdef  /.notdef /space /exclam /quotedbl /numbersign /dollar /percent\n\
+-	/ampersand  /quoteright /parenleft /parenright /asterisk /plus /comma /hyphen\n\
++	/.notdef  /.notdef /space /exclam /quotedbl /numbersign /dollar /percent\n");
++	fprintf (file,
++	"/ampersand  /quoteright /parenleft /parenright /asterisk /plus /comma /hyphen\n\
+ 	/period  /slash /zero /one /two /three /four /five /six  /seven /eight /nine\n\
+ 	/colon /semicolon /less /equal /greater  /question /at /A /B /C /D /E /F  /G /H\n\
+-	/I /J /K /L /M /N  /O /P /Q /R /S /T /U /V  /W /X /Y /Z /bracketleft /backslash\n\
+-	/bracketright /asciicircum  /underscore /quoteleft /a /b /c /d /e /f  /g /h /i\n\
++	/I /J /K /L /M /N  /O /P /Q /R /S /T /U /V  /W /X /Y /Z /bracketleft /backslash\n");
++	fprintf (file,
++	"/bracketright /asciicircum  /underscore /quoteleft /a /b /c /d /e /f  /g /h /i\n\
+ 	/j /k /l /m /n  /o /p /q /r /s /t /u /v  /w /x /y /z /braceleft /bar\n\
+-	/braceright /tilde  /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\
++	/braceright /tilde  /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n");
++	fprintf (file,
++	"/.notdef /.notdef  /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\
+ 	/.notdef /.notdef  /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\
+ 	/.notdef /.notdef  /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\
+-	/.notdef /.notdef  /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\
+-	/.notdef /.notdef  /.notdef /space /exclamdown /cent /sterling /currency /yen\n\
+-	/brokenbar  /section /dieresis /copyright /ordfeminine /guillemotleft\n\
++	/.notdef /.notdef  /.notdef /space /exclamdown /cent /sterling /currency /yen\n");
++	fprintf (file,
++	"/brokenbar  /section /dieresis /copyright /ordfeminine /guillemotleft\n\
+ 	/logicalnot /hyphen /registered  /macron /degree /plusminus /twosuperior\n\
+ 	/threesuperior /acute /mu /paragraph  /bullet /cedilla /onesuperior\n\
+-	/ordmasculine /guillemotright /onequarter /onehalf /threequarters /questiondown\n\
+-	/Agrave /Aacute /Acircumflex /Atilde /Adieresis /Aring /AE  /Ccedilla /Egrave\n\
++	/ordmasculine /guillemotright /onequarter /onehalf /threequarters /questiondown\n");
++	fprintf (file,
++	"/Agrave /Aacute /Acircumflex /Atilde /Adieresis /Aring /AE  /Ccedilla /Egrave\n\
+ 	/Eacute /Ecircumflex /Edieresis /Igrave /Iacute /Icircumflex  /Idieresis /Eth\n\
+ 	/Ntilde /Ograve /Oacute /Ocircumflex /Otilde /Odieresis  /multiply /Oslash\n\
+-	/Ugrave /Uacute /Ucircumflex /Udieresis /Yacute /Thorn  /germandbls /agrave\n\
+-	/aacute /acircumflex /atilde /adieresis /aring /ae  /ccedilla /egrave /eacute\n\
++	/Ugrave /Uacute /Ucircumflex /Udieresis /Yacute /Thorn  /germandbls /agrave\n");
++	fprintf (file,
++	"/aacute /acircumflex /atilde /adieresis /aring /ae  /ccedilla /egrave /eacute\n\
+ 	/ecircumflex /edieresis /igrave /iacute /icircumflex  /idieresis /eth /ntilde\n\
+ 	/ograve /oacute /ocircumflex /otilde /odieresis  /divide /oslash /ugrave\n\
+ 	/uacute /ucircumflex /udieresis /yacute /thorn  /ydieresis \n\
+-] def\n\
+-\n\
+-/Times-Roman /Times-Roman-IL1 MF\n\
++] def\n\n");
++	fprintf (file, "/Times-Roman /Times-Roman-IL1 MF\n\
+ /Times-Italic /Times-Italic-IL1 MF\n\
+ /Times-Bold /Times-Bold-IL1 MF\n\
+ /Helvetica /Helvetica-IL1 MF\n\
+ /Helvetica-Oblique /Helvetica-Oblique-IL1 MF\n\
+-/Helvetica-Bold /Helvetica-Bold-IL1 MF\n\
+-\n\
+-/textbox {\n\
++/Helvetica-Bold /Helvetica-Bold-IL1 MF\n\n");
++	fprintf (file, "/textbox {\n\
+ margins 10 rom 12 LG lm tm moveto } def\n\
+ /midpage { pw rm sub 2 div fm translate\n\
+ textbox numbering 10 ss} def\n\
+@@ -165,8 +169,8 @@ textbox numbering 10 ss} def\n\
+ /jump { bm tm gt { showpage grestore p1 } if\n\
+ } def } def p1\n\
+ } def\n\
+-/newpage { 10 neg TM tm pop jump } def\n\
+-%% close file\n\
++/newpage { 10 neg TM tm pop jump } def\n");
++	fprintf (file, "%% close file\n\
+ /close { showpage grestore clear end ZZ } def\n\
+ /minidict 90 dict def \n\
+ minidict begin \n\
+@@ -181,13 +185,13 @@ exch sub lm add tm moveto } bind def\n\
+ /numbering { gs rm 2 div bm 25 sub moveto\n\
+ pg pg 1 add PG 4 string cvs 7 ss show gr } def\n\
+ /find { search { pop 3 -1 roll 1 add 3 1 roll }\n\
+-{ pop exit } ifelse } def\n\
+-/spacecount { 0 exch ( ) { find } loop } def\n\
++{ pop exit } ifelse } def\n");
++	fprintf (file, "/spacecount { 0 exch ( ) { find } loop } def\n\
+ /toofar? { ( ) search pop dup stringwidth pop\n\
+ currentpoint pop add rm gt } bind def\n\
+ /pagejump { jump toofar? { L jump s s }\n\
+-{ s s } ifelse } def\n\
+-/s /show load def %% \n\
++{ s s } ifelse } def\n");
++	fprintf (file, "/s /show load def %% \n\
+ /n { bm tm gt { jump s L } { s L } ifelse} bind def\n\
+ /c { centre s L } def \n\
+ /S { dup spacecount { pagejump } repeat pop } def\n\
+@@ -200,13 +204,10 @@ currentpoint pop add rm gt } bind def\n\
+ /bol { /Times-Bold-IL1 F } def\n\
+ /ss { /Helvetica-IL1 F } def\n\
+ /si { /Helvetica-Oblique-IL1 } def\n\
+-/sb { /Helvetica-Bold-IL1 F } def\n\
+-\n\
+-end %% close minidict: *this is important*\n\
+-%%%% EndResource\n\
+-\n\
+-\n\
+-%%%%BeginPageSetup \n\
++/sb { /Helvetica-Bold-IL1 F } def\n\n");
++	fprintf (file, "end %% close minidict: *this is important*\n\
++%%%% EndResource\n\n\n");
++	fprintf (file, "%%%%BeginPageSetup \n\
+ 1upA4 %% open the page \n\
+ %%%%EndPageSetup \n\
+ 0 a\n\
+@@ -233,7 +234,7 @@ close\n\
+ 	cli_outfunf ("postscript export, saved output to \"%s\"", filename);
+ 	if (file != stdout)
+ 		fclose (file);
+-	return (int) node;
++	return node;
+ }
+ 
+ /*
+--- hnb-1.9.18.orig/src/file_xml.c
++++ hnb-1.9.18/src/file_xml.c
+@@ -147,7 +147,7 @@ static void xml_export_nodes (FILE * fil
+ 	}
+ }
+ 
+-static int export_xml (int argc, char **argv, void *data)
++static void* export_xml (int argc, char **argv, void *data)
+ {
+ 	Node *node = (Node *) data;
+ 	char *filename = argc==2?argv[1]:"";
+@@ -159,7 +159,7 @@ static int export_xml (int argc, char **
+ 		file = fopen (filename, "w");
+ 	if (!file) {
+ 		cli_outfunf ("xml export, unable to open \"%s\"", filename);
+-		return (int) node;
++		return node;
+ 	}
+ 
+ 	xml_export_nodes (file, node, 0);
+@@ -170,7 +170,7 @@ static int export_xml (int argc, char **
+ 	cli_outfunf ("xml export, wrote data to \"%s\"", filename);
+ 
+ 
+-	return (int) node;
++	return node;
+ }
+ 
+ /* joins up tags with data if there is data as the first child
+@@ -202,7 +202,7 @@ static Node *xml_cuddle_nodes (Node *nod
+ }
+ 
+ 
+-static int import_xml (int argc, char **argv, void *data)
++static void* import_xml (int argc, char **argv, void *data)
+ {
+ 	Node *node = (Node *) data;
+ 	char *filename = argc==2?argv[1]:"";
+@@ -221,7 +221,7 @@ static int import_xml (int argc, char **
+ 	file = fopen (filename, "r");
+ 	if (!file) {
+ 		cli_outfunf ("xml import, unable to open \"%s\"", filename);
+-		return (int) node;
++		return node;
+ 	}
+ 	s = xml_tok_init (file);
+ 	init_import (&ist, node);
+@@ -231,7 +231,7 @@ static int import_xml (int argc, char **
+ 			cli_outfunf ("xml import error, parsing og '%s', line:%i %s", filename,
+ 						 s->line_no,rdata);
+ 			fclose (file);
+-			return (int) node;
++			return node;
+ 		}
+ 
+ 		switch (type) {
+@@ -328,7 +328,7 @@ static int import_xml (int argc, char **
+ 
+ 	cli_outfunf ("xml import - imported \"%s\" %i lines", filename, s->line_no);
+ 	xml_tok_cleanup (s);
+-	return (int) node;
++	return node;
+ }
+ 
+ /*
+--- hnb-1.9.18.orig/src/libcli/cli.c
++++ hnb-1.9.18/src/libcli/cli.c
+@@ -113,7 +113,7 @@ static  int item_matches (const char *it
+ 
+ typedef struct ItemT {
+ 	char *name;					/* what the user types */
+-	int (*func) (int argc,char **argv, void *data);	/* function that is the command */
++	void* (*func) (int argc,char **argv, void *data);	/* function that is the command */
+ 	int *integer;				/* pointer to integer (set to NULL if string) */
+ 	char *string;				/* pointer to string (set to NULL if integer) */
+ 	char *usage;					/* helptext for this command */
+@@ -129,8 +129,8 @@ static ItemT *items = NULL;
+ 
+ void
+ cli_add_item (char *name,
+-		  int *integer, char *string,
+-		  int (*func) (int argc,char **argv, void *data), char *usage)
++	      int *integer, char *string,
++	      void *(*func) (int argc,char **argv, void *data), char *usage)
+ {
+ 	ItemT *titem = items;
+ 
+@@ -191,8 +191,8 @@ void cli_add_help(char *name, char *help
+ }
+ 
+ 
+-static int help (int argc,char **argv, void *data);
+-static int vars (int argc,char **argv, void *data);
++static void* help (int argc,char **argv, void *data);
++static void* vars (int argc,char **argv, void *data);
+ 
+ static int inited = 0;
+ 
+@@ -224,13 +224,13 @@ static void init_cli (void)
+ 
+ int cli_calllevel=0;
+ 
+-int cli_docmd (char *commandline, void *data)
++void *cli_docmd (char *commandline, void *data)
+ {
+ 	int largc=0;
+ 	char **largv;
+ 	
+ 	ItemT *titem = items;
+-	int ret=(int)data;
++	void *ret=data;
+ 	cli_calllevel++;
+ 
+ 	if (cli_precmd)
+@@ -382,7 +382,7 @@ char *cli_complete (const char *commandl
+ 
+ /* internal commands */
+ 
+-static int help (int argc,char **argv, void *data)
++static void* help (int argc,char **argv, void *data)
+ {
+ 	if (argc == 1) {		/* show all help */
+ 		ItemT *titem = items;
+@@ -410,17 +410,17 @@ static int help (int argc,char **argv, v
+ 						cli_outfun ("");
+ 						cli_outfun(titem->help);
+ 					}
+-					return(int)data;
++					return data;
+ 				}
+ 			}
+ 			titem = titem->next;
+ 		}
+ 		cli_outfunf ("unknown command '%s'", argv[1]);
+ 	}
+-	return(int)data;	
++	return data;	
+ }
+ 
+-static int vars (int argc, char **argv, void *data)
++static void* vars (int argc, char **argv, void *data)
+ {
+ 	ItemT *titem = items;
+ 
+@@ -446,7 +446,7 @@ static int vars (int argc, char **argv, 
+ 
+ 	cli_outfunf ("----------------");
+ 	cli_outfunf ("to change a variable: \"variablename newvalue\"");
+-	return(int)data;
++	return data;
+ }
+ 
+ char *cli_getstring(char *variable){
+--- hnb-1.9.18.orig/src/libcli/cli.h
++++ hnb-1.9.18/src/libcli/cli.h
+@@ -40,8 +40,8 @@ void cli_cleanup(void);
+ 
+ void
+ cli_add_item (char *name,
+-		  int *integer, char *string,
+-		  int (*func) (int argc,char **argv, void *data), char *usage);
++	      int *integer, char *string,
++	      void* (*func) (int argc,char **argv, void *data), char *usage);
+ 
+ #define cli_add_int(name,integer,usage)\
+ 	cli_add_item (name, integer, NULL, NULL, usage)
+@@ -55,7 +55,7 @@ cli_add_item (char *name,
+ int cli_load_file(char *filename);
+ 
+ char *cli_complete (const char *commandline);	/* returns a completed commandline */
+-int cli_docmd (char *commandline, void *data);	/* run commandline */
++void *cli_docmd (char *commandline, void *data);	/* run commandline */
+ 
+ 
+ extern void (*cli_outfun) (char *);	/* the outputting function 
+--- hnb-1.9.18.orig/src/libcli/cli_tokenize.c
++++ hnb-1.9.18/src/libcli/cli_tokenize.c
+@@ -182,10 +182,10 @@ static int is_oneof (char c, char *chars
+ 
+ #define MAX_VARNAMELENGTH 128
+ 
+-char **argv_tokenize(char *input_string){
++char **argv_tokenize(char *input_string) {
+ 	char **argv=NULL;
+ 	char *output;
+-	unsigned char varname[MAX_VARNAMELENGTH]="";
++	char varname[MAX_VARNAMELENGTH]="";
+ 	int varname_pos=0;
+ 	
+ 	init_state_table();
+--- hnb-1.9.18.orig/src/libcli/test.c
++++ hnb-1.9.18/src/libcli/test.c
+@@ -23,7 +23,7 @@
+ int integer=0;
+ char string[40]="not set";
+ 
+-int echo(int argc,char **argv, void *data){
++void* echo(int argc,char **argv, void *data){
+ 	printf("tokens:%i\n",argc);
+ 	while(*argv)
+ 		printf("[%s]\n",*(argv++));
+--- hnb-1.9.18.orig/src/node.c
++++ hnb-1.9.18/src/node.c
+@@ -142,48 +142,48 @@ void node_unset (Node *node, char *name)
+ #include <stdio.h>
+ 
+ 
+-int cmd_att_set (int argc, char **argv, void *data)
++void *cmd_att_set (int argc, char **argv, void *data)
+ {
+ 	Node *pos = (Node *) data;
+ 
+ 	if(argc!=3){
+ 		cli_outfunf("usage: %s <attribute> <value>",argv[0]);
+-		return (int) pos;
++		return pos;
+ 	}
+ 		
+ 	node_set (pos, argv[1], argv[2]);
+-	return (int) pos;
++	return pos;
+ }
+ 
+-int cmd_att_get (int argc, char **argv, void *data)
++void *cmd_att_get (int argc, char **argv, void *data)
+ {
+ 	Node *pos = (Node *) data;
+ 	char *cdata;
+ 	
+ 	if(argc!=2){
+ 		cli_outfunf("usage: %s <attribute>",argv[0]);
+-		return (int) pos;
++		return pos;
+ 	}
+ 			
+ 	cdata = node_get (pos, argv[1]);
+ 
+ 	if (cdata)
+ 		cli_outfun (cdata);
+-	return (int) pos;
++	return pos;
+ }
+ 
+-int cmd_att_clear (int argc, char **argv, void *data)
++void *cmd_att_clear (int argc, char **argv, void *data)
+ {
+ 	Node *pos = (Node *) data;
+ 	if(argc!=2){
+ 		cli_outfunf("usage: %s <attribute>",argv[0]);
+-		return (int) pos;
++		return pos;
+ 	}
+ 	node_unset (pos, argv[1]);
+-	return (int) pos;
++	return pos;
+ }
+ 
+-int cmd_att_list (int argc,char **argv, void *data)
++void *cmd_att_list (int argc,char **argv, void *data)
+ {
+ 	Node_AttItem *att;
+ 	Node *pos = (Node *) data;
+@@ -193,7 +193,7 @@ int cmd_att_list (int argc,char **argv, 
+ 		cli_outfunf ("%s: [%s]", att->name, att->data);
+ 		att = att->next;
+ 	}
+-	return (int) pos;
++	return pos;
+ }
+ 
+ /*
+--- hnb-1.9.18.orig/src/query.c
++++ hnb-1.9.18/src/query.c
+@@ -27,7 +27,7 @@
+ 
+ static char query[100];
+ 
+-static int getquery_cmd (int argc, char **argv, void *data)
++static void* getquery_cmd (int argc, char **argv, void *data)
+ {
+ 	Node *pos = (Node *) data;
+ 
+@@ -36,7 +36,7 @@ static int getquery_cmd (int argc, char 
+ 		ui_getstr (argv[1], &query[0]);
+ 	else
+ 		ui_getstr ("enter string", &query[0]);
+-	return (int) pos;
++	return pos;
+ }
+ 
+ /*
+--- hnb-1.9.18.orig/src/search.c
++++ hnb-1.9.18/src/search.c
+@@ -28,7 +28,7 @@
+ 
+ /************** search ************************/
+ 
+-static int search(int argc,char **argv,void *data){
++static void* search(int argc,char **argv,void *data){
+ 	Node *pos=(Node *)data;
+ 	
+ 	if(argc==2){
+@@ -37,7 +37,7 @@ static int search(int argc,char **argv,v
+ 			if (pos == NULL) {
+ 				docmdf (pos, "status 'reached bottom of tree and \\'%s\\' not found'",
+ 						argv[1]);
+-				return (int) data;
++				return data;
+ 			}			
+ 		}
+ 	} else if(argc>2){
+@@ -46,20 +46,20 @@ static int search(int argc,char **argv,v
+ 			if (pos == NULL) {
+ 				docmdf (pos, "status 'reached top of tree and \\'%s\\' not found'",
+ 						argv[2]);
+-				return (int) data;
++				return data;
+ 			}			
+ 		} else if(!strcmp(argv[1],"-f")){
+ 			pos=node_recursive_match( argv[2],pos);
+ 			if (pos == NULL) {
+ 				docmdf (pos, "status 'reached bottom of tree and \\'%s\\' not found'",
+ 						argv[2]);
+-				return (int) data;
++				return data;
+ 			}
+ 		}
+-		return (int)pos;
++		return pos;
+ 	} 
+ 	cli_outfunf("usage: %s [-b|-f] <string>",argv[0]);
+-	return (int)pos;
++	return pos;
+ }
+ 
+ /*
+--- hnb-1.9.18.orig/src/spell.c
++++ hnb-1.9.18/src/spell.c
+@@ -72,12 +72,12 @@ static void spell_node (Node *node)
+ 	}
+ }
+ 
+-static int spell_cmd (int argc, char **argv, void *data)
++static void* spell_cmd (int argc, char **argv, void *data)
+ {
+ 	Node *pos = (Node *) data;
+ 	if(prefs.readonly){
+ 			cli_outfun("readonly flag set, avoiding changes");
+-			return (int)data;
++			return data;
+ 	}
+ 	if (argc==2 && (!strcmp (argv[1], "-r"))) {
+ 		int startlevel;
+@@ -92,7 +92,7 @@ static int spell_cmd (int argc, char **a
+ 	} else {
+ 		spell_node (pos);
+ 	}
+-	return (int) pos;
++	return pos;
+ }
+ 
+ /*
+@@ -102,7 +102,10 @@ void init_spell ()
+ {
+ 	cli_add_command ("spell", spell_cmd, "[-r]");
+ 	cli_add_help ("spell",
+-				  "Spellchecks the current node, or all children and following siblings recursively (if -r specified), using the command defined in 'spell_command'");
++		      "Spellchecks the current node, or all children and "
++		      "following siblings recursively (if -r specified), "
++                      "using the command defined in 'spell_command'");
+ 	cli_add_string ("spell_command", spell_command,
+-					"Command executed when spell checking a node, a temporary file is written and passed as an argument");
++			"Command executed when spell checking a node, a "
++			"temporary file is written and passed as an argument");
+ }
+--- hnb-1.9.18.orig/src/statcmds.c
++++ hnb-1.9.18/src/statcmds.c
+@@ -25,7 +25,7 @@
+ 
+ #ifndef WIN32
+ 
+-static int mem_cmd (int argc, char **argv, void *data)
++static void* mem_cmd (int argc, char **argv, void *data)
+ {
+ 	Node *pos = (Node *) data;
+ 
+@@ -35,7 +35,7 @@ static int mem_cmd (int argc, char **arg
+ 
+ 		file = fopen ("/proc/self/stat", "r");
+ 		if (!file)
+-			return (int) pos;
++			return pos;
+ 
+ 		fscanf (file,
+ 				"%*i %*s %*s %*i %*i %*i %*i %*i %*i %*i %*i %*i %*i %*i %*i %*i %*i %*i %*i %*i %*i %*i %i",
+@@ -53,7 +53,7 @@ static int mem_cmd (int argc, char **arg
+ 
+ 		file = fopen ("/proc/meminfo", "r");
+ 		if (!file)
+-			return (int) pos;
++			return pos;
+ 
+ 		fscanf (file, "%*s %*s %*s %*s %*s %*s %*s %*i %*i %i %i %i",
+ 				&free, &buffers, &cached);
+@@ -64,7 +64,7 @@ static int mem_cmd (int argc, char **arg
+ 					 (float) ((free + buffers + cached) / 1024.0 / 1024.0));
+ 	}
+ 
+-	return (int) pos;
++	return pos;
+ }
+ #endif
+ /*
+@@ -97,7 +97,7 @@ static int count_words (unsigned char *s
+ 	return words;
+ }
+ 
+-static int stats_cmd (int argc, char **argv, void *data)
++static void* stats_cmd (int argc, char **argv, void *data)
+ {
+ 	int words = 0, leaves = 0, nodes = 0;
+ 	Node *pos = (Node *) data;
+@@ -114,7 +114,7 @@ static int stats_cmd (int argc, char **a
+ 
+ 	cli_outfunf ("nodes:%i, leaves:%i words:%i", nodes, leaves, words);
+ 
+-	return (int) pos;
++	return pos;
+ }
+ 
+ /*
+--- hnb-1.9.18.orig/src/state.c
++++ hnb-1.9.18/src/state.c
+@@ -29,7 +29,7 @@
+ 
+ static Node *savedtree = NULL;
+ 
+-static int save_state_cmd (int argc, char **argv, void *data)
++static void* save_state_cmd (int argc, char **argv, void *data)
+ {
+ 	Node *pos = (Node *) data;
+ 	Node *i;
+@@ -58,10 +58,10 @@ static int save_state_cmd (int argc, cha
+ 			savedtree = node_recurse (savedtree);
+ 	}
+ 
+-	return (int) pos;
++	return pos;
+ }
+ 
+-static int restore_state_cmd (int argc, char **argv, void *data)
++static void* restore_state_cmd (int argc, char **argv, void *data)
+ {
+ 	Node *pos = (Node *) data;
+ 
+@@ -74,7 +74,7 @@ static int restore_state_cmd (int argc, 
+ 		tree_free (savedtree);
+ 		savedtree = NULL;
+ 	}
+-	return (int) pos;
++	return pos;
+ }
+ 
+ /*
+@@ -84,8 +84,9 @@ void init_keepstate ()
+ {
+ 	cli_add_command ("save_state", save_state_cmd, "");
+ 	cli_add_help ("save_state",
+-				  "Saves a copy of the current tree and selected node in memory");
++		      "Saves a copy of the current tree and selected node in "
++		      "memory");
+ 	cli_add_command ("restore_state", restore_state_cmd, "");
+ 	cli_add_help ("restore_state",
+-				  "Restores the copy of the tree saved with save_state");
++		      "Restores the copy of the tree saved with save_state");
+ }
+--- hnb-1.9.18.orig/src/tree_misc.c
++++ hnb-1.9.18/src/tree_misc.c
+@@ -27,16 +27,16 @@
+ #include "ui_cli.h"
+ #include "evilloop.h"
+ 
+-static int cmd_movenode (int argc, char **argv, void *data)
++static void* cmd_movenode (int argc, char **argv, void *data)
+ {
+ 	Node *pos = (Node *) data;
+ 	if(argc<2){
+ 		cli_outfunf("usage: %s <left|right|up|down>",argv[0]);
+-		return (int)pos;
++		return pos;
+ 	}
+ 	if(prefs.readonly){
+ 		cli_outfun("readonly flag set, avoiding tree change");
+-		return (int)data;
++		return data;
+ 	}
+ 	if (!strcmp (argv[1], "left")) {
+ 		if (node_left (pos)) {
+@@ -68,8 +68,8 @@ static int cmd_movenode (int argc, char 
+ 			node_swap (pos, node_down (pos));
+ 		}
+ 	}
+-	docmd(pos,"tree_changed");
+-	return (int) pos;
++	docmd(pos, "tree_changed");
++	return pos;
+ }
+ 
+ /*
+@@ -80,12 +80,12 @@ void init_movenode ()
+ 	cli_add_command ("movenode", cmd_movenode, "<up|left|right|down>");
+ }
+ 
+-static int cmd_go(int argc, char **argv, void *data){
++static void* cmd_go(int argc, char **argv, void *data){
+ 	Node *pos=(Node *)data;
+ 	
+ 	if(argc!=2){
+ 		cli_outfunf("usage: %s <up|down|left|right|recurse|backrecurse|root|top|bottom>");
+-		return (int)pos;
++		return pos;
+ 	}
+ 	
+ 	if(!strcmp(argv[1],"up")){
+@@ -115,7 +115,7 @@ static int cmd_go(int argc, char **argv,
+ 	}
+ 
+ 	
+-	return (int)pos;
++	return pos;
+ }
+ 
+ /*
+@@ -131,7 +131,7 @@ void init_go ()
+ #include "ctype.h"
+ #include "ui_binding.h"
+ 
+-static int cmd_outdent (int argc, char **argv, void *data)
++static void* cmd_outdent (int argc, char **argv, void *data)
+ {
+ 	Node *pos = (Node *) data;
+ 
+@@ -140,11 +140,11 @@ static int cmd_outdent (int argc, char *
+ 			inputbuf[strlen (inputbuf) + 1] = 0;
+ 			inputbuf[strlen (inputbuf)] = lastbinding->key;
+ 		}		
+-		return (int)pos;
++		return pos;
+ 	}
+ 	if(prefs.readonly){
+ 		cli_outfun("readonly flag set, avoiding tree change");
+-		return (int)data;
++		return data;
+ 	}
+ 
+ 	if (node_left (pos)) {
+@@ -174,14 +174,14 @@ static int cmd_outdent (int argc, char *
+ 		} else {
+ 			target_node->right = NULL;
+ 		}
+-		docmd(pos,"tree_changed");
++		docmd(pos, "tree_changed");
+ 	}
+-	return (int) pos;
++	return pos;
+ }
+ 
+ /*	FIXME: no real need for a temporary node */
+ 
+-static int cmd_indent (int argc, char **argv, void *data)
++static void* cmd_indent (int argc, char **argv, void *data)
+ {
+ 	Node *pos = (Node *) data;
+ 
+@@ -190,11 +190,11 @@ static int cmd_indent (int argc, char **
+ 			inputbuf[strlen (inputbuf) + 1] = 0;
+ 			inputbuf[strlen (inputbuf)] = lastbinding->key;
+ 		}		
+-		return (int)pos;
++		return pos;
+ 	}
+ 	if(prefs.readonly){
+ 		cli_outfun("readonly flag set, avoiding tree change");
+-		return (int)data;
++		return data;
+ 	}
+ 
+ 	if (node_up (pos)) {
+@@ -218,9 +218,9 @@ static int cmd_indent (int argc, char **
+ 			snode = node_down (snode);
+ 		}
+ 		node_remove (node_down (pos));
+-		docmd(pos,"tree_changed");
++		docmd(pos, "tree_changed");
+ 	}
+-	return (int) pos;
++	return pos;
+ }
+ 
+ /*
+@@ -236,13 +236,13 @@ void init_outdent_indent ()
+ 				  "moves the active item and the following siblings one level to the right");
+ }
+ 
+-static int remove_cmd (int argc, char **argv, void *data)
++static void* remove_cmd (int argc, char **argv, void *data)
+ {
+ 	Node *pos = (Node *) data;
+ 
+ 	if(prefs.readonly){
+ 		cli_outfun("readonly flag set, avoiding tree change");
+-		return (int)data;
++		return data;
+ 	}
+ 	if (node_right (pos)) {
+ 		Tbinding *c;
+@@ -263,7 +263,7 @@ static int remove_cmd (int argc, char **
+ 		pos = node_remove (pos);
+ 		docmd(pos,"tree_changed");
+ 	}
+-	return (int) pos;
++	return pos;
+ }
+ 
+ /*
+@@ -277,7 +277,7 @@ void init_remove ()
+ }
+ 
+ 
+-static int commandline_cmd (int argc, char **argv, void *data)
++static void* commandline_cmd (int argc, char **argv, void *data)
+ {
+ 	Node *pos = (Node *) data;
+ 
+@@ -292,7 +292,7 @@ static int commandline_cmd (int argc, ch
+ 		if (commandline[0])
+ 			pos = docmd (pos, commandline);
+ 	} while (commandline[0] && strcmp(commandline,"q") && strcmp(commandline,"quit"));
+-	return (int) pos;
++	return pos;
+ }
+ 
+ /*
+@@ -305,12 +305,12 @@ void init_commandline ()
+ 				  "Invokes the interactive commandline in curses mode.");
+ }
+ 
+-static int insert_below_cmd (int argc, char **argv, void *data)
++static void* insert_below_cmd (int argc, char **argv, void *data)
+ {
+ 	Node *pos = (Node *) data;
+ 	if(prefs.readonly){
+ 		cli_outfun("readonly flag set, avoiding tree change");
+-		return (int)data;
++		return data;
+ 	}
+ 
+ 	if (node_getflag (pos, F_temp)) {
+@@ -325,7 +325,7 @@ static int insert_below_cmd (int argc, c
+ 	}
+ 	inputbuf[0] = 0;
+ 	docmd(pos,"tree_changed");
+-	return (int) pos;
++	return pos;
+ }
+ 
+ /*
+--- hnb-1.9.18.orig/src/tree_sort.c
++++ hnb-1.9.18/src/tree_sort.c
+@@ -141,7 +141,7 @@ static int cmp_descending(Node *a,Node *
+ 	return cmp_todo(b,a);
+ }
+ 
+-static int sort_cmd (int argc, char **argv, void *data)
++static void* sort_cmd (int argc, char **argv, void *data)
+ {
+ 	Node *pos = (Node *) data;
+ 	int (*cmp) (Node *a, Node *b)=cmp_todo;
+@@ -155,7 +155,7 @@ static int sort_cmd (int argc, char **ar
+ 	node_mergesort (node_top (pos), nodes_down (node_top (pos)) + 1, cmp);
+ 	if (node_left (pos))
+ 		node_left (pos)->right = node_top (pos);
+-	return (int) pos;
++	return pos;
+ }
+ 
+ /*
+--- hnb-1.9.18.orig/src/tree_todo.c
++++ hnb-1.9.18/src/tree_todo.c
+@@ -260,7 +260,7 @@ int calc_percentage_size (Node *node, in
+ 
+ #include "cli.h"
+ 
+-static int toggle_todo_cmd (int argc, char **argv, void *data)
++static void* toggle_todo_cmd (int argc, char **argv, void *data)
+ {
+ 	Node *pos = (Node *) data;
+ 
+@@ -272,15 +272,15 @@ static int toggle_todo_cmd (int argc, ch
+ 		node_unset(pos,"done");
+ 	}
+ 
+-	return (int) pos;
++	return pos;
+ }
+ 
+-static int toggle_done_cmd (int argc, char **argv, void *data)
++static void* toggle_done_cmd (int argc, char **argv, void *data)
+ {
+ 	Node *pos = (Node *) data;
+ 
+ 	if (strcmp(fixnullstring(node_get(pos,"type")),"todo")) {	/* bail out if not todo info set */
+-		return (int) pos;
++		return pos;
+ 	}
+ 
+ 	if (!strcmp(fixnullstring(node_get(pos,"done")),"yes")) {	/* bail out if not todo info set */
+@@ -289,7 +289,7 @@ static int toggle_done_cmd (int argc, ch
+ 		node_set(pos,"done","yes");
+ 	}
+ 
+-	return (int) pos;
++	return pos;
+ }
+ 
+ /*
+--- hnb-1.9.18.orig/src/ui_binding.c
++++ hnb-1.9.18/src/ui_binding.c
+@@ -250,14 +250,14 @@ static int string2keycode (char *str)
+ 
+ int ui_current_scope = 0;
+ 
+-static int ui_context_cmd (int argc, char **argv, void *data)
++static void* ui_context_cmd (int argc, char **argv, void *data)
+ {
+ 	if(argc<2){
+ 		cli_outfunf("usage: %s <contextname>",argv[0]);
+-		return(int)data;
++		return data;
+ 	}
+ 	ui_current_scope = string2scope (argv[1]);
+-	return (int) data;
++	return data;
+ }
+ 
+ static void makebinding (int scope_no, int key, int action, char *action_name,
+@@ -272,7 +272,7 @@ static void makebinding (int scope_no, i
+ 	ui_binding_count[scope_no]++;
+ }
+ 
+-static int ui_bind_cmd (int argc, char **argv, void *data)
++static void* ui_bind_cmd (int argc, char **argv, void *data)
+ {
+ /*	char context[40];*/
+ 	char *key;
+@@ -280,7 +280,7 @@ static int ui_bind_cmd (int argc, char *
+ 
+ 	if(argc<3){
+ 		cli_outfunf("error in bindings %s %s %s %s\n",argv[0],argv[1],argv[2],argv[3]);
+-		return (int)data;
++		return data;
+ 	}
+ 	key=argv[1];
+ 	action=argv[2];
+@@ -293,7 +293,7 @@ static int ui_bind_cmd (int argc, char *
+ 					 ui_action_command, "command", action);
+ 	}
+ 
+-	return (int) data;
++	return data;
+ }
+ 
+ 
+@@ -395,10 +395,12 @@ char *tidy_keyname (const char *keyname)
+ !init_ui_binding();
+ */
+ 
+-static int dummy_cmd (int argc, char **argv, void *data)
++#if 0
++static void* dummy_cmd (int argc, char **argv, void *data)
+ {
+-	return (int) data;
++	return data;
+ }
++#endif
+ 
+ void init_ui_binding ()
+ {
+@@ -409,8 +411,9 @@ void init_ui_binding ()
+ 	cli_add_help ("context",
+ 				  "Changes context, context may be one of 'main', 'lineedit', 'nodeedit', 'confirm' or any other userdefined context.");
+ 
++#if 0
+ /* dummy commands to show the 'builtins' */
+-/*	cli_add_command ("backspace", dummy_cmd, "");
++	cli_add_command ("backspace", dummy_cmd, "");
+ 	cli_add_help ("backspace", "erase the preceding character");
+ 	cli_add_command ("delete", dummy_cmd, "");
+ 	cli_add_help ("delete", "erase the following character");
+@@ -477,5 +480,5 @@ void init_ui_binding ()
+ 	cli_add_command ("unbound", dummy_cmd, "");
+ 	cli_add_help ("unbound",
+ 				  "give a message indicating that the pressed key is not bound in the current context");
+-*/
++#endif
+ }
+--- hnb-1.9.18.orig/src/ui_cli.c
++++ hnb-1.9.18/src/ui_cli.c
+@@ -49,14 +49,14 @@ static char *path_strip (char *path)
+ 	return path;
+ }
+ 
+-static int add (int argc,char **argv, void *data)
++static void* add (int argc, char **argv, void *data)
+ {
+ 	Node *pos = (Node *) data;
+ 	Node *tnode;
+ 
+ 	if(argc==1){
+ 		cli_outfunf("usage: %s <new entry>",argv[0]);
+-		return 0;
++		return pos;
+ 	}
+ 
+ 	if (argc==2) {
+@@ -65,23 +65,23 @@ static int add (int argc,char **argv, vo
+ 
+ 	tnode = node_insert_down (node_bottom (pos));
+ 	node_set (tnode, TEXT, argv[1]);
+-	return (int) pos;
++	return pos;
+ }
+ 
+-static int addc (int argc,char **argv, void *data)
++static void* addc (int argc, char **argv, void *data)
+ {
+ 	Node *pos = (Node *) data;
+ 	Node *tnode;
+ 
+ 	if(argc==1){
+ 		cli_outfunf("usage: %s <entry> [new subentry]",argv[0]);
+-		return 0;
++		return pos;
+ 	}
+ 
+ 	tnode = node_exact_match (argv[1], pos);
+ 	if (!tnode) {
+ 		cli_outfun ("specified parent not found");
+-		return (int) pos;
++		return pos;
+ 	}
+ 
+ 	if (node_right (tnode)) {
+@@ -95,30 +95,30 @@ static int addc (int argc,char **argv, v
+ 	else
+ 		node_set (tnode, TEXT, argv[2]);
+ 
+-	return (int) pos;
++	return pos;
+ }
+ 
+-static int pwd (int argc,char **argv, void *data)
++static void* pwd (int argc, char **argv, void *data)
+ {
+ 	Node *pos = (Node *) data;
+ 
+ 	cli_outfun (path_strip (node2path (pos)));
+ 	cli_outfun ("\n");
+-	return (int) pos;
++	return pos;
+ }
+ 
+-static int cd (int argc, char **argv, void *data)
++static void* cd (int argc, char **argv, void *data)
+ {
+ 	Node *pos = (Node *) data;
+ 	Node *tnode = pos;
+ 
+ 	if(argc==1){
+-		return (int)node_root(pos);
++		return node_root(pos);
+ 	}
+ 
+ 	if (!strcmp (argv[1], "..")){
+ 		if (node_left (tnode) != 0)
+-			return (int) (node_left (tnode));
++			return node_left (tnode);
+ 	}
+ 		
+ 
+@@ -128,11 +128,9 @@ static int cd (int argc, char **argv, vo
+ 	}
+ 	if (!tnode) {
+ 		cli_outfun ("no such node\n");
+-		return (int) pos;
++		return pos;
+ 	}
+-	return (int) tnode;
+-
+-	return (int) pos;
++	return tnode;
+ }
+ 
+ #include <ctype.h>
+@@ -151,7 +149,7 @@ static void pre_command (char *commandli
+ 	}
+ }
+ 
+-static int ls (int argc, char **argv, void *data)
++static void* ls (int argc, char **argv, void *data)
+ {
+ 	Node *pos = (Node *) data;
+ 
+@@ -188,7 +186,7 @@ static int ls (int argc, char **argv, vo
+ 			tnode = node_down (tnode);
+ 		}
+ 	}
+-	return (int) pos;
++	return pos;
+ }
+ 
+ /*
+@@ -216,12 +214,12 @@ void init_ui_cli (void)
+ 
+ Node *docmd (Node *pos, const char *commandline)
+ {
+-	int ret;
++	Node *ret;
+ 	char *cmdline = strdup (commandline);
+ 
+ 	ret = cli_docmd (cmdline, pos);
+ 	free (cmdline);
+-	return (Node *) ret;
++	return ret;
+ }
+ 
+ Node *docmdf (Node *pos,char *format, ...){
+--- hnb-1.9.18.orig/src/ui_draw.c
++++ hnb-1.9.18/src/ui_draw.c
+@@ -525,7 +525,7 @@ static struct {
+ 
+ /* FIXME: make backup?,.. and make sure data is present,.., make possiblity to write back? */
+ 
+-int display_format_cmd (int argc, char **argv, void *data)
++void* display_format_cmd (int argc, char **argv, void *data)
+ {
+ 	char *p = argv[1];
+ 	int width;
+@@ -533,7 +533,7 @@ int display_format_cmd (int argc, char *
+ 	int col_no = 0;
+ 
+ 	if(argc<2){
+-		return (int)data;
++		return data;
+ 	}
+ 
+ 	do {
+@@ -618,7 +618,7 @@ int display_format_cmd (int argc, char *
+ 
+ 	col_def[col_no].type = col_terminate;
+ 
+-	return (int) data;
++	return data;
+ }
+ 
+ 
+@@ -775,19 +775,19 @@ void ui_draw (Node *node, char *input, i
+ 					tnode = 0;
+ 			}
+ 		}
+-/* draw the currently selected item */
+ 
++		/* draw the currently selected item */
+ 		line_nodeno[active_line] = node_no (node);
+ 
+ 		if (edit_mode) {
+-			lines = draw_item (active_line, (int) input, node, drawmode_edit);
++			lines = draw_item (active_line, strlen(input) - 1,
++					   node, drawmode_edit);
+ 		} else {
+-			lines =
+-				draw_item (active_line, strlen (input), node,
+-						   drawmode_completion);
++			lines = draw_item (active_line, strlen (input), node,
++					   drawmode_completion);
+ 		}
+ 
+-/* draw items below current item */
++		/* draw items below current item */
+ 		{
+ 			Node *prev_up = node;	/* to aid pgup/pgdn */
+ 			Node *tnode = down (node, node);
+--- hnb-1.9.18.orig/src/ui_edit.c
++++ hnb-1.9.18/src/ui_edit.c
+@@ -28,7 +28,7 @@
+ #include "evilloop.h"
+ #include <stdlib.h>
+ 
+-static int ui_edit_cmd (int argc, char **argv, void *data)
++static void* ui_edit_cmd (int argc, char **argv, void *data)
+ {
+ 	Tbinding *c;
+ 	int stop = 0;
+@@ -48,7 +48,7 @@ static int ui_edit_cmd (int argc, char *
+ 	if(prefs.readonly){
+ 		cli_outfun("readonly flag set, avoiding tree change");
+ 		ui_current_scope = tempscope;
+-		return (int)data;
++		return data;
+ 	}
+ 
+ 	if (inputbuf[0]) {			/* there is data in the inputbuffer,.. 
+@@ -67,7 +67,7 @@ static int ui_edit_cmd (int argc, char *
+ 		}
+ 		ui_current_scope = tempscope;
+ 		docmd(pos,"tree_changed");
+-		return (int) pos;
++		return pos;
+ 	}
+ 
+ 	node_backup = node_duplicate (pos);
+@@ -81,7 +81,7 @@ static int ui_edit_cmd (int argc, char *
+ 
+ 	while (!stop) {
+ 		node_set (pos, TEXT, input);
+-		ui_draw (pos, (char *) cursor_pos, 1);
++		ui_draw (pos, input, 1);
+ 		c = parsekey (ui_input (), ui_scope_nodeedit);
+ 		switch (c->action) {
+ 			case ui_action_right:
+@@ -215,7 +215,7 @@ static int ui_edit_cmd (int argc, char *
+ 	}
+ 	node_free (node_backup);
+ 	ui_current_scope = tempscope;
+-	return (int) data;
++	return data;
+ }
+ 
+ int ui_getstr_loc (char *input, int x, int y, int maxlen)
+--- hnb-1.9.18.orig/src/ui_menu.c
++++ hnb-1.9.18/src/ui_menu.c
+@@ -109,10 +109,10 @@ static Node *menu_do(Node *pos){
+ 	return pos;
+ }
+ 
+-static int cmd_menu(int argc,char **argv,void *data){
++static void* cmd_menu(int argc,char **argv,void *data){
+ 	Node *pos=(Node *)data;
+ 	if(argc==1){ /* draw menu */
+-		return (int)menu_do(pos);
++		return menu_do(pos);
+ 	} else if(argc==4){
+ 		char *submenu=argv[1];
+ 		char *label=argv[2];
+@@ -142,7 +142,7 @@ static int cmd_menu(int argc,char **argv
+ 		if(menu[col][row].width>menu[col][0].width)
+ 			menu[col][0].width=menu[col][row].width;	
+ 	}
+-	return(int)pos;
++	return pos;
+ }
+ 
+ /*
+--- hnb-1.9.18.orig/src/ui_overlay.c
++++ hnb-1.9.18/src/ui_overlay.c
+@@ -44,11 +44,11 @@
+ 
+ static char *ui_helptext[MAX_SCOPES] = { 0 };
+ 
+-static int ui_helptext_cmd (int argc, char **argv, void *data)
++static void* ui_helptext_cmd (int argc, char **argv, void *data)
+ {
+ 	if(argc>1)
+ 		ui_helptext[ui_current_scope] = strdup (argv[1]);
+-	return (int) data;
++	return data;
+ }
+ 
+ #define MAX_STATUS_LINES 100
+@@ -129,7 +129,7 @@ void set_status (char *message)
+ }
+ 
+ 
+-static int ui_status_cmd (int argc, char **argv, void *data)
++static void* ui_status_cmd (int argc, char **argv, void *data)
+ {
+ 	if(argc==2 && (!strcmp(argv[1],"-c") || !strcmp(argv[1],"--clear"))){
+ 		status_ttl=0;
+@@ -138,7 +138,7 @@ static int ui_status_cmd (int argc, char
+ 		if(!ui_inited)
+ 		cli_outfun(argv[1]);
+ 	}
+-	return (int) data;
++	return data;
+ }
+ 
+ 
+--- hnb-1.9.18.orig/src/ui_style.c
++++ hnb-1.9.18/src/ui_style.c
+@@ -116,7 +116,7 @@ void ui_style_restore_color ()
+ 	}
+ }
+ 
+-static int ui_style_cmd (int argc, char **argv, void *data)
++static void* ui_style_cmd (int argc, char **argv, void *data)
+ {
+ 	char *item;
+ 	char *colors;
+@@ -124,7 +124,7 @@ static int ui_style_cmd (int argc, char 
+ 
+ 	if(argc!=4){
+ 		cli_outfunf("usage: %i <item> <fg/bg> <atts>");
+-		return (int)data;
++		return data;
+ 	}
+ 
+ 	item=argv[1];
+@@ -137,7 +137,7 @@ static int ui_style_cmd (int argc, char 
+ 
+ 		if (style_no == -1) {
+ 			printf ("unknown style 'style [%s] %s %s'\n", item, colors, atts);
+-			return (int) data;
++			return data;
+ 		}
+ 		color2 = strchr (colors, '/');
+ 		color2[0] = '\0';
+@@ -166,7 +166,7 @@ static int ui_style_cmd (int argc, char 
+ 			bkgdset (' ' + COLOR_PAIR (ui_style_background));
+ 		}
+ 	}
+-	return (int) data;
++	return data;
+ }
+ 
+ /*
--- hnb-1.9.18.orig/debian/patches/23_fix_spelling_errors_in_man_page.patch
+++ hnb-1.9.18/debian/patches/23_fix_spelling_errors_in_man_page.patch
@@ -0,0 +1,27 @@
+hnb (1.9.18-8)  * Fix spelling errors in man page.
+
+--- hnb-1.9.18.orig/doc/hnb.1
++++ hnb-1.9.18/doc/hnb.1
+@@ -31,7 +31,7 @@ Show version of program.
+ Load the tutorial instead of a database.
+ .TP
+ .B \-rc <\fIfile\fP>
+-Load an other config file than default.
++Load another config file than default.
+ .TP
+ .B \-ui <curses|cli>
+ Specify user interface to use.
+@@ -41,11 +41,11 @@ Run commands in noninteractive mode (sta
+ `help' to get more information).
+ .SH FILES
+ .IP ~/.hnb
+-The default file for your notes. To use an other, specify its name on
++The default file for your notes. To use another, specify its name on
+ the command line.
+ 
+ .IP ~/.hnbrc
+-The default configuration file. To load an other config file than default,
++The default configuration file. To load another config file than default,
+ use the \fB-rc\fP command-line option.
+ 
+ .SH SEE ALSO
--- hnb-1.9.18.orig/debian/patches/11_makefile_doc.patch
+++ hnb-1.9.18/debian/patches/11_makefile_doc.patch
@@ -0,0 +1,35 @@
+hnb (1.9.18-4)  * Add doc/Makefile.  It is used to generate the user
+                  documentation and can also be used to generate some
+                  graphs for developers.
+
+--- /dev/null
++++ hnb-1.9.18/doc/Makefile
+@@ -0,0 +1,28 @@
++#!/usr/bin/make -f
++
++.PHONY: all clean distclean doc doc-dev
++
++DOC = Documentation.html
++DOCDEV = xml_states.ps cli_tokenize.ps
++
++all: doc doc-dev
++xml_states.ps: ../src/xml.dot
++libcli/cli_tokenize.ps: ../src/libcli/cli_tokenize.dot
++
++doc: $(DOC)
++doc-dev: $(DOCDEV)
++
++clean:
++	$(RM) $(DOC)
++
++distclean: clean
++	$(RM) $(DOCDEV)
++
++%.ps:
++	dot -Tps $^ > $@
++
++%.html:
++	../src/hnb -rc /dev/null $(basename $@).hnb -e "go root" "export_htmlcss $@"
++
++%.txt:
++	../src/hnb -rc /dev/null $(basename $@).hnb -e "go root" "export_ascii $@"
--- hnb-1.9.18.orig/debian/patches/17_wrap_long_words.patch
+++ hnb-1.9.18/debian/patches/17_wrap_long_words.patch
@@ -0,0 +1,47 @@
+hnb (1.9.18-5)  * Wrap words that are longer than one line.  This patch has been
+                  written by Tomáš Janoušek <tomi@nomi.cz> in 2007.
+hnb (1.9.18-6)  * Fixed a character lost bug in word wrapping.  Thanks to Tomáš
+                  Janoušek for the patch.
+
+--- hnb.orig/src/ui_draw.c
++++ hnb/src/ui_draw.c
+@@ -157,6 +157,7 @@ static int draw_textblock (int line_star
+ 			case '\t':
+ 			case '\n':
+ 			case '\r':			/* all whitespace is treated as spaces */
++			wordwrap:
+ 				if (col + wpos + 1 >= col_end) {	/* reached margin */
+ 					if (drawmode == drawmode_edit) {
+ 						if (cursor_state == 0)
+@@ -196,8 +197,12 @@ static int draw_textblock (int line_star
+ 							addstr ((char *) word);
+ 
+ 						}
+-						if (data[dpos])
+-							addch (' ');
++						if (data[dpos]) {
++							if (isspace(data[dpos]))
++								addch (' ');
++							else
++								addch (data[dpos]);
++						}
+ 					}
+ 				}
+ 
+@@ -226,10 +231,12 @@ static int draw_textblock (int line_star
+ 				word[wpos = 0] = 0;
+ 				break;
+ 			default:
+-				if (wpos < 198) {
+-					word[wpos++] = data[dpos];
+-					word[wpos] = 0;
+-				}
++				if (col_start + wpos + 2 >= col_end)
++					goto wordwrap;
++
++				word[wpos++] = data[dpos];
++				word[wpos] = 0;
++
+ 				break;
+ 		}
+ 		dpos++;
--- hnb-1.9.18.orig/debian/patches/01_quotations_instead_of_quotes.patch
+++ hnb-1.9.18/debian/patches/01_quotations_instead_of_quotes.patch
@@ -0,0 +1,24 @@
+hnb (1.9.17-3)  * Use quotations instead of quotes.
+
+--- hnb-1.9.18.orig/doc/Documentation.hnb
++++ hnb-1.9.18/doc/Documentation.hnb
+@@ -329,7 +329,7 @@
+ 			</node>
+ 		</node>
+ 	</node>
+-	<node><data>quotes </data>
++	<node><data>quotations </data>
+ 		<node><data>Peoples Front To Reunite Gondwanaland: &quot;Stop the Laurasian Separatist Movement!&quot; </data></node>
+ 		<node><data>slashdot </data>
+ 			<node><data>disbelief </data>
+--- hnb-1.9.18.orig/src/tutorial.inc
++++ hnb-1.9.18/src/tutorial.inc
+@@ -189,7 +189,7 @@ i(0,"sample data",0);
+ 				i(4,"http://www.vg.no/",0);
+ 			i(3,"fark.com",0);
+ 				i(4,"http://www.fark.com/",0);
+-	i(1,"quotes ",0);
++	i(1,"quotations ",0);
+ 		i(2,"Peoples Front To Reunite Gondwanaland: \\Stop the Laurasian Separatist Movement!\\ ",0);
+ 		i(2,"slashdot ",0);
+ 			i(3,"disbelief ",0);