diff --git a/less-436-manpage-add-old-bot-option.patch b/less-436-manpage-add-old-bot-option.patch new file mode 100644 index 0000000000000000000000000000000000000000..a3c76d70297d161c3b0a2f53449cc8964994b20f --- /dev/null +++ b/less-436-manpage-add-old-bot-option.patch @@ -0,0 +1,13 @@ +--- less-436/less.nro.old-bot 2010-01-05 15:20:00.690985900 +0100 ++++ less-436/less.nro 2010-01-05 15:16:30.500112556 +0100 +@@ -555,6 +555,10 @@ This can cause + to run somewhat faster than the default. + .IP "\-G or \-\-HILITE-SEARCH" + The \-G option suppresses all highlighting of strings found by search commands. ++.IP "\-\-old-bot" ++Reverts to the old bottom of screen behavior. This can be sometimes ++desirable if the long lines are not wrapped correctly ++when reaching the bottom of the terminal, while scrolling forward. + .IP "\-h\fIn\fP or \-\-max-back-scroll=\fIn\fP" + Specifies a maximum number of lines to scroll backward. + If it is necessary to scroll backward more than \fIn\fP lines, diff --git a/less-458-less-filters-man.patch b/less-458-less-filters-man.patch new file mode 100644 index 0000000000000000000000000000000000000000..7de44150ca847eec43b1a34bdcc03df6ff477655 --- /dev/null +++ b/less-458-less-filters-man.patch @@ -0,0 +1,24 @@ +diff -up less-466/less.nro.filters-man less-466/less.nro +--- less-466/less.nro.filters-man 2014-09-18 14:32:32.124111631 +0200 ++++ less-466/less.nro 2014-09-18 14:32:39.548177152 +0200 +@@ -1323,7 +1323,19 @@ Similarly, if the first two characters of LESSOPEN are vertical bar and dash + the input pipe is used on standard input as well as other files. + Again, in this case the dash is not considered to be part of + the input pipe command. +-. ++.PP ++There are used following files to set up default preprocessor: ++.br ++ /etc/profile.d/less.sh ++.br ++ /etc/profile.d/less.csh ++.br ++These files set up /usr/bin/lesspipe.sh as a default filter. An user defined ++filter can be specified in ~/.lessfilter. This file should have an execute bit ++set and accept only one parameter, which represents a filename. If ++the user defined filter process the file, zero should be returned. Otherwise ++~/.lessfilter tries to handle the file. ++ + .SH "NATIONAL CHARACTER SETS" + There are three types of characters in the input file: + .IP "normal characters" diff --git a/less-458-lessecho-usage.patch b/less-458-lessecho-usage.patch new file mode 100644 index 0000000000000000000000000000000000000000..b16369be8bc1813d654df488127f5ad1498468b2 --- /dev/null +++ b/less-458-lessecho-usage.patch @@ -0,0 +1,33 @@ +diff -upr less-458_orig/lessecho.c less-458_work/lessecho.c +--- less-458_orig/lessecho.c 2013-05-07 14:03:52.091104655 +0200 ++++ less-458_work/lessecho.c 2013-05-07 11:21:10.883991862 +0200 +@@ -41,7 +41,27 @@ static int num_metachars = 0; + static void pr_usage(void) + { + fprintf(stderr, +- "usage: lessecho [-ox] [-cx] [-pn] [-dn] [-mx] [-nn] [-ex] [-fn] [-a] file ...\n"); ++ "usage: lessecho [-ox] [-cx] [-pn] [-dn] [-mx] [-nn] [-ex] [-fn] [-a] file ...\n\n"); ++ fprintf(stderr, ++ " -ox\t- specifies \"x\" to be the open quote character\n"); ++ fprintf(stderr, ++ " -cx\t- specifies \"x\" to be the close quote character\n"); ++ fprintf(stderr, ++ " -pn\t- specifies \"n\" to be the open quote character, as an integer\n"); ++ fprintf(stderr, ++ " -dn\t- specifies \"n\" to be the close quote character, as an integer\n"); ++ fprintf(stderr, ++ " -mx\t- specifies \"x\" to be a metachar\n"); ++ fprintf(stderr, ++ " -nn\t- specifies \"n\" to be a metachar, as an integer\n"); ++ fprintf(stderr, ++ " -ex\t- specifies \"x\" to be the escape char for metachars\n"); ++ fprintf(stderr, ++ " -fn\t- specifies \"n\" to be the escape char for metachars, as an integer\n"); ++ fprintf(stderr, ++ " -a\t- specifies that all arguments are to be quoted\n"); ++ fprintf(stderr, ++ " -?\t- prints this help\n"); + } + + static void pr_version(void) + diff --git a/less-458-lesskey-usage.patch b/less-458-lesskey-usage.patch new file mode 100644 index 0000000000000000000000000000000000000000..e9c5cc32ff1729c0139180aeff0f92be9fa97219 --- /dev/null +++ b/less-458-lesskey-usage.patch @@ -0,0 +1,20 @@ +diff -upr less-458_orig/lesskey.c less-458_work/lesskey.c +--- less-458_orig/lesskey.c 2013-05-07 14:03:52.062104533 +0200 ++++ less-458_work/lesskey.c 2013-05-07 11:21:10.881991855 +0200 +@@ -217,7 +217,15 @@ extern char version[]; + + static void usage(void) + { +- fprintf(stderr, "usage: lesskey [-o output] [input]\n"); ++ fprintf(stderr, "usage: lesskey [-o output] [input]\n\n"); ++ fprintf(stderr, ++ " -o output\t- specify output file, otherwise $HOME/.less is used\n"); ++ fprintf(stderr, ++ " -i input\t- specify input file, otherwise standard input is used\n"); ++ fprintf(stderr, ++ " -V\t\t- print lesskey version\n"); ++ fprintf(stderr, ++ " -h\t\t- print this help\n"); + exit(1); + } + diff --git a/less-458-old-bot-in-help.patch b/less-458-old-bot-in-help.patch new file mode 100644 index 0000000000000000000000000000000000000000..7476dfce9557fa40e915567434e914076a1c4bc6 --- /dev/null +++ b/less-458-old-bot-in-help.patch @@ -0,0 +1,24 @@ +diff -up less-458/help.c.oldbothelp less-458/help.c +--- less-458/help.c.oldbothelp 2014-02-03 16:49:34.000000000 +0100 ++++ less-458/help.c 2014-02-03 16:50:17.202836595 +0100 +@@ -138,6 +138,8 @@ constant char helpdata[] = { + ' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','H','i','g','h','l','i','g','h','t',' ','o','n','l','y',' ','l','a','s','t',' ','m','a','t','c','h',' ','f','o','r',' ','s','e','a','r','c','h','e','s','.','\n', + ' ',' ','-','G',' ',' ','.','.','.','.','.','.','.','.',' ',' ','-','-','H','I','L','I','T','E','-','S','E','A','R','C','H','\n', + ' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','D','o','n','\'','t',' ','h','i','g','h','l','i','g','h','t',' ','a','n','y',' ','m','a','t','c','h','e','s',' ','f','o','r',' ','s','e','a','r','c','h','e','s','.','\n', ++' ',' ','-','-','o','l','d','-','b','o','t','\n', ++' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','R','e','v','e','r','t',' ','t','o',' ','t','h','e',' ','o','l','d',' ','b','o','t','t','o','m',' ','o','f',' ','s','c','r','e','e','n',' ','b','e','h','a','v','i','o','r','.','\n', + ' ',' ','-','h',' ','[','_','\b','N',']',' ',' ','.','.','.','.',' ',' ','-','-','m','a','x','-','b','a','c','k','-','s','c','r','o','l','l','=','[','_','\b','N',']','\n', + ' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','B','a','c','k','w','a','r','d',' ','s','c','r','o','l','l',' ','l','i','m','i','t','.','\n', + ' ',' ','-','i',' ',' ','.','.','.','.','.','.','.','.',' ',' ','-','-','i','g','n','o','r','e','-','c','a','s','e','\n', +diff -up less-458/less.hlp.oldbothelp less-458/less.hlp +--- less-458/less.hlp.oldbothelp 2014-02-03 16:49:34.503555646 +0100 ++++ less-458/less.hlp 2014-02-03 16:49:34.507555673 +0100 +@@ -135,6 +135,8 @@ + Highlight only last match for searches. + -G ........ --HILITE-SEARCH + Don't highlight any matches for searches. ++ --old-bot ++ Revert to the old bottom of screen behavior. + -h [_N] .... --max-back-scroll=[_N] + Backward scroll limit. + -i ........ --ignore-case diff --git a/less-633.tar.gz b/less-633.tar.gz deleted file mode 100644 index 6f96facacee591b9d9c1a83fbed49f02a8ebb429..0000000000000000000000000000000000000000 Binary files a/less-633.tar.gz and /dev/null differ diff --git a/less-643.tar.gz b/less-643.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..dd603bfa3193b067ff1ff3dc0ba388aa53a7823e Binary files /dev/null and b/less-643.tar.gz differ diff --git a/less.csh b/less.csh new file mode 100644 index 0000000000000000000000000000000000000000..d3c1f8e348197542fff481d89cc4ba14cbba817b --- /dev/null +++ b/less.csh @@ -0,0 +1,15 @@ +# less initialization script (csh) + +# All less.*sh files should have the same semantics! + +# In case you are curious, the test for non-emptiness is not as easy as in +# Bourne shell. This "eval" construct is probably inspired by Stack +# Overflow question 13343392. +if ( $?LESSOPEN && { eval 'test ! -z "$LESSOPEN"' } ) then + : +else + if ( -x /usr/bin/lesspipe.sh ) then + # The '||' here is intentional, see rhbz#1254837. + setenv LESSOPEN "||/usr/bin/lesspipe.sh %s" + endif +endif diff --git a/less.sh b/less.sh new file mode 100644 index 0000000000000000000000000000000000000000..189bbd2c84174c23b3097403e61b9289f9d01283 --- /dev/null +++ b/less.sh @@ -0,0 +1,8 @@ +# less initialization script (sh) + +# All less.*sh files should have the same semantics! + +if [ -z "$LESSOPEN" ] && [ -x /usr/bin/lesspipe.sh ]; then + # The '||' here is intentional, see rhbz#1254837. + export LESSOPEN="||/usr/bin/lesspipe.sh %s" +fi diff --git a/less.spec b/less.spec index 122b41556580aa556fdeadfa4a485a7f13e31956..70fd3c025589feb8456b339e5d1ae77034ed399a 100644 --- a/less.spec +++ b/less.spec @@ -1,50 +1,68 @@ -Name: less -Version: 633 -Release: 1 -Summary: Less is a pager that displays text files. -License: GPLv3+ or BSD -URL: http://www.greenwoodsoftware.com/less -Source0: http://www.greenwoodsoftware.com/less/%{name}-%{version}.tar.gz -Patch0: less-394-time.patch -Patch1: less-475-fsync.patch - -BuildRequires: gcc make ncurses-devel autoconf automake libtool +Name: less +Version: 643 +Release: 1 +License: GPLv3+ or BSD +Source0: https://www.greenwoodsoftware.com/less/%{name}-%{version}.tar.gz +Source1: lesspipe.sh +Source2: less.sh +Source3: less.csh +Patch4: less-394-time.patch +Patch5: less-475-fsync.patch +Patch6: less-436-manpage-add-old-bot-option.patch +Patch8: less-458-lessecho-usage.patch +Patch9: less-458-less-filters-man.patch +Patch10: less-458-lesskey-usage.patch +Patch11: less-458-old-bot-in-help.patch +URL: https://www.greenwoodsoftware.com/less/ +BuildRequires: ncurses-devel +BuildRequires: autoconf automake libtool +BuildRequires: make %description -Less is a pager. A pager is a program that displays text files. -Other pagers commonly in use are more and pg. Pagers are often -used in command-line environments like the Unix shell and the MS-DOS -command prompt to display files. +The less utility is a text file browser that resembles more, but has +more capabilities. Less allows you to move backwards in the file as +well as forwards. Since less doesn't have to read the entire input file +before it starts, less starts up more quickly than text editors (for +example, vi). -Less is not an editor. You can't change the contents of the file -you're viewing. Less is not a windowing system. It doesn't have -fancy scroll bars or other GUI (graphical user interface) elements. - -%package_help +You should install less because it is a basic utility for viewing text +files, and you'll use it frequently. %prep -%autosetup -n %{name}-%{version} -p1 +%setup -q +%patch4 -p1 -b .time +%patch5 -p1 -b .fsync +%patch6 -p1 -b .manpage-add-old-bot-option +%patch8 -p1 -b .lessecho-usage +%patch9 -p1 -b .less-filters-man +%patch10 -p1 -b .lesskey-usage +%patch11 -p1 -b .old-bot + %build rm -f ./configure -autoreconf -ivf +autoreconf -fiv %configure %make_build CFLAGS="%{optflags} -D_GNU_SOURCE -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64" %install %make_install - +mkdir -p $RPM_BUILD_ROOT/etc/profile.d +install -p %{SOURCE1} $RPM_BUILD_ROOT%{_bindir} +install -p -m 644 %{SOURCE2} $RPM_BUILD_ROOT/etc/profile.d +install -p -m 644 %{SOURCE3} $RPM_BUILD_ROOT/etc/profile.d %files -%defattr(-,root,root) -%license LICENSE COPYING -%{_bindir}/less* - -%files help %doc README NEWS INSTALL +%license LICENSE COPYING +/etc/profile.d/* +%{_bindir}/* %{_mandir}/man1/* %changelog +* Mon Feb 12 2024 shafeipaozi - 643-1 +- Update to 643 + * Tue Jan 30 2024 hongjinghao - 633-1 - Update to 633 diff --git a/lesspipe.sh b/lesspipe.sh new file mode 100755 index 0000000000000000000000000000000000000000..f2df6a1fe4904b22fac1228407f9fe126e1180aa --- /dev/null +++ b/lesspipe.sh @@ -0,0 +1,128 @@ +#!/bin/sh +# +# To use this filter with less, define LESSOPEN: +# export LESSOPEN="|/usr/bin/lesspipe.sh %s" +# +# The script should return zero if the output was valid and non-zero +# otherwise, so less could detect even a valid empty output +# (for example while uncompressing gzipped empty file). +# For backward-compatibility, this is not required by default. To turn +# this functionality there should be another vertical bar (|) straight +# after the first one in the LESSOPEN environment variable: +# export LESSOPEN="||/usr/bin/lesspipe.sh %s" + +if [ ! -e "$1" ] ; then + exit 1 +fi + +if [ -d "$1" ] ; then + ls -alF -- "$1" + exit $? +fi + +exec 2>/dev/null + +# Allow for user defined filters +if [ -x ~/.lessfilter ]; then + ~/.lessfilter "$1" + if [ $? -eq 0 ]; then + exit 0 + fi +fi + +manfilter () +{ + if test -x /usr/bin/man ; then + # See rhbz#1241543 for more info. Well, actually we firstly + # used 'man -l', then we switched to groff, and then we again + # switched back to 'man -l'. + /usr/bin/man -P /usr/bin/cat -l "$1" + elif test -x /usr/bin/groff; then + # This is from pre-rhbz#1241543-time. + groff -Tascii -mandoc "$1" | cat -s + else + echo "WARNING:" + echo "WARNING: to better show manual pages, install 'man-db' package" + echo "WARNING:" + cat "$1" + fi +} + +export MAN_KEEP_FORMATTING=1 + +case "$1" in +*.[1-9n].bz2|*.[1-9]x.bz2|*.man.bz2|*.[1-9n].[glx]z|*.[1-9]x.[glx]z|*.man.[glx]z|*.[1-9n].lzma|*.[1-9]x.lzma|*.man.lzma|*.[1-9n].zst|*.[1-9]x.zst|*.man.zst|*.[1-9n].br|*.[1-9]x.br|*.man.br) + case "$1" in + *.gz) DECOMPRESSOR="gzip -dc" ;; + *.bz2) DECOMPRESSOR="bzip2 -dc" ;; + *.lz) DECOMPRESSOR="lzip -dc" ;; + *.zst) DECOMPRESSOR="zstd -dcq" ;; + *.br) DECOMPRESSOR="brotli -dc" ;; + *.xz|*.lzma) DECOMPRESSOR="xz -dc" ;; + esac + if [ -n "$DECOMPRESSOR" ] && $DECOMPRESSOR -- "$1" | file - | grep -q troff; then + $DECOMPRESSOR -- "$1" | manfilter - + exit $? + fi ;;& +*.[1-9n]|*.[1-9]x|*.man) + if file "$1" | grep -q troff; then + manfilter "$1" + exit $? + fi ;;& +*.tar) tar tvvf "$1"; exit $? ;; +*.tgz|*.tar.gz|*.tar.[zZ]) tar tzvvf "$1"; exit $? ;; +*.tar.xz) tar Jtvvf "$1"; exit $? ;; +*.xz|*.lzma) xz -dc -- "$1"; exit $? ;; +*.tar.lz) tar --lzip -tvvf "$1"; exit $? ;; +*.lz) lzip -dc -- "$1"; exit $? ;; +*.tar.zst) tar --zstd -tvvf "$1"; exit $? ;; +*.zst) zstd -dcq -- "$1"; exit $? ;; +*.tar.br) brotli -dc -- "$1" | tar tvvf -; exit $? ;; +*.br) brotli -dc -- "$1"; exit $? ;; +*.tar.bz2|*.tbz2) bzip2 -dc -- "$1" | tar tvvf -; exit $? ;; +*.[zZ]|*.gz) gzip -dc -- "$1"; exit $? ;; +*.bz2) bzip2 -dc -- "$1"; exit $? ;; +*.zip|*.jar|*.nbm) zipinfo -- "$1"; exit $? ;; +# --nomanifest -> rhbz#1450277 +*.rpm) rpm -qpivl --changelog --nomanifest -- "$1"; exit $? ;; +*.cpi|*.cpio) cpio -itv < "$1"; exit $? ;; +*.gpg) + if [ -x /usr/bin/gpg2 ]; then + gpg2 -d "$1" + exit $? + elif [ -x /usr/bin/gpg ]; then + gpg -d "$1" + exit $? + else + echo "No GnuPG available." + echo "Install gnupg2 or gnupg to show encrypted files." + exit 1 + fi ;; +*.gif|*.jpeg|*.jpg|*.pcd|*.png|*.tga|*.tiff|*.tif) + if [ -x /usr/bin/identify ]; then + identify "$1" + exit $? + elif [ -x /usr/bin/gm ]; then + gm identify "$1" + exit $? + else + echo "No identify available" + echo "Install ImageMagick or GraphicsMagick to browse images" + exit 1 + fi ;; +*) + if [ -x /usr/bin/file ] && [ -x /usr/bin/iconv ] && [ -x /usr/bin/cut ]; then + case `file -b "$1"` in + *UTF-16*) conv='UTF-16' ;; + *UTF-32*) conv='UTF-32' ;; + esac + if [ -n "$conv" ]; then + env=`echo $LANG | cut -d. -f2` + if [ -n "$env" -a "$conv" != "$env" ]; then + iconv -f $conv -t $env "$1" + exit $? + fi + fi + fi + exit 1 +esac