- Fix for valid empty LESSOPEN pipe output

Resolves: #579251, #615303
- The new "--old-bot" option is not documented in the man page
  Resolves: #510724
- Fix descriptions of some options in online help
  Resolves: #578289 (Jeff Bastian <jbastian@redhat.com>)[IT603793]
This commit is contained in:
Vojtech Vitek (V-Teq) 2010-12-22 14:29:55 +01:00
parent c90d7c25e5
commit 3749773d1d
5 changed files with 119 additions and 3 deletions

View File

@ -0,0 +1,39 @@
--- less-436/filename.c 2009-07-06 22:52:23.000000000 +0200
+++ less-436_vvitek/filename.c 2010-12-08 16:01:41.269695932 +0100
@@ -879,17 +879,32 @@ open_altfile(filename, pf, pfd)
*/
f = fileno(fd);
SET_BINARY(f);
+ *pfd = (void *) fd;
+ *pf = f;
if (read(f, &c, 1) != 1)
{
/*
- * Pipe is empty. This means there is no alt file.
+ * Error or pipe is empty. Close it and
+ * check exit status of the pipe process.
*/
- pclose(fd);
+ if (pclose(fd) == 0) {
+ /*
+ * Exit status was zero, so the EOF was correct
+ * empty output. Let the program open /dev/null
+ * instead, as the pipe is already closed.
+ * Set force_open to omit bad_file() check
+ * failure, as it is special 'c' pseudo-device.
+ */
+ *pf = 0;
+ *pfd = NULL;
+ force_open = 1;
+ return (save("/dev/null"));
+ }
+ *pf = 0;
+ *pfd = NULL;
return (NULL);
}
ch_ungetchar(c);
- *pfd = (void *) fd;
- *pf = f;
return (save("-"));
}
#endif

50
less-436-help.patch Normal file
View File

@ -0,0 +1,50 @@
diff --git a/help.c b/help.c
index 531aa16..0de6f0f 100644
--- a/help.c
+++ b/help.c
@@ -119,7 +119,7 @@ constant char helpdata[] = {
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','N','u','m','b','e','r',' ','o','f',' ','b','u','f','f','e','r','s','.','\n',
' ',' ','-','B',' ',' ','.','.','.','.','.','.','.','.',' ',' ','-','-','a','u','t','o','-','b','u','f','f','e','r','s','\n',
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','D','o','n','\'','t',' ','a','u','t','o','m','a','t','i','c','a','l','l','y',' ','a','l','l','o','c','a','t','e',' ','b','u','f','f','e','r','s',' ','f','o','r',' ','p','i','p','e','s','.','\n',
-' ',' ','-','c',' ',' ','.','.','.','.','.','.','.','.',' ',' ','-','-','c','l','e','a','r','-','s','c','r','e','e','n','\n',
+' ',' ','-','c',' ',' ','-','C',' ',' ','.','.','.','.',' ',' ','-','-','c','l','e','a','r','-','s','c','r','e','e','n',' ','-','-','C','L','E','A','R','-','S','C','R','E','E','N','\n',
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','R','e','p','a','i','n','t',' ','b','y',' ','c','l','e','a','r','i','n','g',' ','r','a','t','h','e','r',' ','t','h','a','n',' ','s','c','r','o','l','l','i','n','g','.','\n',
' ',' ','-','d',' ',' ','.','.','.','.','.','.','.','.',' ',' ','-','-','d','u','m','b','\n',
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','D','u','m','b',' ','t','e','r','m','i','n','a','l','.','\n',
@@ -151,8 +151,10 @@ constant char helpdata[] = {
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','I','g','n','o','r','e',' ','t','h','e',' ','L','E','S','S','O','P','E','N',' ','e','n','v','i','r','o','n','m','e','n','t',' ','v','a','r','i','a','b','l','e','.','\n',
' ',' ','-','m',' ',' ','-','M',' ',' ','.','.','.','.',' ',' ','-','-','l','o','n','g','-','p','r','o','m','p','t',' ',' ','-','-','L','O','N','G','-','P','R','O','M','P','T','\n',
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','S','e','t',' ','p','r','o','m','p','t',' ','s','t','y','l','e','.','\n',
-' ',' ','-','n',' ',' ','-','N',' ',' ','.','.','.','.',' ',' ','-','-','l','i','n','e','-','n','u','m','b','e','r','s',' ',' ','-','-','L','I','N','E','-','N','U','M','B','E','R','S','\n',
+' ',' ','-','n',' ',' ','.','.','.','.','.','.','.','.',' ',' ','-','-','l','i','n','e','-','n','u','m','b','e','r','s','\n',
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','D','o','n','\'','t',' ','u','s','e',' ','l','i','n','e',' ','n','u','m','b','e','r','s','.','\n',
+' ',' ','-','N',' ',' ','.','.','.','.','.','.','.','.',' ',' ','-','-','L','I','N','E','-','N','U','M','B','E','R','S','\n',
+' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','U','s','e',' ','l','i','n','e',' ','n','u','m','b','e','r','s','.','\n',
' ',' ','-','o',' ','[','_','\b','f','_','\b','i','_','\b','l','_','\b','e',']',' ',' ','.',' ',' ','-','-','l','o','g','-','f','i','l','e','=','[','_','\b','f','_','\b','i','_','\b','l','_','\b','e',']','\n',
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','C','o','p','y',' ','t','o',' ','l','o','g',' ','f','i','l','e',' ','(','s','t','a','n','d','a','r','d',' ','i','n','p','u','t',' ','o','n','l','y',')','.','\n',
' ',' ','-','O',' ','[','_','\b','f','_','\b','i','_','\b','l','_','\b','e',']',' ',' ','.',' ',' ','-','-','L','O','G','-','F','I','L','E','=','[','_','\b','f','_','\b','i','_','\b','l','_','\b','e',']','\n',
diff --git a/less.hlp b/less.hlp
index 15ece5a..186e409 100644
--- a/less.hlp
+++ b/less.hlp
@@ -116,7 +116,7 @@
Number of buffers.
-B ........ --auto-buffers
Don't automatically allocate buffers for pipes.
- -c ........ --clear-screen
+ -c -C .... --clear-screen --CLEAR-SCREEN
Repaint by clearing rather than scrolling.
-d ........ --dumb
Dumb terminal.
@@ -148,8 +148,10 @@
Ignore the LESSOPEN environment variable.
-m -M .... --long-prompt --LONG-PROMPT
Set prompt style.
- -n -N .... --line-numbers --LINE-NUMBERS
+ -n ........ --line-numbers
Don't use line numbers.
+ -N ........ --LINE-NUMBERS
+ Use line numbers.
-o [_f_i_l_e] . --log-file=[_f_i_l_e]
Copy to log file (standard input only).
-O [_f_i_l_e] . --LOG-FILE=[_f_i_l_e]

View File

@ -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,

View File

@ -1,7 +1,7 @@
Summary: A text file browser similar to more, but better Summary: A text file browser similar to more, but better
Name: less Name: less
Version: 436 Version: 436
Release: 6%{?dist} Release: 7%{?dist}
License: GPLv3+ License: GPLv3+
Group: Applications/Text Group: Applications/Text
Source: http://www.greenwoodsoftware.com/less/%{name}-%{version}.tar.gz Source: http://www.greenwoodsoftware.com/less/%{name}-%{version}.tar.gz
@ -11,7 +11,10 @@ Source3: less.csh
Patch1: less-406-Foption.patch Patch1: less-406-Foption.patch
Patch4: less-394-time.patch Patch4: less-394-time.patch
Patch5: less-418-fsync.patch Patch5: less-418-fsync.patch
Patch6: less-436-manpage.patch Patch6: less-436-manpage-add-old-bot-option.patch
Patch7: less-436-manpage-del-extra-line.patch
Patch8: less-436-help.patch
Patch9: less-436-empty-lessopen-pipe.patch
URL: http://www.greenwoodsoftware.com/less/ URL: http://www.greenwoodsoftware.com/less/
Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: ncurses-devel BuildRequires: ncurses-devel
@ -33,7 +36,10 @@ files, and you'll use it frequently.
%patch1 -p1 -b .Foption %patch1 -p1 -b .Foption
%patch4 -p1 -b .time %patch4 -p1 -b .time
%patch5 -p1 -b .fsync %patch5 -p1 -b .fsync
%patch6 -p1 -b .manpage %patch6 -p1 -b .manpage-add-old-bot-option
%patch7 -p1 -b .manpage-del-extra-line
%patch8 -p1 -b .help
%patch9 -p1 -b .empty-lessopen-pipe
autoreconf autoreconf
@ -65,6 +71,14 @@ ls -la $RPM_BUILD_ROOT/etc/profile.d
rm -rf $RPM_BUILD_ROOT rm -rf $RPM_BUILD_ROOT
%changelog %changelog
* Wed Dec 22 2010 Vojtech Vitek (V-Teq) <vvitek@redhat.com> - 436-7
- Fix for valid empty LESSOPEN pipe output
Resolves: #579251, #615303
- The new "--old-bot" option is not documented in the man page
Resolves: #510724
- Fix descriptions of some options in online help
Resolves: #578289 (Jeff Bastian <jbastian@redhat.com>)[IT603793]
* Wed Jan 20 2010 Nikola Pajkovsky <npajkovs@redhat.com> - 436-6 * Wed Jan 20 2010 Nikola Pajkovsky <npajkovs@redhat.com> - 436-6
- RFE: lesspipe.sh could use a support for *.xz file - RFE: lesspipe.sh could use a support for *.xz file