summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2005-10-16 21:46:13 +0000
committerMike Frysinger <vapier@gentoo.org>2005-10-16 21:46:13 +0000
commitd83a72b1956ea7f69c27ef9fe4e1402c6d952f53 (patch)
tree4087d0a315d1c5d35f37af582e856eae499fa4f9 /sys-apps
parentBump x86 stable to fix python dependency, bug 109207. (diff)
downloadgentoo-2-d83a72b1956ea7f69c27ef9fe4e1402c6d952f53.tar.gz
gentoo-2-d83a72b1956ea7f69c27ef9fe4e1402c6d952f53.tar.bz2
gentoo-2-d83a72b1956ea7f69c27ef9fe4e1402c6d952f53.zip
Tweak the manpage case in lesspipe.sh to display compressed text files which are named funny #109419.
(Portage version: 2.0.53_rc5)
Diffstat (limited to 'sys-apps')
-rw-r--r--sys-apps/less/ChangeLog9
-rw-r--r--sys-apps/less/files/digest-less-385_p4-r23
-rw-r--r--sys-apps/less/files/lesspipe.sh47
-rw-r--r--sys-apps/less/less-385_p4-r2.ebuild47
4 files changed, 86 insertions, 20 deletions
diff --git a/sys-apps/less/ChangeLog b/sys-apps/less/ChangeLog
index 28826a5b7302..390d33a07f87 100644
--- a/sys-apps/less/ChangeLog
+++ b/sys-apps/less/ChangeLog
@@ -1,6 +1,13 @@
# ChangeLog for sys-apps/less
# Copyright 1999-2005 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/sys-apps/less/ChangeLog,v 1.43 2005/09/17 00:30:23 ciaranm Exp $
+# $Header: /var/cvsroot/gentoo-x86/sys-apps/less/ChangeLog,v 1.44 2005/10/16 21:46:13 vapier Exp $
+
+*less-385_p4-r2 (16 Oct 2005)
+
+ 16 Oct 2005; Mike Frysinger <vapier@gentoo.org> files/lesspipe.sh,
+ +less-385_p4-r2.ebuild:
+ Tweak the manpage case in lesspipe.sh to display compressed text files which
+ are named funny #109419.
17 Sep 2005; Ciaran McCreesh <ciaranm@gentoo.org> ChangeLog:
Converted to UTF-8, fixed encoding screwups
diff --git a/sys-apps/less/files/digest-less-385_p4-r2 b/sys-apps/less/files/digest-less-385_p4-r2
new file mode 100644
index 000000000000..0a9382dd7ac8
--- /dev/null
+++ b/sys-apps/less/files/digest-less-385_p4-r2
@@ -0,0 +1,3 @@
+MD5 2856987228fb140f95d60e311ef3d931 less-385.tar.gz 269752
+MD5 ea0d9670c1e293e2bb752f36f877e43f less-385-cl4.patch.bz2 24444
+MD5 da9d228944dae497d3b92f236bcf7226 code2color 199875
diff --git a/sys-apps/less/files/lesspipe.sh b/sys-apps/less/files/lesspipe.sh
index 62f020441e04..98bf1dd42a09 100644
--- a/sys-apps/less/files/lesspipe.sh
+++ b/sys-apps/less/files/lesspipe.sh
@@ -3,6 +3,8 @@
# Preprocessor for 'less'. Used when this environment variable is set:
# LESSOPEN="|lesspipe.sh %s"
+# TODO: handle compressed files better
+
trap 'exit 0' PIPE
guesscompress() {
@@ -23,37 +25,44 @@ lesspipe_file() {
*" Zip archive"*) lesspipe "$1" ".zip" ;;
*" ELF "*) readelf -a -- "$1" ;;
*": data") hexdump -C -- "$1" ;;
+ *) return 1 ;;
esac
+ return 0
}
lesspipe() {
- local DECOMPRESSOR=""
local match=$2
[[ -z ${match} ]] && match=$1
+ local DECOMPRESSOR=$(guesscompress "$match")
+
case "$match" in
### Doc files ###
*.[0-9n]|*.man|\
*.[0-9n].bz2|*.man.bz2|\
- *.[0-9n].gz|*.man.gz)
- DECOMPRESSOR=$(guesscompress "$match")
- if [[ $($DECOMPRESSOR -- "$1" | file -) == *troff* ]] ; then
- # Need to make sure we pass path to man or it will try
- # to locate "$1" in the man search paths
- if [[ $1 == /* ]] ; then
- man -- "$1"
- else
- man -- "./$1"
- fi
- else
- # We could have matched a library (libc.so.6), so let
- # `file` figure out what the hell this thing is
- case "$match" in
- *.man.gz|*.man.bz2) $DECOMPRESSOR -- "$1";;
- *) lesspipe_file "$1";;
- esac
- fi
+ *.[0-9n].gz|*.man.gz|\
+ *.[0-9][a-z].gz|*.[0-9][a-z].gz)
+ local out=$(${DECOMPRESSOR} -- "$1" | file -)
+ case ${out} in
+ *troff*)
+ # Need to make sure we pass path to man or it will try
+ # to locate "$1" in the man search paths
+ if [[ $1 == /* ]] ; then
+ man -- "$1"
+ else
+ man -- "./$1"
+ fi
+ ;;
+ *text*)
+ ${DECOMPRESSOR} -- "$1"
+ ;;
+ *)
+ # We could have matched a library (libc.so.6), so let
+ # `file` figure out what the hell this thing is
+ lesspipe_file "$1"
+ ;;
+ esac
;;
*.dvi) dvi2tty "$1" ;;
*.ps|*.pdf) ps2ascii "$1" || pstotext "$1" || pdftotext "$1" ;;
diff --git a/sys-apps/less/less-385_p4-r2.ebuild b/sys-apps/less/less-385_p4-r2.ebuild
new file mode 100644
index 000000000000..c3dc75b949e2
--- /dev/null
+++ b/sys-apps/less/less-385_p4-r2.ebuild
@@ -0,0 +1,47 @@
+# Copyright 1999-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-apps/less/less-385_p4-r2.ebuild,v 1.1 2005/10/16 21:46:13 vapier Exp $
+
+inherit eutils
+
+MY_PV=${PV/_p*}
+MY_P=${PN}-${MY_PV}
+PATCH_VER=${PV/_p/-cl}
+DESCRIPTION="Excellent text file viewer"
+HOMEPAGE="http://www.greenwoodsoftware.com/less/ https://gna.org/forum/forum.php?forum_id=715"
+SRC_URI="http://www.greenwoodsoftware.com/less/${MY_P}.tar.gz
+ http://download.gna.org/hpr/less/${MY_PV}/${PATCH_VER}/less-${PATCH_VER}.patch.bz2
+ http://www-zeuthen.desy.de/~friebel/unix/less/code2color"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
+IUSE=""
+
+DEPEND=">=sys-libs/ncurses-5.2"
+PROVIDE="virtual/pager"
+
+S=${WORKDIR}/${MY_P}
+
+src_unpack() {
+ unpack ${MY_P}.tar.gz
+ cd "${S}"
+ epatch "${DISTDIR}"/less-${PATCH_VER}.patch.bz2
+ cp "${DISTDIR}"/code2color "${S}"/
+ epatch "${FILESDIR}"/code2color.patch
+}
+
+src_install() {
+ dobin less lessecho lesskey code2color || die "dobin"
+ newbin "${FILESDIR}"/lesspipe.sh lesspipe.sh || die "newbin"
+
+ # the -R is Needed for groff-1.18 and later ...
+ echo 'LESS="-R -M --shift 5"' > 70less
+ doenvd 70less
+
+ for m in *.nro ; do
+ newman ${m} ${m/nro/1}
+ done
+
+ dodoc NEWS README*
+}