--- kgb-1.0b4+ds.orig/debian/rules
+++ kgb-1.0b4+ds/debian/rules
@@ -0,0 +1,72 @@
+#!/usr/bin/make -f
+
+#export DH_VERBOSE=1
+
+DEB_HOST_GNU_TYPE	?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
+DEB_BUILD_GNU_TYPE	?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
+
+CXXFLAGS += -Wall -fno-strict-aliasing -Wformat -Wformat-security -D_FORTIFY_SOURCE=2
+LDFLAGS += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
+
+ifneq (,$(filter noopt,$(DEB_BUILD_OPTIONS)))
+        CXXFLAGS += -O0
+else
+        CXXFLAGS += -O3
+endif
+
+# Enable IEEE-conformant floating point math on alphas (not the default)
+ifeq (alpha-linux-gnu,$(DEB_HOST_GNU_TYPE))
+	CXXFLAGS += -mieee
+endif
+
+CXXFLAGS += -g
+
+include /usr/share/quilt/quilt.make
+
+kgb: $(QUILT_STAMPFN)
+	dh_testdir
+	$(CXX) $(CXXFLAGS) $(LDFLAGS) -o kgb kgb_arch_posix_by_slawek.cpp
+	touch $@
+
+test: kgb
+	dh_testdir
+ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
+	sh debian/test.sh
+else
+	@echo 'Skipping test...'
+endif
+
+build: kgb test
+
+clean:  unpatch
+	dh_testdir
+	dh_testroot
+	$(RM) kgb
+	$(RM) -r test
+	dh_clean
+
+install: kgb
+	dh_testdir
+	dh_testroot
+	dh_installdirs
+	install -D -m 755 kgb debian/kgb/usr/bin/kgb
+
+binary-indep:
+
+binary-arch: install
+	dh_testdir
+	dh_testroot
+	dh_installchangelogs
+	dh_installdocs
+	dh_installman
+	dh_strip
+	dh_compress
+	dh_fixperms
+	dh_installdeb
+	dh_shlibdeps
+	dh_gencontrol
+	dh_md5sums
+	dh_builddeb
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install test
--- kgb-1.0b4+ds.orig/debian/watch
+++ kgb-1.0b4+ds/debian/watch
@@ -0,0 +1,3 @@
+version=3
+opts=dversionmangle=s/\+ds// \
+http://sf.net/kgbarchiver/kgb_arch_posix_by_slawek_v(.*)\.tar\.bz2
--- kgb-1.0b4+ds.orig/debian/compat
+++ kgb-1.0b4+ds/debian/compat
@@ -0,0 +1 @@
+5
--- kgb-1.0b4+ds.orig/debian/control
+++ kgb-1.0b4+ds/debian/control
@@ -0,0 +1,18 @@
+Source: kgb
+Section: utils
+Priority: optional
+Maintainer: Raphael Geissert <geissert@debian.org>
+Build-Depends: debhelper (>= 5), quilt (>= 0.40)
+Standards-Version: 3.8.4
+Homepage: http://kgbarchiver.sourceforge.net/
+
+Package: kgb
+Architecture: i386 sh4 sparc s390 powerpc mips mipsel m68k ia64 amd64 armel armhf alpha kfreebsd-i386 kfreebsd-amd64 hurd-i386 hppa
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Description: Archiver for .kgb files
+ This is an archiver (compressor/decompressor) for files in the KGB format,
+ which provides high compression rates at the expense of memory and CPU time.
+ .
+ This package contains the KGB archiver based on the
+ PAQ6 archiver by Matt Mahoney.
+
--- kgb-1.0b4+ds.orig/debian/manpages
+++ kgb-1.0b4+ds/debian/manpages
@@ -0,0 +1 @@
+debian/additions/kgb.1
--- kgb-1.0b4+ds.orig/debian/changelog
+++ kgb-1.0b4+ds/debian/changelog
@@ -0,0 +1,156 @@
+kgb (1.0b4+ds-13.5.201411011603) ucs4-0-0-0; urgency=low
+
+  * UCS auto build. The following patches have been applied to the original source package
+    0001-bump-version-for-ucs400
+
+ -- Univention builddaemon <buildd@univention.de>  Sat, 01 Nov 2014 16:03:08 +0100
+
+kgb (1.0b4+ds-13) unstable; urgency=low
+
+  * Bump version, otherwise the build stamp in UCS 3.2 is higher than the 4.0
+    build (Bug #35387)
+
+ -- Sönke Schwardt-Krummrich <schwardt@univention.de>  Fri, 30 Oct 2014 14:43:23 +0200
+
+kgb (1.0b4+ds-13.2) unstable; urgency=low
+
+  * Non-maintainer upload.
+  * Fix "ftbfs with GCC-4.7": add patch gcc-4.7.patch (missing include).
+    (Closes: #667226)
+
+ -- gregor herrmann <gregoa@debian.org>  Sun, 06 May 2012 16:57:27 +0200
+
+kgb (1.0b4+ds-13.1) unstable; urgency=low
+
+  * NMU, added armhf to arch list. (Closes: #604533) 
+
+ -- Hector Oron <zumbi@debian.org>  Sat, 05 Mar 2011 06:22:23 +0000
+
+kgb (1.0b4+ds-13) unstable; urgency=low
+
+  * debian/control:
+    + Add sh4 to the architectures list.  Thanks Nobuhiro Iwamatsu for
+      the test build. (Closes: #568963)
+  * bad_strings.patch: fix typo (Closes: #578031)
+
+ -- Raphael Geissert <geissert@debian.org>  Sat, 24 Apr 2010 10:16:26 -0500
+
+kgb (1.0b4+ds-12) unstable; urgency=low
+
+  * debian/control:
+    + Drop DM-UA field.
+    + Bump standards version to 3.8.4, no changes needed.
+    + Update my email address.
+    + Drop useless suggests on unrar and unzip.
+  * debian/rules:
+    + General cleanup.
+  * debian/test.sh:
+    + General cleanup.
+
+ -- Raphael Geissert <geissert@debian.org>  Fri, 29 Jan 2010 01:12:00 -0600
+
+kgb (1.0b4+ds-11) unstable; urgency=low
+
+  * Dropped, now useless, build-dependency on tofrodos
+    + Allows package to be built on hurd-i386
+  * Strip '+ds' in watch file
+
+ -- Raphael Geissert <atomo64@gmail.com>  Fri, 20 Jun 2008 17:35:21 -0500
+
+kgb (1.0b4+ds-10) unstable; urgency=low
+
+  * Repackaged the tarball
+    + Removed .exe file from it
+    + Converted .cpp to Unix end of lines (Closes: #485151)
+  * Refreshed all patches (using the same naming convention on all of them)
+    + Also renamed some to be more meaningful
+  * Bumped to Standards-Version 3.8.0
+    + Use find instead of findstring to parse DEB_BUILD_OPTS
+
+ -- Raphael Geissert <atomo64@gmail.com>  Fri, 20 Jun 2008 15:50:03 -0500
+
+kgb (1.0b4-9) unstable; urgency=medium
+
+  * The "one says it builds, but buildd's don't" anti-arm upload.
+    + Not building in arm anymore
+
+ -- Raphael Geissert <atomo64@gmail.com>  Sun, 01 Jun 2008 20:33:42 -0500
+
+kgb (1.0b4-8) unstable; urgency=medium
+
+  * debian/patches/packed.patch: use the packed attribute when building for arm.
+    + Finally fixes issues when building in arm.
+  * debian/test.sh: add another test with a hardcoded md5sum to make sure
+    binary compatibility of the compressed files is preserved
+    among the different arch builds.
+  * debian/rules: minor tweaks
+  * Refreshed patches 
+
+ -- Raphael Geissert <atomo64@gmail.com>  Mon, 28 Apr 2008 16:35:49 -0500
+
+kgb (1.0b4-7) unstable; urgency=medium
+
+  * debian/patches/32bits.diff: Make kgb !32bits builds-capable
+    + Fixes FTBFS: cc1plus: error: unrecognized command line option "-m32"
+    (Closes: #474723)
+  * debian/copyright: add packaging copyright and licence
+
+ -- Raphael Geissert <atomo64@gmail.com>  Tue, 08 Apr 2008 18:10:36 -0500
+
+kgb (1.0b4-6) unstable; urgency=medium
+
+  * patches/bad_strings.patch: Make prompts easier to understand
+     (Closes: #471018)
+  * kgb.1: Correct typos and bad wording (Closes: #471017)
+     Thanks to "A. Costa <agcosta@gis.net>"
+  * Remove double space in package description, thanks to Cyril Brulebois
+  * LFS support:
+    + Make sure it is compiled with the LFS flags
+    + Replaced some long int stuff with long long ones (Closes: #473074)
+  * debian/test.sh: add a simple test suite to be run at the build target
+  * debian/control: Build-Depend on g++-multilib
+    + Not building 64bits bins as the code is designed for 32bits archs
+      - Previous !32bits builds are broken, hence the urgency
+
+ -- Raphael Geissert <atomo64@gmail.com>  Sun, 06 Apr 2008 21:05:38 -0500
+
+kgb (1.0b4-5) unstable; urgency=low
+
+  * Bumped to standards version 3.7.3: no change needed.
+  * patches/missing_include.patch: added missing #include <cstring>
+     Closes: #455290
+  * Converted all the patches to LN EOL,
+     and made debian/rules convert the source EOL's.
+     All this to fix an EOL's mess
+  * debian/control: Added XS-DM-Upload-Allowed: yes
+
+ -- Raphael Geissert <atomo64@gmail.com>  Thu, 10 Jan 2008 16:39:26 -0600
+
+kgb (1.0b4-4) unstable; urgency=low
+
+  * Homepage now used as a control entry
+  * Improved the package description by making it meaningful (Closes: #452358)
+
+ -- Raphael Geissert <atomo64@gmail.com>  Thu, 22 Nov 2007 20:31:31 -0600
+
+kgb (1.0b4-3) unstable; urgency=low
+
+  * Satisfy Suggests on m68k (unrar not available)
+  * Made it DEB_BUILD_OPTIONS=noopt aware
+  * -O3 is now used by default
+  * README file is no longer installed
+  * Replaced Website with Homepage in package description
+
+ -- Raphael Geissert <atomo64@gmail.com>  Fri, 14 Sep 2007 15:32:30 -0500
+
+kgb (1.0b4-2) unstable; urgency=medium
+
+  * Fixed cast from 'char*' to 'int' (Closes: #432734)
+
+ -- Raphael Geissert <atomo64@gmail.com>  Wed, 11 Jul 2007 13:23:18 -0500
+
+kgb (1.0b4-1) unstable; urgency=low
+
+  * Initial release (Closes: #428317)
+
+ -- Raphael Geissert <atomo64@gmail.com>  Wed, 01 Nov 2006 19:21:42 -0500
--- kgb-1.0b4+ds.orig/debian/test.sh
+++ kgb-1.0b4+ds/debian/test.sh
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+set -exv
+
+dh_testdir
+
+[ -d test ] || mkdir test
+md5sum kgb > test/sum
+
+[ ! -f test/test.kgb ] || rm -f test/test.kgb
+
+./kgb test/test.kgb test/sum
+mv test/sum test/sum.orig
+./kgb test/test.kgb
+[ "$(cat test/sum)" = "$(cat test/sum.orig)" ]
+
+[ ! -f test/gpl.kgb ] || rm -f test/gpl.kgb
+./kgb test/gpl.kgb gpl.txt
+[ "$(md5sum test/gpl.kgb)" = "258f3cdf0cf69827c888d25948eb4486  test/gpl.kgb" ]
--- kgb-1.0b4+ds.orig/debian/copyright
+++ kgb-1.0b4+ds/debian/copyright
@@ -0,0 +1,24 @@
+This package was debianized by Raphael Geissert <atomo64@gmail.com> on
+Wed, 01 Nov 2006 19:21:42 -0500.
+
+It was downloaded from: http://kgbarchiver.sourceforge.net/
+
+Upstream author: Tomasz Pawlak <tomekp17@gmail.com>
+Modifications by: Slawek (poczta-sn@gazeta.pl)
+Based on PAQ6 by Matt Mahoney <mmahoney@cs.fit.edu>
+
+
+This software is copyright (c) 2004 by Matt Mahoney.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License version 2 as
+published by the Free Software Foundation at
+http://www.gnu.org/licenses/gpl.txt or (at your option) any later version.
+This program is distributed without any warranty.
+
+On Debian systems, the complete text of the GNU General Public
+License can be found in the file `/usr/share/common-licenses/GPL-2'.
+
+The Debian packaging is Copyright (C) 2006, 2007, 2008, 
+by Raphael Geissert <atomo64@gmail.com> and is available under the terms of the
+GNU General Public License version 2 or (at your option) any later version.
--- kgb-1.0b4+ds.orig/debian/patches/lfs.patch
+++ kgb-1.0b4+ds/debian/patches/lfs.patch
@@ -0,0 +1,100 @@
+Index: kgb-arch-posix-by-slawek_1.0b4+ds/kgb_arch_posix_by_slawek.cpp
+===================================================================
+--- kgb-arch-posix-by-slawek_1.0b4+ds.orig/kgb_arch_posix_by_slawek.cpp
++++ kgb-arch-posix-by-slawek_1.0b4+ds/kgb_arch_posix_by_slawek.cpp
+@@ -575,6 +575,8 @@ Also, give yourself credit in the help m
+ #include <vector>
+ #include <algorithm>
+ #include <map>
++#include <sys/stat.h>
++#include <fcntl.h>
+ #undef hash
+ using namespace std;
+ 
+@@ -2210,7 +2212,7 @@ int _mode = 0;
+ 
+   // File names and sizes from input or archive
+   vector<string> filename; // List of names
+-  vector<long> filesize;   // Size or -1 if error
++  vector<long long> filesize;   // Size or -1 if error
+   int uncompressed_bytes=0, compressed_bytes=0;  // Input, output sizes
+ 
+   // Extract files
+@@ -2265,11 +2267,11 @@ int _mode = 0;
+     // Extract files from archive data
+     Transformer e(DECOMPRESS, archive);
+     for (int i=0; i<int(filename.size()); ++i) {
+-      printf("%10ldKB %s: ", filesize[i]/1024, filename[i].c_str());
++      printf("%10lldKB %s: ", filesize[i]/1024, filename[i].c_str());
+ 
+       // Compare with existing file
+       FILE* f=fopen(filename[i].c_str(), "rb");
+-      const long size=filesize[i];
++      const long long size=filesize[i];
+       uncompressed_bytes+=size;
+       if (f) {
+         bool different=false;
+@@ -2391,16 +2393,21 @@ int _mode = 0;
+ 
+     // Get file sizes
+     for (int i=0; i<int(filename.size()); ++i) {
+-      FILE* f=fopen(filename[i].c_str(), "rb");
++      int f=open64(filename[i].c_str(), O_RDONLY);
+       if (!f) {
+         printf("File not found, skipping: %s\n",
+           filename[i].c_str());
+         filesize.push_back(-1);
+       }
+       else {
+-        fseek(f, 0L, SEEK_END);
+-        filesize.push_back(ftell(f));
+-        fclose(f);
++        struct stat64 finfo;
++
++        if (fstat64(f, &finfo) != 0)
++          perror("fstat64() error");
++        else
++        filesize.push_back(finfo.st_size);
++
++        close(f);
+       }
+     }
+     if (filesize.empty() || *max_element(filesize.begin(), filesize.end())<0){
+@@ -2417,7 +2424,7 @@ int _mode = 0;
+     fprintf(archive, PROGNAME " -%d\r\n", MEM);
+     for (int i=0; i<int(filename.size()); ++i) {
+       if (filesize[i]>=0)
+-        fprintf(archive, "%ld\t%s\r\n", filesize[i], filename[i].c_str());
++        fprintf(archive, "%lld\t%s\r\n", filesize[i], filename[i].c_str());
+     }
+     putc(032, archive);  // MSDOS EOF
+     putc('\f', archive);
+@@ -2425,15 +2432,15 @@ int _mode = 0;
+ 
+     // Write data
+     Transformer e(COMPRESS, archive);
+-    long file_start=ftell(archive);
++    long long file_start=ftell(archive);
+     for (int i=0; i<int(filename.size()); ++i) {
+-      const long size=filesize[i];
++      const long long size=filesize[i];
+       if (size>=0) {
+         uncompressed_bytes+=size;
+-        printf("%-23s %10ldKB -> ", filename[i].c_str(), size/1024);
++        printf("%-23s %10lldKB -> ", filename[i].c_str(), size/1024);
+         FILE* f=fopen(filename[i].c_str(), "rb");
+         int c;
+-        for (long j=0; j<size; ++j) {
++        for (long long j=0; j<size; ++j) {
+           if (f)
+             c=getc(f);
+           else
+@@ -2442,7 +2449,7 @@ int _mode = 0;
+         }
+         if (f)
+           fclose(f);
+-        printf("%ldKB\n", (ftell(archive)-file_start)/1024);
++        printf("%lldKB\n", (ftell(archive)-file_start)/1024);
+         file_start=ftell(archive);
+       }
+     }
--- kgb-1.0b4+ds.orig/debian/patches/usage_info.patch
+++ kgb-1.0b4+ds/debian/patches/usage_info.patch
@@ -0,0 +1,17 @@
+Index: kgb-arch-posix-by-slawek_1.0b4+ds/kgb_arch_posix_by_slawek.cpp
+===================================================================
+--- kgb-arch-posix-by-slawek_1.0b4+ds.orig/kgb_arch_posix_by_slawek.cpp
++++ kgb-arch-posix-by-slawek_1.0b4+ds/kgb_arch_posix_by_slawek.cpp
+@@ -2178,9 +2178,9 @@ int _mode = 0;
+   // Check arguments
+   if (argc<2) {
+       printf("KGB Archiver v1.0, (C) 2005-2006 Tomasz Pawlak\nBased on PAQ6 by Matt Mahoney\nmod by Slawek (poczta-sn@gazeta.pl)\n\n"
+-      "Compression:\t\tkgb_arch.exe -<m> archive.kgb files <@list_files>\n"
+-      "Decompression:\t\tkgb_arch.exe archive.kgb\n"
+-      "Table of contests:\tmore < archive.kgb\n\n"
++      "Compression:\t\tkgb -<m> archive.kgb files <@files_list>\n"
++      "Decompression:\t\tkgb archive.kgb\n"
++      "Table of contents:\tmore < archive.kgb\n\n"
+       "m argument\tmemory usage\n"
+       "----------\t------------------------------\n"
+       " -0       \t 2 MB (the fastest compression)\n"
--- kgb-1.0b4+ds.orig/debian/patches/32bits.patch
+++ kgb-1.0b4+ds/debian/patches/32bits.patch
@@ -0,0 +1,34 @@
+Index: kgb-arch-posix-by-slawek_1.0b4+ds/kgb_arch_posix_by_slawek.cpp
+===================================================================
+--- kgb-arch-posix-by-slawek_1.0b4+ds.orig/kgb_arch_posix_by_slawek.cpp
++++ kgb-arch-posix-by-slawek_1.0b4+ds/kgb_arch_posix_by_slawek.cpp
+@@ -570,6 +570,7 @@ Also, give yourself credit in the help m
+ #include <cmath>
+ #include <ctime>
+ #include <cassert>
++#include <stdint.h>
+ #include <new>
+ #include <string>
+ #include <vector>
+@@ -580,15 +581,17 @@ Also, give yourself credit in the help m
+ #undef hash
+ using namespace std;
+ 
++typedef int int32_t;
++
+ const int PSCALE=4096;  // Integer scale for representing probabilities
+ int MEM=3;        // Use about 6 MB * 2^MEM bytes of memory                      
+ 
+ template <class T> inline int size(const T& t) {return t.size();}
+ 
+-// 8-32 bit unsigned types, adjust as appropriate
+-typedef unsigned char U8;
+-typedef unsigned short U16;
+-typedef unsigned long U32;
++// 8-32 bit unsigned types
++typedef uint8_t U8;
++typedef uint16_t U16;
++typedef uint32_t U32;
+ 
+ // Fail if out of memory
+ void handler() {
--- kgb-1.0b4+ds.orig/debian/patches/bad_strings.patch
+++ kgb-1.0b4+ds/debian/patches/bad_strings.patch
@@ -0,0 +1,40 @@
+Index: kgb-1.0b4+ds-12/kgb_arch_posix_by_slawek.cpp
+===================================================================
+--- kgb-1.0b4+ds-12.orig/kgb_arch_posix_by_slawek.cpp
++++ kgb-1.0b4+ds-12/kgb_arch_posix_by_slawek.cpp
+@@ -2187,7 +2187,7 @@ int _mode = 0;
+       " -0       \t 2 MB (the fastest compression)\n"
+       " -1       \t 3 MB\n"
+       " -2       \t 6 MB\n"
+-      " -3       \t 18 MB (dafault)\n"
++      " -3       \t 18 MB (default)\n"
+       " -4       \t 64 MB\n"
+       " -5       \t 154 MB\n"
+       " -6       \t 202 MB\n"
+@@ -2341,7 +2341,7 @@ int _mode = 0;
+                   fname+=argv[i][a];
+                File=fopen(fname.c_str(),"r");
+                if(!File) {
+-                  printf("Cannot find directive file %s.\n",fname.c_str());
++                  printf("Cannot find listing file %s.\n",fname.c_str());
+                   continue;
+                }
+                else {
+@@ -2364,7 +2364,7 @@ int _mode = 0;
+                         }
+                      }
+                      else {
+-                        printf("The file %s is not valid directive file%d.\n",fname.c_str(),fchar);
++                        printf("The file %s is not valid listing file%d.\n",fname.c_str(),fchar);
+                         break;
+                      }
+                   }
+@@ -2379,7 +2379,7 @@ int _mode = 0;
+         }
+     else {
+       printf(
+-        "Type filenames to compression, finish empty line:\n");
++        "Type filenames to compress, finish with empty line:\n");
+       while (true) {
+         string s=getline(stdin);
+         if (s=="")
--- kgb-1.0b4+ds.orig/debian/patches/series
+++ kgb-1.0b4+ds/debian/patches/series
@@ -0,0 +1,8 @@
+char2int.patch
+usage_info.patch
+missing_cstring_include.patch
+signed2uint.patch
+bad_strings.patch
+lfs.patch
+32bits.patch
+gcc-4.7.patch
--- kgb-1.0b4+ds.orig/debian/patches/gcc-4.7.patch
+++ kgb-1.0b4+ds/debian/patches/gcc-4.7.patch
@@ -0,0 +1,10 @@
+--- a/kgb_arch_posix_by_slawek.cpp
++++ b/kgb_arch_posix_by_slawek.cpp
+@@ -578,6 +578,7 @@
+ #include <map>
+ #include <sys/stat.h>
+ #include <fcntl.h>
++#include <unistd.h>
+ #undef hash
+ using namespace std;
+ 
--- kgb-1.0b4+ds.orig/debian/patches/signed2uint.patch
+++ kgb-1.0b4+ds/debian/patches/signed2uint.patch
@@ -0,0 +1,13 @@
+Index: kgb-arch-posix-by-slawek_1.0b4+ds/kgb_arch_posix_by_slawek.cpp
+===================================================================
+--- kgb-arch-posix-by-slawek_1.0b4+ds.orig/kgb_arch_posix_by_slawek.cpp
++++ kgb-arch-posix-by-slawek_1.0b4+ds/kgb_arch_posix_by_slawek.cpp
+@@ -2337,7 +2337,7 @@ int _mode = 0;
+             string fname=""; FILE* File;
+             File=fopen(argv[i],"r");
+             if(!File) {//checks if file @sth.ext does not exist
+-               for(int a=1; a<strlen(argv[i]); a++)
++               for(uint a=1; a<strlen(argv[i]); a++)
+                   fname+=argv[i][a];
+                File=fopen(fname.c_str(),"r");
+                if(!File) {
--- kgb-1.0b4+ds.orig/debian/patches/char2int.patch
+++ kgb-1.0b4+ds/debian/patches/char2int.patch
@@ -0,0 +1,13 @@
+Index: kgb-arch-posix-by-slawek_1.0b4+ds/kgb_arch_posix_by_slawek.cpp
+===================================================================
+--- kgb-arch-posix-by-slawek_1.0b4+ds.orig/kgb_arch_posix_by_slawek.cpp
++++ kgb-arch-posix-by-slawek_1.0b4+ds/kgb_arch_posix_by_slawek.cpp
+@@ -1122,7 +1122,7 @@ Hashtable<T>::Hashtable(U32 n): N(n>4?n-
+   char *p=(char*)calloc((16<<N)+64, 1);
+   if (!p)
+     handler();
+-  p+=64-(((int)p)&63);  // Aligned
++  p+=64-(((long)p)&63);  // Aligned
+   table=(HashElement*)p;
+ }
+ 
--- kgb-1.0b4+ds.orig/debian/patches/missing_cstring_include.patch
+++ kgb-1.0b4+ds/debian/patches/missing_cstring_include.patch
@@ -0,0 +1,12 @@
+Index: kgb-arch-posix-by-slawek_1.0b4+ds/kgb_arch_posix_by_slawek.cpp
+===================================================================
+--- kgb-arch-posix-by-slawek_1.0b4+ds.orig/kgb_arch_posix_by_slawek.cpp
++++ kgb-arch-posix-by-slawek_1.0b4+ds/kgb_arch_posix_by_slawek.cpp
+@@ -565,6 +565,7 @@ Also, give yourself credit in the help m
+ #define hash ___hash  // To avoid Digital MARS name collision
+ #include <cstdio>
+ #include <cstdlib>
++#include <cstring>
+ #include <cctype>
+ #include <cmath>
+ #include <ctime>
--- kgb-1.0b4+ds.orig/debian/additions/kgb.1
+++ kgb-1.0b4+ds/debian/additions/kgb.1
@@ -0,0 +1,66 @@
+.\" Author: Raphael Geissert <atomo64@gmail.com>
+.\" Copyright (C) 2007, 2008 Raphael Geissert <atomo64@gmail.com>
+.\"
+.\" This is free software; you may redistribute it and/or modify
+.\" it under the terms of the GNU General Public License as
+.\" published by the Free Software Foundation; either version 2,
+.\" or (at your option) any later version.
+.\"
+.\" This 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 the Debian GNU/Linux system; if not, write to the Free
+.\" Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+.\" 02111-1307 USA
+.TH kgb "1" "March 2008"
+.SH NAME
+kgb \- .kgb files archiver
+.SH SYNOPSIS
+kgb [-<m>] archive.kgb [filename  ...] [@files_listing @...]
+.PP
+kgb FILE.kgb
+.SH DESCRIPTION
+.B kgb
+is a file archiver with high-compression rates (and high CPU and memory cost).
+.SH OPTIONS
+.SS Compressing:
+.TP
+.B  \-<m>  
+Set compression level (memory usage), values:
+   0: 2 MB (fastest)
+   1: 3 MB
+   2: 6 MB
+   3: 18 MB (default)
+   4: 64 MB
+   5: 154 MB
+   6: 202 MB
+   7: 404 MB
+   8: 808 MB
+   9:
+.B 1616 MB
+(best compression)
+.TP
+.B  archive.kgb  
+Filename of the new KGB archive. It must
+.B not
+exist, otherwise it will fail.
+.TP
+.B  [filename ...]   
+File or list of files to compress.
+.TP
+.B  [@files_listing @...]
+File(s) containing a list of file names to be compressed, separated by a new line.
+.SS Uncompressing:
+.B FILE.kgb
+ KGB archive to extract.
+.SH AUTHOR
+.TP
+KGB Archiver v1.0b4, (C) 2005\-2006 Tomasz Pawlak; Based on PAQ6 by Matt Mahoney; mod by Slawek <poczta-sn@gazeta.pl>.
+.PP
+This manual page was written by Raphael Geissert
+.nh
+<atomo64@gmail.com> 
+for the \fBDebian\fP system (but may be used by others).
