Sync from SUSE:SLFO:Main less revision 30d1f2b3e9bdad21bf3c1efc97640178
This commit is contained in:
commit
850a11be1d
23
.gitattributes
vendored
Normal file
23
.gitattributes
vendored
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
## Default LFS
|
||||||
|
*.7z filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.bsp filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.gem filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.gz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.jar filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.lz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.lzma filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.obscpio filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.oxt filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.pdf filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.png filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.rpm filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.tbz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.tbz2 filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.tgz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.ttf filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.txz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.whl filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.xz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.zip filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.zst filter=lfs diff=lfs merge=lfs -text
|
18
README.SUSE
Normal file
18
README.SUSE
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
Dear user,
|
||||||
|
|
||||||
|
the 'less' application, thanks to its preprocessor, is able to show even binary
|
||||||
|
formats using calls to external commands. Since not every user finds this
|
||||||
|
feature plausible, you have the opportunity to customize behavior of 'less'
|
||||||
|
using the environment variable LESS_ADVANCED_PREPROCESSOR. By default, it's set
|
||||||
|
to "no" in /etc/profile -- thus if you require less to handle binary formats,
|
||||||
|
set this in your startup scripts:
|
||||||
|
|
||||||
|
export LESS_ADVANCED_PREPROCESSOR="yes"
|
||||||
|
|
||||||
|
Remark for experienced users:
|
||||||
|
If you had already set this switch and want to temporarily override it, you can
|
||||||
|
force 'less' to read a file from its standard input instead, e.g.:
|
||||||
|
|
||||||
|
less < dumb.ps
|
||||||
|
|
||||||
|
will show the source PostScript, and not the "rendered" result.
|
15
less-429-more.patch
Normal file
15
less-429-more.patch
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
Index: less-632/option.c
|
||||||
|
===================================================================
|
||||||
|
--- less-632.orig/option.c
|
||||||
|
+++ less-632/option.c
|
||||||
|
@@ -165,6 +165,10 @@ public void scan_option(char *s)
|
||||||
|
s--;
|
||||||
|
optc = 'z';
|
||||||
|
break;
|
||||||
|
+ case 'l':
|
||||||
|
+ if (less_is_more)
|
||||||
|
+ continue;
|
||||||
|
+ break;
|
||||||
|
case 'n':
|
||||||
|
if (less_is_more)
|
||||||
|
optc = 'z';
|
68
less-429-shell.patch
Normal file
68
less-429-shell.patch
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
Index: less-632/filename.c
|
||||||
|
===================================================================
|
||||||
|
--- less-632.orig/filename.c
|
||||||
|
+++ less-632/filename.c
|
||||||
|
@@ -550,7 +550,7 @@ static FILE * shellcmd(char *cmd)
|
||||||
|
#if HAVE_SHELL
|
||||||
|
char *shell;
|
||||||
|
|
||||||
|
- shell = lgetenv("SHELL");
|
||||||
|
+ shell = lgetenv("LESSSHELL");
|
||||||
|
if (!isnullenv(shell))
|
||||||
|
{
|
||||||
|
char *scmd;
|
||||||
|
Index: less-632/less.hlp
|
||||||
|
===================================================================
|
||||||
|
--- less-632.orig/less.hlp
|
||||||
|
+++ less-632/less.hlp
|
||||||
|
@@ -104,7 +104,7 @@
|
||||||
|
___<_n_a_m_e_> Display the setting of an option, by name.
|
||||||
|
+_c_m_d Execute the less cmd each time a new file is examined.
|
||||||
|
|
||||||
|
- !_c_o_m_m_a_n_d Execute the shell command with $SHELL.
|
||||||
|
+ !_c_o_m_m_a_n_d Execute the shell command with $LESSSHELL.
|
||||||
|
#_c_o_m_m_a_n_d Execute the shell command, expanded like a prompt.
|
||||||
|
|XX_c_o_m_m_a_n_d Pipe file between current pos & mark XX to shell command.
|
||||||
|
s _f_i_l_e Save input to a file.
|
||||||
|
Index: less-632/less.nro
|
||||||
|
===================================================================
|
||||||
|
--- less-632.orig/less.nro
|
||||||
|
+++ less-632/less.nro
|
||||||
|
@@ -457,7 +457,7 @@ current file.
|
||||||
|
A pound sign (#) is replaced by the name of the previously examined file.
|
||||||
|
"!!" repeats the last shell command.
|
||||||
|
"!" with no shell command simply invokes a shell.
|
||||||
|
-On Unix systems, the shell is taken from the environment variable SHELL,
|
||||||
|
+On Unix systems, the shell is taken from the environment variable LESSSHELL,
|
||||||
|
or defaults to "sh".
|
||||||
|
On MS-DOS and OS/2 systems, the shell is the normal command processor.
|
||||||
|
.IP "# shell-command"
|
||||||
|
@@ -2274,7 +2274,7 @@ automatically when running in
|
||||||
|
.IP PATH
|
||||||
|
User's search path (used to find a lesskey file
|
||||||
|
on MS-DOS and OS/2 systems).
|
||||||
|
-.IP SHELL
|
||||||
|
+.IP LESSSHELL
|
||||||
|
The shell used to execute the !\& command, as well as to expand filenames.
|
||||||
|
.IP TERM
|
||||||
|
The type of terminal on which
|
||||||
|
Index: less-632/lsystem.c
|
||||||
|
===================================================================
|
||||||
|
--- less-632.orig/lsystem.c
|
||||||
|
+++ less-632/lsystem.c
|
||||||
|
@@ -121,13 +121,13 @@ public void lsystem(char *cmd, char *don
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Pass the command to the system to be executed.
|
||||||
|
- * If we have a SHELL environment variable, use
|
||||||
|
+ * If we have a LESSSHELL environment variable, use
|
||||||
|
* <$SHELL -c "command"> instead of just <command>.
|
||||||
|
* If the command is empty, just invoke a shell.
|
||||||
|
*/
|
||||||
|
#if HAVE_SHELL
|
||||||
|
p = NULL;
|
||||||
|
- if ((shell = lgetenv("SHELL")) != NULL && *shell != '\0')
|
||||||
|
+ if ((shell = lgetenv("LESSSHELL")) != NULL && *shell != '\0')
|
||||||
|
{
|
||||||
|
if (*cmd == '\0')
|
||||||
|
p = save(shell);
|
BIN
less-633.sig
Normal file
BIN
less-633.sig
Normal file
Binary file not shown.
BIN
less-633.tar.gz
(Stored with Git LFS)
Normal file
BIN
less-633.tar.gz
(Stored with Git LFS)
Normal file
Binary file not shown.
1156
less.changes
Normal file
1156
less.changes
Normal file
File diff suppressed because it is too large
Load Diff
30
less.keyring
Normal file
30
less.keyring
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
-----BEGIN PGP PUBLIC KEY BLOCK-----
|
||||||
|
Version: GnuPG v1.4.2 (MingW32)
|
||||||
|
|
||||||
|
mQGiBEGxJ/oRBADqyDKgNZNZSBVjYa++6I53TEbRc/ySPE8O5xnl+tJdW9Vr8Lr/
|
||||||
|
vUd+xLSW10Ej48ISY/Vnw1N1Z3CqypLSVy3EJn5Kt9FE+yED5doRl3xLQ4f2zpLV
|
||||||
|
+6r7+62D5CkuNIO1SHVfqjHYQdMIa+pIj8tfWHODUM63iDOHjy2QQalSWwCg/zN3
|
||||||
|
A5hZoo+7FwmmyndtIZzNfu8EANGohWj4wjrGP+qz12eQGctD76jlX9m9GSUWSDfz
|
||||||
|
iflox9xSElOoa0kGlNe3iB4JbfgeWsDc8u1pKvWaOu7SVT1ob0X6ZSGDF+sZ178B
|
||||||
|
YDbQEZ8wNK7vh7PvYmNTAdx8TjdeZH7BP0CqFXAefUIcf7IjxsCyoJKc0N/bBW5/
|
||||||
|
wcXXBACRzkz2plYFRHuQJuma+vv1TZEnqUdU3xsDstiQzSUMltzHDNbGtDhZ+9XA
|
||||||
|
ZfhkM3sSimyljUbdjnUf/F/ulFGJfFp+C0+CIDqtOeLwtq1oNRFzsPAXMJGTh0IY
|
||||||
|
vss6/cpAGVBWhCt4nIL/o40xwte1YhcT3vEZ//CHKhlVhD+ozrQrTWFyayBOdWRl
|
||||||
|
bG1hbiA8bWFya25AZ3JlZW53b29kc29mdHdhcmUuY29tPohgBBARAgAgAhkBBQJD
|
||||||
|
AkHCBgsJCAcDAgQVAggDBBYCAwECHgECF4AACgkQ8VOnyDMjUlmy0wCfXc0HXCRm
|
||||||
|
kcAmNIhzuk2luW0sx7gAoJHwtEAf/54QboxUlXfJ//IvsFhBuQINBEGxJ/oQCAD2
|
||||||
|
Qle3CH8IF3KiutapQvMF6PlTETlPtvFuuUs4INoBp1ajFOmPQFXz0AfGy0OplK33
|
||||||
|
TGSGSfgMg71l6RfUodNQ+PVZX9x2Uk89PY3bzpnhV5JZzf24rnRPxfx2vIPFRzBh
|
||||||
|
znzJZv8V+bv9kV7HAarTW56NoKVyOtQa8L9GAFgr5fSI/VhOSdvNILSd5JEHNmsz
|
||||||
|
bDgNRR0PfIizHHxbLY7288kjwEPwpVsYjY67VYy4XTjTNP18F1dDox0YbN4zISy1
|
||||||
|
Kv884bEpQBgRjXyEpwpy1obEAxnIByl6ypUM2Zafq9AKUJsCRtMIPWakXUGfnHy9
|
||||||
|
iUsiGSa6q6Jew1XpMgs7AAICB/95h7/V29mwuVP/uP55I6NmEyYwI2gLUNdRPmNj
|
||||||
|
V+u/5gdh9DF9LQWj3Ko5vRmxVz3iAI3Nf2x7de+ULjEQruWsAvQgqjL1/NGQYupM
|
||||||
|
k5gPLdYrd8pjJfcLOjOM5ykArSHLtnPvg8OgiwBBb2YezLed3U0Li6fpV/sI4vD/
|
||||||
|
rE55LNP3vijgXtLEdA2BTVJk7cJnjAOseWD8ZesJIbWPMfgD5CrM5jDFOnFqTBNX
|
||||||
|
YbrlEkI5faFL8y6HUTk5o9C1oHehgPtaDfYKmLVUWFQWVr1RzCILb8TiBjmlVvrH
|
||||||
|
q01dBUrsXOHiuAdYc4mSVAzGEjZdy2OrbgQyHMxSYFWCHRCkiEYEGBECAAYFAkGx
|
||||||
|
J/oACgkQ8VOnyDMjUlmPgACfZiXhixWbCD/W6D9dm7+isKy6D2oAn38AYHzvs+2L
|
||||||
|
Uz6yQ9xi5xz636J9
|
||||||
|
=QjER
|
||||||
|
-----END PGP PUBLIC KEY BLOCK-----
|
93
less.spec
Normal file
93
less.spec
Normal file
@ -0,0 +1,93 @@
|
|||||||
|
#
|
||||||
|
# spec file for package less
|
||||||
|
#
|
||||||
|
# Copyright (c) 2023 SUSE LLC
|
||||||
|
#
|
||||||
|
# All modifications and additions to the file contributed by third parties
|
||||||
|
# remain the property of their copyright owners, unless otherwise agreed
|
||||||
|
# upon. The license for this file, and modifications and additions to the
|
||||||
|
# file, is the same license as for the pristine package itself (unless the
|
||||||
|
# license for the pristine package is not an Open Source License, in which
|
||||||
|
# case the license is the MIT License). An "Open Source License" is a
|
||||||
|
# license that conforms to the Open Source Definition (Version 1.9)
|
||||||
|
# published by the Open Source Initiative.
|
||||||
|
|
||||||
|
# Please submit bugfixes or comments via https://bugs.opensuse.org/
|
||||||
|
#
|
||||||
|
|
||||||
|
|
||||||
|
%if ! %{defined _distconfdir}
|
||||||
|
%define _distconfdir %{_sysconfdir}
|
||||||
|
%else
|
||||||
|
%define use_usretc 1
|
||||||
|
%endif
|
||||||
|
Name: less
|
||||||
|
Version: 633
|
||||||
|
Release: 0
|
||||||
|
Summary: Text File Browser and Pager Similar to more
|
||||||
|
License: BSD-2-Clause OR GPL-3.0-or-later
|
||||||
|
Group: Productivity/Text/Utilities
|
||||||
|
URL: https://www.greenwoodsoftware.com/less/
|
||||||
|
Source: https://www.greenwoodsoftware.com/less/less-%{version}.tar.gz
|
||||||
|
Source1: README.SUSE
|
||||||
|
Source2: lessopen.sh
|
||||||
|
Source3: lessclose.sh
|
||||||
|
Source4: lesskey.src
|
||||||
|
Source5: https://www.greenwoodsoftware.com/less/less-%{version}.sig
|
||||||
|
Source6: https://www.greenwoodsoftware.com/less/pubkey.asc#/%{name}.keyring
|
||||||
|
Patch0: less-429-shell.patch
|
||||||
|
Patch2: less-429-more.patch
|
||||||
|
BuildRequires: automake
|
||||||
|
BuildRequires: ncurses-devel
|
||||||
|
BuildRequires: pkgconfig
|
||||||
|
Requires: file
|
||||||
|
# lessopen.sh uses which
|
||||||
|
Requires: /usr/bin/which
|
||||||
|
|
||||||
|
%description
|
||||||
|
less is a text file browser and pager similar to more. It allows
|
||||||
|
backward as well as forward movement within a file. Also, less does not
|
||||||
|
have to read the entire input file before starting. It is possible to
|
||||||
|
start an editor at any time from within less.
|
||||||
|
|
||||||
|
%prep
|
||||||
|
%autosetup -p1
|
||||||
|
#
|
||||||
|
# the ./configure script is not writable for the normal user
|
||||||
|
# rather fix permissions for all files
|
||||||
|
chmod u+w *
|
||||||
|
#
|
||||||
|
cp %{SOURCE1} %{SOURCE2} %{SOURCE3} %{SOURCE4} .
|
||||||
|
|
||||||
|
%build
|
||||||
|
autoreconf -fiv
|
||||||
|
export CFLAGS="%{optflags} -fPIE"
|
||||||
|
export LDFLAGS="-pie"
|
||||||
|
%configure
|
||||||
|
#
|
||||||
|
# regenerate help.c because less.hlp was patched
|
||||||
|
./mkhelp.pl <less.hlp >help.c
|
||||||
|
#
|
||||||
|
# build less
|
||||||
|
%make_build
|
||||||
|
|
||||||
|
%install
|
||||||
|
%make_install
|
||||||
|
#
|
||||||
|
# lesskey
|
||||||
|
install -m 755 -d %{buildroot}/%{_distconfdir}
|
||||||
|
install -m 644 lesskey.src %{buildroot}/%{_distconfdir}/lesskey
|
||||||
|
%{buildroot}%{_bindir}/lesskey -o %{buildroot}%{_distconfdir}/lesskey.bin %{buildroot}%{_distconfdir}/lesskey
|
||||||
|
#
|
||||||
|
# preprocessor
|
||||||
|
install -m 755 lessopen.sh lessclose.sh %{buildroot}/%{_bindir}
|
||||||
|
chmod -x LICENSE COPYING NEWS README.SUSE
|
||||||
|
|
||||||
|
%files
|
||||||
|
%license LICENSE COPYING
|
||||||
|
%doc NEWS README.SUSE
|
||||||
|
%{_mandir}/*/*
|
||||||
|
%{_distconfdir}/*
|
||||||
|
%{_bindir}/*
|
||||||
|
|
||||||
|
%changelog
|
12
lessclose.sh
Normal file
12
lessclose.sh
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# Copyright (c) 2001 SUSE GmbH, Nuernberg, Germany
|
||||||
|
# Copyright (c) 2002 SUSE Linux AG, Nuernberg, Germany
|
||||||
|
#
|
||||||
|
# Author: Vladimír Linek <vinil@suse.cz>
|
||||||
|
#
|
||||||
|
# Postprocessor for 'less'.
|
||||||
|
# Use with environment variable: LESSCLOSE="lessclose.sh %s %s"
|
||||||
|
#
|
||||||
|
|
||||||
|
test "$1" = "$2" || rm -f "$2"
|
101
lesskey.src
Normal file
101
lesskey.src
Normal file
@ -0,0 +1,101 @@
|
|||||||
|
#command
|
||||||
|
\e[A back-line
|
||||||
|
\e[B forw-line
|
||||||
|
\eO5A back-line
|
||||||
|
\eO5B forw-line
|
||||||
|
\eO5C right-scroll
|
||||||
|
\eO5D left-scroll
|
||||||
|
\e[6~ forw-scroll
|
||||||
|
\e[5~ back-scroll
|
||||||
|
\217A back-line
|
||||||
|
\217B forw-line
|
||||||
|
\217C right-scroll
|
||||||
|
\217D left-scroll
|
||||||
|
\2336~ forw-scroll
|
||||||
|
\2335~ back-scroll
|
||||||
|
\177 back-screen
|
||||||
|
^H back-screen
|
||||||
|
\e[3~ back-screen
|
||||||
|
\e[3;5~ back-screen
|
||||||
|
\2333~ back-screen
|
||||||
|
\e[2~ visual
|
||||||
|
\e[2;5~ visual
|
||||||
|
\2332~ visual
|
||||||
|
\e[1~ goto-line
|
||||||
|
\eOH goto-line
|
||||||
|
\eO5H goto-line
|
||||||
|
\e[4~ goto-end
|
||||||
|
\eOF goto-end
|
||||||
|
\eO5F goto-end
|
||||||
|
\eOM forw-line
|
||||||
|
#line-edit
|
||||||
|
\eO5A up
|
||||||
|
\eO5B down
|
||||||
|
\eO5C right
|
||||||
|
\eO5D left
|
||||||
|
\217A up
|
||||||
|
\217B down
|
||||||
|
\217C right
|
||||||
|
\217D left
|
||||||
|
\177 backspace
|
||||||
|
^H backspace
|
||||||
|
\e[3~ delete
|
||||||
|
\e[3;5~ delete
|
||||||
|
\2333~ delete
|
||||||
|
\e[1~ home
|
||||||
|
\eOH home
|
||||||
|
\eO5H home
|
||||||
|
\217H home
|
||||||
|
\e[4~ end
|
||||||
|
\eOF end
|
||||||
|
\eO5F end
|
||||||
|
\217F end
|
||||||
|
\e[5~ up
|
||||||
|
\e[6~ down
|
||||||
|
\e[5;5~ up
|
||||||
|
\e[6;5~ down
|
||||||
|
\2335~ up
|
||||||
|
\2336~ down
|
||||||
|
\e[2~ insert
|
||||||
|
\e[2;5~ insert
|
||||||
|
\2332~ insert
|
||||||
|
\e[E insert
|
||||||
|
\e[G insert
|
||||||
|
\eOE insert
|
||||||
|
\eOo insert :
|
||||||
|
\eOj insert *
|
||||||
|
\eOm insert -
|
||||||
|
\eOk insert +
|
||||||
|
\eOl insert ,
|
||||||
|
\eOM insert
|
||||||
|
\eOw insert 7
|
||||||
|
\eOx insert 8
|
||||||
|
\eOy insert 9
|
||||||
|
\eOt insert 4
|
||||||
|
\eOu insert 5
|
||||||
|
\eOv insert 6
|
||||||
|
\eOq insert 1
|
||||||
|
\eOr insert 2
|
||||||
|
\eOs insert 3
|
||||||
|
\eOp insert 0
|
||||||
|
\eOn insert .
|
||||||
|
\217E insert
|
||||||
|
\217o insert :
|
||||||
|
\217j insert *
|
||||||
|
\217m insert -
|
||||||
|
\217k insert +
|
||||||
|
\217l insert ,
|
||||||
|
\217M insert
|
||||||
|
\217w insert 7
|
||||||
|
\217x insert 8
|
||||||
|
\217y insert 9
|
||||||
|
\217t insert 4
|
||||||
|
\217u insert 5
|
||||||
|
\217v insert 6
|
||||||
|
\217q insert 1
|
||||||
|
\217r insert 2
|
||||||
|
\217s insert 3
|
||||||
|
\217p insert 0
|
||||||
|
\217n insert .
|
||||||
|
#env
|
||||||
|
LESSBINFMT=*s\%o
|
188
lessopen.sh
Normal file
188
lessopen.sh
Normal file
@ -0,0 +1,188 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# Copyright (c) 2001 SUSE GmbH, Nuernberg, Germany
|
||||||
|
# Copyright (c) 2002 SUSE Linux AG, Nuernberg, Germany
|
||||||
|
#
|
||||||
|
# Author: Vladimir Linek <vinil@suse.cz>
|
||||||
|
# Support for directory listing by Dimitar Pashov <d.pashov@gmail.com>
|
||||||
|
#
|
||||||
|
# Preprocessor for 'less'.
|
||||||
|
# Use with environment variable: LESSOPEN="lessopen.sh %s"
|
||||||
|
|
||||||
|
# the following hack does not break anything but helps to view file whose name
|
||||||
|
# begins with a "-" or "+" with names
|
||||||
|
if echo "$1" | grep -q ^/; then
|
||||||
|
# absolute path
|
||||||
|
SRC="$1"
|
||||||
|
else
|
||||||
|
# relative path
|
||||||
|
SRC="./$1"
|
||||||
|
fi
|
||||||
|
|
||||||
|
NAME="${SRC##*/}"
|
||||||
|
|
||||||
|
[ ! -r "$SRC" ] && exit 1
|
||||||
|
|
||||||
|
cleaner() {
|
||||||
|
test "$TMPF_pre" = "$SRC" -o "$TMPF_pre" = "$TMPF" && return
|
||||||
|
rm -f "$TMPF_pre"
|
||||||
|
}
|
||||||
|
trap 'cleaner' EXIT SIGHUP
|
||||||
|
TMPF=$(mktemp /tmp/less.XXXXXXXXX) || exit 1
|
||||||
|
TMPF_pre=$(mktemp /tmp/less.XXXXXXXXX) || exit 1
|
||||||
|
|
||||||
|
lang=$LANG
|
||||||
|
test -n "$LC_CTYPE" && lang="$LC_CTYPE"
|
||||||
|
case "$lang" in
|
||||||
|
*.UTF-8|*.UTF8)
|
||||||
|
GROFF_DEVICE=utf8
|
||||||
|
;;
|
||||||
|
ja*)
|
||||||
|
GROFF_DEVICE=nippon
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
GROFF_DEVICE=latin1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
CMD=
|
||||||
|
type=`/usr/bin/file -L "$SRC"`
|
||||||
|
case ${type#"$SRC": } in
|
||||||
|
*"gzip compressed data"*|\
|
||||||
|
*"compress'd data"*|\
|
||||||
|
*"packed data"*)
|
||||||
|
CMD="gzip -dc" ;;
|
||||||
|
*"Zip archive data"*)
|
||||||
|
CMD="unzip -v" ;;
|
||||||
|
*"bzip"*" compressed data"*)
|
||||||
|
CMD="bzip2 -dc" ;;
|
||||||
|
*"xz compressed data"*|\
|
||||||
|
*"XZ compressed data"*)
|
||||||
|
CMD="xz -dc" ;;
|
||||||
|
*)
|
||||||
|
rm -f "$TMPF_pre"
|
||||||
|
TMPF_pre="$SRC" ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
test -n "$CMD" && $CMD "$SRC" >"$TMPF_pre" 2>/dev/null
|
||||||
|
|
||||||
|
type=`/usr/bin/file -L "$TMPF_pre"`
|
||||||
|
case ${type#"$TMPF_pre": } in
|
||||||
|
*tar\ archive*)
|
||||||
|
if [ -x "`/usr/bin/which tar 2>/dev/null`" ]; then
|
||||||
|
tar tvvf "$TMPF_pre" >"$TMPF" 2>/dev/null
|
||||||
|
else echo "tar is not available for preprocessing" 1>&2; rm -f "$TMPF"; TMPF="$TMPF_pre"; fi
|
||||||
|
;;
|
||||||
|
*Microsoft\ Cabinet\ *\ data*)
|
||||||
|
if [ -x "`/usr/bin/which cabextract 2>/dev/null`" ]; then
|
||||||
|
cabextract -l "$TMPF_pre" >"$TMPF" 2>/dev/null
|
||||||
|
else echo "cabextract is not available for preprocessing" 1>&2; rm -f "$TMPF"; TMPF="$TMPF_pre"; fi
|
||||||
|
;;
|
||||||
|
*RPM*)
|
||||||
|
if [ -x "`/usr/bin/which rpm 2>/dev/null`" ]; then
|
||||||
|
(echo -e "=============================== Information ====================================\n";
|
||||||
|
rpm -qip "\"$TMPF_pre\"";
|
||||||
|
echo -e "\n\n================================= Changelog (head) =============================\n";
|
||||||
|
rpm -qp --changelog "\"$TMPF_pre\"" | head -n 16
|
||||||
|
echo -e "\n\n================================= Content ======================================\n";
|
||||||
|
rpm -qlp "\"$TMPF_pre\""
|
||||||
|
) >"$TMPF" 2>/dev/null
|
||||||
|
else echo "rpm is not available for preprocessing" 1>&2; rm -f "$TMPF"; TMPF="$TMPF_pre"; fi
|
||||||
|
;;
|
||||||
|
*DVI*)
|
||||||
|
if [ -x "`/usr/bin/which dvi2tty 2>/dev/null`" ]; then
|
||||||
|
if [ "${TMPF_pre%.dvi}" != "$TMPF_pre" ] ; then
|
||||||
|
dvi2tty -q "$TMPF_pre" >"$TMPF" 2>/dev/null
|
||||||
|
else echo "dvi2tty requires an input file name with the suffix .dvi" 1>&2; rm -f "$TMPF"; TMPF="$TMPF_pre" ; fi
|
||||||
|
else echo "dvi2tty is not available for preprocessing" 1>&2; rm -f "$TMPF"; TMPF="$TMPF_pre"; fi
|
||||||
|
;;
|
||||||
|
*PDF*)
|
||||||
|
if [ -x "`/usr/bin/which pdftotext 2>/dev/null`" ]; then
|
||||||
|
pdftotext "$TMPF_pre" "$TMPF" 2>/dev/null
|
||||||
|
else echo "pdftotext is not available for preprocessing" 1>&2; rm -f "$TMPF"; TMPF="$TMPF_pre"; fi
|
||||||
|
;;
|
||||||
|
*Debian\ binary\ package*)
|
||||||
|
if [ -x "`/usr/bin/which dpkg-deb 2>/dev/null`" ]; then
|
||||||
|
dpkg-deb -c "$TMPF_pre" >"$TMPF" 2>/dev/null
|
||||||
|
else echo "dpkg-deb is not available for preprocessing" 1>&2; rm -f "$TMPF"; TMPF="$TMPF_pre"; fi
|
||||||
|
;;
|
||||||
|
*\ ar\ archive*)
|
||||||
|
if [ -x "`/usr/bin/which nm 2>/dev/null`" ]; then
|
||||||
|
nm "$TMPF_pre" >"$TMPF" 2>/dev/null
|
||||||
|
else echo "nm is not available for preprocessing" 1>&2; rm -f "$TMPF"; TMPF="$TMPF_pre"; fi
|
||||||
|
;;
|
||||||
|
*directory*)
|
||||||
|
# assuming ls is always available
|
||||||
|
ls -lh "$TMPF_pre" >"$TMPF" 2>/dev/null
|
||||||
|
;;
|
||||||
|
*diff\ output*)
|
||||||
|
# I haven't found way, to set less -R from this script
|
||||||
|
# so check, if '-R' or '--RAW-CONTROL-CHARS' is set in environment
|
||||||
|
R_NOT_SET=true
|
||||||
|
for i in $LESS; do
|
||||||
|
if [ "${i:0:1}" = "-" ]; then
|
||||||
|
if [ "${i:1:1}" = "-" ]; then
|
||||||
|
if [ "$i" = --RAW-CONTROL-CHARS ]; then
|
||||||
|
R_NOT_SET=false
|
||||||
|
break
|
||||||
|
else
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
for j in `seq 1 $((${#i} - 1 ))`; do
|
||||||
|
if [ "${i:j:1}" = R ]; then
|
||||||
|
R_NOT_SET=false
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
# if we have -R and colordiff, we can continue
|
||||||
|
if [ $R_NOT_SET = false ] && \
|
||||||
|
[ -x "`/usr/bin/which colordiff 2>/dev/null`" ]; then
|
||||||
|
colordiff < "$TMPF_pre" | cat > "$TMPF" 2>/dev/null
|
||||||
|
else rm -f "$TMPF"; TMPF="$TMPF_pre"; fi
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
if [ "$LESS_ADVANCED_PREPROCESSOR" = "yes" ]; then
|
||||||
|
case ${type#"$TMPF_pre": } in
|
||||||
|
*troff*)
|
||||||
|
if [ -x "`/usr/bin/which groff 2>/dev/null`" ]; then
|
||||||
|
case "$NAME" in
|
||||||
|
*.[1-9nxp]*|*.man|*.[1-9nxp]*.*|*.man.*)
|
||||||
|
groff -s -p -t -e -T$GROFF_DEVICE -mandoc "$TMPF_pre" >"$TMPF" 2>/dev/null ;;
|
||||||
|
*.ms|*.ms.*)
|
||||||
|
groff -T$GROFF_DEVICE -ms "$TMPF_pre" >"$TMPF" 2>/dev/null ;;
|
||||||
|
*.me|*.me.*)
|
||||||
|
groff -T$GROFF_DEVICE -me "$TMPF_pre" >"$TMPF" 2>/dev/null ;;
|
||||||
|
*)
|
||||||
|
groff -T$GROFF_DEVICE "$TMPF_pre" >"$TMPF" 2>/dev/null ;;
|
||||||
|
esac
|
||||||
|
else echo "groff is not available for preprocessing" 1>&2; rm -f "$TMPF"; TMPF="$TMPF_pre"; fi
|
||||||
|
;;
|
||||||
|
*PostScript*)
|
||||||
|
if [ -x "`/usr/bin/which ps2ascii 2>/dev/null`" ]; then
|
||||||
|
ps2ascii "$TMPF_pre" >"$TMPF" 2>/dev/null
|
||||||
|
else echo "ps2ascii is not available for preprocessing" 1>&2; rm -f "$TMPF"; TMPF="$TMPF_pre"; fi
|
||||||
|
;;
|
||||||
|
*HTML*)
|
||||||
|
if [ -x "`/usr/bin/which w3m 2>/dev/null`" ]; then
|
||||||
|
w3m -dump -T text/html "$TMPF_pre" >"$TMPF" 2>/dev/null
|
||||||
|
elif [ -x "`/usr/bin/which lynx 2>/dev/null`" ]; then
|
||||||
|
lynx -dump -force_html "$TMPF_pre" >"$TMPF" 2>/dev/null
|
||||||
|
else echo "lynx/w3m not available for preprocessing" 1>&2; rm -f "$TMPF"; TMPF="$TMPF_pre"; fi
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
rm -f "$TMPF"
|
||||||
|
TMPF="$TMPF_pre"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
else
|
||||||
|
rm -f "$TMPF"
|
||||||
|
TMPF="$TMPF_pre"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
test "$TMPF" = "$SRC" || echo "$TMPF"
|
Loading…
Reference in New Issue
Block a user