Compare commits

...

5 Commits
master ... f8

Author SHA1 Message Date
Fedora Release Engineering
de5c6334e5 dist-git conversion 2010-07-28 20:36:17 +00:00
Bill Nottingham
264755bb76 Fix typo that causes a failure to update the common directory. (releng
#2781)
2009-11-26 01:45:09 +00:00
Zdenek Prikryl
9848656db4 Fixed -F option Resolves: #427551 2008-01-18 13:32:54 +00:00
Zdenek Prikryl
4f7a8e357e Fixed sigsegv when displaying non-existing file after short file Resolves:
#426107
2007-12-19 09:37:36 +00:00
Jesse Keating
e2c13d07a5 Initialize branch F-8 for less 2007-10-20 22:55:27 +00:00
5 changed files with 200 additions and 28 deletions

View File

View File

@ -1,21 +0,0 @@
# Makefile for source rpm: less
# $Id: Makefile,v 1.1 2004/09/09 07:11:51 cvsdist Exp $
NAME := less
SPECFILE = $(firstword $(wildcard *.spec))
define find-makefile-common
for d in common ../common ../../common ; do if [ -f $$d/Makefile.common ] ; then if [ -f $$d/CVS/Root -a -w $$/Makefile.common ] ; then cd $$d ; cvs -Q update ; fi ; echo "$$d/Makefile.common" ; break ; fi ; done
endef
MAKEFILE_COMMON := $(shell $(find-makefile-common))
ifeq ($(MAKEFILE_COMMON),)
# attempt a checkout
define checkout-makefile-common
test -f CVS/Root && { cvs -Q -d $$(cat CVS/Root) checkout common && echo "common/Makefile.common" ; } || { echo "ERROR: I can't figure out how to checkout the 'common' module." ; exit -1 ; } >&2
endef
MAKEFILE_COMMON := $(shell $(checkout-makefile-common))
endif
include $(MAKEFILE_COMMON)

View File

@ -1,6 +1,41 @@
--- less-406/screen.c.pom 2007-06-17 18:56:04.000000000 +0200
+++ less-406/screen.c 2007-06-26 11:10:56.000000000 +0200
@@ -233,6 +233,7 @@ extern int wscroll;
--- less-406/main.c.Foption 2007-06-17 18:56:04.000000000 +0200
+++ less-406/main.c 2008-01-11 10:18:46.000000000 +0100
@@ -33,6 +33,7 @@ public int quitting;
public int secure;
public int dohelp;
public int less_is_more;
+public int line_count;
#if LOGFILE
public int logfile = -1;
@@ -280,6 +281,16 @@ main(argc, argv)
{
if (edit_first()) /* Edit first valid file in cmd line */
quit(QUIT_ERROR);
+ /*
+ * In case that we have only one file and -F, have to get a line
+ * count fot init(). If the line count is less then a height of a term,
+ * the content of the file is printed out and then less quits. Otherwise
+ * -F can not be used
+ */
+ if (nifile() == 1 && quit_if_one_screen)
+ line_count = get_line_count();
+ else if (nifile() > 1) /* In case more than one file, -F can not be used */
+ quit_if_one_screen = FALSE;
}
init();
--- less-406/screen.c.Foption 2007-06-17 18:56:04.000000000 +0200
+++ less-406/screen.c 2008-01-11 10:20:00.000000000 +0100
@@ -204,6 +204,7 @@ public int missing_cap = 0; /* Some capa
static int attrmode = AT_NORMAL;
extern int binattr;
+extern int line_count;
#if !MSDOS_COMPILER
static char *cheaper();
@@ -233,6 +234,7 @@ extern int wscroll;
extern int screen_trashed;
extern int tty;
extern int top_scroll;
@ -8,12 +43,63 @@
extern int oldbot;
#if HILITE_SEARCH
extern int hilite_search;
@@ -1573,7 +1574,7 @@ deinit()
@@ -1534,7 +1536,9 @@ win32_deinit_term()
init()
{
#if !MSDOS_COMPILER
- if (!no_init)
+ if (quit_if_one_screen && line_count >= sc_height)
+ quit_if_one_screen = FALSE;
+ if (!no_init && !quit_if_one_screen)
tputs(sc_init, sc_height, putchr);
if (!no_keypad)
tputs(sc_s_keypad, sc_height, putchr);
@@ -1573,8 +1577,9 @@ deinit()
#if !MSDOS_COMPILER
if (!no_keypad)
tputs(sc_e_keypad, sc_height, putchr);
- if (!no_init)
- tputs(sc_deinit, sc_height, putchr);
+ if (!no_init && !quit_if_one_screen)
tputs(sc_deinit, sc_height, putchr);
+ tputs(sc_deinit, sc_height, putchr);
+
#else
/* Restore system colors. */
SETCOLORS(sy_fg_color, sy_bg_color);
--- less-406/funcs.h.Foption 2007-03-24 07:27:54.000000000 +0100
+++ less-406/funcs.h 2008-01-11 09:36:16.000000000 +0100
@@ -126,6 +126,7 @@
public void forward ();
public void backward ();
public int get_back_scroll ();
+ public int get_line_count ();
public void del_ifile ();
public IFILE next_ifile ();
public IFILE prev_ifile ();
--- less-406/forwback.c.Foption 2007-06-17 18:56:04.000000000 +0200
+++ less-406/forwback.c 2008-01-11 09:37:15.000000000 +0100
@@ -410,3 +410,24 @@ get_back_scroll()
return (sc_height - 2);
return (10000); /* infinity */
}
+
+/*
+ * Get line count of file
+ */
+ public int
+get_line_count()
+{
+ int nlines = 0;
+ POSITION pos;
+
+ pos = position(TOP);
+
+ while (pos != NULL_POSITION)
+ {
+ pos = forw_line(pos);
+ nlines++;
+ }
+
+ return nlines;
+}
+

97
less-406-nonexfile.patch Normal file
View File

@ -0,0 +1,97 @@
--- less-406/ch.c.nonexfile 2007-06-17 18:56:04.000000000 +0200
+++ less-406/ch.c 2007-12-19 10:27:54.000000000 +0100
@@ -128,6 +128,9 @@ fch_get()
POSITION pos;
POSITION len;
+ if (thisfile == NULL)
+ return (EOI);
+
slept = FALSE;
/*
@@ -416,6 +419,9 @@ ch_seek(pos)
BLOCKNUM new_block;
POSITION len;
+ if (thisfile == NULL)
+ return (0);
+
len = ch_length();
if (pos < ch_zero() || (len != NULL_POSITION && pos > len))
return (1);
@@ -450,6 +456,9 @@ ch_end_seek()
{
POSITION len;
+ if (thisfile == NULL)
+ return (0);
+
if (ch_flags & CH_CANSEEK)
ch_fsize = filesize(ch_file);
@@ -503,6 +512,8 @@ ch_beg_seek()
public POSITION
ch_length()
{
+ if (thisfile == NULL)
+ return (NULL_POSITION);
if (ignore_eoi)
return (NULL_POSITION);
if (ch_flags & CH_HELPFILE)
@@ -516,6 +527,8 @@ ch_length()
public POSITION
ch_tell()
{
+ if (thisfile == NULL)
+ return (NULL_POSITION);
return (ch_block * LBUFSIZE) + ch_offset;
}
@@ -527,6 +540,8 @@ ch_forw_get()
{
register int c;
+ if (thisfile == NULL)
+ return (EOI);
c = ch_get();
if (c == EOI)
return (EOI);
@@ -546,6 +561,8 @@ ch_forw_get()
public int
ch_back_get()
{
+ if (thisfile == NULL)
+ return (EOI);
if (ch_offset > 0)
ch_offset --;
else
@@ -586,6 +603,9 @@ ch_flush()
{
register struct buf *bp;
+ if (thisfile == NULL)
+ return;
+
if (!(ch_flags & CH_CANSEEK))
{
/*
@@ -769,6 +789,9 @@ ch_close()
{
int keepstate = FALSE;
+ if (thisfile == NULL)
+ return;
+
if (ch_flags & (CH_CANSEEK|CH_POPENED|CH_HELPFILE))
{
/*
@@ -807,6 +830,8 @@ ch_close()
public int
ch_getflags()
{
+ if (thisfile == NULL)
+ return (0);
return (ch_flags);
}

View File

@ -1,7 +1,7 @@
Summary: A text file browser similar to more, but better
Name: less
Version: 406
Release: 12%{?dist}
Release: 14%{?dist}
License: BSD
Group: Applications/Text
Source: http://www.greenwoodsoftware.com/less/%{name}-%{version}.tar.gz
@ -12,6 +12,7 @@ Patch0: less-382-fixline.patch
Patch1: less-406-Foption.patch
Patch3: less-394-goend.patch
Patch4: less-394-time.patch
Patch5: less-406-nonexfile.patch
URL: http://www.greenwoodsoftware.com/less/
Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
@ -35,6 +36,7 @@ files, and you'll use it frequently.
%patch1 -p1 -b .Foption
%patch3 -p1 -b .goend
%patch4 -p1 -b .time
%patch5 -p1 -b .nonexfile
chmod -R a+w *
chmod 644 lessecho.c lesskey.c version.c LICENSE
@ -63,6 +65,14 @@ ls -la $RPM_BUILD_ROOT/etc/profile.d
rm -rf $RPM_BUILD_ROOT
%changelog
* Fri Jan 18 2008 Zdenek Prikryl <iprikryl@redhat.com> - 406-14
- Fixed -F option
- Resolves: #427551
* Wed Dec 19 2007 Zdenek Prikryl <iprikryl@redhat.com> - 406-13
- Fixed sigsegv when displaying non-existing file after short file
- Resolves: #426107
* Mon Oct 1 2007 Ivana Varekova <varekova@redhat.com> - 406-12
- change license tag
- fix 312591 - add which dependency