* [gentoo-commits] repo/gentoo:master commit in: sys-apps/less/files/
@ 2016-04-06 22:09 Mike Frysinger
0 siblings, 0 replies; 13+ messages in thread
From: Mike Frysinger @ 2016-04-06 22:09 UTC (permalink / raw
To: gentoo-commits
commit: 701215724afae290d5cab3ce63bb5805673738f6
Author: Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Wed Apr 6 21:45:29 2016 +0000
Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Wed Apr 6 22:09:25 2016 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=70121572
sys-apps/less: lesspipe: handle all non-regular files in main code
sys-apps/less/files/lesspipe.sh | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/sys-apps/less/files/lesspipe.sh b/sys-apps/less/files/lesspipe.sh
index d659e39..c0f30e3 100755
--- a/sys-apps/less/files/lesspipe.sh
+++ b/sys-apps/less/files/lesspipe.sh
@@ -59,6 +59,15 @@ lesspipe() {
[[ ${match} == *.${ignore} ]] && exit 0
done
+ # Handle non-regular file types.
+ if [[ -d $1 ]] ; then
+ ls -alF -- "$1"
+ return
+ elif [[ ! -f $1 ]] ; then
+ stat "$1"
+ return
+ fi
+
case "${match}" in
### Doc files ###
@@ -234,14 +243,12 @@ lesspipe() {
if [[ -z $1 ]] ; then
echo "Usage: lesspipe <file>"
elif [[ $1 == "-V" || $1 == "--version" ]] ; then
- Id="cvsid"
cat <<-EOF
- $Id$
- Copyright 2001-2013 Gentoo Foundation
+ lesspipe (git)
+ Copyright 2001-2016 Gentoo Foundation
Mike Frysinger <vapier@gentoo.org>
(with plenty of ideas stolen from other projects/distros)
-
EOF
less -V
elif [[ $1 == "-h" || $1 == "--help" ]] ; then
@@ -265,8 +272,6 @@ elif [[ $1 == "-h" || $1 == "--help" ]] ; then
Run 'less --help' or 'man less' for more info.
EOF
-elif [[ -d $1 ]] ; then
- ls -alF -- "$1"
else
recur=0
[[ -n ${LESSDEBUG} ]] \
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sys-apps/less/files/
@ 2016-04-06 22:09 Mike Frysinger
0 siblings, 0 replies; 13+ messages in thread
From: Mike Frysinger @ 2016-04-06 22:09 UTC (permalink / raw
To: gentoo-commits
commit: 1baf50e0e76740f88f997e71e8bdfe2fb35be830
Author: Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Wed Apr 6 21:10:38 2016 +0000
Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Wed Apr 6 22:09:25 2016 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1baf50e0
sys-apps/less: lesspipe: improve help text a bit
sys-apps/less/files/lesspipe.sh | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/sys-apps/less/files/lesspipe.sh b/sys-apps/less/files/lesspipe.sh
old mode 100644
new mode 100755
index 6edaa3c..d659e39
--- a/sys-apps/less/files/lesspipe.sh
+++ b/sys-apps/less/files/lesspipe.sh
@@ -251,18 +251,19 @@ elif [[ $1 == "-h" || $1 == "--help" ]] ; then
Usage: lesspipe <file>
lesspipe specific settings:
- LESSCOLOR env - toggle colorizing of output (no/yes/always)
+ LESSCOLOR env - toggle colorizing of output (no/yes/always; default: no)
LESSCOLORIZER env - program used to colorize output (default: code2color)
LESSIGNORE - list of extensions to ignore (don't do anything fancy)
You can create per-user filters as well by creating the executable file:
~/.lessfilter
- One argument is passed to it: the file to display.
+ One argument is passed to it: the file to display. The script should exit 0
+ to indicate it handled the file, or non-zero to tell lesspipe to handle it.
To use lesspipe, simply add to your environment:
export LESSOPEN="|lesspipe %s"
- Run 'less --help' or 'man less' for more info
+ Run 'less --help' or 'man less' for more info.
EOF
elif [[ -d $1 ]] ; then
ls -alF -- "$1"
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sys-apps/less/files/
@ 2016-04-06 22:21 Mike Frysinger
0 siblings, 0 replies; 13+ messages in thread
From: Mike Frysinger @ 2016-04-06 22:21 UTC (permalink / raw
To: gentoo-commits
commit: c1af53561c8f8bdf253f46c6b9e442fd457c5a45
Author: Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Wed Apr 6 22:16:35 2016 +0000
Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Wed Apr 6 22:20:05 2016 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c1af5356
sys-apps/less: lesspipe: split pdf/ps handling #477860
sys-apps/less/files/lesspipe.sh | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/sys-apps/less/files/lesspipe.sh b/sys-apps/less/files/lesspipe.sh
index c0f30e3..291d6d6 100755
--- a/sys-apps/less/files/lesspipe.sh
+++ b/sys-apps/less/files/lesspipe.sh
@@ -99,7 +99,8 @@ lesspipe() {
esac
;;
*.dvi) dvi2tty "$1" ;;
- *.ps|*.pdf) ps2ascii "$1" || pstotext "$1" || pdftotext "$1" ;;
+ *.ps) ps2ascii "$1" || pstotext "$1" ;;
+ *.pdf) pdftotext "$1" - || ps2ascii "$1" || pstotext "$1" ;;
*.doc) antiword "$1" || catdoc "$1" ;;
*.rtf) unrtf --nopict --text "$1" ;;
*.conf|*.txt|*.log) ;; # force less to work on these directly #150256
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sys-apps/less/files/
@ 2016-07-20 4:37 Mike Frysinger
0 siblings, 0 replies; 13+ messages in thread
From: Mike Frysinger @ 2016-07-20 4:37 UTC (permalink / raw
To: gentoo-commits
commit: 4f718fab3559f68a5ce168efcca8692f3b202260
Author: Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Wed Jul 20 04:34:41 2016 +0000
Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Wed Jul 20 04:34:48 2016 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4f718fab
sys-apps/less: make image info more verbose/robust
sys-apps/less/files/lesspipe.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sys-apps/less/files/lesspipe.sh b/sys-apps/less/files/lesspipe.sh
index 291d6d6..abd9349 100755
--- a/sys-apps/less/files/lesspipe.sh
+++ b/sys-apps/less/files/lesspipe.sh
@@ -162,7 +162,7 @@ lesspipe() {
### Media ###
*.bmp|*.gif|*.jpeg|*.jpg|*.ico|*.pcd|*.pcx|*.png|*.ppm|*.tga|*.tiff|*.tif|*.webp)
- identify "$1" || file -L -- "$1"
+ identify -verbose -- "$1" || file -L -- "$1"
;;
*.asf|*.avi|*.mov|*.mp4|*.mpeg|*.mpg|*.qt|*.ram|*.rm|*.webm|*.wmv)
midentify "$1" || file -L -- "$1"
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sys-apps/less/files/
@ 2017-05-16 19:10 Mike Frysinger
0 siblings, 0 replies; 13+ messages in thread
From: Mike Frysinger @ 2017-05-16 19:10 UTC (permalink / raw
To: gentoo-commits
commit: e313247685a3b161ee0374efddc4f4d899d7769a
Author: Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Tue May 16 19:06:18 2017 +0000
Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Tue May 16 19:10:32 2017 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e3132476
sys-apps/less: add flv & mkv to video list
sys-apps/less/files/lesspipe.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sys-apps/less/files/lesspipe.sh b/sys-apps/less/files/lesspipe.sh
index abd934905ad..66078850cbd 100755
--- a/sys-apps/less/files/lesspipe.sh
+++ b/sys-apps/less/files/lesspipe.sh
@@ -164,7 +164,7 @@ lesspipe() {
*.bmp|*.gif|*.jpeg|*.jpg|*.ico|*.pcd|*.pcx|*.png|*.ppm|*.tga|*.tiff|*.tif|*.webp)
identify -verbose -- "$1" || file -L -- "$1"
;;
- *.asf|*.avi|*.mov|*.mp4|*.mpeg|*.mpg|*.qt|*.ram|*.rm|*.webm|*.wmv)
+ *.asf|*.avi|*.flv|*.mkv|*.mov|*.mp4|*.mpeg|*.mpg|*.qt|*.ram|*.rm|*.webm|*.wmv)
midentify "$1" || file -L -- "$1"
;;
*.mp3) mp3info "$1" || id3info "$1" ;;
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sys-apps/less/files/
@ 2017-10-20 7:45 Patrice Clement
0 siblings, 0 replies; 13+ messages in thread
From: Patrice Clement @ 2017-10-20 7:45 UTC (permalink / raw
To: gentoo-commits
commit: 7826fd7cae3c25f4fd8311ae3c8fc8b235dfd822
Author: Michael Mair-Keimberger <m.mairkeimberger <AT> gmail <DOT> com>
AuthorDate: Tue Oct 10 13:38:43 2017 +0000
Commit: Patrice Clement <monsieurp <AT> gentoo <DOT> org>
CommitDate: Fri Oct 20 07:45:10 2017 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7826fd7c
sys-apps/less: remove unused patch.
sys-apps/less/files/code2color-0.2.patch | 26 --------------------------
1 file changed, 26 deletions(-)
diff --git a/sys-apps/less/files/code2color-0.2.patch b/sys-apps/less/files/code2color-0.2.patch
deleted file mode 100644
index f8a782504e6..00000000000
--- a/sys-apps/less/files/code2color-0.2.patch
+++ /dev/null
@@ -1,26 +0,0 @@
---- code2color
-+++ code2color
-@@ -163,11 +163,11 @@
- # building up the database
- # newer entries overwrite old ones
- my @CONFIG_FILES;
-- push @CONFIG_FILES, "/etc/code2html.config";
-+ push @CONFIG_FILES, "/etc/code2color";
- push @CONFIG_FILES,
-- $ENV{'HOME'}."/.code2html.config" if $ENV{'HOME'};
-+ $ENV{'HOME'}."/.code2color" if $ENV{'HOME'};
- push @CONFIG_FILES,
-- split(/:/,$ENV{'CODE2HTML_CONFIG'}) if $ENV{'CODE2HTML_CONFIG'};
-+ split(/:/,$ENV{'CODE2COLOR_CONFIG'}) if $ENV{'CODE2COLOR_CONFIG'};
- push @CONFIG_FILES,
- split(/:/,$params{'langfile'}) if $params{'langfile'};
-
-@@ -3192,7 +3192,7 @@
- #
-
- $LANGUAGE{'shellscript'} = {
-- 'filename' => '\\.(sh|shell)$',
-+ 'filename' => '\\.(ebuild|eclass|sh|shell)$',
- 'regex' => '^\\s*#\\s*![^\\s]*(sh|bash|ash|zsh|ksh)',
- 'patterns' => [ {
- 'name' => 'comment',
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sys-apps/less/files/
@ 2018-10-31 8:06 Lars Wendler
0 siblings, 0 replies; 13+ messages in thread
From: Lars Wendler @ 2018-10-31 8:06 UTC (permalink / raw
To: gentoo-commits
commit: 26a5b316bf32ff5c636c2ed381d717d3d09ebc41
Author: Michael Mair-Keimberger <m.mairkeimberger <AT> gmail <DOT> com>
AuthorDate: Sun Sep 30 12:55:32 2018 +0000
Commit: Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
CommitDate: Wed Oct 31 08:06:10 2018 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=26a5b316
sys-apps/less: remove obsolete file
Signed-off-by: Michael Mair-Keimberger <m.mairkeimberger <AT> gmail.com>
Signed-off-by: Lars Wendler <polynomial-c <AT> gentoo.org>
sys-apps/less/files/README.Gentoo | 22 ----------------------
1 file changed, 22 deletions(-)
diff --git a/sys-apps/less/files/README.Gentoo b/sys-apps/less/files/README.Gentoo
deleted file mode 100644
index dca832808f1..00000000000
--- a/sys-apps/less/files/README.Gentoo
+++ /dev/null
@@ -1,22 +0,0 @@
-This version of less comes with some Gentoo enhancements:
- - default lesspipe.sh script to "view" files
- - colorization support
-
-To see what file types are supported, just read the /usr/bin/lesspipe.sh
-script (it's just a plain text bash script).
-
-Colorization support is disabled by default. To enable it, export the
-LESSCOLOR variable to "yes":
- $ export LESSCOLOR=yes
-
-We also provide a colorization script, 'code2color', that is used by
-default. If you wish to use another script, simply export the LESSCOLORIZER
-variable to name of the script:
- $ export LESSCOLORIZER=some-other-script
-
-If you want to use the code2color script and the default color schemes are
-not acceptable, you can develop your own schemes and save them in one of
-the following places:
- /etc/code2color
- ~/.code2color
- CODE2COLOR_CONFIG env var
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sys-apps/less/files/
@ 2019-09-15 7:53 Mike Frysinger
0 siblings, 0 replies; 13+ messages in thread
From: Mike Frysinger @ 2019-09-15 7:53 UTC (permalink / raw
To: gentoo-commits
commit: 741f5ec1e6d6668a9e51d292cc5c1e34a4f905c2
Author: Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Sun Sep 15 07:46:01 2019 +0000
Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Sun Sep 15 07:50:59 2019 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=741f5ec1
sys-apps/less: lesspipe: minor improvements
* Add/update copyright/license headers.
* Test whether LESSDEBUG is set rather than its value
* Fix `stat` usage on pseudo paths (e.g. URIs) & names that start with -
* Add a .json print handler via python
* Process https:// URIs like http://
* Try elinks in addition to & before other CLI browsers
* Tweak quoting in a few places as shellcheck highlighted
* Check $# -eq 0 so we don't treat "" as missing arguments
* Don't run lesspipe twice when it fails & LESSDEBUG is enabled
Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org>
sys-apps/less/files/lesspipe.sh | 29 ++++++++++++++++-------------
1 file changed, 16 insertions(+), 13 deletions(-)
diff --git a/sys-apps/less/files/lesspipe.sh b/sys-apps/less/files/lesspipe.sh
index 66078850cbd..68ec0f67926 100755
--- a/sys-apps/less/files/lesspipe.sh
+++ b/sys-apps/less/files/lesspipe.sh
@@ -1,11 +1,13 @@
#!/bin/bash
-#
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
# Preprocessor for 'less'. Used when this environment variable is set:
# LESSOPEN="|lesspipe %s"
# TODO: handle compressed files better
-[[ -n ${LESSDEBUG} ]] && set -x
+[[ -n ${LESSDEBUG+set} ]] && set -x
trap 'exit 0' PIPE
@@ -64,8 +66,9 @@ lesspipe() {
ls -alF -- "$1"
return
elif [[ ! -f $1 ]] ; then
- stat "$1"
- return
+ # Only return if the stat passes. This is needed to handle pseudo
+ # arguments like URIs.
+ stat -- "$1" && return
fi
case "${match}" in
@@ -104,10 +107,11 @@ lesspipe() {
*.doc) antiword "$1" || catdoc "$1" ;;
*.rtf) unrtf --nopict --text "$1" ;;
*.conf|*.txt|*.log) ;; # force less to work on these directly #150256
+ *.json) python -mjson.tool "$1" ;;
### URLs ###
- ftp://*|http://*|*.htm|*.html)
- for b in links2 links lynx ; do
+ ftp://*|http://*|https://|*.htm|*.html)
+ for b in elinks links2 links lynx ; do
${b} -dump "$1" && exit 0
done
html2text -style pretty "$1"
@@ -120,7 +124,7 @@ lesspipe() {
*.tar.lzma|*.tar.xz)
${DECOMPRESSOR} -- "$1" | tar tvvf -;;
*.tbz2|*.tbz|*.tgz|*.tlz|*.txz)
- lesspipe "$1" "$1".tar.${1##*.t} ;;
+ lesspipe "$1" "$1.tar.${1##*.t}" ;;
### Misc archives ###
*.bz2|\
@@ -207,7 +211,7 @@ lesspipe() {
*)
case $(( recur++ )) in
# Maybe we didn't match due to case issues ...
- 0) lesspipe "$1" "$(echo $1 | LC_ALL=C tr '[:upper:]' '[:lower:]')" ;;
+ 0) lesspipe "$1" "$(echo "$1" | LC_ALL=C tr '[:upper:]' '[:lower:]')" ;;
# Maybe we didn't match because the file is named weird ...
1) lesspipe_file "$1" ;;
@@ -241,12 +245,12 @@ lesspipe() {
esac
}
-if [[ -z $1 ]] ; then
+if [[ $# -eq 0 ]] ; then
echo "Usage: lesspipe <file>"
elif [[ $1 == "-V" || $1 == "--version" ]] ; then
cat <<-EOF
lesspipe (git)
- Copyright 2001-2016 Gentoo Foundation
+ Copyright 1999-2019 Gentoo Authors
Mike Frysinger <vapier@gentoo.org>
(with plenty of ideas stolen from other projects/distros)
@@ -275,7 +279,6 @@ elif [[ $1 == "-h" || $1 == "--help" ]] ; then
EOF
else
recur=0
- [[ -n ${LESSDEBUG} ]] \
- && lesspipe "$1" \
- || lesspipe "$1" 2> /dev/null
+ [[ -z ${LESSDEBUG+set} ]] && exec 2>/dev/null
+ lesspipe "$1"
fi
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sys-apps/less/files/
@ 2019-09-19 15:13 Mike Gilbert
0 siblings, 0 replies; 13+ messages in thread
From: Mike Gilbert @ 2019-09-19 15:13 UTC (permalink / raw
To: gentoo-commits
commit: 673cb21b8bbfe49bd13a7be8257c74e534779a71
Author: Mike Gilbert <floppym <AT> gentoo <DOT> org>
AuthorDate: Thu Sep 19 15:13:11 2019 +0000
Commit: Mike Gilbert <floppym <AT> gentoo <DOT> org>
CommitDate: Thu Sep 19 15:13:11 2019 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=673cb21b
sys-apps/less: chmod -x files/lesspipe.sh
Closes: https://bugs.gentoo.org/694874
Package-Manager: Portage-2.3.75_p7, Repoman-2.3.17_p49
Signed-off-by: Mike Gilbert <floppym <AT> gentoo.org>
sys-apps/less/files/lesspipe.sh | 0
1 file changed, 0 insertions(+), 0 deletions(-)
diff --git a/sys-apps/less/files/lesspipe.sh b/sys-apps/less/files/lesspipe.sh
old mode 100755
new mode 100644
^ permalink raw reply [flat|nested] 13+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sys-apps/less/files/
@ 2020-09-13 20:43 James Le Cuirot
0 siblings, 0 replies; 13+ messages in thread
From: James Le Cuirot @ 2020-09-13 20:43 UTC (permalink / raw
To: gentoo-commits
commit: d4fa1ffef9503e2a5f7f1151ffba5892a4049b24
Author: James Le Cuirot <chewi <AT> gentoo <DOT> org>
AuthorDate: Sun Sep 13 20:41:58 2020 +0000
Commit: James Le Cuirot <chewi <AT> gentoo <DOT> org>
CommitDate: Sun Sep 13 20:42:51 2020 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d4fa1ffe
sys-apps/less: Fix lesspipe handling of *.arj archives
unarj is being last-rited so prefer arj. The way unarj was being
called was also broken for years.
Bug: https://bugs.gentoo.org/694746
Package-Manager: Portage-3.0.6, Repoman-3.0.1
Signed-off-by: James Le Cuirot <chewi <AT> gentoo.org>
sys-apps/less/files/lesspipe.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sys-apps/less/files/lesspipe.sh b/sys-apps/less/files/lesspipe.sh
index 68ec0f67926..a393de07ec7 100644
--- a/sys-apps/less/files/lesspipe.sh
+++ b/sys-apps/less/files/lesspipe.sh
@@ -1,5 +1,5 @@
#!/bin/bash
-# Copyright 1999-2019 Gentoo Authors
+# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# Preprocessor for 'less'. Used when this environment variable is set:
@@ -135,7 +135,7 @@ lesspipe() {
*.cpi|*.cpio) cpio -itv < "$1" ;;
*.ace) unace l "$1" ;;
*.arc) arc v "$1" ;;
- *.arj) unarj l -- "$1" ;;
+ *.arj) arj l -- "$1" || unarj l "$1" ;;
*.cab) cabextract -l -- "$1" ;;
*.lha|*.lzh) lha v "$1" ;;
*.zoo) zoo -list "$1" || unzoo -l "$1" ;;
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sys-apps/less/files/
@ 2023-12-31 2:38 Conrad Kostecki
0 siblings, 0 replies; 13+ messages in thread
From: Conrad Kostecki @ 2023-12-31 2:38 UTC (permalink / raw
To: gentoo-commits
commit: faec8c28c79c6f7a494e785883ef49b29d232495
Author: Michael Mair-Keimberger <mmk <AT> levelnine <DOT> at>
AuthorDate: Fri Dec 29 14:18:03 2023 +0000
Commit: Conrad Kostecki <conikost <AT> gentoo <DOT> org>
CommitDate: Sun Dec 31 02:38:01 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=faec8c28
sys-apps/less: remove unused patch/file
Signed-off-by: Michael Mair-Keimberger <mmk <AT> levelnine.at>
Closes: https://github.com/gentoo/gentoo/pull/34530
Signed-off-by: Conrad Kostecki <conikost <AT> gentoo.org>
sys-apps/less/files/less-633-tinfow.patch | 52 ------
sys-apps/less/files/lesspipe-r2.sh | 291 ------------------------------
2 files changed, 343 deletions(-)
diff --git a/sys-apps/less/files/less-633-tinfow.patch b/sys-apps/less/files/less-633-tinfow.patch
deleted file mode 100644
index 82ea458cd008..000000000000
--- a/sys-apps/less/files/less-633-tinfow.patch
+++ /dev/null
@@ -1,52 +0,0 @@
-https://github.com/gwsw/less/pull/403
-
-From 23000c286773af153a5743bc923465707b87613b Mon Sep 17 00:00:00 2001
-From: Sam James <sam@gentoo.org>
-Date: Mon, 17 Jul 2023 22:58:27 +0100
-Subject: [PATCH] configure.ac: Check for tinfow before tinfo
-
-We currently check for ncursesw > ncurses and then tinfo > tinfow. This means
-we can get a mismatch of ncursesw + tinfo, instead of the correct ncursesw + tinfow.
-
-Swap the order so we check for ncursesw first (before other ncurses variants)
-and then tinfow first (before other tinfo variants).
-
-This is needed anyway for correctness, but also needed for certain terminfos
-to work correctly with recent ncurses.
-
-A better fix would be to use pkg-config first which handles this correctly
-and would include the appropriate -ltinfo* in the libraries list for -lncurses*,
-but not doing that for now.
-
-Bug: https://bugs.gentoo.org/910430
---- a/configure.ac
-+++ b/configure.ac
-@@ -63,10 +63,10 @@ fi
-
- if test $curses_broken = 0; then
-
--# -- Try tinfo.
-+# -- Try tinfow.
- if test "x$TERMLIBS" = x; then
-- if test $have_tinfo = yes; then
-- TERMLIBS="-ltinfo"
-+ if test $have_tinfow = yes; then
-+ TERMLIBS="-ltinfow"
- SAVE_LIBS=$LIBS
- LIBS="$LIBS $TERMLIBS"
- AC_LINK_IFELSE([AC_LANG_PROGRAM([[$include_termcap_h]], [[tgetent(0,0); tgetflag(0); tgetnum(0); tgetstr(0,0);]])],[termok=yes],[termok=no])
-@@ -75,10 +75,10 @@ if test "x$TERMLIBS" = x; then
- fi
- fi
-
--# -- Try tinfow.
-+# -- Try tinfo.
- if test "x$TERMLIBS" = x; then
-- if test $have_tinfow = yes; then
-- TERMLIBS="-ltinfow"
-+ if test $have_tinfo = yes; then
-+ TERMLIBS="-ltinfo"
- SAVE_LIBS=$LIBS
- LIBS="$LIBS $TERMLIBS"
- AC_LINK_IFELSE([AC_LANG_PROGRAM([[$include_termcap_h]], [[tgetent(0,0); tgetflag(0); tgetnum(0); tgetstr(0,0);]])],[termok=yes],[termok=no])
-
diff --git a/sys-apps/less/files/lesspipe-r2.sh b/sys-apps/less/files/lesspipe-r2.sh
deleted file mode 100644
index fc54d5b21306..000000000000
--- a/sys-apps/less/files/lesspipe-r2.sh
+++ /dev/null
@@ -1,291 +0,0 @@
-#!/bin/bash
-# Copyright 1999-2020 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-# Preprocessor for 'less'. Used when this environment variable is set:
-# LESSOPEN="|lesspipe %s"
-
-# TODO: handle compressed files better
-
-[[ -n ${LESSDEBUG+set} ]] && set -x
-
-trap 'exit 0' PIPE
-
-guesscompress() {
- case "$1" in
- *.gz|*.z) echo "gunzip -c" ;;
- *.bz2|*.bz) echo "bunzip2 -c" ;;
- *.lz) echo "lzip -dc" ;;
- *.lzma) echo "unlzma -c" ;;
- *.lzo) echo "lzop -dc" ;;
- *.xz) echo "xzdec" ;;
- *.zst) echo "zstdcat" ;;
- *) echo "cat" ;;
- esac
-}
-
-lesspipe_file() {
- local out=$(file -L -- "$1")
- local suffix
- case ${out} in
- *" 7-zip archive"*) suffix="7z";;
- *" ar archive"*) suffix="a";;
- *" CAB-Installer"*) suffix="cab";;
- *" cpio archive"*) suffix="cpio";;
- *" ELF "*) suffix="elf";;
- *" LHa"*archive*) suffix="lha";;
- *" troff "*) suffix="man";;
- *" script text"*) suffix="sh";;
- *" shared object"*) suffix="so";;
- *" tar archive"*) suffix="tar";;
- *" Zip archive"*) suffix="zip";;
- *": data") hexdump -C -- "$1"; return 0;;
- *) return 1;;
- esac
- lesspipe "$1" ".${suffix}"
- return 0
-}
-
-lesspipe() {
- local match=$2
- [[ -z ${match} ]] && match=$1
-
- local DECOMPRESSOR=$(guesscompress "${match}")
-
- # User filters
- if [[ -x ~/.lessfilter ]] ; then
- ~/.lessfilter "$1" && exit 0
- fi
-
- local ignore
- for ignore in ${LESSIGNORE} ; do
- [[ ${match} == *.${ignore} ]] && exit 0
- done
-
- # Handle non-regular file types.
- if [[ -d $1 ]] ; then
- ls -alF -- "$1"
- return
- elif [[ ! -f $1 ]] ; then
- # Only return if the stat passes. This is needed to handle pseudo
- # arguments like URIs.
- stat -- "$1" && return
- fi
-
- case "${match}" in
-
- ### Doc files ###
- *.[0-9n]|*.man|\
- *.[0-9n].bz2|*.man.bz2|\
- *.[0-9n].gz|*.man.gz|\
- *.[0-9n].lzma|*.man.lzma|\
- *.[0-9n].xz|*.man.xz|\
- *.[0-9n].zst|*.man.zst|\
- *.[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) ps2ascii "$1" || pstotext "$1" ;;
- *.pdf) pdftotext "$1" - || ps2ascii "$1" || pstotext "$1" ;;
- *.doc) antiword "$1" || catdoc "$1" ;;
- *.rtf) unrtf --nopict --text "$1" ;;
- *.conf|*.txt|*.log) ;; # force less to work on these directly #150256
- *.json) python -mjson.tool "$1" ;;
-
- ### URLs ###
- ftp://*|http://*|https://|*.htm|*.html)
- for b in elinks links2 links lynx ; do
- ${b} -dump "$1" && exit 0
- done
- html2text -style pretty "$1"
- ;;
-
- ### Tar files ###
- *.tar|\
- *.tar.bz2|*.tar.bz|*.tar.gz|*.tar.z|*.tar.zst|\
- *.tar.lz|*.tar.tlz|\
- *.tar.lzma|*.tar.xz)
- ${DECOMPRESSOR} -- "$1" | tar tvvf -;;
- *.tbz2|*.tbz|*.tgz|*.tlz|*.txz)
- lesspipe "$1" "$1.tar.${1##*.t}" ;;
-
- ### Misc archives ###
- *.bz2|\
- *.gz|*.z|\
- *.zst|\
- *.lz|\
- *.lzma|*.xz) ${DECOMPRESSOR} -- "$1" ;;
- *.rpm) rpm -qpivl --changelog -- "$1" || rpm2tar -O "$1" | tar tvvf -;;
- *.cpi|*.cpio) cpio -itv < "$1" ;;
- *.ace) unace l "$1" ;;
- *.arc) arc v "$1" ;;
- *.arj) arj l -- "$1" || unarj l "$1" ;;
- *.cab) cabextract -l -- "$1" ;;
- *.lha|*.lzh) lha v "$1" ;;
- *.zoo) zoo -list "$1" || unzoo -l "$1" ;;
- *.7z|*.exe) 7z l -- "$1" || 7za l -- "$1" || 7zr l -- "$1" ;;
- *.a) ar tv "$1" ;;
- *.elf) readelf -a -W -- "$1" ;;
- *.so) readelf -h -d -s -W -- "$1" ;;
- *.mo|*.gmo) msgunfmt -- "$1" ;;
-
- *.rar|.r[0-9][0-9]) unrar l -- "$1" ;;
-
- *.jar|*.war|*.ear|*.xpi|*.zip)
- unzip -v "$1" || miniunzip -l "$1" || miniunz -l "$1" || zipinfo -v "$1"
- ;;
-
- *.deb|*.udeb)
- if type -P dpkg > /dev/null ; then
- dpkg --info "$1"
- dpkg --contents "$1"
- else
- ar tv "$1"
- ar p "$1" data.tar.gz | tar tzvvf -
- fi
- ;;
-
- ### Filesystems ###
- *.squashfs) unsquashfs -s "$1" && unsquashfs -ll "$1" ;;
-
- ### Media ###
- *.bmp|*.gif|*.jpeg|*.jpg|*.ico|*.pcd|*.pcx|*.png|*.ppm|*.tga|*.tiff|*.tif|*.webp)
- identify -verbose -- "$1" || file -L -- "$1"
- ;;
- *.asf|*.avi|*.flv|*.mkv|*.mov|*.mp4|*.mpeg|*.mpg|*.qt|*.ram|*.rm|*.webm|*.wmv)
- midentify "$1" || file -L -- "$1"
- ;;
- *.mp3) mp3info "$1" || id3info "$1" ;;
- *.ogg) ogginfo "$1" ;;
- *.flac) metaflac --list "$1" ;;
- *.torrent) torrentinfo "$1" || torrentinfo-console "$1" || ctorrent -x "$1" ;;
- *.bin|*.cue|*.raw)
- # not all .bin/.raw files are cd images #285507
- # fall back to lesspipe_file if .cue doesn't exist, or if
- # cd-info failed to parse things sanely
- [[ -e ${1%.*}.cue ]] \
- && cd-info --no-header --no-device-info "$1" \
- || lesspipe_file "$1"
- ;;
- *.iso)
- iso_info=$(isoinfo -d -i "$1")
- echo "${iso_info}"
- # Joliet output overrides Rock Ridge, so prefer the better Rock
- case ${iso_info} in
- *$'\n'"Rock Ridge"*) iso_opts="-R";;
- *$'\n'"Joliet"*) iso_opts="-J";;
- *) iso_opts="";;
- esac
- isoinfo -l ${iso_opts} -i "$1"
- ;;
-
- ### Encryption stuff ###
- *.crl) openssl crl -hash -text -noout -in "$1" ;;
- *.csr) openssl req -text -noout -in "$1" ;;
- *.crt|*.pem) openssl x509 -hash -text -noout -in "$1" ;;
-
-# May not be such a good idea :)
-# ### Device nodes ###
-# /dev/[hs]d[a-z]*)
-# fdisk -l "${1:0:8}"
-# [[ $1 == *hd* ]] && hdparm -I "${1:0:8}"
-# ;;
-
- ### Everything else ###
- *)
- case $(( recur++ )) in
- # Maybe we didn't match due to case issues ...
- 0) lesspipe "$1" "$(echo "$1" | LC_ALL=C tr '[:upper:]' '[:lower:]')" ;;
-
- # Maybe we didn't match because the file is named weird ...
- 1) lesspipe_file "$1" ;;
- esac
-
- # So no matches from above ... finally fall back to an external
- # coloring package. No matching here so we don't have to worry
- # about keeping in sync with random packages. Any coloring tool
- # you use should not output errors about unsupported files to
- # stdout. If it does, it's your problem.
-
- # Allow people to flip color off if they dont want it
- case ${LESSCOLOR} in
- always) LESSCOLOR=2;;
- [yY][eE][sS]|[yY]|1|true) LESSCOLOR=1;;
- [nN][oO]|[nN]|0|false) LESSCOLOR=0;;
- *) LESSCOLOR=1;;
- esac
- if [[ ${LESSCOLOR} != "0" ]] && [[ -n ${LESSCOLORIZER=pygmentize} ]] ; then
- # 2: Only colorize if user forces it ...
- # 1: ... or we know less will handle raw codes -- this will
- # not detect -seiRM, so set LESSCOLORIZER yourself
- if [[ ${LESSCOLOR} == "2" ]] || [[ " ${LESS} " == *" -"[rR]" "* ]] ; then
- LESSQUIET=true ${LESSCOLORIZER} "$1"
- fi
- fi
-
- # Nothing left to do but let less deal
- exit 0
- ;;
- esac
-}
-
-if [[ $# -eq 0 ]] ; then
- echo "Usage: lesspipe <file>"
-elif [[ $1 == "-V" || $1 == "--version" ]] ; then
- cat <<-EOF
- lesspipe (git)
- Copyright 1999-2019 Gentoo Authors
- Mike Frysinger <vapier@gentoo.org>
- (with plenty of ideas stolen from other projects/distros)
-
- EOF
- less -V
-elif [[ $1 == "-h" || $1 == "--help" ]] ; then
- cat <<-EOF
- lesspipe: preprocess files before sending them to less
-
- Usage: lesspipe <file>
-
- lesspipe specific settings:
- LESSCOLOR env - toggle colorizing of output (no/yes/always; default: no)
- LESSCOLORIZER env - program used to colorize output (default: pygmentize)
- LESSIGNORE - list of extensions to ignore (don't do anything fancy)
-
- You can create per-user filters as well by creating the executable file:
- ~/.lessfilter
- One argument is passed to it: the file to display. The script should exit 0
- to indicate it handled the file, or non-zero to tell lesspipe to handle it.
-
- To use lesspipe, simply add to your environment:
- export LESSOPEN="|lesspipe %s"
-
- For colorization, install dev-python/pygments for the pygmentize program. Note,
- if using alternative code2color from sys app-text/lesspipe you may run out of
- memory due to #188835.
-
- Run 'less --help' or 'man less' for more info.
- EOF
-else
- recur=0
- [[ -z ${LESSDEBUG+set} ]] && exec 2>/dev/null
- lesspipe "$1"
-fi
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sys-apps/less/files/
@ 2024-03-16 12:13 Conrad Kostecki
0 siblings, 0 replies; 13+ messages in thread
From: Conrad Kostecki @ 2024-03-16 12:13 UTC (permalink / raw
To: gentoo-commits
commit: 3f8b528ee8c3b45d4c4bab2801cd87b849dea7d5
Author: Michael Mair-Keimberger <mmk <AT> levelnine <DOT> at>
AuthorDate: Sat Mar 9 09:44:22 2024 +0000
Commit: Conrad Kostecki <conikost <AT> gentoo <DOT> org>
CommitDate: Sat Mar 16 12:13:23 2024 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3f8b528e
sys-apps/less: remove unused patches
Signed-off-by: Michael Mair-Keimberger <mmk <AT> levelnine.at>
Closes: https://github.com/gentoo/gentoo/pull/35678
Signed-off-by: Conrad Kostecki <conikost <AT> gentoo.org>
sys-apps/less/files/less-608-CVE-2022-46663.patch | 22 -----------
sys-apps/less/files/less-608-procfs.patch | 45 -----------------------
2 files changed, 67 deletions(-)
diff --git a/sys-apps/less/files/less-608-CVE-2022-46663.patch b/sys-apps/less/files/less-608-CVE-2022-46663.patch
deleted file mode 100644
index a358dd6f1a77..000000000000
--- a/sys-apps/less/files/less-608-CVE-2022-46663.patch
+++ /dev/null
@@ -1,22 +0,0 @@
-https://bugs.gentoo.org/893530
-https://github.com/gwsw/less/commit/a78e1351113cef564d790a730d657a321624d79c
-
-From a78e1351113cef564d790a730d657a321624d79c Mon Sep 17 00:00:00 2001
-From: Mark Nudelman <markn@greenwoodsoftware.com>
-Date: Fri, 7 Oct 2022 19:25:46 -0700
-Subject: [PATCH] End OSC8 hyperlink on invalid embedded escape sequence.
-
---- a/line.c
-+++ b/line.c
-@@ -633,8 +633,8 @@ ansi_step(pansi, ch)
- /* Hyperlink ends with \7 or ESC-backslash. */
- if (ch == '\7')
- return ANSI_END;
-- if (pansi->prev_esc && ch == '\\')
-- return ANSI_END;
-+ if (pansi->prev_esc)
-+ return (ch == '\\') ? ANSI_END : ANSI_ERR;
- pansi->prev_esc = (ch == ESC);
- return ANSI_MID;
- }
-
diff --git a/sys-apps/less/files/less-608-procfs.patch b/sys-apps/less/files/less-608-procfs.patch
deleted file mode 100644
index 4f66322b8123..000000000000
--- a/sys-apps/less/files/less-608-procfs.patch
+++ /dev/null
@@ -1,45 +0,0 @@
-From 03f011f219a6d6068c4ccd07dbd8dcd50641ff10 Mon Sep 17 00:00:00 2001
-From: Mark Nudelman <markn@greenwoodsoftware.com>
-Date: Tue, 20 Sep 2022 12:32:30 -0700
-Subject: [PATCH] Fix reading procfs files on Linux: bad detection of
- HAVE_PROCFS.
-
-diff --git a/ch.c b/ch.c
-index bfad09c7..fcf136b9 100644
---- a/ch.c
-+++ b/ch.c
-@@ -28,6 +28,9 @@ extern ino_t curr_ino;
-
- #if HAVE_PROCFS
- #include <sys/statfs.h>
-+#if HAVE_LINUX_MAGIC_H
-+#include <linux/magic.h>
-+#endif
- #endif
-
- typedef POSITION BLOCKNUM;
-diff --git a/configure.ac b/configure.ac
-index f7c64814..b10adce9 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -37,7 +37,7 @@ AC_SEARCH_LIBS([regcmp], [gen intl PW])
-
- # Checks for header files.
- AC_HEADER_STDC
--AC_CHECK_HEADERS([ctype.h errno.h fcntl.h limits.h stdio.h stdlib.h string.h termcap.h termio.h termios.h time.h unistd.h values.h sys/ioctl.h sys/stream.h wctype.h])
-+AC_CHECK_HEADERS([ctype.h errno.h fcntl.h limits.h stdio.h stdlib.h string.h termcap.h termio.h termios.h time.h unistd.h values.h linux/magic.h sys/ioctl.h sys/stream.h wctype.h])
-
- # Checks for typedefs, structures, and compiler characteristics.
- AC_HEADER_STAT
-@@ -271,7 +271,10 @@ AC_TRY_COMPILE([#include <sys/types.h>
- [struct stat s; dev_t dev = s.st_dev; ino_t ino = s.st_ino;],
- [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_STAT_INO)], [AC_MSG_RESULT(no)])
- AC_MSG_CHECKING(for procfs)
--AC_TRY_COMPILE([#include <sys/statfs.h>],
-+AC_TRY_COMPILE([#include <sys/statfs.h>
-+#if HAVE_LINUX_MAGIC_H
-+#include <linux/magic.h>
-+#endif],
- [struct statfs s; s.f_type = PROC_SUPER_MAGIC; (void) fstatfs(0,&s); ],
- [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_PROCFS)], [AC_MSG_RESULT(no)])
-
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sys-apps/less/files/
@ 2024-12-06 23:12 Conrad Kostecki
0 siblings, 0 replies; 13+ messages in thread
From: Conrad Kostecki @ 2024-12-06 23:12 UTC (permalink / raw
To: gentoo-commits
commit: 294ae7e4e6b120f4efd6fc94a3a27b84bbfef327
Author: Michael Mair-Keimberger <mmk <AT> levelnine <DOT> at>
AuthorDate: Mon Nov 25 19:59:20 2024 +0000
Commit: Conrad Kostecki <conikost <AT> gentoo <DOT> org>
CommitDate: Fri Dec 6 23:11:30 2024 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=294ae7e4
sys-apps/less: remove unused file
Signed-off-by: Michael Mair-Keimberger <mmk <AT> levelnine.at>
Signed-off-by: Conrad Kostecki <conikost <AT> gentoo.org>
sys-apps/less/files/lesspipe-r1.sh | 287 -------------------------------------
1 file changed, 287 deletions(-)
diff --git a/sys-apps/less/files/lesspipe-r1.sh b/sys-apps/less/files/lesspipe-r1.sh
deleted file mode 100644
index 9dcfea1d6399..000000000000
--- a/sys-apps/less/files/lesspipe-r1.sh
+++ /dev/null
@@ -1,287 +0,0 @@
-#!/bin/bash
-# Copyright 1999-2020 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-# Preprocessor for 'less'. Used when this environment variable is set:
-# LESSOPEN="|lesspipe %s"
-
-# TODO: handle compressed files better
-
-[[ -n ${LESSDEBUG+set} ]] && set -x
-
-trap 'exit 0' PIPE
-
-guesscompress() {
- case "$1" in
- *.gz|*.z) echo "gunzip -c" ;;
- *.bz2|*.bz) echo "bunzip2 -c" ;;
- *.lz) echo "lzip -dc" ;;
- *.lzma) echo "unlzma -c" ;;
- *.lzo) echo "lzop -dc" ;;
- *.xz) echo "xzdec" ;;
- *.zst) echo "zstdcat" ;;
- *) echo "cat" ;;
- esac
-}
-
-lesspipe_file() {
- local out=$(file -L -- "$1")
- local suffix
- case ${out} in
- *" 7-zip archive"*) suffix="7z";;
- *" ar archive"*) suffix="a";;
- *" CAB-Installer"*) suffix="cab";;
- *" cpio archive"*) suffix="cpio";;
- *" ELF "*) suffix="elf";;
- *" LHa"*archive*) suffix="lha";;
- *" troff "*) suffix="man";;
- *" script text"*) suffix="sh";;
- *" shared object"*) suffix="so";;
- *" tar archive"*) suffix="tar";;
- *" Zip archive"*) suffix="zip";;
- *": data") hexdump -C -- "$1"; return 0;;
- *) return 1;;
- esac
- lesspipe "$1" ".${suffix}"
- return 0
-}
-
-lesspipe() {
- local match=$2
- [[ -z ${match} ]] && match=$1
-
- local DECOMPRESSOR=$(guesscompress "${match}")
-
- # User filters
- if [[ -x ~/.lessfilter ]] ; then
- ~/.lessfilter "$1" && exit 0
- fi
-
- local ignore
- for ignore in ${LESSIGNORE} ; do
- [[ ${match} == *.${ignore} ]] && exit 0
- done
-
- # Handle non-regular file types.
- if [[ -d $1 ]] ; then
- ls -alF -- "$1"
- return
- elif [[ ! -f $1 ]] ; then
- # Only return if the stat passes. This is needed to handle pseudo
- # arguments like URIs.
- stat -- "$1" && return
- fi
-
- case "${match}" in
-
- ### Doc files ###
- *.[0-9n]|*.man|\
- *.[0-9n].bz2|*.man.bz2|\
- *.[0-9n].gz|*.man.gz|\
- *.[0-9n].lzma|*.man.lzma|\
- *.[0-9n].xz|*.man.xz|\
- *.[0-9n].zst|*.man.zst|\
- *.[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) ps2ascii "$1" || pstotext "$1" ;;
- *.pdf) pdftotext "$1" - || ps2ascii "$1" || pstotext "$1" ;;
- *.doc) antiword "$1" || catdoc "$1" ;;
- *.rtf) unrtf --nopict --text "$1" ;;
- *.conf|*.txt|*.log) ;; # force less to work on these directly #150256
- *.json) python -mjson.tool "$1" ;;
-
- ### URLs ###
- ftp://*|http://*|https://|*.htm|*.html)
- for b in elinks links2 links lynx ; do
- ${b} -dump "$1" && exit 0
- done
- html2text -style pretty "$1"
- ;;
-
- ### Tar files ###
- *.tar|\
- *.tar.bz2|*.tar.bz|*.tar.gz|*.tar.z|*.tar.zst|\
- *.tar.lz|*.tar.tlz|\
- *.tar.lzma|*.tar.xz)
- ${DECOMPRESSOR} -- "$1" | tar tvvf -;;
- *.tbz2|*.tbz|*.tgz|*.tlz|*.txz)
- lesspipe "$1" "$1.tar.${1##*.t}" ;;
-
- ### Misc archives ###
- *.bz2|\
- *.gz|*.z|\
- *.zst|\
- *.lz|\
- *.lzma|*.xz) ${DECOMPRESSOR} -- "$1" ;;
- *.rpm) rpm -qpivl --changelog -- "$1" || rpm2tar -O "$1" | tar tvvf -;;
- *.cpi|*.cpio) cpio -itv < "$1" ;;
- *.ace) unace l "$1" ;;
- *.arc) arc v "$1" ;;
- *.arj) arj l -- "$1" || unarj l "$1" ;;
- *.cab) cabextract -l -- "$1" ;;
- *.lha|*.lzh) lha v "$1" ;;
- *.zoo) zoo -list "$1" || unzoo -l "$1" ;;
- *.7z|*.exe) 7z l -- "$1" || 7za l -- "$1" || 7zr l -- "$1" ;;
- *.a) ar tv "$1" ;;
- *.elf) readelf -a -W -- "$1" ;;
- *.so) readelf -h -d -s -W -- "$1" ;;
- *.mo|*.gmo) msgunfmt -- "$1" ;;
-
- *.rar|.r[0-9][0-9]) unrar l -- "$1" ;;
-
- *.jar|*.war|*.ear|*.xpi|*.zip)
- unzip -v "$1" || miniunzip -l "$1" || miniunz -l "$1" || zipinfo -v "$1"
- ;;
-
- *.deb|*.udeb)
- if type -P dpkg > /dev/null ; then
- dpkg --info "$1"
- dpkg --contents "$1"
- else
- ar tv "$1"
- ar p "$1" data.tar.gz | tar tzvvf -
- fi
- ;;
-
- ### Filesystems ###
- *.squashfs) unsquashfs -s "$1" && unsquashfs -ll "$1" ;;
-
- ### Media ###
- *.bmp|*.gif|*.jpeg|*.jpg|*.ico|*.pcd|*.pcx|*.png|*.ppm|*.tga|*.tiff|*.tif|*.webp)
- identify -verbose -- "$1" || file -L -- "$1"
- ;;
- *.asf|*.avi|*.flv|*.mkv|*.mov|*.mp4|*.mpeg|*.mpg|*.qt|*.ram|*.rm|*.webm|*.wmv)
- midentify "$1" || file -L -- "$1"
- ;;
- *.mp3) mp3info "$1" || id3info "$1" ;;
- *.ogg) ogginfo "$1" ;;
- *.flac) metaflac --list "$1" ;;
- *.torrent) torrentinfo "$1" || torrentinfo-console "$1" || ctorrent -x "$1" ;;
- *.bin|*.cue|*.raw)
- # not all .bin/.raw files are cd images #285507
- # fall back to lesspipe_file if .cue doesn't exist, or if
- # cd-info failed to parse things sanely
- [[ -e ${1%.*}.cue ]] \
- && cd-info --no-header --no-device-info "$1" \
- || lesspipe_file "$1"
- ;;
- *.iso)
- iso_info=$(isoinfo -d -i "$1")
- echo "${iso_info}"
- # Joliet output overrides Rock Ridge, so prefer the better Rock
- case ${iso_info} in
- *$'\n'"Rock Ridge"*) iso_opts="-R";;
- *$'\n'"Joliet"*) iso_opts="-J";;
- *) iso_opts="";;
- esac
- isoinfo -l ${iso_opts} -i "$1"
- ;;
-
- ### Encryption stuff ###
- *.crl) openssl crl -hash -text -noout -in "$1" ;;
- *.csr) openssl req -text -noout -in "$1" ;;
- *.crt|*.pem) openssl x509 -hash -text -noout -in "$1" ;;
-
-# May not be such a good idea :)
-# ### Device nodes ###
-# /dev/[hs]d[a-z]*)
-# fdisk -l "${1:0:8}"
-# [[ $1 == *hd* ]] && hdparm -I "${1:0:8}"
-# ;;
-
- ### Everything else ###
- *)
- case $(( recur++ )) in
- # Maybe we didn't match due to case issues ...
- 0) lesspipe "$1" "$(echo "$1" | LC_ALL=C tr '[:upper:]' '[:lower:]')" ;;
-
- # Maybe we didn't match because the file is named weird ...
- 1) lesspipe_file "$1" ;;
- esac
-
- # So no matches from above ... finally fall back to an external
- # coloring package. No matching here so we don't have to worry
- # about keeping in sync with random packages. Any coloring tool
- # you use should not output errors about unsupported files to
- # stdout. If it does, it's your problem.
-
- # Allow people to flip color off if they dont want it
- case ${LESSCOLOR} in
- always) LESSCOLOR=2;;
- [yY][eE][sS]|[yY]|1|true) LESSCOLOR=1;;
- [nN][oO]|[nN]|0|false) LESSCOLOR=0;;
- *) LESSCOLOR=0;; # default to no color #188835
- esac
- if [[ ${LESSCOLOR} != "0" ]] && [[ -n ${LESSCOLORIZER=code2color} ]] ; then
- # 2: Only colorize if user forces it ...
- # 1: ... or we know less will handle raw codes -- this will
- # not detect -seiRM, so set LESSCOLORIZER yourself
- if [[ ${LESSCOLOR} == "2" ]] || [[ " ${LESS} " == *" -"[rR]" "* ]] ; then
- LESSQUIET=true ${LESSCOLORIZER} "$1"
- fi
- fi
-
- # Nothing left to do but let less deal
- exit 0
- ;;
- esac
-}
-
-if [[ $# -eq 0 ]] ; then
- echo "Usage: lesspipe <file>"
-elif [[ $1 == "-V" || $1 == "--version" ]] ; then
- cat <<-EOF
- lesspipe (git)
- Copyright 1999-2019 Gentoo Authors
- Mike Frysinger <vapier@gentoo.org>
- (with plenty of ideas stolen from other projects/distros)
-
- EOF
- less -V
-elif [[ $1 == "-h" || $1 == "--help" ]] ; then
- cat <<-EOF
- lesspipe: preprocess files before sending them to less
-
- Usage: lesspipe <file>
-
- lesspipe specific settings:
- LESSCOLOR env - toggle colorizing of output (no/yes/always; default: no)
- LESSCOLORIZER env - program used to colorize output (default: code2color)
- LESSIGNORE - list of extensions to ignore (don't do anything fancy)
-
- You can create per-user filters as well by creating the executable file:
- ~/.lessfilter
- One argument is passed to it: the file to display. The script should exit 0
- to indicate it handled the file, or non-zero to tell lesspipe to handle it.
-
- To use lesspipe, simply add to your environment:
- export LESSOPEN="|lesspipe %s"
-
- Run 'less --help' or 'man less' for more info.
- EOF
-else
- recur=0
- [[ -z ${LESSDEBUG+set} ]] && exec 2>/dev/null
- lesspipe "$1"
-fi
^ permalink raw reply related [flat|nested] 13+ messages in thread
end of thread, other threads:[~2024-12-06 23:12 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-06 23:12 [gentoo-commits] repo/gentoo:master commit in: sys-apps/less/files/ Conrad Kostecki
-- strict thread matches above, loose matches on Subject: below --
2024-03-16 12:13 Conrad Kostecki
2023-12-31 2:38 Conrad Kostecki
2020-09-13 20:43 James Le Cuirot
2019-09-19 15:13 Mike Gilbert
2019-09-15 7:53 Mike Frysinger
2018-10-31 8:06 Lars Wendler
2017-10-20 7:45 Patrice Clement
2017-05-16 19:10 Mike Frysinger
2016-07-20 4:37 Mike Frysinger
2016-04-06 22:21 Mike Frysinger
2016-04-06 22:09 Mike Frysinger
2016-04-06 22:09 Mike Frysinger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox