Import less v358.

This commit is contained in:
ps 2000-07-14 09:51:40 +00:00
parent 1b28029810
commit 5d465776b9
29 changed files with 1312 additions and 960 deletions

View File

@ -16,7 +16,7 @@ SRC = \
output.c position.c prompt.c search.c signal.c \
tags.c ttyin.c version.c
DISTFILES_W = \
defines.ds Makefile.dsb Makefile.dsg Makefile.dsm \
defines.ds Makefile.dsb Makefile.dsg Makefile.dsu \
defines.o2 Makefile.o2e \
defines.o9 Makefile.o9c Makefile.o9u \
defines.wn Makefile.wnm Makefile.wnb

58
contrib/less/Makefile.dsu Normal file
View File

@ -0,0 +1,58 @@
# Makefile for less.
# MS-DOS version
#### Start of system configuration section. ####
CC = cl
# Change the following directories to match your installation.
LIBDIR = c:\msvc\lib
INCDIR = c:\msvc\include
# CFLAGS are compile-time options and LDFLAGS are link-time options. They are
# customized for MSVC 1.0 (MSC 8.0). If you have a different version of the
# compiler, you may need to change some of the options to their equivalents.
# -Ot optimize for speed
# -AL large memory model
# -Za ANSI C conformance
# -nologo suppress MSVC banners
# -onerror:noexe no .EXE file if link errors occur
CFLAGS = -Ot -AL -Za -nologo
LDFLAGS = -onerror:noexe -nologo
LIBS = $(LIBDIR)\llibce.lib $(LIBDIR)\graphics.lib
#### End of system configuration section. ####
# This rule allows us to supply the necessary -D options
# in addition to whatever the user asks for.
.c.obj:
$(CC) -c -I. -I$(INCDIR) $(CPPFLAGS) $(CFLAGS) $<
OBJ = main.obj screen.obj brac.obj ch.obj charset.obj cmdbuf.obj command.obj \
decode.obj edit.obj filename.obj forwback.obj help.obj ifile.obj \
input.obj jump.obj line.obj linenum.obj lsystem.obj \
mark.obj optfunc.obj option.obj opttbl.obj os.obj output.obj \
position.obj prompt.obj search.obj signal.obj tags.obj \
ttyin.obj version.obj
all: less lesskey
# This is really horrible, but the command line is too long for
# MS-DOS if we try to link $(OBJ).
less: $(OBJ)
-if exist lesskey.obj del lesskey.obj
$(CC) $(LDFLAGS) -o $@ *.obj $(LIBS)
lesskey: lesskey.obj version.obj
$(CC) $(LDFLAGS) -o $@ lesskey.obj version.obj $(LIBS)
defines.h: defines.ds
-del defines.h
-copy defines.ds defines.h
$(OBJ): less.h defines.h
clean:
-del *.obj
-del less.exe
-del lesskey.exe

View File

@ -10,6 +10,20 @@
To report bugs, suggestions or comments, send email to
bug-less@gnu.org or marknu@flash.net.
======================================================================
Major changes between "less" versions 354 and 358
* Add -J (--status-column) option to display a status column.
* Add -# (--shift) option to set default horizontal shift distance.
Default horizontal shift distance is now one-half screen width.
* Horizontal shifting does not shift line numbers if -N is in effect.
* Horizontal shifting acts as though -S were set, to avoid confusion.
======================================================================

View File

@ -1,7 +1,7 @@
Less, version 354
Less, version 358
This is the distribution of less, version 354, released 23 Mar 2000.
This is the distribution of less, version 358, released 08 Jul 2000.
This program is part of the GNU project (http://www.gnu.org).
This program is free software. You may redistribute it and/or
@ -106,7 +106,7 @@ INSTALLATION (MS-DOS systems only,
Depending on your compiler, you may need to convert the source
to have CR-LF rather than LF as line terminators.
2. If you are using Microsoft C, rename MAKEFILE.DSM to MAKEFILE.
2. If you are using Microsoft C, rename MAKEFILE.DSU to MAKEFILE.
If you are using Borland C, rename MAKEFILE.DSB to MAKEFILE.
If you are using DJGPP, rename MAKEFILE.DSG to MAKEFILE.

View File

@ -66,5 +66,11 @@
/* Define HAVE_UPPER_LOWER if you have isupper, islower, toupper, tolower */
#undef HAVE_UPPER_LOWER
/* Define HAVE_SIGSET_T you have the sigset_t type */
#undef HAVE_SIGSET_T
/* Define HAVE_SIGEMPTYSET if you have the sigemptyset macro */
#undef HAVE_SIGEMPTYSET
/* Define EDIT_PGM to your editor. */
#define EDIT_PGM "vi"

View File

@ -50,6 +50,7 @@ extern char *editor;
extern char *editproto;
#endif
extern int screen_trashed; /* The screen has been overwritten */
extern int shift_count;
static char ungot[UNGOT_SIZE];
static char *ungotp = NULL;
@ -1502,7 +1503,8 @@ commands()
case A_LSHIFT:
if (number <= 0)
number = 8;
number = (shift_count > 0) ?
shift_count : sc_width / 2;
if (number > hshift)
number = hshift;
hshift -= number;
@ -1511,7 +1513,8 @@ commands()
case A_RSHIFT:
if (number <= 0)
number = 8;
number = (shift_count > 0) ?
shift_count : sc_width / 2;
hshift += number;
screen_trashed = 1;
break;

118
contrib/less/configure vendored
View File

@ -1730,7 +1730,7 @@ cat >> confdefs.h <<EOF
EOF
for ac_func in memcpy popen _setjmp sigsetmask stat strchr strstr system
for ac_func in memcpy popen _setjmp sigprocmask sigsetmask stat strchr strstr system
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
echo "configure:1737: checking for $ac_func" >&5
@ -1922,11 +1922,63 @@ else
fi
rm -f conftest*
echo $ac_n "checking for sigset_t""... $ac_c" 1>&6
echo "configure:1927: checking for sigset_t" >&5
cat > conftest.$ac_ext <<EOF
#line 1929 "configure"
#include "confdefs.h"
#include <signal.h>
int main() {
sigset_t s; s = 0;
; return 0; }
EOF
if { (eval echo configure:1938: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
echo "$ac_t""yes" 1>&6; cat >> confdefs.h <<\EOF
#define HAVE_SIGSET_T 1
EOF
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
echo "$ac_t""no" 1>&6
fi
rm -f conftest*
echo $ac_n "checking for sigemptyset""... $ac_c" 1>&6
echo "configure:1953: checking for sigemptyset" >&5
cat > conftest.$ac_ext <<EOF
#line 1955 "configure"
#include "confdefs.h"
#include <signal.h>
int main() {
sigset_t s; sigemptyset(&s);
; return 0; }
EOF
if { (eval echo configure:1964: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
echo "$ac_t""yes" 1>&6; cat >> confdefs.h <<\EOF
#define HAVE_SIGEMPTYSET 1
EOF
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
echo "$ac_t""no" 1>&6
fi
rm -f conftest*
have_errno=no
echo $ac_n "checking for errno""... $ac_c" 1>&6
echo "configure:1928: checking for errno" >&5
echo "configure:1980: checking for errno" >&5
cat > conftest.$ac_ext <<EOF
#line 1930 "configure"
#line 1982 "configure"
#include "confdefs.h"
#if HAVE_ERRNO_H
@ -1936,7 +1988,7 @@ int main() {
static int x; x = errno;
; return 0; }
EOF
if { (eval echo configure:1940: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
if { (eval echo configure:1992: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
echo "$ac_t""yes - in errno.h" 1>&6; cat >> confdefs.h <<\EOF
#define HAVE_ERRNO 1
@ -1949,7 +2001,7 @@ fi
rm -f conftest*
if test $have_errno = no; then
cat > conftest.$ac_ext <<EOF
#line 1953 "configure"
#line 2005 "configure"
#include "confdefs.h"
#if HAVE_ERRNO_H
@ -1959,7 +2011,7 @@ int main() {
extern int errno; static int x; x = errno;
; return 0; }
EOF
if { (eval echo configure:1963: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
if { (eval echo configure:2015: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
echo "$ac_t""yes - must define" 1>&6; cat >> confdefs.h <<\EOF
#define HAVE_ERRNO 1
@ -1978,9 +2030,9 @@ rm -f conftest*
fi
echo $ac_n "checking for locale""... $ac_c" 1>&6
echo "configure:1982: checking for locale" >&5
echo "configure:2034: checking for locale" >&5
cat > conftest.$ac_ext <<EOF
#line 1984 "configure"
#line 2036 "configure"
#include "confdefs.h"
#include <locale.h>
#include <ctype.h>
@ -1988,7 +2040,7 @@ int main() {
setlocale(LC_CTYPE,""); isprint(0); iscntrl(0);
; return 0; }
EOF
if { (eval echo configure:1992: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
if { (eval echo configure:2044: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
echo "$ac_t""yes" 1>&6; cat >> confdefs.h <<\EOF
#define HAVE_LOCALE 1
@ -2002,9 +2054,9 @@ else
fi
rm -f conftest*
echo $ac_n "checking for ctype functions""... $ac_c" 1>&6
echo "configure:2006: checking for ctype functions" >&5
echo "configure:2058: checking for ctype functions" >&5
cat > conftest.$ac_ext <<EOF
#line 2008 "configure"
#line 2060 "configure"
#include "confdefs.h"
#if HAVE_CTYPE_H
@ -2014,7 +2066,7 @@ int main() {
static int x; x = isupper(x); x = tolower(x); x = toupper(x);
; return 0; }
EOF
if { (eval echo configure:2018: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
if { (eval echo configure:2070: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
echo "$ac_t""yes" 1>&6; cat >> confdefs.h <<\EOF
#define HAVE_UPPER_LOWER 1
@ -2030,9 +2082,9 @@ rm -f conftest*
have_ospeed=no
echo $ac_n "checking termcap for ospeed""... $ac_c" 1>&6
echo "configure:2034: checking termcap for ospeed" >&5
echo "configure:2086: checking termcap for ospeed" >&5
cat > conftest.$ac_ext <<EOF
#line 2036 "configure"
#line 2088 "configure"
#include "confdefs.h"
#include <sys/types.h>
@ -2046,7 +2098,7 @@ int main() {
ospeed = 0;
; return 0; }
EOF
if { (eval echo configure:2050: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
if { (eval echo configure:2102: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
echo "$ac_t""yes - in termcap.h" 1>&6; cat >> confdefs.h <<\EOF
#define HAVE_OSPEED 1
@ -2059,14 +2111,14 @@ fi
rm -f conftest*
if test $have_ospeed = no; then
cat > conftest.$ac_ext <<EOF
#line 2063 "configure"
#line 2115 "configure"
#include "confdefs.h"
int main() {
extern short ospeed; ospeed = 0;
; return 0; }
EOF
if { (eval echo configure:2070: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
if { (eval echo configure:2122: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
echo "$ac_t""yes - must define" 1>&6; cat >> confdefs.h <<\EOF
#define HAVE_OSPEED 1
@ -2087,7 +2139,7 @@ fi
have_regex=no
have_posix_regex=unknown
echo $ac_n "checking for regcomp""... $ac_c" 1>&6
echo "configure:2091: checking for regcomp" >&5
echo "configure:2143: checking for regcomp" >&5
WANT_REGEX=auto
# Check whether --with-regex or --without-regex was given.
@ -2103,7 +2155,7 @@ if test "$cross_compiling" = yes; then
have_posix_regex=unknown
else
cat > conftest.$ac_ext <<EOF
#line 2107 "configure"
#line 2159 "configure"
#include "confdefs.h"
#include <sys/types.h>
@ -2118,7 +2170,7 @@ if (rm.rm_sp != text + 1) exit(1); /* check for correct offset */
#endif
exit(0); }
EOF
if { (eval echo configure:2122: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
if { (eval echo configure:2174: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
have_posix_regex=yes
else
@ -2139,7 +2191,7 @@ EOF
have_regex=yes
elif test $have_posix_regex = unknown; then
cat > conftest.$ac_ext <<EOF
#line 2143 "configure"
#line 2195 "configure"
#include "confdefs.h"
#include <sys/types.h>
@ -2148,7 +2200,7 @@ int main() {
regex_t *r; regfree(r);
; return 0; }
EOF
if { (eval echo configure:2152: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
if { (eval echo configure:2204: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
echo "$ac_t""using POSIX regcomp" 1>&6
cat >> confdefs.h <<\EOF
@ -2169,7 +2221,7 @@ fi
if test $have_regex = no; then
if test $WANT_REGEX = auto -o $WANT_REGEX = pcre; then
echo $ac_n "checking for pcre_compile in -lpcre""... $ac_c" 1>&6
echo "configure:2173: checking for pcre_compile in -lpcre" >&5
echo "configure:2225: checking for pcre_compile in -lpcre" >&5
ac_lib_var=`echo pcre'_'pcre_compile | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@ -2177,7 +2229,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lpcre $LIBS"
cat > conftest.$ac_ext <<EOF
#line 2181 "configure"
#line 2233 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@ -2188,7 +2240,7 @@ int main() {
pcre_compile()
; return 0; }
EOF
if { (eval echo configure:2192: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
if { (eval echo configure:2244: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@ -2217,12 +2269,12 @@ fi
if test $have_regex = no; then
if test $WANT_REGEX = auto -o $WANT_REGEX = regcmp; then
echo $ac_n "checking for regcmp""... $ac_c" 1>&6
echo "configure:2221: checking for regcmp" >&5
echo "configure:2273: checking for regcmp" >&5
if eval "test \"`echo '$''{'ac_cv_func_regcmp'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 2226 "configure"
#line 2278 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char regcmp(); below. */
@ -2245,7 +2297,7 @@ regcmp();
; return 0; }
EOF
if { (eval echo configure:2249: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
if { (eval echo configure:2301: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_func_regcmp=yes"
else
@ -2273,7 +2325,7 @@ fi
if test $have_regex = no; then
if test $WANT_REGEX = auto -o $WANT_REGEX = regcomp; then
cat > conftest.$ac_ext <<EOF
#line 2277 "configure"
#line 2329 "configure"
#include "confdefs.h"
#include "regexp.h"
@ -2281,7 +2333,7 @@ int main() {
regcomp("");
; return 0; }
EOF
if { (eval echo configure:2285: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
if { (eval echo configure:2337: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
echo "$ac_t""using V8 regcomp" 1>&6; cat >> confdefs.h <<\EOF
#define HAVE_V8_REGCOMP 1
@ -2310,12 +2362,12 @@ fi
if test $have_regex = no; then
if test $WANT_REGEX = auto -o $WANT_REGEX = re_comp; then
echo "$ac_t""using re_comp" 1>&6; echo $ac_n "checking for re_comp""... $ac_c" 1>&6
echo "configure:2314: checking for re_comp" >&5
echo "configure:2366: checking for re_comp" >&5
if eval "test \"`echo '$''{'ac_cv_func_re_comp'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 2319 "configure"
#line 2371 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char re_comp(); below. */
@ -2338,7 +2390,7 @@ re_comp();
; return 0; }
EOF
if { (eval echo configure:2342: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
if { (eval echo configure:2394: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_func_re_comp=yes"
else

View File

@ -139,7 +139,7 @@ AC_TRY_COMPILE([#include <time.h>], [time_t t = 0;],
dnl Checks for functions and external variables.
AC_TYPE_SIGNAL
AC_CHECK_FUNCS(memcpy popen _setjmp sigsetmask stat strchr strstr system)
AC_CHECK_FUNCS(memcpy popen _setjmp sigprocmask sigsetmask stat strchr strstr system)
dnl Some systems have termios.h but not the corresponding functions.
AC_CHECK_FUNC(tcgetattr, AC_DEFINE(HAVE_TERMIOS_FUNCS))
@ -168,6 +168,18 @@ AC_MSG_CHECKING(for sys_errlist)
AC_TRY_LINK(, [extern char *sys_errlist[]; static char **x; x = sys_errlist;],
[AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SYS_ERRLIST)], [AC_MSG_RESULT(no)])
AC_MSG_CHECKING(for sigset_t)
AC_TRY_LINK([
#include <signal.h>
], [sigset_t s; s = 0;],
[AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SIGSET_T)], [AC_MSG_RESULT(no)])
AC_MSG_CHECKING(for sigemptyset)
AC_TRY_LINK([
#include <signal.h>
], [sigset_t s; sigemptyset(&s);],
[AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SIGEMPTYSET)], [AC_MSG_RESULT(no)])
have_errno=no
AC_MSG_CHECKING(for errno)
AC_TRY_LINK([

View File

@ -373,7 +373,7 @@ add_var_table(tlist, buf, len)
/*
* Search a single command table for the command string in cmd.
*/
public int
static int
cmd_search(cmd, table, endtable, sp)
char *cmd;
char *table;
@ -384,6 +384,7 @@ cmd_search(cmd, table, endtable, sp)
register char *q;
register int a;
*sp = NULL;
for (p = table, q = cmd; p < endtable; p++, q++)
{
if (*p == *q)
@ -417,8 +418,7 @@ cmd_search(cmd, table, endtable, sp)
{
*sp = ++p;
a &= ~A_EXTRA;
} else
*sp = NULL;
}
return (a);
}
} else if (*q == '\0')
@ -484,6 +484,8 @@ cmd_decode(tlist, cmd, sp)
if (action != A_INVALID)
break;
}
if (action == A_UINVALID)
action = A_INVALID;
return (action);
}

View File

@ -281,6 +281,13 @@
/* Define if you have the sigsetmask function. */
#define HAVE_SIGSETMASK 0
/* Define if you have the sigprocmask function. */
#define HAVE_SIGPROCMASK 0
/* Define if you have the sigset_t type and sigemptyset macro */
#define HAVE_SIGSET_T 0
#define HAVE_SIGEMPTYSET 0
/* Define if you have the stat function. */
#define HAVE_STAT 1

View File

@ -241,6 +241,12 @@
/* Define HAVE_UPPER_LOWER if you have isupper, islower, toupper, tolower */
#undef HAVE_UPPER_LOWER
/* Define HAVE_SIGSET_T you have the sigset_t type */
#undef HAVE_SIGSET_T
/* Define HAVE_SIGEMPTYSET if you have the sigemptyset macro */
#undef HAVE_SIGEMPTYSET
/* Define EDIT_PGM to your editor. */
#define EDIT_PGM "vi"
@ -253,6 +259,9 @@
/* Define if you have the popen function. */
#undef HAVE_POPEN
/* Define if you have the sigprocmask function. */
#undef HAVE_SIGPROCMASK
/* Define if you have the sigsetmask function. */
#undef HAVE_SIGSETMASK

View File

@ -244,6 +244,13 @@
/* Define if you have the sigsetmask function. */
#define HAVE_SIGSETMASK 0
/* Define if you have the sigprocmask function. */
#define HAVE_SIGPROCMASK 0
/* Define if you have the sigset_t type and sigemptyset macro */
#define HAVE_SIGSET_T 0
#define HAVE_SIGEMPTYSET 0
/* Define if you have the stat function. */
#define HAVE_STAT 1

View File

@ -261,6 +261,13 @@
/* Define if you have the sigsetmask function. */
#define HAVE_SIGSETMASK 0
/* Define if you have the sigprocmask function. */
#define HAVE_SIGPROCMASK 0
/* Define if you have the sigset_t type and sigemptyset macro */
#define HAVE_SIGSET_T 0
#define HAVE_SIGEMPTYSET 0
/* Define if you have the stat function. */
#define HAVE_STAT 0

View File

@ -245,6 +245,13 @@
/* Define if you have the sigsetmask function. */
#define HAVE_SIGSETMASK 0
/* Define if you have the sigprocmask function. */
#define HAVE_SIGPROCMASK 0
/* Define if you have the sigset_t type and sigemptyset macro */
#define HAVE_SIGSET_T 0
#define HAVE_SIGEMPTYSET 0
/* Define if you have the stat function. */
#define HAVE_STAT 1

View File

@ -72,7 +72,6 @@
public void init_cmds ();
public void add_fcmd_table ();
public void add_ecmd_table ();
public int cmd_search ();
public int fcmd_decode ();
public int ecmd_decode ();
public char * lgetenv ();

View File

@ -140,6 +140,8 @@ constant char helpdata[] = {
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','I','g','n','o','r','e',' ','c','a','s','e',' ','i','n',' ','a','l','l',' ','s','e','a','r','c','h','e','s','.','\n',
' ',' ','-','j',' ','[','_','\b','N',']',' ',' ','.','.','.','.',' ',' ','-','-','j','u','m','p','-','t','a','r','g','e','t','=','[','_','\b','N',']','\n',
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','S','c','r','e','e','n',' ','p','o','s','i','t','i','o','n',' ','o','f',' ','t','a','r','g','e','t',' ','l','i','n','e','s','.','\n',
' ',' ','-','J',' ',' ','.','.','.','.','.','.','.','.',' ',' ','-','-','s','t','a','t','u','s','-','c','o','l','u','m','n','\n',
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','D','i','s','p','l','a','y',' ','a',' ','s','t','a','t','u','s',' ','c','o','l','u','m','n',' ','a','t',' ','l','e','f','t',' ','e','d','g','e',' ','o','f',' ','s','c','r','e','e','n','.','\n',
' ',' ','-','k',' ','[','_','\b','f','_','\b','i','_','\b','l','_','\b','e',']',' ',' ','.',' ',' ','-','-','l','e','s','s','k','e','y','-','f','i','l','e','=','[','_','\b','f','_','\b','i','_','\b','l','_','\b','e',']','\n',
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','U','s','e',' ','a',' ','l','e','s','s','k','e','y',' ','f','i','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',
@ -186,6 +188,9 @@ constant char helpdata[] = {
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','S','e','t',' ','s','h','e','l','l',' ','q','u','o','t','e',' ','c','h','a','r','a','c','t','e','r','s','.','\n',
' ',' ','-','~',' ',' ','.','.','.','.','.','.','.','.',' ',' ','-','-','t','i','l','d','e','\n',
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','D','o','n','\'','t',' ','d','i','s','p','l','a','y',' ','t','i','l','d','e','s',' ','a','f','t','e','r',' ','e','n','d',' ','o','f',' ','f','i','l','e','.','\n',
' ',' ','-','#',' ','[','_','\b','N',']',' ',' ','.','.','.','.',' ',' ','-','-','s','h','i','f','t','=','[','_','\b','N',']','\n',
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','H','o','r','i','z','o','n','t','a','l',' ','s','c','r','o','l','l',' ','a','m','o','u','n','t',' ','(','0',' ','=',' ','o','n','e',' ','h','a','l','f',' ','s','c','r','e','e','n',' ','w','i','d','t','h',')','\n',
'\n',
' ','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','\n',
'\n',
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','L','\b','L','I','\b','I','N','\b','N','E','\b','E',' ','E','\b','E','D','\b','D','I','\b','I','T','\b','T','I','\b','I','N','\b','N','G','\b','G','\n',

View File

@ -23,6 +23,7 @@
extern int squeeze;
extern int chopline;
extern int hshift;
extern int quit_if_one_screen;
extern int sigs;
extern int ignore_eoi;
@ -111,7 +112,7 @@ forw_line(curr_pos)
* is too long to print in the screen width.
* End the line here.
*/
if (chopline)
if (chopline || hshift > 0)
{
do
{
@ -289,7 +290,7 @@ back_line(curr_pos)
* reached our curr_pos yet. Discard the line
* and start a new one.
*/
if (chopline)
if (chopline || hshift > 0)
{
endline = TRUE;
quit_if_one_screen = FALSE;

View File

@ -139,7 +139,7 @@ void free();
/*
* Special types and constants.
*/
typedef long POSITION;
typedef off_t POSITION;
#define PR_POSITION "%ld"
#define MAX_PRINT_POSITION 20
#define MAX_PRINT_INT 10
@ -359,6 +359,20 @@ struct textlist
#define LSIGNAL(sig,func) signal(sig,func)
#endif
#if HAVE_SIGPROCMASK
#if HAVE_SIGSET_T
#else
#undef HAVE_SIGPROCMASK
#endif
#endif
#if HAVE_SIGPROCMASK
#if HAVE_SIGEMPTYSET
#else
#undef sigemptyset
#define sigemptyset(mp) *(mp) = 0
#endif
#endif
#define S_INTERRUPT 01
#define S_STOP 02
#define S_WINCH 04

View File

@ -137,6 +137,8 @@
Ignore case in all searches.
-j [_N] .... --jump-target=[_N]
Screen position of target lines.
-J ........ --status-column
Display a status column at left edge of screen.
-k [_f_i_l_e] . --lesskey-file=[_f_i_l_e]
Use a lesskey file.
-m -M .... --long-prompt --LONG-PROMPT
@ -183,6 +185,9 @@
Set shell quote characters.
-~ ........ --tilde
Don't display tildes after end of file.
-# [_N] .... --shift=[_N]
Horizontal scroll amount (0 = one half screen width)
---------------------------------------------------------------------------
LLIINNEE EEDDIITTIINNGG

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
.TH LESS 1 "Version 354: 23 Mar 2000"
.TH LESS 1 "Version 358: 08 Jul 2000"
.SH NAME
less \- opposite of more
.SH SYNOPSIS
@ -86,13 +86,16 @@ Scroll backward N lines, default one half of the screen size.
If N is specified, it becomes the new default for
subsequent d and u commands.
.IP "ESC-) or RIGHTARROW"
Scroll horizontally right N characters, default 8.
This behaves best if you also set the -S option (chop lines).
Scroll horizontally right N characters, default half the screen width
(see the -# option).
While the text is scrolled, it acts as though the -S option
(chop lines) were in effect.
Note that if you wish to enter a number N, you must use ESC-), not RIGHTARROW,
because the arrow is taken to be a line editing command
(see the LINE EDITING section).
.IP "ESC-( or LEFTARROW"
Scroll horizontally left N characters, default 8.
Scroll horizontally left N characters, default half the screen width
(see the -# option).
.IP "r or ^R or ^L"
Repaint the screen.
.IP R
@ -549,6 +552,9 @@ after the target line.
For example, if "-j4" is used, the target line is the
fourth line on the screen, so searches begin at the fifth line
on the screen.
.IP "-J or --status-column"
Displays a status column at the left edge of the screen.
The status column is used only if the -w or -W option is in effect.
.IP "-k\fIfilename\fP or --lesskey-file=\fIfilename\fP"
Causes
.I less
@ -727,6 +733,8 @@ The first "new" line is the line immediately following the line previously
at the bottom of the screen.
Also highlights the target line after a g or p command.
The highlight is removed at the next command which causes movement.
The entire line is highlighted, unless the -J option is in effect,
in which case only the status column is highlighted.
.IP "-W or --HILITE-UNREAD"
Like -w, but temporarily highlights the first new line after any
forward movement command larger than one line.
@ -776,6 +784,11 @@ remains -" (a dash followed by a double quote).
.IP "-~ or --tilde"
Normally lines after end of file are displayed as a single tilde (~).
This option causes lines after end of file to be displayed as blank lines.
.IP "-# or --shift"
Specifies the default number of positions to scroll horizontally
in the RIGHTARROW and LEFTARROW commands.
If the number specified is zero, it sets the default number of
positions to one half of the screen width.
.IP --
A command line argument of "--" marks the end of option arguments.
Any arguments following this are interpreted as filenames.

View File

@ -101,6 +101,7 @@ struct cmdname cmdnames[] =
"back-search", A_B_SEARCH,
"back-window", A_B_WINDOW,
"debug", A_DEBUG,
"digit", A_DIGIT,
"display-flag", A_DISP_OPTION,
"display-option", A_DISP_OPTION,
"end", A_GOEND,

View File

@ -61,7 +61,7 @@ CCOOMMMMAANNDD SSEECCTTIIOONN
Version 354: 23 Mar 2000 1
Version 358: 08 Jul 2000 1
@ -127,7 +127,7 @@ LESSKEY(1) LESSKEY(1)
Version 354: 23 Mar 2000 2
Version 358: 08 Jul 2000 2
@ -193,7 +193,7 @@ EEXXAAMMPPLLEE
Version 354: 23 Mar 2000 3
Version 358: 08 Jul 2000 3
@ -248,18 +248,18 @@ LESSKEY(1) LESSKEY(1)
H help
h help
V version
q quit
Q quit
:q quit
:Q quit
ZZ quit
0 digit
1 digit
2 digit
3 digit
4 digit
5 digit
6 digit
7 digit
Version 354: 23 Mar 2000 4
Version 358: 08 Jul 2000 4
@ -268,6 +268,15 @@ LESSKEY(1) LESSKEY(1)
LESSKEY(1) LESSKEY(1)
8 digit
9 digit
q quit
Q quit
:q quit
:Q quit
ZZ quit
PPRREECCEEDDEENNCCEE
Commands specified by _l_e_s_s_k_e_y take precedence over the
default commands. A default command key may be disabled
@ -313,6 +322,18 @@ EEXXAAMMPPLLEE
\17 back-complete
\e\t back-complete
^L expand
Version 358: 08 Jul 2000 5
LESSKEY(1) LESSKEY(1)
^V literal
^A literal
\el right
@ -322,18 +343,6 @@ EEXXAAMMPPLLEE
\eb word-left
\e\kl word-left
\ew word-right
Version 354: 23 Mar 2000 5
LESSKEY(1) LESSKEY(1)
\e\kr word-right
\ei insert
\ex delete
@ -380,18 +389,9 @@ EEXXAAMMPPLLEE
SSEEEE AALLSSOO
less(1)
WWAARRNNIINNGGSS
It is not possible to specify special keys, such as upar-
row, in a keyboard-independent manner. The only way to
specify such keys is to specify the escape sequence which
Version 354: 23 Mar 2000 6
Version 358: 08 Jul 2000 6
@ -400,6 +400,14 @@ WWAARRNNIINNGGSS
LESSKEY(1) LESSKEY(1)
SSEEEE AALLSSOO
less(1)
WWAARRNNIINNGGSS
It is not possible to specify special keys, such as upar-
row, in a keyboard-independent manner. The only way to
specify such keys is to specify the escape sequence which
a particular keyboard sends when such a keys is pressed.
On MS-DOS and OS/2 systems, certain keys send a sequence
@ -449,14 +457,6 @@ AAUUTTHHOORR
Version 354: 23 Mar 2000 7
Version 358: 08 Jul 2000 7

View File

@ -1,4 +1,4 @@
.TH LESSKEY 1 "Version 354: 23 Mar 2000"
.TH LESSKEY 1 "Version 358: 08 Jul 2000"
.SH NAME
lesskey \- specify key bindings for less
.SH SYNOPSIS
@ -218,6 +218,16 @@ default command keys used by less:
H help
h help
V version
0 digit
1 digit
2 digit
3 digit
4 digit
5 digit
6 digit
7 digit
8 digit
9 digit
q quit
Q quit
:q quit

View File

@ -18,6 +18,7 @@
#include "less.h"
#define IS_CONT(c) (((c) & 0xC0) == 0x80)
#define LINENUM_WIDTH 8 /* Chars to use for line number */
/* Buffer which holds the current output line */
public char linebuf[LINEBUF_SIZE];
@ -32,6 +33,7 @@ static int column; /* Printable length, accounting for
backspaces, etc. */
static int overstrike; /* Next char should overstrike previous char */
static int is_null_line; /* There is no current line */
static int lmargin; /* Left margin */
static char pendc;
static POSITION pendpos;
static char *end_ansi_chars;
@ -44,6 +46,7 @@ extern int linenums;
extern int ctldisp;
extern int twiddle;
extern int binattr;
extern int status_col;
extern int auto_wrap, ignaw;
extern int bo_s_width, bo_e_width;
extern int ul_s_width, ul_e_width;
@ -51,6 +54,8 @@ extern int bl_s_width, bl_e_width;
extern int so_s_width, so_e_width;
extern int sc_width, sc_height;
extern int utf_mode;
extern POSITION start_attnpos;
extern POSITION end_attnpos;
/*
* Initialize from environment variables.
@ -74,6 +79,11 @@ prewind()
overstrike = 0;
is_null_line = 0;
pendc = '\0';
lmargin = 0;
if (status_col)
lmargin += 1;
if (linenums == OPT_ONPLUS)
lmargin += LINENUM_WIDTH+1;
}
/*
@ -85,42 +95,54 @@ plinenum(pos)
{
register int lno;
register int i;
register int n;
if (linenums == OPT_ONPLUS)
{
/*
* Get the line number and put it in the current line.
* {{ Note: since find_linenum calls forw_raw_line,
* it may seek in the input file, requiring the caller
* of plinenum to re-seek if necessary. }}
* {{ Since forw_raw_line modifies linebuf, we must
* do this first, before storing anything in linebuf. }}
*/
lno = find_linenum(pos);
}
/*
* We display the line number at the start of each line
* only if the -N option is set.
* Display a status column if the -J option is set.
*/
if (linenums != OPT_ONPLUS)
return;
if (status_col)
{
linebuf[curr] = ' ';
if (start_attnpos != NULL_POSITION &&
pos >= start_attnpos && pos < end_attnpos)
attr[curr] = AT_STANDOUT;
else
attr[curr] = 0;
curr++;
column++;
}
/*
* Get the line number and put it in the current line.
* {{ Note: since find_linenum calls forw_raw_line,
* it may seek in the input file, requiring the caller
* of plinenum to re-seek if necessary. }}
* Display the line number at the start of each line
* if the -N option is set.
*/
lno = find_linenum(pos);
sprintf(&linebuf[curr], "%6d", lno);
n = strlen(&linebuf[curr]);
column += n;
for (i = 0; i < n; i++)
attr[curr++] = 0;
if (linenums == OPT_ONPLUS)
{
sprintf(&linebuf[curr], "%*d", LINENUM_WIDTH, lno);
column += LINENUM_WIDTH;
for (i = 0; i < LINENUM_WIDTH; i++)
attr[curr++] = 0;
}
/*
* Append enough spaces to bring us to the next tab stop.
* {{ We could avoid this at the cost of adding some
* complication to the tab stop logic in pappend(). }}
* Append enough spaces to bring us to the lmargin.
*/
if (tabstop == 0)
tabstop = 1;
do
while (column < lmargin)
{
linebuf[curr] = ' ';
attr[curr++] = AT_NORMAL;
column++;
} while (((column + cshift) % tabstop) != 0);
}
}
/*
@ -157,23 +179,23 @@ pshift(shift)
int i;
int real_shift;
if (shift > column)
shift = column;
if (shift > curr)
shift = curr;
if (shift > column - lmargin)
shift = column - lmargin;
if (shift > curr - lmargin)
shift = curr - lmargin;
if (!utf_mode)
real_shift = shift;
else
{
real_shift = utf_len(linebuf, shift);
real_shift = utf_len(linebuf + lmargin, shift);
if (real_shift > curr)
real_shift = curr;
}
for (i = 0; i < curr - real_shift; i++)
{
linebuf[i] = linebuf[i + real_shift];
attr[i] = attr[i + real_shift];
linebuf[lmargin + i] = linebuf[lmargin + i + real_shift];
attr[lmargin + i] = attr[lmargin + i + real_shift];
}
column -= shift;
curr -= real_shift;
@ -474,7 +496,7 @@ do_append(c, pos)
do
{
STOREC(' ', AT_NORMAL);
} while (((column + cshift) % tabstop) != 0);
} while (((column + cshift - lmargin) % tabstop) != 0);
break;
}
} else if (control_char(c))

View File

@ -44,6 +44,8 @@ public int chopline; /* Truncate displayed lines at screen width */
public int no_init; /* Disable sending ti/te termcap strings */
public int twiddle; /* Show tildes after EOF */
public int show_attn; /* Hilite first unread line */
public int shift_count; /* Number of positions to shift horizontally */
public int status_col; /* Display a status column */
#if HILITE_SEARCH
public int hilite_search; /* Highlight matched search patterns? */
#endif
@ -68,6 +70,7 @@ static struct optname g_optname = { "hilite-search", NULL };
static struct optname h_optname = { "max-back-scroll", NULL };
static struct optname i_optname = { "ignore-case", NULL };
static struct optname j_optname = { "jump-target", NULL };
static struct optname J__optname = { "status-column", NULL };
#if USERFILE
static struct optname k_optname = { "lesskey-file", NULL };
#endif
@ -98,6 +101,7 @@ static struct optname z_optname = { "window", NULL };
static struct optname quote_optname = { "quotes", NULL };
static struct optname tilde_optname = { "tilde", NULL };
static struct optname query_optname = { "help", NULL };
static struct optname pound_optname = { "shift", NULL };
/*
@ -186,6 +190,12 @@ static struct option option[] =
"Position target at screen line %d",
NULL
},
{ 'J', &J__optname,
BOOL|REPAINT, OPT_OFF, &status_col, NULL,
"Don't display a status column",
"Display a status column",
NULL
},
#if USERFILE
{ 'k', &k_optname,
STRING|NO_TOGGLE|NO_QUERY, 0, NULL, opt_k,
@ -314,6 +324,12 @@ static struct option option[] =
NOVAR, 0, NULL, opt_query,
NULL, NULL, NULL
},
{ '#', &pound_optname,
NUMBER, 0, &shift_count, NULL,
"Horizontal shift: ",
"Horizontal shift %d positions",
NULL
},
{ '\0', NULL, NOVAR, 0, NULL, NULL, NULL, NULL, NULL }
};

View File

@ -99,12 +99,20 @@ iread(fd, buf, len)
* We jumped here from intread.
*/
reading = 0;
#if HAVE_SIGPROCMASK
{
sigset_t mask;
sigemptyset(&mask);
sigprocmask(SIG_SETMASK, &mask, NULL);
}
#else
#if HAVE_SIGSETMASK
sigsetmask(0);
#else
#ifdef _OSK
sigmask(~0);
#endif
#endif
#endif
return (READ_INTR);
}

View File

@ -52,6 +52,7 @@ extern int linenums;
extern int sc_height;
extern int jump_sline;
extern int bs_mode;
extern int status_col;
extern POSITION start_attnpos;
extern POSITION end_attnpos;
#if HILITE_SEARCH
@ -509,7 +510,8 @@ is_hilited(pos, epos, nohide)
{
struct hilite *hl;
if (start_attnpos != NULL_POSITION &&
if (!status_col &&
start_attnpos != NULL_POSITION &&
pos < end_attnpos &&
(epos == NULL_POSITION || epos > start_attnpos))
/*

View File

@ -594,6 +594,12 @@ v352 3/8/00 Fix scan_option NULL dereference.
-----------------------------------------------------------------
v353 3/20/00 Fix SECURE compile bug, allow space after numeric option.
v354 3/23/00 Add support for PCRE; add --with-regex configure option.
-----------------------------------------------------------------
v355 6/28/00 Add -# option (thanks to Andy Levinson).
v356 7/5/00 Add -J option.
v357 7/6/00 Support sigprocmask.
-----------------------------------------------------------------
v358 7/8/00 Fix problems with #stop in lesskey file.
*/
char version[] = "354";
char version[] = "358";