/home/delphij/m

This commit is contained in:
Xin LI 2007-06-04 01:42:54 +00:00
parent 6dcb072b30
commit 7f074f9c8f
61 changed files with 6039 additions and 3680 deletions

View File

@ -13,6 +13,7 @@ INSTALL_DATA = @INSTALL_DATA@
CFLAGS = @CFLAGS@
CFLAGS_COMPILE_ONLY = -c
LDFLAGS = @LDFLAGS@
CPPFLAGS = @CPPFLAGS@
O=o
LIBS = @LIBS@
@ -25,10 +26,12 @@ bindir = @bindir@
binprefix =
sysconfdir = @sysconfdir@
datarootdir = @datarootdir@
mandir = @mandir@
manext = 1
manprefix =
DESTDIR =
#### End of system configuration section. ####
@ -60,22 +63,26 @@ lessecho: lessecho.${O} version.${O}
${OBJ}: ${srcdir}/less.h ${srcdir}/funcs.h defines.h
install: all ${srcdir}/less.nro ${srcdir}/lesskey.nro ${srcdir}/lessecho.nro installdirs
${INSTALL_PROGRAM} less ${bindir}/${binprefix}less
${INSTALL_PROGRAM} lesskey ${bindir}/${binprefix}lesskey
${INSTALL_PROGRAM} lessecho ${bindir}/${binprefix}lessecho
${INSTALL_DATA} ${srcdir}/less.nro ${mandir}/man${manext}/${manprefix}less.${manext}
${INSTALL_DATA} ${srcdir}/lesskey.nro ${mandir}/man${manext}/${manprefix}lesskey.${manext}
${INSTALL_DATA} ${srcdir}/lessecho.nro ${mandir}/man${manext}/${manprefix}lessecho.${manext}
${INSTALL_PROGRAM} less ${DESTDIR}${bindir}/${binprefix}less
${INSTALL_PROGRAM} lesskey ${DESTDIR}${bindir}/${binprefix}lesskey
${INSTALL_PROGRAM} lessecho ${DESTDIR}${bindir}/${binprefix}lessecho
${INSTALL_DATA} ${srcdir}/less.nro ${DESTDIR}${mandir}/man${manext}/${manprefix}less.${manext}
${INSTALL_DATA} ${srcdir}/lesskey.nro ${DESTDIR}${mandir}/man${manext}/${manprefix}lesskey.${manext}
${INSTALL_DATA} ${srcdir}/lessecho.nro ${DESTDIR}${mandir}/man${manext}/${manprefix}lessecho.${manext}
install-strip:
${MAKE} INSTALL_PROGRAM='${INSTALL_PROGRAM} -s' install
installdirs: mkinstalldirs
${srcdir}/mkinstalldirs ${bindir} ${mandir}/man${manext}
${srcdir}/mkinstalldirs ${DESTDIR}${bindir} ${DESTDIR}${mandir}/man${manext}
uninstall:
rm -f ${bindir}/${binprefix}less ${bindir}/${binprefix}lesskey ${bindir}/${binprefix}lessecho
rm -f ${mandir}/man${manext}/${manprefix}less.${manext} ${mandir}/man${manext}/${manprefix}lesskey.${manext}
rm -f ${DESTDIR}${bindir}/${binprefix}less
rm -f ${DESTDIR}${bindir}/${binprefix}lesskey
rm -f ${DESTDIR}${bindir}/${binprefix}lessecho
rm -f ${DESTDIR}${mandir}/man${manext}/${manprefix}less.${manext}
rm -f ${DESTDIR}${mandir}/man${manext}/${manprefix}lesskey.${manext}
rm -f ${DESTDIR}${mandir}/man${manext}/${manprefix}lessecho.${manext}
info:
install-info:

View File

@ -7,11 +7,59 @@
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.
To report bugs, suggestions or comments, send email to
bug-less@gnu.org or markn@greenwoodsoftware.com.
======================================================================
Major changes between "less" versions 394 and 403
* Allow decimal point in number for % (percent) command.
* Allow decimal point in number for -j option (fraction of screen height).
* Make n command fetch previous pattern from history file on first search.
* Don't rewrite history file if it has not changed.
* Don't move to bottom of screen on first page.
* Don't output extraneous newlines, so copy & pasting lines from the
output works better.
* The -c option has been made identical with the -C option.
* Allow "/dev/null" as synomym for "-" in LESSHISTFILE to indicate
that no history file should be used.
* Search can now find text which follows a null byte, if the PCRE
library is used, or if no-regex searching (ctrl-R) is used.
* Better compatibility with POSIX more specification.
* Make -f work for directories.
* Make "t" cmd traverse tags in the correct order.
* Allow a few binary characters in the input file before warning
that the file is binary.
* Don't warn that file is binary if it merely contains ANSI color sequences
and -R is in effect.
* Update Unicode character tables.
* Support DESTDIR in Makefile.
* Fix bug when filename contains certain shell metacharacters such as "$".
* Fix bug when resizing the window while waiting for input from a pipe.
* Fix configure bugs.
======================================================================
Major changes between "less" versions 382 and 394
* Add history file to save search and shell command history between
@ -632,3 +680,6 @@
* Lesskey files may now include characters after the action as
extra input to be parsed after the action; for example:
"toggle-option X" to toggle a specific option X.

View File

@ -1,7 +1,7 @@
Less, version 394
Less, version 403
This is the distribution of less, version 394, released 03 Dec 2005.
This is the distribution of less, version 403, released 25 May 2007.
This program is part of the GNU project (http://www.gnu.org).
This program is free software. You may redistribute it and/or
@ -46,6 +46,7 @@ INSTALLATION (Unix systems only):
--with-editor=program
Specifies the default editor program used by the "v" command.
The default is "vi".
--with-regex=lib
Specifies the regular expression library used by less for pattern
matching. The default is "auto", which means the configure program
@ -62,6 +63,7 @@ INSTALLATION (Unix systems only):
to prevent users from viewing other files, accessing shell
commands, etc.
3. It is a good idea to look over the generated Makefile and defines.h
and make sure they look ok. If you know of any peculiarities of
your system that configure might not have detected, you may fix the

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 1984-2004 Mark Nudelman
* Copyright (C) 1984-2007 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-2004 Mark Nudelman
* Copyright (C) 1984-2007 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-2005 Mark Nudelman
* Copyright (C) 1984-2007 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.
@ -322,6 +322,7 @@ set_charset()
}
#if HAVE_LOCALE
#ifdef CODESET
/*
* Try using the codeset name as the charset name.
*/
@ -329,6 +330,7 @@ set_charset()
if (icharset(s, 1))
return;
#endif
#endif
#if HAVE_STRSTR
/*
@ -648,42 +650,93 @@ step_char(pp, dir, limit)
*/
struct wchar_range { LWCHAR first, last; };
/*
* Characters with general category values
* Mn: Mark, Nonspacing
* Me: Mark, Enclosing
* Last synched with
* <http://www.unicode.org/Public/5.0.0/ucd/UnicodeData-5.0.0d7.txt>
* dated 2005-11-30T00:58:48Z
*/
static struct wchar_range comp_table[] = {
{0x300,0x357}, {0x35d,0x36f}, {0x483,0x486}, {0x488,0x489},
{0x591,0x5a1}, {0x5a3,0x5b9}, {0x5bb,0x5bd}, {0x5bf,0x5bf},
{0x5c1,0x5c2}, {0x5c4,0x5c4}, {0x610,0x615}, {0x64b,0x658},
{0x670,0x670}, {0x6d6,0x6dc}, {0x6de,0x6e4}, {0x6e7,0x6e8},
{0x6ea,0x6ed}, {0x711,0x711}, {0x730,0x74a}, {0x7a6,0x7b0},
{0x901,0x902}, {0x93c,0x93c}, {0x941,0x948}, {0x94d,0x94d},
{0x951,0x954}, {0x962,0x963}, {0x981,0x981}, {0x9bc,0x9bc},
{0x9c1,0x9c4}, {0x9cd,0x9cd}, {0x9e2,0x9e3}, {0xa01,0xa02},
{0xa3c,0xa3c}, {0xa41,0xa42}, {0xa47,0xa48}, {0xa4b,0xa4d},
{0xa70,0xa71}, {0xa81,0xa82}, {0xabc,0xabc}, {0xac1,0xac5},
{0xac7,0xac8}, {0xacd,0xacd}, {0xae2,0xae3}, {0xb01,0xb01},
{0xb3c,0xb3c}, {0xb3f,0xb3f}, {0xb41,0xb43}, {0xb4d,0xb4d},
{0xb56,0xb56}, {0xb82,0xb82}, {0xbc0,0xbc0}, {0xbcd,0xbcd},
{0xc3e,0xc40}, {0xc46,0xc48}, {0xc4a,0xc4d}, {0xc55,0xc56},
{0xcbc,0xcbc}, {0xcbf,0xcbf}, {0xcc6,0xcc6}, {0xccc,0xccd},
{0xd41,0xd43}, {0xd4d,0xd4d}, {0xdca,0xdca}, {0xdd2,0xdd4},
{0xdd6,0xdd6}, {0xe31,0xe31}, {0xe34,0xe3a}, {0xe47,0xe4e},
{0xeb1,0xeb1}, {0xeb4,0xeb9}, {0xebb,0xebc}, {0xec8,0xecd},
{0xf18,0xf19}, {0xf35,0xf35}, {0xf37,0xf37}, {0xf39,0xf39},
{0xf71,0xf7e}, {0xf80,0xf84}, {0xf86,0xf87}, {0xf90,0xf97},
{0xf99,0xfbc}, {0xfc6,0xfc6}, {0x102d,0x1030}, {0x1032,0x1032},
{0x1036,0x1037}, {0x1039,0x1039}, {0x1058,0x1059},
{0x1712,0x1714}, {0x1732,0x1734}, {0x1752,0x1753},
{0x1772,0x1773}, {0x17b7,0x17bd}, {0x17c6,0x17c6},
{0x17c9,0x17d3}, {0x17dd,0x17dd}, {0x180b,0x180d},
{0x18a9,0x18a9}, {0x1920,0x1922}, {0x1927,0x1928},
{0x1932,0x1932}, {0x1939,0x193b}, {0x20d0,0x20ea},
{0x302a,0x302f}, {0x3099,0x309a}, {0xfb1e,0xfb1e},
{0xfe00,0xfe0f}, {0xfe20,0xfe23}, {0x1d167,0x1d169},
{0x1d17b,0x1d182}, {0x1d185,0x1d18b}, {0x1d1aa,0x1d1ad},
{0xe0100,0xe01ef},
{ 0x0300, 0x036F} /* Mn */, { 0x0483, 0x0486} /* Mn */,
{ 0x0488, 0x0489} /* Me */,
{ 0x0591, 0x05BD} /* Mn */, { 0x05BF, 0x05BF} /* Mn */,
{ 0x05C1, 0x05C2} /* Mn */, { 0x05C4, 0x05C5} /* Mn */,
{ 0x05C7, 0x05C7} /* Mn */, { 0x0610, 0x0615} /* Mn */,
{ 0x064B, 0x065E} /* Mn */, { 0x0670, 0x0670} /* Mn */,
{ 0x06D6, 0x06DC} /* Mn */,
{ 0x06DE, 0x06DE} /* Me */,
{ 0x06DF, 0x06E4} /* Mn */, { 0x06E7, 0x06E8} /* Mn */,
{ 0x06EA, 0x06ED} /* Mn */, { 0x0711, 0x0711} /* Mn */,
{ 0x0730, 0x074A} /* Mn */, { 0x07A6, 0x07B0} /* Mn */,
{ 0x07EB, 0x07F3} /* Mn */, { 0x0901, 0x0902} /* Mn */,
{ 0x093C, 0x093C} /* Mn */, { 0x0941, 0x0948} /* Mn */,
{ 0x094D, 0x094D} /* Mn */, { 0x0951, 0x0954} /* Mn */,
{ 0x0962, 0x0963} /* Mn */, { 0x0981, 0x0981} /* Mn */,
{ 0x09BC, 0x09BC} /* Mn */, { 0x09C1, 0x09C4} /* Mn */,
{ 0x09CD, 0x09CD} /* Mn */, { 0x09E2, 0x09E3} /* Mn */,
{ 0x0A01, 0x0A02} /* Mn */, { 0x0A3C, 0x0A3C} /* Mn */,
{ 0x0A41, 0x0A42} /* Mn */, { 0x0A47, 0x0A48} /* Mn */,
{ 0x0A4B, 0x0A4D} /* Mn */, { 0x0A70, 0x0A71} /* Mn */,
{ 0x0A81, 0x0A82} /* Mn */, { 0x0ABC, 0x0ABC} /* Mn */,
{ 0x0AC1, 0x0AC5} /* Mn */, { 0x0AC7, 0x0AC8} /* Mn */,
{ 0x0ACD, 0x0ACD} /* Mn */, { 0x0AE2, 0x0AE3} /* Mn */,
{ 0x0B01, 0x0B01} /* Mn */, { 0x0B3C, 0x0B3C} /* Mn */,
{ 0x0B3F, 0x0B3F} /* Mn */, { 0x0B41, 0x0B43} /* Mn */,
{ 0x0B4D, 0x0B4D} /* Mn */, { 0x0B56, 0x0B56} /* Mn */,
{ 0x0B82, 0x0B82} /* Mn */, { 0x0BC0, 0x0BC0} /* Mn */,
{ 0x0BCD, 0x0BCD} /* Mn */, { 0x0C3E, 0x0C40} /* Mn */,
{ 0x0C46, 0x0C48} /* Mn */, { 0x0C4A, 0x0C4D} /* Mn */,
{ 0x0C55, 0x0C56} /* Mn */, { 0x0CBC, 0x0CBC} /* Mn */,
{ 0x0CBF, 0x0CBF} /* Mn */, { 0x0CC6, 0x0CC6} /* Mn */,
{ 0x0CCC, 0x0CCD} /* Mn */, { 0x0CE2, 0x0CE3} /* Mn */,
{ 0x0D41, 0x0D43} /* Mn */, { 0x0D4D, 0x0D4D} /* Mn */,
{ 0x0DCA, 0x0DCA} /* Mn */, { 0x0DD2, 0x0DD4} /* Mn */,
{ 0x0DD6, 0x0DD6} /* Mn */, { 0x0E31, 0x0E31} /* Mn */,
{ 0x0E34, 0x0E3A} /* Mn */, { 0x0E47, 0x0E4E} /* Mn */,
{ 0x0EB1, 0x0EB1} /* Mn */, { 0x0EB4, 0x0EB9} /* Mn */,
{ 0x0EBB, 0x0EBC} /* Mn */, { 0x0EC8, 0x0ECD} /* Mn */,
{ 0x0F18, 0x0F19} /* Mn */, { 0x0F35, 0x0F35} /* Mn */,
{ 0x0F37, 0x0F37} /* Mn */, { 0x0F39, 0x0F39} /* Mn */,
{ 0x0F71, 0x0F7E} /* Mn */, { 0x0F80, 0x0F84} /* Mn */,
{ 0x0F86, 0x0F87} /* Mn */, { 0x0F90, 0x0F97} /* Mn */,
{ 0x0F99, 0x0FBC} /* Mn */, { 0x0FC6, 0x0FC6} /* Mn */,
{ 0x102D, 0x1030} /* Mn */, { 0x1032, 0x1032} /* Mn */,
{ 0x1036, 0x1037} /* Mn */, { 0x1039, 0x1039} /* Mn */,
{ 0x1058, 0x1059} /* Mn */, { 0x135F, 0x135F} /* Mn */,
{ 0x1712, 0x1714} /* Mn */, { 0x1732, 0x1734} /* Mn */,
{ 0x1752, 0x1753} /* Mn */, { 0x1772, 0x1773} /* Mn */,
{ 0x17B7, 0x17BD} /* Mn */, { 0x17C6, 0x17C6} /* Mn */,
{ 0x17C9, 0x17D3} /* Mn */, { 0x17DD, 0x17DD} /* Mn */,
{ 0x180B, 0x180D} /* Mn */, { 0x18A9, 0x18A9} /* Mn */,
{ 0x1920, 0x1922} /* Mn */, { 0x1927, 0x1928} /* Mn */,
{ 0x1932, 0x1932} /* Mn */, { 0x1939, 0x193B} /* Mn */,
{ 0x1A17, 0x1A18} /* Mn */, { 0x1B00, 0x1B03} /* Mn */,
{ 0x1B34, 0x1B34} /* Mn */, { 0x1B36, 0x1B3A} /* Mn */,
{ 0x1B3C, 0x1B3C} /* Mn */, { 0x1B42, 0x1B42} /* Mn */,
{ 0x1B6B, 0x1B73} /* Mn */, { 0x1DC0, 0x1DCA} /* Mn */,
{ 0x1DFE, 0x1DFF} /* Mn */, { 0x20D0, 0x20DC} /* Mn */,
{ 0x20DD, 0x20E0} /* Me */,
{ 0x20E1, 0x20E1} /* Mn */,
{ 0x20E2, 0x20E4} /* Me */,
{ 0x20E5, 0x20EF} /* Mn */, { 0x302A, 0x302F} /* Mn */,
{ 0x3099, 0x309A} /* Mn */, { 0xA806, 0xA806} /* Mn */,
{ 0xA80B, 0xA80B} /* Mn */, { 0xA825, 0xA826} /* Mn */,
{ 0xFB1E, 0xFB1E} /* Mn */, { 0xFE00, 0xFE0F} /* Mn */,
{ 0xFE20, 0xFE23} /* Mn */, { 0x10A01, 0x10A03} /* Mn */,
{ 0x10A05, 0x10A06} /* Mn */, { 0x10A0C, 0x10A0F} /* Mn */,
{ 0x10A38, 0x10A3A} /* Mn */, { 0x10A3F, 0x10A3F} /* Mn */,
{ 0x1D167, 0x1D169} /* Mn */, { 0x1D17B, 0x1D182} /* Mn */,
{ 0x1D185, 0x1D18B} /* Mn */, { 0x1D1AA, 0x1D1AD} /* Mn */,
{ 0x1D242, 0x1D244} /* Mn */, { 0xE0100, 0xE01EF} /* Mn */,
};
/*
* Special pairs, not ranges.
*/
static struct wchar_range comb_table[] = {
{0x0644,0x0622}, {0x0644,0x0623}, {0x0644,0x0625}, {0x0644,0x0627},
{0x0644,0x0622}, {0x0644,0x0623}, {0x0644,0x0625}, {0x0644,0x0627},
};
/*
@ -695,263 +748,284 @@ static struct wchar_range comb_table[] = {
* Cn: Other, Not Assigned
* Zl: Separator, Line
* Zp: Separator, Paragraph
* Last synched with
* <http://www.unicode.org/Public/5.0.0/ucd/UnicodeData-5.0.0d7.txt>
* dated 2005-11-30T00:58:48Z
*/
static struct wchar_range ubin_table[] = {
{ 0x0000, 0x001f} /* Cc */, { 0x007f, 0x009f} /* Cc */,
{ 0x0000, 0x001F} /* Cc */, { 0x007F, 0x009F} /* Cc */,
#if 0
{ 0x00ad, 0x00ad} /* Cf */,
{ 0x00AD, 0x00AD} /* Cf */,
#endif
{ 0x0237, 0x024f} /* Cn */, { 0x0358, 0x035c} /* Cn */,
{ 0x0370, 0x0373} /* Cn */, { 0x0376, 0x0379} /* Cn */,
{ 0x037b, 0x037d} /* Cn */, { 0x037f, 0x0383} /* Cn */,
{ 0x038b, 0x038b} /* Cn */, { 0x038d, 0x038d} /* Cn */,
{ 0x03a2, 0x03a2} /* Cn */, { 0x03cf, 0x03cf} /* Cn */,
{ 0x03fc, 0x03ff} /* Cn */, { 0x0487, 0x0487} /* Cn */,
{ 0x04cf, 0x04cf} /* Cn */, { 0x04f6, 0x04f7} /* Cn */,
{ 0x04fa, 0x04ff} /* Cn */, { 0x0510, 0x0530} /* Cn */,
{ 0x0557, 0x0558} /* Cn */, { 0x0560, 0x0560} /* Cn */,
{ 0x0588, 0x0588} /* Cn */, { 0x058b, 0x0590} /* Cn */,
{ 0x05a2, 0x05a2} /* Cn */, { 0x05ba, 0x05ba} /* Cn */,
{ 0x05c5, 0x05cf} /* Cn */, { 0x05eb, 0x05ef} /* Cn */,
{ 0x05f5, 0x05ff} /* Cn */,
{ 0x037F, 0x0383} /* Cn */, { 0x038B, 0x038B} /* Cn */,
{ 0x038D, 0x038D} /* Cn */, { 0x03A2, 0x03A2} /* Cn */,
{ 0x03CF, 0x03CF} /* Cn */, { 0x0487, 0x0487} /* Cn */,
{ 0x0514, 0x0530} /* Cn */, { 0x0557, 0x0558} /* Cn */,
{ 0x0560, 0x0560} /* Cn */, { 0x0588, 0x0588} /* Cn */,
{ 0x058B, 0x0590} /* Cn */, { 0x05C8, 0x05CF} /* Cn */,
{ 0x05EB, 0x05EF} /* Cn */, { 0x05F5, 0x05FF} /* Cn */,
#if 0
{ 0x0600, 0x0603} /* Cf */,
#endif
{ 0x0604, 0x060b} /* Cn */, { 0x0616, 0x061a} /* Cn */,
{ 0x061c, 0x061e} /* Cn */, { 0x0620, 0x0620} /* Cn */,
{ 0x063b, 0x063f} /* Cn */, { 0x0659, 0x065f} /* Cn */,
{ 0x0604, 0x060A} /* Cn */, { 0x0616, 0x061A} /* Cn */,
{ 0x061C, 0x061D} /* Cn */, { 0x0620, 0x0620} /* Cn */,
{ 0x063B, 0x063F} /* Cn */, { 0x065F, 0x065F} /* Cn */,
#if 0
{ 0x06dd, 0x06dd} /* Cf */,
{ 0x06DD, 0x06DD} /* Cf */,
#endif
{ 0x070e, 0x070e} /* Cn */,
{ 0x070E, 0x070E} /* Cn */,
#if 0
{ 0x070f, 0x070f} /* Cf */,
{ 0x070F, 0x070F} /* Cf */,
#endif
{ 0x074b, 0x074c} /* Cn */, { 0x0750, 0x077f} /* Cn */,
{ 0x07b2, 0x0900} /* Cn */, { 0x093a, 0x093b} /* Cn */,
{ 0x094e, 0x094f} /* Cn */, { 0x0955, 0x0957} /* Cn */,
{ 0x0971, 0x0980} /* Cn */, { 0x0984, 0x0984} /* Cn */,
{ 0x098d, 0x098e} /* Cn */, { 0x0991, 0x0992} /* Cn */,
{ 0x09a9, 0x09a9} /* Cn */, { 0x09b1, 0x09b1} /* Cn */,
{ 0x09b3, 0x09b5} /* Cn */, { 0x09ba, 0x09bb} /* Cn */,
{ 0x09c5, 0x09c6} /* Cn */, { 0x09c9, 0x09ca} /* Cn */,
{ 0x09ce, 0x09d6} /* Cn */, { 0x09d8, 0x09db} /* Cn */,
{ 0x09de, 0x09de} /* Cn */, { 0x09e4, 0x09e5} /* Cn */,
{ 0x09fb, 0x0a00} /* Cn */, { 0x0a04, 0x0a04} /* Cn */,
{ 0x0a0b, 0x0a0e} /* Cn */, { 0x0a11, 0x0a12} /* Cn */,
{ 0x0a29, 0x0a29} /* Cn */, { 0x0a31, 0x0a31} /* Cn */,
{ 0x0a34, 0x0a34} /* Cn */, { 0x0a37, 0x0a37} /* Cn */,
{ 0x0a3a, 0x0a3b} /* Cn */, { 0x0a3d, 0x0a3d} /* Cn */,
{ 0x0a43, 0x0a46} /* Cn */, { 0x0a49, 0x0a4a} /* Cn */,
{ 0x0a4e, 0x0a58} /* Cn */, { 0x0a5d, 0x0a5d} /* Cn */,
{ 0x0a5f, 0x0a65} /* Cn */, { 0x0a75, 0x0a80} /* Cn */,
{ 0x0a84, 0x0a84} /* Cn */, { 0x0a8e, 0x0a8e} /* Cn */,
{ 0x0a92, 0x0a92} /* Cn */, { 0x0aa9, 0x0aa9} /* Cn */,
{ 0x0ab1, 0x0ab1} /* Cn */, { 0x0ab4, 0x0ab4} /* Cn */,
{ 0x0aba, 0x0abb} /* Cn */, { 0x0ac6, 0x0ac6} /* Cn */,
{ 0x0aca, 0x0aca} /* Cn */, { 0x0ace, 0x0acf} /* Cn */,
{ 0x0ad1, 0x0adf} /* Cn */, { 0x0ae4, 0x0ae5} /* Cn */,
{ 0x0af0, 0x0af0} /* Cn */, { 0x0af2, 0x0b00} /* Cn */,
{ 0x0b04, 0x0b04} /* Cn */, { 0x0b0d, 0x0b0e} /* Cn */,
{ 0x0b11, 0x0b12} /* Cn */, { 0x0b29, 0x0b29} /* Cn */,
{ 0x0b31, 0x0b31} /* Cn */, { 0x0b34, 0x0b34} /* Cn */,
{ 0x0b3a, 0x0b3b} /* Cn */, { 0x0b44, 0x0b46} /* Cn */,
{ 0x0b49, 0x0b4a} /* Cn */, { 0x0b4e, 0x0b55} /* Cn */,
{ 0x0b58, 0x0b5b} /* Cn */, { 0x0b5e, 0x0b5e} /* Cn */,
{ 0x0b62, 0x0b65} /* Cn */, { 0x0b72, 0x0b81} /* Cn */,
{ 0x0b84, 0x0b84} /* Cn */, { 0x0b8b, 0x0b8d} /* Cn */,
{ 0x0b91, 0x0b91} /* Cn */, { 0x0b96, 0x0b98} /* Cn */,
{ 0x0b9b, 0x0b9b} /* Cn */, { 0x0b9d, 0x0b9d} /* Cn */,
{ 0x0ba0, 0x0ba2} /* Cn */, { 0x0ba5, 0x0ba7} /* Cn */,
{ 0x0bab, 0x0bad} /* Cn */, { 0x0bb6, 0x0bb6} /* Cn */,
{ 0x0bba, 0x0bbd} /* Cn */, { 0x0bc3, 0x0bc5} /* Cn */,
{ 0x0bc9, 0x0bc9} /* Cn */, { 0x0bce, 0x0bd6} /* Cn */,
{ 0x0bd8, 0x0be6} /* Cn */, { 0x0bfb, 0x0c00} /* Cn */,
{ 0x0c04, 0x0c04} /* Cn */, { 0x0c0d, 0x0c0d} /* Cn */,
{ 0x0c11, 0x0c11} /* Cn */, { 0x0c29, 0x0c29} /* Cn */,
{ 0x0c34, 0x0c34} /* Cn */, { 0x0c3a, 0x0c3d} /* Cn */,
{ 0x0c45, 0x0c45} /* Cn */, { 0x0c49, 0x0c49} /* Cn */,
{ 0x0c4e, 0x0c54} /* Cn */, { 0x0c57, 0x0c5f} /* Cn */,
{ 0x0c62, 0x0c65} /* Cn */, { 0x0c70, 0x0c81} /* Cn */,
{ 0x0c84, 0x0c84} /* Cn */, { 0x0c8d, 0x0c8d} /* Cn */,
{ 0x0c91, 0x0c91} /* Cn */, { 0x0ca9, 0x0ca9} /* Cn */,
{ 0x0cb4, 0x0cb4} /* Cn */, { 0x0cba, 0x0cbb} /* Cn */,
{ 0x0cc5, 0x0cc5} /* Cn */, { 0x0cc9, 0x0cc9} /* Cn */,
{ 0x0cce, 0x0cd4} /* Cn */, { 0x0cd7, 0x0cdd} /* Cn */,
{ 0x0cdf, 0x0cdf} /* Cn */, { 0x0ce2, 0x0ce5} /* Cn */,
{ 0x0cf0, 0x0d01} /* Cn */, { 0x0d04, 0x0d04} /* Cn */,
{ 0x0d0d, 0x0d0d} /* Cn */, { 0x0d11, 0x0d11} /* Cn */,
{ 0x0d29, 0x0d29} /* Cn */, { 0x0d3a, 0x0d3d} /* Cn */,
{ 0x0d44, 0x0d45} /* Cn */, { 0x0d49, 0x0d49} /* Cn */,
{ 0x0d4e, 0x0d56} /* Cn */, { 0x0d58, 0x0d5f} /* Cn */,
{ 0x0d62, 0x0d65} /* Cn */, { 0x0d70, 0x0d81} /* Cn */,
{ 0x0d84, 0x0d84} /* Cn */, { 0x0d97, 0x0d99} /* Cn */,
{ 0x0db2, 0x0db2} /* Cn */, { 0x0dbc, 0x0dbc} /* Cn */,
{ 0x0dbe, 0x0dbf} /* Cn */, { 0x0dc7, 0x0dc9} /* Cn */,
{ 0x0dcb, 0x0dce} /* Cn */, { 0x0dd5, 0x0dd5} /* Cn */,
{ 0x0dd7, 0x0dd7} /* Cn */, { 0x0de0, 0x0df1} /* Cn */,
{ 0x0df5, 0x0e00} /* Cn */, { 0x0e3b, 0x0e3e} /* Cn */,
{ 0x0e5c, 0x0e80} /* Cn */, { 0x0e83, 0x0e83} /* Cn */,
{ 0x0e85, 0x0e86} /* Cn */, { 0x0e89, 0x0e89} /* Cn */,
{ 0x0e8b, 0x0e8c} /* Cn */, { 0x0e8e, 0x0e93} /* Cn */,
{ 0x0e98, 0x0e98} /* Cn */, { 0x0ea0, 0x0ea0} /* Cn */,
{ 0x0ea4, 0x0ea4} /* Cn */, { 0x0ea6, 0x0ea6} /* Cn */,
{ 0x0ea8, 0x0ea9} /* Cn */, { 0x0eac, 0x0eac} /* Cn */,
{ 0x0eba, 0x0eba} /* Cn */, { 0x0ebe, 0x0ebf} /* Cn */,
{ 0x0ec5, 0x0ec5} /* Cn */, { 0x0ec7, 0x0ec7} /* Cn */,
{ 0x0ece, 0x0ecf} /* Cn */, { 0x0eda, 0x0edb} /* Cn */,
{ 0x0ede, 0x0eff} /* Cn */, { 0x0f48, 0x0f48} /* Cn */,
{ 0x0f6b, 0x0f70} /* Cn */, { 0x0f8c, 0x0f8f} /* Cn */,
{ 0x0f98, 0x0f98} /* Cn */, { 0x0fbd, 0x0fbd} /* Cn */,
{ 0x0fcd, 0x0fce} /* Cn */, { 0x0fd0, 0x0fff} /* Cn */,
{ 0x074B, 0x074C} /* Cn */, { 0x076E, 0x077F} /* Cn */,
{ 0x07B2, 0x07BF} /* Cn */, { 0x07FB, 0x0900} /* Cn */,
{ 0x093A, 0x093B} /* Cn */, { 0x094E, 0x094F} /* Cn */,
{ 0x0955, 0x0957} /* Cn */, { 0x0971, 0x097A} /* Cn */,
{ 0x0980, 0x0980} /* Cn */, { 0x0984, 0x0984} /* Cn */,
{ 0x098D, 0x098E} /* Cn */, { 0x0991, 0x0992} /* Cn */,
{ 0x09A9, 0x09A9} /* Cn */, { 0x09B1, 0x09B1} /* Cn */,
{ 0x09B3, 0x09B5} /* Cn */, { 0x09BA, 0x09BB} /* Cn */,
{ 0x09C5, 0x09C6} /* Cn */, { 0x09C9, 0x09CA} /* Cn */,
{ 0x09CF, 0x09D6} /* Cn */, { 0x09D8, 0x09DB} /* Cn */,
{ 0x09DE, 0x09DE} /* Cn */, { 0x09E4, 0x09E5} /* Cn */,
{ 0x09FB, 0x0A00} /* Cn */, { 0x0A04, 0x0A04} /* Cn */,
{ 0x0A0B, 0x0A0E} /* Cn */, { 0x0A11, 0x0A12} /* Cn */,
{ 0x0A29, 0x0A29} /* Cn */, { 0x0A31, 0x0A31} /* Cn */,
{ 0x0A34, 0x0A34} /* Cn */, { 0x0A37, 0x0A37} /* Cn */,
{ 0x0A3A, 0x0A3B} /* Cn */, { 0x0A3D, 0x0A3D} /* Cn */,
{ 0x0A43, 0x0A46} /* Cn */, { 0x0A49, 0x0A4A} /* Cn */,
{ 0x0A4E, 0x0A58} /* Cn */, { 0x0A5D, 0x0A5D} /* Cn */,
{ 0x0A5F, 0x0A65} /* Cn */, { 0x0A75, 0x0A80} /* Cn */,
{ 0x0A84, 0x0A84} /* Cn */, { 0x0A8E, 0x0A8E} /* Cn */,
{ 0x0A92, 0x0A92} /* Cn */, { 0x0AA9, 0x0AA9} /* Cn */,
{ 0x0AB1, 0x0AB1} /* Cn */, { 0x0AB4, 0x0AB4} /* Cn */,
{ 0x0ABA, 0x0ABB} /* Cn */, { 0x0AC6, 0x0AC6} /* Cn */,
{ 0x0ACA, 0x0ACA} /* Cn */, { 0x0ACE, 0x0ACF} /* Cn */,
{ 0x0AD1, 0x0ADF} /* Cn */, { 0x0AE4, 0x0AE5} /* Cn */,
{ 0x0AF0, 0x0AF0} /* Cn */, { 0x0AF2, 0x0B00} /* Cn */,
{ 0x0B04, 0x0B04} /* Cn */, { 0x0B0D, 0x0B0E} /* Cn */,
{ 0x0B11, 0x0B12} /* Cn */, { 0x0B29, 0x0B29} /* Cn */,
{ 0x0B31, 0x0B31} /* Cn */, { 0x0B34, 0x0B34} /* Cn */,
{ 0x0B3A, 0x0B3B} /* Cn */, { 0x0B44, 0x0B46} /* Cn */,
{ 0x0B49, 0x0B4A} /* Cn */, { 0x0B4E, 0x0B55} /* Cn */,
{ 0x0B58, 0x0B5B} /* Cn */, { 0x0B5E, 0x0B5E} /* Cn */,
{ 0x0B62, 0x0B65} /* Cn */, { 0x0B72, 0x0B81} /* Cn */,
{ 0x0B84, 0x0B84} /* Cn */, { 0x0B8B, 0x0B8D} /* Cn */,
{ 0x0B91, 0x0B91} /* Cn */, { 0x0B96, 0x0B98} /* Cn */,
{ 0x0B9B, 0x0B9B} /* Cn */, { 0x0B9D, 0x0B9D} /* Cn */,
{ 0x0BA0, 0x0BA2} /* Cn */, { 0x0BA5, 0x0BA7} /* Cn */,
{ 0x0BAB, 0x0BAD} /* Cn */, { 0x0BBA, 0x0BBD} /* Cn */,
{ 0x0BC3, 0x0BC5} /* Cn */, { 0x0BC9, 0x0BC9} /* Cn */,
{ 0x0BCE, 0x0BD6} /* Cn */, { 0x0BD8, 0x0BE5} /* Cn */,
{ 0x0BFB, 0x0C00} /* Cn */, { 0x0C04, 0x0C04} /* Cn */,
{ 0x0C0D, 0x0C0D} /* Cn */, { 0x0C11, 0x0C11} /* Cn */,
{ 0x0C29, 0x0C29} /* Cn */, { 0x0C34, 0x0C34} /* Cn */,
{ 0x0C3A, 0x0C3D} /* Cn */, { 0x0C45, 0x0C45} /* Cn */,
{ 0x0C49, 0x0C49} /* Cn */, { 0x0C4E, 0x0C54} /* Cn */,
{ 0x0C57, 0x0C5F} /* Cn */, { 0x0C62, 0x0C65} /* Cn */,
{ 0x0C70, 0x0C81} /* Cn */, { 0x0C84, 0x0C84} /* Cn */,
{ 0x0C8D, 0x0C8D} /* Cn */, { 0x0C91, 0x0C91} /* Cn */,
{ 0x0CA9, 0x0CA9} /* Cn */, { 0x0CB4, 0x0CB4} /* Cn */,
{ 0x0CBA, 0x0CBB} /* Cn */, { 0x0CC5, 0x0CC5} /* Cn */,
{ 0x0CC9, 0x0CC9} /* Cn */, { 0x0CCE, 0x0CD4} /* Cn */,
{ 0x0CD7, 0x0CDD} /* Cn */, { 0x0CDF, 0x0CDF} /* Cn */,
{ 0x0CE4, 0x0CE5} /* Cn */, { 0x0CF0, 0x0CF0} /* Cn */,
{ 0x0CF3, 0x0D01} /* Cn */, { 0x0D04, 0x0D04} /* Cn */,
{ 0x0D0D, 0x0D0D} /* Cn */, { 0x0D11, 0x0D11} /* Cn */,
{ 0x0D29, 0x0D29} /* Cn */, { 0x0D3A, 0x0D3D} /* Cn */,
{ 0x0D44, 0x0D45} /* Cn */, { 0x0D49, 0x0D49} /* Cn */,
{ 0x0D4E, 0x0D56} /* Cn */, { 0x0D58, 0x0D5F} /* Cn */,
{ 0x0D62, 0x0D65} /* Cn */, { 0x0D70, 0x0D81} /* Cn */,
{ 0x0D84, 0x0D84} /* Cn */, { 0x0D97, 0x0D99} /* Cn */,
{ 0x0DB2, 0x0DB2} /* Cn */, { 0x0DBC, 0x0DBC} /* Cn */,
{ 0x0DBE, 0x0DBF} /* Cn */, { 0x0DC7, 0x0DC9} /* Cn */,
{ 0x0DCB, 0x0DCE} /* Cn */, { 0x0DD5, 0x0DD5} /* Cn */,
{ 0x0DD7, 0x0DD7} /* Cn */, { 0x0DE0, 0x0DF1} /* Cn */,
{ 0x0DF5, 0x0E00} /* Cn */, { 0x0E3B, 0x0E3E} /* Cn */,
{ 0x0E5C, 0x0E80} /* Cn */, { 0x0E83, 0x0E83} /* Cn */,
{ 0x0E85, 0x0E86} /* Cn */, { 0x0E89, 0x0E89} /* Cn */,
{ 0x0E8B, 0x0E8C} /* Cn */, { 0x0E8E, 0x0E93} /* Cn */,
{ 0x0E98, 0x0E98} /* Cn */, { 0x0EA0, 0x0EA0} /* Cn */,
{ 0x0EA4, 0x0EA4} /* Cn */, { 0x0EA6, 0x0EA6} /* Cn */,
{ 0x0EA8, 0x0EA9} /* Cn */, { 0x0EAC, 0x0EAC} /* Cn */,
{ 0x0EBA, 0x0EBA} /* Cn */, { 0x0EBE, 0x0EBF} /* Cn */,
{ 0x0EC5, 0x0EC5} /* Cn */, { 0x0EC7, 0x0EC7} /* Cn */,
{ 0x0ECE, 0x0ECF} /* Cn */, { 0x0EDA, 0x0EDB} /* Cn */,
{ 0x0EDE, 0x0EFF} /* Cn */, { 0x0F48, 0x0F48} /* Cn */,
{ 0x0F6B, 0x0F70} /* Cn */, { 0x0F8C, 0x0F8F} /* Cn */,
{ 0x0F98, 0x0F98} /* Cn */, { 0x0FBD, 0x0FBD} /* Cn */,
{ 0x0FCD, 0x0FCE} /* Cn */, { 0x0FD2, 0x0FFF} /* Cn */,
{ 0x1022, 0x1022} /* Cn */, { 0x1028, 0x1028} /* Cn */,
{ 0x102b, 0x102b} /* Cn */, { 0x1033, 0x1035} /* Cn */,
{ 0x103a, 0x103f} /* Cn */, { 0x105a, 0x109f} /* Cn */,
{ 0x10c6, 0x10cf} /* Cn */, { 0x10f9, 0x10fa} /* Cn */,
{ 0x10fc, 0x10ff} /* Cn */, { 0x115a, 0x115e} /* Cn */,
{ 0x11a3, 0x11a7} /* Cn */, { 0x11fa, 0x11ff} /* Cn */,
{ 0x1207, 0x1207} /* Cn */, { 0x1247, 0x1247} /* Cn */,
{ 0x1249, 0x1249} /* Cn */, { 0x124e, 0x124f} /* Cn */,
{ 0x1257, 0x1257} /* Cn */, { 0x1259, 0x1259} /* Cn */,
{ 0x125e, 0x125f} /* Cn */, { 0x1287, 0x1287} /* Cn */,
{ 0x1289, 0x1289} /* Cn */, { 0x128e, 0x128f} /* Cn */,
{ 0x12af, 0x12af} /* Cn */, { 0x12b1, 0x12b1} /* Cn */,
{ 0x12b6, 0x12b7} /* Cn */, { 0x12bf, 0x12bf} /* Cn */,
{ 0x12c1, 0x12c1} /* Cn */, { 0x12c6, 0x12c7} /* Cn */,
{ 0x12cf, 0x12cf} /* Cn */, { 0x12d7, 0x12d7} /* Cn */,
{ 0x12ef, 0x12ef} /* Cn */, { 0x130f, 0x130f} /* Cn */,
{ 0x102B, 0x102B} /* Cn */, { 0x1033, 0x1035} /* Cn */,
{ 0x103A, 0x103F} /* Cn */, { 0x105A, 0x109F} /* Cn */,
{ 0x10C6, 0x10CF} /* Cn */, { 0x10FD, 0x10FF} /* Cn */,
{ 0x115A, 0x115E} /* Cn */, { 0x11A3, 0x11A7} /* Cn */,
{ 0x11FA, 0x11FF} /* Cn */, { 0x1249, 0x1249} /* Cn */,
{ 0x124E, 0x124F} /* Cn */, { 0x1257, 0x1257} /* Cn */,
{ 0x1259, 0x1259} /* Cn */, { 0x125E, 0x125F} /* Cn */,
{ 0x1289, 0x1289} /* Cn */, { 0x128E, 0x128F} /* Cn */,
{ 0x12B1, 0x12B1} /* Cn */, { 0x12B6, 0x12B7} /* Cn */,
{ 0x12BF, 0x12BF} /* Cn */, { 0x12C1, 0x12C1} /* Cn */,
{ 0x12C6, 0x12C7} /* Cn */, { 0x12D7, 0x12D7} /* Cn */,
{ 0x1311, 0x1311} /* Cn */, { 0x1316, 0x1317} /* Cn */,
{ 0x131f, 0x131f} /* Cn */, { 0x1347, 0x1347} /* Cn */,
{ 0x135b, 0x1360} /* Cn */, { 0x137d, 0x139f} /* Cn */,
{ 0x13f5, 0x1400} /* Cn */, { 0x1677, 0x167f} /* Cn */,
{ 0x169d, 0x169f} /* Cn */, { 0x16f1, 0x16ff} /* Cn */,
{ 0x170d, 0x170d} /* Cn */, { 0x1715, 0x171f} /* Cn */,
{ 0x1737, 0x173f} /* Cn */, { 0x1754, 0x175f} /* Cn */,
{ 0x176d, 0x176d} /* Cn */, { 0x1771, 0x1771} /* Cn */,
{ 0x1774, 0x177f} /* Cn */,
{ 0x135B, 0x135E} /* Cn */, { 0x137D, 0x137F} /* Cn */,
{ 0x139A, 0x139F} /* Cn */, { 0x13F5, 0x1400} /* Cn */,
{ 0x1677, 0x167F} /* Cn */, { 0x169D, 0x169F} /* Cn */,
{ 0x16F1, 0x16FF} /* Cn */, { 0x170D, 0x170D} /* Cn */,
{ 0x1715, 0x171F} /* Cn */, { 0x1737, 0x173F} /* Cn */,
{ 0x1754, 0x175F} /* Cn */, { 0x176D, 0x176D} /* Cn */,
{ 0x1771, 0x1771} /* Cn */, { 0x1774, 0x177F} /* Cn */,
#if 0
{ 0x17b4, 0x17b5} /* Cf */,
{ 0x17B4, 0x17B5} /* Cf */,
#endif
{ 0x17de, 0x17df} /* Cn */, { 0x17ea, 0x17ef} /* Cn */,
{ 0x17fa, 0x17ff} /* Cn */, { 0x180f, 0x180f} /* Cn */,
{ 0x181a, 0x181f} /* Cn */, { 0x1878, 0x187f} /* Cn */,
{ 0x18aa, 0x18ff} /* Cn */, { 0x191d, 0x191f} /* Cn */,
{ 0x192c, 0x192f} /* Cn */, { 0x193c, 0x193f} /* Cn */,
{ 0x1941, 0x1943} /* Cn */, { 0x196e, 0x196f} /* Cn */,
{ 0x1975, 0x19df} /* Cn */, { 0x1a00, 0x1cff} /* Cn */,
{ 0x1d6c, 0x1dff} /* Cn */, { 0x1e9c, 0x1e9f} /* Cn */,
{ 0x1efa, 0x1eff} /* Cn */, { 0x1f16, 0x1f17} /* Cn */,
{ 0x1f1e, 0x1f1f} /* Cn */, { 0x1f46, 0x1f47} /* Cn */,
{ 0x1f4e, 0x1f4f} /* Cn */, { 0x1f58, 0x1f58} /* Cn */,
{ 0x1f5a, 0x1f5a} /* Cn */, { 0x1f5c, 0x1f5c} /* Cn */,
{ 0x1f5e, 0x1f5e} /* Cn */, { 0x1f7e, 0x1f7f} /* Cn */,
{ 0x1fb5, 0x1fb5} /* Cn */, { 0x1fc5, 0x1fc5} /* Cn */,
{ 0x1fd4, 0x1fd5} /* Cn */, { 0x1fdc, 0x1fdc} /* Cn */,
{ 0x1ff0, 0x1ff1} /* Cn */, { 0x1ff5, 0x1ff5} /* Cn */,
{ 0x1fff, 0x1fff} /* Cn */, { 0x200b, 0x200f} /* Cf */,
{ 0x17DE, 0x17DF} /* Cn */, { 0x17EA, 0x17EF} /* Cn */,
{ 0x17FA, 0x17FF} /* Cn */, { 0x180F, 0x180F} /* Cn */,
{ 0x181A, 0x181F} /* Cn */, { 0x1878, 0x187F} /* Cn */,
{ 0x18AA, 0x18FF} /* Cn */, { 0x191D, 0x191F} /* Cn */,
{ 0x192C, 0x192F} /* Cn */, { 0x193C, 0x193F} /* Cn */,
{ 0x1941, 0x1943} /* Cn */, { 0x196E, 0x196F} /* Cn */,
{ 0x1975, 0x197F} /* Cn */, { 0x19AA, 0x19AF} /* Cn */,
{ 0x19CA, 0x19CF} /* Cn */, { 0x19DA, 0x19DD} /* Cn */,
{ 0x1A1C, 0x1A1D} /* Cn */, { 0x1A20, 0x1AFF} /* Cn */,
{ 0x1B4C, 0x1B4F} /* Cn */, { 0x1B7D, 0x1CFF} /* Cn */,
{ 0x1DCB, 0x1DFD} /* Cn */, { 0x1E9C, 0x1E9F} /* Cn */,
{ 0x1EFA, 0x1EFF} /* Cn */, { 0x1F16, 0x1F17} /* Cn */,
{ 0x1F1E, 0x1F1F} /* Cn */, { 0x1F46, 0x1F47} /* Cn */,
{ 0x1F4E, 0x1F4F} /* Cn */, { 0x1F58, 0x1F58} /* Cn */,
{ 0x1F5A, 0x1F5A} /* Cn */, { 0x1F5C, 0x1F5C} /* Cn */,
{ 0x1F5E, 0x1F5E} /* Cn */, { 0x1F7E, 0x1F7F} /* Cn */,
{ 0x1FB5, 0x1FB5} /* Cn */, { 0x1FC5, 0x1FC5} /* Cn */,
{ 0x1FD4, 0x1FD5} /* Cn */, { 0x1FDC, 0x1FDC} /* Cn */,
{ 0x1FF0, 0x1FF1} /* Cn */, { 0x1FF5, 0x1FF5} /* Cn */,
{ 0x1FFF, 0x1FFF} /* Cn */,
{ 0x200B, 0x200F} /* Cf */,
{ 0x2028, 0x2028} /* Zl */,
{ 0x2029, 0x2029} /* Zp */,
{ 0x202a, 0x202e} /* Cf */,
{ 0x2055, 0x2056} /* Cn */, { 0x2058, 0x205e} /* Cn */,
{ 0x202A, 0x202E} /* Cf */,
{ 0x2060, 0x2063} /* Cf */,
{ 0x2064, 0x2069} /* Cn */,
{ 0x206a, 0x206f} /* Cf */,
{ 0x2072, 0x2073} /* Cn */, { 0x208f, 0x209f} /* Cn */,
{ 0x20b2, 0x20cf} /* Cn */, { 0x20eb, 0x20ff} /* Cn */,
{ 0x213c, 0x213c} /* Cn */, { 0x214c, 0x2152} /* Cn */,
{ 0x2184, 0x218f} /* Cn */, { 0x23d1, 0x23ff} /* Cn */,
{ 0x2427, 0x243f} /* Cn */, { 0x244b, 0x245f} /* Cn */,
{ 0x2618, 0x2618} /* Cn */, { 0x267e, 0x267f} /* Cn */,
{ 0x2692, 0x269f} /* Cn */, { 0x26a2, 0x2700} /* Cn */,
{ 0x2705, 0x2705} /* Cn */, { 0x270a, 0x270b} /* Cn */,
{ 0x2728, 0x2728} /* Cn */, { 0x274c, 0x274c} /* Cn */,
{ 0x274e, 0x274e} /* Cn */, { 0x2753, 0x2755} /* Cn */,
{ 0x2757, 0x2757} /* Cn */, { 0x275f, 0x2760} /* Cn */,
{ 0x2795, 0x2797} /* Cn */, { 0x27b0, 0x27b0} /* Cn */,
{ 0x27bf, 0x27cf} /* Cn */, { 0x27ec, 0x27ef} /* Cn */,
{ 0x2b0e, 0x2e7f} /* Cn */, { 0x2e9a, 0x2e9a} /* Cn */,
{ 0x2ef4, 0x2eff} /* Cn */, { 0x2fd6, 0x2fef} /* Cn */,
{ 0x2ffc, 0x2fff} /* Cn */, { 0x3040, 0x3040} /* Cn */,
{ 0x3097, 0x3098} /* Cn */, { 0x3100, 0x3104} /* Cn */,
{ 0x312d, 0x3130} /* Cn */, { 0x318f, 0x318f} /* Cn */,
{ 0x31b8, 0x31ef} /* Cn */, { 0x321f, 0x321f} /* Cn */,
{ 0x3244, 0x324f} /* Cn */, { 0x327e, 0x327e} /* Cn */,
{ 0x32ff, 0x32ff} /* Cn */, { 0x4db6, 0x4dbf} /* Cn */,
{ 0x9fa6, 0x9fff} /* Cn */, { 0xa48d, 0xa48f} /* Cn */,
{ 0xa4c7, 0xabff} /* Cn */, { 0xd7a4, 0xd7ff} /* Cn */,
{ 0xd800, 0xdfff} /* Cs */,
{ 0xe000, 0xf8ff} /* Co */,
{ 0xfa2e, 0xfa2f} /* Cn */, { 0xfa6b, 0xfaff} /* Cn */,
{ 0xfb07, 0xfb12} /* Cn */, { 0xfb18, 0xfb1c} /* Cn */,
{ 0xfb37, 0xfb37} /* Cn */, { 0xfb3d, 0xfb3d} /* Cn */,
{ 0xfb3f, 0xfb3f} /* Cn */, { 0xfb42, 0xfb42} /* Cn */,
{ 0xfb45, 0xfb45} /* Cn */, { 0xfbb2, 0xfbd2} /* Cn */,
{ 0xfd40, 0xfd4f} /* Cn */, { 0xfd90, 0xfd91} /* Cn */,
{ 0xfdc8, 0xfdef} /* Cn */, { 0xfdfe, 0xfdff} /* Cn */,
{ 0xfe10, 0xfe1f} /* Cn */, { 0xfe24, 0xfe2f} /* Cn */,
{ 0xfe53, 0xfe53} /* Cn */, { 0xfe67, 0xfe67} /* Cn */,
{ 0xfe6c, 0xfe6f} /* Cn */, { 0xfe75, 0xfe75} /* Cn */,
{ 0xfefd, 0xfefe} /* Cn */,
{ 0xfeff, 0xfeff} /* Cf */,
{ 0xff00, 0xff00} /* Cn */, { 0xffbf, 0xffc1} /* Cn */,
{ 0xffc8, 0xffc9} /* Cn */, { 0xffd0, 0xffd1} /* Cn */,
{ 0xffd8, 0xffd9} /* Cn */, { 0xffdd, 0xffdf} /* Cn */,
{ 0xffe7, 0xffe7} /* Cn */, { 0xffef, 0xfff8} /* Cn */,
{ 0xfff9, 0xfffb} /* Cf */,
{ 0xfffe, 0xffff} /* Cn */, { 0x1000c, 0x1000c} /* Cn */,
{ 0x10027, 0x10027} /* Cn */, { 0x1003b, 0x1003b} /* Cn */,
{ 0x1003e, 0x1003e} /* Cn */, { 0x1004e, 0x1004f} /* Cn */,
{ 0x1005e, 0x1007f} /* Cn */, { 0x100fb, 0x100ff} /* Cn */,
{ 0x206A, 0x206F} /* Cf */,
{ 0x2072, 0x2073} /* Cn */, { 0x208F, 0x208F} /* Cn */,
{ 0x2095, 0x209F} /* Cn */, { 0x20B6, 0x20CF} /* Cn */,
{ 0x20F0, 0x20FF} /* Cn */, { 0x214F, 0x2152} /* Cn */,
{ 0x2185, 0x218F} /* Cn */, { 0x23E8, 0x23FF} /* Cn */,
{ 0x2427, 0x243F} /* Cn */, { 0x244B, 0x245F} /* Cn */,
{ 0x269D, 0x269F} /* Cn */, { 0x26B3, 0x2700} /* Cn */,
{ 0x2705, 0x2705} /* Cn */, { 0x270A, 0x270B} /* Cn */,
{ 0x2728, 0x2728} /* Cn */, { 0x274C, 0x274C} /* Cn */,
{ 0x274E, 0x274E} /* Cn */, { 0x2753, 0x2755} /* Cn */,
{ 0x2757, 0x2757} /* Cn */, { 0x275F, 0x2760} /* Cn */,
{ 0x2795, 0x2797} /* Cn */, { 0x27B0, 0x27B0} /* Cn */,
{ 0x27BF, 0x27BF} /* Cn */, { 0x27CB, 0x27CF} /* Cn */,
{ 0x27EC, 0x27EF} /* Cn */, { 0x2B1B, 0x2B1F} /* Cn */,
{ 0x2B24, 0x2BFF} /* Cn */, { 0x2C2F, 0x2C2F} /* Cn */,
{ 0x2C5F, 0x2C5F} /* Cn */, { 0x2C6D, 0x2C73} /* Cn */,
{ 0x2C78, 0x2C7F} /* Cn */, { 0x2CEB, 0x2CF8} /* Cn */,
{ 0x2D26, 0x2D2F} /* Cn */, { 0x2D66, 0x2D6E} /* Cn */,
{ 0x2D70, 0x2D7F} /* Cn */, { 0x2D97, 0x2D9F} /* Cn */,
{ 0x2DA7, 0x2DA7} /* Cn */, { 0x2DAF, 0x2DAF} /* Cn */,
{ 0x2DB7, 0x2DB7} /* Cn */, { 0x2DBF, 0x2DBF} /* Cn */,
{ 0x2DC7, 0x2DC7} /* Cn */, { 0x2DCF, 0x2DCF} /* Cn */,
{ 0x2DD7, 0x2DD7} /* Cn */, { 0x2DDF, 0x2DFF} /* Cn */,
{ 0x2E18, 0x2E1B} /* Cn */, { 0x2E1E, 0x2E7F} /* Cn */,
{ 0x2E9A, 0x2E9A} /* Cn */, { 0x2EF4, 0x2EFF} /* Cn */,
{ 0x2FD6, 0x2FEF} /* Cn */, { 0x2FFC, 0x2FFF} /* Cn */,
{ 0x3040, 0x3040} /* Cn */, { 0x3097, 0x3098} /* Cn */,
{ 0x3100, 0x3104} /* Cn */, { 0x312D, 0x3130} /* Cn */,
{ 0x318F, 0x318F} /* Cn */, { 0x31B8, 0x31BF} /* Cn */,
{ 0x31D0, 0x31EF} /* Cn */, { 0x321F, 0x321F} /* Cn */,
{ 0x3244, 0x324F} /* Cn */, { 0x32FF, 0x32FF} /* Cn */,
{ 0x4DB6, 0x4DBF} /* Cn */, { 0x9FBC, 0x9FFF} /* Cn */,
{ 0xA48D, 0xA48F} /* Cn */, { 0xA4C7, 0xA6FF} /* Cn */,
{ 0xA71B, 0xA71F} /* Cn */, { 0xA722, 0xA7FF} /* Cn */,
{ 0xA82C, 0xA83F} /* Cn */, { 0xA878, 0xABFF} /* Cn */,
{ 0xD7A4, 0xD7FF} /* Cn */,
{ 0xD800, 0xDFFF} /* Cs */,
{ 0xE000, 0xF8FF} /* Co */,
{ 0xFA2E, 0xFA2F} /* Cn */, { 0xFA6B, 0xFA6F} /* Cn */,
{ 0xFADA, 0xFAFF} /* Cn */, { 0xFB07, 0xFB12} /* Cn */,
{ 0xFB18, 0xFB1C} /* Cn */, { 0xFB37, 0xFB37} /* Cn */,
{ 0xFB3D, 0xFB3D} /* Cn */, { 0xFB3F, 0xFB3F} /* Cn */,
{ 0xFB42, 0xFB42} /* Cn */, { 0xFB45, 0xFB45} /* Cn */,
{ 0xFBB2, 0xFBD2} /* Cn */, { 0xFD40, 0xFD4F} /* Cn */,
{ 0xFD90, 0xFD91} /* Cn */, { 0xFDC8, 0xFDEF} /* Cn */,
{ 0xFDFE, 0xFDFF} /* Cn */, { 0xFE1A, 0xFE1F} /* Cn */,
{ 0xFE24, 0xFE2F} /* Cn */, { 0xFE53, 0xFE53} /* Cn */,
{ 0xFE67, 0xFE67} /* Cn */, { 0xFE6C, 0xFE6F} /* Cn */,
{ 0xFE75, 0xFE75} /* Cn */, { 0xFEFD, 0xFEFE} /* Cn */,
{ 0xFEFF, 0xFEFF} /* Cf */,
{ 0xFF00, 0xFF00} /* Cn */, { 0xFFBF, 0xFFC1} /* Cn */,
{ 0xFFC8, 0xFFC9} /* Cn */, { 0xFFD0, 0xFFD1} /* Cn */,
{ 0xFFD8, 0xFFD9} /* Cn */, { 0xFFDD, 0xFFDF} /* Cn */,
{ 0xFFE7, 0xFFE7} /* Cn */, { 0xFFEF, 0xFFF8} /* Cn */,
{ 0xFFF9, 0xFFFB} /* Cf */,
{ 0xFFFE, 0xFFFF} /* Cn */, { 0x1000C, 0x1000C} /* Cn */,
{ 0x10027, 0x10027} /* Cn */, { 0x1003B, 0x1003B} /* Cn */,
{ 0x1003E, 0x1003E} /* Cn */, { 0x1004E, 0x1004F} /* Cn */,
{ 0x1005E, 0x1007F} /* Cn */, { 0x100FB, 0x100FF} /* Cn */,
{ 0x10103, 0x10106} /* Cn */, { 0x10134, 0x10136} /* Cn */,
{ 0x10140, 0x102ff} /* Cn */, { 0x1031f, 0x1031f} /* Cn */,
{ 0x10324, 0x1032f} /* Cn */, { 0x1034b, 0x1037f} /* Cn */,
{ 0x1039e, 0x1039e} /* Cn */, { 0x103a0, 0x103ff} /* Cn */,
{ 0x1049e, 0x1049f} /* Cn */, { 0x104aa, 0x107ff} /* Cn */,
{ 0x1018B, 0x102FF} /* Cn */, { 0x1031F, 0x1031F} /* Cn */,
{ 0x10324, 0x1032F} /* Cn */, { 0x1034B, 0x1037F} /* Cn */,
{ 0x1039E, 0x1039E} /* Cn */, { 0x103C4, 0x103C7} /* Cn */,
{ 0x103D6, 0x103FF} /* Cn */,
{ 0x1049E, 0x1049F} /* Cn */, { 0x104AA, 0x107FF} /* Cn */,
{ 0x10806, 0x10807} /* Cn */, { 0x10809, 0x10809} /* Cn */,
{ 0x10836, 0x10836} /* Cn */, { 0x10839, 0x1083b} /* Cn */,
{ 0x1083d, 0x1083e} /* Cn */, { 0x10840, 0x1cfff} /* Cn */,
{ 0x1d0f6, 0x1d0ff} /* Cn */, { 0x1d127, 0x1d129} /* Cn */,
{ 0x1d173, 0x1d17a} /* Cf */,
{ 0x1d1de, 0x1d2ff} /* Cn */, { 0x1d357, 0x1d3ff} /* Cn */,
{ 0x1d455, 0x1d455} /* Cn */, { 0x1d49d, 0x1d49d} /* Cn */,
{ 0x1d4a0, 0x1d4a1} /* Cn */, { 0x1d4a3, 0x1d4a4} /* Cn */,
{ 0x1d4a7, 0x1d4a8} /* Cn */, { 0x1d4ad, 0x1d4ad} /* Cn */,
{ 0x1d4ba, 0x1d4ba} /* Cn */, { 0x1d4bc, 0x1d4bc} /* Cn */,
{ 0x1d4c4, 0x1d4c4} /* Cn */, { 0x1d506, 0x1d506} /* Cn */,
{ 0x1d50b, 0x1d50c} /* Cn */, { 0x1d515, 0x1d515} /* Cn */,
{ 0x1d51d, 0x1d51d} /* Cn */, { 0x1d53a, 0x1d53a} /* Cn */,
{ 0x1d53f, 0x1d53f} /* Cn */, { 0x1d545, 0x1d545} /* Cn */,
{ 0x1d547, 0x1d549} /* Cn */, { 0x1d551, 0x1d551} /* Cn */,
{ 0x1d6a4, 0x1d6a7} /* Cn */, { 0x1d7ca, 0x1d7cd} /* Cn */,
{ 0x1d800, 0x1ffff} /* Cn */, { 0x2a6d7, 0x2f7ff} /* Cn */,
{ 0x2fa1e, 0xe0000} /* Cn */,
{ 0xe0001, 0xe0001} /* Cf */,
{ 0xe0002, 0xe001f} /* Cn */,
{ 0xe0020, 0xe007f} /* Cf */,
{ 0xe0080, 0xe00ff} /* Cn */, { 0xe01f0, 0xeffff} /* Cn */,
{ 0xf0000, 0xffffd} /* Co */,
{ 0xffffe, 0xfffff} /* Cn */,
{0x100000,0x10fffd} /* Co */,
{0x10fffe,0x10ffff} /* Cn */,
{0x110000,0x7fffffff} /* ISO 10646?? */
{ 0x10836, 0x10836} /* Cn */, { 0x10839, 0x1083B} /* Cn */,
{ 0x1083D, 0x1083E} /* Cn */, { 0x10840, 0x108FF} /* Cn */,
{ 0x1091A, 0x1091E} /* Cn */, { 0x10920, 0x109FF} /* Cn */,
{ 0x10A04, 0x10A04} /* Cn */, { 0x10A07, 0x10A0B} /* Cn */,
{ 0x10A14, 0x10A14} /* Cn */, { 0x10A18, 0x10A18} /* Cn */,
{ 0x10A34, 0x10A37} /* Cn */, { 0x10A3B, 0x10A3E} /* Cn */,
{ 0x10A48, 0x10A4F} /* Cn */, { 0x10A59, 0x11FFF} /* Cn */,
{ 0x1236F, 0x123FF} /* Cn */, { 0x12463, 0x1246F} /* Cn */,
{ 0x12474, 0x1CFFF} /* Cn */, { 0x1D0F6, 0x1D0FF} /* Cn */,
{ 0x1D127, 0x1D129} /* Cn */,
{ 0x1D173, 0x1D17A} /* Cf */,
{ 0x1D1DE, 0x1D1FF} /* Cn */, { 0x1D246, 0x1D2FF} /* Cn */,
{ 0x1D357, 0x1D35F} /* Cn */, { 0x1D372, 0x1D3FF} /* Cn */,
{ 0x1D455, 0x1D455} /* Cn */, { 0x1D49D, 0x1D49D} /* Cn */,
{ 0x1D4A0, 0x1D4A1} /* Cn */, { 0x1D4A3, 0x1D4A4} /* Cn */,
{ 0x1D4A7, 0x1D4A8} /* Cn */, { 0x1D4AD, 0x1D4AD} /* Cn */,
{ 0x1D4BA, 0x1D4BA} /* Cn */, { 0x1D4BC, 0x1D4BC} /* Cn */,
{ 0x1D4C4, 0x1D4C4} /* Cn */, { 0x1D506, 0x1D506} /* Cn */,
{ 0x1D50B, 0x1D50C} /* Cn */, { 0x1D515, 0x1D515} /* Cn */,
{ 0x1D51D, 0x1D51D} /* Cn */, { 0x1D53A, 0x1D53A} /* Cn */,
{ 0x1D53F, 0x1D53F} /* Cn */, { 0x1D545, 0x1D545} /* Cn */,
{ 0x1D547, 0x1D549} /* Cn */, { 0x1D551, 0x1D551} /* Cn */,
{ 0x1D6A6, 0x1D6A7} /* Cn */, { 0x1D7CC, 0x1D7CD} /* Cn */,
{ 0x1D800, 0x1FFFF} /* Cn */, { 0x2A6D7, 0x2F7FF} /* Cn */,
{ 0x2FA1E, 0xE0000} /* Cn */,
{ 0xE0001, 0xE0001} /* Cf */,
{ 0xE0002, 0xE001F} /* Cn */,
{ 0xE0020, 0xE007F} /* Cf */,
{ 0xE0080, 0xE00FF} /* Cn */, { 0xE01F0, 0xEFFFF} /* Cn */,
{ 0xF0000, 0xFFFFD} /* Co */,
{ 0xFFFFE, 0xFFFFF} /* Cn */,
{0x100000,0x10FFFD} /* Co */,
{0x10FFFE,0x10FFFF} /* Cn */,
{0x110000,0x7FFFFFFF} /* ISO 10646?? */
};
/*
* Double width characters
* W: East Asian Wide
* F: East Asian Full-width
* Unassigned code points may be included when they allow ranges to be merged.
* Last synched with
* <http://www.unicode.org/Public/5.0.0/ucd/EastAsianWidth-5.0.0d2.txt>
* dated 2005-11-08T01:32:56Z
*/
static struct wchar_range wide_table[] = {
{ 0x1100, 0x115f} /* W */, { 0x2329, 0x232a} /* W */,
{ 0x1100, 0x115F} /* W */, { 0x2329, 0x232A} /* W */,
{ 0x2E80, 0x2FFB} /* W */,
{ 0x3000, 0x3000} /* F */,
{ 0x3001, 0x303E} /* W */, { 0x3041, 0x4DB5} /* W */,
{ 0x4E00, 0x9FA5} /* W */, { 0xA000, 0xA4C6} /* W */,
{ 0xAC00, 0xD7A3} /* W */, { 0xF900, 0xFA6A} /* W */,
{ 0xFE30, 0xFE6B} /* W */,
{ 0x4E00, 0x9FBB} /* W */, { 0xA000, 0xA4C6} /* W */,
{ 0xAC00, 0xD7A3} /* W */, { 0xF900, 0xFAD9} /* W */,
{ 0xFE10, 0xFE19} /* W */, { 0xFE30, 0xFE6B} /* W */,
{ 0xFF01, 0xFF60} /* F */, { 0xFFE0, 0xFFE6} /* F */,
{ 0x20000, 0x2FFFD} /* W */, { 0x30000, 0x3FFFD} /* W */,
};
static int

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2005 Mark Nudelman
* Copyright (C) 2005-2007 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-2004 Mark Nudelman
* Copyright (C) 1984-2007 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-2005 Mark Nudelman
* Copyright (C) 1984-2007 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.
@ -68,22 +68,23 @@ struct mlist
struct mlist *prev;
struct mlist *curr_mp;
char *string;
int modified;
};
/*
* These are the various command histories that exist.
*/
struct mlist mlist_search =
{ &mlist_search, &mlist_search, &mlist_search, NULL };
{ &mlist_search, &mlist_search, &mlist_search, NULL, 0 };
public void * constant ml_search = (void *) &mlist_search;
struct mlist mlist_examine =
{ &mlist_examine, &mlist_examine, &mlist_examine, NULL };
{ &mlist_examine, &mlist_examine, &mlist_examine, NULL, 0 };
public void * constant ml_examine = (void *) &mlist_examine;
#if SHELL_ESCAPE || PIPEC
struct mlist mlist_shell =
{ &mlist_shell, &mlist_shell, &mlist_shell, NULL };
{ &mlist_shell, &mlist_shell, &mlist_shell, NULL, 0 };
public void * constant ml_shell = (void *) &mlist_shell;
#endif
@ -124,12 +125,11 @@ cmd_reset()
}
/*
* Clear command line on display.
* Clear command line.
*/
public void
clear_cmd()
{
clear_bot();
cmd_col = prompt_col = 0;
cmd_mbc_buf_len = 0;
}
@ -767,6 +767,7 @@ cmd_accept()
if (curr_mlist == NULL)
return;
cmd_addhist(curr_mlist, cmdbuf);
curr_mlist->modified = 1;
#endif
}
@ -1275,13 +1276,21 @@ cmd_char(c)
* Return the number currently in the command buffer.
*/
public LINENUM
cmd_int()
cmd_int(frac)
long *frac;
{
register char *p;
char *p;
LINENUM n = 0;
int err;
for (p = cmdbuf; *p != '\0'; p++)
n = (10 * n) + (*p - '0');
for (p = cmdbuf; *p >= '0' && *p <= '9'; p++)
n = (n * 10) + (*p - '0');
*frac = 0;
if (*p++ == '.')
{
*frac = getfraction(&p, NULL, &err);
/* {{ do something if err is set? }} */
}
return (n);
}
@ -1294,6 +1303,17 @@ get_cmdbuf()
return (cmdbuf);
}
/*
* Return the last (most recent) string in the current command history.
*/
public char *
cmd_lastpattern()
{
if (curr_mlist == NULL)
return (NULL);
return (curr_mlist->curr_mp->prev->string);
}
#if CMD_HISTORY
/*
* Get the name of the history file.
@ -1309,7 +1329,7 @@ histfile_name()
name = lgetenv("LESSHISTFILE");
if (name != NULL && *name != '\0')
{
if (strcmp(name, "-") == 0)
if (strcmp(name, "-") == 0 || strcmp(name, "/dev/null") == 0)
/* $LESSHISTFILE == "-" means don't use a history file. */
return (NULL);
return (save(name));
@ -1428,6 +1448,8 @@ save_cmdhist()
filename = histfile_name();
if (filename == NULL)
return;
if (!mlist_search.modified && !mlist_shell.modified)
return;
f = fopen(filename, "w");
free(filename);
if (f == NULL)

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 1984-2005 Mark Nudelman
* Copyright (C) 1984-2007 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.
@ -23,7 +23,6 @@
extern int erase_char, erase2_char, kill_char;
extern int sigs;
extern int quit_at_eof;
extern int quit_if_one_screen;
extern int squished;
extern int hit_eof;
@ -54,6 +53,8 @@ extern char *editproto;
#endif
extern int screen_trashed; /* The screen has been overwritten */
extern int shift_count;
extern int oldbot;
extern int forw_prompt;
static char ungot[UNGOT_SIZE];
static char *ungotp = NULL;
@ -63,6 +64,7 @@ static char *shellcmd = NULL; /* For holding last shell command for "!!" */
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 int optflag;
static int optgetname;
@ -75,7 +77,7 @@ static char pipec;
static void multi_search();
/*
* Move the cursor to lower left before executing a command.
* Move the cursor to start of prompt line before executing a command.
* This looks nicer if the command takes a long time before
* updating the screen.
*/
@ -83,7 +85,7 @@ static void multi_search();
cmd_exec()
{
clear_attn();
lower_left();
line_left();
flush();
}
@ -98,6 +100,7 @@ start_mca(action, prompt, mlist, cmdflags)
int cmdflags;
{
mca = action;
clear_bot();
clear_cmd();
cmd_putstr(prompt);
set_mlist(mlist, cmdflags);
@ -120,6 +123,7 @@ mca_search()
else
mca = A_B_SEARCH;
clear_bot();
clear_cmd();
if (search_type & SRCH_NO_MATCH)
@ -155,6 +159,7 @@ mca_opt_toggle()
dash = (flag == OPT_NO_TOGGLE) ? "_" : "-";
mca = A_OPT_TOGGLE;
clear_bot();
clear_cmd();
cmd_putstr(dash);
if (optgetname)
@ -291,14 +296,14 @@ mca_char(c)
* Entering digits of a number.
* Terminated by a non-digit.
*/
if ((c < '0' || c > '9') &&
if (!((c >= '0' && c <= '9') || c == '.') &&
editchar(c, EC_PEEK|EC_NOHISTORY|EC_NOCOMPLETE|EC_NORIGHTLEFT) == A_INVALID)
{
/*
* Not part of the number.
* Treat as a normal command character.
*/
number = cmd_int();
number = cmd_int(&fraction);
mca = 0;
cmd_accept();
return (NO_MCA);
@ -606,7 +611,7 @@ prompt()
* {{ Relying on "first prompt" to detect a single-screen file
* fails if +G is used, for example. }}
*/
if ((quit_at_eof == OPT_ONPLUS || quit_if_one_screen) &&
if ((get_quit_at_eof() == OPT_ONPLUS || quit_if_one_screen) &&
hit_eof && !(ch_getflags() & CH_HELPFILE) &&
next_ifile(curr_ifile) == NULL_IFILE)
quit(QUIT_OK);
@ -616,7 +621,7 @@ prompt()
* If the -e flag is set and we've hit EOF on the last file,
* and the file is squished (shorter than the screen), quit.
*/
if (quit_at_eof && squished &&
if (get_quit_at_eof() && squished &&
next_ifile(curr_ifile) == NULL_IFILE)
quit(QUIT_OK);
#endif
@ -631,7 +636,20 @@ prompt()
/*
* Select the proper prompt and display it.
*/
/*
* If the previous action was a forward movement,
* don't clear the bottom line of the display;
* just print the prompt since the forward movement guarantees
* that we're in the right position to display the prompt.
* Clearing the line could cause a problem: for example, if the last
* line displayed ended at the right screen edge without a newline,
* then clearing would clear the last displayed line rather than
* the prompt line.
*/
if (!forw_prompt)
clear_bot();
clear_cmd();
forw_prompt = 0;
p = pr_string();
if (p == NULL || *p == '\0')
putchr(':');
@ -641,6 +659,7 @@ prompt()
putstr(p);
at_exit();
}
clear_eol();
}
/*
@ -1161,11 +1180,17 @@ commands()
* Go to a specified percentage into the file.
*/
if (number < 0)
{
number = 0;
fraction = 0;
}
if (number > 100)
{
number = 100;
fraction = 0;
}
cmd_exec();
jump_percent((int) number);
jump_percent((int) number, fraction);
break;
case A_GOEND:
@ -1386,7 +1411,7 @@ commands()
number = 1;
if (edit_next((int) number))
{
if (quit_at_eof && hit_eof &&
if (get_quit_at_eof() && hit_eof &&
!(ch_getflags() & CH_HELPFILE))
quit(QUIT_OK);
parg.p_string = (number > 1) ? "(N-th) " : "";

7353
contrib/less/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-2004 Mark Nudelman
# Copyright (C) 1984-2007 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.
@ -64,7 +64,7 @@ if test "x$TERMLIBS" = x; then
fi
fi
dnl -- Try ncursesw.
# -- Try ncursesw.
if test "x$TERMLIBS" = x; then
if test $have_ncursesw = yes; then
TERMLIBS="-lncursesw"
@ -154,7 +154,7 @@ LIBS="$LIBS $TERMLIBS"
# Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS([ctype.h errno.h fcntl.h limits.h stdio.h stdlib.h string.h termcap.h termio.h termios.h time.h unistd.h values.h sys/ioctl.h sys/stream.h sys/ptem.h])
AC_CHECK_HEADERS([ctype.h errno.h fcntl.h limits.h stdio.h stdlib.h string.h termcap.h termio.h termios.h time.h unistd.h values.h sys/ioctl.h sys/stream.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_STAT
@ -227,7 +227,29 @@ AC_TRY_COMPILE([#include <time.h>], [time_t t = 0;],
# Checks for library functions.
AC_TYPE_SIGNAL
AC_CHECK_FUNCS([fsync memcpy popen _setjmp sigprocmask sigsetmask snprintf stat strchr strstr system fchmod])
AC_CHECK_FUNCS([fsync popen _setjmp sigprocmask sigsetmask snprintf stat system fchmod])
# AC_CHECK_FUNCS may not work for inline functions, so test these separately.
AC_MSG_CHECKING(for memcpy)
AC_TRY_LINK([
#if HAVE_STRING_H
#include <string.h>
#endif], [memcpy(0,0,0);],
[AC_MSG_RESULT(yes); AC_DEFINE(HAVE_MEMCPY)], [AC_MSG_RESULT(no)])
AC_MSG_CHECKING(for strchr)
AC_TRY_LINK([
#if HAVE_STRING_H
#include <string.h>
#endif], [strchr("x",'x');],
[AC_MSG_RESULT(yes); AC_DEFINE(HAVE_STRCHR)], [AC_MSG_RESULT(no)])
AC_MSG_CHECKING(for strstr)
AC_TRY_LINK([
#if HAVE_STRING_H
#include <string.h>
#endif], [strstr("x","x");],
[AC_MSG_RESULT(yes); AC_DEFINE(HAVE_STRSTR)], [AC_MSG_RESULT(no)])
# Some systems have termios.h but not the corresponding functions.
AC_CHECK_FUNC(tcgetattr, AC_DEFINE(HAVE_TERMIOS_FUNCS))
@ -256,11 +278,7 @@ AC_MSG_CHECKING(for sys_errlist)
AC_TRY_LINK(, [extern char *sys_errlist[]; static char **x; x = sys_errlist;],
[AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SYS_ERRLIST)], [AC_MSG_RESULT(no)])
AC_MSG_CHECKING(for sigset_t)
AC_TRY_LINK([
#include <signal.h>
], [sigset_t s; s = 0;],
[AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SIGSET_T)], [AC_MSG_RESULT(no)])
AC_CHECK_TYPES([sigset_t],,,[#include <signal.h>])
AC_MSG_CHECKING(for sigemptyset)
AC_TRY_LINK([
@ -532,6 +550,12 @@ AH_TOP([
*/
#define PATHNAME_SEP "/"
/*
* The value returned from tgetent on success.
* Some HP-UX systems return 0 on success.
*/
#define TGETENT_OK 1
/*
* HAVE_SYS_TYPES_H is 1 if your system has <sys/types.h>.
*/
@ -561,7 +585,7 @@ AH_TOP([
/*
* Default shell metacharacters and meta-escape character.
*/
#define DEF_METACHARS "; *?\t\n'\"()<>[]|&^`#\\"
#define DEF_METACHARS "; *?\t\n'\"()<>[]|&^`#\\$%=~"
#define DEF_METAESCAPE "\\"
/*
@ -569,6 +593,15 @@ AH_TOP([
*/
#define HAVE_DUP 1
/* Define to 1 if you have the memcpy() function. */
#define HAVE_MEMCPY 1
/* Define to 1 if you have the strchr() function. */
#define HAVE_STRCHR 1
/* Define to 1 if you have the strstr() function. */
#define HAVE_STRSTR 1
/*
* Sizes of various buffers.
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 1984-2004 Mark Nudelman
* Copyright (C) 1984-2007 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.
@ -120,6 +120,7 @@ static unsigned char cmdtable[] =
'7',0, A_DIGIT,
'8',0, A_DIGIT,
'9',0, A_DIGIT,
'.',0, A_DIGIT,
'=',0, A_STAT,
CONTROL('G'),0, A_STAT,

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 1984-2004 Mark Nudelman
* Copyright (C) 1984-2007 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,12 @@
*/
#define PATHNAME_SEP "/"
/*
* The value returned from tgetent on success.
* Some HP-UX systems return 0 on success.
*/
#define TGETENT_OK 1
/*
* HAVE_SYS_TYPES_H is 1 if your system has <sys/types.h>.
*/
@ -156,7 +162,7 @@
/*
* Default shell metacharacters and meta-escape character.
*/
#define DEF_METACHARS "; *?\t\n'\"()<>[]|&^`#\\"
#define DEF_METACHARS "; *?\t\n'\"()<>[]|&^`#\\$%=~"
#define DEF_METAESCAPE "\\"
/*
@ -164,6 +170,15 @@
*/
#define HAVE_DUP 1
/* Define to 1 if you have the memcpy() function. */
#define HAVE_MEMCPY 1
/* Define to 1 if you have the strchr() function. */
#define HAVE_STRCHR 1
/* Define to 1 if you have the strstr() function. */
#define HAVE_STRSTR 1
/*
* Sizes of various buffers.
*/
@ -225,9 +240,6 @@
/* Define HAVE_LOCALE if you have locale.h and setlocale. */
#undef HAVE_LOCALE
/* Define to 1 if you have the `memcpy' function. */
#undef HAVE_MEMCPY
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
@ -261,7 +273,7 @@
/* Define to 1 if you have the `sigsetmask' function. */
#undef HAVE_SIGSETMASK
/* Define HAVE_SIGSET_T you have the sigset_t type. */
/* Define to 1 if the system has the type `sigset_t'. */
#undef HAVE_SIGSET_T
/* Define to 1 if you have the `snprintf' function. */
@ -279,9 +291,6 @@
/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
/* Define to 1 if you have the `strchr' function. */
#undef HAVE_STRCHR
/* Define HAVE_STRERROR if you have the strerror() function. */
#undef HAVE_STRERROR
@ -291,9 +300,6 @@
/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* Define to 1 if you have the `strstr' function. */
#undef HAVE_STRSTR
/* Define to 1 if you have the `system' function. */
#undef HAVE_SYSTEM
@ -303,9 +309,6 @@
/* Define to 1 if you have the <sys/ioctl.h> header file. */
#undef HAVE_SYS_IOCTL_H
/* Define to 1 if you have the <sys/ptem.h> header file. */
#undef HAVE_SYS_PTEM_H
/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
@ -401,8 +404,8 @@
/* Define to empty if `const' does not conform to ANSI C. */
#undef const
/* Define to `long' if <sys/types.h> does not define. */
/* Define to `long int' if <sys/types.h> does not define. */
#undef off_t
/* Define to `unsigned' if <sys/types.h> does not define. */
/* Define to `unsigned int' if <sys/types.h> does not define. */
#undef size_t

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 1984-2004 Mark Nudelman
* Copyright (C) 1984-2007 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-2004 Mark Nudelman
* Copyright (C) 1984-2007 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-2004 Mark Nudelman
* Copyright (C) 1984-2007 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-2005 Mark Nudelman
* Copyright (C) 1984-2007 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-2005 Mark Nudelman
* Copyright (C) 1984-2007 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.
@ -51,6 +51,7 @@
extern int force_open;
extern int secure;
extern int use_lessopen;
extern int ctldisp;
extern IFILE curr_ifile;
extern IFILE old_ifile;
#if SPACES_IN_FILENAMES
@ -470,7 +471,8 @@ bin_file(f)
{
int i;
int n;
unsigned char data[64];
int bin_count = 0;
unsigned char data[256];
if (!seekable(f))
return (0);
@ -478,9 +480,20 @@ bin_file(f)
return (0);
n = read(f, data, sizeof(data));
for (i = 0; i < n; i++)
if (binary_char(data[i]))
return (1);
return (0);
{
char c = data[i];
if (ctldisp == OPT_ONPLUS && c == ESC)
{
while (++i < n && is_ansi_middle(data[i]))
continue;
} else if (binary_char(c))
bin_count++;
}
/*
* Call it a binary file if there are more than 5 binary characters
* in the first 256 bytes of the file.
*/
return (bin_count > 5);
}
/*
@ -966,7 +979,7 @@ bad_file(filename)
register char *m = NULL;
filename = shell_unquote(filename);
if (is_dir(filename))
if (!force_open && is_dir(filename))
{
static char is_a_dir[] = " is a directory";

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 1984-2005 Mark Nudelman
* Copyright (C) 1984-2007 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.
@ -21,18 +21,19 @@ public int hit_eof; /* Keeps track of how many times we hit end of file */
public int screen_trashed;
public int squished;
public int no_back_scroll = 0;
public int forw_prompt;
extern int sigs;
extern int top_scroll;
extern int quiet;
extern int sc_width, sc_height;
extern int quit_at_eof;
extern int plusoption;
extern int forw_scroll;
extern int back_scroll;
extern int ignore_eoi;
extern int clear_bg;
extern int final_attr;
extern int oldbot;
#if TAGS
extern char *tagoption;
#endif
@ -77,7 +78,7 @@ eof_check()
* of the screen; this can happen when we display a short file
* for the first time.
*/
static void
public void
squish_check()
{
if (!squished)
@ -135,8 +136,7 @@ forw(n, pos, force, only_last, nblank)
pos_clear();
add_forw_pos(pos);
force = 1;
if (top_scroll == OPT_ONPLUS || (first_time && top_scroll != OPT_ON))
clear();
clear();
home();
} else
{
@ -155,8 +155,7 @@ forw(n, pos, force, only_last, nblank)
force = 1;
if (top_scroll)
{
if (top_scroll == OPT_ONPLUS)
clear();
clear();
home();
} else if (!first_time)
{
@ -230,9 +229,16 @@ forw(n, pos, force, only_last, nblank)
squished = 1;
continue;
}
if (top_scroll == OPT_ON)
clear_eol();
put_line();
#if 0
/* {{
* Can't call clear_eol here. The cursor might be at end of line
* on an ignaw terminal, so clear_eol would clear the last char
* of the current line instead of all of the next line.
* If we really need to do this on clear_bg terminals, we need
* to find a better way.
* }}
*/
if (clear_bg && apply_at_specials(final_attr) != AT_NORMAL)
{
/*
@ -244,6 +250,8 @@ forw(n, pos, force, only_last, nblank)
*/
clear_eol();
}
#endif
forw_prompt = 1;
}
if (ignore_eoi)
@ -309,6 +317,8 @@ back(n, pos, force, only_last)
eof_bell();
else if (do_repaint)
repaint();
else if (!oldbot)
lower_left();
(void) currline(BOTTOM);
}
@ -324,7 +334,7 @@ forward(n, force, only_last)
{
POSITION pos;
if (quit_at_eof && hit_eof && !(ch_getflags() & CH_HELPFILE))
if (get_quit_at_eof() && hit_eof && !(ch_getflags() & CH_HELPFILE))
{
/*
* If the -e flag is set and we're trying to go

View File

@ -14,6 +14,7 @@
public void remove_top ();
public void win32_scroll_up ();
public void lower_left ();
public void line_left ();
public void check_winch ();
public void goto_line ();
public void vbell ();
@ -70,6 +71,7 @@
public int cmd_char ();
public LINENUM cmd_int ();
public char * get_cmdbuf ();
public char * cmd_lastpattern ();
public void init_cmdhist ();
public void save_cmdhist ();
public int in_mca ();
@ -118,6 +120,7 @@
public char * bad_file ();
public POSITION filesize ();
public char * shell_coption ();
public void squish_check ();
public void forw ();
public void back ();
public void forward ();
@ -181,6 +184,8 @@
public void opt_o ();
public void opt__O ();
public void opt_l ();
public void opt_j ();
public void calc_jump_sline ();
public void opt_k ();
public void opt_t ();
public void opt__T ();
@ -201,6 +206,8 @@
public int isoptpending ();
public void nopendopt ();
public int getnum ();
public long getfraction ();
public int get_quit_at_eof ();
public void init_option ();
public struct loption * findopt ();
public struct loption * findopt_name ();

View File

@ -118,8 +118,8 @@ constant char helpdata[] = {
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','N','u','m','b','e','r',' ','o','f',' ','b','u','f','f','e','r','s','.','\n',
' ',' ','-','B',' ',' ','.','.','.','.','.','.','.','.',' ',' ','-','-','a','u','t','o','-','b','u','f','f','e','r','s','\n',
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','D','o','n','\'','t',' ','a','u','t','o','m','a','t','i','c','a','l','l','y',' ','a','l','l','o','c','a','t','e',' ','b','u','f','f','e','r','s',' ','f','o','r',' ','p','i','p','e','s','.','\n',
' ',' ','-','c',' ',' ','-','C',' ',' ','.','.','.','.',' ',' ','-','-','c','l','e','a','r','-','s','c','r','e','e','n',' ',' ','-','-','C','L','E','A','R','-','S','C','R','E','E','N','\n',
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','R','e','p','a','i','n','t',' ','b','y',' ','s','c','r','o','l','l','i','n','g','/','c','l','e','a','r','i','n','g','.','\n',
' ',' ','-','c',' ',' ','.','.','.','.','.','.','.','.',' ',' ','-','-','c','l','e','a','r','-','s','c','r','e','e','n','\n',
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','R','e','p','a','i','n','t',' ','b','y',' ','c','l','e','a','r','i','n','g',' ','r','a','t','h','e','r',' ','t','h','a','n',' ','s','c','r','o','l','l','i','n','g','.','\n',
' ',' ','-','d',' ',' ','.','.','.','.','.','.','.','.',' ',' ','-','-','d','u','m','b','\n',
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','D','u','m','b',' ','t','e','r','m','i','n','a','l','.','\n',
' ',' ','-','D',' ','[','_','\b','x','_','\b','n','_','\b','.','_','\b','n',']',' ',' ','.',' ',' ','-','-','c','o','l','o','r','=','_','\b','x','_','\b','n','_','\b','.','_','\b','n','\n',
@ -151,7 +151,7 @@ constant char helpdata[] = {
' ',' ','-','m',' ',' ','-','M',' ',' ','.','.','.','.',' ',' ','-','-','l','o','n','g','-','p','r','o','m','p','t',' ',' ','-','-','L','O','N','G','-','P','R','O','M','P','T','\n',
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','S','e','t',' ','p','r','o','m','p','t',' ','s','t','y','l','e','.','\n',
' ',' ','-','n',' ',' ','-','N',' ',' ','.','.','.','.',' ',' ','-','-','l','i','n','e','-','n','u','m','b','e','r','s',' ',' ','-','-','L','I','N','E','-','N','U','M','B','E','R','S','\n',
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','U','s','e',' ','l','i','n','e',' ','n','u','m','b','e','r','s','.','\n',
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','D','o','n','\'','t',' ','u','s','e',' ','l','i','n','e',' ','n','u','m','b','e','r','s','.','\n',
' ',' ','-','o',' ','[','_','\b','f','_','\b','i','_','\b','l','_','\b','e',']',' ',' ','.',' ',' ','-','-','l','o','g','-','f','i','l','e','=','[','_','\b','f','_','\b','i','_','\b','l','_','\b','e',']','\n',
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','C','o','p','y',' ','t','o',' ','l','o','g',' ','f','i','l','e',' ','(','s','t','a','n','d','a','r','d',' ','i','n','p','u','t',' ','o','n','l','y',')','.','\n',
' ',' ','-','O',' ','[','_','\b','f','_','\b','i','_','\b','l','_','\b','e',']',' ',' ','.',' ',' ','-','-','L','O','G','-','F','I','L','E','=','[','_','\b','f','_','\b','i','_','\b','l','_','\b','e',']','\n',
@ -220,6 +220,7 @@ constant char helpdata[] = {
' ','T','A','B',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','C','o','m','p','l','e','t','e',' ','f','i','l','e','n','a','m','e',' ','&',' ','c','y','c','l','e','.','\n',
' ','S','H','I','F','T','-','T','A','B',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','E','S','C','-','T','A','B',' ',' ',' ','C','o','m','p','l','e','t','e',' ','f','i','l','e','n','a','m','e',' ','&',' ','r','e','v','e','r','s','e',' ','c','y','c','l','e','.','\n',
' ','C','N','T','L','-','L',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','C','o','m','p','l','e','t','e',' ','f','i','l','e','n','a','m','e',',',' ','l','i','s','t',' ','a','l','l','.','\n',
'\n',
'\n',
0 };
constant int size_helpdata = sizeof(helpdata) - 1;

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 1984-2004 Mark Nudelman
* Copyright (C) 1984-2007 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-2005 Mark Nudelman
* Copyright (C) 1984-2007 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-2005 Mark Nudelman
* Copyright (C) 1984-2007 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.
@ -102,8 +102,9 @@ repaint()
* Jump to a specified percentage into the file.
*/
public void
jump_percent(percent)
jump_percent(percent, fraction)
int percent;
long fraction;
{
POSITION pos, len;
@ -121,7 +122,7 @@ jump_percent(percent)
error("Don't know length of file", NULL_PARG);
return;
}
pos = percent_pos(len, percent);
pos = percent_pos(len, percent, fraction);
if (pos >= len)
pos = len-1;
@ -280,7 +281,7 @@ jump_loc(pos, sline)
}
}
lastmark();
if (top_scroll != OPT_ON)
if (!top_scroll)
clear();
else
home();

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 1984-2005 Mark Nudelman
* Copyright (C) 1984-2007 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.
@ -8,6 +8,7 @@
* contact the author, see the README file.
*/
#define NEWBOT 1
/*
* Standard include file for "less".
@ -295,6 +296,10 @@ struct textlist
#define READ_INTR (-2)
/* A fraction is represented by an int n; the fraction is n/NUM_FRAC_DENOM */
#define NUM_FRAC_DENOM 1000000
#define NUM_LOG_FRAC_DENOM 6
/* How quiet should we be? */
#define NOT_QUIET 0 /* Ring bell at eof and for errors */
#define LITTLE_QUIET 1 /* Ring bell only for errors */

View File

@ -115,8 +115,8 @@
Number of buffers.
-B ........ --auto-buffers
Don't automatically allocate buffers for pipes.
-c -C .... --clear-screen --CLEAR-SCREEN
Repaint by scrolling/clearing.
-c ........ --clear-screen
Repaint by clearing rather than scrolling.
-d ........ --dumb
Dumb terminal.
-D [_x_n_._n] . --color=_x_n_._n
@ -148,7 +148,7 @@
-m -M .... --long-prompt --LONG-PROMPT
Set prompt style.
-n -N .... --line-numbers --LINE-NUMBERS
Use line numbers.
Don't use line numbers.
-o [_f_i_l_e] . --log-file=[_f_i_l_e]
Copy to log file (standard input only).
-O [_f_i_l_e] . --LOG-FILE=[_f_i_l_e]
@ -218,3 +218,4 @@
SHIFT-TAB ESC-TAB Complete filename & reverse cycle.
CNTL-L Complete filename, list all.

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
.TH LESS 1 "Version 394: 03 Dec 2005"
.TH LESS 1 "Version 403: 25 May 2007"
.SH NAME
less \- opposite of more
.SH SYNOPSIS
@ -119,7 +119,9 @@ or if N is not specified and
standard input, rather than a file, is being read.)
.IP "p or %"
Go to a position N percent into the file.
N should be between 0 and 100.
N should be between 0 and 100, and may contain a decimal point.
.IP "P"
Go to the line containing byte offset N in the file.
.IP "{"
If a left curly bracket appears in the top line displayed
on the screen,
@ -478,7 +480,8 @@ 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.
.IP "\-C or \-\-CLEAR-SCREEN"
The \-C option is like \-c, but the screen is cleared before it is repainted.
Same as \-c, for compatibility with older versions of
.I less.
.IP "\-d or \-\-dumb"
The \-d option suppresses the error message
normally displayed if the terminal is dumb;
@ -515,6 +518,8 @@ Also suppresses the warning message when a binary file is opened.
By default,
.I less
will refuse to open non-regular files.
Note that some operating systems will not allow directories
to be read, even if \-f is set.
.IP "\-F or \-\-quit-if-one-screen"
Causes
.I less
@ -553,11 +558,17 @@ 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 marked position.
The screen line is specified by a number: the top line on the screen
The screen line may be 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.
Alternately, the screen line may be specified as a fraction of the height
of the screen, starting with a decimal point: .5 is in the middle of the
screen, .3 is three tenths down from the first line, and so on.
If the line is specified as a fraction, the actual line number
is recalculated if the terminal window is resized, so that the
target line remains at the specified fraction of the screen height.
If the \-j option is used, searches begin at the line immediately
after the target line.
For example, if "\-j4" is used, the target line is the
@ -804,7 +815,7 @@ By default, any forward movement causes scrolling.
Changes the default scrolling window size to \fIn\fP 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
The "z" may be omitted for compatibility with some versions of
.I more.
If the number
.I n
@ -1142,6 +1153,8 @@ Selects a Russian character set.
Selects a character set appropriate for NeXT computers.
.IP utf-8
Selects the UTF-8 encoding of the ISO 10646 character set.
UTF-8 is special in that it supports multi-byte characters in the input file.
It is the only character set that supports multi-byte characters.
.IP windows
Selects a character set appropriate for Microsoft Windows (cp 1251).
.PP
@ -1444,6 +1457,36 @@ filename completion (TAB, ^L)
.PP
Less can also be compiled to be permanently in "secure" mode.
.SH "COMPATIBILITY WITH MORE"
If the environment variable LESS_IS_MORE is set to 1,
or if the program is invoked via a file link named "more",
.I less
behaves (mostly) in conformance with the POSIX "more" command specification.
In this mode, less behaves differently in these ways:
.PP
The \-e option works differently.
If the \-e option is not set,
.I less
behaves as if the \-E option were set.
If the \-e option is set,
.I less
behaves as if the \-e and \-F options were set.
.PP
The \-m option works differently.
If the \-m option is not set, the medium prompt is used,
and it is prefixed with the string "--More--".
If the \-m option is set, the short prompt is used.
.PP
The \-n option acts like the \-z option.
The normal behavior of the \-n option is unavailable in this mode.
.PP
The parameter to the \-p option is taken to be a
.I less
command rather than a search pattern.
.PP
The LESS environment variable is ignored,
and the MORE environment variable is used in its place.
.SH "ENVIRONMENT VARIABLES"
Environment variables may be specified either in the system environment
as usual, or in a
@ -1509,7 +1552,7 @@ Normally should be set to "global" if your system has the
Name of the history file used to remember search commands and
shell commands between invocations of
.I less.
If set to "\-", a history file is not used.
If set to "\-" or "/dev/null", a history file is not used.
The default is "$HOME/.lesshst" on Unix systems, "$HOME/_lesshst" on
DOS and Windows systems, or "$HOME/lesshst.ini" or "$INIT/lesshst.ini"
on OS/2 systems.
@ -1536,6 +1579,10 @@ See discussion under SECURITY.
String to be appended to a directory name in filename completion.
.IP LESSUTFBINFMT
Format for displaying non-printable Unicode code points.
.IP LESS_IS_MORE
Emulate the
.I more
(1) command.
.IP LINES
Sets the number of lines on the screen.
Takes precedence over the number of lines specified by the TERM variable.
@ -1562,26 +1609,24 @@ The = command and prompts (unless changed by \-P)
report the line numbers of the lines at the top and bottom of the screen,
but the byte and percent of the line after the one at the bottom of the screen.
.PP
If the :e command is used to name more than one file,
and one of the named files has been viewed previously,
the new files may be entered into the list in an unexpected order.
.PP
On certain older terminals (the so-called "magic cookie" terminals),
search highlighting will cause an erroneous display.
On such terminals, search highlighting is disabled by default
to avoid possible problems.
.PP
When searching in a binary file, text which follows a null byte
may not be found.
This problem does not occur when searching with regular expressions turned
off via ^R, and also does not occur when
.I less
is compiled to use the PCRE regular expression library.
.PP
In certain cases, when search highlighting is enabled and
a search pattern begins with a ^,
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
@ -1594,10 +1639,10 @@ LESSCHARSET to "ascii" (or whatever character set is appropriate).
.PP
This manual is too long.
.PP
See http://www.greenwoodsoftware.com/less for the list of known bugs in all versions of less.
See http://www.greenwoodsoftware.com/less for the latest list of known bugs in less.
.SH COPYRIGHT
Copyright (C) 1984-2005 Mark Nudelman
Copyright (C) 1984-2007 Mark Nudelman
.PP
less is part of the GNU project and is free software.
You can redistribute it and/or modify it
@ -1622,6 +1667,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.
Send bug reports or comments to the above address or to
.br
For more information, see the less homepage at http://www.greenwoodsoftware.com/less.
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-2004 Mark Nudelman
* Copyright (C) 1984-2007 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.10 $";
static char *version = "$Revision: 1.11 $";
static int quote_all = 0;
static char openquote = '"';

View File

@ -2,43 +2,43 @@ LESSECHO(1) LESSECHO(1)
NNAAMMEE
NAME
lessecho - expand metacharacters
SSYYNNOOPPSSIISS
lleesssseecchhoo _[_-_o_x_] _[_-_c_x_] _[_-_p_n_] _[_-_d_n_] _[_-_m_x_] _[_-_n_n_] _[_-_e_x_] _[_-_a_] _f_i_l_e _._._.
SYNOPSIS
lessecho [-ox] [-cx] [-pn] [-dn] [-mx] [-nn] [-ex] [-a] file ...
DDEESSCCRRIIPPTTIIOONN
_l_e_s_s_e_c_h_o is a program that simply echos its arguments on standard out-
DESCRIPTION
lessecho is a program that simply echos its arguments on standard out-
put. But any argument containing spaces is enclosed in quotes.
OOPPTTIIOONNSS
OPTIONS
A summary of options is included below.
--ooxx Specifies "x" to be the open quote character.
-ox Specifies "x" to be the open quote character.
--ccxx Specifies "x" to be the close quote character.
-cx Specifies "x" to be the close quote character.
--ppnn Specifies "n" to be the open quote character, as an integer.
-pn Specifies "n" to be the open quote character, as an integer.
--ddnn Specifies "n" to be the close quote character, as an integer.
-dn Specifies "n" to be the close quote character, as an integer.
--mmxx Specifies "x" to be a metachar.
-mx Specifies "x" to be a metachar.
--nnnn Specifies "n" to be a metachar, as an integer.
-nn Specifies "n" to be a metachar, as an integer.
--eexx Specifies "x" to be the escape char for metachars.
-ex Specifies "x" to be the escape char for metachars.
--ffnn Specifies "n" to be the escape char for metachars, as an inte-
-fn Specifies "n" to be the escape char for metachars, as an inte-
ger.
--aa Specifies that all arguments are to be quoted. The default is
-a Specifies that all arguments are to be quoted. The default is
that only arguments containing spaces are quoted.
SSEEEE AALLSSOO
SEE ALSO
less(1)
AAUUTTHHOORR
AUTHOR
This manual page was written by Thomas Schoepf <schoepf@debian.org>,
for the Debian GNU/Linux system (but may be used by others).
@ -46,4 +46,4 @@ AAUUTTHHOORR
Version 394: 03 Dec 2005 LESSECHO(1)
Version 403: 25 May 2007 LESSECHO(1)

View File

@ -1,4 +1,4 @@
.TH LESSECHO 1 "Version 394: 03 Dec 2005"
.TH LESSECHO 1 "Version 403: 25 May 2007"
.SH NAME
lessecho \- expand metacharacters
.SH SYNOPSIS

View File

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

@ -2,37 +2,37 @@ LESSKEY(1) LESSKEY(1)
NNAAMMEE
NAME
lesskey - specify key bindings for less
SSYYNNOOPPSSIISS
lleesssskkeeyy [[--oo oouuttppuutt]] [[----]] [[iinnppuutt]]
lleesssskkeeyy [[----oouuttppuutt==oouuttppuutt]] [[----]] [[iinnppuutt]]
lleesssskkeeyy --VV
lleesssskkeeyy ----vveerrssiioonn
SYNOPSIS
lesskey [-o output] [--] [input]
lesskey [--output=output] [--] [input]
lesskey -V
lesskey --version
DDEESSCCRRIIPPTTIIOONN
_L_e_s_s_k_e_y is used to specify a set of key bindings to be used by _l_e_s_s_.
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
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
used; on MS-DOS systems, $HOME/_lesskey is used; and on OS/2 systems
$HOME/lesskey.ini is used, or $INIT/lesskey.ini if $HOME is undefined.
The output file is a binary file which is used by _l_e_s_s_. If no output
The output file is a binary file which is used by less. If no output
file is specified, and the environment variable LESSKEY is set, the
value of LESSKEY is used as the name of the output file. Otherwise, a
standard filename is used as the name of the output file, which depends
on the system being used: On Unix and OS-9 systems, $HOME/.less is
used; on MS-DOS systems, $HOME/_less is used; and on OS/2 systems,
$HOME/less.ini is used, or $INIT/less.ini if $HOME is undefined. If
the output file already exists, _l_e_s_s_k_e_y will overwrite it.
the output file already exists, lesskey will overwrite it.
The -V or --version option causes _l_e_s_s_k_e_y to print its version number
The -V or --version option causes lesskey to print its version number
and immediately exit. If -V or --version is present, other options and
arguments are ignored.
The input file consists of one or more _s_e_c_t_i_o_n_s_. Each section starts
The input file consists of one or more sections. Each section starts
with a line that identifies the type of section. Possible sections
are:
@ -48,7 +48,7 @@ DDEESSCCRRIIPPTTIIOONN
except for the special section header lines.
CCOOMMMMAANNDD SSEECCTTIIOONN
COMMAND SECTION
The command section begins with the line
#command
@ -56,13 +56,13 @@ CCOOMMMMAANNDD SSEECCTTIIOONN
If the command section is the first section in the file, this line may
be omitted. The command section consists of lines of the form:
_s_t_r_i_n_g <whitespace> _a_c_t_i_o_n [extra-string] <newline>
string <whitespace> action [extra-string] <newline>
Whitespace is any sequence of one or more spaces and/or tabs. The
_s_t_r_i_n_g is the command key(s) which invoke the action. The _s_t_r_i_n_g may
be a single command key, or a sequence of up to 15 keys. The _a_c_t_i_o_n is
string is the command key(s) which invoke the action. The string may
be a single command key, or a sequence of up to 15 keys. The action is
the name of the less action, from the list below. The characters in
the _s_t_r_i_n_g may appear literally, or be prefixed by a caret to indicate
the string 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 fol-
lowed by certain characters specifies input characters as follows:
@ -100,15 +100,15 @@ CCOOMMMMAANNDD SSEECCTTIIOONN
include caret, space, tab and the backslash itself.
An action may be followed by an "extra" string. When such a command is
entered while running _l_e_s_s_, the action is performed, and then the extra
string is parsed, just as if it were typed in to _l_e_s_s_. This feature
entered while running less, the action is performed, and then the extra
string is parsed, just as if it were typed in to less. This feature
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 _l_e_s_s
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.
EEXXAAMMPPLLEE
EXAMPLE
The following input file describes the set of default command keys used
by less:
@ -223,12 +223,12 @@ EEXXAAMMPPLLEE
ZZ quit
PPRREECCEEDDEENNCCEE
Commands specified by _l_e_s_s_k_e_y take precedence over the default com-
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
similar to "invalid", but _l_e_s_s will give an error beep for an "invalid"
similar to "invalid", but less will give an error beep for an "invalid"
command, but not for a "noaction" command. In addition, ALL default
commands may be disabled by adding this control line to the input file:
@ -243,7 +243,7 @@ PPRREECCEEDDEENNCCEE
command can lead to frustration.
LLIINNEE EEDDIITTIINNGG SSEECCTTIIOONN
LINE EDITING SECTION
The line-editing section begins with the line:
#line-edit
@ -254,7 +254,7 @@ LLIINNEE EEDDIITTIINNGG SSEECCTTIIOONN
of a list of keys and actions, one per line as in the example below.
EEXXAAMMPPLLEE
EXAMPLE
The following input file describes the set of default line-editing keys
used by less:
@ -289,7 +289,7 @@ EEXXAAMMPPLLEE
LLEESSSS EENNVVIIRROONNMMEENNTT VVAARRIIAABBLLEESS
LESS ENVIRONMENT VARIABLES
The environment variable section begins with the line
#env
@ -298,16 +298,16 @@ LLEESSSS EENNVVIIRROONNMMEENNTT VVAARRIIAABBLLEESS
Each line consists of an environment variable 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 way are visible only to _l_e_s_s_. If a variable is specified in the
this way are visible only to less. If a variable is specified in the
system environment and also in a lesskey file, the value in the lesskey
file takes precedence. Although the lesskey file can be used to over-
ride variables set in the environment, the main purpose of assigning
variables in the lesskey file is simply to have all _l_e_s_s configuration
variables in the lesskey file is simply to have all less configuration
information stored in one file.
EEXXAAMMPPLLEE
The following input file sets the -i option whenever _l_e_s_s is run, and
EXAMPLE
The following input file sets the -i option whenever less is run, and
specifies the character set to be "latin1":
#env
@ -316,11 +316,11 @@ EEXXAAMMPPLLEE
SSEEEE AALLSSOO
SEE ALSO
less(1)
WWAARRNNIINNGGSS
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
@ -331,8 +331,8 @@ WWAARRNNIINNGGSS
represented as \340 in a lesskey file.
CCOOPPYYRRIIGGHHTT
Copyright (C) 2004 Mark Nudelman
COPYRIGHT
Copyright (C) 2000-2007 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
@ -349,7 +349,7 @@ CCOOPPYYRRIIGGHHTT
Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
AAUUTTHHOORR
AUTHOR
Mark Nudelman <markn@greenwoodsoftware.com>
Send bug reports or comments to the above address or to bug-
less@gnu.org.
@ -357,4 +357,4 @@ AAUUTTHHOORR
Version 394: 03 Dec 2005 LESSKEY(1)
Version 403: 25 May 2007 LESSKEY(1)

View File

@ -1,4 +1,4 @@
.TH LESSKEY 1 "Version 394: 03 Dec 2005"
.TH LESSKEY 1 "Version 403: 25 May 2007"
.SH NAME
lesskey \- specify key bindings for less
.SH SYNOPSIS
@ -358,7 +358,7 @@ which start with a NUL character (0).
This NUL character should be represented as \e340 in a lesskey file.
.SH COPYRIGHT
Copyright (C) 2004 Mark Nudelman
Copyright (C) 2000-2007 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-2004 Mark Nudelman
* Copyright (C) 1984-2007 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-2005 Mark Nudelman
* Copyright (C) 1984-2007 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.
@ -59,6 +59,7 @@ extern int bl_s_width, bl_e_width;
extern int so_s_width, so_e_width;
extern int sc_width, sc_height;
extern int utf_mode;
extern int oldbot;
extern POSITION start_attnpos;
extern POSITION end_attnpos;
@ -994,6 +995,8 @@ pflushmbc()
pdone(endline)
int endline;
{
int nl;
(void) pflushmbc();
if (pendc && (pendc != '\r' || !endline))
@ -1024,8 +1027,21 @@ pdone(endline)
/*
* Add a newline if necessary,
* and append a '\0' to the end of the line.
* We output a newline if we're not at the right edge of the screen,
* or if the terminal doesn't auto wrap,
* or if this is really the end of the line AND the terminal ignores
* a newline at the right edge.
* (In the last case we don't want to output a newline if the terminal
* doesn't ignore it since that would produce an extra blank line.
* But we do want to output a newline if the terminal ignores it in case
* the next line is blank. In that case the single newline output for
* that blank line would be ignored!)
*/
if (column < sc_width || !auto_wrap || ignaw || ctldisp == OPT_ON)
if (!oldbot)
nl = (column < sc_width || !auto_wrap || (endline && ignaw) || ctldisp == OPT_ON);
else
nl = (column < sc_width || !auto_wrap || ignaw || ctldisp == OPT_ON);
if (nl)
{
linebuf[curr] = '\n';
attr[curr] = AT_NORMAL;
@ -1093,9 +1109,10 @@ null_line()
* {{ This is supposed to be more efficient than forw_line(). }}
*/
public POSITION
forw_raw_line(curr_pos, linep)
forw_raw_line(curr_pos, linep, line_lenp)
POSITION curr_pos;
char **linep;
int *line_lenp;
{
register int n;
register int c;
@ -1131,6 +1148,8 @@ forw_raw_line(curr_pos, linep)
linebuf[n] = '\0';
if (linep != NULL)
*linep = linebuf;
if (line_lenp != NULL)
*line_lenp = n;
return (new_pos);
}
@ -1139,9 +1158,10 @@ forw_raw_line(curr_pos, linep)
* {{ This is supposed to be more efficient than back_line(). }}
*/
public POSITION
back_raw_line(curr_pos, linep)
back_raw_line(curr_pos, linep, line_lenp)
POSITION curr_pos;
char **linep;
int *line_lenp;
{
register int n;
register int c;
@ -1202,5 +1222,7 @@ back_raw_line(curr_pos, linep)
}
if (linep != NULL)
*linep = &linebuf[n];
if (line_lenp != NULL)
*line_lenp = size_linebuf - 1 - n;
return (new_pos);
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 1984-2004 Mark Nudelman
* Copyright (C) 1984-2007 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.
@ -314,7 +314,7 @@ find_linenum(pos)
/*
* Allow a signal to abort this loop.
*/
cpos = forw_raw_line(cpos, (char **)NULL);
cpos = forw_raw_line(cpos, (char **)NULL, (int *)NULL);
if (ABORT_SIGS() || cpos == NULL_POSITION)
return (0);
longish();
@ -343,7 +343,7 @@ find_linenum(pos)
/*
* Allow a signal to abort this loop.
*/
cpos = back_raw_line(cpos, (char **)NULL);
cpos = back_raw_line(cpos, (char **)NULL, (int *)NULL);
if (ABORT_SIGS() || cpos == NULL_POSITION)
return (0);
longish();
@ -398,7 +398,7 @@ find_pos(linenum)
/*
* Allow a signal to abort this loop.
*/
cpos = forw_raw_line(cpos, (char **)NULL);
cpos = forw_raw_line(cpos, (char **)NULL, (int *)NULL);
if (ABORT_SIGS() || cpos == NULL_POSITION)
return (NULL_POSITION);
}
@ -414,7 +414,7 @@ find_pos(linenum)
/*
* Allow a signal to abort this loop.
*/
cpos = back_raw_line(cpos, (char **)NULL);
cpos = back_raw_line(cpos, (char **)NULL, (int *)NULL);
if (ABORT_SIGS() || cpos == NULL_POSITION)
return (NULL_POSITION);
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 1984-2005 Mark Nudelman
* Copyright (C) 1984-2007 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-2004 Mark Nudelman
* Copyright (C) 1984-2007 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,6 +32,7 @@ public char * progname;
public int quitting;
public int secure;
public int dohelp;
public int less_is_more;
#if LOGFILE
public int logfile = -1;
@ -56,6 +57,8 @@ static char consoleTitle[256];
extern int missing_cap;
extern int know_dumb;
extern int quit_if_one_screen;
extern int pr_type;
/*
@ -111,12 +114,26 @@ main(argc, argv)
is_tty = isatty(1);
get_term();
init_cmds();
init_prompt();
init_charset();
init_line();
init_cmdhist();
init_option();
s = lgetenv("LESS");
/*
* If the name of the executable program is "more",
* act like LESS_IS_MORE is set.
*/
for (s = progname + strlen(progname); s > progname; s--)
{
if (s[-1] == PATHNAME_SEP[0])
break;
}
if (strcmp(s, "more") == 0)
less_is_more = 1;
init_prompt();
s = lgetenv(less_is_more ? "MORE" : "LESS");
if (s != NULL)
scan_option(save(s));
@ -141,6 +158,9 @@ main(argc, argv)
quit(QUIT_OK);
}
if (less_is_more && get_quit_at_eof())
quit_if_one_screen = TRUE;
#if EDITOR
editor = lgetenv("VISUAL");
if (editor == NULL || *editor == '\0')

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 1984-2004 Mark Nudelman
* Copyright (C) 1984-2007 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-2004 Mark Nudelman
* Copyright (C) 1984-2007 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-2005 Mark Nudelman
* Copyright (C) 1984-2007 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.
@ -37,7 +37,6 @@ extern int sc_height;
extern int secure;
extern int dohelp;
extern int any_display;
extern int less_is_more;
extern char openquote;
extern char closequote;
extern char *prproto[];
@ -55,6 +54,8 @@ extern int logfile;
public char *tagoption = NULL;
extern char *tags;
extern int jump_sline;
extern int jump_sline_fraction;
extern int less_is_more;
#endif
#if MSDOS_COMPILER
extern int nm_fg_color, nm_bg_color;
@ -155,6 +156,71 @@ opt_l(type, s)
}
}
/*
* Handlers for -j option.
*/
public void
opt_j(type, s)
int type;
char *s;
{
PARG parg;
char buf[16];
int len;
int err;
switch (type)
{
case INIT:
case TOGGLE:
if (*s == '.')
{
s++;
jump_sline_fraction = getfraction(&s, "j", &err);
if (err)
error("Invalid line fraction", NULL_PARG);
else
calc_jump_sline();
} else
{
int sline = getnum(&s, "j", &err);
if (err)
error("Invalid line number", NULL_PARG);
else
{
jump_sline = sline;
jump_sline_fraction = -1;
}
}
break;
case QUERY:
if (jump_sline_fraction < 0)
{
parg.p_int = jump_sline;
error("Position target at screen line %d", &parg);
} else
{
sprintf(buf, ".%06d", jump_sline_fraction);
len = strlen(buf);
while (len > 2 && buf[len-1] == '0')
len--;
buf[len] = '\0';
parg.p_string = buf;
error("Position target at screen position %s", &parg);
}
break;
}
}
public void
calc_jump_sline()
{
if (jump_sline_fraction < 0)
return;
jump_sline = sc_height * jump_sline_fraction / NUM_FRAC_DENOM;
}
#if USERFILE
public void
opt_k(type, s)
@ -267,7 +333,7 @@ opt_p(type, s)
* In "more" mode, the -p argument is a command,
* not a search string, so we don't need a slash.
*/
if (!less_is_more);
if (!less_is_more)
ungetsc("/");
break;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 1984-2004 Mark Nudelman
* Copyright (C) 1984-2007 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.
@ -29,6 +29,8 @@ static char *optstring();
static int flip_triple();
extern int screen_trashed;
extern int less_is_more;
extern int quit_at_eof;
extern char *every_first_cmd;
/*
@ -132,6 +134,10 @@ scan_option(s)
s--;
optc = 'z';
break;
case 'n':
if (less_is_more)
optc = 'z';
break;
}
/*
@ -583,6 +589,30 @@ optstring(s, p_str, printopt, validchars)
return (p);
}
/*
*/
static int
num_error(printopt, errp)
char *printopt;
int *errp;
{
PARG parg;
if (errp != NULL)
{
*errp = TRUE;
return (-1);
}
if (printopt != NULL)
{
parg.p_string = printopt;
error("Number is required after %s", &parg);
}
quit(QUIT_ERROR);
/* NOTREACHED */
return (-1);
}
/*
* Translate a string into a number.
* Like atoi(), but takes a pointer to a char *, and updates
@ -597,7 +627,6 @@ getnum(sp, printopt, errp)
register char *s;
register int n;
register int neg;
PARG parg;
s = skipsp(*sp);
neg = FALSE;
@ -607,19 +636,7 @@ getnum(sp, printopt, errp)
s++;
}
if (*s < '0' || *s > '9')
{
if (errp != NULL)
{
*errp = TRUE;
return (-1);
}
if (printopt != NULL)
{
parg.p_string = printopt;
error("Number is required after %s", &parg);
}
quit(QUIT_ERROR);
}
return (num_error(printopt, errp));
n = 0;
while (*s >= '0' && *s <= '9')
@ -631,3 +648,53 @@ getnum(sp, printopt, errp)
n = -n;
return (n);
}
/*
* Translate a string into a fraction, represented by the part of a
* number which would follow a decimal point.
* The value of the fraction is returned as parts per NUM_FRAC_DENOM.
* That is, if "n" is returned, the fraction intended is n/NUM_FRAC_DENOM.
*/
public long
getfraction(sp, printopt, errp)
char **sp;
char *printopt;
int *errp;
{
register char *s;
long frac = 0;
int fraclen = 0;
s = skipsp(*sp);
if (*s < '0' || *s > '9')
return (num_error(printopt, errp));
for ( ; *s >= '0' && *s <= '9'; s++)
{
frac = (frac * 10) + (*s - '0');
fraclen++;
}
if (fraclen > NUM_LOG_FRAC_DENOM)
while (fraclen-- > NUM_LOG_FRAC_DENOM)
frac /= 10;
else
while (fraclen++ < NUM_LOG_FRAC_DENOM)
frac *= 10;
*sp = s;
if (errp != NULL)
*errp = FALSE;
return (frac);
}
/*
* Get the value of the -e flag.
*/
public int
get_quit_at_eof()
{
if (!less_is_more)
return quit_at_eof;
/* When less_is_more is set, the -e flag semantics are different. */
return quit_at_eof ? OPT_ON : OPT_ONPLUS;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 1984-2004 Mark Nudelman
* Copyright (C) 1984-2007 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-2004 Mark Nudelman
* Copyright (C) 1984-2007 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.
@ -40,6 +40,7 @@ public int ctldisp; /* Send control chars to screen untranslated */
public int force_open; /* Open the file even if not regular file */
public int swindow; /* Size of scrolling window */
public int jump_sline; /* Screen line of "jump target" */
public long jump_sline_fraction = -1;
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 */
@ -49,6 +50,7 @@ public int shift_count; /* Number of positions to shift horizontally */
public int status_col; /* Display a status column */
public int use_lessopen; /* Use the LESSOPEN filter */
public int quit_on_intr; /* Quit on interrupt */
public int oldbot; /* Old bottom of screen behavior */
#if HILITE_SEARCH
public int hilite_search; /* Highlight matched search patterns? */
#endif
@ -110,6 +112,7 @@ 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 };
static struct optname oldbot_optname = { "old-bot", NULL };
/*
@ -155,7 +158,7 @@ static struct loption option[] =
TRIPLE, OPT_OFF, &top_scroll, NULL,
{
"Repaint by scrolling from bottom of screen",
"Repaint by clearing each line",
"Repaint by painting from top of screen",
"Repaint by painting from top of screen"
}
},
@ -228,10 +231,10 @@ static struct loption option[] =
}
},
{ 'j', &j_optname,
NUMBER, 1, &jump_sline, NULL,
STRING, 0, NULL, opt_j,
{
"Target line: ",
"Position target at screen line %d",
"0123456789.",
NULL
}
},
@ -429,6 +432,14 @@ static struct loption option[] =
NULL
}
},
{ '.', &oldbot_optname,
BOOL, OPT_OFF, &oldbot, NULL,
{
"Use new bottom of screen behavior",
"Use old bottom of screen behavior",
NULL
}
},
{ '\0', NULL, NOVAR, 0, NULL, NULL, { NULL, NULL, NULL } }
};

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 1984-2005 Mark Nudelman
* Copyright (C) 1984-2007 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.
@ -74,6 +74,7 @@ iread(fd, buf, len)
{
register int n;
start:
#if MSDOS_COMPILER==WIN32C
if (ABORT_SIGS())
return (READ_INTR);
@ -156,7 +157,25 @@ iread(fd, buf, len)
#endif
reading = 0;
if (n < 0)
{
#if HAVE_ERRNO
/*
* Certain values of errno indicate we should just retry the read.
*/
#if MUST_DEFINE_ERRNO
extern int errno;
#endif
#ifdef EINTR
if (errno == EINTR)
goto start;
#endif
#ifdef EAGAIN
if (errno == EAGAIN)
goto start;
#endif
#endif
return (-1);
}
return (n);
}
@ -251,18 +270,25 @@ percentage(num, den)
* Return the specified percentage of a POSITION.
*/
public POSITION
percent_pos(pos, percent)
percent_pos(pos, percent, fraction)
POSITION pos;
int percent;
long fraction;
{
POSITION result100;
/* Change percent (parts per 100) to perden (parts per NUM_FRAC_DENOM). */
long perden = (percent * (NUM_FRAC_DENOM / 100)) + (fraction / 100);
POSITION temp;
if (percent == 0)
if (perden == 0)
return (0);
else if ((result100 = pos * percent) / percent == pos)
return (result100 / 100);
temp = pos * perden; /* This might overflow. */
if (temp / perden == pos)
/* No overflow */
return (temp / NUM_FRAC_DENOM);
else
return (percent * (pos / 100));
/* Above calculation overflows;
* use a method that is less precise but won't overflow. */
return (perden * (pos / NUM_FRAC_DENOM));
}
#if !HAVE_STRCHR

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 1984-2005 Mark Nudelman
* Copyright (C) 1984-2007 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.
@ -21,6 +21,7 @@
public int errmsgs; /* Count of messages displayed by error() */
public int need_clr;
public int final_attr;
public int at_prompt;
extern int sigs;
extern int sc_width;
@ -28,6 +29,7 @@ extern int so_s_width, so_e_width;
extern int screen_trashed;
extern int any_display;
extern int is_tty;
extern int oldbot;
#if MSDOS_COMPILER==BORLANDC || MSDOS_COMPILER==DJGPPC
extern int ctldisp;
@ -372,6 +374,7 @@ putchr(c)
if (ob >= &obuf[sizeof(obuf)-1])
flush();
*ob++ = c;
at_prompt = 0;
return (c);
}
@ -522,6 +525,8 @@ error(fmt, parg)
if (any_display && is_tty)
{
if (!oldbot)
squish_check();
at_exit();
clear_bot();
at_enter(AT_STANDOUT);

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 1984-2004 Mark Nudelman
* Copyright (C) 1984-2007 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-2004 Mark Nudelman
* Copyright (C) 1984-2007 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-2004 Mark Nudelman
* Copyright (C) 1984-2007 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-2004 Mark Nudelman
* Copyright (C) 1984-2007 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.
@ -30,6 +30,7 @@ extern int linenums;
extern int hshift;
extern int sc_height;
extern int jump_sline;
extern int less_is_more;
extern IFILE curr_ifile;
#if EDITOR
extern char *editor;
@ -52,6 +53,8 @@ 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";
static constant char more_proto[] =
"--More--(?eEND ?x- Next\\: %x.:?pB%pB\\%:byte %bB?s/%s...%t)";
public char *prproto[3];
public char constant *eqproto = e_proto;
@ -68,7 +71,7 @@ static char *mp;
init_prompt()
{
prproto[0] = save(s_proto);
prproto[1] = save(m_proto);
prproto[1] = save(less_is_more ? more_proto : m_proto);
prproto[2] = save(M_proto);
eqproto = save(e_proto);
hproto = save(h_proto);
@ -561,9 +564,11 @@ eq_message()
pr_string()
{
char *prompt;
int type;
type = (!less_is_more) ? pr_type : pr_type ? 0 : 1;
prompt = pr_expand((ch_getflags() & CH_HELPFILE) ?
hproto : prproto[pr_type],
hproto : prproto[type],
sc_width-so_s_width-so_e_width-2);
new_file = 0;
return (prompt);

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 1984-2005 Mark Nudelman
* Copyright (C) 1984-2007 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.
@ -163,6 +163,7 @@ static char
*sc_home, /* Cursor home */
*sc_addline, /* Add line, scroll down following lines */
*sc_lower_left, /* Cursor to last line, first column */
*sc_return, /* Cursor to beginning of current line */
*sc_move, /* General cursor positioning */
*sc_clear, /* Clear screen */
*sc_eol_clear, /* Clear to end of line */
@ -232,6 +233,7 @@ extern int wscroll;
extern int screen_trashed;
extern int tty;
extern int top_scroll;
extern int oldbot;
#if HILITE_SEARCH
extern int hilite_search;
#endif
@ -1127,7 +1129,7 @@ get_term()
if ((term = lgetenv("TERM")) == NULL)
term = DEFAULT_TERM;
hardcopy = 0;
if (tgetent(termbuf, term) <= 0)
if (tgetent(termbuf, term) != TGETENT_OK)
hardcopy = 1;
if (ltgetflag("hc"))
hardcopy = 1;
@ -1282,6 +1284,13 @@ get_term()
}
sc_lower_left = cheaper(t1, t2, "\r");
/*
* Get carriage return string.
*/
sc_return = ltgetstr("cr", &sp);
if (sc_return == NULL)
sc_return = "\r";
/*
* Choose between using "al" or "sr" ("add line" or "scroll reverse")
* to add a line at the top of the screen.
@ -1800,6 +1809,33 @@ lower_left()
#endif
}
/*
* Move cursor to left position of current line.
*/
public void
line_left()
{
#if !MSDOS_COMPILER
tputs(sc_return, 1, putchr);
#else
int row;
flush();
#if MSDOS_COMPILER==WIN32C
{
CONSOLE_SCREEN_BUFFER_INFO scr;
GetConsoleScreenBufferInfo(con_out, &scr);
row = scr.dwCursorPosition.Y - scr.srWindow.Top + 1;
}
#else
{
struct rccoord tpos = _gettextposition();
row = tpos.row;
}
#endif
_settextposition(row, 1);
#endif
}
/*
* Check if the console size has changed and reset internals
* (in lieu of SIGWINCH for WIN32).
@ -2108,7 +2144,11 @@ clear_bot()
* the mode while we do the clear. Some terminals fill the
* cleared area with the current attribute.
*/
lower_left();
if (oldbot)
lower_left();
else
line_left();
if (attrmode == AT_NORMAL)
clear_eol_bot();
else
@ -2185,7 +2225,10 @@ at_exit()
at_switch(attr)
int attr;
{
if (apply_at_specials(attr) != attrmode)
int new_attrmode = apply_at_specials(attr);
int ignore_modes = AT_ANSI;
if ((new_attrmode & ~ignore_modes) != (attrmode & ~ignore_modes))
{
at_exit();
at_enter(attr);

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 1984-2004 Mark Nudelman
* Copyright (C) 1984-2007 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-2005 Mark Nudelman
* Copyright (C) 1984-2007 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.
@ -54,6 +54,7 @@ extern int jump_sline;
extern int bs_mode;
extern int ctldisp;
extern int status_col;
extern void * constant ml_search;
extern POSITION start_attnpos;
extern POSITION end_attnpos;
#if HILITE_SEARCH
@ -63,6 +64,7 @@ extern int size_linebuf;
extern int squished;
extern int can_goto_line;
static int hide_hilite;
static int oldbot;
static POSITION prep_startpos;
static POSITION prep_endpos;
@ -110,15 +112,22 @@ static char *last_pattern = NULL;
#define CVT_ANSI 010 /* Remove ANSI escape sequences */
static void
cvt_text(odst, osrc, ops)
cvt_text(odst, osrc, lenp, ops)
char *odst;
char *osrc;
int *lenp;
int ops;
{
register char *dst;
register char *src;
register char *src_end;
for (src = osrc, dst = odst; *src != '\0'; src++)
if (lenp != NULL)
src_end = osrc + *lenp;
else
src_end = osrc + strlen(osrc);
for (src = osrc, dst = odst; src < src_end; src++)
{
if ((ops & CVT_TO_LC) && IS_UPPER(*src))
/* Convert uppercase to lowercase. */
@ -129,7 +138,7 @@ cvt_text(odst, osrc, ops)
else if ((ops & CVT_ANSI) && *src == ESC)
{
/* Skip to end of ANSI escape sequence. */
while (src[1] != '\0')
while (src + 1 != src_end)
if (!is_ansi_middle(*++src))
break;
} else
@ -139,6 +148,8 @@ cvt_text(odst, osrc, ops)
if ((ops & CVT_CRLF) && dst > odst && dst[-1] == '\r')
dst--;
*dst = '\0';
if (lenp != NULL)
*lenp = dst - odst;
}
/*
@ -265,6 +276,8 @@ repaint_hilite(on)
put_line();
}
}
if (!oldbot)
lower_left();
hide_hilite = save_hide_hilite;
}
@ -448,8 +461,9 @@ uncompile_pattern()
* Set sp and ep to the start and end of the matched string.
*/
static int
match_pattern(line, sp, ep, notbol)
match_pattern(line, line_len, sp, ep, notbol)
char *line;
int line_len;
char **sp;
char **ep;
int notbol;
@ -457,7 +471,7 @@ match_pattern(line, sp, ep, notbol)
int matched;
if (last_search_type & SRCH_NO_REGEX)
return (match(last_pattern, line, sp, ep));
return (match(last_pattern, strlen(last_pattern), line, line_len, sp, ep));
#if HAVE_POSIX_REGCOMP
{
@ -479,7 +493,7 @@ match_pattern(line, sp, ep, notbol)
{
int flags = (notbol) ? PCRE_NOTBOL : 0;
int ovector[3];
matched = pcre_exec(regpattern, NULL, line, strlen(line),
matched = pcre_exec(regpattern, NULL, line, line_len,
0, flags, ovector, 3) >= 0;
if (!matched)
return (0);
@ -513,7 +527,7 @@ match_pattern(line, sp, ep, notbol)
*ep = regpattern->endp[0];
#endif
#if NO_REGEX
matched = match(last_pattern, line, sp, ep);
matched = match(last_pattern, strlen(last_pattern), line, line_len, sp, ep);
#endif
return (matched);
}
@ -650,11 +664,14 @@ add_hilite(anchor, hl)
}
static void
adj_hilite_ansi(cvt_ops, line, npos)
adj_hilite_ansi(cvt_ops, line, line_len, npos)
int cvt_ops;
char **line;
int line_len;
POSITION *npos;
{
char *line_end = *line + line_len;
if (cvt_ops & CVT_ANSI)
while (**line == ESC)
{
@ -664,7 +681,7 @@ adj_hilite_ansi(cvt_ops, line, npos)
*/
(*line)++;
(*npos)++;
while (**line != '\0')
while (*line < line_end)
{
(*npos)++;
if (!is_ansi_middle(*(*line)++))
@ -683,6 +700,8 @@ adj_hilite(anchor, linepos, cvt_ops)
int cvt_ops;
{
char *line;
int line_len;
char *line_end;
struct hilite *hl;
int checkstart;
POSITION opos;
@ -695,7 +714,8 @@ adj_hilite(anchor, linepos, cvt_ops)
* This may not be true if there are backspaces in the line.
* Get the raw line again. Look at each character.
*/
(void) forw_raw_line(linepos, &line);
(void) forw_raw_line(linepos, &line, &line_len);
line_end = line + line_len;
opos = npos = linepos;
hl = anchor->hl_first;
checkstart = TRUE;
@ -720,9 +740,9 @@ adj_hilite(anchor, linepos, cvt_ops)
hl = hl->hl_next;
continue; /* {{ necessary }} */
}
if (*line == '\0')
if (line == line_end)
break;
adj_hilite_ansi(cvt_ops, &line, &npos);
adj_hilite_ansi(cvt_ops, &line, line_end - line, &npos);
opos++;
npos++;
line++;
@ -732,8 +752,8 @@ adj_hilite(anchor, linepos, cvt_ops)
{
npos++;
line++;
adj_hilite_ansi(cvt_ops, &line, &npos);
if (*line == '\0')
adj_hilite_ansi(cvt_ops, &line, line_end - line, &npos);
if (line == line_end)
{
--npos;
--line;
@ -757,14 +777,16 @@ adj_hilite(anchor, linepos, cvt_ops)
* sp,ep delimit the first match already found.
*/
static void
hilite_line(linepos, line, sp, ep, cvt_ops)
hilite_line(linepos, line, line_len, sp, ep, cvt_ops)
POSITION linepos;
char *line;
int line_len;
char *sp;
char *ep;
int cvt_ops;
{
char *searchp;
char *line_end = line + line_len;
struct hilite *hl;
struct hilite hilites;
@ -778,7 +800,7 @@ hilite_line(linepos, line, sp, ep, cvt_ops)
* substrings of the line, may mark more than is correct
* if the pattern starts with "^". This bug is fixed
* for those regex functions that accept a notbol parameter
* (currently POSIX and V8-with-regexec2). }}
* (currently POSIX, PCRE and V8-with-regexec2). }}
*/
searchp = line;
/*
@ -805,11 +827,11 @@ hilite_line(linepos, line, sp, ep, cvt_ops)
*/
if (ep > searchp)
searchp = ep;
else if (*searchp != '\0')
else if (searchp != line_end)
searchp++;
else /* end of line */
break;
} while (match_pattern(searchp, &sp, &ep, 1));
} while (match_pattern(searchp, line_end - searchp, &sp, &ep, 1));
/*
* If there were backspaces in the original line, they
@ -940,7 +962,7 @@ search_pos(search_type)
pos = position(linenum);
if (search_type & SRCH_FORW)
{
pos = forw_raw_line(pos, (char **)NULL);
pos = forw_raw_line(pos, (char **)NULL, (int *)NULL);
while (pos == NULL_POSITION)
{
if (++linenum >= sc_height)
@ -974,6 +996,7 @@ search_range(pos, endpos, search_type, matches, maxlines, plinepos, pendpos)
POSITION *pendpos;
{
char *line;
int line_len;
LINENUM linenum;
char *sp, *ep;
int line_match;
@ -1016,7 +1039,7 @@ search_range(pos, endpos, search_type, matches, maxlines, plinepos, pendpos)
* starting position of that line in linepos.
*/
linepos = pos;
pos = forw_raw_line(pos, &line);
pos = forw_raw_line(pos, &line, &line_len);
if (linenum != 0)
linenum++;
} else
@ -1025,7 +1048,7 @@ search_range(pos, endpos, search_type, matches, maxlines, plinepos, pendpos)
* Read the previous line and save the
* starting position of that line in linepos.
*/
pos = back_raw_line(pos, &line);
pos = back_raw_line(pos, &line, &line_len);
linepos = pos;
if (linenum != 0)
linenum--;
@ -1058,14 +1081,14 @@ search_range(pos, endpos, search_type, matches, maxlines, plinepos, pendpos)
* If we're doing backspace processing, delete backspaces.
*/
cvt_ops = get_cvt_ops();
cvt_text(line, line, cvt_ops);
cvt_text(line, line, &line_len, cvt_ops);
/*
* Test the next line to see if we have a match.
* We are successful if we either want a match and got one,
* or if we want a non-match and got one.
*/
line_match = match_pattern(line, &sp, &ep, 0);
line_match = match_pattern(line, line_len, &sp, &ep, 0);
line_match = (!(search_type & SRCH_NO_MATCH) && line_match) ||
((search_type & SRCH_NO_MATCH) && !line_match);
if (!line_match)
@ -1082,7 +1105,7 @@ search_range(pos, endpos, search_type, matches, maxlines, plinepos, pendpos)
* hilite list and keep searching.
*/
if (line_match)
hilite_line(linepos, line, sp, ep, cvt_ops);
hilite_line(linepos, line, line_len, sp, ep, cvt_ops);
#endif
} else if (--matches <= 0)
{
@ -1099,7 +1122,7 @@ search_range(pos, endpos, search_type, matches, maxlines, plinepos, pendpos)
*/
clr_hilite();
if (line_match)
hilite_line(linepos, line, sp, ep, cvt_ops);
hilite_line(linepos, line, line_len, sp, ep, cvt_ops);
}
#endif
if (plinepos != NULL)
@ -1109,6 +1132,44 @@ search_range(pos, endpos, search_type, matches, maxlines, plinepos, pendpos)
}
}
/*
* search for a pattern in history. If found, compile that pattern.
*/
static int
hist_pattern(search_type)
int search_type;
{
#if CMD_HISTORY
char *pattern;
set_mlist(ml_search, 0);
pattern = cmd_lastpattern();
if (pattern == NULL)
return (0);
if (caseless == OPT_ONPLUS)
cvt_text(pattern, pattern, (int *)NULL, CVT_TO_LC);
if (compile_pattern(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();
#endif
return (1);
#else /* CMD_HISTORY */
return (0);
#endif /* CMD_HISTORY */
}
/*
* Search for the n-th occurrence of a specified pattern,
* either forward or backward.
@ -1132,7 +1193,7 @@ search(search_type, pattern, n)
/*
* A null pattern means use the previously compiled pattern.
*/
if (!prev_pattern())
if (!prev_pattern() && !hist_pattern(search_type))
{
error("No previous regular expression", NULL_PARG);
return (-1);
@ -1170,7 +1231,7 @@ search(search_type, pattern, n)
*/
ucase = is_ucase(pattern);
if (caseless == OPT_ONPLUS)
cvt_text(pattern, pattern, CVT_TO_LC);
cvt_text(pattern, pattern, (int *)NULL, CVT_TO_LC);
if (compile_pattern(pattern, search_type) < 0)
return (-1);
/*
@ -1298,7 +1359,7 @@ prep_hilite(spos, epos, maxlines)
{
max_epos = spos;
for (i = 0; i < maxlines; i++)
max_epos = forw_raw_line(max_epos, (char **)NULL);
max_epos = forw_raw_line(max_epos, (char **)NULL, (int *)NULL);
}
/*
@ -1394,18 +1455,23 @@ prep_hilite(spos, epos, maxlines)
* It supports no metacharacters like *, etc.
*/
static int
match(pattern, buf, pfound, pend)
char *pattern, *buf;
match(pattern, pattern_len, buf, buf_len, pfound, pend)
char *pattern;
int pattern_len;
char *buf;
int buf_len;
char **pfound, **pend;
{
register char *pp, *lp;
register char *pattern_end = pattern + pattern_len;
register char *buf_end = buf + buf_len;
for ( ; *buf != '\0'; buf++)
for ( ; buf < buf_end; buf++)
{
for (pp = pattern, lp = buf; *pp == *lp; pp++, lp++)
if (*pp == '\0' || *lp == '\0')
if (pp == pattern_end || lp == buf_end)
break;
if (*pp == '\0')
if (pp == pattern_end)
{
if (pfound != NULL)
*pfound = buf;

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 1984-2004 Mark Nudelman
* Copyright (C) 1984-2007 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.
@ -34,6 +34,7 @@ extern int linenums;
extern int wscroll;
extern int reading;
extern int quit_on_intr;
extern long jump_sline_fraction;
/*
* Interrupt signal handler.
@ -88,8 +89,6 @@ winch(type)
{
LSIGNAL(SIGWINCH, winch);
sigs |= S_WINCH;
if (reading)
intread();
}
#else
#ifdef SIGWIND
@ -153,13 +152,12 @@ init_signals(on)
#endif
#ifdef SIGWINCH
(void) LSIGNAL(SIGWINCH, winch);
#else
#endif
#ifdef SIGWIND
(void) LSIGNAL(SIGWIND, winch);
#endif
#ifdef SIGQUIT
(void) LSIGNAL(SIGQUIT, SIG_IGN);
#endif
#endif
} else
{
@ -242,6 +240,7 @@ psignals()
if (sc_width != old_width || sc_height != old_height)
{
wscroll = (sc_height + 1) / 2;
calc_jump_sline();
screen_trashed = 1;
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 1984-2004 Mark Nudelman
* Copyright (C) 1984-2007 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.
@ -56,7 +56,7 @@ static int getentry();
*
* 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),
* findctag() uses either pattern (in which case line number is 0),
* or line number (in which case pattern is NULL).
*/
struct taglist {
@ -75,10 +75,10 @@ struct tag {
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);
(tp)->next = TAG_END; \
(tp)->prev = taglist.tl_last; \
taglist.tl_last->next = (tp); \
taglist.tl_last = (tp);
#define TAG_RM(tp) \
(tp)->next->prev = (tp)->prev; \
@ -418,7 +418,7 @@ ctagsearch()
* starting position of that line in linepos.
*/
linepos = pos;
pos = forw_raw_line(pos, &line);
pos = forw_raw_line(pos, &line, (int *)NULL);
if (linenum != 0)
linenum++;

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 1984-2004 Mark Nudelman
* Copyright (C) 1984-2007 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.
@ -102,8 +102,6 @@ getchr()
{
char c;
int result;
int hex_in = 0;
int hex_value = 0;
do
{
@ -137,6 +135,9 @@ getchr()
#endif
#if 0 /* allow entering arbitrary hex chars for testing */
/* ctrl-A followed by two hex chars makes a byte */
{
int hex_in = 0;
int hex_value = 0;
if (c == CONTROL('A'))
{
hex_in = 2;
@ -162,6 +163,7 @@ getchr()
}
c = hex_value;
}
}
#endif
/*
* Various parts of the program cannot handle

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 1984-2005 Mark Nudelman
* Copyright (C) 1984-2007 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.
@ -668,6 +668,28 @@ v392 10/14/05 Fix line wrapping bug.
v393 10/19/05 Allow multiple attributes per char; fix bold+underline bug
(thanks again to Charles Levert).
v394 11/8/05 Fix prompt bug; fix compile problem in Windows build.
-----------------------------------------------------------------
v395 1/12/07 Update Unicode tables (thanks to Charles Levert);
don't chmod if LESSHISTFILE = /dev/null;
make -f work for directories; support DESTDIR in Makefile;
fix sigset_t detection in configure;
make "t" cmd traverse tags in correct order
v396 1/13/07 Add compatibility with POSIX more.
v397 3/21/07 Allow decimal point in number for % command;
Allow decimal point in number for -j option;
Allow n command to fetch last search pattern from history
(thanks to arno).
v398 3/22/07 Don't rewrite history file if not necessary;
fix bug when filenames contain "$".
v399 3/22/07 Don't move to bottom of screen at startup;
don't output extraneous newlines.
v400 3/23/07 Allow search to find pattern after null byte (PCRE and no-regex)
(thanks to Michael Constant).
-----------------------------------------------------------------
v401 3/24/07 Minor documentation fixes.
v402 3/30/07 Fix autoconf bug when memcpy etc are inline;
fix bug in terminating number following -j option.
v403 5/25/07 Fix Windows build.
*/
char version[] = "394";
char version[] = "403";