--- barcode-0.98+debian.orig/debian/copyright
+++ barcode-0.98+debian/debian/copyright
@@ -0,0 +1,42 @@
+Author: Alessandro Rubini <rubini@gnu.org>
+Download: http://ftp.gnu.org/gnu/barcode/
+
+Files: *
+Copyright: (C) 1999-2006 Alessandro Rubini <rubini@gnu.org>
+License: GPL-2+
+ 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
+ can be found in /usr/share/common-licenses/GPL-2 file.
+
+Files: debian/*
+Copyright: 2007-2009 Daniel Baumann <daniel@debian.org>
+License: GPL-2+
+ 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
+ can be found in /usr/share/common-licenses/GPL-2 file.
--- barcode-0.98+debian.orig/debian/changelog
+++ barcode-0.98+debian/debian/changelog
@@ -0,0 +1,223 @@
+barcode (0.98+debian-9.4.201403141045) ucs4-0-0-0; urgency=low
+
+  * UCS auto build. No patches were applied to the original source package
+
+ -- Univention builddaemon <buildd@univention.de>  Fri, 14 Mar 2014 10:45:56 +0100
+
+barcode (0.98+debian-9) unstable; urgency=low
+
+  * New maintainer. (Closes: #540584: O: barcode -- Utility and library
+    for barcode generation)
+  * Updated standards-version to 3.8.4
+  * Added README.source
+
+ -- Matti Pöllä <mpo@iki.fi>  Tue, 09 Mar 2010 23:22:36 +0200
+
+barcode (0.98+debian-8) unstable; urgency=low
+
+  * Removing vcs fields.
+  * Orphaning package.
+
+ -- Daniel Baumann <daniel@debian.org>  Sun, 09 Aug 2009 01:25:50 +0200
+
+barcode (0.98+debian-7) unstable; urgency=low
+
+  * Correcting indenting in copyright file.
+  * Updatingto debhelper 7.
+  * Updating to standards 3.8.0.
+  * Updating vcs fields in control file.
+  * Using patch-stamp rather than patch in rules file.
+  * Replacing obsolete dh_clean -k with dh_prep.
+  * Updating section of the debug package.
+  * Updating rules to current state of the art.
+  * Using correct rfc-2822 date formats in changelog.
+  * Updating package to standards version 3.8.2.
+  * Prefxing debhelper files with package name.
+  * Updating year in copyright file.
+  * Using quilt rather than dpatch.
+  * Adding patch to add header to info page (Closes: #528867).
+
+ -- Daniel Baumann <daniel@debian.org>  Fri, 17 Jul 2009 00:11:29 +0200
+
+barcode (0.98+debian-6) unstable; urgency=low
+
+  * Reordering compiler flags in configure call.
+  * Adding debug package.
+
+ -- Daniel Baumann <daniel@debian.org>  Thu, 17 Apr 2008 00:22:00 +0200
+
+barcode (0.98+debian-5) unstable; urgency=medium
+
+  * Enabling 04-manpage.dpatch.
+  * Removing watch file.
+  * Reordering rules file.
+  * Rewriting copyright file in machine-interpretable format.
+  * Adding vcs fields in control file.
+  * Updating package to debhelper 6.
+  * Removing config.guess and config.sub from debian branch.
+
+ -- Daniel Baumann <daniel@debian.org>  Wed, 16 Apr 2008 14:26:00 +0200
+
+barcode (0.98+debian-4) unstable; urgency=low
+
+  * Bumped to new policy.
+  * Using new homepage field in control.
+  * Don't hide make errors in clean target of rules.
+
+ -- Daniel Baumann <daniel@debian.org>  Thu, 27 Dec 2007 08:01:00 +0100
+
+barcode (0.98+debian-3) unstable; urgency=low
+
+  * doc/manpager seems to need gawk to produce proper manpages
+    (Closes: #436523).
+
+ -- Daniel Baumann <daniel@debian.org>  Tue, 14 Aug 2007 14:30:00 +0200
+
+barcode (0.98+debian-2) unstable; urgency=low
+
+  * Added patch from Chris Howie <crazycomputers@yahoo.com> to fix wrong
+    codabar implementation in barcode (Closes: #320908).
+  * Added patch from Paolo <oopla@users.sf.net> to fix oversized images
+    (Closes: #320908).
+
+ -- Daniel Baumann <daniel@debian.org>  Sat, 14 Apr 2007 17:15:00 +0200
+
+barcode (0.98+debian-1) unstable; urgency=low
+
+  * New maintainer (Closes: #358454).
+  * Rebuild upstream tarball without debian directory.
+  * Redone debian packaging from scratch.
+
+ -- Daniel Baumann <daniel@debian.org>  Sat, 07 Apr 2007 13:10:00 +0200
+
+barcode (0.98-4) unstable; urgency=low
+
+  * QA upload. Switch to debhelper and do some cleanup (Closes: #372966).
+
+ -- Santiago Vila <sanvila@debian.org>  Thu, 05 Apr 2007 14:40:52 +0200
+
+barcode (0.98-3) unstable; urgency=low
+
+  * QA upload.
+  * Set maintainer address to QA group.
+
+ -- Nico Golde <nion@debian.org>  Wed, 21 Mar 2007 16:00:07 +0100
+
+barcode (0.98-2) unstable; urgency=low
+
+  * Fix Build dependency on libpaperg-dev (Closes: #346400).
+  * Fix manpage (Closes: #356932).
+  * Fix upstream location (Closes: #279600).
+  * Fix copyright (Closes: #290070).
+  * Fix spelling (Closes: #363174).
+
+ -- Jim Westveer <jwest@netnw.com>  Wed, 19 Apr 2006 00:15:47 +0100
+
+barcode (0.98-1.2) unstable; urgency=low
+
+  * Non-maintainer upload.
+  * Fix manpage (Closes: #356932).
+
+ -- Luk Claes <luk@debian.org>  Wed, 15 Mar 2006 00:15:47 +0100
+
+barcode (0.98-1.1) unstable; urgency=high
+
+  * Non-maintainer upload.
+  * Change build dependency on libpaperg-dev to libpaper-dev (Closes: #346400)
+
+ -- Luk Claes <luk@debian.org>  Sun, 22 Jan 2006 18:29:32 +0100
+
+barcode (0.98-1) unstable; urgency=low
+
+  * New upstream release. Closes #140931
+  * Yes the man page is messy, use info instead.
+
+ -- Jim Westveer (jwest) <jwest@netnw.com>  Thu, 04 Apr 2002 20:04:09 -0800
+
+barcode (0.97-2) unstable; urgency=low
+
+  * Fix spelling error in control file. Closes: #124437
+
+ -- Jim Westveer <jwest@netnw.com>  Sat, 17 Feb 2002 18:14:35 -0800
+
+barcode (0.97-1) unstable; urgency=low
+
+  * New upstream release. Closes: #133401
+
+ -- Jim Westveer <jwest@netnw.com>  Sat, 16 Feb 2002 09:14:35 -0800
+
+barcode (0.95.1-4) stable unstable; urgency=low
+
+  * fixed package error (nop).  Closes: #70200
+  * uploaded to unstable, as stable update was rejected for some stupid reason
+
+ -- Jim Westveer <jwest@netnw.com>  Tue, 13 Nov 2000 08:30:00 -0700
+
+barcode (0.95.1-3) stable; urgency=low
+
+  * fixed package error. .orig.tar.gz was not being uploaded
+
+ -- Jim Westveer <jwest@netnw.com>  Tue, 22 Aug 2000 08:30:00 -0700
+
+barcode (0.95.1-2) unstable; urgency=low
+
+  * fixed package error. Closes: #69329
+
+ -- Jim Westveer <jwest@netnw.com>  Sun, 22 Jul 2000 07:30:00 -0700
+
+barcode (0.95.1-1) unstable; urgency=low
+
+  * New upstream version 0.95.1
+  * patch to 0.95.1 in main.c (stricmp)
+    to fix compile error.
+  * 0.95.1 fixes errors found in 0.94 about ymargin1 = y * unit
+
+ -- Jim Westveer <jwest@netnw.com>  Sun, 28 May 2000 07:30:00 -0700
+
+barcode (0.95-1) unstable; urgency=low
+
+  * New upstream version 0.95
+
+ -- Jim Westveer <jwest@netnw.com>  Sun, 28 May 2000 07:00:00 -0700
+
+barcode (0.94-1) unstable; urgency=low
+
+  * New upstream version 0.94
+
+ -- Jim Westveer <jwest@netnw.com>  Tue, 02 Sep 1999 19:00:00 -0700
+
+barcode (0.93-1) unstable; urgency=low
+
+  * New upstream version 0.93
+
+ -- Jim Westveer <jwest@netnw.com>  Mon, 27 Sep 1999 19:05:11 -0700
+
+barcode (0.92-2) unstable; urgency=low
+
+  * Changed line 434 of main.c fixixing xmargin Closes: #45112
+
+ -- Jim Westveer <jwest@netnw.com>  Mon, 19 Sep 1999 19:05:11 -0700
+
+barcode (0.92-1) unstable; urgency=low
+
+  * new upstream version
+  * libbarcode.a installs correctly.
+  * sources are pristine.
+  * gnupg signed
+
+ -- Jim Westveer <jwest@netnw.com>  Mon, 13 Sep 1999 09:05:11 -0700
+
+barcode (0.91.4-2) unstable; urgency=low
+
+  * Changed Architecture: field to 'any'. Closes: #44992
+
+ -- Jim Westveer <jwest@netnw.com>  Wed, 01 Sep 1999 10:55:11 -0700
+
+barcode (0.91.4-1) unstable; urgency=low
+
+  * Initial release.
+  * Only changes were to Makefile.
+  * only uploaded to arch i386, as I have not tested on other archs.
+  * cant seem to get libbarcode.a to go into /usr/lib ... still working on it.
+
+ -- Jim Westveer <jwest@netnw.com>  Thu, 26 Aug 1999 10:55:11 -0700
--- barcode-0.98+debian.orig/debian/compat
+++ barcode-0.98+debian/debian/compat
@@ -0,0 +1 @@
+7
--- barcode-0.98+debian.orig/debian/rules
+++ barcode-0.98+debian/debian/rules
@@ -0,0 +1,71 @@
+#!/usr/bin/make -f
+
+include /usr/share/quilt/quilt.make
+
+DEB_HOST_GNU_TYPE	?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
+DEB_BUILD_GNU_TYPE	?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
+
+CFLAGS += -DHAVE_STRCASECMP
+
+ifneq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE))
+	CROSS=CC=$(DEB_HOST_GNU_TYPE)-gcc
+else
+	CROSS=
+endif
+
+clean: unpatch
+	dh_testdir
+	dh_testroot
+	rm -f build-stamp
+	rm -f config.guess config.sub
+
+	[ ! -f Makefile ] || $(MAKE) distclean
+
+	dh_clean
+
+config.status: configure patch
+	dh_testdir
+
+ifneq "$(wildcard /usr/share/misc/config.guess)" ""
+	cp -f /usr/share/misc/config.guess config.guess
+endif
+ifneq "$(wildcard /usr/share/misc/config.sub)" ""
+	cp -f /usr/share/misc/config.sub config.sub
+endif
+
+	CFLAGS="$(CFLAGS)" LDFLAGS="-Wl,-z,defs" ./configure $(CROSS) --prefix=/usr
+
+build: build-stamp
+build-stamp: config.status
+	dh_testdir
+
+	$(MAKE)
+
+	touch build-stamp
+
+install: build
+	dh_testdir
+	dh_testroot
+	dh_prep
+
+	$(MAKE) prefix=$(CURDIR)/debian/barcode/usr MAN1DIR=$(CURDIR)/debian/barcode/usr/share/man/man1 MAN3DIR=$(CURDIR)/debian/barcode/usr/share/man/man3 INFODIR=$(CURDIR)/debian/barcode/usr/share/info install
+
+binary: binary-arch
+
+binary-arch: install
+	dh_testdir
+	dh_testroot
+	dh_installchangelogs ChangeLog
+	dh_installdocs
+	dh_strip --dbg-package=barcode-dbg
+	dh_compress
+	dh_fixperms
+	dh_installdeb
+	dh_shlibdeps
+	dh_gencontrol
+	dh_md5sums
+	dh_builddeb
+
+binary-indep:
+
+.PHONY: clean build install binary binary-arch binary-indep
--- barcode-0.98+debian.orig/debian/README.source
+++ barcode-0.98+debian/debian/README.source
@@ -0,0 +1,7 @@
+This package uses the quilt system to apply patches to the upstream
+source code of the software that is packaged. For details about how to
+use quilt read
+
+   /usr/share/doc/quilt/README.source
+
+from the quilt package.
--- barcode-0.98+debian.orig/debian/barcode.docs
+++ barcode-0.98+debian/debian/barcode.docs
@@ -0,0 +1 @@
+TODO
--- barcode-0.98+debian.orig/debian/control
+++ barcode-0.98+debian/debian/control
@@ -0,0 +1,27 @@
+Source: barcode
+Section: graphics
+Priority: optional
+Maintainer: Matti Pöllä <mpo@iki.fi>
+Build-Depends: debhelper (>= 7), quilt, autotools-dev, gawk, libpaper-dev
+Standards-Version: 3.8.4
+Homepage: http://www.gnu.org/software/barcode/
+
+Package: barcode
+Architecture: any
+Depends: ${misc:Depends}, ${shlibs:Depends}, install-info
+Description: Utility and library for barcode generation
+ GNU-barcode can create printouts for the conventional product-tagging
+ standards: UPC-A, UPC-E, EAN-13, EAN-8, ISBN, and several others. Output is
+ generated as either Postscript, Encapsulated Postscript, or PCL.
+
+Package: barcode-dbg
+Section: debug
+Priority: extra
+Architecture: any
+Depends: ${misc:Depends}, barcode (= ${binary:Version})
+Description: Utility and library for barcode generation (debug)
+ GNU-barcode can create printouts for the conventional product-tagging
+ standards: UPC-A, UPC-E, EAN-13, EAN-8, ISBN, and several others. Output is
+ generated as either Postscript, Encapsulated Postscript, or PCL.
+ .
+ This package contains the debugging symbols.
--- barcode-0.98+debian.orig/debian/patches/04-manpage.patch
+++ barcode-0.98+debian/debian/patches/04-manpage.patch
@@ -0,0 +1,13 @@
+Author: Daniel Baumann <daniel@debian.org>
+Description:
+ doc/manpager seems to need gawk to produce proper manpages (Closes: #436523).
+
+diff -Naurp barcode.orig/doc/manpager barcode/doc/manpager
+--- barcode.orig/doc/manpager	2009-07-16 21:49:31.000000000 +0000
++++ barcode/doc/manpager	2009-07-16 21:57:26.000000000 +0000
+@@ -1,4 +1,4 @@
+-#! /usr/bin/awk -f
++#! /usr/bin/gawk -f
+ # Copyright (c) 1998-2001 Alessandro Rubini
+ 
+ BEGIN {IN=0}
--- barcode-0.98+debian.orig/debian/patches/03-oversize.patch
+++ barcode-0.98+debian/debian/patches/03-oversize.patch
@@ -0,0 +1,333 @@
+Author: Paolo <oopla@users.sf.net>
+Description: Fixing oversized images (Closes: #320908).
+
+diff -Naurp barcode.orig/codabar.c barcode/codabar.c
+--- barcode.orig/codabar.c	2009-07-16 21:49:31.000000000 +0000
++++ barcode/codabar.c	2009-07-16 21:57:12.000000000 +0000
+@@ -165,6 +165,7 @@ int Barcode_cbr_encode(struct Barcode_It
+ 	    ptr += strlen(ptr);
+ 	}
+     }
++    textptr[-1] = '\0'; /* overwrite last space */
+     if (!startpresent) {
+ 	if (usesum) {
+ 	    /* if no start character specified, B is used as a stop char */
+diff -Naurp barcode.orig/codabar.c.orig barcode/codabar.c.orig
+--- barcode.orig/codabar.c.orig	1970-01-01 00:00:00.000000000 +0000
++++ barcode/codabar.c.orig	2009-07-16 21:49:31.000000000 +0000
+@@ -0,0 +1,182 @@
++/*
++ * codabar.c -- encoding for Codabar
++ *
++ * Copyright (c) 2000 Leonid A. Broukhis (leob@mailcom.com)
++ *
++ *   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., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
++ */
++
++#include <stdio.h>
++#include <stdlib.h>
++#include <string.h>
++#include <ctype.h>
++#include <errno.h>
++
++#include "barcode.h"
++
++
++/* this is ordered in decades to simplify encoding */
++static char alphabet[] = 
++   "0123456789" "-$:/.+ABCD";
++
++#define CODE_A	16
++#define CODE_B	17
++
++#define NARROW	12
++#define WIDE	14
++
++/* Patterns */
++static char *patterns[] = {
++"1111133","1111331","1113113","3311111","1131131",
++"3111131","1311113","1311311","1331111","3113111",
++"1113311","1133111","3111313","3131113","3131311",
++"1131313","1133131","1313113","1113133","1113331" };
++
++/*
++ * Check that the text can be encoded. Returns 0 or -1.
++ * If it's all lowecase convert to uppercase and accept it.
++ * If the first character is a letter (A to D), the last one must be too;
++ * no other character should be a letter.
++ */
++int Barcode_cbr_verify(unsigned char *text)
++{
++    int i, lower=0, upper=0;
++    int startpresent = 0;
++
++    if (!strlen(text))
++	return -1;
++    for (i=0; text[i]; i++) {
++	char * pos;
++        if (isupper(text[i])) upper++;
++        if (islower(text[i])) lower++;
++	pos = strchr(alphabet,toupper(text[i]));
++        if (!pos)
++            return -1;
++	if (i == 0 && pos - alphabet >= CODE_A)
++	    startpresent = 1;
++	else if (pos - alphabet >= CODE_A &&
++		 (!startpresent || i != strlen(text) - 1))
++	    return -1; 	
++    }
++    if (lower && upper)
++        return -1;
++    return 0;
++}
++
++static int add_one(char *ptr, int code)
++{
++    sprintf(ptr,"1%s", /* separator */ patterns[code]);
++    return 0;
++}
++
++/*
++ * The encoding functions fills the "partial" and "textinfo" fields.
++ * Lowercase chars are converted to uppercase
++ */
++int Barcode_cbr_encode(struct Barcode_Item *bc)
++{
++    static char *text;
++    static char *partial;  /* dynamic */
++    static char *textinfo; /* dynamic */
++    char *c, *ptr, *textptr;
++    int i, code, textpos, usesum, checksum = 0, startpresent;
++
++    if (bc->partial)
++	free(bc->partial);
++    if (bc->textinfo)
++	free(bc->textinfo);
++    bc->partial = bc->textinfo = NULL; /* safe */
++
++    if (!bc->encoding)
++	bc->encoding = strdup("codabar");
++
++    text = bc->ascii;
++    if (!text) {
++        bc->error = EINVAL;
++        return -1;
++    }
++    /* the partial code is 8 * (head + text + check + tail) + margin + term. */
++    partial = malloc( (strlen(text) + 3) * 8 + 2);
++    if (!partial) {
++        bc->error = errno;
++        return -1;
++    }
++
++    /* the text information is at most "nnn:fff:c " * (strlen + check) +term */
++    textinfo = malloc(10*(strlen(text) + 1) + 2);
++    if (!textinfo) {
++        bc->error = errno;
++        free(partial);
++        return -1;
++    }
++
++    ptr = partial;
++    textptr = textinfo;
++    textpos = 0;
++    usesum = bc->flags & BARCODE_NO_CHECKSUM ? 0 : 1;
++    /* if no start character specified, A is used as a start character */
++    if (!isalpha(text[0])) {
++	add_one(ptr, CODE_A);
++	ptr += strlen(ptr);
++	textpos = WIDE;
++	checksum = CODE_A;
++	startpresent = 0;
++    } else {
++	startpresent = 1;
++    }
++    for (i=0; i<strlen(text); i++) {
++        c = strchr(alphabet, toupper(text[i]));
++        if (!c) {
++            bc->error = EINVAL; /* impossible if text is verified */
++            free(partial);
++            free(textinfo);
++            return -1;
++        }
++        code = c - alphabet;
++        add_one(ptr, code);
++        sprintf(textptr, "%i:12:%c ", textpos, toupper(text[i]));
++        textpos += code < 12 ? NARROW : WIDE;
++        textptr += strlen(textptr);
++        ptr += strlen(ptr); 
++	checksum += code;
++	if (startpresent && usesum && i == strlen(text) - 2) {
++	    /* stuff a check symbol before the stop */
++	    c = strchr(alphabet, toupper(text[i+1]));
++	    if (!c) /* impossible */
++		continue;
++	    code = c - alphabet;
++	    checksum += code;
++
++	    /* Complement to a multiple of 16 */
++	    checksum = (checksum + 15) / 16 * 16 - checksum;
++	    add_one(ptr, checksum);
++	    ptr += strlen(ptr);
++	}
++    }
++    if (!startpresent) {
++	if (usesum) {
++	    /* if no start character specified, B is used as a stop char */
++	    checksum += CODE_B;
++	    checksum = (checksum + 15) / 16 * 16 - checksum;
++	    add_one(ptr, checksum);
++	    ptr += strlen(ptr);
++	}
++	add_one(ptr, CODE_B);
++    }
++    bc->partial = partial;
++    bc->textinfo = textinfo;
++
++    return 0;
++}
+diff -Naurp barcode.orig/code128.c barcode/code128.c
+--- barcode.orig/code128.c	2009-07-16 21:49:31.000000000 +0000
++++ barcode/code128.c	2009-07-16 21:57:12.000000000 +0000
+@@ -142,6 +142,7 @@ int Barcode_128b_encode(struct Barcode_I
+         textptr += strlen(textptr);
+         textpos += SYMBOL_WID; /* width of each code */
+     }
++    textptr[-1] = '\0'; /* overwrite last space */
+     /* Add the checksum, independent of BARCODE_NO_CHECKSUM */
+     checksum %= 103;
+     strcat(partial, codeset[checksum]);
+@@ -232,6 +233,7 @@ int Barcode_128c_encode(struct Barcode_I
+         textptr += strlen(textptr);
+         textpos += SYMBOL_WID; /* width of each code */
+     }
++    textptr[-1] = '\0'; /* overwrite last space */
+     /* Add the checksum, independent of BARCODE_NO_CHECKSUM */
+     checksum %= 103;
+     strcat(partial, codeset[checksum]);
+@@ -492,6 +494,7 @@ int Barcode_128_encode(struct Barcode_It
+         textptr += strlen(textptr);
+         textpos += step;
+     }
++    textptr[-1] = '\0'; /* overwrite last space */
+ 
+     bc->partial = partial;
+     bc->textinfo = textinfo;
+@@ -593,6 +596,7 @@ int Barcode_128raw_encode(struct Barcode
+         textpos += SYMBOL_WID; /* width of each code */
+ 	i += n;
+     }
++    textptr[-1] = '\0'; /* overwrite last space */
+     /* Add the checksum, independent of BARCODE_NO_CHECKSUM */
+     checksum %= 103;
+     strcat(partial, codeset[checksum]);
+diff -Naurp barcode.orig/code39.c barcode/code39.c
+--- barcode.orig/code39.c	2009-07-16 21:49:31.000000000 +0000
++++ barcode/code39.c	2009-07-16 21:57:12.000000000 +0000
+@@ -160,6 +160,7 @@ int Barcode_39_encode(struct Barcode_Ite
+         textptr += strlen(textptr);
+         ptr += strlen(ptr); 
+     }
++    textptr[-1] = '\0'; /* overwrite last space */
+     /* Add the checksum */
+     if ( (bc->flags & BARCODE_NO_CHECKSUM)==0 ) {
+ 	code = (strchr(alphabet, checkbet[checksum % 43]) - alphabet);
+diff -Naurp barcode.orig/code93.c barcode/code93.c
+--- barcode.orig/code93.c	2009-07-16 21:49:31.000000000 +0000
++++ barcode/code93.c	2009-07-16 21:57:12.000000000 +0000
+@@ -182,6 +182,7 @@ int Barcode_93_encode(struct Barcode_Ite
+ 	 */
+         textpos += 9;
+     }
++    textptr[-1] = '\0'; /* overwrite last space */
+     c_checksum=0;
+     k_checksum=0;
+ 
+diff -Naurp barcode.orig/i25.c barcode/i25.c
+--- barcode.orig/i25.c	2009-07-16 21:49:31.000000000 +0000
++++ barcode/i25.c	2009-07-16 21:57:12.000000000 +0000
+@@ -153,6 +153,7 @@ int Barcode_i25_encode(struct Barcode_It
+         textpos += 18; /* width of two codes */
+         textptr += strlen(textptr);
+     }
++    textptr[-1] = '\0'; /* overwrite last space */
+     strcat(partial, guard[1]);
+ 
+     bc->partial = partial;
+diff -Naurp barcode.orig/msi.c barcode/msi.c
+--- barcode.orig/msi.c	2009-07-16 21:49:31.000000000 +0000
++++ barcode/msi.c	2009-07-16 21:57:12.000000000 +0000
+@@ -132,6 +132,7 @@ int Barcode_msi_encode(struct Barcode_It
+ 	    }
+ 	}
+     }
++    textptr[-1] = '\0'; /* overwrite last space */
+     /* Some implementations use a double checksum. Currently the only way
+      * to print a barcode with double checksum is to put the checksum
+      * digit printed below at the end of a code in the command line
+diff -Naurp barcode.orig/plessey.c barcode/plessey.c
+--- barcode.orig/plessey.c	2009-07-16 21:49:31.000000000 +0000
++++ barcode/plessey.c	2009-07-16 21:57:12.000000000 +0000
+@@ -140,6 +140,7 @@ int Barcode_pls_encode(struct Barcode_It
+ 	checkptr[4*i+2] = (code >> 2) & 1;
+ 	checkptr[4*i+3] = (code >> 3) & 1;
+     }
++    textptr[-1] = '\0'; /* overwrite last space */
+     /* The CRC checksum is required */
+     for (i=0; i < 4*strlen(text); i++) {
+         int j;
+diff -Naurp barcode.orig/ps.c barcode/ps.c
+--- barcode.orig/ps.c	2009-07-16 21:49:31.000000000 +0000
++++ barcode/ps.c	2009-07-16 21:57:12.000000000 +0000
+@@ -146,11 +146,38 @@ int Barcode_ps_print(struct Barcode_Item
+ 	    fprintf(f, "%%!PS-Adobe-2.0\n");
+ 	fprintf(f, "%%%%Creator: libbarcode\n");
+ 	if (bc->flags & BARCODE_OUT_EPS)  {
++	    int bboxw;
++	    bboxw=bc->xoff + bc->width + 2* bc->margin;
++            if (!(bc->flags & BARCODE_NO_ASCII)) {
++                ptr = strrchr(bc->textinfo,' ');
++	        /*fprintf(stderr, "bc->textinfo=%s\n",bc->textinfo);*/
++	        if (ptr == NULL) {
++	            fprintf(stderr,
++	                "barcode: last char: impossible data: NULL\n");
++	        } else {
++	            /*fprintf(stderr, "ptr=%s\n",ptr);*/
++                   if (sscanf(ptr, "%lf:%lf:%c", &f1, &f2, &c) != 3) {
++	                fprintf(stderr,
++	                   "barcode: last char: impossible data: %s\n", ptr);
++                   } else {
++	                /* Both the backslash and the two parens are special */
++	                if (c!='\\' && c!=')' && c!='(') {
++	                    f1=bc->xoff + (f1+f2) * scalef + bc->margin;
++                           if (f1 > bboxw) bboxw=f1;
++	                }
++	            }
++	        }
++	    }
+ 	    fprintf(f, "%%%%BoundingBox: %i %i %i %i\n",
+ 		    bc->xoff,
+ 		    bc->yoff,
+-		    bc->xoff + bc->width + 2* bc->margin,
++		    bboxw,
+ 		    bc->yoff + bc->height + 2* bc->margin);
++	/*    fprintf(f, "%%DEBUG: bc->width=%i bc->height=%i bc->margin=%i "
++                    "scalef=%6.2f barlen=%6.2f bc->partial=%c\n",
++		    bc->width, bc->height, bc->margin,
++		    scalef, (double)barlen, (char)bc->partial[0]);
++         */
+ 	}
+ 	fprintf(f, "%%%%EndComments\n");
+ 	if (bc->flags & BARCODE_OUT_PS)  {
--- barcode-0.98+debian.orig/debian/patches/series
+++ barcode-0.98+debian/debian/patches/series
@@ -0,0 +1,5 @@
+01-codabar.patch
+02-margin.patch
+03-oversize.patch
+04-manpage.patch
+05-info.patch
--- barcode-0.98+debian.orig/debian/patches/05-info.patch
+++ barcode-0.98+debian/debian/patches/05-info.patch
@@ -0,0 +1,15 @@
+Author: Daniel Baumann <daniel@debian.org>
+Description: Adding info header (Closes: #528867).
+
+diff -Naurp barcode.orig/doc/barcode.info barcode/doc/barcode.info
+--- barcode.orig/doc/barcode.info	2009-07-16 23:49:31.000000000 +0200
++++ barcode/doc/barcode.info	2009-07-17 00:08:22.000000000 +0200
+@@ -1,3 +1,8 @@
++START-INFO-DIR-ENTRY
++* Barcode: (barcode).        Utility and library for barcode generation
++END-INFO-DIR-ENTRY
++INFO-DIR-SECTION Graphics
++
+ This is barcode.info, produced by makeinfo version 4.0 from
+ barcode.texinfo.
+ 
--- barcode-0.98+debian.orig/debian/patches/02-margin.patch
+++ barcode-0.98+debian/debian/patches/02-margin.patch
@@ -0,0 +1,83 @@
+Author: n/a
+Description: Adjusts correct margins.
+
+diff -Naurp barcode.orig/main.c barcode/main.c
+--- barcode.orig/main.c	2009-07-16 21:49:31.000000000 +0000
++++ barcode/main.c	2009-07-16 21:56:09.000000000 +0000
+@@ -419,7 +419,6 @@ char *strerror(int error)
+  */
+ int main(int argc, char **argv)
+ {
+-    struct Barcode_Item * bc;
+     FILE *ifile = stdin;
+     FILE *ofile = stdout;
+     char *line;
+@@ -549,50 +548,37 @@ int main(int argc, char **argv)
+ 	int ystep = (page_hei - ymargin0 - ymargin1)/lines;
+ 	int x = columns, y = -1; /* position in the table, start off-page */
+ 
+-	if (!ximargin) ximargin = BARCODE_DEFAULT_MARGIN;
+-	if (!yimargin) yimargin = BARCODE_DEFAULT_MARGIN;
+-	/* Assign default size unless -g did it (Joachim Reichelt) */
+-	if ( !code_width && !code_height) {
+-	    code_width = xstep - 2*ximargin;
+-	    code_height = ystep - 2*yimargin;
+-	}
+-
+ 	page=0;
++
++
+ 	while ( (line = retrieve_input_string(ifile)) ) {
+ 	    x++;  /* fit x and y */
+ 	    if (x >= columns) {
+ 		x=0; y--;
+ 		if (y<0) {
+ 		    y = lines-1; page++;
+-		    /* flush page */
+-		    if (ps && page > 1) fprintf(ofile, "showpage\n");
+-		    if (pcl && page > 1) fprintf(ofile, "\f");
+-		    /* new page */
+-		    if (ps) fprintf(ofile, "%%%%Page: %i %i\n\n",page,page);
++		    if (page>1) {
++			if (ps) {
++			    fprintf(ofile, "showpage\n");
++			    fprintf(ofile, "%%%%Page: %i %i\n\n",page,page);
++			}
++			if (pcl) fprintf(ofile, "\f");
++		    }
+ 		}
+ 	    }
+ 
+ 	    /*
+-	     * Create a barcode item. This allows to set the margin to 0, as
+-	     * we have [xy]imargin to use. But don't use Encode_and_Print(),
+-	     * unroll it here instead
++	     * Print this code, using the internal margins as spacing.
++	     * In order to remove the extra (default) margin, subtract it
++	     * in advance (dirty)
+ 	     */
+-	    bc = Barcode_Create(line);
+-	    if (!bc) {
+-		fprintf(stderr, "%s: Barcode_Create(): %s\n", argv[0],
+-			strerror(errno));
+-		exit(1);
+-	    }
+-	    bc->margin = 0;
+-	    if ( (Barcode_Position(bc, code_width, code_height,
+-				   xmargin0 + ximargin + x * xstep,
+-				   ymargin0 + yimargin + y * ystep, 0.0) < 0)
+-		 || (Barcode_Encode(bc, flags) < 0)
+-		 || (Barcode_Print(bc, ofile, flags) < 0) ) {
+-		fprintf(stderr, "%s: can't encode \"%s\": %s\n", argv[0],
+-			line, strerror(bc->error));
++	    if (Barcode_Encode_and_Print(line, ofile,
++		    xstep - 2*ximargin, ystep - 2*yimargin,
++		    xmargin0 + ximargin + x * xstep - BARCODE_DEFAULT_MARGIN,
++		    ymargin0 + yimargin + y * ystep - BARCODE_DEFAULT_MARGIN,
++		    flags)<0) {
++		fprintf(stderr, "%s: can't encode \"%s\"\n", argv[0], line);
+ 	    }
+-	    Barcode_Delete(bc);
+ 	}
+ 	if (ps) fprintf(ofile, "showpage\n\n%%%%Trailer\n\n");
+ 	if (pcl) fprintf(ofile, "\f");
--- barcode-0.98+debian.orig/debian/patches/01-codabar.patch
+++ barcode-0.98+debian/debian/patches/01-codabar.patch
@@ -0,0 +1,46 @@
+Author: Chris Howie <crazycomputers@yahoo.com>
+Description: Following codabar specification (Closes: #320908).
+
+diff -Naurp barcode.orig/codabar.c barcode/codabar.c
+--- barcode.orig/codabar.c	2009-07-16 21:49:31.000000000 +0000
++++ barcode/codabar.c	2009-07-16 21:55:33.000000000 +0000
+@@ -29,10 +29,11 @@
+ 
+ /* this is ordered in decades to simplify encoding */
+ static char alphabet[] = 
+-   "0123456789" "-$:/.+ABCD";
++   "0123456789" "-$:/.+ABCDTN*E";
+ 
+ #define CODE_A	16
+ #define CODE_B	17
++#define CODE_T	20
+ 
+ #define NARROW	12
+ #define WIDE	14
+@@ -42,7 +43,8 @@ static char *patterns[] = {
+ "1111133","1111331","1113113","3311111","1131131",
+ "3111131","1311113","1311311","1331111","3113111",
+ "1113311","1133111","3111313","3131113","3131311",
+-"1131313","1133131","1313113","1113133","1113331" };
++"1131313","1133131","1313113","1113133","1113331",
++"1133131","1313113","1113133","1113331"};
+ 
+ /*
+  * Check that the text can be encoded. Returns 0 or -1.
+@@ -167,13 +169,13 @@ int Barcode_cbr_encode(struct Barcode_It
+     }
+     if (!startpresent) {
+ 	if (usesum) {
+-	    /* if no start character specified, B is used as a stop char */
+-	    checksum += CODE_B;
++	    /* if no start character specified, T is used as a stop char */
++	    checksum += CODE_T;
+ 	    checksum = (checksum + 15) / 16 * 16 - checksum;
+ 	    add_one(ptr, checksum);
+ 	    ptr += strlen(ptr);
+ 	}
+-	add_one(ptr, CODE_B);
++	add_one(ptr, CODE_T);
+     }
+     bc->partial = partial;
+     bc->textinfo = textinfo;
