aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Saab <ps@FreeBSD.org>2002-01-07 20:29:38 +0000
committerPaul Saab <ps@FreeBSD.org>2002-01-07 20:29:38 +0000
commitc9346414d95d69f958210e825deb3b086dac3529 (patch)
tree22ed5b4269586d3d5c21d37a27645897709341e3
parent8ed69c6ff9a57551420d2cb6f67c989b37477cb5 (diff)
downloadsrc-c9346414d95d69f958210e825deb3b086dac3529.tar.gz
src-c9346414d95d69f958210e825deb3b086dac3529.zip
Import less v371
Notes
Notes: svn path=/vendor/less/dist/; revision=89019
-rw-r--r--contrib/less/Makefile.aut6
-rw-r--r--contrib/less/Makefile.in4
-rw-r--r--contrib/less/Makefile.o2e9
-rw-r--r--contrib/less/NEWS48
-rw-r--r--contrib/less/README23
-rw-r--r--contrib/less/ch.c106
-rw-r--r--contrib/less/charset.c49
-rw-r--r--contrib/less/cmd.h3
-rw-r--r--contrib/less/cmdbuf.c8
-rw-r--r--contrib/less/command.c67
-rwxr-xr-xcontrib/less/configure411
-rw-r--r--contrib/less/configure.in10
-rw-r--r--contrib/less/decode.c21
-rw-r--r--contrib/less/defines.ds3
-rw-r--r--contrib/less/defines.h.in6
-rw-r--r--contrib/less/defines.h.top3
-rw-r--r--contrib/less/defines.o238
-rw-r--r--contrib/less/defines.o91
-rw-r--r--contrib/less/defines.wn5
-rw-r--r--contrib/less/filename.c13
-rw-r--r--contrib/less/funcs.h13
-rw-r--r--contrib/less/help.c10
-rw-r--r--contrib/less/less.h25
-rw-r--r--contrib/less/less.hlp10
-rw-r--r--contrib/less/less.man1516
-rw-r--r--contrib/less/less.nro109
-rw-r--r--contrib/less/lesskey.c7
-rw-r--r--contrib/less/lesskey.man76
-rw-r--r--contrib/less/lesskey.nro9
-rw-r--r--contrib/less/line.c292
-rw-r--r--contrib/less/linenum.c2
-rw-r--r--contrib/less/lsystem.c7
-rw-r--r--contrib/less/main.c16
-rw-r--r--contrib/less/optfunc.c61
-rw-r--r--contrib/less/option.c28
-rw-r--r--contrib/less/opttbl.c27
-rw-r--r--contrib/less/os.c85
-rw-r--r--contrib/less/output.c71
-rw-r--r--contrib/less/prompt.c74
-rw-r--r--contrib/less/screen.c244
-rw-r--r--contrib/less/scrsize.c104
-rw-r--r--contrib/less/search.c18
-rw-r--r--contrib/less/tags.c618
-rw-r--r--contrib/less/ttyin.c36
-rw-r--r--contrib/less/version.c27
45 files changed, 2943 insertions, 1376 deletions
diff --git a/contrib/less/Makefile.aut b/contrib/less/Makefile.aut
index ef0053dd811c..78adb0babd6e 100644
--- a/contrib/less/Makefile.aut
+++ b/contrib/less/Makefile.aut
@@ -1,7 +1,7 @@
# Makefile for authoring less.
-EMAIL = marknu@flash.net
-HOMEPAGE = http://www.flash.net/~marknu/less
+EMAIL = markn@greenwoodsoftware.com
+HOMEPAGE = http://www.greenwoodsoftware.com/less
SHELL = /bin/sh
RCS = rcs
NROFF = nroff -man
@@ -23,7 +23,7 @@ DISTFILES_W = \
DISTFILES = \
${SRC} regexp.c regexp.h \
COPYING INSTALL LICENSE Makefile.in Makefile.aut NEWS README \
- configure configure.in acconfig.h lesskey.c lessecho.c \
+ configure configure.in acconfig.h lesskey.c lessecho.c scrsize.c \
cmd.h funcs.h lglob.h less.h lesskey.h option.h pckeys.h position.h \
install.sh defines.h.in defines.h.top mkinstalldirs \
less.nro lesskey.nro less.man lesskey.man less.hlp \
diff --git a/contrib/less/Makefile.in b/contrib/less/Makefile.in
index 32b858d5945f..57f62810cc5e 100644
--- a/contrib/less/Makefile.in
+++ b/contrib/less/Makefile.in
@@ -24,6 +24,8 @@ exec_prefix = @exec_prefix@
bindir = @bindir@
binprefix =
+sysconfdir = @sysconfdir@
+
mandir = @mandir@
manext = 1
manprefix =
@@ -35,7 +37,7 @@ SHELL = /bin/sh
# This rule allows us to supply the necessary -D options
# in addition to whatever the user asks for.
.c.o:
- ${CC} -I. ${CFLAGS_COMPILE_ONLY} -DSYSDIR=\"${bindir}\" ${CPPFLAGS} ${CFLAGS} $<
+ ${CC} -I. ${CFLAGS_COMPILE_ONLY} -DBINDIR=\"${bindir}\" -DSYSDIR=\"${sysconfdir}\" ${CPPFLAGS} ${CFLAGS} $<
OBJ = main.${O} screen.${O} brac.${O} ch.${O} charset.${O} cmdbuf.${O} \
command.${O} decode.${O} edit.${O} filename.${O} forwback.${O} \
diff --git a/contrib/less/Makefile.o2e b/contrib/less/Makefile.o2e
index 4fc3eef0bb9a..b0b9db288371 100644
--- a/contrib/less/Makefile.o2e
+++ b/contrib/less/Makefile.o2e
@@ -4,8 +4,8 @@
#### Start of system configuration section. ####
CC = gcc -Zomf
-CFLAGS = -I. -O
-LDFLAGS = -s -Zcrtdll -Zstack 512
+CFLAGS = -I. -O2 -Wall
+LDFLAGS = -s -Zcrtdll
LIBS = -ltermcap
O = obj
@@ -25,7 +25,7 @@ OBJ = main.${O} screen.${O} brac.${O} ch.${O} charset.${O} cmdbuf.${O} \
output.${O} position.${O} prompt.${O} search.${O} signal.${O} \
tags.${O} ttyin.${O} version.${O} regexp.${O}
-all: less.exe lesskey.exe
+all: less.exe lesskey.exe scrsize.exe
less.exe: ${OBJ}
${CC} ${OBJ} -o $@ ${LDFLAGS} ${LIBS}
@@ -33,6 +33,9 @@ less.exe: ${OBJ}
lesskey.exe: lesskey.${O} version.${O}
${CC} lesskey.${O} version.${O} -o $@ ${LDFLAGS}
+scrsize.exe: scrsize.c
+ ${CC} ${CFLAGS} -D__ST_MT_ERRNO__ -s -Zmtd -lX11 $<
+
${OBJ}: defines.h less.h
defines.h: defines.o2
diff --git a/contrib/less/NEWS b/contrib/less/NEWS
index dd06ed0abe80..4bfbfaeb833b 100644
--- a/contrib/less/NEWS
+++ b/contrib/less/NEWS
@@ -4,15 +4,59 @@
======================================================================
For the latest news about less, see the "less" Web page:
- http://www.flash.net/~marknu/less
+ http://www.greenwoodsoftware.com/less
You can also download the latest version of less from there.
To report bugs, suggestions or comments, send email to
- bug-less@gnu.org or marknu@flash.net.
+ bug-less@gnu.org or markn@greenwoodsoftware.com.
======================================================================
+ Major changes between "less" versions 358 and 371
+
+* -x option can now specify multiple variable-width tab stops.
+
+* -X option no longer disables keypad initialization.
+ New option --no-keypad disables keypad initialization.
+
+* New commands t and T step through multiple tag matches.
+ Added support for "global(1)" tags
+ (see http://www.gnu.org/software/global/global.html).
+
+* New prompt style set by option -Pw defines the message printed
+ while waiting for data in the F command.
+
+* System-wide lesskey file now defaults to sysless in etc directory
+ instead of .sysless in bin directory.
+ Use "configure --sysconfdir=..." to change it.
+ (For backwards compatibility, .sysless in bin is still recognized.)
+
+* Pressing RightArrow or LeftArrow while entering a number now shifts
+ the display N columns rather than editing the number itself.
+
+* Status column (enabled with -J) now shows search results.
+
+* Windows version sets window title.
+
+* Default LESSCHARSET for MS-DOS versions is now "dos".
+
+* Improved performance in reading very large files.
+
+* Eliminated some dependencies on file offets being 32 bits.
+
+* Fixed problems when viewing files with very long lines.
+
+* Fixed overstriking in UTF-8 mode, and overstriking tabs.
+
+* Improved horizontal shifting of text using -R option with ANSI color.
+
+* Some fixes for EBCDIC systems.
+
+* Some fixes for OS/2 systems.
+
+======================================================================
+
Major changes between "less" versions 354 and 358
* Add -J (--status-column) option to display a status column.
diff --git a/contrib/less/README b/contrib/less/README
index 9719b1fc70d1..99b29ec1be98 100644
--- a/contrib/less/README
+++ b/contrib/less/README
@@ -1,7 +1,7 @@
- Less, version 358
+ Less, version 371
- This is the distribution of less, version 358, released 08 Jul 2000.
+ This is the distribution of less, version 371, released 26 Dec 2001.
This program is part of the GNU project (http://www.gnu.org).
This program is free software. You may redistribute it and/or
@@ -13,8 +13,8 @@
or
2. The Less License, in the file LICENSE.
- Please report any problems to bug-less@gnu.org or marknu@flash.net.
- See http://www.flash.net/~marknu/less for the latest info.
+ Please report any problems to bug-less@gnu.org or markn@greenwoodsoftware.com.
+ See http://www.greenwoodsoftware.com/less for the latest info.
You may also contact the author at:
Mark Nudelman
Greenwood Software
@@ -91,7 +91,7 @@ INSTALLATION (Unix systems only):
bindir and/or mandir to the appropriate directories.
If you have any problems building or running "less", suggestions,
-complaints, etc., you may mail to the author at marknu@flash.net.
+complaints, etc., you may mail to the author at markn@greenwoodsoftware.com.
Note to hackers: comments noting possible improvements are enclosed
in double curly brackets {{ like this }}.
@@ -191,8 +191,10 @@ INSTALLATION (OS/2 systems only,
somewhere in a directory listed in the PATH or INIT environment
variables.
-8. When satisfied that it works, you may wish to install less.exe and
- lesskey.exe in a directory which is included in your PATH.
+8. When satisfied that it works, you may wish to install less.exe,
+ lesskey.exe and scrsize.exe in a directory which is included in
+ your PATH. scrsize.exe is required only if you use a terminal
+ emulator such as xterm or rxvt.
@@ -224,3 +226,10 @@ INSTALLATION (OS-9 systems only,
See step 6 of the Unix installation instructions for details
on how to change the default installation directories.
+=======================================================================
+ACKNOWLEDGMENTS:
+ Some versions of the less distribution are packaged using
+ Info-ZIP's compression utility.
+ Info-ZIP's software is free and can be obtained as source
+ code or executables from various anonymous-ftp sites,
+ including ftp.uu.net:/pub/archiving/zip.
diff --git a/contrib/less/ch.c b/contrib/less/ch.c
index ad85be049401..3aaa1525faf4 100644
--- a/contrib/less/ch.c
+++ b/contrib/less/ch.c
@@ -21,6 +21,8 @@
#include <windows.h>
#endif
+typedef POSITION BLOCKNUM;
+
public int ignore_eoi;
/*
@@ -29,34 +31,38 @@ public int ignore_eoi;
* in order from most- to least-recently used.
* The circular list is anchored by the file state "thisfile".
*/
-#define LBUFSIZE 1024
+#define LBUFSIZE 8192
struct buf {
- struct buf *next, *prev; /* Must be first to match struct filestate */
- long block;
+ struct buf *next, *prev;
+ struct buf *hnext, *hprev;
+ BLOCKNUM block;
unsigned int datasize;
unsigned char data[LBUFSIZE];
};
+struct buflist {
+ /* -- Following members must match struct buf */
+ struct buf *buf_next, *buf_prev;
+ struct buf *buf_hnext, *buf_hprev;
+};
+
/*
* The file state is maintained in a filestate structure.
* A pointer to the filestate is kept in the ifile structure.
*/
+#define BUFHASH_SIZE 64
struct filestate {
- /* -- Following members must match struct buf */
struct buf *buf_next, *buf_prev;
- long buf_block;
- /* -- End of struct buf copy */
+ struct buflist hashtbl[BUFHASH_SIZE];
int file;
int flags;
POSITION fpos;
int nbufs;
- long block;
+ BLOCKNUM block;
unsigned int offset;
POSITION fsize;
};
-
-#define END_OF_CHAIN ((struct buf *)thisfile)
#define ch_bufhead thisfile->buf_next
#define ch_buftail thisfile->buf_prev
#define ch_nbufs thisfile->nbufs
@@ -67,6 +73,24 @@ struct filestate {
#define ch_flags thisfile->flags
#define ch_file thisfile->file
+#define END_OF_CHAIN ((struct buf *)&thisfile->buf_next)
+#define END_OF_HCHAIN(h) ((struct buf *)&thisfile->hashtbl[h])
+#define BUFHASH(blk) ((blk) & (BUFHASH_SIZE-1))
+
+#define FOR_BUFS_IN_CHAIN(h,bp) \
+ for (bp = thisfile->hashtbl[h].buf_hnext; \
+ bp != END_OF_HCHAIN(h); bp = bp->hnext)
+
+#define HASH_RM(bp) \
+ (bp)->hnext->hprev = (bp)->hprev; \
+ (bp)->hprev->hnext = (bp)->hnext;
+
+#define HASH_INS(bp,h) \
+ (bp)->hnext = thisfile->hashtbl[h].buf_hnext; \
+ (bp)->hprev = END_OF_HCHAIN(h); \
+ thisfile->hashtbl[h].buf_hnext->hprev = (bp); \
+ thisfile->hashtbl[h].buf_hnext = (bp);
+
static struct filestate *thisfile;
static int ch_ungotchar = -1;
@@ -100,6 +124,7 @@ fch_get()
register struct buf *bp;
register int n;
register int slept;
+ register int h;
POSITION pos;
POSITION len;
@@ -108,7 +133,9 @@ fch_get()
/*
* Look for a buffer holding the desired block.
*/
- for (bp = ch_bufhead; bp != END_OF_CHAIN; bp = bp->next)
+ h = BUFHASH(ch_block);
+ FOR_BUFS_IN_CHAIN(h, bp)
+ {
if (bp->block == ch_block)
{
if (ch_offset >= bp->datasize)
@@ -118,6 +145,7 @@ fch_get()
goto read_more;
goto found;
}
+ }
/*
* Block is not in a buffer.
* Take the least recently used buffer
@@ -125,7 +153,7 @@ fch_get()
* If the LRU buffer has data in it,
* then maybe allocate a new buffer.
*/
- if (ch_buftail == END_OF_CHAIN || ch_buftail->block != (long)(-1))
+ if (ch_buftail == END_OF_CHAIN || ch_buftail->block != -1)
{
/*
* There is no empty buffer to use.
@@ -142,8 +170,10 @@ fch_get()
autobuf = OPT_OFF;
}
bp = ch_buftail;
+ HASH_RM(bp); /* Remove from old hash chain. */
bp->block = ch_block;
bp->datasize = 0;
+ HASH_INS(bp, h); /* Insert into new hash chain. */
read_more:
pos = (ch_block * LBUFSIZE) + bp->datasize;
@@ -230,7 +260,11 @@ fch_get()
* Wait a while, then try again.
*/
if (!slept)
- ierror("Waiting for data", NULL_PARG);
+ {
+ PARG parg;
+ parg.p_string = wait_message();
+ ierror("%s", &parg);
+ }
#if !MSDOS_COMPILER
sleep(1);
#else
@@ -253,11 +287,16 @@ fch_get()
*/
bp->next->prev = bp->prev;
bp->prev->next = bp->next;
-
bp->next = ch_bufhead;
bp->prev = END_OF_CHAIN;
ch_bufhead->prev = bp;
ch_bufhead = bp;
+
+ /*
+ * Move to head of hash chain too.
+ */
+ HASH_RM(bp);
+ HASH_INS(bp, h);
}
if (ch_offset >= bp->datasize)
@@ -318,8 +357,8 @@ sync_logfile()
{
register struct buf *bp;
int warned = FALSE;
- long block;
- long nblocks;
+ BLOCKNUM block;
+ BLOCKNUM nblocks;
nblocks = (ch_fpos + LBUFSIZE - 1) / LBUFSIZE;
for (block = 0; block < nblocks; block++)
@@ -352,13 +391,17 @@ sync_logfile()
*/
static int
buffered(block)
- long block;
+ BLOCKNUM block;
{
register struct buf *bp;
+ register int h;
- for (bp = ch_bufhead; bp != END_OF_CHAIN; bp = bp->next)
+ h = BUFHASH(block);
+ FOR_BUFS_IN_CHAIN(h, bp)
+ {
if (bp->block == block)
return (TRUE);
+ }
return (FALSE);
}
@@ -370,7 +413,7 @@ buffered(block)
ch_seek(pos)
register POSITION pos;
{
- long new_block;
+ BLOCKNUM new_block;
POSITION len;
len = ch_length();
@@ -470,12 +513,10 @@ ch_length()
/*
* Return the current position in the file.
*/
-#define tellpos(blk,off) ((POSITION)((((long)(blk)) * LBUFSIZE) + (off)))
-
public POSITION
ch_tell()
{
- return (tellpos(ch_block, ch_offset));
+ return (ch_block * LBUFSIZE) + ch_offset;
}
/*
@@ -570,7 +611,7 @@ ch_flush()
* Initialize all the buffers.
*/
for (bp = ch_bufhead; bp != END_OF_CHAIN; bp = bp->next)
- bp->block = (long)(-1);
+ bp->block = -1;
/*
* Figure out the size of the file, if we can.
@@ -626,15 +667,31 @@ ch_addbuf()
if (bp == NULL)
return (1);
ch_nbufs++;
- bp->block = (long)(-1);
+ bp->block = -1;
bp->next = END_OF_CHAIN;
bp->prev = ch_buftail;
ch_buftail->next = bp;
ch_buftail = bp;
+ HASH_INS(bp, 0);
return (0);
}
/*
+ *
+ */
+ static void
+init_hashtbl()
+{
+ register int h;
+
+ for (h = 0; h < BUFHASH_SIZE; h++)
+ {
+ thisfile->hashtbl[h].buf_hnext = END_OF_HCHAIN(h);
+ thisfile->hashtbl[h].buf_hprev = END_OF_HCHAIN(h);
+ }
+}
+
+/*
* Delete all buffers for this file.
*/
static void
@@ -650,6 +707,7 @@ ch_delbufs()
free(bp);
}
ch_nbufs = 0;
+ init_hashtbl();
}
/*
@@ -693,7 +751,6 @@ ch_init(f, flags)
thisfile = (struct filestate *)
calloc(1, sizeof(struct filestate));
thisfile->buf_next = thisfile->buf_prev = END_OF_CHAIN;
- thisfile->buf_block = (long)(-1);
thisfile->nbufs = 0;
thisfile->flags = 0;
thisfile->fpos = 0;
@@ -702,6 +759,7 @@ ch_init(f, flags)
thisfile->file = -1;
thisfile->fsize = NULL_POSITION;
ch_flags = flags;
+ init_hashtbl();
/*
* Try to seek; set CH_CANSEEK if it works.
*/
diff --git a/contrib/less/charset.c b/contrib/less/charset.c
index efb26a87bd10..bc96cf33dd4a 100644
--- a/contrib/less/charset.c
+++ b/contrib/less/charset.c
@@ -32,16 +32,25 @@ struct charset {
char *desc;
} charsets[] = {
{ "ascii", NULL, "8bcccbcc18b95.b" },
- { "dos", NULL, "8bcccbcc12bc5b95.b." },
+ { "dos", NULL, "8bcccbcc12bc5b223.b" },
{ "ebcdic", NULL, "5bc6bcc7bcc41b.9b7.9b5.b..8b6.10b6.b9.7b9.8b8.17b3.3b9.7b9.8b8.6b10.b.b.b." },
+ { "IBM-1047", NULL, "4cbcbc3b9cbccbccbb4c6bcc5b3cbbc4bc4bccbc191.b" },
{ "iso8859", NULL, "8bcccbcc18b95.33b." },
{ "koi8-r", NULL, "8bcccbcc18b95.b128." },
- { "latin1", NULL, "8bcccbcc18b95.33b." },
{ "next", NULL, "8bcccbcc18b95.bb125.bb" },
{ "utf-8", &utf_mode, "8bcccbcc18b." },
{ NULL, NULL, NULL }
};
+struct cs_alias {
+ char *name;
+ char *oname;
+} cs_aliases[] = {
+ { "latin1", "iso8859" },
+ { "latin9", "iso8859" },
+ { NULL, NULL }
+};
+
#define IS_BINARY_CHAR 01
#define IS_CONTROL_CHAR 02
@@ -126,10 +135,21 @@ icharset(name)
register char *name;
{
register struct charset *p;
+ register struct cs_alias *a;
if (name == NULL || *name == '\0')
return (0);
+ /* First see if the name is an alias. */
+ for (a = cs_aliases; a->name != NULL; a++)
+ {
+ if (strcmp(name, a->name) == 0)
+ {
+ name = a->oname;
+ break;
+ }
+ }
+
for (p = charsets; p->name != NULL; p++)
{
if (strcmp(name, p->name) == 0)
@@ -242,11 +262,18 @@ init_charset()
*/
ilocale();
#else
+#if MSDOS_COMPILER
+ /*
+ * Default to "dos".
+ */
+ (void) icharset("dos");
+#else
/*
* Default to "latin1".
*/
(void) icharset("latin1");
#endif
+#endif
}
/*
@@ -286,8 +313,22 @@ prchar(c)
sprintf(buf, "%c", c);
else if (c == ESC)
sprintf(buf, "ESC");
- else if (c < 128 && !control_char(c ^ 0100))
- sprintf(buf, "^%c", c ^ 0100);
+#if IS_EBCDIC_HOST
+ else if (!binary_char(c) && c < 64)
+ sprintf(buf, "^%c",
+ /*
+ * This array roughly inverts CONTROL() #defined in less.h,
+ * and should be kept in sync with CONTROL() and IBM-1047.
+ */
+ "@ABC.I.?...KLMNO"
+ "PQRS.JH.XY.."
+ "\\]^_"
+ "......W[.....EFG"
+ "..V....D....TU.Z"[c]);
+#else
+ else if (c < 128 && !control_char(c ^ 0100))
+ sprintf(buf, "^%c", c ^ 0100);
+#endif
else
sprintf(buf, binfmt, c);
return (buf);
diff --git a/contrib/less/cmd.h b/contrib/less/cmd.h
index 1619b80ec5d1..0fe097be928a 100644
--- a/contrib/less/cmd.h
+++ b/contrib/less/cmd.h
@@ -63,6 +63,8 @@
#define A_F_FOREVER 50
#define A_GOPOS 51
#define A_REMOVE_FILE 52
+#define A_NEXT_TAG 53
+#define A_PREV_TAG 54
#define A_INVALID 100
#define A_NOACTION 101
@@ -103,6 +105,7 @@
#define EC_PEEK 01
#define EC_NOHISTORY 02
#define EC_NOCOMPLETE 04
+#define EC_NORIGHTLEFT 010
/* Environment variable stuff */
#define EV_OK 01
diff --git a/contrib/less/cmdbuf.c b/contrib/less/cmdbuf.c
index 3aed8aefd03b..e6862b8beafa 100644
--- a/contrib/less/cmdbuf.c
+++ b/contrib/less/cmdbuf.c
@@ -155,7 +155,7 @@ cmd_repaint(old_cp)
for ( ; *cp != '\0'; cp++)
{
p = prchar(*cp);
- if (cmd_col + strlen(p) >= sc_width)
+ if (cmd_col + (int)strlen(p) >= sc_width)
break;
putstr(p);
cmd_col += strlen(p);
@@ -255,9 +255,9 @@ cmd_right()
return (CC_OK);
}
p = prchar(*cp);
- if (cmd_col + strlen(p) >= sc_width)
+ if (cmd_col + (int)strlen(p) >= sc_width)
cmd_lshift();
- else if (cmd_col + strlen(p) == sc_width - 1 && cp[1] != '\0')
+ else if (cmd_col + (int)strlen(p) == sc_width - 1 && cp[1] != '\0')
cmd_lshift();
cp++;
putstr(p);
@@ -279,7 +279,7 @@ cmd_left()
return (CC_OK);
}
p = prchar(cp[-1]);
- if (cmd_col < prompt_col + strlen(p))
+ if (cmd_col < prompt_col + (int)strlen(p))
cmd_rshift();
cp--;
cmd_col -= strlen(p);
diff --git a/contrib/less/command.c b/contrib/less/command.c
index d898ed12e82b..44c9d96f964c 100644
--- a/contrib/less/command.c
+++ b/contrib/less/command.c
@@ -14,6 +14,9 @@
*/
#include "less.h"
+#if MSDOS_COMPILER==WIN32C
+#include <windows.h>
+#endif
#include "position.h"
#include "option.h"
#include "cmd.h"
@@ -214,6 +217,8 @@ exec_mca()
if (secure)
break;
edit_list(cbuf);
+ /* If tag structure is loaded then clean it up. */
+ cleantags();
break;
#endif
#if SHELL_ESCAPE
@@ -284,7 +289,7 @@ mca_char(c)
* Terminated by a non-digit.
*/
if ((c < '0' || c > '9') &&
- editchar(c, EC_PEEK|EC_NOHISTORY|EC_NOCOMPLETE) == A_INVALID)
+ editchar(c, EC_PEEK|EC_NOHISTORY|EC_NOCOMPLETE|EC_NORIGHTLEFT) == A_INVALID)
{
/*
* Not part of the number.
@@ -608,6 +613,13 @@ prompt()
quit(QUIT_OK);
#endif
+#if MSDOS_COMPILER==WIN32C
+ /*
+ * In Win32, display the file name in the window title.
+ */
+ if (!(ch_getflags() & CH_HELPFILE))
+ SetConsoleTitle(pr_expand("Less?f - %f.", 0));
+#endif
/*
* Select the proper prompt and display it.
*/
@@ -832,6 +844,7 @@ commands()
PARG parg;
IFILE old_ifile;
IFILE new_ifile;
+ char *tagfile;
search_type = SRCH_FORW;
wscroll = (sc_height + 1) / 2;
@@ -1349,6 +1362,11 @@ commands()
/*
* Examine next file.
*/
+ if (ntags())
+ {
+ error("No next file", NULL_PARG);
+ break;
+ }
if (number <= 0)
number = 1;
if (edit_next(number))
@@ -1365,6 +1383,11 @@ commands()
/*
* Examine previous file.
*/
+ if (ntags())
+ {
+ error("No previous file", NULL_PARG);
+ break;
+ }
if (number <= 0)
number = 1;
if (edit_prev(number))
@@ -1374,6 +1397,40 @@ commands()
}
break;
+ case A_NEXT_TAG:
+ if (number <= 0)
+ number = 1;
+ tagfile = nexttag(number);
+ if (tagfile == NULL)
+ {
+ error("No next tag", NULL_PARG);
+ break;
+ }
+ if (edit(tagfile) == 0)
+ {
+ POSITION pos = tagsearch();
+ if (pos != NULL_POSITION)
+ jump_loc(pos, jump_sline);
+ }
+ break;
+
+ case A_PREV_TAG:
+ if (number <= 0)
+ number = 1;
+ tagfile = prevtag(number);
+ if (tagfile == NULL)
+ {
+ error("No previous tag", NULL_PARG);
+ break;
+ }
+ if (edit(tagfile) == 0)
+ {
+ POSITION pos = tagsearch();
+ if (pos != NULL_POSITION)
+ jump_loc(pos, jump_sline);
+ }
+ break;
+
case A_INDEX_FILE:
/*
* Examine a particular file.
@@ -1502,7 +1559,9 @@ commands()
goto again;
case A_LSHIFT:
- if (number <= 0)
+ if (number > 0)
+ shift_count = number;
+ else
number = (shift_count > 0) ?
shift_count : sc_width / 2;
if (number > hshift)
@@ -1512,7 +1571,9 @@ commands()
break;
case A_RSHIFT:
- if (number <= 0)
+ if (number > 0)
+ shift_count = number;
+ else
number = (shift_count > 0) ?
shift_count : sc_width / 2;
hshift += number;
diff --git a/contrib/less/configure b/contrib/less/configure
index 2310d4081a24..bed836c2ca17 100755
--- a/contrib/less/configure
+++ b/contrib/less/configure
@@ -1,7 +1,7 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated automatically using autoconf version 2.12
+# Generated automatically using autoconf version 2.13
# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
#
# This configure script is free software; the Free Software Foundation
@@ -53,6 +53,7 @@ mandir='${prefix}/man'
# Initialize some other variables.
subdirs=
MFLAGS= MAKEFLAGS=
+SHELL=${CONFIG_SHELL-/bin/sh}
# Maximum number of lines to put in a shell here document.
ac_max_here_lines=12
@@ -336,7 +337,7 @@ EOF
verbose=yes ;;
-version | --version | --versio | --versi | --vers)
- echo "configure generated by autoconf version 2.12"
+ echo "configure generated by autoconf version 2.13"
exit 0 ;;
-with-* | --with-*)
@@ -506,9 +507,11 @@ ac_ext=c
# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
ac_cpp='$CPP $CPPFLAGS'
ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
cross_compiling=$ac_cv_prog_cc_cross
+ac_exeext=
+ac_objext=o
if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
# Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
@@ -527,15 +530,16 @@ fi
# Extract the first word of "gcc", so it can be a program name with args.
set dummy gcc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:531: checking for $ac_word" >&5
+echo "configure:534: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
if test -n "$CC"; then
ac_cv_prog_CC="$CC" # Let the user override the test.
else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
- for ac_dir in $PATH; do
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
test -z "$ac_dir" && ac_dir=.
if test -f $ac_dir/$ac_word; then
ac_cv_prog_CC="gcc"
@@ -556,16 +560,17 @@ if test -z "$CC"; then
# Extract the first word of "cc", so it can be a program name with args.
set dummy cc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:560: checking for $ac_word" >&5
+echo "configure:564: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
if test -n "$CC"; then
ac_cv_prog_CC="$CC" # Let the user override the test.
else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
ac_prog_rejected=no
- for ac_dir in $PATH; do
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
test -z "$ac_dir" && ac_dir=.
if test -f $ac_dir/$ac_word; then
if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then
@@ -600,25 +605,61 @@ else
echo "$ac_t""no" 1>&6
fi
+ if test -z "$CC"; then
+ case "`uname -s`" in
+ *win32* | *WIN32*)
+ # Extract the first word of "cl", so it can be a program name with args.
+set dummy cl; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:615: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ ac_cv_prog_CC="cl"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+fi
+fi
+CC="$ac_cv_prog_CC"
+if test -n "$CC"; then
+ echo "$ac_t""$CC" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+ ;;
+ esac
+ fi
test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; }
fi
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:608: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo "configure:647: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
ac_ext=c
# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
ac_cpp='$CPP $CPPFLAGS'
ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
cross_compiling=$ac_cv_prog_cc_cross
-cat > conftest.$ac_ext <<EOF
-#line 618 "configure"
+cat > conftest.$ac_ext << EOF
+
+#line 658 "configure"
#include "confdefs.h"
+
main(){return(0);}
EOF
-if { (eval echo configure:622: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:663: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
ac_cv_prog_cc_works=yes
# If we can't run a trivial program, we are probably using a cross compiler.
if (./conftest; exit) 2>/dev/null; then
@@ -632,18 +673,24 @@ else
ac_cv_prog_cc_works=no
fi
rm -fr conftest*
+ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
echo "$ac_t""$ac_cv_prog_cc_works" 1>&6
if test $ac_cv_prog_cc_works = no; then
{ echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
fi
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:642: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:689: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
cross_compiling=$ac_cv_prog_cc_cross
echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
-echo "configure:647: checking whether we are using GNU C" >&5
+echo "configure:694: checking whether we are using GNU C" >&5
if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -652,7 +699,7 @@ else
yes;
#endif
EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:656: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:703: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
ac_cv_prog_gcc=yes
else
ac_cv_prog_gcc=no
@@ -663,11 +710,15 @@ echo "$ac_t""$ac_cv_prog_gcc" 1>&6
if test $ac_cv_prog_gcc = yes; then
GCC=yes
- ac_test_CFLAGS="${CFLAGS+set}"
- ac_save_CFLAGS="$CFLAGS"
- CFLAGS=
- echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:671: checking whether ${CC-cc} accepts -g" >&5
+else
+ GCC=
+fi
+
+ac_test_CFLAGS="${CFLAGS+set}"
+ac_save_CFLAGS="$CFLAGS"
+CFLAGS=
+echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
+echo "configure:722: checking whether ${CC-cc} accepts -g" >&5
if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -682,20 +733,24 @@ rm -f conftest*
fi
echo "$ac_t""$ac_cv_prog_cc_g" 1>&6
- if test "$ac_test_CFLAGS" = set; then
- CFLAGS="$ac_save_CFLAGS"
- elif test $ac_cv_prog_cc_g = yes; then
+if test "$ac_test_CFLAGS" = set; then
+ CFLAGS="$ac_save_CFLAGS"
+elif test $ac_cv_prog_cc_g = yes; then
+ if test "$GCC" = yes; then
CFLAGS="-g -O2"
else
- CFLAGS="-O2"
+ CFLAGS="-g"
fi
else
- GCC=
- test "${CFLAGS+set}" = set || CFLAGS="-g"
+ if test "$GCC" = yes; then
+ CFLAGS="-O2"
+ else
+ CFLAGS=
+ fi
fi
echo $ac_n "checking for POSIXized ISC""... $ac_c" 1>&6
-echo "configure:699: checking for POSIXized ISC" >&5
+echo "configure:754: checking for POSIXized ISC" >&5
if test -d /etc/conf/kconfig.d &&
grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1
then
@@ -716,7 +771,7 @@ else
fi
echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:720: checking how to run the C preprocessor" >&5
+echo "configure:775: checking how to run the C preprocessor" >&5
# On Suns, sometimes $CPP names a directory.
if test -n "$CPP" && test -d "$CPP"; then
CPP=
@@ -731,14 +786,14 @@ else
# On the NeXT, cc -E runs the code through the compiler's parser,
# not just through cpp.
cat > conftest.$ac_ext <<EOF
-#line 735 "configure"
+#line 790 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:741: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
+{ (eval echo configure:796: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
else
@@ -748,14 +803,31 @@ else
rm -rf conftest*
CPP="${CC-cc} -E -traditional-cpp"
cat > conftest.$ac_ext <<EOF
-#line 752 "configure"
+#line 807 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:758: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
+{ (eval echo configure:813: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ :
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ CPP="${CC-cc} -nologo -E"
+ cat > conftest.$ac_ext <<EOF
+#line 824 "configure"
+#include "confdefs.h"
+#include <assert.h>
+Syntax Error
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:830: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
else
@@ -768,6 +840,8 @@ fi
rm -f conftest*
fi
rm -f conftest*
+fi
+rm -f conftest*
ac_cv_prog_CPP="$CPP"
fi
CPP="$ac_cv_prog_CPP"
@@ -778,13 +852,13 @@ echo "$ac_t""$CPP" 1>&6
if test $ac_cv_prog_gcc = yes; then
echo $ac_n "checking whether ${CC-cc} needs -traditional""... $ac_c" 1>&6
-echo "configure:782: checking whether ${CC-cc} needs -traditional" >&5
+echo "configure:856: checking whether ${CC-cc} needs -traditional" >&5
if eval "test \"`echo '$''{'ac_cv_prog_gcc_traditional'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_pattern="Autoconf.*'x'"
cat > conftest.$ac_ext <<EOF
-#line 788 "configure"
+#line 862 "configure"
#include "confdefs.h"
#include <sgtty.h>
Autoconf TIOCGETP
@@ -802,7 +876,7 @@ rm -f conftest*
if test $ac_cv_prog_gcc_traditional = no; then
cat > conftest.$ac_ext <<EOF
-#line 806 "configure"
+#line 880 "configure"
#include "confdefs.h"
#include <termio.h>
Autoconf TCGETA
@@ -849,28 +923,30 @@ ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
# SunOS /usr/etc/install
# IRIX /sbin/install
# AIX /bin/install
+# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
# AFS /usr/afsws/bin/install, which mishandles nonexistent args
# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
# ./install, which can be erroneously created by make from ./install.sh.
echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
-echo "configure:857: checking for a BSD compatible install" >&5
+echo "configure:932: checking for a BSD compatible install" >&5
if test -z "$INSTALL"; then
if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
- IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS="${IFS}:"
+ IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":"
for ac_dir in $PATH; do
# Account for people who put trailing slashes in PATH elements.
case "$ac_dir/" in
/|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
*)
# OSF1 and SCO ODT 3.0 have their own names for install.
- for ac_prog in ginstall installbsd scoinst install; do
+ # Don't use installbsd from OSF since it installs stuff as root
+ # by default.
+ for ac_prog in ginstall scoinst install; do
if test -f $ac_dir/$ac_prog; then
if test $ac_prog = install &&
grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
# AIX install. It has an incompatible calling convention.
- # OSF/1 installbsd also uses dspmsg, but is usable.
:
else
ac_cv_path_install="$ac_dir/$ac_prog -c"
@@ -900,11 +976,14 @@ echo "$ac_t""$INSTALL" 1>&6
# It thinks the first close brace ends the variable substitution.
test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
+
test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+
echo $ac_n "checking for initscr in -lxcurses""... $ac_c" 1>&6
-echo "configure:908: checking for initscr in -lxcurses" >&5
+echo "configure:987: checking for initscr in -lxcurses" >&5
ac_lib_var=`echo xcurses'_'initscr | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -912,7 +991,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lxcurses $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 916 "configure"
+#line 995 "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
@@ -923,7 +1002,7 @@ int main() {
initscr()
; return 0; }
EOF
-if { (eval echo configure:927: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1006: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -945,7 +1024,7 @@ have_xcurses=no
fi
echo $ac_n "checking for initscr in -lncurses""... $ac_c" 1>&6
-echo "configure:949: checking for initscr in -lncurses" >&5
+echo "configure:1028: checking for initscr in -lncurses" >&5
ac_lib_var=`echo ncurses'_'initscr | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -953,7 +1032,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lncurses $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 957 "configure"
+#line 1036 "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
@@ -964,7 +1043,7 @@ int main() {
initscr()
; return 0; }
EOF
-if { (eval echo configure:968: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1047: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -986,7 +1065,7 @@ have_ncurses=no
fi
echo $ac_n "checking for initscr in -lcurses""... $ac_c" 1>&6
-echo "configure:990: checking for initscr in -lcurses" >&5
+echo "configure:1069: checking for initscr in -lcurses" >&5
ac_lib_var=`echo curses'_'initscr | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -994,7 +1073,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lcurses $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 998 "configure"
+#line 1077 "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
@@ -1005,7 +1084,7 @@ int main() {
initscr()
; return 0; }
EOF
-if { (eval echo configure:1009: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1088: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -1027,7 +1106,7 @@ have_curses=no
fi
echo $ac_n "checking for tgetent in -ltermcap""... $ac_c" 1>&6
-echo "configure:1031: checking for tgetent in -ltermcap" >&5
+echo "configure:1110: checking for tgetent in -ltermcap" >&5
ac_lib_var=`echo termcap'_'tgetent | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -1035,7 +1114,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-ltermcap $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 1039 "configure"
+#line 1118 "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
@@ -1046,7 +1125,7 @@ int main() {
tgetent()
; return 0; }
EOF
-if { (eval echo configure:1050: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1129: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -1068,7 +1147,7 @@ have_termcap=no
fi
echo $ac_n "checking for tgetent in -ltermlib""... $ac_c" 1>&6
-echo "configure:1072: checking for tgetent in -ltermlib" >&5
+echo "configure:1151: checking for tgetent in -ltermlib" >&5
ac_lib_var=`echo termlib'_'tgetent | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -1076,7 +1155,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-ltermlib $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 1080 "configure"
+#line 1159 "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
@@ -1087,7 +1166,7 @@ int main() {
tgetent()
; return 0; }
EOF
-if { (eval echo configure:1091: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1170: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -1109,7 +1188,7 @@ have_termlib=no
fi
echo $ac_n "checking for regcmp in -lgen""... $ac_c" 1>&6
-echo "configure:1113: checking for regcmp in -lgen" >&5
+echo "configure:1192: checking for regcmp in -lgen" >&5
ac_lib_var=`echo gen'_'regcmp | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -1117,7 +1196,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lgen $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 1121 "configure"
+#line 1200 "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
@@ -1128,7 +1207,7 @@ int main() {
regcmp()
; return 0; }
EOF
-if { (eval echo configure:1132: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1211: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -1156,7 +1235,7 @@ else
fi
echo $ac_n "checking for regcmp in -lintl""... $ac_c" 1>&6
-echo "configure:1160: checking for regcmp in -lintl" >&5
+echo "configure:1239: checking for regcmp in -lintl" >&5
ac_lib_var=`echo intl'_'regcmp | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -1164,7 +1243,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lintl $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 1168 "configure"
+#line 1247 "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
@@ -1175,7 +1254,7 @@ int main() {
regcmp()
; return 0; }
EOF
-if { (eval echo configure:1179: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1258: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -1203,7 +1282,7 @@ else
fi
echo $ac_n "checking for regcmp in -lPW""... $ac_c" 1>&6
-echo "configure:1207: checking for regcmp in -lPW" >&5
+echo "configure:1286: checking for regcmp in -lPW" >&5
ac_lib_var=`echo PW'_'regcmp | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -1211,7 +1290,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lPW $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 1215 "configure"
+#line 1294 "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
@@ -1222,7 +1301,7 @@ int main() {
regcmp()
; return 0; }
EOF
-if { (eval echo configure:1226: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1305: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -1251,7 +1330,7 @@ fi
echo $ac_n "checking for working terminal libraries""... $ac_c" 1>&6
-echo "configure:1255: checking for working terminal libraries" >&5
+echo "configure:1334: checking for working terminal libraries" >&5
TERMLIBS=
curses_broken=0
@@ -1259,6 +1338,9 @@ if test x`uname -s` = "xHP-UX" >/dev/null 2>&1; then
if test x`uname -r` = "xB.11.00" >/dev/null 2>&1; then
curses_broken=1
fi
+if test x`uname -r` = "xB.11.11" >/dev/null 2>&1; then
+ curses_broken=1
+fi
fi
if test $curses_broken = 0; then
@@ -1268,14 +1350,14 @@ if test "x$TERMLIBS" = x; then
SAVE_LIBS=$LIBS
LIBS="$LIBS $TERMLIBS"
cat > conftest.$ac_ext <<EOF
-#line 1272 "configure"
+#line 1354 "configure"
#include "confdefs.h"
int main() {
tgetent(0,0); tgetflag(0); tgetnum(0); tgetstr(0,0);
; return 0; }
EOF
-if { (eval echo configure:1279: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1361: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
termok=yes
else
@@ -1296,14 +1378,14 @@ if test "x$TERMLIBS" = x; then
SAVE_LIBS=$LIBS
LIBS="$LIBS $TERMLIBS"
cat > conftest.$ac_ext <<EOF
-#line 1300 "configure"
+#line 1382 "configure"
#include "confdefs.h"
int main() {
tgetent(0,0); tgetflag(0); tgetnum(0); tgetstr(0,0);
; return 0; }
EOF
-if { (eval echo configure:1307: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1389: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
termok=yes
else
@@ -1324,14 +1406,14 @@ if test "x$TERMLIBS" = x; then
SAVE_LIBS=$LIBS
LIBS="$LIBS $TERMLIBS"
cat > conftest.$ac_ext <<EOF
-#line 1328 "configure"
+#line 1410 "configure"
#include "confdefs.h"
int main() {
tgetent(0,0); tgetflag(0); tgetnum(0); tgetstr(0,0);
; return 0; }
EOF
-if { (eval echo configure:1335: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1417: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
termok=yes
else
@@ -1353,14 +1435,14 @@ if test "x$TERMLIBS" = x; then
SAVE_LIBS=$LIBS
LIBS="$LIBS $TERMLIBS"
cat > conftest.$ac_ext <<EOF
-#line 1357 "configure"
+#line 1439 "configure"
#include "confdefs.h"
int main() {
tgetent(0,0); tgetflag(0); tgetnum(0); tgetstr(0,0);
; return 0; }
EOF
-if { (eval echo configure:1364: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1446: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
termok=yes
else
@@ -1383,14 +1465,14 @@ if test "x$TERMLIBS" = x; then
SAVE_LIBS=$LIBS
LIBS="$LIBS $TERMLIBS"
cat > conftest.$ac_ext <<EOF
-#line 1387 "configure"
+#line 1469 "configure"
#include "confdefs.h"
int main() {
tgetent(0,0); tgetflag(0); tgetnum(0); tgetstr(0,0);
; return 0; }
EOF
-if { (eval echo configure:1394: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1476: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
termok=yes
else
@@ -1411,14 +1493,14 @@ if test "x$TERMLIBS" = x; then
SAVE_LIBS=$LIBS
LIBS="$LIBS $TERMLIBS"
cat > conftest.$ac_ext <<EOF
-#line 1415 "configure"
+#line 1497 "configure"
#include "confdefs.h"
int main() {
tgetent(0,0); tgetflag(0); tgetnum(0); tgetstr(0,0);
; return 0; }
EOF
-if { (eval echo configure:1422: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1504: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
termok=yes
else
@@ -1445,18 +1527,18 @@ for ac_hdr in ctype.h errno.h fcntl.h limits.h stdio.h stdlib.h string.h termcap
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:1449: checking for $ac_hdr" >&5
+echo "configure:1531: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1454 "configure"
+#line 1536 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1459: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
+{ (eval echo configure:1541: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
eval "ac_cv_header_$ac_safe=yes"
@@ -1483,12 +1565,12 @@ done
echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:1487: checking for ANSI C header files" >&5
+echo "configure:1569: checking for ANSI C header files" >&5
if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1492 "configure"
+#line 1574 "configure"
#include "confdefs.h"
#include <stdlib.h>
#include <stdarg.h>
@@ -1496,8 +1578,8 @@ else
#include <float.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1500: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
+{ (eval echo configure:1582: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
ac_cv_header_stdc=yes
@@ -1513,7 +1595,7 @@ rm -f conftest*
if test $ac_cv_header_stdc = yes; then
# SunOS 4.x string.h does not declare mem*, contrary to ANSI.
cat > conftest.$ac_ext <<EOF
-#line 1517 "configure"
+#line 1599 "configure"
#include "confdefs.h"
#include <string.h>
EOF
@@ -1531,7 +1613,7 @@ fi
if test $ac_cv_header_stdc = yes; then
# ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
cat > conftest.$ac_ext <<EOF
-#line 1535 "configure"
+#line 1617 "configure"
#include "confdefs.h"
#include <stdlib.h>
EOF
@@ -1552,7 +1634,7 @@ if test "$cross_compiling" = yes; then
:
else
cat > conftest.$ac_ext <<EOF
-#line 1556 "configure"
+#line 1638 "configure"
#include "confdefs.h"
#include <ctype.h>
#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
@@ -1563,7 +1645,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
exit (0); }
EOF
-if { (eval echo configure:1567: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:1649: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
:
else
@@ -1587,12 +1669,12 @@ EOF
fi
echo $ac_n "checking for off_t""... $ac_c" 1>&6
-echo "configure:1591: checking for off_t" >&5
+echo "configure:1673: checking for off_t" >&5
if eval "test \"`echo '$''{'ac_cv_type_off_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1596 "configure"
+#line 1678 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
@@ -1601,7 +1683,7 @@ else
#endif
EOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- egrep "off_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
+ egrep "(^|[^a-zA-Z_0-9])off_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
rm -rf conftest*
ac_cv_type_off_t=yes
else
@@ -1620,16 +1702,16 @@ EOF
fi
echo $ac_n "checking for void""... $ac_c" 1>&6
-echo "configure:1624: checking for void" >&5
+echo "configure:1706: checking for void" >&5
cat > conftest.$ac_ext <<EOF
-#line 1626 "configure"
+#line 1708 "configure"
#include "confdefs.h"
int main() {
void *foo = 0;
; return 0; }
EOF
-if { (eval echo configure:1633: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1715: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
echo "$ac_t""yes" 1>&6; cat >> confdefs.h <<\EOF
#define HAVE_VOID 1
@@ -1643,16 +1725,16 @@ else
fi
rm -f conftest*
echo $ac_n "checking for const""... $ac_c" 1>&6
-echo "configure:1647: checking for const" >&5
+echo "configure:1729: checking for const" >&5
cat > conftest.$ac_ext <<EOF
-#line 1649 "configure"
+#line 1731 "configure"
#include "confdefs.h"
int main() {
const int foo = 0;
; return 0; }
EOF
-if { (eval echo configure:1656: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1738: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
echo "$ac_t""yes" 1>&6; cat >> confdefs.h <<\EOF
#define HAVE_CONST 1
@@ -1666,16 +1748,16 @@ else
fi
rm -f conftest*
echo $ac_n "checking for time_t""... $ac_c" 1>&6
-echo "configure:1670: checking for time_t" >&5
+echo "configure:1752: checking for time_t" >&5
cat > conftest.$ac_ext <<EOF
-#line 1672 "configure"
+#line 1754 "configure"
#include "confdefs.h"
#include <time.h>
int main() {
time_t t = 0;
; return 0; }
EOF
-if { (eval echo configure:1679: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1761: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
echo "$ac_t""yes" 1>&6; cat >> confdefs.h <<\EOF
#define HAVE_TIME_T 1
@@ -1690,12 +1772,12 @@ fi
rm -f conftest*
echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6
-echo "configure:1694: checking return type of signal handlers" >&5
+echo "configure:1776: checking return type of signal handlers" >&5
if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1699 "configure"
+#line 1781 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <signal.h>
@@ -1712,7 +1794,7 @@ int main() {
int i;
; return 0; }
EOF
-if { (eval echo configure:1716: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1798: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_type_signal=void
else
@@ -1730,15 +1812,15 @@ cat >> confdefs.h <<EOF
EOF
-for ac_func in memcpy popen _setjmp sigprocmask sigsetmask stat strchr strstr system
+for ac_func in fsync 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
+echo "configure:1819: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1742 "configure"
+#line 1824 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -1761,7 +1843,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:1765: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1847: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -1787,12 +1869,12 @@ done
echo $ac_n "checking for tcgetattr""... $ac_c" 1>&6
-echo "configure:1791: checking for tcgetattr" >&5
+echo "configure:1873: checking for tcgetattr" >&5
if eval "test \"`echo '$''{'ac_cv_func_tcgetattr'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1796 "configure"
+#line 1878 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char tcgetattr(); below. */
@@ -1815,7 +1897,7 @@ tcgetattr();
; return 0; }
EOF
-if { (eval echo configure:1819: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1901: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_tcgetattr=yes"
else
@@ -1839,9 +1921,9 @@ fi
echo $ac_n "checking for fileno""... $ac_c" 1>&6
-echo "configure:1843: checking for fileno" >&5
+echo "configure:1925: checking for fileno" >&5
cat > conftest.$ac_ext <<EOF
-#line 1845 "configure"
+#line 1927 "configure"
#include "confdefs.h"
#if HAVE_STDIO_H
@@ -1851,7 +1933,7 @@ int main() {
static int x; x = fileno(stdin);
; return 0; }
EOF
-if { (eval echo configure:1855: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1937: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
echo "$ac_t""yes" 1>&6; cat >> confdefs.h <<\EOF
#define HAVE_FILENO 1
@@ -1866,9 +1948,9 @@ fi
rm -f conftest*
echo $ac_n "checking for strerror""... $ac_c" 1>&6
-echo "configure:1870: checking for strerror" >&5
+echo "configure:1952: checking for strerror" >&5
cat > conftest.$ac_ext <<EOF
-#line 1872 "configure"
+#line 1954 "configure"
#include "confdefs.h"
#if HAVE_STDIO_H
@@ -1884,7 +1966,7 @@ int main() {
static char *x; x = strerror(0);
; return 0; }
EOF
-if { (eval echo configure:1888: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1970: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
echo "$ac_t""yes" 1>&6; cat >> confdefs.h <<\EOF
#define HAVE_STRERROR 1
@@ -1899,16 +1981,16 @@ fi
rm -f conftest*
echo $ac_n "checking for sys_errlist""... $ac_c" 1>&6
-echo "configure:1903: checking for sys_errlist" >&5
+echo "configure:1985: checking for sys_errlist" >&5
cat > conftest.$ac_ext <<EOF
-#line 1905 "configure"
+#line 1987 "configure"
#include "confdefs.h"
int main() {
extern char *sys_errlist[]; static char **x; x = sys_errlist;
; return 0; }
EOF
-if { (eval echo configure:1912: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1994: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
echo "$ac_t""yes" 1>&6; cat >> confdefs.h <<\EOF
#define HAVE_SYS_ERRLIST 1
@@ -1923,9 +2005,9 @@ fi
rm -f conftest*
echo $ac_n "checking for sigset_t""... $ac_c" 1>&6
-echo "configure:1927: checking for sigset_t" >&5
+echo "configure:2009: checking for sigset_t" >&5
cat > conftest.$ac_ext <<EOF
-#line 1929 "configure"
+#line 2011 "configure"
#include "confdefs.h"
#include <signal.h>
@@ -1934,7 +2016,7 @@ 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
+if { (eval echo configure:2020: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
echo "$ac_t""yes" 1>&6; cat >> confdefs.h <<\EOF
#define HAVE_SIGSET_T 1
@@ -1949,9 +2031,9 @@ fi
rm -f conftest*
echo $ac_n "checking for sigemptyset""... $ac_c" 1>&6
-echo "configure:1953: checking for sigemptyset" >&5
+echo "configure:2035: checking for sigemptyset" >&5
cat > conftest.$ac_ext <<EOF
-#line 1955 "configure"
+#line 2037 "configure"
#include "confdefs.h"
#include <signal.h>
@@ -1960,7 +2042,7 @@ 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
+if { (eval echo configure:2046: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
echo "$ac_t""yes" 1>&6; cat >> confdefs.h <<\EOF
#define HAVE_SIGEMPTYSET 1
@@ -1976,9 +2058,9 @@ rm -f conftest*
have_errno=no
echo $ac_n "checking for errno""... $ac_c" 1>&6
-echo "configure:1980: checking for errno" >&5
+echo "configure:2062: checking for errno" >&5
cat > conftest.$ac_ext <<EOF
-#line 1982 "configure"
+#line 2064 "configure"
#include "confdefs.h"
#if HAVE_ERRNO_H
@@ -1988,7 +2070,7 @@ int main() {
static int x; x = errno;
; 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:2074: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
echo "$ac_t""yes - in errno.h" 1>&6; cat >> confdefs.h <<\EOF
#define HAVE_ERRNO 1
@@ -2001,7 +2083,7 @@ fi
rm -f conftest*
if test $have_errno = no; then
cat > conftest.$ac_ext <<EOF
-#line 2005 "configure"
+#line 2087 "configure"
#include "confdefs.h"
#if HAVE_ERRNO_H
@@ -2011,7 +2093,7 @@ int main() {
extern int errno; static int x; x = errno;
; return 0; }
EOF
-if { (eval echo configure:2015: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2097: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
echo "$ac_t""yes - must define" 1>&6; cat >> confdefs.h <<\EOF
#define HAVE_ERRNO 1
@@ -2030,9 +2112,9 @@ rm -f conftest*
fi
echo $ac_n "checking for locale""... $ac_c" 1>&6
-echo "configure:2034: checking for locale" >&5
+echo "configure:2116: checking for locale" >&5
cat > conftest.$ac_ext <<EOF
-#line 2036 "configure"
+#line 2118 "configure"
#include "confdefs.h"
#include <locale.h>
#include <ctype.h>
@@ -2040,7 +2122,7 @@ int main() {
setlocale(LC_CTYPE,""); isprint(0); iscntrl(0);
; return 0; }
EOF
-if { (eval echo configure:2044: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2126: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
echo "$ac_t""yes" 1>&6; cat >> confdefs.h <<\EOF
#define HAVE_LOCALE 1
@@ -2054,9 +2136,9 @@ else
fi
rm -f conftest*
echo $ac_n "checking for ctype functions""... $ac_c" 1>&6
-echo "configure:2058: checking for ctype functions" >&5
+echo "configure:2140: checking for ctype functions" >&5
cat > conftest.$ac_ext <<EOF
-#line 2060 "configure"
+#line 2142 "configure"
#include "confdefs.h"
#if HAVE_CTYPE_H
@@ -2066,7 +2148,7 @@ int main() {
static int x; x = isupper(x); x = tolower(x); x = toupper(x);
; 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:2152: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
echo "$ac_t""yes" 1>&6; cat >> confdefs.h <<\EOF
#define HAVE_UPPER_LOWER 1
@@ -2082,9 +2164,9 @@ rm -f conftest*
have_ospeed=no
echo $ac_n "checking termcap for ospeed""... $ac_c" 1>&6
-echo "configure:2086: checking termcap for ospeed" >&5
+echo "configure:2168: checking termcap for ospeed" >&5
cat > conftest.$ac_ext <<EOF
-#line 2088 "configure"
+#line 2170 "configure"
#include "confdefs.h"
#include <sys/types.h>
@@ -2098,7 +2180,7 @@ int main() {
ospeed = 0;
; return 0; }
EOF
-if { (eval echo configure:2102: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2184: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
echo "$ac_t""yes - in termcap.h" 1>&6; cat >> confdefs.h <<\EOF
#define HAVE_OSPEED 1
@@ -2111,14 +2193,14 @@ fi
rm -f conftest*
if test $have_ospeed = no; then
cat > conftest.$ac_ext <<EOF
-#line 2115 "configure"
+#line 2197 "configure"
#include "confdefs.h"
int main() {
extern short ospeed; ospeed = 0;
; return 0; }
EOF
-if { (eval echo configure:2122: \"$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${ac_exeext}; then
rm -rf conftest*
echo "$ac_t""yes - must define" 1>&6; cat >> confdefs.h <<\EOF
#define HAVE_OSPEED 1
@@ -2139,7 +2221,7 @@ fi
have_regex=no
have_posix_regex=unknown
echo $ac_n "checking for regcomp""... $ac_c" 1>&6
-echo "configure:2143: checking for regcomp" >&5
+echo "configure:2225: checking for regcomp" >&5
WANT_REGEX=auto
# Check whether --with-regex or --without-regex was given.
@@ -2155,7 +2237,7 @@ if test "$cross_compiling" = yes; then
have_posix_regex=unknown
else
cat > conftest.$ac_ext <<EOF
-#line 2159 "configure"
+#line 2241 "configure"
#include "confdefs.h"
#include <sys/types.h>
@@ -2170,7 +2252,7 @@ if (rm.rm_sp != text + 1) exit(1); /* check for correct offset */
#endif
exit(0); }
EOF
-if { (eval echo configure:2174: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:2256: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
have_posix_regex=yes
else
@@ -2191,7 +2273,7 @@ EOF
have_regex=yes
elif test $have_posix_regex = unknown; then
cat > conftest.$ac_ext <<EOF
-#line 2195 "configure"
+#line 2277 "configure"
#include "confdefs.h"
#include <sys/types.h>
@@ -2200,7 +2282,7 @@ int main() {
regex_t *r; regfree(r);
; return 0; }
EOF
-if { (eval echo configure:2204: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2286: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
echo "$ac_t""using POSIX regcomp" 1>&6
cat >> confdefs.h <<\EOF
@@ -2221,7 +2303,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:2225: checking for pcre_compile in -lpcre" >&5
+echo "configure:2307: 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
@@ -2229,7 +2311,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lpcre $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 2233 "configure"
+#line 2315 "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
@@ -2240,7 +2322,7 @@ int main() {
pcre_compile()
; return 0; }
EOF
-if { (eval echo configure:2244: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2326: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -2269,12 +2351,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:2273: checking for regcmp" >&5
+echo "configure:2355: 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 2278 "configure"
+#line 2360 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char regcmp(); below. */
@@ -2297,7 +2379,7 @@ regcmp();
; return 0; }
EOF
-if { (eval echo configure:2301: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2383: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_regcmp=yes"
else
@@ -2325,7 +2407,7 @@ fi
if test $have_regex = no; then
if test $WANT_REGEX = auto -o $WANT_REGEX = regcomp; then
cat > conftest.$ac_ext <<EOF
-#line 2329 "configure"
+#line 2411 "configure"
#include "confdefs.h"
#include "regexp.h"
@@ -2333,7 +2415,7 @@ int main() {
regcomp("");
; return 0; }
EOF
-if { (eval echo configure:2337: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2419: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
echo "$ac_t""using V8 regcomp" 1>&6; cat >> confdefs.h <<\EOF
#define HAVE_V8_REGCOMP 1
@@ -2362,12 +2444,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:2366: checking for re_comp" >&5
+echo "configure:2448: 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 2371 "configure"
+#line 2453 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char re_comp(); below. */
@@ -2390,7 +2472,7 @@ re_comp();
; return 0; }
EOF
-if { (eval echo configure:2394: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2476: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_re_comp=yes"
else
@@ -2455,7 +2537,7 @@ EOF
# Ultrix sh set writes to stderr and can't be redirected directly,
# and sets the high bit in the cache file unless we assign to the vars.
(set) 2>&1 |
- case `(ac_space=' '; set) 2>&1` in
+ case `(ac_space=' '; set | grep ac_space) 2>&1` in
*ac_space=\ *)
# `set' does not quote correctly, so add quotes (double-quote substitution
# turns \\\\ into \\, and sed turns \\ into \).
@@ -2522,7 +2604,7 @@ do
echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion"
exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;;
-version | --version | --versio | --versi | --vers | --ver | --ve | --v)
- echo "$CONFIG_STATUS generated by autoconf version 2.12"
+ echo "$CONFIG_STATUS generated by autoconf version 2.13"
exit 0 ;;
-help | --help | --hel | --he | --h)
echo "\$ac_cs_usage"; exit 0 ;;
@@ -2542,9 +2624,11 @@ sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g;
s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF
$ac_vpsub
$extrasub
+s%@SHELL@%$SHELL%g
s%@CFLAGS@%$CFLAGS%g
s%@CPPFLAGS@%$CPPFLAGS%g
s%@CXXFLAGS@%$CXXFLAGS%g
+s%@FFLAGS@%$FFLAGS%g
s%@DEFS@%$DEFS%g
s%@LDFLAGS@%$LDFLAGS%g
s%@LIBS@%$LIBS%g
@@ -2566,6 +2650,7 @@ s%@mandir@%$mandir%g
s%@CC@%$CC%g
s%@CPP@%$CPP%g
s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
+s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g
s%@INSTALL_DATA@%$INSTALL_DATA%g
s%@REGEX_O@%$REGEX_O%g
diff --git a/contrib/less/configure.in b/contrib/less/configure.in
index d92c551a086c..83284735849a 100644
--- a/contrib/less/configure.in
+++ b/contrib/less/configure.in
@@ -8,6 +8,11 @@ AC_ISC_POSIX
AC_PROG_GCC_TRADITIONAL
AC_PROG_INSTALL
+dnl Check for compilation model.
+dnl AC_SYS_LARGEFILE is not supported in all versions of autoconf.
+dnl Remove the dnl comment on the next line to use large (64 bit) files.
+dnl AC_SYS_LARGEFILE
+
dnl Checks for libraries.
AC_CHECK_LIB(xcurses, initscr, [have_xcurses=yes], [have_xcurses=no])
AC_CHECK_LIB(ncurses, initscr, [have_ncurses=yes], [have_ncurses=no])
@@ -30,6 +35,9 @@ if test x`uname -s` = "xHP-UX" >/dev/null 2>&1; then
if test x`uname -r` = "xB.11.00" >/dev/null 2>&1; then
curses_broken=1
fi
+if test x`uname -r` = "xB.11.11" >/dev/null 2>&1; then
+ curses_broken=1
+fi
fi
if test $curses_broken = 0; then
@@ -139,7 +147,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 sigprocmask sigsetmask stat strchr strstr system)
+AC_CHECK_FUNCS(fsync 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))
diff --git a/contrib/less/decode.c b/contrib/less/decode.c
index 46ac21bcd5f8..f5f58ea00d03 100644
--- a/contrib/less/decode.c
+++ b/contrib/less/decode.c
@@ -140,6 +140,8 @@ static unsigned char cmdtable[] =
CONTROL('X'),CONTROL('V'),0, A_EXAMINE,
':','n',0, A_NEXT_FILE,
':','p',0, A_PREV_FILE,
+ 't',0, A_NEXT_TAG,
+ 'T',0, A_PREV_TAG,
':','x',0, A_INDEX_FILE,
':','d',0, A_REMOVE_FILE,
'-',0, A_OPT_TOGGLE,
@@ -293,6 +295,13 @@ init_cmds()
add_ecmd_table((char*)edittable, sizeof(edittable));
#if USERFILE
/*
+ * For backwards compatibility,
+ * try to add tables in the OLD system lesskey file.
+ */
+#ifdef BINDIR
+ add_hometable(NULL, BINDIR "/.sysless", 1);
+#endif
+ /*
* Try to add the tables in the system lesskey file.
*/
add_hometable("LESSKEY_SYSTEM", LESSKEYFILE_SYS, 1);
@@ -708,7 +717,7 @@ add_hometable(envname, def_filename, sysvar)
char *filename;
PARG parg;
- if ((filename = lgetenv(envname)) != NULL)
+ if (envname != NULL && (filename = lgetenv(envname)) != NULL)
filename = save(filename);
else if (sysvar)
filename = save(def_filename);
@@ -764,6 +773,16 @@ editchar(c, flags)
action = ecmd_decode(usercmd, &s);
} while (action == A_PREFIX);
+ if (flags & EC_NORIGHTLEFT)
+ {
+ switch (action)
+ {
+ case EC_RIGHT:
+ case EC_LEFT:
+ action = A_INVALID;
+ break;
+ }
+ }
#if CMD_HISTORY
if (flags & EC_NOHISTORY)
{
diff --git a/contrib/less/defines.ds b/contrib/less/defines.ds
index 1144168892bc..bf8b57968c1a 100644
--- a/contrib/less/defines.ds
+++ b/contrib/less/defines.ds
@@ -185,6 +185,7 @@
#define TERMBUF_SIZE 2048 /* Termcap buffer for tgetent */
#define TERMSBUF_SIZE 1024 /* Buffer to hold termcap strings */
#define TAGLINE_SIZE 512 /* Max size of line in tags file */
+#define TABSTOP_MAX 32 /* Max number of custom tab stops */
/* Define to `long' if <sys/types.h> doesn't define. */
#if MSDOS_COMPILER==BORLANDC
@@ -253,7 +254,7 @@
#define MUST_DEFINE_OSPEED 0
/* Define HAVE_LOCALE if you have locale.h and setlocale. */
-#define HAVE_LOCALE 1
+#define HAVE_LOCALE 0
/* Define HAVE_TERMIOS_FUNCS if you have tcgetattr/tcsetattr */
#define HAVE_TERMIOS_FUNCS 0
diff --git a/contrib/less/defines.h.in b/contrib/less/defines.h.in
index 3f379cadb8b0..8b8df1b17e1c 100644
--- a/contrib/less/defines.h.in
+++ b/contrib/less/defines.h.in
@@ -105,7 +105,7 @@
* (in the HOME directory).
*/
#define LESSKEYFILE ".less"
-#define LESSKEYFILE_SYS SYSDIR "/.sysless"
+#define LESSKEYFILE_SYS SYSDIR "/sysless"
#define DEF_LESSKEYINFILE ".lesskey"
@@ -169,6 +169,7 @@
#define TERMBUF_SIZE 2048 /* Termcap buffer for tgetent */
#define TERMSBUF_SIZE 1024 /* Buffer to hold termcap strings */
#define TAGLINE_SIZE 512 /* Max size of line in tags file */
+#define TABSTOP_MAX 32 /* Max number of custom tab stops */
/* Settings automatically determined by configure. */
@@ -253,6 +254,9 @@
/* Define if you have the _setjmp function. */
#undef HAVE__SETJMP
+/* Define if you have the fsync function. */
+#undef HAVE_FSYNC
+
/* Define if you have the memcpy function. */
#undef HAVE_MEMCPY
diff --git a/contrib/less/defines.h.top b/contrib/less/defines.h.top
index e14d1ea52f0b..11b32df87f2e 100644
--- a/contrib/less/defines.h.top
+++ b/contrib/less/defines.h.top
@@ -104,7 +104,7 @@
* (in the HOME directory).
*/
#define LESSKEYFILE ".less"
-#define LESSKEYFILE_SYS SYSDIR "/.sysless"
+#define LESSKEYFILE_SYS SYSDIR "/sysless"
#define DEF_LESSKEYINFILE ".lesskey"
@@ -168,5 +168,6 @@
#define TERMBUF_SIZE 2048 /* Termcap buffer for tgetent */
#define TERMSBUF_SIZE 1024 /* Buffer to hold termcap strings */
#define TAGLINE_SIZE 512 /* Max size of line in tags file */
+#define TABSTOP_MAX 32 /* Max number of custom tab stops */
/* Settings automatically determined by configure. */
diff --git a/contrib/less/defines.o2 b/contrib/less/defines.o2
index 48bfe0c1bccf..cf923e43e4f7 100644
--- a/contrib/less/defines.o2
+++ b/contrib/less/defines.o2
@@ -60,7 +60,7 @@
* EDIT_PGM is the name of the (default) editor to be invoked.
*/
#define EDITOR (!SECURE)
-#define EDIT_PGM "me"
+#define EDIT_PGM "vi"
/*
* TAGS is 1 if you wish to support tag files.
@@ -112,7 +112,7 @@
* (in the HOME directory).
*/
#define LESSKEYFILE "less.ini"
-#define LESSKEYFILE_SYS "\\sysless.ini"
+#define LESSKEYFILE_SYS "C:\\sysless.ini"
#define DEF_LESSKEYINFILE "lesskey.ini"
@@ -166,6 +166,7 @@
#define TERMBUF_SIZE 2048 /* Termcap buffer for tgetent */
#define TERMSBUF_SIZE 1024 /* Buffer to hold termcap strings */
#define TAGLINE_SIZE 512 /* Max size of line in tags file */
+#define TABSTOP_MAX 32 /* Max number of custom tab stops */
/* Define to `long' if <sys/types.h> doesn't define. */
/* #define off_t long */
@@ -200,7 +201,7 @@
#define HAVE_CONST 1
/* Define HAVE_TIME_T if your system supports the "time_t" type. */
-#define HAVE_TIME_T 0
+#define HAVE_TIME_T 1
/* Define HAVE_STRERROR if you have the strerror() function. */
#define HAVE_STRERROR 1
@@ -212,22 +213,22 @@
/* Define MUST_DEFINE_ERRNO if you have errno but it is not define
* in errno.h */
#define HAVE_ERRNO 1
-#define MUST_DEFINE_ERRNO 1
+/* #undef MUST_DEFINE_ERRNO */
/* Define HAVE_SYS_ERRLIST if you have the sys_errlist[] variable */
#define HAVE_SYS_ERRLIST 1
/* Define HAVE_OSPEED if your termcap library has the ospeed variable */
-#define HAVE_OSPEED 0
+#define HAVE_OSPEED 1
/* Define MUST_DEFINE_OSPEED if you have ospeed but it is not defined
* in termcap.h. */
#define MUST_DEFINE_OSPEED 0
/* Define HAVE_LOCALE if you have locale.h and setlocale. */
-#define HAVE_LOCALE 0
+#define HAVE_LOCALE 1
/* Define HAVE_TERMIOS_FUNCS if you have tcgetattr/tcsetattr */
-#define HAVE_TERMIOS_FUNCS 0
+#define HAVE_TERMIOS_FUNCS 1
/* Define HAVE_UPPER_LOWER if you have isupper, islower, toupper, tolower */
#define HAVE_UPPER_LOWER 1
@@ -239,17 +240,17 @@
#define HAVE_MEMCPY 1
/* Define if you have the popen function. */
-#define HAVE_POPEN 0
+#define HAVE_POPEN 1
/* Define if you have the sigsetmask function. */
#define HAVE_SIGSETMASK 0
/* Define if you have the sigprocmask function. */
-#define HAVE_SIGPROCMASK 0
+#define HAVE_SIGPROCMASK 1
/* Define if you have the sigset_t type and sigemptyset macro */
-#define HAVE_SIGSET_T 0
-#define HAVE_SIGEMPTYSET 0
+#define HAVE_SIGSET_T 1
+#define HAVE_SIGEMPTYSET 1
/* Define if you have the stat function. */
#define HAVE_STAT 1
@@ -257,6 +258,9 @@
/* Define if you have the strchr function. */
#define HAVE_STRCHR 1
+/* Define if you have the strstr function. */
+#define HAVE_STRSTR 1
+
/* Define if you have the system function. */
#define HAVE_SYSTEM 1
@@ -264,13 +268,13 @@
#define HAVE_CTYPE_H 1
/* Define if you have the <errno.h> header file. */
-#define HAVE_ERRNO_H 0
+#define HAVE_ERRNO_H 1
/* Define if you have the <fcntl.h> header file. */
#define HAVE_FCNTL_H 1
/* Define if you have the <limits.h> header file. */
-#define HAVE_LIMITS_H 0
+#define HAVE_LIMITS_H 1
/* Define if you have the <stdio.h> header file. */
#define HAVE_STDIO_H 1
@@ -282,7 +286,7 @@
#define HAVE_STRING_H 1
/* Define if you have the <sys/ioctl.h> header file. */
-#define HAVE_SYS_IOCTL_H 0
+#define HAVE_SYS_IOCTL_H 1
/* Define if you have the <sys/ptem.h> header file. */
#define HAVE_SYS_PTEM_H 0
@@ -291,13 +295,13 @@
#define HAVE_SYS_STREAM_H 0
/* Define if you have the <termcap.h> header file. */
-#define HAVE_TERMCAP_H 0
+#define HAVE_TERMCAP_H 1
/* Define if you have the <termio.h> header file. */
-#define HAVE_TERMIO_H 0
+#define HAVE_TERMIO_H 1
/* Define if you have the <termios.h> header file. */
-#define HAVE_TERMIOS_H 0
+#define HAVE_TERMIOS_H 1
/* Define if you have the <time.h> header file. */
#define HAVE_TIME_H 1
diff --git a/contrib/less/defines.o9 b/contrib/less/defines.o9
index 6f447c2272bc..553a005e4e65 100644
--- a/contrib/less/defines.o9
+++ b/contrib/less/defines.o9
@@ -179,6 +179,7 @@
#define TERMBUF_SIZE 2048 /* Termcap buffer for tgetent */
#define TERMSBUF_SIZE 1024 /* Buffer to hold termcap strings */
#define TAGLINE_SIZE 512 /* Max size of line in tags file */
+#define TABSTOP_MAX 32 /* Max number of custom tab stops */
/* Define to `long' if <sys/types.h> doesn't define. */
#define off_t long
diff --git a/contrib/less/defines.wn b/contrib/less/defines.wn
index 538f645d59e6..73970c2efc97 100644
--- a/contrib/less/defines.wn
+++ b/contrib/less/defines.wn
@@ -167,6 +167,7 @@
#define TERMBUF_SIZE 2048 /* Termcap buffer for tgetent */
#define TERMSBUF_SIZE 1024 /* Buffer to hold termcap strings */
#define TAGLINE_SIZE 512 /* Max size of line in tags file */
+#define TABSTOP_MAX 32 /* Max number of custom tab stops */
/* Define to `long' if <sys/types.h> doesn't define. */
/* #define off_t long */
@@ -225,7 +226,7 @@
#define MUST_DEFINE_OSPEED 0
/* Define HAVE_LOCALE if you have locale.h and setlocale. */
-#define HAVE_LOCALE 1
+#define HAVE_LOCALE 0
/* Define HAVE_TERMIOS_FUNCS if you have tcgetattr/tcsetattr */
#define HAVE_TERMIOS_FUNCS 0
@@ -240,7 +241,7 @@
#define HAVE_MEMCPY 1
/* Define if you have the popen function. */
-#define HAVE_POPEN 0
+#define HAVE_POPEN 1
/* Define if you have the sigsetmask function. */
#define HAVE_SIGSETMASK 0
diff --git a/contrib/less/filename.c b/contrib/less/filename.c
index 189ad87f6e91..bfbbfdbead9e 100644
--- a/contrib/less/filename.c
+++ b/contrib/less/filename.c
@@ -24,7 +24,6 @@
#if MSDOS_COMPILER==DJGPPC
#include <glob.h>
#include <dir.h>
-#include <limits.h>
#define _MAX_PATH PATH_MAX
#endif
#endif
@@ -34,6 +33,9 @@
#include <modes.h>
#endif
#endif
+#if OS2
+#include <signal.h>
+#endif
#if HAVE_STAT
#include <sys/stat.h>
@@ -878,7 +880,16 @@ close_altfile(altfilename, filename, pipefd)
if (secure)
return;
if (pipefd != NULL)
+ {
+#if OS2
+ /*
+ * The pclose function of OS/2 emx sometimes fails.
+ * Send SIGINT to the piped process before closing it.
+ */
+ kill(((FILE*)pipefd)->_pid, SIGINT);
+#endif
pclose((FILE*) pipefd);
+ }
if ((lessclose = lgetenv("LESSCLOSE")) == NULL)
return;
gfilename = esc_metachars(filename);
diff --git a/contrib/less/funcs.h b/contrib/less/funcs.h
index 8f0967dc19cb..6d11a70ba86b 100644
--- a/contrib/less/funcs.h
+++ b/contrib/less/funcs.h
@@ -12,6 +12,7 @@
public void home ();
public void add_line ();
public void remove_top ();
+ public void win32_scroll_up ();
public void lower_left ();
public void check_winch ();
public void goto_line ();
@@ -142,6 +143,7 @@
public void init_line ();
public void prewind ();
public void plinenum ();
+ public int is_ansi_end ();
public int pappend ();
public void pdone ();
public int gline ();
@@ -175,6 +177,7 @@
public void opt_i ();
public void opt__V ();
public void opt_D ();
+ public void opt_x ();
public void opt_quote ();
public void opt_query ();
public int get_swindow ();
@@ -195,7 +198,6 @@
public int percentage ();
public POSITION percent_pos ();
public int os9_signal ();
- public int isatty ();
public void put_line ();
public void flush ();
public int putchr ();
@@ -218,6 +220,7 @@
public char * pr_expand ();
public char * eq_message ();
public char * pr_string ();
+ public char * wait_message ();
public void repaint_hilite ();
public void clear_attn ();
public void undo_search ();
@@ -231,9 +234,15 @@
public RETSIGTYPE winch ();
public void init_signals ();
public void psignals ();
+ public void cleantags ();
+ public int gettagtype ();
public void findtag ();
- public int edit_tagfile ();
public POSITION tagsearch ();
+ public char * nexttag ();
+ public char * prevtag ();
+ public int ntags ();
+ public int curr_tag ();
+ public int edit_tagfile ();
public void open_getchr ();
public void close_getchr ();
public int getchr ();
diff --git a/contrib/less/help.c b/contrib/less/help.c
index a7a283f9fd32..98813f9069bd 100644
--- a/contrib/less/help.c
+++ b/contrib/less/help.c
@@ -22,8 +22,8 @@ constant char helpdata[] = {
' ',' ','E','S','C','-','S','P','A','C','E',' ',' ',' ',' ',' ',' ',' ',' ',' ','*',' ',' ','F','o','r','w','a','r','d',' ',' ','o','n','e',' ','w','i','n','d','o','w',',',' ','b','u','t',' ','d','o','n','\'','t',' ','s','t','o','p',' ','a','t',' ','e','n','d','-','o','f','-','f','i','l','e','.','\n',
' ',' ','d',' ',' ','^','D',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','*',' ',' ','F','o','r','w','a','r','d',' ',' ','o','n','e',' ','h','a','l','f','-','w','i','n','d','o','w',' ','(','a','n','d',' ','s','e','t',' ','h','a','l','f','-','w','i','n','d','o','w',' ','t','o',' ','_','\b','N',')','.','\n',
' ',' ','u',' ',' ','^','U',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','*',' ',' ','B','a','c','k','w','a','r','d',' ','o','n','e',' ','h','a','l','f','-','w','i','n','d','o','w',' ','(','a','n','d',' ','s','e','t',' ','h','a','l','f','-','w','i','n','d','o','w',' ','t','o',' ','_','\b','N',')','.','\n',
-' ',' ','E','S','C','-','(',' ',' ','R','i','g','h','t','A','r','r','o','w',' ','*',' ',' ','L','e','f','t',' ',' ','8',' ','c','h','a','r','a','c','t','e','r',' ','p','o','s','i','t','i','o','n','s',' ','(','o','r',' ','_','\b','N',' ','p','o','s','i','t','i','o','n','s',')','.','\n',
-' ',' ','E','S','C','-',')',' ',' ','L','e','f','t','A','r','r','o','w',' ',' ','*',' ',' ','R','i','g','h','t',' ','8',' ','c','h','a','r','a','c','t','e','r',' ','p','o','s','i','t','i','o','n','s',' ','(','o','r',' ','_','\b','N',' ','p','o','s','i','t','i','o','n','s',')','.','\n',
+' ',' ','E','S','C','-','(',' ',' ','R','i','g','h','t','A','r','r','o','w',' ','*',' ',' ','L','e','f','t',' ',' ','o','n','e',' ','h','a','l','f',' ','s','c','r','e','e','n',' ','w','i','d','t','h',' ','(','o','r',' ','_','\b','N',' ','p','o','s','i','t','i','o','n','s',')','.','\n',
+' ',' ','E','S','C','-',')',' ',' ','L','e','f','t','A','r','r','o','w',' ',' ','*',' ',' ','R','i','g','h','t',' ','o','n','e',' ','h','a','l','f',' ','s','c','r','e','e','n',' ','w','i','d','t','h',' ','(','o','r',' ','_','\b','N',' ','p','o','s','i','t','i','o','n','s',')','.','\n',
' ',' ','F',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','F','o','r','w','a','r','d',' ','f','o','r','e','v','e','r',';',' ','l','i','k','e',' ','"','t','a','i','l',' ','-','f','"','.','\n',
' ',' ','r',' ',' ','^','R',' ',' ','^','L',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','R','e','p','a','i','n','t',' ','s','c','r','e','e','n','.','\n',
' ',' ','R',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','R','e','p','a','i','n','t',' ','s','c','r','e','e','n',',',' ','d','i','s','c','a','r','d','i','n','g',' ','b','u','f','f','e','r','e','d',' ','i','n','p','u','t','.','\n',
@@ -55,6 +55,8 @@ constant char helpdata[] = {
' ',' ','g',' ',' ','<',' ',' ','E','S','C','-','<',' ',' ',' ',' ',' ',' ',' ','*',' ',' ','G','o',' ','t','o',' ','f','i','r','s','t',' ','l','i','n','e',' ','i','n',' ','f','i','l','e',' ','(','o','r',' ','l','i','n','e',' ','_','\b','N',')','.','\n',
' ',' ','G',' ',' ','>',' ',' ','E','S','C','-','>',' ',' ',' ',' ',' ',' ',' ','*',' ',' ','G','o',' ','t','o',' ','l','a','s','t',' ','l','i','n','e',' ','i','n',' ','f','i','l','e',' ','(','o','r',' ','l','i','n','e',' ','_','\b','N',')','.','\n',
' ',' ','p',' ',' ','%',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','*',' ',' ','G','o',' ','t','o',' ','b','e','g','i','n','n','i','n','g',' ','o','f',' ','f','i','l','e',' ','(','o','r',' ','_','\b','N',' ','p','e','r','c','e','n','t',' ','i','n','t','o',' ','f','i','l','e',')','.','\n',
+' ',' ','t',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','*',' ',' ','G','o',' ','t','o',' ','t','h','e',' ','(','_','\b','N','-','t','h',')',' ','n','e','x','t',' ','t','a','g','.','\n',
+' ',' ','T',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','*',' ',' ','G','o',' ','t','o',' ','t','h','e',' ','(','_','\b','N','-','t','h',')',' ','p','r','e','v','i','o','u','s',' ','t','a','g','.','\n',
' ',' ','{',' ',' ','(',' ',' ','[',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','*',' ',' ','F','i','n','d',' ','c','l','o','s','e',' ','b','r','a','c','k','e','t',' ','}',' ',')',' ',']','.','\n',
' ',' ','}',' ',' ',')',' ',' ',']',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','*',' ',' ','F','i','n','d',' ','o','p','e','n',' ','b','r','a','c','k','e','t',' ','{',' ','(',' ','[','.','\n',
' ',' ','E','S','C','-','^','F',' ','_','\b','<','_','\b','c','_','\b','1','_','\b','>',' ','_','\b','<','_','\b','c','_','\b','2','_','\b','>',' ',' ','*',' ',' ','F','i','n','d',' ','c','l','o','s','e',' ','b','r','a','c','k','e','t',' ','_','\b','<','_','\b','c','_','\b','2','_','\b','>','.','\n',
@@ -176,10 +178,12 @@ constant char helpdata[] = {
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','H','i','g','h','l','i','g','h','t',' ','f','i','r','s','t',' ','n','e','w',' ','l','i','n','e',' ','a','f','t','e','r',' ','f','o','r','w','a','r','d','-','s','c','r','e','e','n','.','\n',
' ',' ','-','W',' ',' ','.','.','.','.','.','.','.','.',' ',' ','-','-','H','I','L','I','T','E','-','U','N','R','E','A','D','\n',
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','H','i','g','h','l','i','g','h','t',' ','f','i','r','s','t',' ','n','e','w',' ','l','i','n','e',' ','a','f','t','e','r',' ','a','n','y',' ','f','o','r','w','a','r','d',' ','m','o','v','e','m','e','n','t','.','\n',
-' ',' ','-','x',' ','[','_','\b','N',']',' ',' ','.','.','.','.',' ',' ','-','-','t','a','b','s','=','[','_','\b','N',']','\n',
+' ',' ','-','x',' ','[','_','\b','N','[',',','.','.','.',']',']',' ',' ','-','-','t','a','b','s','=','[','_','\b','N','[',',','.','.','.',']',']','\n',
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','S','e','t',' ','t','a','b',' ','s','t','o','p','s','.','\n',
' ',' ','-','X',' ',' ','.','.','.','.','.','.','.','.',' ',' ','-','-','n','o','-','i','n','i','t','\n',
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','D','o','n','\'','t',' ','u','s','e',' ','t','e','r','m','c','a','p',' ','i','n','i','t','/','d','e','i','n','i','t',' ','s','t','r','i','n','g','s','.','\n',
+' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','-','-','n','o','-','k','e','y','p','a','d','\n',
+' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','D','o','n','\'','t',' ','u','s','e',' ','t','e','r','m','c','a','p',' ','k','e','y','p','a','d',' ','i','n','i','t','/','d','e','i','n','i','t',' ','s','t','r','i','n','g','s','.','\n',
' ',' ','-','y',' ','[','_','\b','N',']',' ',' ','.','.','.','.',' ',' ','-','-','m','a','x','-','f','o','r','w','-','s','c','r','o','l','l','=','[','_','\b','N',']','\n',
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','F','o','r','w','a','r','d',' ','s','c','r','o','l','l',' ','l','i','m','i','t','.','\n',
' ',' ','-','z',' ','[','_','\b','N',']',' ',' ','.','.','.','.',' ',' ','-','-','w','i','n','d','o','w','=','[','_','\b','N',']','\n',
diff --git a/contrib/less/less.h b/contrib/less/less.h
index 2063558cf75a..333e70a998ed 100644
--- a/contrib/less/less.h
+++ b/contrib/less/less.h
@@ -70,6 +70,9 @@
#if HAVE_CTYPE_H
#include <ctype.h>
#endif
+#if HAVE_LIMITS_H
+#include <limits.h>
+#endif
#if HAVE_STDLIB_H
#include <stdlib.h>
#endif
@@ -80,7 +83,7 @@
#include <modes.h>
#include <strings.h>
#endif
-#if MSDOS_COMPILER==WIN32C
+#if MSDOS_COMPILER==WIN32C || OS2
#include <io.h>
#endif
#if MSDOS_COMPILER==DJGPPC
@@ -136,13 +139,21 @@ void free();
#define BAD_LSEEK ((off_t)-1)
+#ifndef CHAR_BIT
+#define CHAR_BIT 8
+#endif
+
+/*
+ * Upper bound on the string length of an integer converted to string.
+ * 302 / 1000 is ceil (log10 (2.0)). Subtract 1 for the sign bit;
+ * add 1 for integer division truncation; add 1 more for a minus sign.
+ */
+#define INT_STRLEN_BOUND(t) ((sizeof(t) * CHAR_BIT - 1) * 302 / 1000 + 1 + 1)
+
/*
* Special types and constants.
*/
typedef off_t POSITION;
-#define PR_POSITION "%ld"
-#define MAX_PRINT_POSITION 20
-#define MAX_PRINT_INT 10
#define NULL_POSITION ((POSITION)(-1))
@@ -179,7 +190,7 @@ typedef off_t POSITION;
#if MSDOS_COMPILER==MSOFTC
#define SET_BINARY(f) _setmode(f, _O_BINARY);
#else
-#if MSDOS_COMPILER
+#if MSDOS_COMPILER || OS2
#define SET_BINARY(f) setmode(f, O_BINARY)
#else
#define SET_BINARY(f)
@@ -283,6 +294,10 @@ struct textlist
#define AT_INVIS (4)
#define AT_STANDOUT (5)
+#if '0' == 240
+#define IS_EBCDIC_HOST 1
+#endif
+
#if IS_EBCDIC_HOST
/*
* Long definition for EBCDIC.
diff --git a/contrib/less/less.hlp b/contrib/less/less.hlp
index 24dc8bf85893..d5be32bed158 100644
--- a/contrib/less/less.hlp
+++ b/contrib/less/less.hlp
@@ -19,8 +19,8 @@
ESC-SPACE * Forward one window, but don't stop at end-of-file.
d ^D * Forward one half-window (and set half-window to _N).
u ^U * Backward one half-window (and set half-window to _N).
- ESC-( RightArrow * Left 8 character positions (or _N positions).
- ESC-) LeftArrow * Right 8 character positions (or _N positions).
+ ESC-( RightArrow * Left one half screen width (or _N positions).
+ ESC-) LeftArrow * Right one half screen width (or _N positions).
F Forward forever; like "tail -f".
r ^R ^L Repaint screen.
R Repaint screen, discarding buffered input.
@@ -52,6 +52,8 @@
g < ESC-< * Go to first line in file (or line _N).
G > ESC-> * Go to last line in file (or line _N).
p % * Go to beginning of file (or _N percent into file).
+ t * Go to the (_N-th) next tag.
+ T * Go to the (_N-th) previous tag.
{ ( [ * Find close bracket } ) ].
} ) ] * Find open bracket { ( [.
ESC-^F _<_c_1_> _<_c_2_> * Find close bracket _<_c_2_>.
@@ -173,10 +175,12 @@
Highlight first new line after forward-screen.
-W ........ --HILITE-UNREAD
Highlight first new line after any forward movement.
- -x [_N] .... --tabs=[_N]
+ -x [_N[,...]] --tabs=[_N[,...]]
Set tab stops.
-X ........ --no-init
Don't use termcap init/deinit strings.
+ --no-keypad
+ Don't use termcap keypad init/deinit strings.
-y [_N] .... --max-forw-scroll=[_N]
Forward scroll limit.
-z [_N] .... --window=[_N]
diff --git a/contrib/less/less.man b/contrib/less/less.man
index 0491773c80f9..e917d54570f6 100644
--- a/contrib/less/less.man
+++ b/contrib/less/less.man
@@ -12,10 +12,10 @@ SSYYNNOOPPSSIISS
lleessss ----hheellpp
lleessss --VV
lleessss ----vveerrssiioonn
- lleessss [[--[[++]]aaBBccCCddeeEEffggGGiiIImmMMnnNNqqQQrrssSSuuUUVVwwXX]]
+ lleessss [[--[[++]]aaBBccCCddeeEEffFFggGGiiIIJJmmMMnnNNqqQQrrRRssSSuuUUVVwwWWXX]]
[[--bb _b_u_f_s]] [[--hh _l_i_n_e_s]] [[--jj _l_i_n_e]] [[--kk _k_e_y_f_i_l_e]]
[[--{{ooOO}} _l_o_g_f_i_l_e]] [[--pp _p_a_t_t_e_r_n]] [[--PP _p_r_o_m_p_t]] [[--tt _t_a_g]]
- [[--TT _t_a_g_s_f_i_l_e]] [[--xx _t_a_b]] [[--yy _l_i_n_e_s]] [[--[[zz]] _l_i_n_e_s]]
+ [[--TT _t_a_g_s_f_i_l_e]] [[--xx _t_a_b,,......]] [[--yy _l_i_n_e_s]] [[--[[zz]] _l_i_n_e_s]]
[[++[[++]]_c_m_d]] [[----]] [[_f_i_l_e_n_a_m_e]]......
(See the OPTIONS section for alternate option syntax with
long option names.)
@@ -49,8 +49,8 @@ CCOOMMMMAANNDDSS
SPACE or ^V or f or ^F
Scroll forward N lines, default one window (see
option -z below). If N is more than the screen
- size, only the final screenful is displayed. Warn-
- ing: some systems use ^V as a special literaliza-
+ size, only the final screenful is displayed. Warn­
+ ing: some systems use ^V as a special literaliza­
tion character.
z Like SPACE, but if N is specified, it becomes the
@@ -61,7 +61,7 @@ CCOOMMMMAANNDDSS
- Version 358: 08 Jul 2000 1
+ Version 371: 26 Dec 2001 1
@@ -103,17 +103,17 @@ LESS(1) LESS(1)
ESC-) or RIGHTARROW
Scroll horizontally right N characters, default
- half the screen width (see the -# option). While
+ half the screen width (see the -# option). If a
+ number N is specified, it becomes the default for
+ future RIGHTARROW and LEFTARROW commands. 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 sec-
- tion).
+ option (chop lines) were in effect.
ESC-( or LEFTARROW
Scroll horizontally left N characters, default half
- the screen width (see the -# option).
+ the screen width (see the -# option). If a number
+ N is specified, it becomes the default for future
+ RIGHTARROW and LEFTARROW commands.
r or ^R or ^L
Repaint the screen.
@@ -127,7 +127,7 @@ LESS(1) LESS(1)
- Version 358: 08 Jul 2000 2
+ Version 371: 26 Dec 2001 2
@@ -193,7 +193,7 @@ LESS(1) LESS(1)
- Version 358: 08 Jul 2000 3
+ Version 371: 26 Dec 2001 3
@@ -222,7 +222,7 @@ LESS(1) LESS(1)
^X^X Same as single quote.
/pattern
- Search forward in the file for the N-th line con-
+ Search forward in the file for the N-th line con­
taining the pattern. N defaults to 1. The pattern
is a regular expression, as recognized by _e_d_. The
search starts at the second line displayed (but see
@@ -233,19 +233,19 @@ LESS(1) LESS(1)
search rather than become part of the pattern:
^N or !
- Search for lines which do NOT match the pat-
+ Search for lines which do NOT match the pat­
tern.
^E or *
Search multiple files. That is, if the
search reaches the END of the current file
- without finding a match, the search contin-
+ without finding a match, the search contin­
ues in the next file in the command line
list.
^F or @
Begin the search at the first line of the
- FIRST file in the command line list, regard-
+ FIRST file in the command line list, regard­
less of what is currently displayed on the
screen or the settings of the -a or -j
options.
@@ -254,12 +254,12 @@ LESS(1) LESS(1)
on the current screen, but don't move to the
first match (KEEP current position).
- ^R Don't interpret regular expression metachar-
+ ^R Don't interpret regular expression metachar­
acters; that is, do a simple textual
- Version 358: 08 Jul 2000 4
+ Version 371: 26 Dec 2001 4
@@ -271,26 +271,26 @@ LESS(1) LESS(1)
comparison.
?pattern
- Search backward in the file for the N-th line con-
+ Search backward in the file for the N-th line con­
taining the pattern. The search starts at the line
immediately before the top line displayed.
Certain characters are special as in the / command:
^N or !
- Search for lines which do NOT match the pat-
+ Search for lines which do NOT match the pat­
tern.
^E or *
Search multiple files. That is, if the
search reaches the beginning of the current
file without finding a match, the search
- continues in the previous file in the com-
+ continues in the previous file in the com­
mand line list.
^F or @
Begin the search at the last line of the
- last file in the command line list, regard-
+ last file in the command line list, regard­
less of what is currently displayed on the
screen or the settings of the -a or -j
options.
@@ -306,7 +306,7 @@ LESS(1) LESS(1)
Same as "?*".
n Repeat previous search, for N-th line containing
- the last pattern. If the previous search was modi-
+ the last pattern. If the previous search was modi­
fied by ^N, the search is made for the N-th line
NOT containing the pattern. If the previous search
was modified by ^E, the search continues in the
@@ -316,16 +316,16 @@ LESS(1) LESS(1)
expressions. There is no effect if the previous
search was modified by ^F or ^K.
- N Repeat previous search, but in the reverse direc-
+ N Repeat previous search, but in the reverse direc­
tion.
- ESC-n Repeat previous search, but crossing file bound-
+ ESC-n Repeat previous search, but crossing file bound­
aries. The effect is as if the previous search
were modified by *.
- Version 358: 08 Jul 2000 5
+ Version 371: 26 Dec 2001 5
@@ -334,7 +334,7 @@ LESS(1) LESS(1)
LESS(1) LESS(1)
- ESC-N Repeat previous search, but in the reverse direc-
+ ESC-N Repeat previous search, but in the reverse direc­
tion and crossing file boundaries.
ESC-u Undo search highlighting. Turn off highlighting of
@@ -352,11 +352,11 @@ LESS(1) LESS(1)
below) from the list of files in the command line
is re-examined. A percent sign (%) in the filename
is replaced by the name of the current file. A
- pound sign (#) is replaced by the name of the pre-
+ pound sign (#) is replaced by the name of the pre­
viously examined file. However, two consecutive
percent signs are simply replaced with a single
percent sign. This allows you to enter a filename
- that contains a percent sign in the name. Simi-
+ that contains a percent sign in the name. Simi­
larly, two consecutive pound signs are replaced
with a single pound sign. The filename is inserted
into the command line list of files so that it can
@@ -368,7 +368,7 @@ LESS(1) LESS(1)
double quotes (also see the -" option).
^X^V or E
- Same as :e. Warning: some systems use ^V as a spe-
+ Same as :e. Warning: some systems use ^V as a spe­
cial literalization character. On such systems,
you may not be able to use ^V.
@@ -386,12 +386,12 @@ LESS(1) LESS(1)
:d Remove the current file from the list of files.
- = or ^G or :f
- Prints some information about the file being
+ t Go to the next tag, if there were more than one
+ matches for the current tag. See the -t option for
- Version 358: 08 Jul 2000 6
+ Version 371: 26 Dec 2001 6
@@ -400,75 +400,82 @@ LESS(1) LESS(1)
LESS(1) LESS(1)
- viewed, including its name and the line number and
+ more details about tags.
+
+ T Go to the previous tag, if there were more than one
+ matches for the current tag.
+
+ = or ^G or :f
+ Prints some information about the file being
+ viewed, including its name and the line number and
byte offset of the bottom line being displayed. If
- possible, it also prints the length of the file,
- the number of lines in the file and the percent of
+ possible, it also prints the length of the file,
+ the number of lines in the file and the percent of
the file above the last displayed line.
- - Followed by one of the command line option letters
- (see OPTIONS below), this will change the setting
- of that option and print a message describing the
- new setting. If a ^P (CONTROL-P) is entered imme-
- diately after the dash, the setting of the option
- is changed but no message is printed. If the
- option letter has a numeric value (such as -b or
- -h), or a string value (such as -P or -t), a new
- value may be entered after the option letter. If
- no new value is entered, a message describing the
- current setting is printed and nothing is changed.
-
- -- Like the - command, but takes a long option name
- (see OPTIONS below) rather than a single option
- letter. You must press RETURN after typing the
- option name. A ^P immediately after the second
- dash suppresses printing of a message describing
+ - Followed by one of the command line option letters
+ (see OPTIONS below), this will change the setting
+ of that option and print a message describing the
+ new setting. If a ^P (CONTROL-P) is entered imme­
+ diately after the dash, the setting of the option
+ is changed but no message is printed. If the
+ option letter has a numeric value (such as -b or
+ -h), or a string value (such as -P or -t), a new
+ value may be entered after the option letter. If
+ no new value is entered, a message describing the
+ current setting is printed and nothing is changed.
+
+ -- Like the - command, but takes a long option name
+ (see OPTIONS below) rather than a single option
+ letter. You must press RETURN after typing the
+ option name. A ^P immediately after the second
+ dash suppresses printing of a message describing
the new setting, as in the - command.
- -+ Followed by one of the command line option letters
- this will reset the option to its default setting
- and print a message describing the new setting.
- (The "-+_X" command does the same thing as "-+_X" on
- the command line.) This does not work for string-
+ -+ Followed by one of the command line option letters
+ this will reset the option to its default setting
+ and print a message describing the new setting.
+ (The "-+_X" command does the same thing as "-+_X" on
+ the command line.) This does not work for string-
valued options.
- --+ Like the -+ command, but takes a long option name
+ --+ Like the -+ command, but takes a long option name
rather than a single option letter.
-! Followed by one of the command line option letters,
this will reset the option to the "opposite" of its
- default setting and print a message describing the
- new setting. This does not work for numeric or
+ default setting and print a message describing the
+ new setting. This does not work for numeric or
string-valued options.
- --! Like the -! command, but takes a long option name
+ --! Like the -! command, but takes a long option name
rather than a single option letter.
- _ (Underscore.) Followed by one of the command line
- option letters, this will print a message describ-
- ing the current setting of that option. The set-
- ting of the option is not changed.
+ _ (Underscore.) Followed by one of the command line
+ option letters, this will print a message describ­
+ ing the current setting of that option. The
- __ (Double underscore.) Like the _ (underscore) com-
- mand, but takes a long option name rather than a
- single option letter. You must press RETURN after
- typing the option name.
+ Version 371: 26 Dec 2001 7
- Version 358: 08 Jul 2000 7
+LESS(1) LESS(1)
-LESS(1) LESS(1)
+ setting of the option is not changed.
+ __ (Double underscore.) Like the _ (underscore) com­
+ mand, but takes a long option name rather than a
+ single option letter. You must press RETURN after
+ typing the option name.
+cmd Causes the specified cmd to be executed each time a
- new file is examined. For example, +G causes _l_e_s_s
- to initially display each file starting at the end
+ new file is examined. For example, +G causes _l_e_s_s
+ to initially display each file starting at the end
rather than the beginning.
V Prints the version number of _l_e_s_s being run.
@@ -476,54 +483,47 @@ LESS(1) LESS(1)
q or Q or :q or :Q or ZZ
Exits _l_e_s_s_.
- The following four commands may or may not be valid,
+ The following four commands may or may not be valid,
depending on your particular installation.
- v Invokes an editor to edit the current file being
- viewed. The editor is taken from the environment
- variable VISUAL if defined, or EDITOR if VISUAL is
- not defined, or defaults to "vi" if neither VISUAL
- nor EDITOR is defined. See also the discussion of
+ v Invokes an editor to edit the current file being
+ viewed. The editor is taken from the environment
+ variable VISUAL if defined, or EDITOR if VISUAL is
+ not defined, or defaults to "vi" if neither VISUAL
+ nor EDITOR is defined. See also the discussion of
LESSEDIT under the section on PROMPTS below.
! shell-command
- Invokes a shell to run the shell-command given. A
- percent sign (%) in the command is replaced by the
- name of the 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 environ-
- ment variable SHELL, or defaults to "sh". On MS-
- DOS and OS/2 systems, the shell is the normal com-
+ Invokes a shell to run the shell-command given. A
+ percent sign (%) in the command is replaced by the
+ name of the 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 environ­
+ ment variable SHELL, or defaults to "sh". On MS-
+ DOS and OS/2 systems, the shell is the normal com­
mand processor.
| <m> shell-command
<m> represents any mark letter. Pipes a section of
- the input file to the given shell command. The
- section of the file to be piped is between the
- first line on the current screen and the position
- marked by the letter. <m> may also be ^ or $ to
+ the input file to the given shell command. The
+ section of the file to be piped is between the
+ first line on the current screen and the position
+ marked by the letter. <m> may also be ^ or $ to
indicate beginning or end of file respectively. If
<m> is . or newline, the current screen is piped.
s filename
- Save the input to a file. This only works if the
+ Save the input to a file. This only works if the
input is a pipe, not an ordinary file.
-OOPPTTIIOONNSS
- Command line options are described below. Most options
- may be changed while _l_e_s_s is running, via the "-" command.
-
- Most options may be given in one of two forms: either a
- dash followed by a single letter, or two dashes followed
- by a long option name. A long option name may be
- Version 358: 08 Jul 2000 8
+ Version 371: 26 Dec 2001 8
@@ -532,17 +532,24 @@ OOPPTTIIOONNSS
LESS(1) LESS(1)
- abbreviated as long as the abbreviation is unambiguous.
- For example, --quit-at-eof may be abbreviated --quit, but
- not --qui, since both --quit-at-eof and --quiet begin with
- --qui. Some long option names are in uppercase, such as
- --QUIT-AT-EOF, as distinct from --quit-at-eof. Such
- option names need only have their first letter capital-
- ized; the remainder of the name may be in either case.
+OOPPTTIIOONNSS
+ Command line options are described below. Most options
+ may be changed while _l_e_s_s is running, via the "-" command.
+
+ Most options may be given in one of two forms: either a
+ dash followed by a single letter, or two dashes followed
+ by a long option name. A long option name may be abbrevi­
+ ated as long as the abbreviation is unambiguous. For
+ example, --quit-at-eof may be abbreviated --quit, but not
+ --qui, since both --quit-at-eof and --quiet begin with
+ --qui. Some long option names are in uppercase, such as
+ --QUIT-AT-EOF, as distinct from --quit-at-eof. Such
+ option names need only have their first letter capital­
+ ized; the remainder of the name may be in either case.
For example, --Quit-at-eof is equivalent to --QUIT-AT-EOF.
- Options are also taken from the environment variable
- "LESS". For example, to avoid typing "less -options ..."
+ Options are also taken from the environment variable
+ "LESS". For example, to avoid typing "less -options ..."
each time _l_e_s_s is invoked, you might tell _c_s_h_:
setenv LESS "-options"
@@ -551,18 +558,18 @@ LESS(1) LESS(1)
LESS="-options"; export LESS
- On MS-DOS, you don't need the quotes, but you should
- replace any percent signs in the options string by double
+ On MS-DOS, you don't need the quotes, but you should
+ replace any percent signs in the options string by double
percent signs.
- The environment variable is parsed before the command
- line, so command line options override the LESS environ-
+ The environment variable is parsed before the command
+ line, so command line options override the LESS environ­
ment variable. If an option appears in the LESS variable,
- it can be reset to its default value on the command line
+ it can be reset to its default value on the command line
by beginning the command line option with "-+".
For options like -P or -D which take a following string, a
- dollar sign ($) must be used to signal the end of the
+ dollar sign ($) must be used to signal the end of the
string. For example, to set two -D options on MS-DOS, you
must have a dollar sign between them, like this:
@@ -570,26 +577,19 @@ LESS(1) LESS(1)
-? or --help
- This option displays a summary of the commands
- accepted by _l_e_s_s (the same as the h command).
- (Depending on how your shell interprets the ques-
- tion mark, it may be necessary to quote the ques-
+ This option displays a summary of the commands
+ accepted by _l_e_s_s (the same as the h command).
+ (Depending on how your shell interprets the ques­
+ tion mark, it may be necessary to quote the ques­
tion mark, thus: "-\?".)
-a or --search-skip-screen
- Causes searches to start after the last line dis-
- played on the screen, thus skipping all lines dis-
- played on the screen. By default, searches start
- at the second line on the screen (or after the last
- found line; see the -j option).
-
- -b_n or --buffers=_n
- Specifies the number of buffers _l_e_s_s will use for
- each file. Buffers are 1K, and by default 10
+ Causes searches to start after the last line dis­
+ played on the screen, thus skipping all lines
- Version 358: 08 Jul 2000 9
+ Version 371: 26 Dec 2001 9
@@ -598,26 +598,33 @@ LESS(1) LESS(1)
LESS(1) LESS(1)
- buffers are used for each file (except if the file
- is a pipe; see the -B option). The number _n speci-
+ displayed on the screen. By default, searches
+ start at the second line on the screen (or after
+ the last found line; see the -j option).
+
+ -b_n or --buffers=_n
+ Specifies the number of buffers _l_e_s_s will use for
+ each file. Buffers are 1K, and by default 10
+ buffers are used for each file (except if the file
+ is a pipe; see the -B option). The number _n speci­
fies a different number of buffers to use.
-B or --auto-buffers
- By default, when data is read from a pipe, buffers
- are allocated automatically as needed. If a large
- amount of data is read from the pipe, this can
- cause a large amount of memory to be allocated.
+ By default, when data is read from a pipe, buffers
+ are allocated automatically as needed. If a large
+ amount of data is read from the pipe, this can
+ cause a large amount of memory to be allocated.
The -B option disables this automatic allocation of
- buffers for pipes, so that only the number of
- buffers specified by the -b option are used. Warn-
- ing: use of -B can result in erroneous display,
- since only the most recently viewed part of the
+ buffers for pipes, so that only the number of
+ buffers specified by the -b option are used. Warn­
+ ing: use of -B can result in erroneous display,
+ since only the most recently viewed part of the
file is kept in memory; any earlier data is lost.
-c or --clear-screen
- Causes full screen repaints to be painted from the
- top line down. By default, full screen repaints
- are done by scrolling from the bottom of the
+ Causes full screen repaints to be painted from the
+ top line down. By default, full screen repaints
+ are done by scrolling from the bottom of the
screen.
-C or --CLEAR-SCREEN
@@ -626,102 +633,95 @@ LESS(1) LESS(1)
-d or --dumb
The -d option suppresses the error message normally
- displayed if the terminal is dumb; that is, lacks
- some important capability, such as the ability to
+ displayed if the terminal is dumb; that is, lacks
+ some important capability, such as the ability to
clear the screen or scroll backward. The -d option
does not otherwise change the behavior of _l_e_s_s on a
dumb terminal).
-Dxx_c_o_l_o_r or --color=xx_c_o_l_o_r
[MS-DOS only] Sets the color of the text displayed.
- xx is a single character which selects the type of
- text whose color is being set: n=normal, s=stand-
- out, d=bold, u=underlined, k=blink. _c_o_l_o_r is a
- pair of numbers separated by a period. The first
- number selects the foreground color and the second
+ xx is a single character which selects the type of
+ text whose color is being set: n=normal, s=stand­
+ out, d=bold, u=underlined, k=blink. _c_o_l_o_r is a
+ pair of numbers separated by a period. The first
+ number selects the foreground color and the second
selects the background color of the text. A single
number _N is the same as _N_._0.
-e or --quit-at-eof
- Causes _l_e_s_s to automatically exit the second time
- it reaches end-of-file. By default, the only way
- to exit _l_e_s_s is via the "q" command.
-
- -E or --QUIT-AT-EOF
- Causes _l_e_s_s to automatically exit the first time it
- reaches end-of-file.
+ Causes _l_e_s_s to automatically exit the second time
+ it reaches end-of-file. By default, the only way
+ Version 371: 26 Dec 2001 10
- Version 358: 08 Jul 2000 10
+LESS(1) LESS(1)
-LESS(1) LESS(1)
+ to exit _l_e_s_s is via the "q" command.
+ -E or --QUIT-AT-EOF
+ Causes _l_e_s_s to automatically exit the first time it
+ reaches end-of-file.
-f or --force
- Forces non-regular files to be opened. (A non-reg-
+ Forces non-regular files to be opened. (A non-reg­
ular file is a directory or a device special file.)
- Also suppresses the warning message when a binary
- file is opened. By default, _l_e_s_s will refuse to
+ Also suppresses the warning message when a binary
+ file is opened. By default, _l_e_s_s will refuse to
open non-regular files.
-F or --quit-if-one-screen
- Causes _l_e_s_s to automatically exit if the entire
+ Causes _l_e_s_s to automatically exit if the entire
file can be displayed on the first screen.
-g or --hilite-search
- Normally, _l_e_s_s will highlight ALL strings which
- match the last search command. The -g option
- changes this behavior to highlight only the partic-
- ular string which was found by the last search com-
- mand. This can cause _l_e_s_s to run somewhat faster
+ Normally, _l_e_s_s will highlight ALL strings which
+ match the last search command. The -g option
+ changes this behavior to highlight only the partic­
+ ular string which was found by the last search com­
+ mand. This can cause _l_e_s_s to run somewhat faster
than the default.
-G or --HILITE-SEARCH
- The -G option suppresses all highlighting of
+ The -G option suppresses all highlighting of
strings found by search commands.
-h_n or ---max-back-scroll=_n
- Specifies a maximum number of lines to scroll back-
- ward. If it is necessary to scroll backward more
- than _n lines, the screen is repainted in a forward
- direction instead. (If the terminal does not have
+ Specifies a maximum number of lines to scroll back­
+ ward. If it is necessary to scroll backward more
+ than _n lines, the screen is repainted in a forward
+ direction instead. (If the terminal does not have
the ability to scroll backward, -h0 is implied.)
-i or --ignore-case
- Causes searches to ignore case; that is, uppercase
- and lowercase are considered identical. This
- option is ignored if any uppercase letters appear
+ Causes searches to ignore case; that is, uppercase
+ and lowercase are considered identical. This
+ option is ignored if any uppercase letters appear
in the search pattern; in other words, if a pattern
- contains uppercase letters, then that search does
+ contains uppercase letters, then that search does
not ignore case.
-I or --IGNORE-CASE
- Like -i, but searches ignore case even if the pat-
+ Like -i, but searches ignore case even if the pat­
tern contains uppercase letters.
-j_n or --jump-target=_n
- Specifies a line on the screen where the "target"
- line is to be positioned. A target line is the
+ Specifies a line on the screen where the "target"
+ line is to be positioned. A target line is the
object of a text search, tag search, jump to a line
- number, jump to a file percentage, or jump to a
+ number, jump to a file percentage, or jump to a
marked position. The screen line is specified by a
- number: the top line on the screen is 1, the next
- is 2, and so on. The number may be negative to
- specify a line relative to the bottom of the
- screen: the bottom line on the screen is -1, the
- second to the bottom is -2, and so on. If the -j
- option is used, searches begin at the line
- Version 358: 08 Jul 2000 11
+ Version 371: 26 Dec 2001 11
@@ -730,20 +730,27 @@ LESS(1) LESS(1)
LESS(1) LESS(1)
- immediately 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.
+ number: the top line on the screen is 1, the next
+ is 2, and so on. The number may be negative to
+ specify a line relative to the bottom of the
+ screen: the bottom line on the screen is -1, the
+ second to the bottom is -2, and so on. If the -j
+ option is used, searches begin at the line immedi­
+ ately 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.
-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.
+ Displays a status column at the left edge of the
+ screen. The status column shows the lines that
+ matched the current search. The status column is
+ also used if the -w or -W option is in effect.
-k_f_i_l_e_n_a_m_e or --lesskey-file=_f_i_l_e_n_a_m_e
Causes _l_e_s_s to open and interpret the named file as
a _l_e_s_s_k_e_y (1) file. Multiple -k options may be
- specified. If the LESSKEY or LESSKEY_SYSTEM envi-
+ specified. If the LESSKEY or LESSKEY_SYSTEM envi­
ronment variable is set, or if a lesskey file is
found in a standard place (see KEY BINDINGS), it is
also used as a _l_e_s_s_k_e_y file.
@@ -769,7 +776,7 @@ LESS(1) LESS(1)
discussion of LESSEDIT in PROMPTS below).
-N or --LINE-NUMBERS
- Causes a line number to be displayed at the begin-
+ Causes a line number to be displayed at the begin­
ning of each line in the display.
-o_f_i_l_e_n_a_m_e or --log-file=_f_i_l_e_n_a_m_e
@@ -777,25 +784,25 @@ LESS(1) LESS(1)
it is being viewed. This applies only when the
input file is a pipe, not an ordinary file. If the
file already exists, _l_e_s_s will ask for confirmation
- before overwriting it.
- -O_f_i_l_e_n_a_m_e or --LOG-FILE=_f_i_l_e_n_a_m_e
- The -O option is like -o, but it will overwrite an
- existing file without asking for confirmation.
- If no log file has been specified, the -o and -O
+ Version 371: 26 Dec 2001 12
- Version 358: 08 Jul 2000 12
+LESS(1) LESS(1)
-LESS(1) LESS(1)
+ before overwriting it.
+ -O_f_i_l_e_n_a_m_e or --LOG-FILE=_f_i_l_e_n_a_m_e
+ The -O option is like -o, but it will overwrite an
+ existing file without asking for confirmation.
+ If no log file has been specified, the -o and -O
options can be used from within _l_e_s_s to specify a
log file. Without a file name, they will simply
report the name of the log file. The "s" command
@@ -818,19 +825,20 @@ LESS(1) LESS(1)
prompt to that string. -Pm changes the medium (-m)
prompt. -PM changes the long (-M) prompt. -Ph
changes the prompt for the help screen. -P=
- changes the message printed by the = command. All
- prompt strings consist of a sequence of letters and
- special escape sequences. See the section on
- PROMPTS for more details.
+ changes the message printed by the = command. -Pw
+ changes the message printed while waiting for data
+ (in the F command). All prompt strings consist of
+ a sequence of letters and special escape sequences.
+ See the section on PROMPTS for more details.
-q or --quiet or --silent
- Causes moderately "quiet" operation: the terminal
- bell is not rung if an attempt is made to scroll
+ Causes moderately "quiet" operation: the terminal
+ bell is not rung if an attempt is made to scroll
past the end of the file or before the beginning of
- the file. If the terminal has a "visual bell", it
- is used instead. The bell will be rung on certain
- other errors, such as typing an invalid character.
- The default is to ring the terminal bell in all
+ the file. If the terminal has a "visual bell", it
+ is used instead. The bell will be rung on certain
+ other errors, such as typing an invalid character.
+ The default is to ring the terminal bell in all
such cases.
-Q or --QUIET or --SILENT
@@ -838,22 +846,14 @@ LESS(1) LESS(1)
is never rung.
-r or --raw-control-chars
- Causes "raw" control characters to be displayed.
- The default is to display control characters using
+ Causes "raw" control characters to be displayed.
+ The default is to display control characters using
the caret notation; for example, a control-A (octal
- 001) is displayed as "^A". Warning: when the -r
- option is used, _l_e_s_s cannot keep track of the
- actual appearance of the screen (since this depends
- on how the screen responds to each type of control
- character). Thus, various display problems may
- result, such as long lines being split in the wrong
- place.
-
-
+ 001) is displayed as "^A". Warning: when the -r
- Version 358: 08 Jul 2000 13
+ Version 371: 26 Dec 2001 13
@@ -862,85 +862,98 @@ LESS(1) LESS(1)
LESS(1) LESS(1)
+ option is used, _l_e_s_s cannot keep track of the
+ actual appearance of the screen (since this depends
+ on how the screen responds to each type of control
+ character). Thus, various display problems may
+ result, such as long lines being split in the wrong
+ place.
+
-R or --RAW-CONTROL-CHARS
- Like -r, but tries to keep track of the screen
- appearance where possible. This works only if the
- input consists of normal text and possibly some
- ANSI "color" escape sequences, which are sequences
+ Like -r, but tries to keep track of the screen
+ appearance where possible. This works only if the
+ input consists of normal text and possibly some
+ ANSI "color" escape sequences, which are sequences
of the form:
ESC [ ... m
- where the "..." is zero or more characters other
- than "m". For the purpose of keeping track of
- screen appearance, all control characters and all
+ where the "..." is zero or more characters other
+ than "m". For the purpose of keeping track of
+ screen appearance, all control characters and all
ANSI color escape sequences are assumed to not move
- the cursor. You can make _l_e_s_s think that charac-
- ters other than "m" can end ANSI color escape
- sequences by setting the environment variable
- LESSANSIENDCHARS to the list of characters which
+ the cursor. You can make _l_e_s_s think that charac­
+ ters other than "m" can end ANSI color escape
+ sequences by setting the environment variable
+ LESSANSIENDCHARS to the list of characters which
can end a color escape sequence.
-s or --squeeze-blank-lines
- Causes consecutive blank lines to be squeezed into
- a single blank line. This is useful when viewing
+ Causes consecutive blank lines to be squeezed into
+ a single blank line. This is useful when viewing
_n_r_o_f_f output.
-S or --chop-long-lines
- Causes lines longer than the screen width to be
+ Causes lines longer than the screen width to be
chopped rather than folded. That is, the remainder
of a long line is simply discarded. The default is
- to fold long lines; that is, display the remainder
+ to fold long lines; that is, display the remainder
on the next line.
-t_t_a_g or --tag=_t_a_g
- The -t option, followed immediately by a TAG, will
- edit the file containing that tag. For this to
- work, there must be a file called "tags" in the
- current directory, which was previously built by
- the _c_t_a_g_s (1) command. This option may also be
- specified from within _l_e_s_s (using the - command) as
- a way of examining a new file. The command ":t" is
- equivalent to specifying -t from within _l_e_s_s_.
+ The -t option, followed immediately by a TAG, will
+ edit the file containing that tag. For this to
+ work, tag information must be available; for exam­
+ ple, there may be a file in the current directory
+ called "tags", which was previously built by _c_t_a_g_s
+ (1) or an equivalent command. If the environment
+ variable LESSGLOBALTAGS is set, it is taken to be
+ the name of a command compatible with _g_l_o_b_a_l (1),
+ and that command is executed to find the tag. (See
+ http://www.gnu.org/software/global/global.html).
+ The -t option may also be specified from within
+ _l_e_s_s (using the - command) as a way of examining a
+ new file. The command ":t" is equivalent to speci­
+ fying -t from within _l_e_s_s_.
- -T_t_a_g_s_f_i_l_e or --tag-file=_t_a_g_s_f_i_l_e
- Specifies a tags file to be used instead of "tags".
- -u or --underline-special
- Causes backspaces and carriage returns to be
- treated as printable characters; that is, they are
- sent to the terminal when they appear in the input.
- -U or --UNDERLINE-SPECIAL
- Causes backspaces, tabs and carriage returns to be
- treated as control characters; that is, they are
- handled as specified by the -r option.
+ Version 371: 26 Dec 2001 14
- Version 358: 08 Jul 2000 14
+LESS(1) LESS(1)
+ -T_t_a_g_s_f_i_l_e or --tag-file=_t_a_g_s_f_i_l_e
+ Specifies a tags file to be used instead of "tags".
-LESS(1) LESS(1)
+ -u or --underline-special
+ Causes backspaces and carriage returns to be
+ treated as printable characters; that is, they are
+ sent to the terminal when they appear in the input.
+ -U or --UNDERLINE-SPECIAL
+ Causes backspaces, tabs and carriage returns to be
+ treated as control characters; that is, they are
+ handled as specified by the -r option.
- By default, if neither -u nor -U is given,
- backspaces which appear adjacent to an underscore
- character are treated specially: the underlined
- text is displayed using the terminal's hardware
+ By default, if neither -u nor -U is given,
+ backspaces which appear adjacent to an underscore
+ character are treated specially: the underlined
+ text is displayed using the terminal's hardware
underlining capability. Also, backspaces which
appear between two identical characters are treated
specially: the overstruck text is printed using the
terminal's hardware boldface capability. Other
- backspaces are deleted, along with the preceding
- character. Carriage returns immediately followed
- by a newline are deleted. other carriage returns
- are handled as specified by the -r option. Text
- which is overstruck or underlined can be searched
+ backspaces are deleted, along with the preceding
+ character. Carriage returns immediately followed
+ by a newline are deleted. other carriage returns
+ are handled as specified by the -r option. Text
+ which is overstruck or underlined can be searched
for if neither -u nor -U is in effect.
-V or --version
@@ -948,135 +961,145 @@ LESS(1) LESS(1)
-w or --hilite-unread
Temporarily highlights the first "new" line after a
- forward movement of a full page. The first "new"
- line is the line immediately following the line
- previously at the bottom of the screen. Also high-
+ forward movement of a full page. The first "new"
+ line is the line immediately following the line
+ previously at the bottom of the screen. Also high­
lights 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
+ 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.
-W or --HILITE-UNREAD
- Like -w, but temporarily highlights the first new
+ Like -w, but temporarily highlights the first new
line after any forward movement command larger than
one line.
- -x_n or --tabs=_n
- Sets tab stops every _n positions. The default for
- _n is 8.
+ -x_n,... or --tabs=_n,...
+ Sets tab stops. If only one _n is specified, tab
+ stops are set at multiples of _n. If multiple val­
+ ues separated by commas are specified, tab stops
+ are set at those positions, and then continue with
+ the same spacing as the last two. For example,
+ _-_x_9_,_1_7 will set tabs at positions 9, 17, 25, 33,
- -X or --no-init
- Disables sending the termcap initialization and
- deinitialization strings to the terminal. This is
- sometimes desirable if the deinitialization string
- does something unnecessary, like clearing the
- screen.
- -y_n or --max-forw-scroll=_n
- Specifies a maximum number of lines to scroll for-
- ward. If it is necessary to scroll forward more
- than _n lines, the screen is repainted instead. The
- -c or -C option may be used to repaint from the top
- of the screen if desired. By default, any forward
- movement causes scrolling.
+ Version 371: 26 Dec 2001 15
- Version 358: 08 Jul 2000 15
+LESS(1) LESS(1)
+ etc. The default for _n is 8.
+ -X or --no-init
+ Disables sending the termcap initialization and
+ deinitialization strings to the terminal. This is
+ sometimes desirable if the deinitialization string
+ does something unnecessary, like clearing the
+ screen.
-LESS(1) LESS(1)
+ --no-keypad
+ Disables sending the keypad initialization and
+ deinitialization strings to the terminal. This is
+ sometimes useful if the keypad strings make the
+ numeric keypad behave in an undesirable manner.
+ -y_n or --max-forw-scroll=_n
+ Specifies a maximum number of lines to scroll for­
+ ward. If it is necessary to scroll forward more
+ than _n lines, the screen is repainted instead. The
+ -c or -C option may be used to repaint from the top
+ of the screen if desired. By default, any forward
+ movement causes scrolling.
-[z]_n or --window=_n
- Changes the default scrolling window size to _n
- lines. The default is one screenful. The z and w
- commands can also be used to change the window
- size. The "z" may be omitted for compatibility
- with _m_o_r_e_. If the number _n is negative, it indi-
- cates _n lines less than the current screen size.
- For example, if the screen is 24 lines, _-_z_-_4 sets
+ Changes the default scrolling window size to _n
+ lines. The default is one screenful. The z and w
+ commands can also be used to change the window
+ size. The "z" may be omitted for compatibility
+ with _m_o_r_e_. If the number _n is negative, it indi­
+ cates _n lines less than the current screen size.
+ For example, if the screen is 24 lines, _-_z_-_4 sets
the scrolling window to 20 lines. If the screen is
- resized to 40 lines, the scrolling window automati-
+ resized to 40 lines, the scrolling window automati­
cally changes to 36 lines.
-"_c_c or --quotes=_c_c
- Changes the filename quoting character. This may
+ Changes the filename quoting character. This may
be necessary if you are trying to name a file which
- contains both spaces and quote characters. Fol-
+ contains both spaces and quote characters. Fol­
lowed by a single character, this changes the quote
- character to that character. Filenames containing
+ character to that character. Filenames containing
a space should then be surrounded by that character
- rather than by double quotes. Followed by two
- characters, changes the open quote to the first
- character, and the close quote to the second char-
+ rather than by double quotes. Followed by two
+ characters, changes the open quote to the first
+ character, and the close quote to the second char­
acter. Filenames containing a space should then be
- preceded by the open quote character and followed
+ preceded by the open quote character and followed
by the close quote character. Note that even after
the quote characters are changed, this option
remains -" (a dash followed by a double quote).
-~ 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.
+ single tilde (~). This option causes lines after
- -# or --shift
- Specifies the default number of positions to scroll
- horizontally in the RIGHTARROW and LEFTARROW com-
- mands. If the number specified is zero, it sets
- the default number of positions to one half of the
- screen width.
- -- A command line argument of "--" marks the end of
- option arguments. Any arguments following this are
- interpreted as filenames. This can be useful when
- viewing a file whose name begins with a "-" or "+".
- + If a command line option begins with ++, the remain-
- der of that option is taken to be an initial com-
- mand to _l_e_s_s_. For example, +G tells _l_e_s_s to start
- at the end of the file rather than the beginning,
- and +/xyz tells it to start at the first occurrence
- of "xyz" in the file. As a special case, +<number>
- acts like +<number>g; that is, it starts the dis-
- play at the specified line number (however, see the
- caveat under the "g" command above). If the option
+ Version 371: 26 Dec 2001 16
- Version 358: 08 Jul 2000 16
+LESS(1) LESS(1)
+ end of file to be displayed as blank lines.
-LESS(1) LESS(1)
+ -# or --shift
+ Specifies the default number of positions to scroll
+ horizontally in the RIGHTARROW and LEFTARROW com­
+ mands. If the number specified is zero, it sets
+ the default number of positions to one half of the
+ screen width.
+ -- A command line argument of "--" marks the end of
+ option arguments. Any arguments following this are
+ interpreted as filenames. This can be useful when
+ viewing a file whose name begins with a "-" or "+".
- starts with ++, the initial command applies to
- every file being viewed, not just the first one.
+ + If a command line option begins with ++, the remain­
+ der of that option is taken to be an initial com­
+ mand to _l_e_s_s_. For example, +G tells _l_e_s_s to start
+ at the end of the file rather than the beginning,
+ and +/xyz tells it to start at the first occurrence
+ of "xyz" in the file. As a special case, +<number>
+ acts like +<number>g; that is, it starts the dis­
+ play at the specified line number (however, see the
+ caveat under the "g" command above). If the option
+ starts with ++, the initial command applies to
+ every file being viewed, not just the first one.
The + command described previously may also be used
- to set (or change) an initial command for every
+ to set (or change) an initial command for every
file.
LLIINNEE EEDDIITTIINNGG
- When entering command line at the bottom of the screen
- (for example, a filename for the :e command, or the pat-
- tern for a search command), certain keys can be used to
- manipulate the command line. Most commands have an alter-
- nate form in [ brackets ] which can be used if a key does
- not exist on a particular keyboard. (The bracketed forms
- do not work in the MS-DOS version.) Any of these special
- keys may be entered literally by preceding it with the
- "literal" character, either ^V or ^A. A backslash itself
+ When entering command line at the bottom of the screen
+ (for example, a filename for the :e command, or the pat­
+ tern for a search command), certain keys can be used to
+ manipulate the command line. Most commands have an alter­
+ nate form in [ brackets ] which can be used if a key does
+ not exist on a particular keyboard. (The bracketed forms
+ do not work in the MS-DOS version.) Any of these special
+ keys may be entered literally by preceding it with the
+ "literal" character, either ^V or ^A. A backslash itself
may also be entered literally by entering two backslashes.
LEFTARROW [ ESC-h ]
@@ -1086,11 +1109,23 @@ LLIINNEE EEDDIITTIINNGG
Move the cursor one space to the right.
^LEFTARROW [ ESC-b or ESC-LEFTARROW ]
- (That is, CONTROL and LEFTARROW simultaneously.)
+ (That is, CONTROL and LEFTARROW simultaneously.)
Move the cursor one word to the left.
^RIGHTARROW [ ESC-w or ESC-RIGHTARROW ]
- (That is, CONTROL and RIGHTARROW simultaneously.)
+ (That is, CONTROL and RIGHTARROW simultaneously.)
+
+
+
+ Version 371: 26 Dec 2001 17
+
+
+
+
+
+LESS(1) LESS(1)
+
+
Move the cursor one word to the right.
HOME [ ESC-0 ]
@@ -1100,90 +1135,55 @@ LLIINNEE EEDDIITTIINNGG
Move the cursor to the end of the line.
BACKSPACE
- Delete the character to the left of the cursor, or
+ Delete the character to the left of the cursor, or
cancel the command if the command line is empty.
DELETE or [ ESC-x ]
Delete the character under the cursor.
^BACKSPACE [ ESC-BACKSPACE ]
- (That is, CONTROL and BACKSPACE simultaneously.)
+ (That is, CONTROL and BACKSPACE simultaneously.)
Delete the word to the left of the cursor.
^DELETE [ ESC-X or ESC-DELETE ]
- (That is, CONTROL and DELETE simultaneously.)
+ (That is, CONTROL and DELETE simultaneously.)
Delete the word under the cursor.
-
-
-
- Version 358: 08 Jul 2000 17
-
-
-
-
-
-LESS(1) LESS(1)
-
-
UPARROW [ ESC-k ]
Retrieve the previous command line.
DOWNARROW [ ESC-j ]
Retrieve the next command line.
- TAB Complete the partial filename to the left of the
- cursor. If it matches more than one filename, the
- first match is entered into the command line.
- Repeated TABs will cycle thru the other matching
- filenames. If the completed filename is a direc-
- tory, a "/" is appended to the filename. (On MS-
- DOS systems, a "\" is appended.) The environment
- variable LESSSEPARATOR can be used to specify a
- different character to append to a directory name.
+ TAB Complete the partial filename to the left of the
+ cursor. If it matches more than one filename, the
+ first match is entered into the command line.
+ Repeated TABs will cycle thru the other matching
+ filenames. If the completed filename is a direc­
+ tory, a "/" is appended to the filename. (On MS-
+ DOS systems, a "\" is appended.) The environment
+ variable LESSSEPARATOR can be used to specify a
+ different character to append to a directory name.
BACKTAB [ ESC-TAB ]
Like, TAB, but cycles in the reverse direction thru
the matching filenames.
- ^L Complete the partial filename to the left of the
- cursor. If it matches more than one filename, all
- matches are entered into the command line (if they
+ ^L Complete the partial filename to the left of the
+ cursor. If it matches more than one filename, all
+ matches are entered into the command line (if they
fit).
- ^U (Unix) or ESC (MS-DOS)
- Delete the entire command line, or cancel the com-
- mand if the command line is empty. If you have
- changed your line-kill character in Unix to some-
+ ^U (Unix and OS/2) or ESC (MS-DOS)
+ Delete the entire command line, or cancel the com­
+ mand if the command line is empty. If you have
+ changed your line-kill character in Unix to some­
thing other than ^U, that character is used instead
of ^U.
-KKEEYY BBIINNDDIINNGGSS
- You may define your own _l_e_s_s commands by using the program
- _l_e_s_s_k_e_y (1) to create a lesskey file. This file specifies
- a set of command keys and an action associated with each
- key. You may also use _l_e_s_s_k_e_y to change the line-editing
- keys (see LINE EDITING), and to set environment variables.
- If the environment variable LESSKEY is set, _l_e_s_s uses that
- as the name of the lesskey file. Otherwise, _l_e_s_s looks in
- a standard place for the lesskey file: On Unix systems,
- _l_e_s_s looks for a lesskey file called "$HOME/.less". On
- MS-DOS and Windows systems, _l_e_s_s looks for a lesskey file
- called "$HOME/_less", and if it is not found there, then
- looks for a lesskey file called "_less" in any directory
- specified in the PATH environment variable. On OS/2 sys-
- tems, _l_e_s_s looks for a lesskey file called
- "$HOME/less.ini", and if it is not found, then looks for a
- lesskey file called "less.ini" in any directory specified
- in the INIT environment variable, and if it not found
- there, then looks for a lesskey file called "less.ini" in
- any directory specified in the PATH environment variable.
- See the _l_e_s_s_k_e_y manual page for more details.
-
-
- Version 358: 08 Jul 2000 18
+ Version 371: 26 Dec 2001 18
@@ -1192,64 +1192,64 @@ KKEEYY BBIINNDDIINNGGSS
LESS(1) LESS(1)
- A system-wide lesskey file may also be set up to provide
+KKEEYY BBIINNDDIINNGGSS
+ You may define your own _l_e_s_s commands by using the program
+ _l_e_s_s_k_e_y (1) to create a lesskey file. This file specifies
+ a set of command keys and an action associated with each
+ key. You may also use _l_e_s_s_k_e_y to change the line-editing
+ keys (see LINE EDITING), and to set environment variables.
+ If the environment variable LESSKEY is set, _l_e_s_s uses that
+ as the name of the lesskey file. Otherwise, _l_e_s_s looks in
+ a standard place for the lesskey file: On Unix systems,
+ _l_e_s_s looks for a lesskey file called "$HOME/.less". On
+ MS-DOS and Windows systems, _l_e_s_s looks for a lesskey file
+ called "$HOME/_less", and if it is not found there, then
+ looks for a lesskey file called "_less" in any directory
+ specified in the PATH environment variable. On OS/2 sys­
+ tems, _l_e_s_s looks for a lesskey file called
+ "$HOME/less.ini", and if it is not found, then looks for a
+ lesskey file called "less.ini" in any directory specified
+ in the INIT environment variable, and if it not found
+ there, then looks for a lesskey file called "less.ini" in
+ any directory specified in the PATH environment variable.
+ See the _l_e_s_s_k_e_y manual page for more details.
+
+ A system-wide lesskey file may also be set up to provide
key bindings. If a key is defined in both a local lesskey
- file and in the system-wide file, key bindings in the
- local file take precedence over those in the system-wide
- file. If the environment variable LESSKEY_SYSTEM is set,
- _l_e_s_s uses that as the name of the system-wide lesskey
- file. Otherwise, _l_e_s_s looks in a standard place for the
+ file and in the system-wide file, key bindings in the
+ local file take precedence over those in the system-wide
+ file. If the environment variable LESSKEY_SYSTEM is set,
+ _l_e_s_s uses that as the name of the system-wide lesskey
+ file. Otherwise, _l_e_s_s looks in a standard place for the
system-wide lesskey file: On Unix systems, the system-wide
- lesskey file is /usr/local/bin/.sysless. (However, if
- _l_e_s_s was built with a different binary directory than
- /usr/local/bin, that directory is where the .sysless file
+ lesskey file is /usr/local/etc/sysless. (However, if _l_e_s_s
+ was built with a different sysconf directory than
+ /usr/local/etc, that directory is where the sysless file
is found.) On MS-DOS and Windows systems, the system-wide
lesskey file is c:\_sysless. On OS/2 systems, the system-
wide lesskey file is c:\sysless.ini.
IINNPPUUTT PPRREEPPRROOCCEESSSSOORR
- You may define an "input preprocessor" for _l_e_s_s_. Before
- _l_e_s_s opens a file, it first gives your input preprocessor
- a chance to modify the way the contents of the file are
- displayed. An input preprocessor is simply an executable
- program (or shell script), which writes the contents of
+ You may define an "input preprocessor" for _l_e_s_s_. Before
+ _l_e_s_s opens a file, it first gives your input preprocessor
+ a chance to modify the way the contents of the file are
+ displayed. An input preprocessor is simply an executable
+ program (or shell script), which writes the contents of
the file to a different file, called the replacement file.
The contents of the replacement file are then displayed in
- place of the contents of the original file. However, it
+ place of the contents of the original file. However, it
will appear to the user as if the original file is opened;
- that is, _l_e_s_s will display the original filename as the
+ that is, _l_e_s_s will display the original filename as the
name of the current file.
- An input preprocessor receives one command line argument,
- the original filename, as entered by the user. It should
- create the replacement file, and when finished, print the
- name of the replacement file to its standard output. If
- the input preprocessor does not output a replacement file-
- name, _l_e_s_s uses the original file, as normal. The input
- preprocessor is not called when viewing standard input.
- To set up an input preprocessor, set the LESSOPEN environ-
- ment variable to a command line which will invoke your
- input preprocessor. This command line should include one
- occurrence of the string "%s", which will be replaced by
- the filename when the input preprocessor command is
- invoked.
-
- When _l_e_s_s closes a file opened in such a way, it will call
- another program, called the input postprocessor, which may
- perform any desired clean-up action (such as deleting the
- replacement file created by LESSOPEN). This program
- receives two command line arguments, the original filename
- as entered by the user, and the name of the replacement
- file. To set up an input postprocessor, set the LESSCLOSE
- environment variable to a command line which will invoke
- your input postprocessor. It may include two occurrences
- of the string "%s"; the first is replaced with the origi-
- nal name of the file and the second with the name of the
+ An input preprocessor receives one command line argument,
+ the original filename, as entered by the user. It should
+ create the replacement file, and when finished, print the
- Version 358: 08 Jul 2000 19
+ Version 371: 26 Dec 2001 19
@@ -1258,10 +1258,32 @@ IINNPPUUTT PPRREEPPRROOCCEESSSSOORR
LESS(1) LESS(1)
+ name of the replacement file to its standard output. If
+ the input preprocessor does not output a replacement file­
+ name, _l_e_s_s uses the original file, as normal. The input
+ preprocessor is not called when viewing standard input.
+ To set up an input preprocessor, set the LESSOPEN environ­
+ ment variable to a command line which will invoke your
+ input preprocessor. This command line should include one
+ occurrence of the string "%s", which will be replaced by
+ the filename when the input preprocessor command is
+ invoked.
+
+ When _l_e_s_s closes a file opened in such a way, it will call
+ another program, called the input postprocessor, which may
+ perform any desired clean-up action (such as deleting the
+ replacement file created by LESSOPEN). This program
+ receives two command line arguments, the original filename
+ as entered by the user, and the name of the replacement
+ file. To set up an input postprocessor, set the LESSCLOSE
+ environment variable to a command line which will invoke
+ your input postprocessor. It may include two occurrences
+ of the string "%s"; the first is replaced with the origi­
+ nal name of the file and the second with the name of the
replacement file, which was output by LESSOPEN.
- For example, on many Unix systems, these two scripts will
- allow you to keep files in compressed format, but still
+ For example, on many Unix systems, these two scripts will
+ allow you to keep files in compressed format, but still
let _l_e_s_s view them directly:
lessopen.sh:
@@ -1280,54 +1302,54 @@ LESS(1) LESS(1)
#! /bin/sh
rm $2
- To use these scripts, put them both where they can be exe-
- cuted and set LESSOPEN="lessopen.sh %s", and
+ To use these scripts, put them both where they can be exe­
+ cuted and set LESSOPEN="lessopen.sh %s", and
LESSCLOSE="lessclose.sh %s %s". More complex LESSOPEN and
- LESSCLOSE scripts may be written to accept other types of
+ LESSCLOSE scripts may be written to accept other types of
compressed files, and so on.
- It is also possible to set up an input preprocessor to
- pipe the file data directly to _l_e_s_s_, rather than putting
+ It is also possible to set up an input preprocessor to
+ pipe the file data directly to _l_e_s_s_, rather than putting
the data into a replacement file. This avoids the need to
decompress the entire file before starting to view it. An
- input preprocessor that works this way is called an input
- pipe. An input pipe, instead of writing the name of a
- replacement file on its standard output, writes the entire
- contents of the replacement file on its standard output.
- If the input pipe does not write any characters on its
- standard output, then there is no replacement file and
- _l_e_s_s uses the original file, as normal. To use an input
- pipe, make the first character in the LESSOPEN environment
- variable a vertical bar (|) to signify that the input pre-
- processor is an input pipe.
- For example, on many Unix systems, this script will work
- like the previous example scripts:
- lesspipe.sh:
- #! /bin/sh
- case "$1" in
- *.Z) uncompress -c $1 2>/dev/null
- ;;
- esac
- To use this script, put it where it can be executed and
+ Version 371: 26 Dec 2001 20
- Version 358: 08 Jul 2000 20
+LESS(1) LESS(1)
+ input preprocessor that works this way is called an input
+ pipe. An input pipe, instead of writing the name of a
+ replacement file on its standard output, writes the entire
+ contents of the replacement file on its standard output.
+ If the input pipe does not write any characters on its
+ standard output, then there is no replacement file and
+ _l_e_s_s uses the original file, as normal. To use an input
+ pipe, make the first character in the LESSOPEN environment
+ variable a vertical bar (|) to signify that the input pre­
+ processor is an input pipe.
-LESS(1) LESS(1)
+ For example, on many Unix systems, this script will work
+ like the previous example scripts:
+ lesspipe.sh:
+ #! /bin/sh
+ case "$1" in
+ *.Z) uncompress -c $1 2>/dev/null
+ ;;
+ esac
- set LESSOPEN="|lesspipe.sh %s". When an input pipe is
- used, a LESSCLOSE postprocessor can be used, but it is
- usually not necessary since there is no replacement file
- to clean up. In this case, the replacement file name
+ To use this script, put it where it can be executed and
+ set LESSOPEN="|lesspipe.sh %s". When an input pipe is
+ used, a LESSCLOSE postprocessor can be used, but it is
+ usually not necessary since there is no replacement file
+ to clean up. In this case, the replacement file name
passed to the LESSCLOSE postprocessor is "-".
@@ -1338,7 +1360,7 @@ NNAATTIIOONNAALL CCHHAARRAACCTTEERR SSEETTSS
can be displayed directly to the screen.
control characters
- should not be displayed directly, but are expected
+ should not be displayed directly, but are expected
to be found in ordinary text files (such as
backspace and tab).
@@ -1346,135 +1368,160 @@ NNAATTIIOONNAALL CCHHAARRAACCTTEERR SSEETTSS
should not be displayed directly and are not
expected to be found in text files.
- A "character set" is simply a description of which charac-
- ters are to be considered normal, control, and binary.
+ A "character set" is simply a description of which charac­
+ ters are to be considered normal, control, and binary.
The LESSCHARSET environment variable may be used to select
a character set. Possible values for LESSCHARSET are:
- ascii BS, TAB, NL, CR, and formfeed are control charac-
- ters, all chars with values between 32 and 126 are
+ ascii BS, TAB, NL, CR, and formfeed are control charac­
+ ters, all chars with values between 32 and 126 are
normal, and all others are binary.
- iso8859
- Selects an ISO 8859 character set. This is the
- same as ASCII, except characters between 160 and
- 255 are treated as normal characters.
- latin1 Same as iso8859.
- dos Selects a character set appropriate for MS-DOS.
- ebcdic Selects an EBCDIC character set.
- koi8-r Selects a Russian character set.
+ Version 371: 26 Dec 2001 21
+
+
- next Selects a character set appropriate for NeXT com-
- puters.
- utf-8 Selects the UTF-8 encoding of the ISO 10646 charac-
- ter set.
- If the LESSCHARSET environment variable is not set, the
- default character set is latin1. However, if the string
- "UTF-8" is found in the LC_ALL, LC_CTYPE or LANG environ-
- ment variables, then the default character set is utf-8
+LESS(1) LESS(1)
+ iso8859
+ Selects an ISO 8859 character set. This is the
+ same as ASCII, except characters between 160 and
+ 255 are treated as normal characters.
- Version 358: 08 Jul 2000 21
+ latin1 Same as iso8859.
+ latin9 Same as iso8859.
+ dos Selects a character set appropriate for MS-DOS.
+ ebcdic Selects an EBCDIC character set.
+ IBM-1047
+ Selects an EBCDIC character set used by OS/390 Unix
+ Services. This is the EBCDIC analogue of latin1.
+ You get similar results by setting either LESS­
+ CHARSET=IBM-1047 or LC_CTYPE=en_US in your environ­
+ ment.
-LESS(1) LESS(1)
+ koi8-r Selects a Russian character set.
+ next Selects a character set appropriate for NeXT com­
+ puters.
- instead.
+ utf-8 Selects the UTF-8 encoding of the ISO 10646 charac­
+ ter set.
- In special cases, it may be desired to tailor _l_e_s_s to use
- a character set other than the ones definable by LESS-
- CHARSET. In this case, the environment variable LESS-
- CHARDEF can be used to define a character set. It should
- be set to a string where each character in the string rep-
+ In special cases, it may be desired to tailor _l_e_s_s to use
+ a character set other than the ones definable by LESS­
+ CHARSET. In this case, the environment variable LESS­
+ CHARDEF can be used to define a character set. It should
+ be set to a string where each character in the string rep­
resents one character in the character set. The character
- "." is used for a normal character, "c" for control, and
- "b" for binary. A decimal number may be used for repeti-
- tion. For example, "bccc4b." would mean character 0 is
- binary, 1, 2 and 3 are control, 4, 5, 6 and 7 are binary,
- and 8 is normal. All characters after the last are taken
- to be the same as the last, so characters 9 through 255
- would be normal. (This is an example, and does not neces-
+ "." is used for a normal character, "c" for control, and
+ "b" for binary. A decimal number may be used for repeti­
+ tion. For example, "bccc4b." would mean character 0 is
+ binary, 1, 2 and 3 are control, 4, 5, 6 and 7 are binary,
+ and 8 is normal. All characters after the last are taken
+ to be the same as the last, so characters 9 through 255
+ would be normal. (This is an example, and does not neces­
sarily represent any real character set.)
- This table shows the value of LESSCHARDEF which is equiva-
+ This table shows the value of LESSCHARDEF which is equiva­
lent to each of the possible values for LESSCHARSET:
ascii 8bcccbcc18b95.b
dos 8bcccbcc12bc5b95.b.
ebcdic 5bc6bcc7bcc41b.9b7.9b5.b..8b6.10b6.b9.7b
9.8b8.17b3.3b9.7b9.8b8.6b10.b.b.b.
+ IBM-1047 4cbcbc3b9cbccbccbb4c6bcc5b3cbbc4bc4bccbc
+ 191.b
iso8859 8bcccbcc18b95.33b.
koi8-r 8bcccbcc18b95.b128.
+
+
+
+ Version 371: 26 Dec 2001 22
+
+
+
+
+
+LESS(1) LESS(1)
+
+
latin1 8bcccbcc18b95.33b.
next 8bcccbcc18b95.bb125.bb
- If neither LESSCHARSET nor LESSCHARDEF is set, but your
- system supports the _s_e_t_l_o_c_a_l_e interface, _l_e_s_s will use
- setlocale to determine the character set. setlocale is
- controlled by setting the LANG or LC_CTYPE environment
- variables.
+ If neither LESSCHARSET nor LESSCHARDEF is set, but the
+ string "UTF-8" is found in the LC_ALL, LC_TYPE or LANG
+ environment variables, then the default character set is
+ utf-8.
- Control and binary characters are displayed in standout
- (reverse video). Each such character is displayed in
+ If that string is not found, but your system supports the
+ _s_e_t_l_o_c_a_l_e interface, _l_e_s_s will use setlocale to determine
+ the character set. setlocale is controlled by setting the
+ LANG or LC_CTYPE environment variables.
+
+ Finally, if the _s_e_t_l_o_c_a_l_e interface is also not available,
+ the default character set is latin1.
+
+ Control and binary characters are displayed in standout
+ (reverse video). Each such character is displayed in
caret notation if possible (e.g. ^A for control-A). Caret
notation is used only if inverting the 0100 bit results in
a normal printable character. Otherwise, the character is
- displayed as a hex number in angle brackets. This format
- can be changed by setting the LESSBINFMT environment vari-
- able. LESSBINFMT may begin with a "*" and one character
+ displayed as a hex number in angle brackets. This format
+ can be changed by setting the LESSBINFMT environment vari­
+ able. LESSBINFMT may begin with a "*" and one character
to select the display attribute: "*k" is blinking, "*d" is
- bold, "*u" is underlined, "*s" is standout, and "*n" is
- normal. If LESSBINFMT does not begin with a "*", normal
- attribute is assumed. The remainder of LESSBINFMT is a
- string which may include one printf-style escape sequence
- (a % followed by x, X, o, d, etc.). For example, if LESS-
- BINFMT is "*u[%x]", binary characters are displayed in
- underlined hexadecimal surrounded by brackets. The
+ bold, "*u" is underlined, "*s" is standout, and "*n" is
+ normal. If LESSBINFMT does not begin with a "*", normal
+ attribute is assumed. The remainder of LESSBINFMT is a
+ string which may include one printf-style escape sequence
+ (a % followed by x, X, o, d, etc.). For example, if LESS­
+ BINFMT is "*u[%x]", binary characters are displayed in
+ underlined hexadecimal surrounded by brackets. The
default if no LESSBINFMT is specified is "*s<%X>".
+PPRROOMMPPTTSS
+ The -P option allows you to tailor the prompt to your
+ preference. The string given to the -P option replaces
+ the specified prompt string. Certain characters in the
+ string are interpreted specially. The prompt mechanism is
+ rather complicated to provide flexibility, but the ordi­
+ nary user need not understand the details of constructing
+ personalized prompt strings.
+ A percent sign followed by a single character is expanded
+ according to what the following character is:
+ %b_X Replaced by the byte offset into the current input
+ file. The b is followed by a single character
+ (shown as _X above) which specifies the line whose
+ byte offset is to be used. If the character is a
+ "t", the byte offset of the top line in the display
+ is used, an "m" means use the middle line, a "b"
+ means use the bottom line, a "B" means use the line
- Version 358: 08 Jul 2000 22
+ Version 371: 26 Dec 2001 23
-LESS(1) LESS(1)
-PPRROOMMPPTTSS
- The -P option allows you to tailor the prompt to your
- preference. The string given to the -P option replaces
- the specified prompt string. Certain characters in the
- string are interpreted specially. The prompt mechanism is
- rather complicated to provide flexibility, but the ordi-
- nary user need not understand the details of constructing
- personalized prompt strings.
+LESS(1) LESS(1)
- A percent sign followed by a single character is expanded
- according to what the following character is:
- %b_X Replaced by the byte offset into the current input
- file. The b is followed by a single character
- (shown as _X above) which specifies the line whose
- byte offset is to be used. If the character is a
- "t", the byte offset of the top line in the display
- is used, an "m" means use the middle line, a "b"
- means use the bottom line, a "B" means use the line
just after the bottom line, and a "j" means use the
"target" line, as specified by the -j option.
@@ -1483,26 +1530,26 @@ PPRROOMMPPTTSS
%c Replaced by the column number of the text appearing
in the first column of the screen.
- %d_X Replaced by the page number of a line in the input
- file. The line to be used is determined by the _X,
+ %d_X Replaced by the page number of a line in the input
+ file. The line to be used is determined by the _X,
as with the %b option.
- %D Replaced by the number of pages in the input file,
- or equivalently, the page number of the last line
+ %D Replaced by the number of pages in the input file,
+ or equivalently, the page number of the last line
in the input file.
%E Replaced by the name of the editor (from the VISUAL
- environment variable, or the EDITOR environment
- variable if VISUAL is not defined). See the dis-
+ environment variable, or the EDITOR environment
+ variable if VISUAL is not defined). See the dis­
cussion of the LESSEDIT feature below.
%f Replaced by the name of the current input file.
- %i Replaced by the index of the current file in the
+ %i Replaced by the index of the current file in the
list of input files.
- %l_X Replaced by the line number of a line in the input
- file. The line to be used is determined by the _X,
+ %l_X Replaced by the line number of a line in the input
+ file. The line to be used is determined by the _X,
as with the %b option.
%L Replaced by the line number of the last line in the
@@ -1510,56 +1557,55 @@ PPRROOMMPPTTSS
%m Replaced by the total number of input files.
+ %p_X Replaced by the percent into the current input
+ file, based on byte offsets. The line used is
+ determined by the _X as with the %b option.
+ %P_X Replaced by the percent into the current input
+ file, based on line numbers. The line used is
+ determined by the _X as with the %b option.
+ %s Same as %B.
- Version 358: 08 Jul 2000 23
+ %t Causes any trailing spaces to be removed. Usually
+ used at the end of the string, but may appear any­
+ where.
+ %x Replaced by the name of the next input file in the
+ list.
+ If any item is unknown (for example, the file size if
+ input is a pipe), a question mark is printed instead.
-LESS(1) LESS(1)
+ Version 371: 26 Dec 2001 24
- %p_X Replaced by the percent into the current input
- file, based on byte offsets. The line used is
- determined by the _X as with the %b option.
- %P_X Replaced by the percent into the current input
- file, based on line numbers. The line used is
- determined by the _X as with the %b option.
- %s Same as %B.
- %t Causes any trailing spaces to be removed. Usually
- used at the end of the string, but may appear any-
- where.
-
- %x Replaced by the name of the next input file in the
- list.
+LESS(1) LESS(1)
- If any item is unknown (for example, the file size if
- input is a pipe), a question mark is printed instead.
- The format of the prompt string can be changed depending
- on certain conditions. A question mark followed by a sin-
- gle character acts like an "IF": depending on the follow-
+ The format of the prompt string can be changed depending
+ on certain conditions. A question mark followed by a sin­
+ gle character acts like an "IF": depending on the follow­
ing character, a condition is evaluated. If the condition
- is true, any characters following the question mark and
- condition character, up to a period, are included in the
- prompt. If the condition is false, such characters are
+ is true, any characters following the question mark and
+ condition character, up to a period, are included in the
+ prompt. If the condition is false, such characters are
not included. A colon appearing between the question mark
- and the period can be used to establish an "ELSE": any
- characters between the colon and the period are included
- in the string if and only if the IF condition is false.
- Condition characters (which follow a question mark) may
+ and the period can be used to establish an "ELSE": any
+ characters between the colon and the period are included
+ in the string if and only if the IF condition is false.
+ Condition characters (which follow a question mark) may
be:
- ?a True if any characters have been included in the
+ ?a True if any characters have been included in the
prompt so far.
- ?b_X True if the byte offset of the specified line is
+ ?b_X True if the byte offset of the specified line is
known.
?B True if the size of current input file is known.
@@ -1567,94 +1613,82 @@ LESS(1) LESS(1)
?c True if the text is horizontally shifted (%c is not
zero).
- ?d_X True if the page number of the specified line is
+ ?d_X True if the page number of the specified line is
known.
?e True if at end-of-file.
- ?f True if there is an input filename (that is, if
+ ?f True if there is an input filename (that is, if
input is not a pipe).
- ?l_X True if the line number of the specified line is
+ ?l_X True if the line number of the specified line is
+ known.
+ ?L True if the line number of the last line in the
+ file is known.
+ ?m True if there is more than one input file.
- Version 358: 08 Jul 2000 24
+ ?n True if this is the first prompt in a new input
+ file.
+ ?p_X True if the percent into the current input file,
+ based on byte offsets, of the specified line is
+ known.
+ ?P_X True if the percent into the current input file,
+ based on line numbers, of the specified line is
+ known.
+ ?s Same as "?B".
-LESS(1) LESS(1)
- known.
+ Version 371: 26 Dec 2001 25
- ?L True if the line number of the last line in the
- file is known.
- ?m True if there is more than one input file.
- ?n True if this is the first prompt in a new input
- file.
- ?p_X True if the percent into the current input file,
- based on byte offsets, of the specified line is
- known.
- ?P_X True if the percent into the current input file,
- based on line numbers, of the specified line is
- known.
+LESS(1) LESS(1)
- ?s Same as "?B".
?x True if there is a next input file (that is, if the
current input file is not the last one).
Any characters other than the special ones (question mark,
- colon, period, percent, and backslash) become literally
- part of the prompt. Any of the special characters may be
- included in the prompt literally by preceding it with a
+ colon, period, percent, and backslash) become literally
+ part of the prompt. Any of the special characters may be
+ included in the prompt literally by preceding it with a
backslash.
Some examples:
?f%f:Standard input.
- This prompt prints the filename, if known; otherwise the
+ This prompt prints the filename, if known; otherwise the
string "Standard input".
?f%f .?ltLine %lt:?pt%pt\%:?btByte %bt:-...
- This prompt would print the filename, if known. The file-
- name is followed by the line number, if known, otherwise
- the percent if known, otherwise the byte offset if known.
- Otherwise, a dash is printed. Notice how each question
+ This prompt would print the filename, if known. The file­
+ name is followed by the line number, if known, otherwise
+ the percent if known, otherwise the byte offset if known.
+ Otherwise, a dash is printed. Notice how each question
mark has a matching period, and how the % after the %pt is
included literally by escaping it with a backslash.
?n?f%f .?m(file %i of %m) ..?e(END) ?x- Next\: %x..%t
- This prints the filename if this is the first prompt in a
- file, followed by the "file N of N" message if there is
+ This prints the filename if this is the first prompt in a
+ file, followed by the "file N of N" message if there is
more than one input file. Then, if we are at end-of-file,
- the string "(END)" is printed followed by the name of the
- next file, if there is one. Finally, any trailing spaces
- are truncated. This is the default prompt. For refer-
- ence, here are the defaults for the other two prompts (-m
-
-
-
- Version 358: 08 Jul 2000 25
-
-
-
-
-
-LESS(1) LESS(1)
-
-
- and -M respectively). Each is broken into two lines here
+ the string "(END)" is printed followed by the name of the
+ next file, if there is one. Finally, any trailing spaces
+ are truncated. This is the default prompt. For refer­
+ ence, here are the defaults for the other two prompts (-m
+ and -M respectively). Each is broken into two lines here
for readability only.
?n?f%f .?m(file %i of %m) ..?e(END) ?x- Next\: %x.:
@@ -1668,25 +1702,36 @@ LESS(1) LESS(1)
?f%f .?m(file %i of %m) .?ltlines %lt-%lb?L/%L. .
byte %bB?s/%s. ?e(END) :?pB%pB\%..%t
- The prompt expansion features are also used for another
- purpose: if an environment variable LESSEDIT is defined,
- it is used as the command to be executed when the v com-
- mand is invoked. The LESSEDIT string is expanded in the
- same way as the prompt strings. The default value for
+ The prompt expansion features are also used for another
+ purpose: if an environment variable LESSEDIT is defined,
+ it is used as the command to be executed when the v com­
+ mand is invoked. The LESSEDIT string is expanded in the
+ same way as the prompt strings. The default value for
LESSEDIT is:
+
+
+ Version 371: 26 Dec 2001 26
+
+
+
+
+
+LESS(1) LESS(1)
+
+
%E ?lm+%lm. %f
Note that this expands to the editor name, followed by a +
- and the line number, followed by the file name. If your
- editor does not accept the "+linenumber" syntax, or has
- other differences in invocation syntax, the LESSEDIT vari-
+ and the line number, followed by the file name. If your
+ editor does not accept the "+linenumber" syntax, or has
+ other differences in invocation syntax, the LESSEDIT vari­
able can be changed to modify this default.
SSEECCUURRIITTYY
When the environment variable LESSSECURE is set to 1, _l_e_s_s
- runs in a "secure" mode. This means these features are
+ runs in a "secure" mode. This means these features are
disabled:
! the shell command
@@ -1707,52 +1752,52 @@ SSEECCUURRIITTYY
filename completion (TAB, ^L)
- Less can also be compiled to be permanently in "secure"
+ Less can also be compiled to be permanently in "secure"
+ mode.
+EENNVVIIRROONNMMEENNTT VVAARRIIAABBLLEESS
+ Environment variables may be specified either in the sys­
+ tem environment as usual, or in a _l_e_s_s_k_e_y (1) file. If
+ environment variables are defined in more than one place,
+ variables defined in a local lesskey file take precedence
+ over variables defined in the system environment, which
+ take precedence over variables defined in the system-wide
+ lesskey file.
- Version 358: 08 Jul 2000 26
+ COLUMNS
+ Sets the number of columns on the screen. Takes
+ precedence over the number of columns specified by
+ the TERM variable. (But if you have a windowing
+ system which supports TIOCGWINSZ or WIOCGETD, the
+ window system's idea of the screen size takes
+ precedence over the LINES and COLUMNS environment
+ variables.)
+ Version 371: 26 Dec 2001 27
-LESS(1) LESS(1)
- mode.
-EENNVVIIRROONNMMEENNTT VVAARRIIAABBLLEESS
- Environment variables may be specified either in the sys-
- tem environment as usual, or in a _l_e_s_s_k_e_y (1) file. If
- environment variables are defined in more than one place,
- variables defined in a local lesskey file take precedence
- over variables defined in the system environment, which
- take precedence over variables defined in the system-wide
- lesskey file.
+LESS(1) LESS(1)
- COLUMNS
- Sets the number of columns on the screen. Takes
- precedence over the number of columns specified by
- the TERM variable. (But if you have a windowing
- system which supports TIOCGWINSZ or WIOCGETD, the
- window system's idea of the screen size takes
- precedence over the LINES and COLUMNS environment
- variables.)
EDITOR The name of the editor (used for the v command).
- HOME Name of the user's home directory (used to find a
- lesskey file on Unix systems).
+ HOME Name of the user's home directory (used to find a
+ lesskey file on Unix and OS/2 systems).
HOMEDRIVE, HOMEPATH
- Concatenation of the HOMEDRIVE and HOMEPATH envi-
- ronment variables is the name of the user's home
- directory if the HOME variable is not set (only in
+ Concatenation of the HOMEDRIVE and HOMEPATH envi­
+ ronment variables is the name of the user's home
+ directory if the HOME variable is not set (only in
the Windows version).
- INIT Name of the user's init directory (used to find a
+ INIT Name of the user's init directory (used to find a
lesskey file on OS/2 systems).
LANG Language for determining the character set.
@@ -1763,45 +1808,49 @@ EENNVVIIRROONNMMEENNTT VVAARRIIAABBLLEESS
LESS Options which are passed to _l_e_s_s automatically.
LESSANSIENDCHARS
- Characters which are assumed to end an ANSI color
+ Characters which are assumed to end an ANSI color
escape sequence (default "m").
LESSBINFMT
- Format for displaying non-printable, non-control
+ Format for displaying non-printable, non-control
characters.
LESSCHARDEF
Defines a character set.
+ LESSCHARSET
+ Selects a predefined character set.
+ LESSCLOSE
+ Command line to invoke the (optional) input-post­
+ processor.
+ LESSECHO
+ Name of the lessecho program (default "lessecho").
+ The lessecho program is needed to expand metachar­
+ acters, such as * and ?, in filenames on Unix sys­
+ tems.
+ LESSEDIT
+ Editor prototype string (used for the v command).
+ See discussion under PROMPTS.
- Version 358: 08 Jul 2000 27
+ LESSGLOBALTAGS
+ Name of the command used by the -t option to find
+ global tags. Normally should be set to "global" if
+ your system has the _g_l_o_b_a_l (1) command. If not
+ set, global tags are not used.
+ Version 371: 26 Dec 2001 28
-LESS(1) LESS(1)
- LESSCHARSET
- Selects a predefined character set.
- LESSCLOSE
- Command line to invoke the (optional) input-post-
- processor.
+LESS(1) LESS(1)
- LESSECHO
- Name of the lessecho program (default "lessecho").
- The lessecho program is needed to expand metachar-
- acters, such as * and ?, in filenames on Unix sys-
- tems.
-
- LESSEDIT
- Editor prototype string (used for the v command).
- See discussion under PROMPTS.
LESSKEY
Name of the default lesskey(1) file.
@@ -1810,17 +1859,17 @@ LESS(1) LESS(1)
Name of the default system-wide lesskey(1) file.
LESSMETACHARS
- List of characters which are considered "metachar-
+ List of characters which are considered "metachar­
acters" by the shell.
LESSMETAESCAPE
- Prefix which less will add before each metacharac-
- ter in a command sent to the shell. If LESS-
+ Prefix which less will add before each metacharac­
+ ter in a command sent to the shell. If LESS­
METAESCAPE is an empty string, commands containing
metacharacters will not be passed to the shell.
LESSOPEN
- Command line to invoke the (optional) input-prepro-
+ Command line to invoke the (optional) input-prepro­
cessor.
LESSSECURE
@@ -1828,7 +1877,7 @@ LESS(1) LESS(1)
SECURITY.
LESSSEPARATOR
- String to be appended to a directory name in file-
+ String to be appended to a directory name in file­
name completion.
LINES Sets the number of lines on the screen. Takes
@@ -1840,18 +1889,6 @@ LESS(1) LESS(1)
variables.)
PATH User's search path (used to find a lesskey file on
-
-
-
- Version 358: 08 Jul 2000 28
-
-
-
-
-
-LESS(1) LESS(1)
-
-
MS-DOS and OS/2 systems).
SHELL The shell used to execute the ! command, as well as
@@ -1869,6 +1906,18 @@ SSEEEE AALLSSOO
WWAARRNNIINNGGSS
The = command and prompts (unless changed by -P) report
the line numbers of the lines at the top and bottom of the
+
+
+
+ Version 371: 26 Dec 2001 29
+
+
+
+
+
+LESS(1) LESS(1)
+
+
screen, but the byte and percent of the line after the one
at the bottom of the screen.
@@ -1878,7 +1927,7 @@ WWAARRNNIINNGGSS
On certain older terminals (the so-called "magic cookie"
terminals), search highlighting will cause an erroneous
- display. On such terminals, search highlighting is dis-
+ display. On such terminals, search highlighting is dis­
abled by default to avoid possible problems.
In certain cases, when search highlighting is enabled and
@@ -1887,29 +1936,46 @@ WWAARRNNIINNGGSS
not occur when less is compiled to use the POSIX regular
expression package.)
+ When viewing text containing ANSI color escape sequences
+ using the -R option, searching will not find text contain­
+ ing an embedded escape sequence. Also, search highlight­
+ ing may change the color of some of the text which follows
+ the highlighted text.
+
On some systems, _s_e_t_l_o_c_a_l_e claims that ASCII characters 0
- thru 31 are control characters rather than binary charac-
+ thru 31 are control characters rather than binary charac­
ters. This causes _l_e_s_s to treat some binary files as
ordinary, non-binary files. To workaround this problem,
set the environment variable LESSCHARSET to "ascii" (or
whatever character set is appropriate).
- See http://www.flash.net/~marknu/less for the latest list
- of known bugs in this version of less.
+ See http://www.greenwoodsoftware.com/less for the latest
+ list of known bugs in this version of less.
CCOOPPYYRRIIGGHHTT
- Copyright (C) 2000 Mark Nudelman
+ Copyright (C) 2001 Mark Nudelman
less is part of the GNU project and is free software. You
can redistribute it and/or modify it under the terms of
either (1) the GNU General Public License as published by
the Free Software Foundation; or (2) the Less License.
See the file README in the less distribution for more
+ details regarding redistribution. You should have
+ received a copy of the GNU General Public License along
+ with the source for less; see the file COPYING. If not,
+ write to the Free Software Foundation, 59 Temple Place,
+ Suite 330, Boston, MA 02111-1307, USA. You should also
+ have received a copy of the Less License; see the file
+ LICENSE.
+
+ less is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied war­
+ ranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- Version 358: 08 Jul 2000 29
+ Version 371: 26 Dec 2001 30
@@ -1918,25 +1984,25 @@ CCOOPPYYRRIIGGHHTT
LESS(1) LESS(1)
- details regarding redistribution. You should have
- received a copy of the GNU General Public License along
- with the source for less; see the file COPYING. If not,
- write to the Free Software Foundation, 59 Temple Place,
- Suite 330, Boston, MA 02111-1307, USA. You should also
- have received a copy of the Less License; see the file
- LICENSE.
-
- less is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied war-
- ranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PUR-
- POSE. See the GNU General Public License for more
+ PURPOSE. See the GNU General Public License for more
details.
AAUUTTHHOORR
- Mark Nudelman <marknu@flash.net>
+ Mark Nudelman <markn@greenwoodsoftware.com>
Send bug reports or comments to the above address or to
bug-less@gnu.org.
+ For more information, see the less homepage at
+ http://www.greenwoodsoftware.com/less.
+
+
+
+
+
+
+
+
+
@@ -1975,6 +2041,6 @@ AAUUTTHHOORR
- Version 358: 08 Jul 2000 30
+ Version 371: 26 Dec 2001 31
diff --git a/contrib/less/less.nro b/contrib/less/less.nro
index eb7aede2bd1a..ecc97822c962 100644
--- a/contrib/less/less.nro
+++ b/contrib/less/less.nro
@@ -1,4 +1,4 @@
-.TH LESS 1 "Version 358: 08 Jul 2000"
+.TH LESS 1 "Version 371: 26 Dec 2001"
.SH NAME
less \- opposite of more
.SH SYNOPSIS
@@ -10,13 +10,13 @@ less \- opposite of more
.br
.B "less --version"
.br
-.B "less [-[+]aBcCdeEfgGiImMnNqQrsSuUVwX]"
+.B "less [-[+]aBcCdeEfFgGiIJmMnNqQrRsSuUVwWX]"
.br
.B " [-b \fIbufs\fP] [-h \fIlines\fP] [-j \fIline\fP] [-k \fIkeyfile\fP]"
.br
.B " [-{oO} \fIlogfile\fP] [-p \fIpattern\fP] [-P \fIprompt\fP] [-t \fItag\fP]"
.br
-.B " [-T \fItagsfile\fP] [-x \fItab\fP] [-y \fIlines\fP] [-[z] \fIlines\fP]"
+.B " [-T \fItagsfile\fP] [-x \fItab\fP,...] [-y \fIlines\fP] [-[z] \fIlines\fP]"
.br
.B " [+[+]\fIcmd\fP] [--] [\fIfilename\fP]..."
.br
@@ -88,14 +88,15 @@ subsequent d and u commands.
.IP "ESC-) or RIGHTARROW"
Scroll horizontally right N characters, default half the screen width
(see the -# option).
+If a number N is specified, it becomes the default for future RIGHTARROW
+and LEFTARROW commands.
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 half the screen width
(see the -# option).
+If a number N is specified, it becomes the default for future RIGHTARROW
+and LEFTARROW commands.
.IP "r or ^R or ^L"
Repaint the screen.
.IP R
@@ -287,6 +288,11 @@ Examine the first file in the command line list.
If a number N is specified, the N-th file in the list is examined.
.IP ":d"
Remove the current file from the list of files.
+.IP "t"
+Go to the next tag, if there were more than one matches for the current tag.
+See the \-t option for more details about tags.
+.IP "T"
+Go to the previous tag, if there were more than one matches for the current tag.
.IP "= or ^G or :f"
Prints some information about the file being viewed,
including its name
@@ -554,7 +560,8 @@ 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.
+The status column shows the lines that matched the current search.
+The status column is also used if the -w or -W option is in effect.
.IP "-k\fIfilename\fP or --lesskey-file=\fIfilename\fP"
Causes
.I less
@@ -634,6 +641,7 @@ to that string.
-PM changes the long (-M) prompt.
-Ph changes the prompt for the help screen.
-P= changes the message printed by the = command.
+-Pw changes the message printed while waiting for data (in the F command).
All prompt strings consist of a sequence of
letters and special escape sequences.
See the section on PROMPTS for more details.
@@ -690,11 +698,17 @@ on the next line.
.IP "-t\fItag\fP or --tag=\fItag\fP"
The -t option, followed immediately by a TAG,
will edit the file containing that tag.
-For this to work, there must be a file called "tags" in the
-current directory, which was previously built by the
+For this to work, tag information must be available;
+for example, there may be a file in the current directory called "tags",
+which was previously built by
.I ctags
-(1) command.
-This option may also be specified from within
+(1) or an equivalent command.
+If the environment variable LESSGLOBALTAGS is set, it is taken to be
+the name of a command compatible with
+.I global
+(1), and that command is executed to find the tag.
+(See http://www.gnu.org/software/global/global.html).
+The -t option may also be specified from within
.I less
(using the \- command) as a way of examining a new file.
The command ":t" is equivalent to specifying -t from within
@@ -738,14 +752,24 @@ 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.
-.IP "-x\fIn\fP or --tabs=\fIn\fP"
-Sets tab stops every \fIn\fP positions.
+.IP "-x\fIn\fP,... or --tabs=\fIn\fP,..."
+Sets tab stops.
+If only one \fIn\fP is specified, tab stops are set at multiples of \fIn\fP.
+If multiple values separated by commas are specified, tab stops
+are set at those positions, and then continue with the same spacing as the
+last two.
+For example, \fI-x9,17\fP will set tabs at positions 9, 17, 25, 33, etc.
The default for \fIn\fP is 8.
.IP "-X or --no-init"
Disables sending the termcap initialization and deinitialization strings
to the terminal.
This is sometimes desirable if the deinitialization string does
something unnecessary, like clearing the screen.
+.IP "--no-keypad"
+Disables sending the keypad initialization and deinitialization strings
+to the terminal.
+This is sometimes useful if the keypad strings make the numeric
+keypad behave in an undesirable manner.
.IP "-y\fIn\fP or --max-forw-scroll=\fIn\fP"
Specifies a maximum number of lines to scroll forward.
If it is necessary to scroll forward more than \fIn\fP lines,
@@ -864,7 +888,7 @@ Like, TAB, but cycles in the reverse direction thru the matching filenames.
Complete the partial filename to the left of the cursor.
If it matches more than one filename, all matches are entered into
the command line (if they fit).
-.IP "^U (Unix) or ESC (MS-DOS)"
+.IP "^U (Unix and OS/2) or ESC (MS-DOS)"
Delete the entire command line,
or cancel the command if the command line is empty.
If you have changed your line-kill character in Unix to something
@@ -918,11 +942,11 @@ uses that as the name of the system-wide lesskey file.
Otherwise,
.I less
looks in a standard place for the system-wide lesskey file:
-On Unix systems, the system-wide lesskey file is /usr/local/bin/.sysless.
+On Unix systems, the system-wide lesskey file is /usr/local/etc/sysless.
(However, if
.I less
-was built with a different binary directory than /usr/local/bin,
-that directory is where the .sysless file is found.)
+was built with a different sysconf directory than /usr/local/etc,
+that directory is where the sysless file is found.)
On MS-DOS and Windows systems, the system-wide lesskey file is c:\\_sysless.
On OS/2 systems, the system-wide lesskey file is c:\\sysless.ini.
@@ -1078,10 +1102,17 @@ This is the same as ASCII, except characters between 160 and 255 are
treated as normal characters.
.IP latin1
Same as iso8859.
+.IP latin9
+Same as iso8859.
.IP dos
Selects a character set appropriate for MS-DOS.
.IP ebcdic
Selects an EBCDIC character set.
+.IP IBM-1047
+Selects an EBCDIC character set used by OS/390 Unix Services.
+This is the EBCDIC analogue of latin1. You get similar results
+by setting either LESSCHARSET=IBM-1047 or LC_CTYPE=en_US
+in your environment.
.IP koi8-r
Selects a Russian character set.
.IP next
@@ -1089,11 +1120,6 @@ Selects a character set appropriate for NeXT computers.
.IP utf-8
Selects the UTF-8 encoding of the ISO 10646 character set.
.PP
-If the LESSCHARSET environment variable is not set,
-the default character set is latin1.
-However, if the string "UTF-8" is found in the LC_ALL, LC_CTYPE or LANG
-environment variables, then the default character set is utf-8 instead.
-.PP
In special cases, it may be desired to tailor
.I less
to use a character set other than the ones definable by LESSCHARSET.
@@ -1122,6 +1148,9 @@ to each of the possible values for LESSCHARSET:
.br
\ \ \ \ \ \ 9.8b8.17b3.3b9.7b9.8b8.6b10.b.b.b.
.br
+ IBM-1047 4cbcbc3b9cbccbccbb4c6bcc5b3cbbc4bc4bccbc
+ \ \ \ \ \ \ 191.b
+.br
iso8859 8bcccbcc18b95.33b.
.br
koi8-r 8bcccbcc18b95.b128.
@@ -1130,13 +1159,21 @@ to each of the possible values for LESSCHARSET:
.br
next\ \ 8bcccbcc18b95.bb125.bb
.PP
-If neither LESSCHARSET nor LESSCHARDEF is set,
-but your system supports the
+If neither LESSCHARSET nor LESSCHARDEF is set,
+but the string "UTF-8" is found in the LC_ALL, LC_TYPE or LANG
+environment variables, then the default character set is utf-8.
+.PP
+If that string is not found, but your system supports the
.I setlocale
interface,
.I less
will use setlocale to determine the character set.
-setlocale is controlled by setting the LANG or LC_CTYPE environment variables.
+setlocale is controlled by setting the LANG or LC_CTYPE environment
+variables.
+.PP
+Finally, if the
+.I setlocale
+interface is also not available, the default character set is latin1.
.PP
Control and binary characters are displayed in standout (reverse video).
Each such character is displayed in caret notation if possible
@@ -1380,7 +1417,8 @@ LINES and COLUMNS environment variables.)
.IP EDITOR
The name of the editor (used for the v command).
.IP HOME
-Name of the user's home directory (used to find a lesskey file on Unix systems).
+Name of the user's home directory
+(used to find a lesskey file on Unix and OS/2 systems).
.IP "HOMEDRIVE, HOMEPATH"
Concatenation of the HOMEDRIVE and HOMEPATH environment variables is
the name of the user's home directory if the HOME variable is not set
@@ -1413,6 +1451,11 @@ in filenames on Unix systems.
.IP LESSEDIT
Editor prototype string (used for the v command).
See discussion under PROMPTS.
+.IP LESSGLOBALTAGS
+Name of the command used by the -t option to find global tags.
+Normally should be set to "global" if your system has the
+.I global
+(1) command. If not set, global tags are not used.
.IP LESSKEY
Name of the default lesskey(1) file.
.IP LESSKEY_SYSTEM
@@ -1472,6 +1515,11 @@ more text than the matching string may be highlighted.
(This problem does not occur when less is compiled to use the POSIX
regular expression package.)
.PP
+When viewing text containing ANSI color escape sequences using the -R option,
+searching will not find text containing an embedded escape sequence.
+Also, search highlighting may change the color of some of the text
+which follows the highlighted text.
+.PP
On some systems,
.I setlocale
claims that ASCII characters 0 thru 31 are control characters
@@ -1482,11 +1530,11 @@ to treat some binary files as ordinary, non-binary files.
To workaround this problem, set the environment variable
LESSCHARSET to "ascii" (or whatever character set is appropriate).
.PP
-See http://www.flash.net/~marknu/less for the latest list of known bugs in this
+See http://www.greenwoodsoftware.com/less for the latest list of known bugs in this
version of less.
.SH COPYRIGHT
-Copyright (C) 2000 Mark Nudelman
+Copyright (C) 2001 Mark Nudelman
.PP
less is part of the GNU project and is free software.
You can redistribute it and/or modify it
@@ -1509,7 +1557,8 @@ See the GNU General Public License for more details.
.SH AUTHOR
.PP
-Mark Nudelman <marknu@flash.net>
+Mark Nudelman <markn@greenwoodsoftware.com>
.br
Send bug reports or comments to the above address or to bug-less@gnu.org.
-
+.br
+For more information, see the less homepage at http://www.greenwoodsoftware.com/less.
diff --git a/contrib/less/lesskey.c b/contrib/less/lesskey.c
index adab35c01748..6334230e8863 100644
--- a/contrib/less/lesskey.c
+++ b/contrib/less/lesskey.c
@@ -126,11 +126,14 @@ struct cmdname cmdnames[] =
"invalid", A_UINVALID,
"left-scroll", A_LSHIFT,
"next-file", A_NEXT_FILE,
+ "next-tag", A_NEXT_TAG,
"noaction", A_NOACTION,
"percent", A_PERCENT,
"pipe", A_PIPE,
"prev-file", A_PREV_FILE,
+ "prev-tag", A_PREV_TAG,
"quit", A_QUIT,
+ "remove-file", A_REMOVE_FILE,
"repaint", A_REPAINT,
"repaint-flush", A_FREPAINT,
"repeat-search", A_AGAIN_SEARCH,
@@ -411,6 +414,10 @@ tstr(pp)
case 'h': ch = SK_HOME; break;
case 'e': ch = SK_END; break;
case 'x': ch = SK_DELETE; break;
+ default:
+ error("illegal char after \\k");
+ *pp = p+1;
+ return ("");
}
*pp = p+1;
buf[0] = SK_SPECIAL_KEY;
diff --git a/contrib/less/lesskey.man b/contrib/less/lesskey.man
index 8cff45e55437..ee7752dffdfa 100644
--- a/contrib/less/lesskey.man
+++ b/contrib/less/lesskey.man
@@ -61,7 +61,7 @@ CCOOMMMMAANNDD SSEECCTTIIOONN
- Version 358: 08 Jul 2000 1
+ Version 371: 26 Dec 2001 1
@@ -84,7 +84,7 @@ LESSKEY(1) LESSKEY(1)
_s_t_r_i_n_g may appear literally, or be prefixed by a caret to
indicate a control key. A backslash followed by one to
three octal digits may be used to specify a character by
- its octal value. A backslash followed by certain charac-
+ its octal value. A backslash followed by certain charac­
ters specifies input characters as follows:
\b BACKSPACE
@@ -127,7 +127,7 @@ LESSKEY(1) LESSKEY(1)
- Version 358: 08 Jul 2000 2
+ Version 371: 26 Dec 2001 2
@@ -144,7 +144,7 @@ LESSKEY(1) LESSKEY(1)
EEXXAAMMPPLLEE
- The following input file describes the set of default com-
+ The following input file describes the set of default com­
mand keys used by less:
#command
@@ -186,14 +186,14 @@ EEXXAAMMPPLLEE
^L repaint
\eu undo-hilite
g goto-line
+ \kh goto-line
< goto-line
\e< goto-line
p percent
- % percent
- Version 358: 08 Jul 2000 3
+ Version 371: 26 Dec 2001 3
@@ -202,6 +202,7 @@ EEXXAAMMPPLLEE
LESSKEY(1) LESSKEY(1)
+ % percent
\e[ left-scroll
\e] right-scroll
\e( left-scroll
@@ -217,6 +218,7 @@ LESSKEY(1) LESSKEY(1)
G goto-end
\e> goto-end
> goto-end
+ \ke goto-end
= status
^G status
:f status
@@ -236,7 +238,10 @@ LESSKEY(1) LESSKEY(1)
^X^V examine
:n next-file
:p prev-file
+ t next-tag
+ T prev-tag
:x index-file
+ :d remove-file
- toggle-option
:t toggle-option t
s toggle-option o
@@ -251,15 +256,10 @@ LESSKEY(1) LESSKEY(1)
0 digit
1 digit
2 digit
- 3 digit
- 4 digit
- 5 digit
- 6 digit
- 7 digit
- Version 358: 08 Jul 2000 4
+ Version 371: 26 Dec 2001 4
@@ -268,6 +268,11 @@ LESSKEY(1) LESSKEY(1)
LESSKEY(1) LESSKEY(1)
+ 3 digit
+ 4 digit
+ 5 digit
+ 6 digit
+ 7 digit
8 digit
9 digit
q quit
@@ -295,7 +300,7 @@ PPRREECCEEDDEENNCCEE
file.
Be aware that #stop can be dangerous. Since all default
- commands are disabled, you must provide sufficient com-
+ commands are disabled, you must provide sufficient com­
mands before the #stop line to enable all necessary
actions. For example, failure to provide a "quit" command
can lead to frustration.
@@ -306,9 +311,9 @@ LLIINNEE EEDDIITTIINNGG SSEECCTTIIOONN
#line-edit
- This section specifies new key bindings for the line edit-
+ This section specifies new key bindings for the line edit­
ing commands, in a manner similar to the way key bindings
- for ordinary commands are specified in the #command sec-
+ for ordinary commands are specified in the #command sec­
tion. The line-editing section consists of a list of keys
and actions, one per line as in the example below.
@@ -317,15 +322,10 @@ EEXXAAMMPPLLEE
The following input file describes the set of default
line-editing keys used by less:
- #line-edit
- \t forw-complete
- \17 back-complete
- \e\t back-complete
- ^L expand
- Version 358: 08 Jul 2000 5
+ Version 371: 26 Dec 2001 5
@@ -334,6 +334,11 @@ EEXXAAMMPPLLEE
LESSKEY(1) LESSKEY(1)
+ #line-edit
+ \t forw-complete
+ \17 back-complete
+ \e\t back-complete
+ ^L expand
^V literal
^A literal
\el right
@@ -366,7 +371,7 @@ LLEESSSS EENNVVIIRROONNMMEENNTT VVAARRIIAABBLLEESS
#env
Following this line is a list of environment variable
- assignments. Each line consists of an environment vari-
+ assignments. Each line consists of an environment vari­
able name, an equals sign (=) and the value to be assigned
to the environment variable. White space before and after
the equals sign is ignored. Variables assigned in this
@@ -383,21 +388,22 @@ EEXXAAMMPPLLEE
The following input file sets the -i option whenever _l_e_s_s
is run, and specifies the character set to be "latin1":
- #env
- LESS = -i
- LESSCHARSET = latin1
+ Version 371: 26 Dec 2001 6
- Version 358: 08 Jul 2000 6
+LESSKEY(1) LESSKEY(1)
-LESSKEY(1) LESSKEY(1)
+ #env
+ LESS = -i
+ LESSCHARSET = latin1
+
SSEEEE AALLSSOO
@@ -405,7 +411,7 @@ SSEEEE AALLSSOO
WWAARRNNIINNGGSS
- It is not possible to specify special keys, such as upar-
+ 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.
@@ -426,8 +432,8 @@ CCOOPPYYRRIIGGHHTT
any later version.
lesskey is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied war-
- ranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PUR-
+ but WITHOUT ANY WARRANTY; without even the implied war­
+ ranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PUR­
POSE. See the GNU General Public License for more
details.
@@ -438,7 +444,7 @@ CCOOPPYYRRIIGGHHTT
AAUUTTHHOORR
- Mark Nudelman <marknu@flash.net>
+ Mark Nudelman <markn@greenwoodsoftware.com>
Send bug reports or comments to the above address or to
bug-less@gnu.org.
@@ -451,12 +457,6 @@ AAUUTTHHOORR
-
-
-
-
-
-
- Version 358: 08 Jul 2000 7
+ Version 371: 26 Dec 2001 7
diff --git a/contrib/less/lesskey.nro b/contrib/less/lesskey.nro
index 7ed95026715b..30fd7f963438 100644
--- a/contrib/less/lesskey.nro
+++ b/contrib/less/lesskey.nro
@@ -1,4 +1,4 @@
-.TH LESSKEY 1 "Version 358: 08 Jul 2000"
+.TH LESSKEY 1 "Version 371: 26 Dec 2001"
.SH NAME
lesskey \- specify key bindings for less
.SH SYNOPSIS
@@ -168,6 +168,7 @@ default command keys used by less:
^L repaint
\eeu undo-hilite
g goto-line
+ \ekh goto-line
< goto-line
\ee< goto-line
p percent
@@ -187,6 +188,7 @@ default command keys used by less:
G goto-end
\ee> goto-end
> goto-end
+ \eke goto-end
= status
^G status
:f status
@@ -206,7 +208,10 @@ default command keys used by less:
^X^V examine
:n next-file
:p prev-file
+ t next-tag
+ T prev-tag
:x index-file
+ :d remove-file
- toggle-option
:t toggle-option t
s toggle-option o
@@ -373,7 +378,7 @@ Suite 330, Boston, MA 02111-1307, USA.
.SH AUTHOR
.PP
-Mark Nudelman <marknu@flash.net>
+Mark Nudelman <markn@greenwoodsoftware.com>
.br
Send bug reports or comments to the above address or to bug-less@gnu.org.
diff --git a/contrib/less/line.c b/contrib/less/line.c
index 6781a2c6f5bc..981d84ee2178 100644
--- a/contrib/less/line.c
+++ b/contrib/less/line.c
@@ -20,20 +20,23 @@
#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];
-public int size_linebuf = sizeof(linebuf);
+public char *linebuf = NULL; /* Buffer which holds the current output line */
+static char *attr = NULL; /* Extension of linebuf to hold attributes */
+public int size_linebuf = 0; /* Size of line buffer (and attr buffer) */
public int cshift; /* Current left-shift of output line buffer */
public int hshift; /* Desired left-shift of output line buffer */
+public int tabstops[TABSTOP_MAX] = { 0 }; /* Custom tabstops */
+public int ntabstops = 1; /* Number of tabstops */
+public int tabdefault = 8; /* Default repeated tabstops */
-static char attr[LINEBUF_SIZE]; /* Extension of linebuf to hold attributes */
static int curr; /* Index into linebuf */
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 int hilites; /* Number of hilites in this line */
static char pendc;
static POSITION pendpos;
static char *end_ansi_chars;
@@ -41,7 +44,6 @@ static char *end_ansi_chars;
static int do_append();
extern int bs_mode;
-extern int tabstop;
extern int linenums;
extern int ctldisp;
extern int twiddle;
@@ -66,6 +68,34 @@ init_line()
end_ansi_chars = lgetenv("LESSANSIENDCHARS");
if (end_ansi_chars == NULL || *end_ansi_chars == '\0')
end_ansi_chars = "m";
+ linebuf = (char *) ecalloc(LINEBUF_SIZE, sizeof(char));
+ attr = (char *) ecalloc(LINEBUF_SIZE, sizeof(char));
+ size_linebuf = LINEBUF_SIZE;
+}
+
+/*
+ * Expand the line buffer.
+ */
+ static int
+expand_linebuf()
+{
+ int new_size = size_linebuf + LINEBUF_SIZE;
+ char *new_buf = (char *) calloc(new_size, sizeof(char));
+ char *new_attr = (char *) calloc(new_size, sizeof(char));
+ if (new_buf == NULL || new_attr == NULL)
+ {
+ if (new_attr != NULL)
+ free(new_attr);
+ if (new_buf != NULL)
+ free(new_buf);
+ return 1;
+ }
+ memcpy(new_buf, linebuf, size_linebuf * sizeof(char));
+ memcpy(new_attr, attr, size_linebuf * sizeof(char));
+ linebuf = new_buf;
+ attr = new_attr;
+ size_linebuf = new_size;
+ return 0;
}
/*
@@ -80,6 +110,9 @@ prewind()
is_null_line = 0;
pendc = '\0';
lmargin = 0;
+#if HILITE_SEARCH
+ hilites = 0;
+#endif
if (status_col)
lmargin += 1;
if (linenums == OPT_ONPLUS)
@@ -146,10 +179,44 @@ plinenum(pos)
}
/*
- *
+ * Determine how many characters are required to shift N columns.
*/
static int
-utf_len(char *s, int len)
+shift_chars(s, len)
+ char *s;
+ int len;
+{
+ char *p = s;
+
+ /*
+ * Each char counts for one column, except ANSI color escape
+ * sequences use no columns since they don't move the cursor.
+ */
+ while (*p != '\0' && len > 0)
+ {
+ if (*p++ != ESC)
+ {
+ len--;
+ } else
+ {
+ while (*p != '\0')
+ {
+ if (is_ansi_end(*p++))
+ break;
+ }
+ }
+ }
+ return (p - s);
+}
+
+/*
+ * Determine how many characters are required to shift N columns (UTF version).
+ * {{ FIXME: what about color escape sequences in UTF mode? }}
+ */
+ static int
+utf_shift_chars(s, len)
+ char *s;
+ int len;
{
int ulen = 0;
@@ -177,28 +244,26 @@ pshift(shift)
int shift;
{
int i;
- int real_shift;
+ int nchars;
if (shift > column - lmargin)
shift = column - lmargin;
if (shift > curr - lmargin)
shift = curr - lmargin;
- if (!utf_mode)
- real_shift = shift;
+ if (utf_mode)
+ nchars = utf_shift_chars(linebuf + lmargin, shift);
else
+ nchars = shift_chars(linebuf + lmargin, shift);
+ if (nchars > curr)
+ nchars = curr;
+ for (i = 0; i < curr - nchars; i++)
{
- real_shift = utf_len(linebuf + lmargin, shift);
- if (real_shift > curr)
- real_shift = curr;
- }
- for (i = 0; i < curr - real_shift; i++)
- {
- linebuf[lmargin + i] = linebuf[lmargin + i + real_shift];
- attr[lmargin + i] = attr[lmargin + i + real_shift];
+ linebuf[lmargin + i] = linebuf[lmargin + i + nchars];
+ attr[lmargin + i] = attr[lmargin + i + nchars];
}
+ curr -= nchars;
column -= shift;
- curr -= real_shift;
cshift += shift;
}
@@ -306,17 +371,30 @@ in_ansi_esc_seq()
{
if (linebuf[i] == ESC)
return (1);
- if (strchr(end_ansi_chars, linebuf[i]) != NULL)
+ if (is_ansi_end(linebuf[i]))
return (0);
}
return (0);
}
/*
+ * Is a character the end of an ANSI escape sequence?
+ */
+ public int
+is_ansi_end(c)
+ char c;
+{
+ return (strchr(end_ansi_chars, c) != NULL);
+}
+
+/*
* Append a character and attribute to the line buffer.
*/
+#define STORE_CHAR(c,a,pos) \
+ do { if (store_char((c),(a),(pos))) return (1); else curr++; } while (0)
+
static int
-storec(c, a, pos)
+store_char(c, a, pos)
int c;
int a;
POSITION pos;
@@ -325,11 +403,14 @@ storec(c, a, pos)
#if HILITE_SEARCH
if (is_hilited(pos, pos+1, 0))
+ {
/*
* This character should be highlighted.
* Override the attribute passed in.
*/
a = AT_STANDOUT;
+ hilites++;
+ }
#endif
if (ctldisp == OPT_ONPLUS && in_ansi_esc_seq())
w = 0;
@@ -341,11 +422,15 @@ storec(c, a, pos)
*/
return (1);
- if (curr >= sizeof(linebuf)-2)
+ if (curr >= size_linebuf-2)
+ {
/*
* Won't fit in line buffer.
+ * Try to expand it.
*/
- return (1);
+ if (expand_linebuf())
+ return (1);
+ }
/*
* Special handling for "magic cookie" terminals.
@@ -387,6 +472,38 @@ storec(c, a, pos)
}
/*
+ * Append a tab to the line buffer.
+ * Store spaces to represent the tab.
+ */
+#define STORE_TAB(a,pos) \
+ do { if (store_tab((a),(pos))) return (1); } while (0)
+
+ static int
+store_tab(attr, pos)
+ int attr;
+ POSITION pos;
+{
+ int to_tab = column + cshift - lmargin;
+ int i;
+
+ if (ntabstops < 2 || to_tab >= tabstops[ntabstops-1])
+ to_tab = tabdefault -
+ ((to_tab - tabstops[ntabstops-1]) % tabdefault);
+ else
+ {
+ for (i = ntabstops - 2; i >= 0; i--)
+ if (to_tab >= tabstops[i])
+ break;
+ to_tab = tabstops[i+1] - to_tab;
+ }
+
+ do {
+ STORE_CHAR(' ', attr, pos);
+ } while (--to_tab > 0);
+ return 0;
+}
+
+/*
* Append a character to the line buffer.
* Expand tabs into spaces, handle underlining, boldfacing, etc.
* Returns 0 if ok, 1 if couldn't fit in buffer.
@@ -429,7 +546,10 @@ pappend(c, pos)
* pappending. (Bold & underline can get messed up otherwise.)
*/
if (cshift < hshift && column > sc_width / 2)
+ {
+ linebuf[curr] = '\0';
pshift(hshift - cshift);
+ }
return (r);
}
@@ -441,15 +561,15 @@ do_append(c, pos)
register char *s;
register int a;
-#define STOREC(c,a) \
- if (storec((c),(a),pos)) return (1); else curr++
+#define STOREC(c,a) \
+ if ((c) == '\t') STORE_TAB((a),pos); else STORE_CHAR((c),(a),pos)
if (c == '\b')
{
switch (bs_mode)
{
case BS_NORMAL:
- STOREC(c, AT_NORMAL);
+ STORE_CHAR(c, AT_NORMAL, pos);
break;
case BS_CONTROL:
goto do_control_char;
@@ -469,14 +589,40 @@ do_append(c, pos)
* bold (if an identical character is overstruck),
* or just deletion of the character in the buffer.
*/
- overstrike = 0;
- if ((char)c == linebuf[curr])
- STOREC(linebuf[curr], AT_BOLD);
- else if (c == '_')
+ overstrike--;
+ if (utf_mode && curr > 1 && (char)c == linebuf[curr-2])
+ {
+ backc();
+ backc();
+ overstrike = 2;
+ } else if (utf_mode && curr > 0 && (char)c == linebuf[curr-1])
+ {
+ backc();
+ STORE_CHAR(linebuf[curr], AT_BOLD, pos);
+ overstrike = 1;
+ } else if ((char)c == linebuf[curr])
+ {
+ STOREC(c, AT_BOLD);
+ } else if (c == '_')
+ {
+ if (utf_mode)
+ {
+ if (curr > 0 && IS_CONT(linebuf[curr]))
+ attr[curr-1] = AT_UNDERLINE;
+ if (curr > 1 && IS_CONT(linebuf[curr-1]))
+ attr[curr-2] = AT_UNDERLINE;
+ if (curr > 2 && IS_CONT(linebuf[curr-2]))
+ attr[curr-3] = AT_UNDERLINE;
+ if (curr > 3 && IS_CONT(linebuf[curr-3]))
+ attr[curr-4] = AT_UNDERLINE;
+ if (curr > 4 && IS_CONT(linebuf[curr-4]))
+ attr[curr-5] = AT_UNDERLINE;
+ }
STOREC(linebuf[curr], AT_UNDERLINE);
- else if (linebuf[curr] == '_')
+ } else if (linebuf[curr] == '_')
+ {
STOREC(c, AT_UNDERLINE);
- else if (control_char(c))
+ } else if (control_char(c))
goto do_control_char;
else
STOREC(c, AT_NORMAL);
@@ -485,18 +631,13 @@ do_append(c, pos)
/*
* Expand a tab into spaces.
*/
- if (tabstop == 0)
- tabstop = 1;
switch (bs_mode)
{
case BS_CONTROL:
goto do_control_char;
case BS_NORMAL:
case BS_SPECIAL:
- do
- {
- STOREC(' ', AT_NORMAL);
- } while (((column + cshift - lmargin) % tabstop) != 0);
+ STORE_TAB(AT_NORMAL, pos);
break;
}
} else if (control_char(c))
@@ -507,7 +648,7 @@ do_append(c, pos)
/*
* Output as a normal character.
*/
- STOREC(c, AT_NORMAL);
+ STORE_CHAR(c, AT_NORMAL, pos);
} else
{
/*
@@ -525,7 +666,7 @@ do_append(c, pos)
return (1);
for ( ; *s != 0; s++)
- STOREC(*s, a);
+ STORE_CHAR(*s, a, pos);
}
} else
{
@@ -568,6 +709,14 @@ pdone(endline)
}
linebuf[curr] = '\0';
attr[curr] = AT_NORMAL;
+
+#if HILITE_SEARCH
+ if (status_col && hilites > 0)
+ {
+ linebuf[0] = '*';
+ attr[0] = AT_STANDOUT;
+ }
+#endif
/*
* If we are done with this line, reset the current shift.
*/
@@ -622,7 +771,7 @@ forw_raw_line(curr_pos, linep)
POSITION curr_pos;
char **linep;
{
- register char *p;
+ register int n;
register int c;
POSITION new_pos;
@@ -630,8 +779,7 @@ forw_raw_line(curr_pos, linep)
(c = ch_forw_get()) == EOI)
return (NULL_POSITION);
- p = linebuf;
-
+ n = 0;
for (;;)
{
if (c == '\n' || c == EOI)
@@ -639,21 +787,22 @@ forw_raw_line(curr_pos, linep)
new_pos = ch_tell();
break;
}
- if (p >= &linebuf[sizeof(linebuf)-1])
+ if (n >= size_linebuf-1)
{
- /*
- * Overflowed the input buffer.
- * Pretend the line ended here.
- * {{ The line buffer is supposed to be big
- * enough that this never happens. }}
- */
- new_pos = ch_tell() - 1;
- break;
+ if (expand_linebuf())
+ {
+ /*
+ * Overflowed the input buffer.
+ * Pretend the line ended here.
+ */
+ new_pos = ch_tell() - 1;
+ break;
+ }
}
- *p++ = c;
+ linebuf[n++] = c;
c = ch_forw_get();
}
- *p = '\0';
+ linebuf[n] = '\0';
if (linep != NULL)
*linep = linebuf;
return (new_pos);
@@ -668,7 +817,7 @@ back_raw_line(curr_pos, linep)
POSITION curr_pos;
char **linep;
{
- register char *p;
+ register int n;
register int c;
POSITION new_pos;
@@ -676,9 +825,8 @@ back_raw_line(curr_pos, linep)
ch_seek(curr_pos-1))
return (NULL_POSITION);
- p = &linebuf[sizeof(linebuf)];
- *--p = '\0';
-
+ n = size_linebuf;
+ linebuf[--n] = '\0';
for (;;)
{
c = ch_back_get();
@@ -701,18 +849,32 @@ back_raw_line(curr_pos, linep)
new_pos = ch_zero();
break;
}
- if (p <= linebuf)
+ if (n <= 0)
{
+ int old_size_linebuf = size_linebuf;
+ char *fm;
+ char *to;
+ if (expand_linebuf())
+ {
+ /*
+ * Overflowed the input buffer.
+ * Pretend the line ended here.
+ */
+ new_pos = ch_tell() + 1;
+ break;
+ }
/*
- * Overflowed the input buffer.
- * Pretend the line ended here.
+ * Shift the data to the end of the new linebuf.
*/
- new_pos = ch_tell() + 1;
- break;
+ for (fm = linebuf + old_size_linebuf,
+ to = linebuf + size_linebuf;
+ fm >= linebuf; fm--, to--)
+ *to = *fm;
+ n = size_linebuf - old_size_linebuf;
}
- *--p = c;
+ linebuf[--n] = c;
}
if (linep != NULL)
- *linep = p;
+ *linep = &linebuf[n];
return (new_pos);
}
diff --git a/contrib/less/linenum.c b/contrib/less/linenum.c
index e75711c786aa..7a90cd5ce986 100644
--- a/contrib/less/linenum.c
+++ b/contrib/less/linenum.c
@@ -297,7 +297,6 @@ find_linenum(pos)
* The decision is based on which way involves
* traversing fewer bytes in the file.
*/
- flush();
#if HAVE_TIME
startime = get_time();
#endif
@@ -386,7 +385,6 @@ find_pos(lno)
/* Found it exactly. */
return (p->pos);
- flush();
if (p == &anchor || lno - p->prev->line < p->line - lno)
{
/*
diff --git a/contrib/less/lsystem.c b/contrib/less/lsystem.c
index 92286a334dbc..30c89dea9aec 100644
--- a/contrib/less/lsystem.c
+++ b/contrib/less/lsystem.c
@@ -14,8 +14,8 @@
* Necessarily very OS dependent.
*/
-#include <signal.h>
#include "less.h"
+#include <signal.h>
#include "position.h"
#if MSDOS_COMPILER
@@ -107,7 +107,12 @@ lsystem(cmd, donemsg)
*/
inp = dup(0);
close(0);
+#if OS2
+ /* The __open() system call translates "/dev/tty" to "con". */
+ if (__open("/dev/tty", OPEN_READ) < 0)
+#else
if (open("/dev/tty", OPEN_READ) < 0)
+#endif
dup(inp);
#endif
diff --git a/contrib/less/main.c b/contrib/less/main.c
index 2c69d877592c..861996bd3836 100644
--- a/contrib/less/main.c
+++ b/contrib/less/main.c
@@ -14,6 +14,9 @@
*/
#include "less.h"
+#if MSDOS_COMPILER==WIN32C
+#include <windows.h>
+#endif
public char * every_first_cmd = NULL;
public int new_file;
@@ -42,10 +45,15 @@ public char * editproto;
#endif
#if TAGS
+extern char * tags;
extern char * tagoption;
extern int jump_sline;
#endif
+#ifdef WIN32
+static char consoleTitle[256];
+#endif
+
extern int missing_cap;
extern int know_dumb;
@@ -93,6 +101,7 @@ main(argc, argv)
putenv(env);
}
}
+ GetConsoleTitle(consoleTitle, sizeof(consoleTitle)/sizeof(char));
#endif /* WIN32 */
/*
@@ -153,7 +162,7 @@ main(argc, argv)
ifile = get_ifile(FAKE_HELPFILE, ifile);
while (argc-- > 0)
{
-#if (MSDOS_COMPILER && MSDOS_COMPILER != DJGPPC) || OS2
+#if (MSDOS_COMPILER && MSDOS_COMPILER != DJGPPC)
/*
* Because the "shell" doesn't expand filename patterns,
* treat each argument as a filename pattern rather than
@@ -209,7 +218,7 @@ main(argc, argv)
* Select the first file to examine.
*/
#if TAGS
- if (tagoption != NULL)
+ if (tagoption != NULL || strcmp(tags, "-") == 0)
{
/*
* A -t option was given.
@@ -365,6 +374,9 @@ quit(status)
*/
close(2);
#endif
+#if WIN32
+ SetConsoleTitle(consoleTitle);
+#endif
close_getchr();
exit(status);
}
diff --git a/contrib/less/optfunc.c b/contrib/less/optfunc.c
index e3fb861d4271..524551c26951 100644
--- a/contrib/less/optfunc.c
+++ b/contrib/less/optfunc.c
@@ -42,6 +42,7 @@ extern char closequote;
extern char *prproto[];
extern char *eqproto;
extern char *hproto;
+extern char *wproto;
extern IFILE curr_ifile;
extern char version[];
#if LOGFILE
@@ -291,6 +292,7 @@ opt__P(type, s)
case 'M': proto = &prproto[PR_LONG]; s++; break;
case '=': proto = &eqproto; s++; break;
case 'h': proto = &hproto; s++; break;
+ case 'w': proto = &wproto; s++; break;
default: proto = &prproto[PR_SHORT]; break;
}
free(*proto);
@@ -368,10 +370,11 @@ opt__V(type, s)
any_display = 1;
putstr("less ");
putstr(version);
- putstr("\nCopyright (C) 2000 Mark Nudelman\n\n");
+ putstr("\nCopyright (C) 2001 Mark Nudelman\n\n");
putstr("less comes with NO WARRANTY, to the extent permitted by law.\n");
putstr("For information about the terms of redistribution,\n");
putstr("see the file named README in the less distribution.\n");
+ putstr("Homepage: http://www.greenwoodsoftware.com/less\n");
quit(QUIT_OK);
break;
}
@@ -461,6 +464,62 @@ opt_D(type, s)
#endif
/*
+ * Handler for the -x option.
+ */
+ public void
+opt_x(type, s)
+ int type;
+ register char *s;
+{
+ extern int tabstops[];
+ extern int ntabstops;
+ extern int tabdefault;
+ char msg[60+(4*TABSTOP_MAX)];
+ int i;
+ PARG p;
+
+ switch (type)
+ {
+ case INIT:
+ case TOGGLE:
+ /* Start at 1 because tabstops[0] is always zero. */
+ for (i = 1; i < TABSTOP_MAX; )
+ {
+ int n = 0;
+ while (*s >= '0' && *s <= '9')
+ n = (10 * n) + (*s++ - '0');
+ if (n > tabstops[i-1])
+ tabstops[i++] = n;
+ if (*s++ != ',')
+ break;
+ }
+ if (i < 2)
+ return;
+ ntabstops = i;
+ tabdefault = tabstops[ntabstops-1] - tabstops[ntabstops-2];
+ break;
+ case QUERY:
+ strcpy(msg, "Tab stops ");
+ if (ntabstops > 2)
+ {
+ for (i = 1; i < ntabstops; i++)
+ {
+ if (i > 1)
+ strcat(msg, ",");
+ sprintf(msg+strlen(msg), "%d", tabstops[i]);
+ }
+ sprintf(msg+strlen(msg), " and then ");
+ }
+ sprintf(msg+strlen(msg), "every %d spaces",
+ tabdefault);
+ p.p_string = msg;
+ error("%s", &p);
+ break;
+ }
+}
+
+
+/*
* Handler for the -" option.
*/
public void
diff --git a/contrib/less/option.c b/contrib/less/option.c
index 137eb488cd84..497233efacfd 100644
--- a/contrib/less/option.c
+++ b/contrib/less/option.c
@@ -116,11 +116,12 @@ scan_option(s)
* EVERY input file.
*/
plusoption = TRUE;
- if (*s == '+')
- every_first_cmd = save(++s);
+ str = s;
+ s = optstring(s, propt('+'), NULL);
+ if (*str == '+')
+ every_first_cmd = save(++str);
else
- ungetsc(s);
- s = optstring(s, propt('+'));
+ ungetsc(str);
continue;
case '0': case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9':
@@ -225,7 +226,7 @@ scan_option(s)
* the handling function.
*/
str = s;
- s = optstring(s, printopt);
+ s = optstring(s, printopt, o->odesc[1]);
break;
case NUMBER:
if (*s == '\0')
@@ -543,11 +544,13 @@ nopendopt()
* Return a pointer to the remainder of the string, if any.
*/
static char *
-optstring(s, printopt)
+optstring(s, printopt, validchars)
char *s;
char *printopt;
+ char *validchars;
{
register char *p;
+ PARG parg;
if (*s == '\0')
{
@@ -555,8 +558,19 @@ optstring(s, printopt)
quit(QUIT_ERROR);
}
for (p = s; *p != '\0'; p++)
- if (*p == END_OPTION_STRING)
+ if (*p == END_OPTION_STRING ||
+ (validchars != NULL && strchr(validchars, *p) == NULL))
{
+ switch (*p)
+ {
+ case END_OPTION_STRING:
+ case ' ': case '\t': case '-':
+ break;
+ default:
+ parg.p_string = p;
+ error("Option string needs delimiter before %s", &parg);
+ break;
+ }
*p = '\0';
return (p+1);
}
diff --git a/contrib/less/opttbl.c b/contrib/less/opttbl.c
index 132de68278ba..9f43f6506d5b 100644
--- a/contrib/less/opttbl.c
+++ b/contrib/less/opttbl.c
@@ -42,6 +42,7 @@ public int swindow; /* Size of scrolling window */
public int jump_sline; /* Screen line of "jump target" */
public int chopline; /* Truncate displayed lines at screen width */
public int no_init; /* Disable sending ti/te termcap strings */
+public int no_keypad; /* Disable sending ks/ke 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 */
@@ -102,10 +103,20 @@ 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 };
+static struct optname keypad_optname = { "no-keypad", NULL };
/*
* Table of all options and their semantics.
+ *
+ * For BOOL and TRIPLE options, odesc[0], odesc[1], odesc[2] are
+ * the description of the option when set to 0, 1 or 2, respectively.
+ * For NUMBER options, odesc[0] is the prompt to use when entering
+ * a new value, and odesc[1] is the description, which should contain
+ * one %d which is replaced by the value of the number.
+ * For STRING options, odesc[0] is the prompt to use when entering
+ * a new value, and odesc[1], if not NULL, is the set of characters
+ * that are valid in the string.
*/
static struct option option[] =
{
@@ -143,7 +154,9 @@ static struct option option[] =
#if MSDOS_COMPILER
{ 'D', &D__optname,
STRING|REPAINT|NO_QUERY, 0, NULL, opt_D,
- "color desc: ", NULL, NULL
+ "color desc: ",
+ "Ddknsu0123456789.",
+ NULL
},
#endif
{ 'e', &e_optname,
@@ -287,9 +300,9 @@ static struct option option[] =
"Highlight first unread line after any forward movement",
},
{ 'x', &x_optname,
- NUMBER|REPAINT, 8, &tabstop, NULL,
+ STRING|REPAINT, 0, NULL, opt_x,
"Tab stops: ",
- "Tab stops every %d spaces",
+ "0123456789,",
NULL
},
{ 'X', &X__optname,
@@ -330,6 +343,12 @@ static struct option option[] =
"Horizontal shift %d positions",
NULL
},
+ { '.', &keypad_optname,
+ BOOL|NO_TOGGLE, OPT_OFF, &no_keypad, NULL,
+ "Use keypad mode",
+ "Don't use keypad mode",
+ NULL
+ },
{ '\0', NULL, NOVAR, 0, NULL, NULL, NULL, NULL, NULL }
};
@@ -429,7 +448,7 @@ findopt_name(p_optname, p_oname, p_err)
maxoname = oname;
maxlen = len;
ambig = 0;
- exact = (len == strlen(oname->oname));
+ exact = (len == (int)strlen(oname->oname));
}
if (!(o->otype & TRIPLE))
break;
diff --git a/contrib/less/os.c b/contrib/less/os.c
index 6e37bb2aaf57..4b4e0a4b4493 100644
--- a/contrib/less/os.c
+++ b/contrib/less/os.c
@@ -33,9 +33,6 @@
#if HAVE_VALUES_H
#include <values.h>
#endif
-#if HAVE_LIMITS_H
-#include <limits.h>
-#endif
#if HAVE_TIME_T
#define time_type time_t
@@ -233,36 +230,6 @@ errno_message(filename)
}
/*
- * Return the largest possible number that can fit in a long.
- */
- static long
-get_maxlong()
-{
-#ifdef LONG_MAX
- return (LONG_MAX);
-#else
-#ifdef MAXLONG
- return (MAXLONG);
-#else
- long n, n2;
-
- /*
- * Keep doubling n until we overflow.
- * {{ This actually only returns the largest power of two that
- * can fit in a long, but percentage() doesn't really need
- * it any more accurate than that. }}
- */
- n2 = 128; /* Hopefully no maxlong is less than 128! */
- do {
- n = n2;
- n2 *= 2;
- } while (n2 / 2 == n);
- return (n);
-#endif
-#endif
-}
-
-/*
* Return the ratio of two POSITIONS, as a percentage.
* {{ Assumes a POSITION is a long int. }}
*/
@@ -270,27 +237,67 @@ get_maxlong()
percentage(num, den)
POSITION num, den;
{
- if (num <= get_maxlong() / 100)
- return ((100 * num) / den);
+ POSITION num100 = num * 100;
+
+ if (num100 / 100 == num)
+ return (num100 / den);
else
return (num / (den / 100));
}
/*
* Return the specified percentage of a POSITION.
- * {{ Assumes a POSITION is a long int. }}
*/
public POSITION
percent_pos(pos, percent)
POSITION pos;
int percent;
{
- if (pos <= get_maxlong() / 100)
- return ((percent * pos) / 100);
+ POSITION result100;
+
+ if (percent == 0)
+ return (0);
+ else if ((result100 = pos * percent) / percent == pos)
+ return (result100 / 100);
else
return (percent * (pos / 100));
}
+#if !HAVE_STRCHR
+/*
+ * strchr is used by regexp.c.
+ */
+ char *
+strchr(s, c)
+ char *s;
+ int c;
+{
+ for ( ; *s != '\0'; s++)
+ if (*s == c)
+ return (s);
+ if (c == '\0')
+ return (s);
+ return (NULL);
+}
+#endif
+
+#if !HAVE_MEMCPY
+ VOID_POINTER
+memcpy(dst, src, len)
+ VOID_POINTER dst;
+ VOID_POINTER src;
+ int len;
+{
+ char *dstp = (char *) dst;
+ char *srcp = (char *) src;
+ int i;
+
+ for (i = 0; i < len; i++)
+ dstp[i] = srcp[i];
+ return (dst);
+}
+#endif
+
#ifdef _OSK_MWC32
/*
@@ -306,7 +313,7 @@ os9_signal(type, handler)
#include <sgstat.h>
- public int
+ int
isatty(f)
int f;
{
diff --git a/contrib/less/output.c b/contrib/less/output.c
index a9c3e9f27ccb..d30930374296 100644
--- a/contrib/less/output.c
+++ b/contrib/less/output.c
@@ -125,68 +125,43 @@ flush()
#if MSDOS_COMPILER==WIN32C
if (is_tty && any_display)
{
- char *p;
char *op;
DWORD nwritten = 0;
CONSOLE_SCREEN_BUFFER_INFO scr;
- DWORD nchars;
- COORD cpos;
- WORD nm_attr;
+ int row;
+ int col;
int olen;
extern HANDLE con_out;
- extern int nm_fg_color;
- extern int nm_bg_color;
-#define MAKEATTR(fg,bg) ((WORD)((fg)|((bg)<<4)))
- *ob = '\0';
olen = ob - obuf;
/*
- * To avoid color problems, if we're scrolling the screen,
- * we write only up to the char that causes the scroll,
- * (a newline or a char in the last column), then fill
- * the bottom line with the "normal" attribute, then
- * write the rest.
- * When Windows scrolls, it takes the attributes for the
- * new line from the first char of the (previously)
- * bottom line.
- *
- * {{ This still doesn't work correctly in all cases! }}
+ * There is a bug in Win32 WriteConsole() if we're
+ * writing in the last cell with a different color.
+ * To avoid color problems in the bottom line,
+ * we scroll the screen manually, before writing.
*/
- nm_attr = MAKEATTR(nm_fg_color, nm_bg_color);
- for (op = obuf; *op != '\0'; )
+ GetConsoleScreenBufferInfo(con_out, &scr);
+ col = scr.dwCursorPosition.X;
+ row = scr.dwCursorPosition.Y;
+ for (op = obuf; op < obuf + olen; op++)
{
- GetConsoleScreenBufferInfo(con_out, &scr);
- /* Find the next newline. */
- p = strchr(op, '\n');
- if (p == NULL &&
- scr.dwCursorPosition.X + olen >= sc_width)
- {
- /*
- * No newline, but writing in the
- * last column causes scrolling.
- */
- p = op + sc_width - scr.dwCursorPosition.X - 1;
- }
- if (scr.dwCursorPosition.Y != scr.srWindow.Bottom ||
- p == NULL)
+ if (*op == '\n')
{
- /* Write the entire buffer. */
- WriteConsole(con_out, op, olen,
- &nwritten, NULL);
- op += olen;
+ col = 0;
+ row++;
} else
{
- /* Write only up to the scrolling char. */
- WriteConsole(con_out, op, p - op + 1,
- &nwritten, NULL);
- cpos.X = 0;
- cpos.Y = scr.dwCursorPosition.Y;
- FillConsoleOutputAttribute(con_out, nm_attr,
- sc_width, cpos, &nchars);
- olen -= p - op + 1;
- op = p + 1;
+ col++;
+ if (col >= sc_width)
+ {
+ col = 0;
+ row++;
+ }
}
}
+ if (row > scr.srWindow.Bottom)
+ win32_scroll_up(row - scr.srWindow.Bottom);
+ WriteConsole(con_out, obuf, olen, &nwritten, NULL);
ob = obuf;
return;
}
@@ -274,7 +249,7 @@ iprintnum(num, radix)
register char *s;
int r;
int neg;
- char buf[10];
+ char buf[INT_STRLEN_BOUND(num)];
neg = (num < 0);
if (neg)
diff --git a/contrib/less/prompt.c b/contrib/less/prompt.c
index 14480213dff4..80fc29deee2c 100644
--- a/contrib/less/prompt.c
+++ b/contrib/less/prompt.c
@@ -41,19 +41,22 @@ extern char *editproto;
* These strings are expanded by pr_expand().
*/
static constant char s_proto[] =
- "?n?f%f .?m(file %i of %m) ..?e(END) ?x- Next\\: %x..%t";
+ "?n?f%f .?m(%T %i of %m) ..?e(END) ?x- Next\\: %x..%t";
static constant char m_proto[] =
- "?n?f%f .?m(file %i of %m) ..?e(END) ?x- Next\\: %x.:?pB%pB\\%:byte %bB?s/%s...%t";
+ "?n?f%f .?m(%T %i of %m) ..?e(END) ?x- Next\\: %x.:?pB%pB\\%:byte %bB?s/%s...%t";
static constant char M_proto[] =
- "?f%f .?n?m(file %i of %m) ..?ltlines %lt-%lb?L/%L. :byte %bB?s/%s. .?e(END) ?x- Next\\: %x.:?pB%pB\\%..%t";
+ "?f%f .?n?m(%T %i of %m) ..?ltlines %lt-%lb?L/%L. :byte %bB?s/%s. .?e(END) ?x- Next\\: %x.:?pB%pB\\%..%t";
static constant char e_proto[] =
- "?f%f .?m(file %i of %m) .?ltlines %lt-%lb?L/%L. .byte %bB?s/%s. ?e(END) :?pB%pB\\%..%t";
+ "?f%f .?m(%T %i of %m) .?ltlines %lt-%lb?L/%L. .byte %bB?s/%s. ?e(END) :?pB%pB\\%..%t";
static constant char h_proto[] =
"HELP -- ?eEND -- Press g to see it again:Press RETURN for more., or q when done";
+static constant char w_proto[] =
+ "Waiting for data";
public char *prproto[3];
public char constant *eqproto = e_proto;
public char constant *hproto = h_proto;
+public char constant *wproto = w_proto;
static char message[PROMPT_SIZE];
static char *mp;
@@ -69,6 +72,7 @@ init_prompt()
prproto[2] = save(M_proto);
eqproto = save(e_proto);
hproto = save(h_proto);
+ wproto = save(w_proto);
}
/*
@@ -109,10 +113,19 @@ ap_char(c)
ap_pos(pos)
POSITION pos;
{
- char buf[MAX_PRINT_POSITION];
-
- sprintf(buf, PR_POSITION, pos);
- ap_str(buf);
+ char buf[INT_STRLEN_BOUND(pos) + 1];
+ char *p = buf + sizeof(buf) - 1;
+ int neg = (pos < 0);
+
+ if (neg)
+ pos = -pos;
+ *p = '\0';
+ do
+ *--p = '0' + (pos % 10);
+ while ((pos /= 10) != 0);
+ if (neg)
+ *--p = '-';
+ ap_str(p);
}
/*
@@ -122,7 +135,7 @@ ap_pos(pos)
ap_int(n)
int n;
{
- char buf[MAX_PRINT_INT];
+ char buf[INT_STRLEN_BOUND(n) + 1];
sprintf(buf, "%d", n);
ap_str(buf);
@@ -186,9 +199,9 @@ cond(c, where)
case 'D': /* Same as L */
return (linenums && ch_length() != NULL_POSITION);
case 'm': /* More than one file? */
- return (nifile() > 1);
+ return (ntags() ? (ntags() > 1) : (nifile() > 1));
case 'n': /* First prompt in a new file? */
- return (new_file);
+ return (ntags() ? 1 : new_file);
case 'p': /* Percent into file (bytes) known? */
return (curr_byte(where) != NULL_POSITION &&
ch_length() > 0);
@@ -200,6 +213,8 @@ cond(c, where)
case 'B':
return (ch_length() != NULL_POSITION);
case 'x': /* Is there a "next" file? */
+ if (ntags())
+ return (0);
return (next_ifile(curr_ifile) != NULL_IFILE);
}
return (0);
@@ -272,7 +287,10 @@ protochar(c, where, iseditproto)
free(s);
break;
case 'i': /* Index into list of files */
- ap_int(get_index(curr_ifile));
+ if (ntags())
+ ap_int(curr_tag());
+ else
+ ap_int(get_index(curr_ifile));
break;
case 'l': /* Current line number */
n = currline(where);
@@ -290,7 +308,11 @@ protochar(c, where, iseditproto)
ap_int(n-1);
break;
case 'm': /* Number of files */
- ap_int(nifile());
+ n = ntags();
+ if (n)
+ ap_int(n);
+ else
+ ap_int(nifile());
break;
case 'p': /* Percent into file (bytes) */
pos = curr_byte(where);
@@ -321,6 +343,12 @@ protochar(c, where, iseditproto)
while (mp > message && mp[-1] == ' ')
mp--;
break;
+ case 'T': /* Type of list */
+ if (ntags())
+ ap_str("tag");
+ else
+ ap_str("file");
+ break;
case 'x': /* Name of next file */
h = next_ifile(curr_ifile);
if (h != NULL_IFILE)
@@ -483,7 +511,6 @@ pr_expand(proto, maxwidth)
}
}
- new_file = 0;
if (mp == message)
return (NULL);
if (maxwidth > 0 && mp >= message + maxwidth)
@@ -515,7 +542,20 @@ eq_message()
public char *
pr_string()
{
- if (ch_getflags() & CH_HELPFILE)
- return (pr_expand(hproto, sc_width-so_s_width-so_e_width-2));
- return (pr_expand(prproto[pr_type], sc_width-so_s_width-so_e_width-2));
+ char *prompt;
+
+ prompt = pr_expand((ch_getflags() & CH_HELPFILE) ?
+ hproto : prproto[pr_type],
+ sc_width-so_s_width-so_e_width-2);
+ new_file = 0;
+ return (prompt);
+}
+
+/*
+ * Return a message suitable for printing while waiting in the F command.
+ */
+ public char *
+wait_message()
+{
+ return (pr_expand(wproto, sc_width-so_s_width-so_e_width-2));
}
diff --git a/contrib/less/screen.c b/contrib/less/screen.c
index 20aa81aaa7dc..485e5487da8f 100644
--- a/contrib/less/screen.c
+++ b/contrib/less/screen.c
@@ -66,6 +66,7 @@ extern int fd0;
#endif
#if OS2
#include <sys/signal.h>
+#include "pckeys.h"
#endif
#if HAVE_SYS_STREAM_H
#include <sys/stream.h>
@@ -88,6 +89,7 @@ extern int fd0;
#if OS2
#define DEFAULT_TERM "ansi"
+static char *windowid;
#else
#define DEFAULT_TERM "unknown"
#endif
@@ -223,6 +225,7 @@ extern int quiet; /* If VERY_QUIET, use visual bell for bell */
extern int no_back_scroll;
extern int swindow;
extern int no_init;
+extern int no_keypad;
extern int sigs;
extern int wscroll;
extern int screen_trashed;
@@ -419,6 +422,9 @@ raw_mode(on)
*/
s = save_term;
}
+#if HAVE_FSYNC
+ fsync(2);
+#endif
tcsetattr(2, TCSADRAIN, &s);
#if MUST_SET_LINE_DISCIPLINE
if (!on)
@@ -708,6 +714,27 @@ scrsize()
_scrsize(s);
sys_width = s[0];
sys_height = s[1];
+ /*
+ * When using terminal emulators for XFree86/OS2, the
+ * _scrsize function does not work well.
+ * Call the scrsize.exe program to get the window size.
+ */
+ windowid = getenv("WINDOWID");
+ if (windowid != NULL)
+ {
+ FILE *fd = popen("scrsize", "rt");
+ if (fd != NULL)
+ {
+ int w, h;
+ fscanf(fd, "%i %i", &w, &h);
+ if (w > 0 && h > 0)
+ {
+ sys_width = w;
+ sys_height = h;
+ }
+ pclose(fd);
+ }
+ }
}
#else
#ifdef TIOCGWINSZ
@@ -831,7 +858,7 @@ special_key_str(key)
{
static char tbuf[40];
char *s;
-#if MSDOS_COMPILER
+#if MSDOS_COMPILER || OS2
static char k_right[] = { '\340', PCK_RIGHT, 0 };
static char k_left[] = { '\340', PCK_LEFT, 0 };
static char k_ctl_right[] = { '\340', PCK_CTL_RIGHT, 0 };
@@ -848,12 +875,56 @@ special_key_str(key)
static char k_pagedown[] = { '\340', PCK_PAGEDOWN, 0 };
static char k_pageup[] = { '\340', PCK_PAGEUP, 0 };
static char k_f1[] = { '\340', PCK_F1, 0 };
-#else
+#endif
+#if !MSDOS_COMPILER
char *sp = tbuf;
#endif
switch (key)
{
+#if OS2
+ /*
+ * If windowid is not NULL, assume less is executed in
+ * the XFree86 environment.
+ */
+ case SK_RIGHT_ARROW:
+ s = windowid ? ltgetstr("kr", &sp) : k_right;
+ break;
+ case SK_LEFT_ARROW:
+ s = windowid ? ltgetstr("kl", &sp) : k_left;
+ break;
+ case SK_UP_ARROW:
+ s = windowid ? ltgetstr("ku", &sp) : k_up;
+ break;
+ case SK_DOWN_ARROW:
+ s = windowid ? ltgetstr("kd", &sp) : k_down;
+ break;
+ case SK_PAGE_UP:
+ s = windowid ? ltgetstr("kP", &sp) : k_pageup;
+ break;
+ case SK_PAGE_DOWN:
+ s = windowid ? ltgetstr("kN", &sp) : k_pagedown;
+ break;
+ case SK_HOME:
+ s = windowid ? ltgetstr("kh", &sp) : k_home;
+ break;
+ case SK_END:
+ s = windowid ? ltgetstr("@7", &sp) : k_end;
+ break;
+ case SK_DELETE:
+ if (windowid)
+ {
+ s = ltgetstr("kD", &sp);
+ if (s == NULL)
+ {
+ tbuf[0] = '\177';
+ tbuf[1] = '\0';
+ s = tbuf;
+ }
+ } else
+ s = k_delete;
+ break;
+#endif
#if MSDOS_COMPILER
case SK_RIGHT_ARROW:
s = k_right;
@@ -882,6 +953,8 @@ special_key_str(key)
case SK_DELETE:
s = k_delete;
break;
+#endif
+#if MSDOS_COMPILER || OS2
case SK_INSERT:
s = k_insert;
break;
@@ -1426,21 +1499,15 @@ win32_deinit_term()
public void
init()
{
- if (no_init)
- {
-#if MSDOS_COMPILER==WIN32C
- /* no_init or not, never trash win32 console colors. */
- initcolor();
- flush();
-#endif
- return;
- }
#if !MSDOS_COMPILER
- tputs(sc_init, sc_height, putchr);
- tputs(sc_s_keypad, sc_height, putchr);
+ if (!no_init)
+ tputs(sc_init, sc_height, putchr);
+ if (!no_keypad)
+ tputs(sc_s_keypad, sc_height, putchr);
#else
#if MSDOS_COMPILER==WIN32C
- win32_init_term();
+ if (!no_init)
+ win32_init_term();
#endif
initcolor();
flush();
@@ -1454,24 +1521,22 @@ init()
public void
deinit()
{
- if (no_init)
- {
-#if MSDOS_COMPILER==WIN32C
- /* no_init or not, never trash win32 console colors. */
- SETCOLORS(sy_fg_color, sy_bg_color);
-#endif
- return;
- }
-
if (!init_done)
return;
#if !MSDOS_COMPILER
- tputs(sc_e_keypad, sc_height, putchr);
- tputs(sc_deinit, sc_height, putchr);
+ if (!no_keypad)
+ tputs(sc_e_keypad, sc_height, putchr);
+ if (!no_init)
+ tputs(sc_deinit, sc_height, putchr);
#else
+ /* Restore system colors. */
SETCOLORS(sy_fg_color, sy_bg_color);
#if MSDOS_COMPILER==WIN32C
- win32_deinit_term();
+ if (!no_init)
+ win32_deinit_term();
+#else
+ /* Need clreol to make SETCOLORS take effect. */
+ clreol();
#endif
#endif
init_done = 0;
@@ -1547,6 +1612,7 @@ add_line()
#endif
}
+#if 0
/*
* Remove the n topmost lines and scroll everything below it in the
* window upward. This is needed to stop leaking the topmost line
@@ -1600,6 +1666,105 @@ remove_top(n)
goto_line(sc_height - n - 1);
#endif
}
+#endif
+
+#if MSDOS_COMPILER==WIN32C
+/*
+ * Clear the screen.
+ */
+ static void
+win32_clear()
+{
+ /*
+ * This will clear only the currently visible rows of the NT
+ * console buffer, which means none of the precious scrollback
+ * rows are touched making for faster scrolling. Note that, if
+ * the window has fewer columns than the console buffer (i.e.
+ * there is a horizontal scrollbar as well), the entire width
+ * of the visible rows will be cleared.
+ */
+ COORD topleft;
+ DWORD nchars;
+ DWORD winsz;
+ CONSOLE_SCREEN_BUFFER_INFO csbi;
+
+ /* get the number of cells in the current buffer */
+ GetConsoleScreenBufferInfo(con_out, &csbi);
+ winsz = csbi.dwSize.X * (csbi.srWindow.Bottom - csbi.srWindow.Top + 1);
+ topleft.X = 0;
+ topleft.Y = csbi.srWindow.Top;
+
+ curr_attr = MAKEATTR(nm_fg_color, nm_bg_color);
+ FillConsoleOutputCharacter(con_out, ' ', winsz, topleft, &nchars);
+ FillConsoleOutputAttribute(con_out, curr_attr, winsz, topleft, &nchars);
+}
+
+/*
+ * Remove the n topmost lines and scroll everything below it in the
+ * window upward.
+ */
+ public void
+win32_scroll_up(n)
+ int n;
+{
+ SMALL_RECT rcSrc, rcClip;
+ CHAR_INFO fillchar;
+ COORD topleft;
+ COORD new_org;
+ DWORD nchars;
+ DWORD size;
+ CONSOLE_SCREEN_BUFFER_INFO csbi;
+
+ if (n <= 0)
+ return;
+
+ if (n >= sc_height - 1)
+ {
+ win32_clear();
+ _settextposition(1,1);
+ return;
+ }
+
+ /* Get the extent of what will remain visible after scrolling. */
+ GetConsoleScreenBufferInfo(con_out, &csbi);
+ rcSrc.Left = csbi.srWindow.Left;
+ rcSrc.Top = csbi.srWindow.Top + n;
+ rcSrc.Right = csbi.srWindow.Right;
+ rcSrc.Bottom = csbi.srWindow.Bottom;
+
+ /* Get the clip rectangle. */
+ rcClip.Left = rcSrc.Left;
+ rcClip.Top = csbi.srWindow.Top;
+ rcClip.Right = rcSrc.Right;
+ rcClip.Bottom = rcSrc.Bottom ;
+
+ /* Move the source text to the top of the screen. */
+ new_org.X = rcSrc.Left;
+ new_org.Y = 0;
+
+ /* Fill the right character and attributes. */
+ fillchar.Char.AsciiChar = ' ';
+ fillchar.Attributes = MAKEATTR(nm_fg_color, nm_bg_color);
+
+ /* Scroll the window. */
+ SetConsoleTextAttribute(con_out, fillchar.Attributes);
+ ScrollConsoleScreenBuffer(con_out, &rcSrc, &rcClip, new_org, &fillchar);
+
+ /* Clear remaining lines at bottom. */
+ topleft.X = csbi.dwCursorPosition.X;
+ topleft.Y = rcSrc.Bottom - n;
+ size = (n * csbi.dwSize.X) + (rcSrc.Right - topleft.X);
+ FillConsoleOutputCharacter(con_out, ' ', size, topleft,
+ &nchars);
+ FillConsoleOutputAttribute(con_out, fillchar.Attributes, size, topleft,
+ &nchars);
+ SetConsoleTextAttribute(con_out, curr_attr);
+
+ /* Move cursor n lines up from where it was. */
+ csbi.dwCursorPosition.Y -= n;
+ SetConsoleCursorPosition(con_out, csbi.dwCursorPosition);
+}
+#endif
/*
* Move cursor to lower left corner of screen.
@@ -1795,7 +1960,7 @@ vbell()
beep()
{
#if !MSDOS_COMPILER
- putchr('\7');
+ putchr(CONTROL('G'));
#else
#if MSDOS_COMPILER==WIN32C
MessageBeep(0);
@@ -1828,30 +1993,7 @@ clear()
#else
flush();
#if MSDOS_COMPILER==WIN32C
- /*
- * This will clear only the currently visible rows of the NT
- * console buffer, which means none of the precious scrollback
- * rows are touched making for faster scrolling. Note that, if
- * the window has fewer columns than the console buffer (i.e.
- * there is a horizontal scrollbar as well), the entire width
- * of the visible rows will be cleared.
- */
- {
- COORD topleft;
- DWORD nchars;
- DWORD winsz;
- CONSOLE_SCREEN_BUFFER_INFO csbi;
-
- /* get the number of cells in the current buffer */
- GetConsoleScreenBufferInfo(con_out, &csbi);
- winsz = csbi.dwSize.X * (csbi.srWindow.Bottom - csbi.srWindow.Top + 1);
- topleft.X = 0;
- topleft.Y = csbi.srWindow.Top;
-
- curr_attr = MAKEATTR(nm_fg_color, nm_bg_color);
- FillConsoleOutputCharacter(con_out, ' ', winsz, topleft, &nchars);
- FillConsoleOutputAttribute(con_out, curr_attr, winsz, topleft, &nchars);
- }
+ win32_clear();
#else
_clearscreen(_GCLEARSCREEN);
#endif
diff --git a/contrib/less/scrsize.c b/contrib/less/scrsize.c
new file mode 100644
index 000000000000..5f28c736ee97
--- /dev/null
+++ b/contrib/less/scrsize.c
@@ -0,0 +1,104 @@
+/*
+ * Copyright (C) 1984-2001 Mark Nudelman
+ *
+ * You may distribute under the terms of either the GNU General Public
+ * License or the Less License, as specified in the README file.
+ *
+ * For more information about less, or for information on how to
+ * contact the author, see the README file.
+ */
+
+/*
+ * This program is used to determine the screen dimensions on OS/2 systems.
+ * Adapted from code written by Kyosuke Tokoro (NBG01720@nifty.ne.jp).
+ */
+
+/*
+ * When I wrote this routine, I consulted some part of the source code
+ * of the xwininfo utility by X Consortium.
+ *
+ * Copyright (c) 1987, X Consortium
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the X Consortium shall not
+ * be used in advertising or otherwise to promote the sale, use or other
+ * dealings in this Software without prior written authorization from the X
+ * Consortium.
+ */
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+static int get_winsize(dpy, window, p_width, p_height)
+ Display *dpy;
+ Window window;
+ int *p_width;
+ int *p_height;
+{
+ XWindowAttributes win_attributes;
+ XSizeHints hints;
+ long longjunk;
+
+ if (!XGetWindowAttributes(dpy, window, &win_attributes))
+ return 1;
+ if (!XGetWMNormalHints(dpy, window, &hints, &longjunk))
+ return 1;
+ if (!(hints.flags & PResizeInc))
+ return 1;
+ if (hints.width_inc == 0 || hints.height_inc == 0)
+ return 1;
+ if (!(hints.flags & (PBaseSize|PMinSize)))
+ return 1;
+ if (hints.flags & PBaseSize)
+ {
+ win_attributes.width -= hints.base_width;
+ win_attributes.height -= hints.base_height;
+ } else
+ {
+ win_attributes.width -= hints.min_width;
+ win_attributes.height -= hints.min_height;
+ }
+ *p_width = win_attributes.width / hints.width_inc;
+ *p_height = win_attributes.height / hints.height_inc;
+ return 0;
+}
+
+int main(argc, argv)
+ int argc;
+ char *argv[];
+{
+ char *cp;
+ Display *dpy;
+ int size[2];
+
+ _scrsize(size);
+ cp = getenv("WINDOWID");
+ if (cp != NULL)
+ {
+ dpy = XOpenDisplay(NULL);
+ if (dpy != NULL)
+ {
+ get_winsize(dpy, (Window) atol(cp), &size[0], &size[1]);
+ XCloseDisplay(dpy);
+ }
+ }
+ printf("%i %i\n", size[0], size[1]);
+ return (0);
+}
diff --git a/contrib/less/search.c b/contrib/less/search.c
index 1aff4dfc83ba..31133fb0f005 100644
--- a/contrib/less/search.c
+++ b/contrib/less/search.c
@@ -1341,21 +1341,3 @@ regerror(s)
}
#endif
-#if !HAVE_STRCHR
-/*
- * strchr is used by regexp.c.
- */
- char *
-strchr(s, c)
- char *s;
- int c;
-{
- for ( ; *s != '\0'; s++)
- if (*s == c)
- return (s);
- if (c == '\0')
- return (s);
- return (NULL);
-}
-#endif
-
diff --git a/contrib/less/tags.c b/contrib/less/tags.c
index cf531a6a75e2..e559e776b06d 100644
--- a/contrib/less/tags.c
+++ b/contrib/less/tags.c
@@ -17,18 +17,154 @@
public char *tags = "tags";
-static char *tagfile;
-static char *tagpattern;
-static int taglinenum;
-static int tagendline;
+static int total;
+static int curseq;
extern int linenums;
extern int sigs;
-extern int jump_sline;
+
+enum tag_result {
+ TAG_FOUND,
+ TAG_NOFILE,
+ TAG_NOTAG,
+ TAG_NOTYPE,
+ TAG_INTR
+};
+
+/*
+ * Tag type
+ */
+enum {
+ T_CTAGS, /* 'tags': standard and extended format (ctags) */
+ T_CTAGS_X, /* stdin: cross reference format (ctags) */
+ T_GTAGS, /* 'GTAGS': function defenition (global) */
+ T_GRTAGS, /* 'GRTAGS': function reference (global) */
+ T_GSYMS, /* 'GSYMS': other symbols (global) */
+ T_GPATH /* 'GPATH': path name (global) */
+};
+
+static enum tag_result findctag();
+static enum tag_result findgtag();
+static char *nextgtag();
+static char *prevgtag();
+static POSITION ctagsearch();
+static POSITION gtagsearch();
+static int getentry();
+
+/*
+ * The list of tags generated by the last findgtag() call.
+ *
+ * Use either pattern or line number.
+ * findgtag() always uses line number, so pattern is always NULL.
+ * findctag() usually either pattern (in which case line number is 0),
+ * or line number (in which case pattern is NULL).
+ */
+struct taglist {
+ struct tag *tl_first;
+ struct tag *tl_last;
+};
+#define TAG_END ((struct tag *) &taglist)
+static struct taglist taglist = { TAG_END, TAG_END };
+struct tag {
+ struct tag *next, *prev; /* List links */
+ char *tag_file; /* Source file containing the tag */
+ int tag_linenum; /* Appropriate line number in source file */
+ char *tag_pattern; /* Pattern used to find the tag */
+ char tag_endline; /* True if the pattern includes '$' */
+};
+static struct tag *curtag;
+
+#define TAG_INS(tp) \
+ (tp)->next = taglist.tl_first; \
+ (tp)->prev = TAG_END; \
+ taglist.tl_first->prev = (tp); \
+ taglist.tl_first = (tp);
+
+#define TAG_RM(tp) \
+ (tp)->next->prev = (tp)->prev; \
+ (tp)->prev->next = (tp)->next;
+
+/*
+ * Delete tag structures.
+ */
+ public void
+cleantags()
+{
+ register struct tag *tp;
+
+ /*
+ * Delete any existing tag list.
+ * {{ Ideally, we wouldn't do this until after we know that we
+ * can load some other tag information. }}
+ */
+ while ((tp = taglist.tl_first) != TAG_END)
+ {
+ TAG_RM(tp);
+ free(tp);
+ }
+ curtag = NULL;
+ total = curseq = 0;
+}
/*
+ * Create a new tag entry.
+ */
+ static struct tag *
+maketagent(name, file, linenum, pattern, endline)
+ char *name;
+ char *file;
+ int linenum;
+ char *pattern;
+ int endline;
+{
+ register struct tag *tp;
+
+ tp = (struct tag *) ecalloc(sizeof(struct tag), 1);
+ tp->tag_file = (char *) ecalloc(strlen(file) + 1, sizeof(char));
+ strcpy(tp->tag_file, file);
+ tp->tag_linenum = linenum;
+ tp->tag_endline = endline;
+ if (pattern == NULL)
+ tp->tag_pattern = NULL;
+ else
+ {
+ tp->tag_pattern = (char *) ecalloc(strlen(pattern) + 1, sizeof(char));
+ strcpy(tp->tag_pattern, pattern);
+ }
+ return (tp);
+}
+
+/*
+ * Get tag mode.
+ */
+ public int
+gettagtype()
+{
+ int f;
+
+ if (strcmp(tags, "GTAGS") == 0)
+ return T_GTAGS;
+ if (strcmp(tags, "GRTAGS") == 0)
+ return T_GRTAGS;
+ if (strcmp(tags, "GSYMS") == 0)
+ return T_GSYMS;
+ if (strcmp(tags, "GPATH") == 0)
+ return T_GPATH;
+ if (strcmp(tags, "-") == 0)
+ return T_CTAGS_X;
+ f = open(tags, OPEN_READ);
+ if (f >= 0)
+ {
+ close(f);
+ return T_CTAGS;
+ }
+ return T_GTAGS;
+}
+
+/*
+ * Find tags in tag file.
* Find a tag in the "tags" file.
- * Sets "tagfile" to the name of the file containing the tag,
+ * Sets "tag_file" to the name of the file containing the tag,
* and "tagpattern" to the search pattern which should be used
* to find the tag.
*/
@@ -36,24 +172,122 @@ extern int jump_sline;
findtag(tag)
register char *tag;
{
+ int type = gettagtype();
+ enum tag_result result;
+
+ if (type == T_CTAGS)
+ result = findctag(tag);
+ else
+ result = findgtag(tag, type);
+ switch (result)
+ {
+ case TAG_FOUND:
+ case TAG_INTR:
+ break;
+ case TAG_NOFILE:
+ error("No tags file", NULL_PARG);
+ break;
+ case TAG_NOTAG:
+ error("No such tag in tags file", NULL_PARG);
+ break;
+ case TAG_NOTYPE:
+ error("unknown tag type", NULL_PARG);
+ break;
+ }
+}
+
+/*
+ * Search for a tag.
+ */
+ public POSITION
+tagsearch()
+{
+ if (curtag == NULL)
+ return (NULL_POSITION); /* No gtags loaded! */
+ if (curtag->tag_linenum != 0)
+ return gtagsearch();
+ else
+ return ctagsearch();
+}
+
+/*
+ * Go to the next tag.
+ */
+ public char *
+nexttag(n)
+ int n;
+{
+ char *tagfile;
+
+ while (n-- > 0)
+ tagfile = nextgtag();
+ return tagfile;
+}
+
+/*
+ * Go to the previous tag.
+ */
+ public char *
+prevtag(n)
+ int n;
+{
+ char *tagfile;
+
+ while (n-- > 0)
+ tagfile = prevgtag();
+ return tagfile;
+}
+
+/*
+ * Return the total number of tags.
+ */
+ public int
+ntags()
+{
+ return total;
+}
+
+/*
+ * Return the sequence number of current tag.
+ */
+ public int
+curr_tag()
+{
+ return curseq;
+}
+
+/*****************************************************************************
+ * ctags
+ */
+
+/*
+ * Find tags in the "tags" file.
+ * Sets curtag to the first tag entry.
+ */
+ static enum tag_result
+findctag(tag)
+ register char *tag;
+{
char *p;
- char *q;
register FILE *f;
register int taglen;
+ register int taglinenum;
+ char *tagfile;
+ char *tagpattern;
+ int tagendline;
int search_char;
int err;
char tline[TAGLINE_SIZE];
+ struct tag *tp;
p = unquote_file(tags);
f = fopen(p, "r");
free(p);
if (f == NULL)
- {
- error("No tags file", NULL_PARG);
- tagfile = NULL;
- return;
- }
+ return TAG_NOFILE;
+ cleantags();
+ total = 0;
taglen = strlen(tag);
/*
@@ -61,6 +295,9 @@ findtag(tag)
*/
while (fgets(tline, sizeof(tline), f) != NULL)
{
+ if (tline[0] == '!')
+ /* Skip header of extended format. */
+ continue;
if (strncmp(tag, tline, taglen) != 0 || !WHITESP(tline[taglen]))
continue;
@@ -72,8 +309,7 @@ findtag(tag)
* or a search pattern surrounded by a pair of delimiters.
* Parse the line and extract these parts.
*/
- tagfile = tagpattern = NULL;
- taglinenum = 0;
+ tagpattern = NULL;
/*
* Skip over the whitespace after the tag name.
@@ -95,7 +331,6 @@ findtag(tag)
if (*p == '\0')
/* Pattern is missing! */
continue;
- tagfile = save(tagfile);
/*
* First see if it is a line number.
@@ -113,39 +348,39 @@ findtag(tag)
search_char = *p++;
if (*p == '^')
p++;
- tagpattern = (char *) ecalloc(strlen(p)+1, sizeof(char));
- q = tagpattern;
+ tagpattern = p;
while (*p != search_char && *p != '\0')
{
if (*p == '\\')
p++;
- *q++ = *p++;
+ p++;
}
- tagendline = (q[-1] == '$');
+ tagendline = (p[-1] == '$');
if (tagendline)
- q--;
- *q = '\0';
+ p--;
+ *p = '\0';
}
-
- fclose(f);
- return;
+ tp = maketagent(tag, tagfile, taglinenum, tagpattern, tagendline);
+ TAG_INS(tp);
+ total++;
}
fclose(f);
- error("No such tag in tags file", NULL_PARG);
- tagfile = NULL;
+ if (total == 0)
+ return TAG_NOTAG;
+ curtag = taglist.tl_first;
+ curseq = 1;
+ return TAG_FOUND;
}
+/*
+ * Edit current tagged file.
+ */
public int
edit_tagfile()
{
- int r;
-
- if (tagfile == NULL)
+ if (curtag == NULL)
return (1);
- r = edit(tagfile);
- free(tagfile);
- tagfile = NULL;
- return (r);
+ return (edit(curtag->tag_file));
}
/*
@@ -157,21 +392,14 @@ edit_tagfile()
* regcmp vs. re_comp) behave differently in the presence of
* parentheses (which are almost always found in a tag).
*/
- public POSITION
-tagsearch()
+ static POSITION
+ctagsearch()
{
POSITION pos, linepos;
int linenum;
int len;
char *line;
- /*
- * If we have the line number of the tag instead of the pattern,
- * just use find_pos.
- */
- if (taglinenum)
- return (find_pos(taglinenum));
-
pos = ch_zero();
linenum = find_linenum(pos);
@@ -217,15 +445,311 @@ tagsearch()
* If tagendline is set, make sure we match all
* the way to end of line (no extra chars after the match).
*/
- len = strlen(tagpattern);
- if (strncmp(tagpattern, line, len) == 0 &&
- (!tagendline || line[len] == '\0' || line[len] == '\r'))
+ len = strlen(curtag->tag_pattern);
+ if (strncmp(curtag->tag_pattern, line, len) == 0 &&
+ (!curtag->tag_endline || line[len] == '\0' || line[len] == '\r'))
+ {
+ curtag->tag_linenum = find_linenum(linepos);
break;
+ }
}
- free(tagpattern);
- tagpattern = NULL;
return (linepos);
}
+/*******************************************************************************
+ * gtags
+ */
+
+/*
+ * Find tags in the GLOBAL's tag file.
+ * The findgtag() will try and load information about the requested tag.
+ * It does this by calling "global -x tag" and storing the parsed output
+ * for future use by gtagsearch().
+ * Sets curtag to the first tag entry.
+ */
+ static enum tag_result
+findgtag(tag, type)
+ char *tag; /* tag to load */
+ int type; /* tags type */
+{
+ char buf[256];
+ FILE *fp;
+ struct tag *tp;
+
+ if (type != T_CTAGS_X && tag == NULL)
+ return TAG_NOFILE;
+
+ cleantags();
+ total = 0;
+
+ /*
+ * If type == T_CTAGS_X then read ctags's -x format from stdin
+ * else execute global(1) and read from it.
+ */
+ if (type == T_CTAGS_X)
+ {
+ fp = stdin;
+ /* Set tag default because we cannot read stdin again. */
+ tags = "tags";
+ } else
+ {
+#if !HAVE_POPEN
+ return TAG_NOFILE;
+#else
+ char command[512];
+ char *flag;
+ char *cmd = lgetenv("LESSGLOBALTAGS");
+
+ if (cmd == NULL || *cmd == '\0')
+ return TAG_NOFILE;
+ /* Get suitable flag value for global(1). */
+ switch (type)
+ {
+ case T_GTAGS:
+ flag = "" ;
+ break;
+ case T_GRTAGS:
+ flag = "r";
+ break;
+ case T_GSYMS:
+ flag = "s";
+ break;
+ case T_GPATH:
+ flag = "P";
+ break;
+ default:
+ return TAG_NOTYPE;
+ }
+
+ /* Get our data from global(1). */
+ tag = esc_metachars(tag);
+ sprintf(command, "%s -x%s %s", cmd, flag, tag);
+ free(tag);
+ fp = popen(command, "r");
+#endif
+ }
+ if (fp != NULL)
+ {
+ while (fgets(buf, sizeof(buf), fp))
+ {
+ char *name, *file, *line;
+
+ if (sigs)
+ {
+#if HAVE_POPEN
+ if (fp != stdin)
+ pclose(fp);
+#endif
+ return TAG_INTR;
+ }
+ if (buf[strlen(buf) - 1] == '\n')
+ buf[strlen(buf) - 1] = 0;
+ else
+ {
+ int c;
+ do {
+ c = fgetc(fp);
+ } while (c != '\n' && c != EOF);
+ }
+
+ if (getentry(buf, &name, &file, &line))
+ {
+ /*
+ * Couldn't parse this line for some reason.
+ * We'll just pretend it never happened.
+ */
+ break;
+ }
+
+ /* Make new entry and add to list. */
+ tp = maketagent(name, file, atoi(line), NULL, 0);
+ TAG_INS(tp);
+ total++;
+ }
+ if (fp != stdin)
+ {
+ if (pclose(fp))
+ {
+ curtag = NULL;
+ total = curseq = 0;
+ return TAG_NOFILE;
+ }
+ }
+ }
+
+ /* Check to see if we found anything. */
+ tp = taglist.tl_first;
+ if (tp == TAG_END)
+ return TAG_NOTAG;
+ curtag = tp;
+ curseq = 1;
+ return TAG_FOUND;
+}
+
+static int circular = 0; /* 1: circular tag structure */
+
+/*
+ * Return the filename required for the next gtag in the queue that was setup
+ * by findgtag(). The next call to gtagsearch() will try to position at the
+ * appropriate tag.
+ */
+ static char *
+nextgtag()
+{
+ struct tag *tp;
+
+ if (curtag == NULL)
+ /* No tag loaded */
+ return NULL;
+
+ tp = curtag->next;
+ if (tp == TAG_END)
+ {
+ if (!circular)
+ return NULL;
+ /* Wrapped around to the head of the queue */
+ curtag = taglist.tl_first;
+ curseq = 1;
+ } else
+ {
+ curtag = tp;
+ curseq++;
+ }
+ return (curtag->tag_file);
+}
+
+/*
+ * Return the filename required for the previous gtag in the queue that was
+ * setup by findgtat(). The next call to gtagsearch() will try to position
+ * at the appropriate tag.
+ */
+ static char *
+prevgtag()
+{
+ struct tag *tp;
+
+ if (curtag == NULL)
+ /* No tag loaded */
+ return NULL;
+
+ tp = curtag->prev;
+ if (tp == TAG_END)
+ {
+ if (!circular)
+ return NULL;
+ /* Wrapped around to the tail of the queue */
+ curtag = taglist.tl_last;
+ curseq = total;
+ } else
+ {
+ curtag = tp;
+ curseq--;
+ }
+ return (curtag->tag_file);
+}
+
+/*
+ * Position the current file at at what is hopefully the tag that was chosen
+ * using either findtag() or one of nextgtag() and prevgtag(). Returns -1
+ * if it was unable to position at the tag, 0 if succesful.
+ */
+ static POSITION
+gtagsearch()
+{
+ if (curtag == NULL)
+ return (NULL_POSITION); /* No gtags loaded! */
+ return (find_pos(curtag->tag_linenum));
+}
+
+/*
+ * The getentry() parses both standard and extended ctags -x format.
+ *
+ * [standard format]
+ * <tag> <lineno> <file> <image>
+ * +------------------------------------------------
+ * |main 30 main.c main(argc, argv)
+ * |func 21 subr.c func(arg)
+ *
+ * The following commands write this format.
+ * o Traditinal Ctags with -x option
+ * o Global with -x option
+ * See <http://www.gnu.org/software/global/global.html>
+ *
+ * [extended format]
+ * <tag> <type> <lineno> <file> <image>
+ * +----------------------------------------------------------
+ * |main function 30 main.c main(argc, argv)
+ * |func function 21 subr.c func(arg)
+ *
+ * The following commands write this format.
+ * o Exuberant Ctags with -x option
+ * See <http://ctags.sourceforge.net>
+ *
+ * Returns 0 on success, -1 on error.
+ * The tag, file, and line will each be NUL-terminated pointers
+ * into buf.
+ */
+
+#ifndef isspace
+#define isspace(c) ((c) == ' ' || (c) == '\t' || (c) == '\n' || (c) == '\r' || (c) == '\f')
+#endif
+#ifndef isdigit
+#define isdigit(c) ((c) >= '0' && (c <= '9'))
+#endif
+
+ static int
+getentry(buf, tag, file, line)
+ char *buf; /* standard or extended ctags -x format data */
+ char **tag; /* name of the tag we actually found */
+ char **file; /* file in which to find this tag */
+ char **line; /* line number of file where this tag is found */
+{
+ char *p = buf;
+
+ for (*tag = p; *p && !isspace(*p); p++) /* tag name */
+ ;
+ if (*p == 0)
+ return (-1);
+ *p++ = 0;
+ for ( ; *p && isspace(*p); p++) /* (skip blanks) */
+ ;
+ if (*p == 0)
+ return (-1);
+ /*
+ * If the second part begin with other than digit,
+ * it is assumed tag type. Skip it.
+ */
+ if (!isdigit(*p))
+ {
+ for ( ; *p && !isspace(*p); p++) /* (skip tag type) */
+ ;
+ for (; *p && isspace(*p); p++) /* (skip blanks) */
+ ;
+ }
+ if (!isdigit(*p))
+ return (-1);
+ *line = p; /* line number */
+ for (*line = p; *p && !isspace(*p); p++)
+ ;
+ if (*p == 0)
+ return (-1);
+ *p++ = 0;
+ for ( ; *p && isspace(*p); p++) /* (skip blanks) */
+ ;
+ if (*p == 0)
+ return (-1);
+ *file = p; /* file name */
+ for (*file = p; *p && !isspace(*p); p++)
+ ;
+ if (*p == 0)
+ return (-1);
+ *p = 0;
+
+ /* value check */
+ if (strlen(*tag) && strlen(*line) && strlen(*file) && atoi(*line) > 0)
+ return (0);
+ return (-1);
+}
+
#endif
diff --git a/contrib/less/ttyin.c b/contrib/less/ttyin.c
index ef87e2586cd8..b342ed9a5bbb 100644
--- a/contrib/less/ttyin.c
+++ b/contrib/less/ttyin.c
@@ -14,6 +14,10 @@
*/
#include "less.h"
+#if OS2
+#include "cmd.h"
+#include "pckeys.h"
+#endif
#if MSDOS_COMPILER==WIN32C
#include "windows.h"
extern char WIN32getch();
@@ -42,7 +46,7 @@ open_getchr()
/* Make sure we get Ctrl+C events. */
SetConsoleMode((HANDLE)tty, ENABLE_PROCESSED_INPUT);
#else
-#if MSDOS_COMPILER || OS2
+#if MSDOS_COMPILER
extern int fd0;
/*
* Open a new handle to CON: in binary mode
@@ -65,7 +69,12 @@ open_getchr()
* which in Unix is usually attached to the screen,
* but also usually lets you read from the keyboard.
*/
+#if OS2
+ /* The __open() system call translates "/dev/tty" to "con". */
+ tty = __open("/dev/tty", OPEN_READ);
+#else
tty = open("/dev/tty", OPEN_READ);
+#endif
if (tty < 0)
tty = 2;
#endif
@@ -111,30 +120,6 @@ getchr()
if (c == '\003')
return (READ_INTR);
#else
-#if OS2
- {
- static int scan = -1;
- flush();
- if (scan >= 0)
- {
- c = scan;
- scan = -1;
- } else
- {
- if ((c = _read_kbd(0, 1, 0)) == -1)
- return (READ_INTR);
- if (c == '\0')
- {
- /*
- * Zero is usually followed by another byte,
- * since certain keys send two bytes.
- */
- scan = _read_kbd(0, 0, 0);
- }
- }
- result = 1;
- }
-#else
result = iread(tty, &c, sizeof(char));
if (result == READ_INTR)
return (READ_INTR);
@@ -147,7 +132,6 @@ getchr()
quit(QUIT_ERROR);
}
#endif
-#endif
/*
* Various parts of the program cannot handle
* an input character of '\0'.
diff --git a/contrib/less/version.c b/contrib/less/version.c
index d43d0ff9276d..32a3c8884c0c 100644
--- a/contrib/less/version.c
+++ b/contrib/less/version.c
@@ -600,6 +600,31 @@ v356 7/5/00 Add -J option.
v357 7/6/00 Support sigprocmask.
-----------------------------------------------------------------
v358 7/8/00 Fix problems with #stop in lesskey file.
+ Posted to Web page.
+-----------------------------------------------------------------
+v359 9/10/00 Fixes for Win32 display problems (thanks to Maurizio Vairani).
+v360 1/17/01 Move sysless to etc.
+v361 12/4/01 Add IBM-1047 charset & EBCDIC fixes (thanks to Thomas Dorner).
+ Fix 32 bit dependencies (thanks to Paul Eggert).
+ Fix UTF-8 overstriking (thanks to Robert Brady).
+v362 12/4/01 Make status column show search targets.
+v363 12/6/01 Add --no-keypad option.
+ Add variable width tabstops (thanks to Peter Samuelson).
+v364 12/10/01 Better handling of very long lines in input;
+ Fix horizontal shifting of colored text.
+v365 12/11/01 Fix overstriking of tabs;
+ Add support for global(1) and multiple tag matches
+ (thanks to Shigio Yamaguchi and Tim Vanderhoek).
+v366 12/11/01 Fixes for OS/2 (thanks to Kyosuke Tokoro).
+v367 12/13/01 Allow -D and -x options to terminate without dollar sign;
+ Right/left arrow when entering N are shift cmds, not line edit.
+v368 12/18/01 Update lesskey commands.
+v370 12/23/01 Fix tags error messages.
+ Posted to Web page.
+-----------------------------------------------------------------
+v371 12/26/01 Fix new_file bug; use popen in Windows version;
+ fix some compiler warnings.
+
*/
-char version[] = "358";
+char version[] = "371";