Vendor import of less v443.

This commit is contained in:
Xin LI 2011-05-09 18:30:23 +00:00
parent f4cb5a505f
commit ed915d8294
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/vendor/less/dist/; revision=221706
svn path=/vendor/less/v443/; revision=221707; tag=vendor/less/v443
66 changed files with 2860 additions and 4996 deletions

View File

@ -2,7 +2,7 @@
------------
Less
Copyright (C) 1984-2009 Mark Nudelman
Copyright (C) 1984-2011 Mark Nudelman
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions

View File

@ -34,6 +34,14 @@ DISTFILES = \
all: help.c funcs.h ${srcdir}/configure
release: .FORCE
${MAKE} -f Makefile.aut tagall
${MAKE} -f Makefile.aut all
${MAKE} -f Makefile.aut clean
${MAKE} -f Makefile.aut dist
.FORCE:
help.c: less.hlp mkhelp
-mv -f ${srcdir}/help.c ${srcdir}/help.c.old
rm -rf help.c

View File

@ -7,11 +7,11 @@ CC = cl
# Normal flags
CFLAGS = /nologo /ML /W3 /GX /O2 /I "." /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /c
LDFLAGS = /subsystem:console /incremental:no /machine:I386
LDFLAGS = /nologo /subsystem:console /incremental:no /machine:I386
# Debugging flags
#CFLAGS = /nologo /MDd /W3 /GX /Od /Gm /Zi /I "." /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /c
#LDFLAGS = /subsystem:console /incremental:yes /debug /machine:I386
#LDFLAGS = /nologo /subsystem:console /incremental:yes /debug /machine:I386
LD = link
LIBS = user32.lib

31
NEWS
View File

@ -10,6 +10,37 @@
To report bugs, suggestions or comments, send email to
bug-less@gnu.org or markn@greenwoodsoftware.com.
======================================================================
Major changes between "less" versions 436 and 443
* Change search behavior such that when a search is given an explicit
pattern, the entire displayed screen is included in the search and
not just the portion after the target line.
* Add -A option to change search behavior to the old way: only
the portion of the screen after the target line is searched.
* Add %F formatting to prompt strings, replaced by the last component
of the input file.
* Control-G while editing a command exits the command.
* Less now exits with status 2 if control-C is pressed and -K is in effect.
* Fix "ungetc overflow" when passing long commands via the -p option.
* Fix bug in using line filtering via the & command
in combination with -i and -I.
* Fix bug in handling negative arguments to the -j option.
* Fix bug in handling %t in prompt strings.
* Improve handling of long option names.
* Improve percentage calculation for very large files.
======================================================================
Major changes between "less" versions 429 and 436

8
README
View File

@ -1,7 +1,7 @@
Less, version 436
Less, version 443
This is the distribution of less, version 436, released 07 Jul 2009.
This is the distribution of less, version 443, released 09 Apr 2011.
This program is part of the GNU project (http://www.gnu.org).
This program is free software. You may redistribute it and/or
@ -93,6 +93,10 @@ 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 }}.
(Note that the above note was originally written at a time when
"hackers" most commonly meant "enthusiastic and dedicated computer
programmers", not "persons who attempt to circumvent computer security".)
=======================================================================

2
brac.c
View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 1984-2009 Mark Nudelman
* Copyright (C) 1984-2011 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.

2
ch.c
View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 1984-2009 Mark Nudelman
* Copyright (C) 1984-2011 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.

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 1984-2009 Mark Nudelman
* Copyright (C) 1984-2011 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.
@ -395,7 +395,7 @@ init_charset()
binary_char(c)
LWCHAR c;
{
if (utf_mode)
if (utf_mode)
return (is_ubin_char(c));
c &= 0377;
return (chardef[c] & IS_BINARY_CHAR);
@ -817,7 +817,7 @@ static struct wchar_range ubin_table[] = {
{ 0x000B, 0x000C} /* Cc */,
{ 0x000E, 0x001A} /* Cc */,
{ 0x001C, 0x001F} /* Cc */,
{ 0x007F, 0x009F} /* Cc */,
{ 0x007F, 0x009F} /* Cc */,
#if 0
{ 0x00AD, 0x00AD} /* Cf */,
#endif

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2005-2009 Mark Nudelman
* Copyright (C) 2005-2011 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.

3
cmd.h
View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 1984-2009 Mark Nudelman
* Copyright (C) 1984-2011 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.
@ -98,6 +98,7 @@
#define EC_F_COMPLETE 17
#define EC_B_COMPLETE 18
#define EC_LITERAL 19
#define EC_ABORT 20
#define EC_NOACTION 101
#define EC_UINVALID 102

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 1984-2009 Mark Nudelman
* Copyright (C) 1984-2011 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.
@ -857,6 +857,10 @@ cmd_edit(c)
case EC_LINEKILL:
not_in_completion();
return (cmd_kill());
case EC_ABORT:
not_in_completion();
(void) cmd_kill();
return (CC_QUIT);
case EC_W_BACKSPACE:
not_in_completion();
return (cmd_werase());

564
command.c
View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 1984-2009 Mark Nudelman
* Copyright (C) 1984-2011 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.
@ -55,8 +55,6 @@ extern int shift_count;
extern int oldbot;
extern int forw_prompt;
static char ungot[UNGOT_SIZE];
static char *ungotp = NULL;
#if SHELL_ESCAPE
static char *shellcmd = NULL; /* For holding last shell command for "!!" */
#endif
@ -64,7 +62,8 @@ static int mca; /* The multicharacter command (action) */
static int search_type; /* The previous type of search */
static LINENUM number; /* The number typed by the user */
static long fraction; /* The fractional part of the number */
static char optchar;
static struct loption *curropt;
static int opt_lower;
static int optflag;
static int optgetname;
static POSITION bottompos;
@ -73,6 +72,13 @@ static int save_hshift;
static char pipec;
#endif
struct ungot {
struct ungot *ug_next;
char ug_char;
};
static struct ungot* ungot = NULL;
static int unget_end = 0;
static void multi_search();
/*
@ -226,8 +232,8 @@ exec_mca()
every_first_cmd = save(cbuf);
break;
case A_OPT_TOGGLE:
toggle_option(optchar, cbuf, optflag);
optchar = '\0';
toggle_option(curropt, opt_lower, cbuf, optflag);
curropt = NULL;
break;
case A_F_BRACKET:
match_brac(cbuf[0], cbuf[1], 1, (int) number);
@ -280,22 +286,249 @@ exec_mca()
}
/*
* Add a character to a multi-character command.
* Is a character an erase or kill char?
*/
static int
is_erase_char(c)
int c;
{
return (c == erase_char || c == erase2_char || c == kill_char);
}
/*
* Handle the first char of an option (after the initial dash).
*/
static int
mca_opt_first_char(c)
{
int flag = (optflag & ~OPT_NO_PROMPT);
if (flag == OPT_NO_TOGGLE)
{
switch (c)
{
case '_':
/* "__" = long option name. */
optgetname = TRUE;
mca_opt_toggle();
return (MCA_MORE);
}
} else
{
switch (c)
{
case '+':
/* "-+" = UNSET. */
optflag = (flag == OPT_UNSET) ?
OPT_TOGGLE : OPT_UNSET;
mca_opt_toggle();
return (MCA_MORE);
case '!':
/* "-!" = SET */
optflag = (flag == OPT_SET) ?
OPT_TOGGLE : OPT_SET;
mca_opt_toggle();
return (MCA_MORE);
case CONTROL('P'):
optflag ^= OPT_NO_PROMPT;
mca_opt_toggle();
return (MCA_MORE);
case '-':
/* "--" = long option name. */
optgetname = TRUE;
mca_opt_toggle();
return (MCA_MORE);
}
}
/* Char was not handled here. */
return (NO_MCA);
}
/*
* Add a char to a long option name.
* See if we've got a match for an option name yet.
* If so, display the complete name and stop
* accepting chars until user hits RETURN.
*/
static int
mca_opt_nonfirst_char(c)
int c;
{
char *p;
char *oname;
if (curropt != NULL)
{
/*
* Already have a match for the name.
* Don't accept anything but erase/kill.
*/
if (is_erase_char(c))
return (MCA_DONE);
return (MCA_MORE);
}
/*
* Add char to cmd buffer and try to match
* the option name.
*/
if (cmd_char(c) == CC_QUIT)
return (MCA_DONE);
p = get_cmdbuf();
opt_lower = ASCII_IS_LOWER(p[0]);
curropt = findopt_name(&p, &oname, NULL);
if (curropt != NULL)
{
/*
* Got a match.
* Remember the option and
* display the full option name.
*/
cmd_reset();
mca_opt_toggle();
for (p = oname; *p != '\0'; p++)
{
c = *p;
if (!opt_lower && ASCII_IS_LOWER(c))
c = ASCII_TO_UPPER(c);
if (cmd_char(c) != CC_OK)
return (MCA_DONE);
}
}
return (MCA_MORE);
}
/*
* Handle a char of an option toggle command.
*/
static int
mca_opt_char(c)
int c;
{
PARG parg;
/*
* This may be a short option (single char),
* or one char of a long option name,
* or one char of the option parameter.
*/
if (curropt == NULL && len_cmdbuf() == 0)
{
int ret = mca_opt_first_char(c);
if (ret != NO_MCA)
return (ret);
}
if (optgetname)
{
/* We're getting a long option name. */
if (c != '\n' && c != '\r')
return (mca_opt_nonfirst_char(c));
if (curropt == NULL)
{
parg.p_string = get_cmdbuf();
error("There is no --%s option", &parg);
return (MCA_DONE);
}
optgetname = FALSE;
cmd_reset();
} else
{
if (is_erase_char(c))
return (NO_MCA);
if (curropt != NULL)
/* We're getting the option parameter. */
return (NO_MCA);
curropt = findopt(c);
if (curropt == NULL)
{
parg.p_string = propt(c);
error("There is no %s option", &parg);
return (MCA_DONE);
}
}
/*
* If the option which was entered does not take a
* parameter, toggle the option immediately,
* so user doesn't have to hit RETURN.
*/
if ((optflag & ~OPT_NO_PROMPT) != OPT_TOGGLE ||
!opt_has_param(curropt))
{
toggle_option(curropt, ASCII_IS_LOWER(c), "", optflag);
return (MCA_DONE);
}
/*
* Display a prompt appropriate for the option parameter.
*/
start_mca(A_OPT_TOGGLE, opt_prompt(curropt), (void*)NULL, 0);
return (MCA_MORE);
}
/*
* Handle a char of a search command.
*/
static int
mca_search_char(c)
int c;
{
int flag = 0;
/*
* Certain characters as the first char of
* the pattern have special meaning:
* ! Toggle the NO_MATCH flag
* * Toggle the PAST_EOF flag
* @ Toggle the FIRST_FILE flag
*/
if (len_cmdbuf() > 0)
return (NO_MCA);
switch (c)
{
case CONTROL('E'): /* ignore END of file */
case '*':
if (mca != A_FILTER)
flag = SRCH_PAST_EOF;
break;
case CONTROL('F'): /* FIRST file */
case '@':
if (mca != A_FILTER)
flag = SRCH_FIRST_FILE;
break;
case CONTROL('K'): /* KEEP position */
if (mca != A_FILTER)
flag = SRCH_NO_MOVE;
break;
case CONTROL('R'): /* Don't use REGULAR EXPRESSIONS */
flag = SRCH_NO_REGEX;
break;
case CONTROL('N'): /* NOT match */
case '!':
flag = SRCH_NO_MATCH;
break;
}
if (flag != 0)
{
search_type ^= flag;
mca_search();
return (MCA_MORE);
}
return (NO_MCA);
}
/*
* Handle a character of a multi-character command.
*/
static int
mca_char(c)
int c;
{
char *p;
int flag;
char buf[3];
PARG parg;
int ret;
switch (mca)
{
case 0:
/*
* Not in a multicharacter command.
* We're not in a multicharacter command.
*/
return (NO_MCA);
@ -318,7 +551,8 @@ mca_char(c)
{
/*
* Not part of the number.
* Treat as a normal command character.
* End the number and treat this char
* as a normal command character.
*/
number = cmd_int(&fraction);
mca = 0;
@ -328,214 +562,26 @@ mca_char(c)
break;
case A_OPT_TOGGLE:
/*
* Special case for the TOGGLE_OPTION command.
* If the option letter which was entered is a
* single-char option, execute the command immediately,
* so user doesn't have to hit RETURN.
* If the first char is + or -, this indicates
* OPT_UNSET or OPT_SET respectively, instead of OPT_TOGGLE.
* "--" begins inputting a long option name.
*/
if (optchar == '\0' && len_cmdbuf() == 0)
{
flag = (optflag & ~OPT_NO_PROMPT);
if (flag == OPT_NO_TOGGLE)
{
switch (c)
{
case '_':
/* "__" = long option name. */
optgetname = TRUE;
mca_opt_toggle();
return (MCA_MORE);
}
} else
{
switch (c)
{
case '+':
/* "-+" = UNSET. */
optflag = (flag == OPT_UNSET) ?
OPT_TOGGLE : OPT_UNSET;
mca_opt_toggle();
return (MCA_MORE);
case '!':
/* "-!" = SET */
optflag = (flag == OPT_SET) ?
OPT_TOGGLE : OPT_SET;
mca_opt_toggle();
return (MCA_MORE);
case CONTROL('P'):
optflag ^= OPT_NO_PROMPT;
mca_opt_toggle();
return (MCA_MORE);
case '-':
/* "--" = long option name. */
optgetname = TRUE;
mca_opt_toggle();
return (MCA_MORE);
}
}
}
if (optgetname)
{
/*
* We're getting a long option name.
* See if we've matched an option name yet.
* If so, display the complete name and stop
* accepting chars until user hits RETURN.
*/
struct loption *o;
char *oname;
int lc;
if (c == '\n' || c == '\r')
{
/*
* When the user hits RETURN, make sure
* we've matched an option name, then
* pretend he just entered the equivalent
* option letter.
*/
if (optchar == '\0')
{
parg.p_string = get_cmdbuf();
error("There is no --%s option", &parg);
return (MCA_DONE);
}
optgetname = FALSE;
cmd_reset();
c = optchar;
} else
{
if (optchar != '\0')
{
/*
* Already have a match for the name.
* Don't accept anything but erase/kill.
*/
if (c == erase_char ||
c == erase2_char ||
c == kill_char)
return (MCA_DONE);
return (MCA_MORE);
}
/*
* Add char to cmd buffer and try to match
* the option name.
*/
if (cmd_char(c) == CC_QUIT)
return (MCA_DONE);
p = get_cmdbuf();
lc = ASCII_IS_LOWER(p[0]);
o = findopt_name(&p, &oname, NULL);
if (o != NULL)
{
/*
* Got a match.
* Remember the option letter and
* display the full option name.
*/
optchar = o->oletter;
if (!lc && ASCII_IS_LOWER(optchar))
optchar = ASCII_TO_UPPER(optchar);
cmd_reset();
mca_opt_toggle();
for (p = oname; *p != '\0'; p++)
{
c = *p;
if (!lc && ASCII_IS_LOWER(c))
c = ASCII_TO_UPPER(c);
if (cmd_char(c) != CC_OK)
return (MCA_DONE);
}
}
return (MCA_MORE);
}
} else
{
if (c == erase_char || c == erase2_char || c == kill_char)
break;
if (optchar != '\0')
/* We already have the option letter. */
break;
}
optchar = c;
if ((optflag & ~OPT_NO_PROMPT) != OPT_TOGGLE ||
single_char_option(c))
{
toggle_option(c, "", optflag);
return (MCA_DONE);
}
/*
* Display a prompt appropriate for the option letter.
*/
if ((p = opt_prompt(c)) == NULL)
{
buf[0] = '-';
buf[1] = c;
buf[2] = '\0';
p = buf;
}
start_mca(A_OPT_TOGGLE, p, (void*)NULL, 0);
return (MCA_MORE);
ret = mca_opt_char(c);
if (ret != NO_MCA)
return (ret);
break;
case A_F_SEARCH:
case A_B_SEARCH:
case A_FILTER:
/*
* Special case for search commands.
* Certain characters as the first char of
* the pattern have special meaning:
* ! Toggle the NO_MATCH flag
* * Toggle the PAST_EOF flag
* @ Toggle the FIRST_FILE flag
*/
if (len_cmdbuf() > 0)
/*
* Only works for the first char of the pattern.
*/
break;
ret = mca_search_char(c);
if (ret != NO_MCA)
return (ret);
break;
flag = 0;
switch (c)
{
case CONTROL('E'): /* ignore END of file */
case '*':
if (mca != A_FILTER)
flag = SRCH_PAST_EOF;
break;
case CONTROL('F'): /* FIRST file */
case '@':
if (mca != A_FILTER)
flag = SRCH_FIRST_FILE;
break;
case CONTROL('K'): /* KEEP position */
if (mca != A_FILTER)
flag = SRCH_NO_MOVE;
break;
case CONTROL('R'): /* Don't use REGULAR EXPRESSIONS */
flag = SRCH_NO_REGEX;
break;
case CONTROL('N'): /* NOT match */
case '!':
flag = SRCH_NO_MATCH;
break;
}
if (flag != 0)
{
search_type ^= flag;
mca_search();
return (MCA_MORE);
}
default:
/* Other multicharacter command. */
break;
}
/*
* Any other multicharacter command
* is terminated by a newline.
* The multichar command is terminated by a newline.
*/
if (c == '\n' || c == '\r')
{
@ -635,7 +681,7 @@ prompt()
{
register char *p;
if (ungotp != NULL && ungotp > ungot)
if (ungot != NULL)
{
/*
* No prompt necessary if commands are from
@ -725,47 +771,58 @@ dispversion()
public int
getcc()
{
if (ungotp == NULL)
if (unget_end)
{
/*
* We have just run out of ungotten chars.
*/
unget_end = 0;
if (len_cmdbuf() == 0 || !empty_screen())
return (getchr());
/*
* Command is incomplete, so try to complete it.
*/
switch (mca)
{
case A_DIGIT:
/*
* We have a number but no command. Treat as #g.
*/
return ('g');
case A_F_SEARCH:
case A_B_SEARCH:
/*
* We have "/string" but no newline. Add the \n.
*/
return ('\n');
default:
/*
* Some other incomplete command. Let user complete it.
*/
return (getchr());
}
}
if (ungot == NULL)
{
/*
* Normal case: no ungotten chars, so get one from the user.
*/
return (getchr());
if (ungotp > ungot)
/*
* Return the next ungotten char.
*/
return (*--ungotp);
}
/*
* We have just run out of ungotten chars.
* Return the next ungotten char.
*/
ungotp = NULL;
if (len_cmdbuf() == 0 || !empty_screen())
return (getchr());
/*
* Command is incomplete, so try to complete it.
*/
switch (mca)
{
case A_DIGIT:
/*
* We have a number but no command. Treat as #g.
*/
return ('g');
case A_F_SEARCH:
case A_B_SEARCH:
/*
* We have "/string" but no newline. Add the \n.
*/
return ('\n');
default:
/*
* Some other incomplete command. Let user complete it.
*/
return (getchr());
struct ungot *ug = ungot;
char c = ug->ug_char;
ungot = ug->ug_next;
free(ug);
unget_end = (ungot == NULL);
return (c);
}
}
@ -777,14 +834,11 @@ getcc()
ungetcc(c)
int c;
{
if (ungotp == NULL)
ungotp = ungot;
if (ungotp >= ungot + sizeof(ungot))
{
error("ungetcc overflow", NULL_PARG);
quit(QUIT_ERROR);
}
*ungotp++ = c;
struct ungot *ug = (struct ungot *) ecalloc(1, sizeof(struct ungot));
ug->ug_char = c;
ug->ug_next = ungot;
ungot = ug;
}
/*
@ -927,7 +981,7 @@ commands()
mca = 0;
cmd_accept();
number = 0;
optchar = '\0';
curropt = NULL;
/*
* See if any signals need processing.

5974
configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
# Process this file with autoconf to produce a configure script.
# Copyright (C) 1984-2009 Mark Nudelman
# Copyright (C) 1984-2011 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.
@ -195,6 +195,8 @@ AH_TEMPLATE([HAVE_REGEXEC2],
[])
AH_TEMPLATE([HAVE_VOID],
[Define HAVE_VOID if your compiler supports the "void" type.])
AH_TEMPLATE([HAVE_FLOAT],
[Define HAVE_FLOAT if your compiler supports the "double" type.])
AH_TEMPLATE([HAVE_CONST],
[Define HAVE_CONST if your compiler supports the "const" modifier.])
AH_TEMPLATE([HAVE_STAT_INO],
@ -366,6 +368,18 @@ AC_ARG_WITH(secure,
[ --with-secure Compile in secure mode],
AC_DEFINE(SECURE_COMPILE, 1), AC_DEFINE(SECURE_COMPILE, 0))
# Should we use floating point?
AC_MSG_CHECKING(for floating point)
AC_ARG_WITH(no-float,
[ --with-no-float Do not use floating point],
WANT_NO_FLOAT=1, WANT_NO_FLOAT=0)
if test $WANT_NO_FLOAT = 0; then
AC_TRY_LINK(, [double f1 = 12.5; double f2 = f1*f1/2.5;],
[AC_MSG_RESULT(yes); AC_DEFINE(HAVE_FLOAT)], [AC_MSG_RESULT(no)])
else
AC_MSG_RESULT(disabled by user)
fi
# Checks for regular expression functions.
have_regex=no
have_posix_regex=unknown

2
cvt.c
View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 1984-2009 Mark Nudelman
* Copyright (C) 1984-2011 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.

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 1984-2009 Mark Nudelman
* Copyright (C) 1984-2011 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.
@ -202,6 +202,7 @@ static unsigned char edittable[] =
SK(SK_UP_ARROW),0, EC_UP, /* UPARROW */
ESC,'j',0, EC_DOWN, /* ESC j */
SK(SK_DOWN_ARROW),0, EC_DOWN, /* DOWNARROW */
CONTROL('G'),0, EC_ABORT, /* CTRL-G */
};
/*

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 1984-2009 Mark Nudelman
* Copyright (C) 1984-2011 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.

View File

@ -219,6 +219,9 @@
/* Define HAVE_FILENO if you have the fileno() macro. */
#undef HAVE_FILENO
/* Define HAVE_FLOAT if your compiler supports the "double" type. */
#undef HAVE_FLOAT
/* Define to 1 if you have the `fsync' function. */
#undef HAVE_FSYNC
@ -386,6 +389,9 @@
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the home page for this package. */
#undef PACKAGE_URL
/* Define to the version of this package. */
#undef PACKAGE_VERSION

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 1984-2009 Mark Nudelman
* Copyright (C) 1984-2011 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.

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 1984-2009 Mark Nudelman
* Copyright (C) 1984-2011 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.

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 1984-2009 Mark Nudelman
* Copyright (C) 1984-2011 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.
@ -272,7 +272,7 @@
#define HAVE_SYSTEM 1
/* Define if you have the snprintf function. */
#define HAVE_SNPRINTF 0
#define HAVE_SNPRINTF 1
/* Define if you have the <ctype.h> header file. */
#define HAVE_CTYPE_H 1
@ -286,8 +286,11 @@
/* Define if you have the <fcntl.h> header file. */
#define HAVE_FCNTL_H 1
/* Define HAVE_FLOAT if your compiler supports the "double" type. */
#define HAVE_FLOAT 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
@ -331,3 +334,6 @@
#define popen _popen
#define pclose _pclose
#define snprintf _snprintf
#pragma warning(disable:4996)

2
edit.c
View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 1984-2009 Mark Nudelman
* Copyright (C) 1984-2011 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.

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 1984-2009 Mark Nudelman
* Copyright (C) 1984-2011 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.
@ -400,6 +400,7 @@ fexpand(s)
return (e);
}
#if TAB_COMPLETE_FILENAME
/*
@ -1057,3 +1058,22 @@ shell_coption()
{
return ("-c");
}
/*
* Return last component of a pathname.
*/
public char *
last_component(name)
char *name;
{
char *slash;
for (slash = name + strlen(name); slash > name; )
{
--slash;
if (*slash == *PATHNAME_SEP || *slash == '/')
return (slash + 1);
}
return (name);
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 1984-2009 Mark Nudelman
* Copyright (C) 1984-2011 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.

View File

@ -127,6 +127,7 @@
public char * bad_file ();
public POSITION filesize ();
public char * shell_coption ();
public char * last_component ();
public int eof_displayed ();
public int entire_file_displayed ();
public void squish_check ();
@ -211,9 +212,10 @@
public void opt_quote ();
public void opt_query ();
public int get_swindow ();
public char * propt ();
public void scan_option ();
public void toggle_option ();
public int single_char_option ();
public int opt_has_param ();
public char * opt_prompt ();
public int isoptpending ();
public void nopendopt ();

9
help.c
View File

@ -115,6 +115,8 @@ constant char helpdata[] = {
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','D','i','s','p','l','a','y',' ','h','e','l','p',' ','(','f','r','o','m',' ','c','o','m','m','a','n','d',' ','l','i','n','e',')','.','\n',
' ',' ','-','a',' ',' ','.','.','.','.','.','.','.','.',' ',' ','-','-','s','e','a','r','c','h','-','s','k','i','p','-','s','c','r','e','e','n','\n',
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','F','o','r','w','a','r','d',' ','s','e','a','r','c','h',' ','s','k','i','p','s',' ','c','u','r','r','e','n','t',' ','s','c','r','e','e','n','.','\n',
' ',' ','-','A',' ',' ','.','.','.','.','.','.','.','.',' ',' ','-','-','S','E','A','R','C','H','-','S','K','I','P','-','S','C','R','E','E','N','\n',
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','F','o','r','w','a','r','d',' ','s','e','a','r','c','h',' ','a','l','w','a','y','s',' ','s','k','i','p','s',' ','t','a','r','g','e','t',' ','l','i','n','e','.','\n',
' ',' ','-','b',' ','[','_','\b','N',']',' ',' ','.','.','.','.',' ',' ','-','-','b','u','f','f','e','r','s','=','[','_','\b','N',']','\n',
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','N','u','m','b','e','r',' ','o','f',' ','b','u','f','f','e','r','s','.','\n',
' ',' ','-','B',' ',' ','.','.','.','.','.','.','.','.',' ',' ','-','-','a','u','t','o','-','b','u','f','f','e','r','s','\n',
@ -147,6 +149,8 @@ constant char helpdata[] = {
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','D','i','s','p','l','a','y',' ','a',' ','s','t','a','t','u','s',' ','c','o','l','u','m','n',' ','a','t',' ','l','e','f','t',' ','e','d','g','e',' ','o','f',' ','s','c','r','e','e','n','.','\n',
' ',' ','-','k',' ','[','_','\b','f','_','\b','i','_','\b','l','_','\b','e',']',' ',' ','.',' ',' ','-','-','l','e','s','s','k','e','y','-','f','i','l','e','=','[','_','\b','f','_','\b','i','_','\b','l','_','\b','e',']','\n',
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','U','s','e',' ','a',' ','l','e','s','s','k','e','y',' ','f','i','l','e','.','\n',
' ',' ','-','K',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','-','-','q','u','i','t','-','o','n','-','i','n','t','r','\n',
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','E','x','i','t',' ','l','e','s','s',' ','i','n',' ','r','e','s','p','o','n','s','e',' ','t','o',' ','c','t','r','l','-','C','.','\n',
' ',' ','-','L',' ',' ','.','.','.','.','.','.','.','.',' ',' ','-','-','n','o','-','l','e','s','s','o','p','e','n','\n',
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','I','g','n','o','r','e',' ','t','h','e',' ','L','E','S','S','O','P','E','N',' ','e','n','v','i','r','o','n','m','e','n','t',' ','v','a','r','i','a','b','l','e','.','\n',
' ',' ','-','m',' ',' ','-','M',' ',' ','.','.','.','.',' ',' ','-','-','l','o','n','g','-','p','r','o','m','p','t',' ',' ','-','-','L','O','N','G','-','P','R','O','M','P','T','\n',
@ -197,6 +201,11 @@ constant char helpdata[] = {
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','D','o','n','\'','t',' ','d','i','s','p','l','a','y',' ','t','i','l','d','e','s',' ','a','f','t','e','r',' ','e','n','d',' ','o','f',' ','f','i','l','e','.','\n',
' ',' ','-','#',' ','[','_','\b','N',']',' ',' ','.','.','.','.',' ',' ','-','-','s','h','i','f','t','=','[','_','\b','N',']','\n',
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','H','o','r','i','z','o','n','t','a','l',' ','s','c','r','o','l','l',' ','a','m','o','u','n','t',' ','(','0',' ','=',' ','o','n','e',' ','h','a','l','f',' ','s','c','r','e','e','n',' ','w','i','d','t','h',')','\n',
' ',' ',' ',' ',' ',' ','.','.','.','.','.','.','.','.',' ',' ','-','-','n','o','-','k','e','y','p','a','d','\n',
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','D','o','n','\'','t',' ','s','e','n','d',' ','k','e','y','p','a','d',' ','i','n','i','t','/','d','e','i','n','i','t',' ','s','e','q','u','e','n','c','e','.','\n',
' ',' ',' ',' ',' ',' ','.','.','.','.','.','.','.','.',' ',' ','-','-','f','o','l','l','o','w','-','n','a','m','e','\n',
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','T','h','e',' ','F',' ','c','o','m','m','a','n','d',' ','c','h','a','n','g','e','s',' ','f','i','l','e','s',' ','i','f',' ','t','h','e',' ','i','n','p','u','t',' ','f','i','l','e',' ','i','s',' ','r','e','n','a','m','e','d','.','\n',
'\n',
'\n',
' ','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','\n',
'\n',

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 1984-2009 Mark Nudelman
* Copyright (C) 1984-2011 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.

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 1984-2009 Mark Nudelman
* Copyright (C) 1984-2011 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.
@ -181,6 +181,11 @@ forw_line(curr_pos)
{
do
{
if (ABORT_SIGS())
{
null_line();
return (NULL_POSITION);
}
c = ch_forw_get();
} while (c != '\n' && c != EOI);
new_pos = ch_tell();

2
jump.c
View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 1984-2009 Mark Nudelman
* Copyright (C) 1984-2011 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.

4
less.h
View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 1984-2009 Mark Nudelman
* Copyright (C) 1984-2011 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.
@ -344,6 +344,7 @@ struct textlist
#define SRCH_FIRST_FILE (1 << 10) /* Search starting at the first file */
#define SRCH_NO_REGEX (1 << 12) /* Don't use regular expressions */
#define SRCH_FILTER (1 << 13) /* Search is for '&' (filter) command */
#define SRCH_AFTER_TARGET (1 << 14) /* Start search after the target line */
#define SRCH_REVERSE(t) (((t) & SRCH_FORW) ? \
(((t) & ~SRCH_FORW) | SRCH_BACK) : \
@ -473,6 +474,7 @@ struct textlist
#define QUIT_OK 0
#define QUIT_ERROR 1
#define QUIT_INTERRUPT 2
#define QUIT_SAVED_STATUS (-1)
#define FOLLOW_DESC 0

View File

@ -112,6 +112,8 @@
Display help (from command line).
-a ........ --search-skip-screen
Forward search skips current screen.
-A ........ --SEARCH-SKIP-SCREEN
Forward search always skips target line.
-b [_N] .... --buffers=[_N]
Number of buffers.
-B ........ --auto-buffers
@ -144,6 +146,8 @@
Display a status column at left edge of screen.
-k [_f_i_l_e] . --lesskey-file=[_f_i_l_e]
Use a lesskey file.
-K --quit-on-intr
Exit less in response to ctrl-C.
-L ........ --no-lessopen
Ignore the LESSOPEN environment variable.
-m -M .... --long-prompt --LONG-PROMPT
@ -194,6 +198,11 @@
Don't display tildes after end of file.
-# [_N] .... --shift=[_N]
Horizontal scroll amount (0 = one half screen width)
........ --no-keypad
Don't send keypad init/deinit sequence.
........ --follow-name
The F command changes files if the input file is renamed.
---------------------------------------------------------------------------

620
less.man

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
.TH LESS 1 "Version 436: 07 Jul 2009"
.TH LESS 1 "Version 443: 09 Apr 2011"
.SH NAME
less \- opposite of more
.SH SYNOPSIS
@ -10,7 +10,7 @@ less \- opposite of more
.br
.B "less \-\-version"
.br
.B "less [\-[+]aBcCdeEfFgGiIJKLmMnNqQrRsSuUVwWX~]"
.B "less [\-[+]aABcCdeEfFgGiIJKLmMnNqQrRsSuUVwWX~]"
.br
.B " [\-b \fIspace\fP] [\-h \fIlines\fP] [\-j \fIline\fP] [\-k \fIkeyfile\fP]"
.br
@ -65,7 +65,7 @@ Like SPACE, but if N is specified, it becomes the new window size.
.IP "ESC-SPACE"
Like SPACE, but scrolls a full screenful, even if it reaches
end-of-file in the process.
.IP "RETURN or ^N or e or ^E or j or ^J"
.IP "ENTER or RETURN or ^N or e or ^E or j or ^J"
Scroll forward N lines, default 1.
The entire N lines are displayed, even if N is more than the screen size.
.IP "d or ^D"
@ -178,7 +178,7 @@ Search forward in the file for the N-th line containing the pattern.
N defaults to 1.
The pattern is a regular expression, as recognized by
the regular expression library supplied by your system.
The search starts at the second line displayed
The search starts at the first line displayed
(but see the \-a and \-j options, which change this).
.sp
Certain characters are special
@ -333,7 +333,7 @@ the current setting is printed and nothing is changed.
.IP \-\-
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.
You must press ENTER or 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.
.IP \-+
@ -363,7 +363,7 @@ The setting of the option is not changed.
(Double underscore.)
Like the _ (underscore) command, but takes a long option name
rather than a single option letter.
You must press RETURN after typing the option name.
You must press ENTER or RETURN after typing the option name.
.IP +cmd
Causes the specified cmd to be executed each time a new file is examined.
For example, +G causes
@ -465,11 +465,24 @@ This option displays a summary of the commands accepted by
(Depending on how your shell interprets the question mark,
it may be necessary to quote the question mark, thus: "\-\e?".)
.IP "\-a or \-\-search-skip-screen"
Causes searches to start after the last line
displayed on the screen,
By default, forward searches start at the top of the displayed screen
and backwards searches start at the bottom of the displayed screen
(except for repeated searches invoked by the n or N commands,
which start after or before the "target" line respectively;
see the \-j option for more about the target line).
The \-a option causes forward searches to instead start at
the bottom of the screen
and backward searches to start at the top of the screen,
thus skipping all lines 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).
.IP "\-A or \-\-SEARCH-SKIP-SCREEN"
Causes all forward searches (not just non-repeated searches)
to start just after the target line, and all backward searches
to start just before the target line.
Thus, forward searches will skip part of the displayed screen
(from the first line up to and including the target line).
Similarly backwards searches will skip the displayed screen
from the last line up to and including the target line.
This was the default behavior in less versions prior to 441.
.IP "\-b\fIn\fP or \-\-buffers=\fIn\fP"
Specifies the amount of buffer space
.I less
@ -590,7 +603,8 @@ is recalculated if the terminal window is resized, so that the
target line remains at the specified fraction of the screen height.
If any form of the \-j option is used,
forward searches begin at the line immediately after the target line,
and backward searches begin at the target line.
and backward searches begin at the target line,
unless changed by \-a or \-A.
For example, if "\-j4" is used, the target line is the
fourth line on the screen, so forward searches begin at the fifth line
on the screen.
@ -613,7 +627,8 @@ file.
.IP "\-K or \-\-quit-on-intr"
Causes
.I less
to exit immediately when an interrupt character (usually ^C) is typed.
to exit immediately (with status 2)
when an interrupt character (usually ^C) is typed.
Normally, an interrupt character causes
.I less
to stop whatever it is doing and return to its command prompt.
@ -970,6 +985,8 @@ 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
other than ^U, that character is used instead of ^U.
.IP "^G"
Delete the entire command line and return to the main prompt.
.SH "KEY BINDINGS"
You may define your own
@ -1290,7 +1307,6 @@ 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 LESSBINFMT is "*u[%x]", binary characters
are displayed in underlined hexadecimal surrounded by brackets.
The default if no LESSBINFMT is specified is "*s<%X>".
The default if no LESSBINFMT is specified is "*s<%02X>".
Warning: the result of expanding the character via LESSBINFMT must
be less than 31 characters.
@ -1347,6 +1363,8 @@ or the EDITOR environment variable if VISUAL is not defined).
See the discussion of the LESSEDIT feature below.
.IP "%f"
Replaced by the name of the current input file.
.IP "%F"
Replaced by the last component of the name of the current input file.
.IP "%i"
Replaced by the index of the current file in the list of
input files.
@ -1664,7 +1682,7 @@ The name of the editor (used for the v command).
lesskey(1)
.SH COPYRIGHT
Copyright (C) 1984-2009 Mark Nudelman
Copyright (C) 1984-2011 Mark Nudelman
.PP
less is part of the GNU project and is free software.
You can redistribute it and/or modify it
@ -1689,12 +1707,10 @@ See the GNU General Public License for more details.
.PP
Mark Nudelman <markn@greenwoodsoftware.com>
.br
Send bug reports or comments to the above address or to bug-less@gnu.org.
.br
See http://www.greenwoodsoftware.com/less/bugs.html for the latest list of known bugs in less.
.br
Send bug reports or comments to the above address or to
.br
bug-less@gnu.org.
.br
For more information, see the less homepage at
.br
http://www.greenwoodsoftware.com/less.

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 1984-2009 Mark Nudelman
* Copyright (C) 1984-2011 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.
@ -28,7 +28,7 @@
#include "less.h"
static char *version = "$Revision: 1.13 $";
static char *version = "$Revision: 1.14 $";
static int quote_all = 0;
static char openquote = '"';

View File

@ -46,4 +46,4 @@ LESSECHO(1) LESSECHO(1)
Version 436: 07 Jul 2009 LESSECHO(1)
Version 443: 09 Apr 2011 LESSECHO(1)

View File

@ -1,4 +1,4 @@
.TH LESSECHO 1 "Version 436: 07 Jul 2009"
.TH LESSECHO 1 "Version 443: 09 Apr 2011"
.SH NAME
lessecho \- expand metacharacters
.SH SYNOPSIS

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 1984-2009 Mark Nudelman
* Copyright (C) 1984-2011 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.
@ -166,6 +166,7 @@ struct cmdname editnames[] =
{ "insert", EC_INSERT },
{ "invalid", EC_UINVALID },
{ "kill-line", EC_LINEKILL },
{ "abort", EC_ABORT },
{ "left", EC_LEFT },
{ "literal", EC_LITERAL },
{ "right", EC_RIGHT },

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 1984-2009 Mark Nudelman
* Copyright (C) 1984-2011 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.

View File

@ -13,7 +13,7 @@ LESSKEY(1) LESSKEY(1)
DESCRIPTION
Lesskey is used to specify a set of key bindings to be used by less.
The input file is a text file which describes the key bindings, If the
The input file is a text file which describes the key bindings. If the
input file is "-", standard input is read. If no input file is speci-
fied, a standard filename is used as the name of the input file, which
depends on the system being used: On Unix systems, $HOME/.lesskey is
@ -105,7 +105,7 @@ LESSKEY(1) LESSKEY(1)
can be used in certain cases to extend the functionality of a command.
For example, see the "{" and ":t" commands in the example below. The
extra string has a special meaning for the "quit" action: when less
quits, first character of the extra string is used as its exit status.
quits, first character of the extra string is used as its exit status.
EXAMPLE
@ -225,12 +225,12 @@ LESSKEY(1) LESSKEY(1)
PRECEDENCE
Commands specified by lesskey take precedence over the default com-
mands. A default command key may be disabled by including it in the
input file with the action "invalid". Alternatively, a key may be
defined to do nothing by using the action "noaction". "noaction" is
Commands specified by lesskey take precedence over the default com-
mands. A default command key may be disabled by including it in the
input file with the action "invalid". Alternatively, a key may be
defined to do nothing by using the action "noaction". "noaction" is
similar to "invalid", but less will give an error beep for an "invalid"
command, but not for a "noaction" command. In addition, ALL default
command, but not for a "noaction" command. In addition, ALL default
commands may be disabled by adding this control line to the input file:
#stop
@ -287,6 +287,7 @@ LESSKEY(1) LESSKEY(1)
\ek up
\ku up
\ej down
^G abort
@ -322,27 +323,22 @@ LESSKEY(1) LESSKEY(1)
WARNINGS
It is not possible to specify special keys, such as uparrow, in a key-
board-independent manner. The only way to specify such keys is to
specify the escape sequence which a particular keyboard sends when such
a key is pressed.
On MS-DOS and OS/2 systems, certain keys send a sequence of characters
which start with a NUL character (0). This NUL character should be
On MS-DOS and OS/2 systems, certain keys send a sequence of characters
which start with a NUL character (0). This NUL character should be
represented as \340 in a lesskey file.
COPYRIGHT
Copyright (C) 2000-2009 Mark Nudelman
Copyright (C) 2000-2011 Mark Nudelman
lesskey is part of the GNU project and is free software; you can redis-
tribute it and/or modify it under the terms of the GNU General Public
tribute it and/or modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either version 2,
or (at your option) any later version.
lesskey is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
lesskey is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License along
@ -358,4 +354,4 @@ LESSKEY(1) LESSKEY(1)
Version 436: 07 Jul 2009 LESSKEY(1)
Version 443: 09 Apr 2011 LESSKEY(1)

View File

@ -1,4 +1,4 @@
.TH LESSKEY 1 "Version 436: 07 Jul 2009"
.TH LESSKEY 1 "Version 443: 09 Apr 2011"
.SH NAME
lesskey \- specify key bindings for less
.SH SYNOPSIS
@ -13,7 +13,7 @@ lesskey \- specify key bindings for less
.I Lesskey
is used to specify a set of key bindings to be used by
.I less.
The input file is a text file which describes the key bindings,
The input file is a text file which describes the key bindings.
If the input file is "-", standard input is read.
If no input file is specified, a standard filename is used
as the name of the input file, which depends on the system being used:
@ -311,6 +311,7 @@ default line-editing keys used by less:
\eek up
\eku up
\eej down
^G abort
.fi
.sp
@ -349,17 +350,12 @@ is run, and specifies the character set to be "latin1":
less(1)
.SH WARNINGS
It is not possible to specify special keys, such as uparrow,
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 key is pressed.
.PP
On MS-DOS and OS/2 systems, certain keys send a sequence of characters
which start with a NUL character (0).
This NUL character should be represented as \e340 in a lesskey file.
.SH COPYRIGHT
Copyright (C) 2000-2009 Mark Nudelman
Copyright (C) 2000-2011 Mark Nudelman
.PP
lesskey is part of the GNU project and is free software;
you can redistribute it and/or modify it

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 1984-2009 Mark Nudelman
* Copyright (C) 1984-2011 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.

2
line.c
View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 1984-2009 Mark Nudelman
* Copyright (C) 1984-2011 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.

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 1984-2009 Mark Nudelman
* Copyright (C) 1984-2011 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.

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 1984-2009 Mark Nudelman
* Copyright (C) 1984-2011 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.

6
main.c
View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 1984-2009 Mark Nudelman
* Copyright (C) 1984-2011 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.
@ -32,7 +32,6 @@ public char * progname;
public int quitting;
public int secure;
public int dohelp;
public int less_is_more;
#if LOGFILE
public int logfile = -1;
@ -55,6 +54,7 @@ extern int jump_sline;
static char consoleTitle[256];
#endif
extern int less_is_more;
extern int missing_cap;
extern int know_dumb;
extern int quit_if_one_screen;
@ -406,7 +406,7 @@ quit(status)
*/
close(2);
#endif
#if WIN32
#ifdef WIN32
SetConsoleTitle(consoleTitle);
#endif
close_getchr();

2
mark.c
View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 1984-2009 Mark Nudelman
* Copyright (C) 1984-2011 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.

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 1984-2009 Mark Nudelman
* Copyright (C) 1984-2011 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.

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 1984-2009 Mark Nudelman
* Copyright (C) 1984-2011 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.

100
option.c
View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 1984-2009 Mark Nudelman
* Copyright (C) 1984-2011 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.
@ -24,7 +24,6 @@
static struct loption *pendopt;
public int plusoption = FALSE;
static char *propt();
static char *optstring();
static int flip_triple();
@ -33,6 +32,35 @@ extern int less_is_more;
extern int quit_at_eof;
extern char *every_first_cmd;
/*
* Return a printable description of an option.
*/
static char *
opt_desc(o)
struct loption *o;
{
static char buf[OPTNAME_MAX + 10];
if (o->oletter == OLETTER_NONE)
SNPRINTF1(buf, sizeof(buf), "--%s", o->onames->oname);
else
SNPRINTF2(buf, sizeof(buf), "-%c (--%s)", o->oletter, o->onames->oname);
return (buf);
}
/*
* Return a string suitable for printing as the "name" of an option.
* For example, if the option letter is 'x', just return "-x".
*/
public char *
propt(c)
int c;
{
static char buf[8];
sprintf(buf, "-%s", prchar(c));
return (buf);
}
/*
* Scan an argument (either from the command line or from the
* LESS environment variable) and process it.
@ -69,7 +97,7 @@ scan_option(s)
(*pendopt->ofunc)(INIT, s);
break;
case NUMBER:
printopt = propt(pendopt->oletter);
printopt = opt_desc(pendopt);
*(pendopt->ovar) = getnum(&s, printopt, (int*)NULL);
break;
}
@ -261,12 +289,12 @@ scan_option(s)
* OPT_SET set to the inverse of the default value
*/
public void
toggle_option(c, s, how_toggle)
int c;
toggle_option(o, lower, s, how_toggle)
struct loption *o;
int lower;
char *s;
int how_toggle;
{
register struct loption *o;
register int num;
int no_prompt;
int err;
@ -275,27 +303,22 @@ toggle_option(c, s, how_toggle)
no_prompt = (how_toggle & OPT_NO_PROMPT);
how_toggle &= ~OPT_NO_PROMPT;
/*
* Look up the option letter in the option table.
*/
o = findopt(c);
if (o == NULL)
{
parg.p_string = propt(c);
error("There is no %s option", &parg);
error("No such option", NULL_PARG);
return;
}
if (how_toggle == OPT_TOGGLE && (o->otype & NO_TOGGLE))
{
parg.p_string = propt(c);
parg.p_string = opt_desc(o);
error("Cannot change the %s option", &parg);
return;
}
}
if (how_toggle == OPT_NO_TOGGLE && (o->otype & NO_QUERY))
{
parg.p_string = propt(c);
parg.p_string = opt_desc(o);
error("Cannot query the %s option", &parg);
return;
}
@ -355,15 +378,13 @@ toggle_option(c, s, how_toggle)
switch (how_toggle)
{
case OPT_TOGGLE:
*(o->ovar) = flip_triple(*(o->ovar),
ASCII_IS_LOWER(c));
*(o->ovar) = flip_triple(*(o->ovar), lower);
break;
case OPT_UNSET:
*(o->ovar) = o->odefault;
break;
case OPT_SET:
*(o->ovar) = flip_triple(o->odefault,
ASCII_IS_LOWER(c));
*(o->ovar) = flip_triple(o->odefault, lower);
break;
}
break;
@ -465,33 +486,17 @@ flip_triple(val, lc)
}
/*
* Return a string suitable for printing as the "name" of an option.
* For example, if the option letter is 'x', just return "-x".
*/
static char *
propt(c)
int c;
{
static char buf[8];
sprintf(buf, "-%s", prchar(c));
return (buf);
}
/*
* Determine if an option is a single character option (BOOL or TRIPLE),
* or if it a multi-character option (NUMBER).
* Determine if an option takes a parameter.
*/
public int
single_char_option(c)
int c;
opt_has_param(o)
struct loption *o;
{
register struct loption *o;
o = findopt(c);
if (o == NULL)
return (TRUE);
return ((o->otype & (BOOL|TRIPLE|NOVAR|NO_TOGGLE)) != 0);
return (0);
if (o->otype & (BOOL|TRIPLE|NOVAR|NO_TOGGLE))
return (0);
return (1);
}
/*
@ -499,14 +504,11 @@ single_char_option(c)
* Only string and number valued options have prompts.
*/
public char *
opt_prompt(c)
int c;
opt_prompt(o)
struct loption *o;
{
register struct loption *o;
o = findopt(c);
if (o == NULL || (o->otype & (STRING|NUMBER)) == 0)
return (NULL);
return ("?");
return (o->odesc[0]);
}
@ -541,7 +543,7 @@ nostring(printopt)
public void
nopendopt()
{
nostring(propt(pendopt->oletter));
nostring(opt_desc(pendopt));
}
/*

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 1984-2009 Mark Nudelman
* Copyright (C) 1984-2011 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.
@ -27,6 +27,8 @@
#define OTYPE (BOOL|TRIPLE|NUMBER|STRING|NOVAR)
#define OLETTER_NONE '\1' /* Invalid option letter */
/*
* Argument to a handling function tells what type of activity:
*/
@ -50,6 +52,8 @@ struct optname
struct optname *onext; /* List of synonymous option names */
};
#define OPTNAME_MAX 32 /* Max length of long option name */
struct loption
{
char oletter; /* The controlling letter (a-z) */

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 1984-2009 Mark Nudelman
* Copyright (C) 1984-2011 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.
@ -133,11 +133,11 @@ static struct optname follow_optname = { "follow-name", NULL };
static struct loption option[] =
{
{ 'a', &a_optname,
BOOL, OPT_OFF, &how_search, NULL,
TRIPLE, OPT_ONPLUS, &how_search, NULL,
{
"Search includes displayed screen",
"Search skips displayed screen",
NULL
"Search includes all of displayed screen"
}
},
@ -237,7 +237,7 @@ static struct loption option[] =
STRING, 0, NULL, opt_j,
{
"Target line: ",
"0123456789.",
"0123456789.-",
NULL
}
},
@ -427,7 +427,7 @@ static struct loption option[] =
NULL
}
},
{ '.', &keypad_optname,
{ OLETTER_NONE, &keypad_optname,
BOOL|NO_TOGGLE, OPT_OFF, &no_keypad, NULL,
{
"Use keypad mode",
@ -435,7 +435,7 @@ static struct loption option[] =
NULL
}
},
{ '.', &oldbot_optname,
{ OLETTER_NONE, &oldbot_optname,
BOOL, OPT_OFF, &oldbot, NULL,
{
"Use new bottom of screen behavior",
@ -443,11 +443,11 @@ static struct loption option[] =
NULL
}
},
{ '.', &follow_optname,
{ OLETTER_NONE, &follow_optname,
BOOL, FOLLOW_DESC, &follow_mode, NULL,
{
"F command Follows file descriptor",
"F command Follows file name",
"F command follows file descriptor",
"F command follows file name",
NULL
}
},

43
os.c
View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 1984-2009 Mark Nudelman
* Copyright (C) 1984-2011 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.
@ -250,6 +250,28 @@ errno_message(filename)
return (m);
}
/* #define HAVE_FLOAT 0 */
static POSITION
muldiv(val, num, den)
POSITION val, num, den;
{
#if HAVE_FLOAT
double v = (((double) val) * num) / den;
return ((POSITION) (v + 0.5));
#else
POSITION v = ((POSITION) val) * num;
if (v / num == val)
/* No overflow */
return (POSITION) (v / den);
else
/* Above calculation overflows;
* use a method that is less precise but won't overflow. */
return (POSITION) (val / (den / num));
#endif
}
/*
* Return the ratio of two POSITIONS, as a percentage.
* {{ Assumes a POSITION is a long int. }}
@ -258,12 +280,7 @@ errno_message(filename)
percentage(num, den)
POSITION num, den;
{
POSITION num100 = num * 100;
if (num100 / 100 == num)
return (num100 / den);
else
return (num / (den / 100));
return (int) muldiv(num, (POSITION) 100, den);
}
/*
@ -276,19 +293,11 @@ percent_pos(pos, percent, fraction)
long fraction;
{
/* Change percent (parts per 100) to perden (parts per NUM_FRAC_DENOM). */
long perden = (percent * (NUM_FRAC_DENOM / 100)) + (fraction / 100);
POSITION temp;
POSITION perden = (percent * (NUM_FRAC_DENOM / 100)) + (fraction / 100);
if (perden == 0)
return (0);
temp = pos * perden; /* This might overflow. */
if (temp / perden == pos)
/* No overflow */
return (temp / NUM_FRAC_DENOM);
else
/* Above calculation overflows;
* use a method that is less precise but won't overflow. */
return (perden * (pos / NUM_FRAC_DENOM));
return (POSITION) muldiv(pos, perden, (POSITION) NUM_FRAC_DENOM);
}
#if !HAVE_STRCHR

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 1984-2009 Mark Nudelman
* Copyright (C) 1984-2011 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.
@ -532,6 +532,7 @@ error(fmt, parg)
get_return();
lower_left();
clear_eol();
if (col >= sc_width)
/*

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 1984-2009 Mark Nudelman
* Copyright (C) 1984-2011 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.
@ -254,8 +254,8 @@ match_pattern(pattern, tpattern, line, line_len, sp, ep, notbol, search_type)
if (search_type & SRCH_NO_REGEX)
matched = match(tpattern, strlen(tpattern), line, line_len, sp, ep);
else
{
else
{
#if HAVE_POSIX_REGCOMP
{
regmatch_t rm;
@ -314,7 +314,7 @@ match_pattern(pattern, tpattern, line, line_len, sp, ep, notbol, search_type)
#if NO_REGEX
matched = match(tpattern, strlen(tpattern), line, line_len, sp, ep);
#endif
}
}
matched = (!(search_type & SRCH_NO_MATCH) && matched) ||
((search_type & SRCH_NO_MATCH) && !matched);
return (matched);

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 1984-2009 Mark Nudelman
* Copyright (C) 1984-2011 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.

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 1984-2009 Mark Nudelman
* Copyright (C) 1984-2011 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.

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 1984-2009 Mark Nudelman
* Copyright (C) 1984-2011 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.

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 1984-2009 Mark Nudelman
* Copyright (C) 1984-2011 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.

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 1984-2009 Mark Nudelman
* Copyright (C) 1984-2011 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.
@ -303,6 +303,9 @@ protochar(c, where, iseditproto)
case 'f': /* File name */
ap_str(get_filename(curr_ifile));
break;
case 'F': /* Last component of file name */
ap_str(last_component(get_filename(curr_ifile)));
break;
case 'i': /* Index into list of files */
#if TAGS
if (ntags())
@ -363,6 +366,7 @@ protochar(c, where, iseditproto)
case 't': /* Truncate trailing spaces in the message */
while (mp > message && mp[-1] == ' ')
mp--;
*mp = '\0';
break;
case 'T': /* Type of list */
#if TAGS

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 1984-2009 Mark Nudelman
* Copyright (C) 1984-2011 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.
@ -1788,7 +1788,7 @@ win32_scroll_up(n)
/* Move the source text to the top of the screen. */
new_org.X = rcSrc.Left;
/* new_org.Y = rcClip.top; -- doesn't compile under MSVC6 */
new_org.Y = rcClip.Top;
/* Fill the right character and attributes. */
fillchar.Char.AsciiChar = ' ';

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 1984-2009 Mark Nudelman
* Copyright (C) 1984-2011 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.

160
search.c
View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 1984-2009 Mark Nudelman
* Copyright (C) 1984-2011 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.
@ -70,6 +70,25 @@ struct pattern_info {
static struct pattern_info search_info;
static struct pattern_info filter_info;
/*
* Are there any uppercase letters in this string?
*/
static int
is_ucase(str)
char *str;
{
char *str_end = str + strlen(str);
LWCHAR ch;
while (str < str_end)
{
ch = step_char(&str, +1, str_end);
if (IS_UPPER(ch))
return (1);
}
return (0);
}
/*
* Compile and save a search pattern.
*/
@ -93,6 +112,16 @@ set_pattern(info, pattern, search_type)
strcpy(info->text, pattern);
}
info->search_type = search_type;
/*
* Ignore case if -I is set OR
* -i is set AND the pattern is all lowercase.
*/
is_ucase_pattern = is_ucase(pattern);
if (is_ucase_pattern && caseless != OPT_ONPLUS)
is_caseless = 0;
else
is_caseless = caseless;
return 0;
}
@ -155,25 +184,6 @@ get_cvt_ops()
return (ops);
}
/*
* Are there any uppercase letters in this string?
*/
static int
is_ucase(str)
char *str;
{
char *str_end = str + strlen(str);
LWCHAR ch;
while (str < str_end)
{
ch = step_char(&str, +1, str_end);
if (IS_UPPER(ch))
return (1);
}
return (0);
}
/*
* Is there a previous (remembered) search pattern?
*/
@ -229,7 +239,7 @@ repaint_hilite(on)
goto_line(slinenum);
put_line();
}
lower_left(); // if !oldbot
lower_left();
hide_hilite = save_hide_hilite;
}
@ -599,7 +609,7 @@ search_pos(search_type)
*/
if (search_type & SRCH_FORW)
{
return (ch_zero());
pos = ch_zero();
} else
{
pos = ch_length();
@ -608,46 +618,66 @@ search_pos(search_type)
(void) ch_end_seek();
pos = ch_length();
}
return (pos);
}
}
if (how_search)
linenum = 0;
} else
{
/*
* Search does not include current screen.
*/
if (search_type & SRCH_FORW)
linenum = BOTTOM_PLUS_ONE;
else
linenum = TOP;
pos = position(linenum);
} else
{
/*
* Search includes current screen.
* It starts at the jump target (if searching backwards),
* or at the jump target plus one (if forwards).
*/
linenum = adjsline(jump_sline);
pos = position(linenum);
if (search_type & SRCH_FORW)
int add_one = 0;
if (how_search == OPT_ON)
{
pos = forw_raw_line(pos, (char **)NULL, (int *)NULL);
while (pos == NULL_POSITION)
{
if (++linenum >= sc_height)
break;
pos = position(linenum);
}
/*
* Search does not include current screen.
*/
if (search_type & SRCH_FORW)
linenum = BOTTOM_PLUS_ONE;
else
linenum = TOP;
} else if (how_search == OPT_ONPLUS && !(search_type & SRCH_AFTER_TARGET))
{
/*
* Search includes all of displayed screen.
*/
if (search_type & SRCH_FORW)
linenum = TOP;
else
linenum = BOTTOM_PLUS_ONE;
} else
{
while (pos == NULL_POSITION)
{
if (--linenum < 0)
break;
pos = position(linenum);
}
/*
* Search includes the part of current screen beyond the jump target.
* It starts at the jump target (if searching backwards),
* or at the jump target plus one (if forwards).
*/
linenum = jump_sline;
if (search_type & SRCH_FORW)
add_one = 1;
}
linenum = adjsline(linenum);
pos = position(linenum);
if (add_one)
pos = forw_raw_line(pos, (char **)NULL, (int *)NULL);
}
/*
* If the line is empty, look around for a plausible starting place.
*/
if (search_type & SRCH_FORW)
{
while (pos == NULL_POSITION)
{
if (++linenum >= sc_height)
break;
pos = position(linenum);
}
} else
{
while (pos == NULL_POSITION)
{
if (--linenum < 0)
break;
pos = position(linenum);
}
}
return (pos);
}
@ -789,7 +819,7 @@ search_range(pos, endpos, search_type, matches, maxlines, plinepos, pendpos)
if (prev_pattern(&search_info))
{
line_match = match_pattern(search_info.compiled, search_info.text,
cline, line_len, &sp, &ep, 0, search_type); //FIXME search_info.search_type
cline, line_len, &sp, &ep, 0, search_type);
if (line_match)
{
/*
@ -853,12 +883,6 @@ hist_pattern(search_type)
if (set_pattern(&search_info, pattern, search_type) < 0)
return (0);
is_ucase_pattern = is_ucase(pattern);
if (is_ucase_pattern && caseless != OPT_ONPLUS)
is_caseless = 0;
else
is_caseless = caseless;
#if HILITE_SEARCH
if (hilite_search == OPT_ONPLUS && !hide_hilite)
hilite_screen();
@ -892,6 +916,7 @@ search(search_type, pattern, n)
/*
* A null pattern means use the previously compiled pattern.
*/
search_type |= SRCH_AFTER_TARGET;
if (!prev_pattern(&search_info) && !hist_pattern(search_type))
{
error("No previous regular expression", NULL_PARG);
@ -930,15 +955,6 @@ search(search_type, pattern, n)
*/
if (set_pattern(&search_info, pattern, search_type) < 0)
return (-1);
/*
* Ignore case if -I is set OR
* -i is set AND the pattern is all lowercase.
*/
is_ucase_pattern = is_ucase(pattern);
if (is_ucase_pattern && caseless != OPT_ONPLUS)
is_caseless = 0;
else
is_caseless = caseless;
#if HILITE_SEARCH
if (hilite_search)
{

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 1984-2009 Mark Nudelman
* Copyright (C) 1984-2011 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.
@ -252,6 +252,6 @@ psignals()
if (tsignals & S_INTERRUPT)
{
if (quit_on_intr)
quit(QUIT_OK);
quit(QUIT_INTERRUPT);
}
}

2
tags.c
View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 1984-2009 Mark Nudelman
* Copyright (C) 1984-2011 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.

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 1984-2009 Mark Nudelman
* Copyright (C) 1984-2011 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.

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 1984-2009 Mark Nudelman
* Copyright (C) 1984-2011 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.
@ -729,6 +729,19 @@ v433 6/28/09 Cleanup search code.
v434 6/29/09 More cleanup.
v435 7/04/09 Fix bugs with non-regex filtering.
v436 7/05/09 Fix memory leak.
-----------------------------------------------------------------
v437 7/14/09 Fix bug in handling some long option names;
make percentage calculation more accurate.
v438 12/29/10 Fix bugs with -i/-I and & filtering;
exit with status 2 on ctrl-C with -K.
v439 12/31/10 Add -A option.
v440 1/5/11 Fix bug displaying prompt after = command.
v441 1/21/11 Fix semi-infinite loop if no newlines in file;
make new -A behavior the default.
-----------------------------------------------------------------
v442 3/2/11 Fix search bug.
Add ctrl-G line edit command.
v443 4/9/11 Fix Windows build.
*/
char version[] = "436";
char version[] = "443";