diff options
author | V3n3RiX <venerix@koprulu.sector> | 2024-12-07 02:07:26 +0000 |
---|---|---|
committer | V3n3RiX <venerix@koprulu.sector> | 2024-12-07 02:07:26 +0000 |
commit | 2198f8593ae0312add1bdccb49edfcb935e5f8a6 (patch) | |
tree | 67d79ffd7e91cc3858d188c49a65f46860a9bac7 /sys-apps/less | |
parent | d285f0ab4ab38d4ea1cd0757a465db5f06764e06 (diff) |
gentoo auto-resync : 07:12:2024 - 02:07:26
Diffstat (limited to 'sys-apps/less')
-rw-r--r-- | sys-apps/less/Manifest | 1 | ||||
-rw-r--r-- | sys-apps/less/files/lesspipe-r1.sh | 287 |
2 files changed, 0 insertions, 288 deletions
diff --git a/sys-apps/less/Manifest b/sys-apps/less/Manifest index 4efc6bcd06c3..5943ed53f622 100644 --- a/sys-apps/less/Manifest +++ b/sys-apps/less/Manifest @@ -1,7 +1,6 @@ AUX less-643-LESSOPEN-escape.patch 1296 BLAKE2B 8e2522e56235b84f413a0f43ec4096a7a21cb9b04ede9fa04483ed940f11df2a7662ce5517db1878f04321df218ad7bda36f50aa70744cc7629e24d5ffcb3172 SHA512 52bda4a8dca4574eefc68dab31782e857a6a788c2016bfa8c1c4fd95c1dbfa22acc7f04cfdba5b06b226f1243e67f316a694625fa6d935c6ed09d9665721aa05 AUX less-643-lesstest-pkg-config.patch 1483 BLAKE2B 2c0fb65721c2b1c5af74a4fd516d9255059e9aeba7eb91de8aff9d6b35fe708fe275bdde9df6047b6bf4c79534c8410cb946be436a35fe21ce254c87235c6908 SHA512 b6d9911efb20da00f28ceebd922c7f97f7957f964ccb2c50187a52019b35dffaa1e2a7a76cf846ca9f76100af5b2fa38468fb5d49bab9a6b6b02747da2c8f76b AUX less.envd 47 BLAKE2B 4ebc9242c96918c6942b05f67a9be541c6c535c23072e89e36c376e690cb7df9528e1734514092a6afdd3d4f47db45c6186a8cce5d9eb18ca7c73a01800f35fc SHA512 261b25887b08b3255e412b36130d014fc37ffc7de75dce3b5ba2521d94a1b0be4c584808b9698c30a8dafea70c62fae2cd0642d0983f96cdb418c3c501433674 -AUX lesspipe-r1.sh 8135 BLAKE2B f11727136a5235f07ad86c1811c5ef8489a48fc3d032b8840bc67eda70e1800f03505a534870a0ba73aa62e4df4315444c76fe8aa89ab47c8b2f1e08fab5b6e2 SHA512 e7820d0c925da4d217214e093c671d6c2da51da00dcec98bed80fe3e6d664cfd3baf1b850eb711e9ccf9a1d09f943e2fc2efc3e8061bbfa45724c5b623dafe94 AUX lesspipe-r3.sh 9154 BLAKE2B d75a0045fdb33a6e5f0eff3c1b3ad85c928dbb65755a8da89464550f65cb9e7390807d332718262f85527766a797d71cc322e3fc9727024d48f6eb4a7fc5d3ef SHA512 fa82613441a0a30a5872be9f3a6387fcad84cd6622621b90641323f571a5aa78f1e369d5798bcad5992131dc79b2b1cc38288e84203108a495982d125d4da99c AUX lesspipe-r4.sh 9208 BLAKE2B 446ce47a46145e3e6e24232c26bb7b8c6d1f22338522413d5f26b3b30632a24cf87133788c835b0ef08429d3b1cc6521e078ef7e29fe7294fc7abe5790608e38 SHA512 31ae9e2c87babb9a17cebbfd55a61c6a7de0ef5191123b37d0a20f46963e4c0c46aee07623e0df69de427a8ed64a975c2b00569d6cdf13de5bbcb1ba0610d3ee DIST less-643.tar.gz 592291 BLAKE2B 6dc60dc2e8db05afdae466877a1d26a3008ff5378bbbf2fbdf9efc4f87c0fcfde5703d44a24d4355c98d3a5f438bdb51173150f2a69f801d9c8e4a7401d71b53 SHA512 6a324ac54e22429ac652dc303bc1fe48933555d1cbf8ad7ecf345940910c014fef9551a3219743cfb7115e356b5841ae97d6ce62e7a1ba1e3300d243efca34d9 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 |