--- less-358.orig/screen.c
+++ less-358/screen.c
@@ -264,7 +264,8 @@
 		/*
 		 * Get terminal modes.
 		 */
-		tcgetattr(2, &s);
+	        /* TMQ changed the ioctl to stdin from stderr to allow redirection of stderr */
+		tcgetattr(1, &s);
 
 		/*
 		 * Save modes and set certain variables dependent on modes.
@@ -419,7 +420,8 @@
 		 */
 		s = save_term;
 	}
-	tcsetattr(2, TCSADRAIN, &s);
+	/* TMQ changed the ioctl to stdin from stderr to allow redirection of stderr */
+	tcsetattr(1, TCSADRAIN, &s);
 #if MUST_SET_LINE_DISCIPLINE
 	if (!on)
 	{
--- less-358.orig/debian/LESSOPEN
+++ less-358/debian/LESSOPEN
@@ -0,0 +1,59 @@
+From the man page:
+       You  may  define an "input preprocessor" for less.  Before
+       less opens a file, it first gives your input  preprocessor
+       a  chance  to  modify the way the contents of the file are
+       displayed.
+
+What this means is that less(1) can automatically open up tar files,
+uncompress gzipped files, and even display something reasonable for
+graphics files.
+
+You just need to put the following in your
+.zlogin/.login/.bash_profile/whatever:
+
+eval $(lesspipe)
+or
+eval $(lessfile)
+
+lesspipe will toss the contents/info on stdout and less will read them
+as they come across.  This means that you don't have to wait for the
+decoding to finish before less shows you the file.  This also means that
+you'll get a 'byte N' instead of an N% as your file position.  You can
+seek to the end and back to get the N% but that means you have to wait
+for the pipe to finish.
+
+lessfile will toss the contents/info on a file which less will then
+read.  After you're done, lessfile will then delete the file.  This
+means that the process has to finish before you see it, but you get nice
+percentages (N%) up front.
+
+If you have some additional tests for binary files that I don't handle, go
+ahead and send them to me.  Note that I will never integrate commands
+for text files.  If you want to add man-ifying or html-izing commands to 
+your copy of lessopen, go ahead, they just won't be integrated in the
+main distribution.
+
+Here are two additional tests that you might like to use but aren't in
+the lessopen script due to speed or principle of least surprise.
+
+    # Decode directories:
+    if [ -d "$1" ]; then
+	echo "$1:"; ls -l $1
+    else
+
+    # view strings inside of an executable
+    if [ -x "$1" ]; then
+        type=$(file "$1")
+        case "$type" in 
+          *executable* )
+            echo -e "$type\n"
+            strings "$1"
+            ;;
+        esac
+    fi
+
+These two entries courtesy of Adrian Bridgett <adrian.bridgett@poboxes.com>.
+Please send in your entries as well.
+
+If you have any questions, send me e-mail at <torin@daft.com>.
+Mentioning less in the subject line will help.
--- less-358.orig/debian/changelog
+++ less-358/debian/changelog
@@ -0,0 +1,329 @@
+less (358-5) unstable; urgency=low
+
+  * Closes: Bug#80989: less: less on a deb file that does not exist
+
+ -- Thomas Schoepf <schoepf@debian.org>  Mon,  1 Jan 2001 12:52:04 +0100
+
+less (358-4) unstable; urgency=low
+
+  * Closes: Bug#79494: Lesspipe mishandles files with spaces, etc.
+    I removed the single quotes around %s in the LESSOPEN and LESSCLOSE
+    environment variables, although is re-actives an old bug (#25706). I still
+    thinks it's sensible, because with the quotes in place, you cannot view
+    any files with need-to-escape characters in their names, now you cannot
+    view only files with '#' as the first character, i.e. you can view them
+    when you write the path ahead (e.g. 'less ./#file').
+    Plus, I added a note to lesspipe that should lead people who fell into this
+    trap door to the right direction.
+
+ -- Thomas Schoepf <schoepf@debian.org>  Tue, 26 Dec 2000 19:33:25 +0100
+
+less (358-3) unstable; urgency=low
+
+  * debian/prerm: call update-alternatives only on removal not on upgrade etc.
+  * Install a manpage slave for pager.1
+
+ -- Thomas Schoepf <schoepf@debian.org>  Mon,  7 Aug 2000 13:44:48 +0200
+
+less (358-2) unstable; urgency=low
+
+  * Closes: #66990: debhelper should not be in Build-Depends-Indep
+  * Bumped Standards-Version to 3.2.0
+  * Switch to debhelper v2.
+
+ -- Thomas Schoepf <schoepf@debian.org>  Sat,  5 Aug 2000 01:19:27 +0200
+
+less (358-1) unstable; urgency=low
+
+  * New upstream version.
+
+ -- Thomas Schoepf <schoepf@debian.org>  Sat, 15 Jul 2000 20:36:02 +0200
+
+less (357-1) unstable; urgency=low
+
+  * New upstream version.
+  * Closes: #44058: less wordwrap bug
+  * Closes: #66309: lesspipe can't find imagemagick
+
+ -- Thomas Schoepf <schoepf@debian.org>  Sun,  9 Jul 2000 00:38:24 +0200
+
+less (354-2) unstable; urgency=low
+
+  * Corrected download address in copyright.
+
+ -- Thomas Schoepf <schoepf@debian.org>  Mon, 29 May 2000 16:49:31 +0200
+
+less (354-1) unstable; urgency=low
+
+  * New upstream version.
+
+ -- Thomas Schoepf <schoepf@debian.org>  Fri, 31 Mar 2000 22:18:28 +0200
+
+less (352-1) unstable; urgency=low
+
+  * New upstream version.
+  * Closes: #57123: lesspipe should display *.lha as well
+  * Documented the behavior, that bash sources the file referenced by
+    $BASH_ENV before executing a shell script (Closes: #50024).
+
+ -- Thomas Schoepf <schoepf@debian.org>  Thu,  9 Mar 2000 11:34:54 +0100
+
+less (346-7) frozen unstable; urgency=low
+
+  * Applied a patch that is now blessed by the upstream maintainer.
+    Closes: #35223: less: can't edit files with spaces in the filename
+    Closes: #36991: less doesn't quote filesnames when starting the editor
+    Closes: #53403: less: problem with filenames with spaces
+
+ -- Thomas Schoepf <schoepf@debian.org>  Fri, 28 Jan 2000 19:53:17 +0100
+
+less (346-6) frozen unstable; urgency=low
+
+  * Release Manager: Fixes a not yet reported bug that causes lesspipe to fail
+    on *.doc files without catdoc installed.
+
+ -- Thomas Schoepf <schoepf@debian.org>  Thu, 20 Jan 2000 13:32:43 +0100
+
+less (346-5) unstable; urgency=low
+
+  * Compiled against new libncurses5. (closes: #53934)
+
+ -- Thomas Schoepf <schoepf@debian.org>  Mon,  3 Jan 2000 18:47:41 +0100
+
+less (346-4) unstable; urgency=low
+
+  * Closes: #53614: Missing build dependencies
+
+ -- Thomas Schoepf <schoepf@debian.org>  Tue, 28 Dec 1999 18:17:00 +0100
+
+less (346-3) unstable; urgency=low
+
+  * Closes: #53303: please include catdoc in lesspipe for MS-Word
+
+ -- Thomas Schoepf <schoepf@debian.org>  Thu, 23 Dec 1999 19:38:06 +0100
+
+less (346-2) unstable; urgency=low
+
+  * Closes: #50201: lesspipe/lessfile: miniunz is now miniunzip
+  * debian/copyright: less may be distributed under the terms of either
+    the GPL or the Less License.
+
+ -- Thomas Schoepf <schoepf@debian.org>  Mon, 15 Nov 1999 01:17:31 +0100
+
+less (346-1) unstable; urgency=low
+
+  * New Upstream version.
+  * Standards-Version: 3.1.0 and Build Dependencies.
+
+ -- Thomas Schoepf <schoepf@debian.org>  Sat,  6 Nov 1999 13:13:00 +0100
+
+less (345-2) unstable; urgency=low
+
+  * debian/rules: Do not use target install-stamp anymore.
+  * Stop patching main.c now that $VISUAL is blessed by the policy.
+
+ -- Thomas Schoepf <schoepf@debian.org>  Fri,  5 Nov 1999 21:50:07 +0100
+
+less (345-1) unstable; urgency=low
+
+  * New upstream version.
+  * Closes: #20184: Default keybindings in less should be changed.
+  * Closes: #32166: Change default character set to latin1
+  * Closes: #36154, #36155: help screen describes -I option incorrectly
+  * Closes: #38498: lesskey patch
+  * Closes: #47535: segfault after typing h:d
+
+ -- Thomas Schoepf <schoepf@debian.org>  Thu,  4 Nov 1999 22:36:04 +0100
+
+less (340-5) unstable; urgency=low
+
+  * Allow user defined lesspipe/lessfile filters via $HOME/.lessfilter.
+    (closes: #46210)
+
+ -- Thomas Schoepf <schoepf@debian.org>  Sat,  2 Oct 1999 13:31:19 +0200
+
+less (340-4) unstable; urgency=low
+
+  * Added description of lesspipe's behavior on empty gzipped files to its
+    manpage. (closes: #24375)
+
+ -- Thomas Schoepf <schoepf@debian.org>  Fri, 17 Sep 1999 00:26:41 +0200
+
+less (340-3) unstable; urgency=low
+
+  * No longer use hard-coded paths for non-standard utilities in lesspipe.
+    (closes: #31012)
+  * No longer leave empty temporary files on the system when less is called on
+    non-existing files and LESSOPEN is set to "lessfile '%s'".
+  * Mime: text/* priority=2.
+
+ -- Thomas Schoepf <schoepf@debian.org>  Fri, 10 Sep 1999 20:15:23 +0200
+
+less (340-2) unstable; urgency=low
+
+  * Repackaged using debhelper.
+  * License is GPL.
+  * debian/control: Standards-Version: 3.0.1.
+  * Added mime support. (closes: #25891)
+  * Wrote manpages for lessecho and lesspipe. (closes: #15961)
+  * lessfile.1.gz is a symlink to lesspipe.1.gz.
+  * Modified lesspipe to use /bin/sh. (closes: #19049)
+
+ -- Thomas Schoepf <schoepf@debian.org>  Thu,  9 Sep 1999 01:00:50 +0200
+
+less (340-1) unstable; urgency=low
+
+  * New maintainer (Thanks Darren!).
+  * New upstream version. (closes: #38297, #39756)
+  * Added support for .tar.bz2 to lessopen. (closes: #32538)
+  * Added support for .jar to lessopen. (closes: #43388)
+  * Added support for miniunz to lessopen. (closes: #41294)
+
+ -- Thomas Schoepf <schoepf@debian.org>  Tue,  7 Sep 1999 12:36:03 +0200
+
+less (332-4.1) frozen unstable; urgency=low
+
+  * Non-maintainer upload
+  * Compiled with ncurses4
+
+ -- Joseph Carter <knghtbrd@debian.org>  Sun,  1 Nov 1998 03:30:54 -0800
+
+less (332-4) unstable frozen; urgency=low
+
+  * Actually fix arj entry.  I'm not sure how the fix got reverted to the
+    old entry.
+  * Put '' around [:upper:] and [:lower:] in tr call to protect them from
+    the shell.  Thanks to Alexey Marinichev <lyosha@math.uu.se>.  (Fixes
+    Bug #22311)
+  * I wasn't paying attention and thought that tempfile just gave me a
+    filename rather than creating a file.  This of course doesn't work.
+    Now we only create the file when we need to.  Thanks to Roberto
+    Lumbreras <rover@lander.es> for pointing this out.  (Fixes Bug #22320)
+  * Updated standards version to 2.4.1.0.  Our one non-compliance was
+    insecure tempfiles.
+
+ -- Darren Stalder <torin@daft.com>  Tue, 12 May 1998 02:19:45 -0700
+
+less (332-3) unstable frozen; urgency=low
+
+  * Modified rules so that you no longer have to be root to build the
+    package.  (Fixes Bug #15454)
+  * Made lessopen tmp-secure (depend on debianutils >= 1.8 for tempfile).
+    (Fixes Bugs #19796, #15463)
+  * Made the filename canonically lowercase for matching in lessopen.
+  * Added directories, .bz, .bz2, .rpm entries to lessopen.  (Fixes Bugs
+    $14200, #17486)
+  * Fixed arj entry to use the correct options.  (I didn't have any .arj
+    handy.)  (Fixes Bugs #17114, #17520)
+  * Linked lesspipe.1.gz/lessfile.1.gz to undocumented.7.gz until I have
+    time to write a real manpage.  (Works on Bug #15961)
+  
+ -- Darren Stalder <torin@daft.com>  Sun, 19 Apr 1998 23:54:53 -0700
+
+less (332-2) unstable; urgency=low
+
+  * Quote the arguments to lesspipe so that it can handle filenames with
+    special characters such as '#'.  Suggestion from Richard Braakman.
+    Thanks, Richard!  (Bug #11859)
+  * Recompile with libc6.  (Bug #11695)
+  * Use update-alternatives to register less(1) as /usr/bin/pager at level
+    77.  (Bug #12474)
+  * Told less(1) to use /usr/bin/editor if the envar EDITOR isn't set.
+    Changed defines.h.in to not redefine EDIT_PGM and removed checking the 
+    VISUAL envar for the program to use.
+  * Register bug on less since it should depend on -something- installing
+    /usr/bin/editor but nothing I've seen does yet.
+
+ -- Darren Stalder <torin@daft.com>  Tue, 23 Sep 1997 01:23:28 -0700
+
+less (332-1) unstable; urgency=low
+
+  * Upstream upgrade.  This fixes bug #5483, #6492, and #9408.
+  * Removed changing the editor to ae.  This closes bug #8036 and makes me
+    quite happy.
+  * Changed rules file to only ask for a password during clean if it needs
+    it.
+  * Included a LESSOPEN script.  See /usr/doc/less/LESSOPEN for details.
+    This closes #3952 and #8111.
+  * Applied patch to screen.c from Herbert Thielen so that less properly
+    sets raw mode if stderr is redirected to /dev/null.  This closes
+    #5512.
+  * NEWS is now installed as /usr/doc/less/changelog, mode 0644.  This
+    closes #7835 and 7837.
+  * README is no longer included in the binary package since it's just
+    directions on how to install less.  This closes #7836.
+
+ -- Darren Stalder <torin@daft.com>  Wed, 18 Jun 1997 23:21:27 -0700
+
+less (321-2) unstable; urgency=low
+
+  * Updated to dpkg standards version 2.1.1.2, changed the rules file to
+    the format that I'm used to.  This fixes #3336.
+  * Convinced less to use ae as the default editor.  I can't stand it but
+    it's guaranteed to be on every debian system.  Changed defines.h.in so
+    that I don't get lots of redefine errors.
+  * Reformatted the Description in the control file to clear #3616
+  * It seems that the upstream release fixed the annoying 0 length bug.
+    This closes #4178, #4586, #4762, #6214, #6612
+
+ -- Darren Stalder <torin@daft.com>  Sun, 2 Feb 1997 20:10:05 -0800
+
+Tue Jul 23 13:52:10 1996  Erick Branderhorst  <branderh@debian.org>
+
+	* mainstream update less 321.
+	* modified debian.control & debian.rules for version, architecture
+	* make install prefix instead of debian.rules specific install
+
+1.  Added debian.* files
+
+The following changes are from Bill Mitchell:
+Changes for less-290-8
+	elf package
+	* rebuilt using ncurses shared lib
+	* changed ncurses-runtime dependency to ncurses3.0
+
+Changes for less-290-7
+	elf package
+	* added bugfix in #ifdef LINUX code in ch.c
+
+Changes for less-290-6
+	elf package
+	* rebuilt for elf
+
+Changes for less-290-5
+	aout package
+	* use alternative patch from Raul Miller to handle /proc files
+
+Changes for less-290-4
+	aout package
+	* hacked filename.c with a workaround for a kernel bug
+	  for files in /proc,
+	      stat(filename) returns st_size set to 0
+	      lseek(fd, (off_t) 0, 2) returns 0
+	  this hack determines filesize by reading thru the file byte by byte
+	  this doesn't address lseeek() being broken, and less(1) will
+	  probably still misbehave if any /proc files are big enough
+	  to make it want to use lseek()
+
+Changes for less-290-3
+
+1.  Added #ifdef DEBIAN block in screen.c to abort on unknown
+    terminal types instead of attempting to continue (due to
+    an apparent libtermcap.a bug which segfaults on tgetflag("hc")
+    for unknown terminal types).
+
+2.  Added -DDEBAIN to cflags in debian.rules.
+
+3.  Added build as a dependency to binary: target in debian.rules.
+
+4.  Modified ./configure invocation handling in debian.rules.
+
+Changes for less-290-2
+
+1.  Cleaned up description and extended description on debian.control.
+
+** Local Variables: **
+** mode:debian-changelog **
+** change-log-default-name:"changelog" **
+** fill-prefix:"  " **
+** End: **
--- less-358.orig/debian/copyright
+++ less-358/debian/copyright
@@ -0,0 +1,50 @@
+This package was debianized by Thomas Schoepf <schoepf@debian.org> on
+Wed,  8 Sep 1999 13:28:20 +0200.
+
+The previous maintainers were Darren Stalder <torin@daft.com>,
+Erick Branderhorst <branderh@debian.org> and
+Bill Mitchell <mitchell@mdd.comm.mot.com>.
+
+It was downloaded from http://home.flash.net/~marknu/less/download.html
+
+Upstream Author: Mark Nudelman <marknu@flash.net>
+
+Copyright:
+
+This program is free software.  You may redistribute it and/or
+modify it under the terms of either:
+
+1. The GNU General Public License, as published by the Free
+   Software Foundation; either version 2, or (at your option) any
+   later version.  A copy of this license is in the file
+   /usr/share/common-licenses/GPL.
+or
+2. The Less License.
+
+                          Less License
+                          ------------
+
+Less
+Copyright (C) 1984-1999  Mark Nudelman
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+1. Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+   notice in the documentation and/or other materials provided with 
+   the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY
+EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
+PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 
+OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 
+BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
+WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 
+OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 
+IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
--- less-358.orig/debian/lessopen
+++ less-358/debian/lessopen
@@ -0,0 +1,192 @@
+#!/bin/sh
+#
+# lessfile/lesspipe
+# $Id: lessopen,v 1.4 1998/05/12 09:37:46 torin Exp $
+#
+# Less filter for viewing non text files.
+#
+# Written by: Behan Webster <behanw@pobox.com>
+# Many Modifications by Darren Stalder
+# Further Modifications by Thomas Schoepf <schoepf@debian.org>
+#
+# combined lessfile and lesspipe to avoid duplication of decode stage
+# shell is sure icky.  I'm real tempted to rewrite the whole thing in Perl 
+#
+# Unfortunately, this means that I have filename dependencies sprinkled
+# throughout the code.  If you don't want lessfile to be called that,
+# you'll need to change the LESSFILE envar below.
+#
+# Usage: eval $(lessfile)  or eval $(lesspipe)
+#
+# less passes in:
+#    $1  filename to be viewed with less  (used by LESSOPEN)
+# and possibly (if used by lessfile)
+#    $2  filename that was created during LESSOPEN
+
+TMPDIR=${TMPDIR:-/tmp}
+BASENAME=$(basename $0)
+LESSFILE=lessfile
+
+if [ $# -eq 1 ] ; then
+	# we were called as LESSOPEN
+
+	# if the file doesn't exist, we don't do anything
+	if ! [ -e "$1" ]; then
+		exit 0
+	fi
+
+	# generate filename for possible use by lesspipe
+	umask 077
+	if [ $BASENAME = $LESSFILE ]; then
+		TMPFILE=$(tempfile -d $TMPDIR -p lessf)
+	fi
+
+	# possibly redirect stdout to a file for lessfile
+	( if [ $BASENAME = $LESSFILE ]; then exec > $TMPFILE; fi
+
+	# Allow for user defined filters
+	if [ -x ~/.lessfilter -a -O ~/.lessfilter ]; then
+		~/.lessfilter "$1"
+		if [ $? -eq 0 ]; then
+			if [ $BASENAME = $LESSFILE ]; then
+				if [ -s $TMPFILE ]; then
+					echo $TMPFILE
+				else
+					rm -f $TMPFILE
+				fi
+			fi
+			exit 0
+		fi
+	fi
+
+	# Decode file for less
+	case $(echo "$1" | tr '[:upper:]' '[:lower:]') in
+		*.arj)
+			if [ -x "`which unarj`" ]; then unarj l "$1"
+			else echo "No unarj available"; fi ;;
+ 
+		*.tar.bz2)
+			if [ -x "`which bunzip2`" ]; then
+				bunzip2 -dc "$1" | tar tvvf -
+			else echo "No bunzip2 available"; fi ;;
+
+		*.bz)
+			if [ -x "`which bunzip`" ]; then bunzip -c "$1"
+			else echo "No bunzip available"; fi ;;
+
+		*.bz2)
+			if [ -x "`which bunzip2`" ]; then bunzip2 -dc "$1"
+			else echo "No bunzip2 available"; fi ;;
+
+		*.deb)
+			echo "$1:"; dpkg --info "$1"
+			echo -e '\n*** Contents:'; dpkg-deb --contents "$1"
+			;;
+
+		*.doc)
+			if [ -x "`which catdoc`" ]; then catdoc "$1"; fi ;;
+
+		*.gif|*.jpeg|*.jpg|*.pcd|*.png|*.tga|*.tiff|*.tif)
+			if [ -x "`which identify`" ]; then
+				identify "$1"
+			else echo -e "No identify available\nInstall ImageMagick to browse images"; fi ;;
+
+		*.lha|*.lzh)
+			if [ -x "`which lha`" ]; then lha v "$1"
+			else echo "No lha available"; fi ;;
+
+		*.rpm)
+			if [ -x "`which rpm`" ]; then
+				echo "$1:"; rpm -q -i -p "$1"
+				echo -e '\n*** Contents:'; rpm -q -l -p "$1";
+			else echo "rpm isn't available, no query on rpm package possible"; fi ;;
+
+		*.tar.gz|*.tgz|*.tar.z)
+			tar tzvf "$1" ;;
+
+		# Note that this is out of alpha order so that we don't catch
+		# the gzipped tar files.
+		*.gz|*.z)
+			gzip -dc "$1" ;;
+
+		*.tar)
+			tar tvf "$1" ;;
+
+		*.jar|*.zip)
+			if [ -x "`which unzip`" ]; then unzip -v "$1";
+			elif [ -x "`which miniunzip`" ]; then miniunzip -l "$1";
+			elif [ -x "`which miniunz`" ]; then miniunz -l "$1";
+			else echo "No unzip, miniunzip or miniunz available"; fi ;;
+
+		*.zoo)
+			if [ -x "`which zoo`" ]; then zoo v "$1"
+			else echo "No zoo available"; fi ;;
+
+	esac
+	) 2>/dev/null
+
+	if [ $BASENAME = $LESSFILE ]; then
+		if [ -s $TMPFILE ]; then
+			echo $TMPFILE
+		else
+			rm -f $TMPFILE
+		fi
+	fi
+
+elif [ $# -eq 2 ] ; then
+	#
+	# we were called as LESSCLOSE
+	# delete the file created if we were lessfile
+	#
+	if [ $BASENAME = $LESSFILE ]; then
+		if [ -f "$2" -a -O "$2" ]; then
+			rm -f "$2"
+		else
+			echo "Error in deleting $2" > /dev/tty
+		fi
+	fi
+
+elif [ $# -eq 0 ] ; then
+	#
+	# must setup shell to use LESSOPEN/LESSCLOSE
+	#
+	# I have no idea how some of the more esoteric shells (es, rc) do
+	# things. If they don't do things in a Bourne manner, send me a patch
+	# and I'll incorporate it.
+	#
+
+	# first determine the full path of lessfile/lesspipe
+	# if you can determine a better way to do this, send me a patch, I've
+	# not shell-scripted for many a year.
+	FULLPATH=$(cd $(dirname $0);pwd)/$BASENAME
+
+	case "$SHELL" in
+		*csh)
+			if [ $BASENAME = $LESSFILE ]; then
+				echo "setenv LESSOPEN \"$FULLPATH %s\";"
+				echo "setenv LESSCLOSE \"$FULLPATH %s %s\";"
+			else
+				echo "setenv LESSOPEN \"| $FULLPATH %s\";"
+				echo "setenv LESSCLOSE \"$FULLPATH %s %s\";"
+			fi
+			;;
+		*)
+			if [ $BASENAME = $LESSFILE ]; then
+				echo "export LESSOPEN=\"$FULLPATH %s\";"
+				echo "export LESSCLOSE=\"$FULLPATH %s %s\";"
+			else
+				echo "export LESSOPEN=\"| $FULLPATH %s\";"
+				echo "export LESSCLOSE=\"$FULLPATH %s %s\";"
+			fi
+			;;
+	esac
+
+	echo "# If you tried to view a file with a name that starts with '#', you"
+	echo "# might see this message instead of the file's contents."
+	echo "# To view the contents, try to put './' ahead of the filename when"
+	echo "# calling less."
+
+else
+	echo "Usage: eval \$($BASENAME)"
+	exit
+fi
--- less-358.orig/debian/dirs
+++ less-358/debian/dirs
@@ -0,0 +1 @@
+usr/bin
--- less-358.orig/debian/postinst
+++ less-358/debian/postinst
@@ -0,0 +1,49 @@
+#! /bin/sh
+# postinst script for less
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+#        * <postinst> `configure' <most-recently-configured-version>
+#        * <old-postinst> `abort-upgrade' <new version>
+#        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
+#          <new-version>
+#        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
+#          <failed-install-package> <version> `removing'
+#          <conflicting-package> <version>
+# for details, see /usr/doc/packaging-manual/
+#
+# quoting from the policy:
+#     Any necessary prompting should almost always be confined to the
+#     post-installation script, and should be protected with a conditional
+#     so that unnecessary prompting doesn't happen if a package's
+#     installation fails and the `postinst' is called with `abort-upgrade',
+#     `abort-remove' or `abort-deconfigure'.
+
+case "$1" in
+    configure)
+        update-alternatives --quiet --install /usr/bin/pager pager \
+	    /usr/bin/less 77 --slave /usr/share/man/man1/pager.1.gz \
+	    pager.1.gz /usr/share/man/man1/less.1.gz
+    ;;
+
+    abort-upgrade|abort-remove|abort-deconfigure)
+
+    ;;
+
+    *)
+        echo "postinst called with unknown argument \`$1'" >&2
+        exit 0
+    ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
+
+
--- less-358.orig/debian/prerm
+++ less-358/debian/prerm
@@ -0,0 +1,37 @@
+#! /bin/sh
+# prerm script for less
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+#        * <prerm> `remove'
+#        * <old-prerm> `upgrade' <new-version>
+#        * <new-prerm> `failed-upgrade' <old-version>
+#        * <conflictor's-prerm> `remove' `in-favour' <package> <new-version>
+#        * <deconfigured's-prerm> `deconfigure' `in-favour'
+#          <package-being-installed> <version> `removing'
+#          <conflicting-package> <version>
+# for details, see /usr/doc/packaging-manual/
+
+case "$1" in
+    remove)
+	update-alternatives --quiet --remove pager /usr/bin/less
+        ;;
+    upgrade|failed-upgrade|deconfigure)
+        ;;
+    *)
+        echo "prerm called with unknown argument \`$1'" >&2
+        exit 0
+    ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
+
+
--- less-358.orig/debian/mime
+++ less-358/debian/mime
@@ -0,0 +1,3 @@
+text/plain; less '%s'; needsterminal; priority=8
+text/*; less '%s'; needsterminal; priority=2
+*/*; less '%s'; needsterminal; priority=0
--- less-358.orig/debian/docs
+++ less-358/debian/docs
@@ -0,0 +1 @@
+debian/LESSOPEN
--- less-358.orig/debian/lessecho.1
+++ less-358/debian/lessecho.1
@@ -0,0 +1,42 @@
+.TH LESSECHO 1
+.\" NAME should be all caps, SECTION should be 1-8, maybe w/ subsection
+.\" other parms are allowed: see man(7), man(1)
+.SH NAME
+lessecho \- expand metacharacters, such as * and ?, in filenames on Unix
+systems.
+.SH SYNOPSIS
+.B lessecho
+.I "[-ox] [-cx] [-pn] [-dn] [-a] file ..."
+.SH "DESCRIPTION"
+This manual page documents briefly the
+.BR lessecho
+command.
+This manual page was written for the Debian GNU/Linux distribution
+because the original program does not have a manual page.
+.PP
+.B lessecho
+is a program that simply echos its filename arguments on standard output. But
+any argument containing spaces is enclosed in quotes.
+.SH OPTIONS
+A summary of options are included below.
+.TP
+.B \-ox
+Specifies "x" to be the open quote character.
+.TP
+.B \-cx
+Specifies "x" to be the close quote character.
+.TP
+.B \-pn
+Specifies "n" to be the open quote character, as an integer.
+.TP
+.B \-dn
+Specifies "n" to be the close quote character, as an integer.
+.TP
+.B \-a
+Specifies that all arguments are to be quoted. The default is that only
+arguments containing spaces are quoted.
+.SH "SEE ALSO"
+less(1)
+.SH AUTHOR
+This manual page was written by Thomas Schoepf <schoepf@debian.org>,
+for the Debian GNU/Linux system (but may be used by others).
--- less-358.orig/debian/lesspipe.1
+++ less-358/debian/lesspipe.1
@@ -0,0 +1,135 @@
+.TH LESSOPEN 1
+.\" NAME should be all caps, SECTION should be 1-8, maybe w/ subsection
+.\" other parms are allowed: see man(7), man(1)
+.SH NAME
+lessfile, lesspipe \- "input preprocessor" for  less.
+.SH SYNOPSIS
+.B lessfile, lesspipe
+.SH "DESCRIPTION"
+This manual page documents briefly the
+.IR lessfile ,
+and
+.I lesspipe
+commands.
+This manual page was written for the Debian GNU/Linux distribution
+because the input preprocessor scripts are provided by Debian GNU/Linux and
+are not part of the original program.
+.PP
+.I lessfile
+and
+.I lesspipe
+are programs that can be used to modify the way the contents of a file are
+displayed in
+.I less.
+What this means is that
+.I less
+can automatically open
+up tar files, uncompress gzipped files, and even display something reasonable
+for graphics files.
+.PP
+.I lesspipe
+will toss the contents/info on STDOUT and
+.I less
+will read them
+as they come across.  This means that you do not have to wait for the
+decoding to finish before less shows you the file.  This also means that
+you will get a 'byte N' instead of an N% as your file position.  You can
+seek to the end and back to get the N% but that means you have to wait
+for the pipe to finish.
+.PP
+.I lessfile
+will toss the contents/info on a file which
+.I less
+will then
+read.  After you are done,
+.I lessfile
+will then delete the file.  This means that the process has to finish before
+you see it, but you get nice percentages (N%) up front.
+.
+.SH USAGE
+Just put one of the following two commands in your login script (e.g.
+~/.bash_profile):
+.PP
+.I eval $(lessfile)
+or
+.I eval $(lesspipe)
+.SH USER DEFINED FILTERS
+It is possible to extend and overwrite the default
+.I lesspipe
+and
+.I lessfile
+input processor if you have specialized requirements. Create an executable
+program with the name
+.I .lessfilter
+and put it into your home directory. This can be a shell script or a binary
+program.
+
+.PP
+It is important that this program returns the correct exit code: return 0 if
+your filter handles the input, return 1 if the standard
+.I lesspipe/lessfile
+filter should handle the input.
+
+.PP
+Here is an example script:
+
+.DS
+  #!/bin/sh
+
+  case "$1" in
+      *.extension)
+          extension-handler "$1"
+          ;;
+      *)
+          # We don't handle this format.
+          exit 1
+  esac
+
+  # No further processing by lesspipe necessary
+  exit 0
+.DE
+
+.SH FILES
+.TP
+.I ~/.lessfilter
+Executable file that can do user defined processing. See section USER DEFINED
+FILTERS for more information.
+.SH BUGS
+When trying to open compressed 0 byte files,
+.I less
+displays the actual binary file contents. This is not a bug.
+.I less
+is designed to do that (see manual page less(1), section INPUT PREPROCESSOR).
+This is the answer of Mark Nudelman <marknu@flash.net>:
+.IP
+"I recognized when I designed it that a
+lesspipe filter cannot output an empty file and have less display
+nothing in that case; it's a side effect of using the "no output" case
+to mean "the filter has nothing to do".  It could have been designed to
+have some other mechanism to indicate "nothing to do", but "no output"
+seemed the simplest and most intuitive for lesspipe writers."
+
+.PP
+Sometimes, less does not display the contents file you want to view but output
+that is produced by your login scripts (~/.bashrc or ~/.bash_profile). This
+happens because less uses your current shell to run the lesspipe filter. Bash
+first looks for the variable $BASH_ENV in the environment expands its value
+and  uses the expanded value as the name of a file to read and execute. If
+this file produces any output less will display this. A way to solve this
+problem is to put the following lines on the top of your login script that
+produces output:
+
+.DS
+  if [ -z "$PS1" ]; then
+      exit
+  fi
+.DE
+
+This tests whether the prompt variable $PS1 is set and if it isn't (which is
+the case for non-interactive shells) it will exit the script.
+.SH "SEE ALSO"
+less(1)
+.SH AUTHOR
+This manual page was written by Thomas Schoepf <schoepf@debian.org>,
+for the Debian GNU/Linux system (but may be used by others). Most of the
+text was copied from a description written by Darren Stalder <torin@daft.com>.
--- less-358.orig/debian/control
+++ less-358/debian/control
@@ -0,0 +1,19 @@
+Source: less
+Section: text
+Priority: standard
+Maintainer: Thomas Schoepf <schoepf@debian.org>
+Build-Depends: debhelper (>= 2.0), libncurses-dev
+Standards-Version: 3.2.0
+
+Package: less
+Architecture: any
+Depends: ${shlibs:Depends}, debianutils (>= 1.8)
+Description: A file pager program, similar to more(1)
+ Less is a program similar to more (1), but which allows backward
+ movement in the file as well as forward movement.  Also, less does not
+ have to read the entire input file before starting, so with large input
+ files it starts up faster than text editors like vi (1).  Less uses
+ termcap (or terminfo on some systems), so it can run on a variety of
+ terminals.  There is even limited support for hardcopy terminals.
+ .
+ Homepage: http://www.flash.net/~marknu/less/
--- less-358.orig/debian/rules
+++ less-358/debian/rules
@@ -0,0 +1,83 @@
+#!/usr/bin/make -f
+#-*- makefile -*-
+# Made with the aid of dh_make, by Craig Small
+# Sample debian/rules that uses debhelper. GNU copyright 1997 by Joey Hess.
+# Some lines taken from debmake, by Christoph Lameter.
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+# This is the debhelper compatibility version to use.
+export DH_COMPAT=2
+
+build: build-stamp
+build-stamp:
+	dh_testdir
+
+	./configure --prefix=/usr --mandir=`pwd`/debian/`dh_listpackages`/usr/share/man \
+		--with-editor=/usr/bin/editor
+	# Add here commands to compile the package.
+	$(MAKE) CFLAGS="-O2"
+
+	touch build-stamp
+
+clean:
+	dh_testdir
+	dh_testroot
+	rm -f build-stamp
+
+	# Add here commands to clean up after the build process.
+	-$(MAKE) distclean
+
+	dh_clean
+
+install: build
+	dh_testdir
+	dh_testroot
+	dh_clean -k
+	dh_installdirs
+
+	# Add here commands to install the package into debian/tmp.
+	$(MAKE) install prefix=`pwd`/debian/`dh_listpackages`/usr
+	install -m 0755 debian/lessopen `pwd`/debian/`dh_listpackages`/usr/bin/lesspipe
+	ln -s lesspipe `pwd`/debian/`dh_listpackages`/usr/bin/lessfile
+	ln -s lesspipe.1.gz `pwd`/debian/`dh_listpackages`/usr/share/man/man1/lessfile.1.gz
+
+# Build architecture-independent files here.
+binary-indep: build install
+# We have nothing to do by default.
+
+# Build architecture-dependent files here.
+binary-arch: build install
+	dh_testversion 2
+	dh_testdir
+	dh_testroot
+	dh_installdocs
+	dh_installexamples
+	dh_installmenu
+#	dh_installemacsen
+#	dh_installinit
+	dh_installmime
+	dh_installcron
+	dh_installmanpages
+	#dh_undocumented
+	dh_installchangelogs NEWS
+	dh_link
+	dh_strip
+	dh_compress
+	dh_fixperms
+	# You may want to make some executables suid here
+	dh_suidregister
+#	dh_makeshlibs
+	dh_installdeb
+#	dh_perl 
+	dh_shlibdeps
+	dh_gencontrol
+	dh_md5sums
+	dh_builddeb
+
+source diff:                                                                  
+	@echo >&2 'source and diff are obsolete - use dpkg-source -b'; false
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary
