MFV r317581: less v491.
MFC after: 1 month
This commit is contained in:
commit
f6b74a7d16
@ -2,7 +2,7 @@
|
||||
------------
|
||||
|
||||
Less
|
||||
Copyright (C) 1984-2015 Mark Nudelman
|
||||
Copyright (C) 1984-2016 Mark Nudelman
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
|
@ -9,6 +9,40 @@
|
||||
|
||||
To report bugs, suggestions or comments, send email to bug-less@gnu.org
|
||||
|
||||
======================================================================
|
||||
|
||||
Major changes between "less" versions 487 and 491
|
||||
|
||||
* Don't output terminal init sequence if using -F and file fits on one screen.
|
||||
|
||||
* Use ANSI prototypes in funcs.h declarations.
|
||||
|
||||
* Fix some const mismatches.
|
||||
|
||||
* Remove "register" in variable declarations.
|
||||
|
||||
* Fix some memory leaks.
|
||||
|
||||
======================================================================
|
||||
|
||||
Major changes between "less" versions 481 and 487
|
||||
|
||||
* New commands ESC-{ and ESC-} to shift to start/end of displayed lines.
|
||||
|
||||
* Make search highlights work correctly when changing caselessness with -i.
|
||||
|
||||
* New option -Da in Windows version to enable SGR mode.
|
||||
|
||||
* Fix "nothing to search" error when top or bottom line on screen is empty.
|
||||
|
||||
* Fix bug when terminal has no "cm" termcap entry.
|
||||
|
||||
* Fix incorrect display when entering double-width chars in search string.
|
||||
|
||||
* Fix bug in Unicode handling that missed some double width characters.
|
||||
|
||||
* Update Unicode database to 9.0.0.
|
||||
|
||||
======================================================================
|
||||
|
||||
Major changes between "less" versions 458 and 481
|
||||
|
@ -7,9 +7,9 @@
|
||||
**************************************************************************
|
||||
**************************************************************************
|
||||
|
||||
Less, version 481
|
||||
Less, version 491
|
||||
|
||||
This is the distribution of less, version 481, released 31 Aug 2015.
|
||||
This is the distribution of less, version 491, released 07 Apr 2017.
|
||||
This program is part of the GNU project (http://www.gnu.org).
|
||||
|
||||
This program is free software. You may redistribute it and/or
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 1984-2015 Mark Nudelman
|
||||
* Copyright (C) 1984-2017 Mark Nudelman
|
||||
*
|
||||
* You may distribute under the terms of either the GNU General Public
|
||||
* License or the Less License, as specified in the README file.
|
||||
@ -24,14 +24,18 @@
|
||||
* "close bracket" are given.
|
||||
*/
|
||||
public void
|
||||
match_brac(int obrac, int cbrac, int forwdir, int n)
|
||||
match_brac(obrac, cbrac, forwdir, n)
|
||||
int obrac;
|
||||
int cbrac;
|
||||
int forwdir;
|
||||
int n;
|
||||
{
|
||||
int c;
|
||||
int nest;
|
||||
POSITION pos;
|
||||
int (*chget)(void);
|
||||
int (*chget)();
|
||||
|
||||
extern int ch_forw_get(void), ch_back_get(void);
|
||||
extern int ch_forw_get(), ch_back_get();
|
||||
|
||||
/*
|
||||
* Seek to the line containing the open bracket.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 1984-2015 Mark Nudelman
|
||||
* Copyright (C) 1984-2017 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.
|
||||
@ -144,7 +144,7 @@ static int ch_addbuf();
|
||||
* Get the character pointed to by the read pointer.
|
||||
*/
|
||||
int
|
||||
ch_get(void)
|
||||
ch_get()
|
||||
{
|
||||
struct buf *bp;
|
||||
struct bufnode *bn;
|
||||
@ -378,7 +378,8 @@ ch_get(void)
|
||||
* a single char onto an input file descriptor.
|
||||
*/
|
||||
public void
|
||||
ch_ungetchar(int c)
|
||||
ch_ungetchar(c)
|
||||
int c;
|
||||
{
|
||||
if (c != -1 && ch_ungotchar != -1)
|
||||
error("ch_ungetchar overrun", NULL_PARG);
|
||||
@ -391,7 +392,7 @@ ch_ungetchar(int c)
|
||||
* If we haven't read all of standard input into it, do that now.
|
||||
*/
|
||||
public void
|
||||
end_logfile(void)
|
||||
end_logfile()
|
||||
{
|
||||
static int tried = FALSE;
|
||||
|
||||
@ -416,7 +417,7 @@ end_logfile(void)
|
||||
* Write all the existing buffered data to the log file.
|
||||
*/
|
||||
public void
|
||||
sync_logfile(void)
|
||||
sync_logfile()
|
||||
{
|
||||
struct buf *bp;
|
||||
struct bufnode *bn;
|
||||
@ -453,7 +454,8 @@ sync_logfile(void)
|
||||
* Determine if a specific block is currently in one of the buffers.
|
||||
*/
|
||||
static int
|
||||
buffered(BLOCKNUM block)
|
||||
buffered(block)
|
||||
BLOCKNUM block;
|
||||
{
|
||||
struct buf *bp;
|
||||
struct bufnode *bn;
|
||||
@ -474,7 +476,8 @@ buffered(BLOCKNUM block)
|
||||
* Return 0 if successful, non-zero if can't seek there.
|
||||
*/
|
||||
public int
|
||||
ch_seek(POSITION pos)
|
||||
ch_seek(pos)
|
||||
POSITION pos;
|
||||
{
|
||||
BLOCKNUM new_block;
|
||||
POSITION len;
|
||||
@ -512,7 +515,7 @@ ch_seek(POSITION pos)
|
||||
* Seek to the end of the file.
|
||||
*/
|
||||
public int
|
||||
ch_end_seek(void)
|
||||
ch_end_seek()
|
||||
{
|
||||
POSITION len;
|
||||
|
||||
@ -539,7 +542,7 @@ ch_end_seek(void)
|
||||
* Seek to the last position in the file that is currently buffered.
|
||||
*/
|
||||
public int
|
||||
ch_end_buffer_seek(void)
|
||||
ch_end_buffer_seek()
|
||||
{
|
||||
struct buf *bp;
|
||||
struct bufnode *bn;
|
||||
@ -567,7 +570,7 @@ ch_end_buffer_seek(void)
|
||||
* beginning of the pipe is no longer buffered.
|
||||
*/
|
||||
public int
|
||||
ch_beg_seek(void)
|
||||
ch_beg_seek()
|
||||
{
|
||||
struct bufnode *bn;
|
||||
struct bufnode *firstbn;
|
||||
@ -599,7 +602,7 @@ ch_beg_seek(void)
|
||||
* Return the length of the file, if known.
|
||||
*/
|
||||
public POSITION
|
||||
ch_length(void)
|
||||
ch_length()
|
||||
{
|
||||
if (thisfile == NULL)
|
||||
return (NULL_POSITION);
|
||||
@ -616,7 +619,7 @@ ch_length(void)
|
||||
* Return the current position in the file.
|
||||
*/
|
||||
public POSITION
|
||||
ch_tell(void)
|
||||
ch_tell()
|
||||
{
|
||||
if (thisfile == NULL)
|
||||
return (NULL_POSITION);
|
||||
@ -627,7 +630,7 @@ ch_tell(void)
|
||||
* Get the current char and post-increment the read pointer.
|
||||
*/
|
||||
public int
|
||||
ch_forw_get(void)
|
||||
ch_forw_get()
|
||||
{
|
||||
int c;
|
||||
|
||||
@ -650,7 +653,7 @@ ch_forw_get(void)
|
||||
* Pre-decrement the read pointer and get the new current char.
|
||||
*/
|
||||
public int
|
||||
ch_back_get(void)
|
||||
ch_back_get()
|
||||
{
|
||||
if (thisfile == NULL)
|
||||
return (EOI);
|
||||
@ -673,7 +676,8 @@ ch_back_get(void)
|
||||
* bufspace is in units of 1024 bytes. -1 mean no limit.
|
||||
*/
|
||||
public void
|
||||
ch_setbufspace(int bufspace)
|
||||
ch_setbufspace(bufspace)
|
||||
int bufspace;
|
||||
{
|
||||
if (bufspace < 0)
|
||||
maxbufs = -1;
|
||||
@ -689,7 +693,7 @@ ch_setbufspace(int bufspace)
|
||||
* Flush (discard) any saved file state, including buffer contents.
|
||||
*/
|
||||
public void
|
||||
ch_flush(void)
|
||||
ch_flush()
|
||||
{
|
||||
struct bufnode *bn;
|
||||
|
||||
@ -756,7 +760,7 @@ ch_flush(void)
|
||||
* The buffer is added to the tail of the buffer chain.
|
||||
*/
|
||||
static int
|
||||
ch_addbuf(void)
|
||||
ch_addbuf()
|
||||
{
|
||||
struct buf *bp;
|
||||
struct bufnode *bn;
|
||||
@ -781,7 +785,7 @@ ch_addbuf(void)
|
||||
*
|
||||
*/
|
||||
static void
|
||||
init_hashtbl(void)
|
||||
init_hashtbl()
|
||||
{
|
||||
int h;
|
||||
|
||||
@ -796,7 +800,7 @@ init_hashtbl(void)
|
||||
* Delete all buffers for this file.
|
||||
*/
|
||||
static void
|
||||
ch_delbufs(void)
|
||||
ch_delbufs()
|
||||
{
|
||||
struct bufnode *bn;
|
||||
|
||||
@ -814,7 +818,8 @@ ch_delbufs(void)
|
||||
* Is it possible to seek on a file descriptor?
|
||||
*/
|
||||
public int
|
||||
seekable(int f)
|
||||
seekable(f)
|
||||
int f;
|
||||
{
|
||||
#if MSDOS_COMPILER
|
||||
extern int fd0;
|
||||
@ -835,7 +840,7 @@ seekable(int f)
|
||||
* This is used after an ignore_eof read, during which the EOF may change.
|
||||
*/
|
||||
public void
|
||||
ch_set_eof(void)
|
||||
ch_set_eof()
|
||||
{
|
||||
ch_fsize = ch_fpos;
|
||||
}
|
||||
@ -845,7 +850,9 @@ ch_set_eof(void)
|
||||
* Initialize file state for a new file.
|
||||
*/
|
||||
public void
|
||||
ch_init(int f, int flags)
|
||||
ch_init(f, flags)
|
||||
int f;
|
||||
int flags;
|
||||
{
|
||||
/*
|
||||
* See if we already have a filestate for this file.
|
||||
@ -884,7 +891,7 @@ ch_init(int f, int flags)
|
||||
* Close a filestate.
|
||||
*/
|
||||
public void
|
||||
ch_close(void)
|
||||
ch_close()
|
||||
{
|
||||
int keepstate = FALSE;
|
||||
|
||||
@ -927,7 +934,7 @@ ch_close(void)
|
||||
* Return ch_flags for the current file.
|
||||
*/
|
||||
public int
|
||||
ch_getflags(void)
|
||||
ch_getflags()
|
||||
{
|
||||
if (thisfile == NULL)
|
||||
return (0);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 1984-2015 Mark Nudelman
|
||||
* Copyright (C) 1984-2017 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,6 +64,8 @@ struct cs_alias {
|
||||
char *oname;
|
||||
} cs_aliases[] = {
|
||||
{ "UTF-8", "utf-8" },
|
||||
{ "utf8", "utf-8" },
|
||||
{ "UTF8", "utf-8" },
|
||||
{ "ANSI_X3.4-1968", "ascii" },
|
||||
{ "US-ASCII", "ascii" },
|
||||
{ "latin1", "iso8859" },
|
||||
@ -130,7 +132,8 @@ public int binattr = AT_STANDOUT;
|
||||
* c control character
|
||||
*/
|
||||
static void
|
||||
ichardef(char *s)
|
||||
ichardef(s)
|
||||
char *s;
|
||||
{
|
||||
char *cp;
|
||||
int n;
|
||||
@ -186,7 +189,9 @@ ichardef(char *s)
|
||||
* The valid charset names are listed in the "charsets" array.
|
||||
*/
|
||||
static int
|
||||
icharset(char *name, int no_error)
|
||||
icharset(name, no_error)
|
||||
char *name;
|
||||
int no_error;
|
||||
{
|
||||
struct charset *p;
|
||||
struct cs_alias *a;
|
||||
@ -227,7 +232,7 @@ icharset(char *name, int no_error)
|
||||
* Define a charset, given a locale name.
|
||||
*/
|
||||
static void
|
||||
ilocale(void)
|
||||
ilocale()
|
||||
{
|
||||
int c;
|
||||
|
||||
@ -247,7 +252,10 @@ ilocale(void)
|
||||
* Define the printing format for control (or binary utf) chars.
|
||||
*/
|
||||
static void
|
||||
setbinfmt(char *s, char **fmtvarptr, char *default_fmt)
|
||||
setbinfmt(s, fmtvarptr, default_fmt)
|
||||
char *s;
|
||||
char **fmtvarptr;
|
||||
char *default_fmt;
|
||||
{
|
||||
if (s && utf_mode)
|
||||
{
|
||||
@ -293,7 +301,7 @@ setbinfmt(char *s, char **fmtvarptr, char *default_fmt)
|
||||
*
|
||||
*/
|
||||
static void
|
||||
set_charset(void)
|
||||
set_charset()
|
||||
{
|
||||
char *s;
|
||||
|
||||
@ -364,7 +372,7 @@ set_charset(void)
|
||||
* Initialize charset data structures.
|
||||
*/
|
||||
public void
|
||||
init_charset(void)
|
||||
init_charset()
|
||||
{
|
||||
char *s;
|
||||
|
||||
@ -385,7 +393,8 @@ init_charset(void)
|
||||
* Is a given character a "binary" character?
|
||||
*/
|
||||
public int
|
||||
binary_char(LWCHAR c)
|
||||
binary_char(c)
|
||||
LWCHAR c;
|
||||
{
|
||||
if (utf_mode)
|
||||
return (is_ubin_char(c));
|
||||
@ -397,7 +406,8 @@ binary_char(LWCHAR c)
|
||||
* Is a given character a "control" character?
|
||||
*/
|
||||
public int
|
||||
control_char(LWCHAR c)
|
||||
control_char(c)
|
||||
LWCHAR c;
|
||||
{
|
||||
c &= 0377;
|
||||
return (chardef[c] & IS_CONTROL_CHAR);
|
||||
@ -408,7 +418,8 @@ control_char(LWCHAR c)
|
||||
* For example, in the "ascii" charset '\3' is printed as "^C".
|
||||
*/
|
||||
public char *
|
||||
prchar(LWCHAR c)
|
||||
prchar(c)
|
||||
LWCHAR c;
|
||||
{
|
||||
/* {{ This buffer can be overrun if LESSBINFMT is a long string. }} */
|
||||
static char buf[32];
|
||||
@ -443,7 +454,8 @@ prchar(LWCHAR c)
|
||||
* Return the printable form of a UTF-8 character.
|
||||
*/
|
||||
public char *
|
||||
prutfchar(LWCHAR ch)
|
||||
prutfchar(ch)
|
||||
LWCHAR ch;
|
||||
{
|
||||
static char buf[32];
|
||||
|
||||
@ -473,7 +485,8 @@ prutfchar(LWCHAR ch)
|
||||
* Get the length of a UTF-8 character in bytes.
|
||||
*/
|
||||
public int
|
||||
utf_len(char ch)
|
||||
utf_len(ch)
|
||||
unsigned char ch;
|
||||
{
|
||||
if ((ch & 0x80) == 0)
|
||||
return 1;
|
||||
@ -495,15 +508,18 @@ utf_len(char ch)
|
||||
* Does the parameter point to the lead byte of a well-formed UTF-8 character?
|
||||
*/
|
||||
public int
|
||||
is_utf8_well_formed(unsigned char *s, int slen)
|
||||
is_utf8_well_formed(ss, slen)
|
||||
char *ss;
|
||||
int slen;
|
||||
{
|
||||
int i;
|
||||
int len;
|
||||
unsigned char *s = (unsigned char *) ss;
|
||||
|
||||
if (IS_UTF8_INVALID(s[0]))
|
||||
return (0);
|
||||
|
||||
len = utf_len((char) s[0]);
|
||||
len = utf_len(s[0]);
|
||||
if (len > slen)
|
||||
return (0);
|
||||
if (len == 1)
|
||||
@ -530,14 +546,16 @@ is_utf8_well_formed(unsigned char *s, int slen)
|
||||
* Return number of invalid UTF-8 sequences found in a buffer.
|
||||
*/
|
||||
public int
|
||||
utf_bin_count(unsigned char *data, int len)
|
||||
utf_bin_count(data, len)
|
||||
char *data;
|
||||
int len;
|
||||
{
|
||||
int bin_count = 0;
|
||||
while (len > 0)
|
||||
{
|
||||
if (is_utf8_well_formed(data, len))
|
||||
{
|
||||
int clen = utf_len(*data);
|
||||
int clen = utf_len(*data & 0377);
|
||||
data += clen;
|
||||
len -= clen;
|
||||
} else
|
||||
@ -547,7 +565,7 @@ utf_bin_count(unsigned char *data, int len)
|
||||
do {
|
||||
++data;
|
||||
--len;
|
||||
} while (len > 0 && !IS_UTF8_LEAD(*data));
|
||||
} while (len > 0 && !IS_UTF8_LEAD(*data & 0377));
|
||||
}
|
||||
}
|
||||
return (bin_count);
|
||||
@ -557,7 +575,8 @@ utf_bin_count(unsigned char *data, int len)
|
||||
* Get the value of a UTF-8 character.
|
||||
*/
|
||||
public LWCHAR
|
||||
get_wchar(constant char *p)
|
||||
get_wchar(p)
|
||||
constant char *p;
|
||||
{
|
||||
switch (utf_len(p[0]))
|
||||
{
|
||||
@ -608,7 +627,9 @@ get_wchar(constant char *p)
|
||||
* Store a character into a UTF-8 string.
|
||||
*/
|
||||
public void
|
||||
put_wchar(char **pp, LWCHAR ch)
|
||||
put_wchar(pp, ch)
|
||||
char **pp;
|
||||
LWCHAR ch;
|
||||
{
|
||||
if (!utf_mode || ch < 0x80)
|
||||
{
|
||||
@ -656,11 +677,14 @@ put_wchar(char **pp, LWCHAR ch)
|
||||
* Step forward or backward one character in a string.
|
||||
*/
|
||||
public LWCHAR
|
||||
step_char(constant char **pp, signed int dir, constant char *limit)
|
||||
step_char(pp, dir, limit)
|
||||
char **pp;
|
||||
signed int dir;
|
||||
constant char *limit;
|
||||
{
|
||||
LWCHAR ch;
|
||||
int len;
|
||||
constant char *p = *pp;
|
||||
char *p = *pp;
|
||||
|
||||
if (!utf_mode)
|
||||
{
|
||||
@ -675,7 +699,7 @@ step_char(constant char **pp, signed int dir, constant char *limit)
|
||||
if (p + len > limit)
|
||||
{
|
||||
ch = 0;
|
||||
p = limit;
|
||||
p = (char *) limit;
|
||||
} else
|
||||
{
|
||||
ch = get_wchar(p);
|
||||
@ -723,7 +747,9 @@ static struct wchar_range comb_table[] = {
|
||||
|
||||
|
||||
static int
|
||||
is_in_table(LWCHAR ch, struct wchar_range_table *table)
|
||||
is_in_table(ch, table)
|
||||
LWCHAR ch;
|
||||
struct wchar_range_table *table;
|
||||
{
|
||||
int hi;
|
||||
int lo;
|
||||
@ -751,7 +777,8 @@ is_in_table(LWCHAR ch, struct wchar_range_table *table)
|
||||
* If a composing character follows any char, the two combine into one glyph.
|
||||
*/
|
||||
public int
|
||||
is_composing_char(LWCHAR ch)
|
||||
is_composing_char(ch)
|
||||
LWCHAR ch;
|
||||
{
|
||||
return is_in_table(ch, &compose_table);
|
||||
}
|
||||
@ -760,7 +787,8 @@ is_composing_char(LWCHAR ch)
|
||||
* Should this UTF-8 character be treated as binary?
|
||||
*/
|
||||
public int
|
||||
is_ubin_char(LWCHAR ch)
|
||||
is_ubin_char(ch)
|
||||
LWCHAR ch;
|
||||
{
|
||||
return is_in_table(ch, &ubin_table);
|
||||
}
|
||||
@ -769,7 +797,8 @@ is_ubin_char(LWCHAR ch)
|
||||
* Is this a double width UTF-8 character?
|
||||
*/
|
||||
public int
|
||||
is_wide_char(LWCHAR ch)
|
||||
is_wide_char(ch)
|
||||
LWCHAR ch;
|
||||
{
|
||||
return is_in_table(ch, &wide_table);
|
||||
}
|
||||
@ -780,7 +809,9 @@ is_wide_char(LWCHAR ch)
|
||||
* a specific char (not any char), the two combine into one glyph.
|
||||
*/
|
||||
public int
|
||||
is_combining_char(LWCHAR ch1, LWCHAR ch2)
|
||||
is_combining_char(ch1, ch2)
|
||||
LWCHAR ch1;
|
||||
LWCHAR ch2;
|
||||
{
|
||||
/* The table is small; use linear search. */
|
||||
int i;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 1984-2015 Mark Nudelman
|
||||
* Copyright (C) 1984-2017 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.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 1984-2015 Mark Nudelman
|
||||
* Copyright (C) 1984-2017 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.
|
||||
@ -67,6 +67,8 @@
|
||||
#define A_FILTER 55
|
||||
#define A_F_UNTIL_HILITE 56
|
||||
#define A_GOEND_BUF 57
|
||||
#define A_LLSHIFT 58
|
||||
#define A_RRSHIFT 59
|
||||
|
||||
#define A_INVALID 100
|
||||
#define A_NOACTION 101
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 1984-2015 Mark Nudelman
|
||||
* Copyright (C) 1984-2017 Mark Nudelman
|
||||
*
|
||||
* You may distribute under the terms of either the GNU General Public
|
||||
* License or the Less License, as specified in the README file.
|
||||
@ -32,7 +32,7 @@ static int literal; /* Next input char should not be interpreted */
|
||||
static int updown_match = -1; /* Prefix length in up/down movement */
|
||||
|
||||
#if TAB_COMPLETE_FILENAME
|
||||
static int cmd_complete(int action);
|
||||
static int cmd_complete();
|
||||
/*
|
||||
* These variables are statics used by cmd_complete.
|
||||
*/
|
||||
@ -76,25 +76,25 @@ struct mlist
|
||||
*/
|
||||
struct mlist mlist_search =
|
||||
{ &mlist_search, &mlist_search, &mlist_search, NULL, 0 };
|
||||
public void * constant ml_search = (void *) &mlist_search;
|
||||
public void *ml_search = (void *) &mlist_search;
|
||||
|
||||
struct mlist mlist_examine =
|
||||
{ &mlist_examine, &mlist_examine, &mlist_examine, NULL, 0 };
|
||||
public void * constant ml_examine = (void *) &mlist_examine;
|
||||
public void *ml_examine = (void *) &mlist_examine;
|
||||
|
||||
#if SHELL_ESCAPE || PIPEC
|
||||
struct mlist mlist_shell =
|
||||
{ &mlist_shell, &mlist_shell, &mlist_shell, NULL, 0 };
|
||||
public void * constant ml_shell = (void *) &mlist_shell;
|
||||
public void *ml_shell = (void *) &mlist_shell;
|
||||
#endif
|
||||
|
||||
#else /* CMD_HISTORY */
|
||||
|
||||
/* If CMD_HISTORY is off, these are just flags. */
|
||||
public void * constant ml_search = (void *)1;
|
||||
public void * constant ml_examine = (void *)2;
|
||||
public void *ml_search = (void *)1;
|
||||
public void *ml_examine = (void *)2;
|
||||
#if SHELL_ESCAPE || PIPEC
|
||||
public void * constant ml_shell = (void *)3;
|
||||
public void *ml_shell = (void *)3;
|
||||
#endif
|
||||
|
||||
#endif /* CMD_HISTORY */
|
||||
@ -114,7 +114,7 @@ static int cmd_mbc_buf_index;
|
||||
* Reset command buffer (to empty).
|
||||
*/
|
||||
public void
|
||||
cmd_reset(void)
|
||||
cmd_reset()
|
||||
{
|
||||
cp = cmdbuf;
|
||||
*cp = '\0';
|
||||
@ -129,7 +129,7 @@ cmd_reset(void)
|
||||
* Clear command line.
|
||||
*/
|
||||
public void
|
||||
clear_cmd(void)
|
||||
clear_cmd()
|
||||
{
|
||||
cmd_col = prompt_col = 0;
|
||||
cmd_mbc_buf_len = 0;
|
||||
@ -140,28 +140,27 @@ clear_cmd(void)
|
||||
* Display a string, usually as a prompt for input into the command buffer.
|
||||
*/
|
||||
public void
|
||||
cmd_putstr(constant char *s)
|
||||
cmd_putstr(s)
|
||||
constant char *s;
|
||||
{
|
||||
LWCHAR prev_ch = 0;
|
||||
LWCHAR ch;
|
||||
constant char *endline = s + strlen(s);
|
||||
while (*s != '\0')
|
||||
{
|
||||
constant char *ns = s;
|
||||
char *ns = (char *) s;
|
||||
int width;
|
||||
ch = step_char(&ns, +1, endline);
|
||||
while (s < ns)
|
||||
putchr(*s++);
|
||||
if (!utf_mode)
|
||||
{
|
||||
cmd_col++;
|
||||
prompt_col++;
|
||||
} else if (!is_composing_char(ch) &&
|
||||
!is_combining_char(prev_ch, ch))
|
||||
{
|
||||
int width = is_wide_char(ch) ? 2 : 1;
|
||||
cmd_col += width;
|
||||
prompt_col += width;
|
||||
}
|
||||
width = 1;
|
||||
else if (is_composing_char(ch) || is_combining_char(prev_ch, ch))
|
||||
width = 0;
|
||||
else
|
||||
width = is_wide_char(ch) ? 2 : 1;
|
||||
cmd_col += width;
|
||||
prompt_col += width;
|
||||
prev_ch = ch;
|
||||
}
|
||||
}
|
||||
@ -170,10 +169,10 @@ cmd_putstr(constant char *s)
|
||||
* How many characters are in the command buffer?
|
||||
*/
|
||||
public int
|
||||
len_cmdbuf(void)
|
||||
len_cmdbuf()
|
||||
{
|
||||
constant char *s = cmdbuf;
|
||||
constant char *endline = s + strlen(s);
|
||||
char *s = cmdbuf;
|
||||
char *endline = s + strlen(s);
|
||||
int len = 0;
|
||||
|
||||
while (*s != '\0')
|
||||
@ -186,63 +185,44 @@ len_cmdbuf(void)
|
||||
|
||||
/*
|
||||
* Common part of cmd_step_right() and cmd_step_left().
|
||||
* {{ Returning pwidth and bswidth separately is a historical artifact
|
||||
* since they're always the same. Maybe clean this up someday. }}
|
||||
*/
|
||||
static char *
|
||||
cmd_step_common(constant char *p, LWCHAR ch, int len, int *pwidth, int *bswidth)
|
||||
cmd_step_common(p, ch, len, pwidth, bswidth)
|
||||
char *p;
|
||||
LWCHAR ch;
|
||||
int len;
|
||||
int *pwidth;
|
||||
int *bswidth;
|
||||
{
|
||||
char *pr;
|
||||
int width;
|
||||
|
||||
if (len == 1)
|
||||
{
|
||||
pr = prchar((int) ch);
|
||||
if (pwidth != NULL || bswidth != NULL)
|
||||
{
|
||||
int len = (int) strlen(pr);
|
||||
if (pwidth != NULL)
|
||||
*pwidth = len;
|
||||
if (bswidth != NULL)
|
||||
*bswidth = len;
|
||||
}
|
||||
width = (int) strlen(pr);
|
||||
} else
|
||||
{
|
||||
pr = prutfchar(ch);
|
||||
if (pwidth != NULL || bswidth != NULL)
|
||||
if (is_composing_char(ch))
|
||||
width = 0;
|
||||
else if (is_ubin_char(ch))
|
||||
width = (int) strlen(pr);
|
||||
else
|
||||
{
|
||||
if (is_composing_char(ch))
|
||||
{
|
||||
if (pwidth != NULL)
|
||||
*pwidth = 0;
|
||||
if (bswidth != NULL)
|
||||
*bswidth = 0;
|
||||
} else if (is_ubin_char(ch))
|
||||
{
|
||||
int len = (int) strlen(pr);
|
||||
if (pwidth != NULL)
|
||||
*pwidth = len;
|
||||
if (bswidth != NULL)
|
||||
*bswidth = len;
|
||||
} else
|
||||
{
|
||||
LWCHAR prev_ch = step_char(&p, -1, cmdbuf);
|
||||
if (is_combining_char(prev_ch, ch))
|
||||
{
|
||||
if (pwidth != NULL)
|
||||
*pwidth = 0;
|
||||
if (bswidth != NULL)
|
||||
*bswidth = 0;
|
||||
} else
|
||||
{
|
||||
if (pwidth != NULL)
|
||||
*pwidth = is_wide_char(ch)
|
||||
? 2
|
||||
: 1;
|
||||
if (bswidth != NULL)
|
||||
*bswidth = 1;
|
||||
}
|
||||
}
|
||||
LWCHAR prev_ch = step_char(&p, -1, cmdbuf);
|
||||
if (is_combining_char(prev_ch, ch))
|
||||
width = 0;
|
||||
else
|
||||
width = is_wide_char(ch) ? 2 : 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (pwidth != NULL)
|
||||
*pwidth = width;
|
||||
if (bswidth != NULL)
|
||||
*bswidth = width;
|
||||
return (pr);
|
||||
}
|
||||
|
||||
@ -250,10 +230,13 @@ cmd_step_common(constant char *p, LWCHAR ch, int len, int *pwidth, int *bswidth)
|
||||
* Step a pointer one character right in the command buffer.
|
||||
*/
|
||||
static char *
|
||||
cmd_step_right(char **pp, int *pwidth, int *bswidth)
|
||||
cmd_step_right(pp, pwidth, bswidth)
|
||||
char **pp;
|
||||
int *pwidth;
|
||||
int *bswidth;
|
||||
{
|
||||
char *p = *pp;
|
||||
LWCHAR ch = step_char((constant char **)pp, +1, p + strlen(p));
|
||||
LWCHAR ch = step_char(pp, +1, p + strlen(p));
|
||||
|
||||
return cmd_step_common(p, ch, *pp - p, pwidth, bswidth);
|
||||
}
|
||||
@ -262,10 +245,13 @@ cmd_step_right(char **pp, int *pwidth, int *bswidth)
|
||||
* Step a pointer one character left in the command buffer.
|
||||
*/
|
||||
static char *
|
||||
cmd_step_left(char **pp, int *pwidth, int *bswidth)
|
||||
cmd_step_left(pp, pwidth, bswidth)
|
||||
char **pp;
|
||||
int *pwidth;
|
||||
int *bswidth;
|
||||
{
|
||||
char *p = *pp;
|
||||
LWCHAR ch = step_char((constant char **)pp, -1, cmdbuf);
|
||||
LWCHAR ch = step_char(pp, -1, cmdbuf);
|
||||
|
||||
return cmd_step_common(*pp, ch, p - *pp, pwidth, bswidth);
|
||||
}
|
||||
@ -275,7 +261,8 @@ cmd_step_left(char **pp, int *pwidth, int *bswidth)
|
||||
* Then position the cursor just after the char old_cp (a pointer into cmdbuf).
|
||||
*/
|
||||
static void
|
||||
cmd_repaint(char *old_cp)
|
||||
cmd_repaint(old_cp)
|
||||
constant char *old_cp;
|
||||
{
|
||||
/*
|
||||
* Repaint the line from the current position.
|
||||
@ -285,7 +272,7 @@ cmd_repaint(char *old_cp)
|
||||
{
|
||||
char *np = cp;
|
||||
int width;
|
||||
constant char *pr = cmd_step_right(&np, &width, NULL);
|
||||
char *pr = cmd_step_right(&np, &width, NULL);
|
||||
if (cmd_col + width >= sc_width)
|
||||
break;
|
||||
cp = np;
|
||||
@ -315,7 +302,7 @@ cmd_repaint(char *old_cp)
|
||||
* and set cp to the corresponding char in cmdbuf.
|
||||
*/
|
||||
static void
|
||||
cmd_home(void)
|
||||
cmd_home()
|
||||
{
|
||||
while (cmd_col > prompt_col)
|
||||
{
|
||||
@ -334,7 +321,7 @@ cmd_home(void)
|
||||
* Shift the cmdbuf display left a half-screen.
|
||||
*/
|
||||
static void
|
||||
cmd_lshift(void)
|
||||
cmd_lshift()
|
||||
{
|
||||
char *s;
|
||||
char *save_cp;
|
||||
@ -372,7 +359,7 @@ cmd_lshift(void)
|
||||
* Shift the cmdbuf display right a half-screen.
|
||||
*/
|
||||
static void
|
||||
cmd_rshift(void)
|
||||
cmd_rshift()
|
||||
{
|
||||
char *s;
|
||||
char *save_cp;
|
||||
@ -402,7 +389,7 @@ cmd_rshift(void)
|
||||
* Move cursor right one character.
|
||||
*/
|
||||
static int
|
||||
cmd_right(void)
|
||||
cmd_right()
|
||||
{
|
||||
char *pr;
|
||||
char *ncp;
|
||||
@ -437,7 +424,7 @@ cmd_right(void)
|
||||
* Move cursor left one character.
|
||||
*/
|
||||
static int
|
||||
cmd_left(void)
|
||||
cmd_left()
|
||||
{
|
||||
char *ncp;
|
||||
int width, bswidth;
|
||||
@ -467,7 +454,9 @@ cmd_left(void)
|
||||
* Insert a char into the command buffer, at the current position.
|
||||
*/
|
||||
static int
|
||||
cmd_ichar(char *cs, int clen)
|
||||
cmd_ichar(cs, clen)
|
||||
char *cs;
|
||||
int clen;
|
||||
{
|
||||
char *s;
|
||||
|
||||
@ -502,7 +491,7 @@ cmd_ichar(char *cs, int clen)
|
||||
* Delete the char to the left of the cursor.
|
||||
*/
|
||||
static int
|
||||
cmd_erase(void)
|
||||
cmd_erase()
|
||||
{
|
||||
char *s;
|
||||
int clen;
|
||||
@ -551,7 +540,7 @@ cmd_erase(void)
|
||||
* Delete the char under the cursor.
|
||||
*/
|
||||
static int
|
||||
cmd_delete(void)
|
||||
cmd_delete()
|
||||
{
|
||||
if (*cp == '\0')
|
||||
{
|
||||
@ -570,7 +559,7 @@ cmd_delete(void)
|
||||
* Delete the "word" to the left of the cursor.
|
||||
*/
|
||||
static int
|
||||
cmd_werase(void)
|
||||
cmd_werase()
|
||||
{
|
||||
if (cp > cmdbuf && cp[-1] == ' ')
|
||||
{
|
||||
@ -596,7 +585,7 @@ cmd_werase(void)
|
||||
* Delete the "word" under the cursor.
|
||||
*/
|
||||
static int
|
||||
cmd_wdelete(void)
|
||||
cmd_wdelete()
|
||||
{
|
||||
if (*cp == ' ')
|
||||
{
|
||||
@ -622,7 +611,7 @@ cmd_wdelete(void)
|
||||
* Delete all chars in the command buffer.
|
||||
*/
|
||||
static int
|
||||
cmd_kill(void)
|
||||
cmd_kill()
|
||||
{
|
||||
if (cmdbuf[0] == '\0')
|
||||
{
|
||||
@ -648,7 +637,9 @@ cmd_kill(void)
|
||||
* Select an mlist structure to be the current command history.
|
||||
*/
|
||||
public void
|
||||
set_mlist(constant void *mlist, int cmdflags)
|
||||
set_mlist(mlist, cmdflags)
|
||||
void *mlist;
|
||||
int cmdflags;
|
||||
{
|
||||
#if CMD_HISTORY
|
||||
curr_mlist = (struct mlist *) mlist;
|
||||
@ -667,9 +658,10 @@ set_mlist(constant void *mlist, int cmdflags)
|
||||
* cmdbuf's corresponding chars.
|
||||
*/
|
||||
static int
|
||||
cmd_updown(int action)
|
||||
cmd_updown(action)
|
||||
int action;
|
||||
{
|
||||
char *s;
|
||||
constant char *s;
|
||||
struct mlist *ml;
|
||||
|
||||
if (curr_mlist == NULL)
|
||||
@ -729,7 +721,10 @@ cmd_updown(int action)
|
||||
* Add a string to an mlist.
|
||||
*/
|
||||
public void
|
||||
cmd_addhist(struct mlist *constant mlist, char *cmd, int modified)
|
||||
cmd_addhist(mlist, cmd, modified)
|
||||
struct mlist *mlist;
|
||||
constant char *cmd;
|
||||
int modified;
|
||||
{
|
||||
#if CMD_HISTORY
|
||||
struct mlist *ml;
|
||||
@ -772,7 +767,7 @@ cmd_addhist(struct mlist *constant mlist, char *cmd, int modified)
|
||||
* Add it to the currently selected history list.
|
||||
*/
|
||||
public void
|
||||
cmd_accept(void)
|
||||
cmd_accept()
|
||||
{
|
||||
#if CMD_HISTORY
|
||||
/*
|
||||
@ -794,7 +789,8 @@ cmd_accept(void)
|
||||
* CC_QUIT The char requests the current command to be aborted.
|
||||
*/
|
||||
static int
|
||||
cmd_edit(int c)
|
||||
cmd_edit(c)
|
||||
int c;
|
||||
{
|
||||
int action;
|
||||
int flags;
|
||||
@ -909,7 +905,8 @@ cmd_edit(int c)
|
||||
* Insert a string into the command buffer, at the current position.
|
||||
*/
|
||||
static int
|
||||
cmd_istr(char *str)
|
||||
cmd_istr(str)
|
||||
char *str;
|
||||
{
|
||||
char *s;
|
||||
int action;
|
||||
@ -918,7 +915,7 @@ cmd_istr(char *str)
|
||||
for (s = str; *s != '\0'; )
|
||||
{
|
||||
char *os = s;
|
||||
step_char((constant char **)&s, +1, endline);
|
||||
step_char(&s, +1, endline);
|
||||
action = cmd_ichar(os, s - os);
|
||||
if (action != CC_OK)
|
||||
{
|
||||
@ -936,14 +933,14 @@ cmd_istr(char *str)
|
||||
* cursor at the end of the word.
|
||||
*/
|
||||
static char *
|
||||
delimit_word(void)
|
||||
delimit_word()
|
||||
{
|
||||
char *word;
|
||||
#if SPACES_IN_FILENAMES
|
||||
char *p;
|
||||
int delim_quoted = 0;
|
||||
int meta_quoted = 0;
|
||||
char *esc = get_meta_escape();
|
||||
constant char *esc = get_meta_escape();
|
||||
int esclen = (int) strlen(esc);
|
||||
#endif
|
||||
|
||||
@ -1023,7 +1020,7 @@ delimit_word(void)
|
||||
* which start with that word, and set tk_text to that list.
|
||||
*/
|
||||
static void
|
||||
init_compl(void)
|
||||
init_compl()
|
||||
{
|
||||
char *word;
|
||||
char c;
|
||||
@ -1086,7 +1083,9 @@ init_compl(void)
|
||||
* Return the next word in the current completion list.
|
||||
*/
|
||||
static char *
|
||||
next_compl(int action, char *prev)
|
||||
next_compl(action, prev)
|
||||
int action;
|
||||
char *prev;
|
||||
{
|
||||
switch (action)
|
||||
{
|
||||
@ -1106,7 +1105,8 @@ next_compl(int action, char *prev)
|
||||
* or a subsequent time (step thru the list).
|
||||
*/
|
||||
static int
|
||||
cmd_complete(int action)
|
||||
cmd_complete(action)
|
||||
int action;
|
||||
{
|
||||
char *s;
|
||||
|
||||
@ -1203,7 +1203,8 @@ cmd_complete(int action)
|
||||
* CC_ERROR The char could not be accepted due to an error.
|
||||
*/
|
||||
public int
|
||||
cmd_char(int c)
|
||||
cmd_char(c)
|
||||
int c;
|
||||
{
|
||||
int action;
|
||||
int len;
|
||||
@ -1292,7 +1293,8 @@ cmd_char(int c)
|
||||
* Return the number currently in the command buffer.
|
||||
*/
|
||||
public LINENUM
|
||||
cmd_int(long *frac)
|
||||
cmd_int(frac)
|
||||
long *frac;
|
||||
{
|
||||
char *p;
|
||||
LINENUM n = 0;
|
||||
@ -1313,7 +1315,7 @@ cmd_int(long *frac)
|
||||
* Return a pointer to the command buffer.
|
||||
*/
|
||||
public char *
|
||||
get_cmdbuf(void)
|
||||
get_cmdbuf()
|
||||
{
|
||||
return (cmdbuf);
|
||||
}
|
||||
@ -1323,7 +1325,7 @@ get_cmdbuf(void)
|
||||
* Return the last (most recent) string in the current command history.
|
||||
*/
|
||||
public char *
|
||||
cmd_lastpattern(void)
|
||||
cmd_lastpattern()
|
||||
{
|
||||
if (curr_mlist == NULL)
|
||||
return (NULL);
|
||||
@ -1335,7 +1337,8 @@ cmd_lastpattern(void)
|
||||
/*
|
||||
*/
|
||||
static int
|
||||
mlist_size(struct mlist *ml)
|
||||
mlist_size(ml)
|
||||
struct mlist *ml;
|
||||
{
|
||||
int size = 0;
|
||||
for (ml = ml->next; ml->string != NULL; ml = ml->next)
|
||||
@ -1347,7 +1350,7 @@ mlist_size(struct mlist *ml)
|
||||
* Get the name of the history file.
|
||||
*/
|
||||
static char *
|
||||
histfile_name(void)
|
||||
histfile_name()
|
||||
{
|
||||
char *home;
|
||||
char *name;
|
||||
@ -1387,8 +1390,11 @@ histfile_name(void)
|
||||
* Read a .lesshst file and call a callback for each line in the file.
|
||||
*/
|
||||
static void
|
||||
read_cmdhist2(void (*action)(void*,struct mlist*,char*), void *uparam,
|
||||
int skip_search, int skip_shell)
|
||||
read_cmdhist2(action, uparam, skip_search, skip_shell)
|
||||
void (*action)(void*,struct mlist*,char*);
|
||||
void *uparam;
|
||||
int skip_search;
|
||||
int skip_shell;
|
||||
{
|
||||
struct mlist *ml = NULL;
|
||||
char line[CMDBUF_SIZE];
|
||||
@ -1448,8 +1454,11 @@ read_cmdhist2(void (*action)(void*,struct mlist*,char*), void *uparam,
|
||||
}
|
||||
|
||||
static void
|
||||
read_cmdhist(void (*action)(void*,struct mlist*,char*), void *uparam,
|
||||
int skip_search, int skip_shell)
|
||||
read_cmdhist(action, uparam, skip_search, skip_shell)
|
||||
void (*action)(void*,struct mlist*,char*);
|
||||
void *uparam;
|
||||
int skip_search;
|
||||
int skip_shell;
|
||||
{
|
||||
read_cmdhist2(action, uparam, skip_search, skip_shell);
|
||||
(*action)(uparam, NULL, NULL); /* signal end of file */
|
||||
@ -1468,7 +1477,7 @@ addhist_init(void *uparam, struct mlist *ml, char *string)
|
||||
* Initialize history from a .lesshist file.
|
||||
*/
|
||||
public void
|
||||
init_cmdhist(void)
|
||||
init_cmdhist()
|
||||
{
|
||||
#if CMD_HISTORY
|
||||
read_cmdhist(&addhist_init, NULL, 0, 0);
|
||||
@ -1480,7 +1489,9 @@ init_cmdhist(void)
|
||||
*/
|
||||
#if CMD_HISTORY
|
||||
static void
|
||||
write_mlist_header(struct mlist *ml, FILE *f)
|
||||
write_mlist_header(ml, f)
|
||||
struct mlist *ml;
|
||||
FILE *f;
|
||||
{
|
||||
if (ml == &mlist_search)
|
||||
fprintf(f, "%s\n", HISTFILE_SEARCH_SECTION);
|
||||
@ -1494,7 +1505,9 @@ write_mlist_header(struct mlist *ml, FILE *f)
|
||||
* Write all modified entries in an mlist to the history file.
|
||||
*/
|
||||
static void
|
||||
write_mlist(struct mlist *ml, FILE *f)
|
||||
write_mlist(ml, f)
|
||||
struct mlist *ml;
|
||||
FILE *f;
|
||||
{
|
||||
for (ml = ml->next; ml->string != NULL; ml = ml->next)
|
||||
{
|
||||
@ -1510,7 +1523,8 @@ write_mlist(struct mlist *ml, FILE *f)
|
||||
* Make a temp name in the same directory as filename.
|
||||
*/
|
||||
static char *
|
||||
make_tempname(char *filename)
|
||||
make_tempname(filename)
|
||||
char *filename;
|
||||
{
|
||||
char lastch;
|
||||
char *tempname = ecalloc(1, strlen(filename)+1);
|
||||
@ -1573,7 +1587,8 @@ copy_hist(void *uparam, struct mlist *ml, char *string)
|
||||
* Make a file readable only by its owner.
|
||||
*/
|
||||
static void
|
||||
make_file_private(FILE *f)
|
||||
make_file_private(f)
|
||||
FILE *f;
|
||||
{
|
||||
#if HAVE_FCHMOD
|
||||
int do_chmod = 1;
|
||||
@ -1593,7 +1608,7 @@ make_file_private(FILE *f)
|
||||
* Does the history file need to be updated?
|
||||
*/
|
||||
static int
|
||||
histfile_modified(void)
|
||||
histfile_modified()
|
||||
{
|
||||
if (mlist_search.modified)
|
||||
return 1;
|
||||
@ -1608,7 +1623,7 @@ histfile_modified(void)
|
||||
* Update the .lesshst file.
|
||||
*/
|
||||
public void
|
||||
save_cmdhist(void)
|
||||
save_cmdhist()
|
||||
{
|
||||
#if CMD_HISTORY
|
||||
char *histname;
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* $FreeBSD$ */
|
||||
/*
|
||||
* Copyright (C) 1984-2015 Mark Nudelman
|
||||
* Copyright (C) 1984-2017 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.
|
||||
@ -44,10 +44,10 @@ extern char *curr_altfilename;
|
||||
extern char version[];
|
||||
extern struct scrpos initial_scrpos;
|
||||
extern IFILE curr_ifile;
|
||||
extern void constant *ml_search;
|
||||
extern void constant *ml_examine;
|
||||
extern void *ml_search;
|
||||
extern void *ml_examine;
|
||||
#if SHELL_ESCAPE || PIPEC
|
||||
extern void constant *ml_shell;
|
||||
extern void *ml_shell;
|
||||
#endif
|
||||
#if EDITOR
|
||||
extern char *editor;
|
||||
@ -84,7 +84,7 @@ struct ungot {
|
||||
};
|
||||
static struct ungot* ungot = NULL;
|
||||
|
||||
static void multi_search(char *pattern, int n, int silent);
|
||||
static void multi_search();
|
||||
|
||||
/*
|
||||
* Move the cursor to start of prompt line before executing a command.
|
||||
@ -92,7 +92,7 @@ static void multi_search(char *pattern, int n, int silent);
|
||||
* updating the screen.
|
||||
*/
|
||||
static void
|
||||
cmd_exec(void)
|
||||
cmd_exec()
|
||||
{
|
||||
#if HILITE_SEARCH
|
||||
clear_attn();
|
||||
@ -105,7 +105,11 @@ cmd_exec(void)
|
||||
* Set up the display to start a new multi-character command.
|
||||
*/
|
||||
static void
|
||||
start_mca(int action, constant char *prompt, constant void *mlist, int cmdflags)
|
||||
start_mca(action, prompt, mlist, cmdflags)
|
||||
int action;
|
||||
constant char *prompt;
|
||||
void *mlist;
|
||||
int cmdflags;
|
||||
{
|
||||
mca = action;
|
||||
clear_bot();
|
||||
@ -115,7 +119,7 @@ start_mca(int action, constant char *prompt, constant void *mlist, int cmdflags)
|
||||
}
|
||||
|
||||
public int
|
||||
in_mca(void)
|
||||
in_mca()
|
||||
{
|
||||
return (mca != 0 && mca != A_PREFIX);
|
||||
}
|
||||
@ -124,7 +128,7 @@ in_mca(void)
|
||||
* Set up the display to start a new search command.
|
||||
*/
|
||||
static void
|
||||
mca_search(void)
|
||||
mca_search()
|
||||
{
|
||||
#if HILITE_SEARCH
|
||||
if (search_type & SRCH_FILTER)
|
||||
@ -167,7 +171,7 @@ mca_search(void)
|
||||
* Set up the display to start a new toggle-option command.
|
||||
*/
|
||||
static void
|
||||
mca_opt_toggle(void)
|
||||
mca_opt_toggle()
|
||||
{
|
||||
int no_prompt;
|
||||
int flag;
|
||||
@ -202,7 +206,7 @@ mca_opt_toggle(void)
|
||||
* Execute a multicharacter command.
|
||||
*/
|
||||
static void
|
||||
exec_mca(void)
|
||||
exec_mca()
|
||||
{
|
||||
char *cbuf;
|
||||
|
||||
@ -292,7 +296,8 @@ exec_mca(void)
|
||||
* Is a character an erase or kill char?
|
||||
*/
|
||||
static int
|
||||
is_erase_char(int c)
|
||||
is_erase_char(c)
|
||||
int c;
|
||||
{
|
||||
return (c == erase_char || c == erase2_char || c == kill_char);
|
||||
}
|
||||
@ -301,7 +306,8 @@ is_erase_char(int c)
|
||||
* Handle the first char of an option (after the initial dash).
|
||||
*/
|
||||
static int
|
||||
mca_opt_first_char(int c)
|
||||
mca_opt_first_char(c)
|
||||
int c;
|
||||
{
|
||||
int flag = (optflag & ~OPT_NO_PROMPT);
|
||||
if (flag == OPT_NO_TOGGLE)
|
||||
@ -352,7 +358,8 @@ mca_opt_first_char(int c)
|
||||
* accepting chars until user hits RETURN.
|
||||
*/
|
||||
static int
|
||||
mca_opt_nonfirst_char(int c)
|
||||
mca_opt_nonfirst_char(c)
|
||||
int c;
|
||||
{
|
||||
char *p;
|
||||
char *oname;
|
||||
@ -401,7 +408,8 @@ mca_opt_nonfirst_char(int c)
|
||||
* Handle a char of an option toggle command.
|
||||
*/
|
||||
static int
|
||||
mca_opt_char(int c)
|
||||
mca_opt_char(c)
|
||||
int c;
|
||||
{
|
||||
PARG parg;
|
||||
|
||||
@ -466,7 +474,8 @@ mca_opt_char(int c)
|
||||
* Handle a char of a search command.
|
||||
*/
|
||||
static int
|
||||
mca_search_char(int c)
|
||||
mca_search_char(c)
|
||||
int c;
|
||||
{
|
||||
int flag = 0;
|
||||
|
||||
@ -522,7 +531,8 @@ mca_search_char(int c)
|
||||
* Handle a character of a multi-character command.
|
||||
*/
|
||||
static int
|
||||
mca_char(int c)
|
||||
mca_char(c)
|
||||
int c;
|
||||
{
|
||||
int ret;
|
||||
|
||||
@ -624,7 +634,7 @@ mca_char(int c)
|
||||
* Discard any buffered file data.
|
||||
*/
|
||||
static void
|
||||
clear_buffers(void)
|
||||
clear_buffers()
|
||||
{
|
||||
if (!(ch_getflags() & CH_CANSEEK))
|
||||
return;
|
||||
@ -639,7 +649,7 @@ clear_buffers(void)
|
||||
* Make sure the screen is displayed.
|
||||
*/
|
||||
static void
|
||||
make_display(void)
|
||||
make_display()
|
||||
{
|
||||
/*
|
||||
* If nothing is displayed yet, display starting from initial_scrpos.
|
||||
@ -679,7 +689,7 @@ make_display(void)
|
||||
* Display the appropriate prompt.
|
||||
*/
|
||||
static void
|
||||
prompt(void)
|
||||
prompt()
|
||||
{
|
||||
constant char *p;
|
||||
|
||||
@ -756,7 +766,7 @@ prompt(void)
|
||||
* Display the less version message.
|
||||
*/
|
||||
public void
|
||||
dispversion(void)
|
||||
dispversion()
|
||||
{
|
||||
PARG parg;
|
||||
|
||||
@ -771,7 +781,7 @@ dispversion(void)
|
||||
* (characters previously given to ungetcc or ungetsc).
|
||||
*/
|
||||
public int
|
||||
getcc(void)
|
||||
getcc()
|
||||
{
|
||||
if (ungot == NULL)
|
||||
{
|
||||
@ -826,7 +836,8 @@ getcc(void)
|
||||
* The next getcc() will return this character.
|
||||
*/
|
||||
public void
|
||||
ungetcc(int c)
|
||||
ungetcc(c)
|
||||
int c;
|
||||
{
|
||||
struct ungot *ug = (struct ungot *) ecalloc(1, sizeof(struct ungot));
|
||||
|
||||
@ -841,7 +852,8 @@ ungetcc(int c)
|
||||
* The next sequence of getcc()'s will return this string.
|
||||
*/
|
||||
public void
|
||||
ungetsc(char *s)
|
||||
ungetsc(s)
|
||||
char *s;
|
||||
{
|
||||
char *p;
|
||||
|
||||
@ -855,7 +867,10 @@ ungetsc(char *s)
|
||||
* If SRCH_PAST_EOF is set, continue the search thru multiple files.
|
||||
*/
|
||||
static void
|
||||
multi_search(char *pattern, int n, int silent)
|
||||
multi_search(pattern, n, silent)
|
||||
char *pattern;
|
||||
int n;
|
||||
int silent;
|
||||
{
|
||||
int nomore;
|
||||
IFILE save_ifile;
|
||||
@ -949,7 +964,8 @@ multi_search(char *pattern, int n, int silent)
|
||||
* Forward forever, or until a highlighted line appears.
|
||||
*/
|
||||
static int
|
||||
forw_loop(int until_hilite)
|
||||
forw_loop(until_hilite)
|
||||
int until_hilite;
|
||||
{
|
||||
POSITION curr_len;
|
||||
|
||||
@ -989,7 +1005,7 @@ forw_loop(int until_hilite)
|
||||
* Accept and execute commands until a quit command.
|
||||
*/
|
||||
public void
|
||||
commands(void)
|
||||
commands()
|
||||
{
|
||||
int c;
|
||||
int action;
|
||||
@ -1769,6 +1785,16 @@ commands(void)
|
||||
screen_trashed = 1;
|
||||
break;
|
||||
|
||||
case A_LLSHIFT:
|
||||
hshift = 0;
|
||||
screen_trashed = 1;
|
||||
break;
|
||||
|
||||
case A_RRSHIFT:
|
||||
hshift = rrshift();
|
||||
screen_trashed = 1;
|
||||
break;
|
||||
|
||||
case A_PREFIX:
|
||||
/*
|
||||
* The command is incomplete (more chars are needed).
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Generated by "./mkutable -f2 Mn Me -- unicode/UnicodeData.txt" on Mon Jul 14 16:21:21 PDT 2014 */
|
||||
/* Generated by "./mkutable -f2 Mn Me -- unicode/UnicodeData.txt" on Tue Sep 20 10:51:43 PDT 2016 */
|
||||
{ 0x0300, 0x036f }, /* Mn */
|
||||
{ 0x0483, 0x0487 }, /* Mn */
|
||||
{ 0x0488, 0x0489 }, /* Me */
|
||||
@ -23,7 +23,8 @@
|
||||
{ 0x0825, 0x0827 }, /* Mn */
|
||||
{ 0x0829, 0x082d }, /* Mn */
|
||||
{ 0x0859, 0x085b }, /* Mn */
|
||||
{ 0x08e4, 0x0902 }, /* Mn */
|
||||
{ 0x08d4, 0x08e1 }, /* Mn */
|
||||
{ 0x08e3, 0x0902 }, /* Mn */
|
||||
{ 0x093a, 0x093a }, /* Mn */
|
||||
{ 0x093c, 0x093c }, /* Mn */
|
||||
{ 0x0941, 0x0948 }, /* Mn */
|
||||
@ -117,6 +118,7 @@
|
||||
{ 0x17c9, 0x17d3 }, /* Mn */
|
||||
{ 0x17dd, 0x17dd }, /* Mn */
|
||||
{ 0x180b, 0x180d }, /* Mn */
|
||||
{ 0x1885, 0x1886 }, /* Mn */
|
||||
{ 0x18a9, 0x18a9 }, /* Mn */
|
||||
{ 0x1920, 0x1922 }, /* Mn */
|
||||
{ 0x1927, 0x1928 }, /* Mn */
|
||||
@ -156,7 +158,7 @@
|
||||
{ 0x1cf4, 0x1cf4 }, /* Mn */
|
||||
{ 0x1cf8, 0x1cf9 }, /* Mn */
|
||||
{ 0x1dc0, 0x1df5 }, /* Mn */
|
||||
{ 0x1dfc, 0x1dff }, /* Mn */
|
||||
{ 0x1dfb, 0x1dff }, /* Mn */
|
||||
{ 0x20d0, 0x20dc }, /* Mn */
|
||||
{ 0x20dd, 0x20e0 }, /* Me */
|
||||
{ 0x20e1, 0x20e1 }, /* Mn */
|
||||
@ -170,13 +172,13 @@
|
||||
{ 0xa66f, 0xa66f }, /* Mn */
|
||||
{ 0xa670, 0xa672 }, /* Me */
|
||||
{ 0xa674, 0xa67d }, /* Mn */
|
||||
{ 0xa69f, 0xa69f }, /* Mn */
|
||||
{ 0xa69e, 0xa69f }, /* Mn */
|
||||
{ 0xa6f0, 0xa6f1 }, /* Mn */
|
||||
{ 0xa802, 0xa802 }, /* Mn */
|
||||
{ 0xa806, 0xa806 }, /* Mn */
|
||||
{ 0xa80b, 0xa80b }, /* Mn */
|
||||
{ 0xa825, 0xa826 }, /* Mn */
|
||||
{ 0xa8c4, 0xa8c4 }, /* Mn */
|
||||
{ 0xa8c4, 0xa8c5 }, /* Mn */
|
||||
{ 0xa8e0, 0xa8f1 }, /* Mn */
|
||||
{ 0xa926, 0xa92d }, /* Mn */
|
||||
{ 0xa947, 0xa951 }, /* Mn */
|
||||
@ -203,7 +205,7 @@
|
||||
{ 0xabed, 0xabed }, /* Mn */
|
||||
{ 0xfb1e, 0xfb1e }, /* Mn */
|
||||
{ 0xfe00, 0xfe0f }, /* Mn */
|
||||
{ 0xfe20, 0xfe2d }, /* Mn */
|
||||
{ 0xfe20, 0xfe2f }, /* Mn */
|
||||
{ 0x101fd, 0x101fd }, /* Mn */
|
||||
{ 0x102e0, 0x102e0 }, /* Mn */
|
||||
{ 0x10376, 0x1037a }, /* Mn */
|
||||
@ -224,16 +226,21 @@
|
||||
{ 0x11173, 0x11173 }, /* Mn */
|
||||
{ 0x11180, 0x11181 }, /* Mn */
|
||||
{ 0x111b6, 0x111be }, /* Mn */
|
||||
{ 0x111ca, 0x111cc }, /* Mn */
|
||||
{ 0x1122f, 0x11231 }, /* Mn */
|
||||
{ 0x11234, 0x11234 }, /* Mn */
|
||||
{ 0x11236, 0x11237 }, /* Mn */
|
||||
{ 0x1123e, 0x1123e }, /* Mn */
|
||||
{ 0x112df, 0x112df }, /* Mn */
|
||||
{ 0x112e3, 0x112ea }, /* Mn */
|
||||
{ 0x11301, 0x11301 }, /* Mn */
|
||||
{ 0x11300, 0x11301 }, /* Mn */
|
||||
{ 0x1133c, 0x1133c }, /* Mn */
|
||||
{ 0x11340, 0x11340 }, /* Mn */
|
||||
{ 0x11366, 0x1136c }, /* Mn */
|
||||
{ 0x11370, 0x11374 }, /* Mn */
|
||||
{ 0x11438, 0x1143f }, /* Mn */
|
||||
{ 0x11442, 0x11444 }, /* Mn */
|
||||
{ 0x11446, 0x11446 }, /* Mn */
|
||||
{ 0x114b3, 0x114b8 }, /* Mn */
|
||||
{ 0x114ba, 0x114ba }, /* Mn */
|
||||
{ 0x114bf, 0x114c0 }, /* Mn */
|
||||
@ -241,6 +248,7 @@
|
||||
{ 0x115b2, 0x115b5 }, /* Mn */
|
||||
{ 0x115bc, 0x115bd }, /* Mn */
|
||||
{ 0x115bf, 0x115c0 }, /* Mn */
|
||||
{ 0x115dc, 0x115dd }, /* Mn */
|
||||
{ 0x11633, 0x1163a }, /* Mn */
|
||||
{ 0x1163d, 0x1163d }, /* Mn */
|
||||
{ 0x1163f, 0x11640 }, /* Mn */
|
||||
@ -248,6 +256,16 @@
|
||||
{ 0x116ad, 0x116ad }, /* Mn */
|
||||
{ 0x116b0, 0x116b5 }, /* Mn */
|
||||
{ 0x116b7, 0x116b7 }, /* Mn */
|
||||
{ 0x1171d, 0x1171f }, /* Mn */
|
||||
{ 0x11722, 0x11725 }, /* Mn */
|
||||
{ 0x11727, 0x1172b }, /* Mn */
|
||||
{ 0x11c30, 0x11c36 }, /* Mn */
|
||||
{ 0x11c38, 0x11c3d }, /* Mn */
|
||||
{ 0x11c3f, 0x11c3f }, /* Mn */
|
||||
{ 0x11c92, 0x11ca7 }, /* Mn */
|
||||
{ 0x11caa, 0x11cb0 }, /* Mn */
|
||||
{ 0x11cb2, 0x11cb3 }, /* Mn */
|
||||
{ 0x11cb5, 0x11cb6 }, /* Mn */
|
||||
{ 0x16af0, 0x16af4 }, /* Mn */
|
||||
{ 0x16b30, 0x16b36 }, /* Mn */
|
||||
{ 0x16f8f, 0x16f92 }, /* Mn */
|
||||
@ -257,5 +275,17 @@
|
||||
{ 0x1d185, 0x1d18b }, /* Mn */
|
||||
{ 0x1d1aa, 0x1d1ad }, /* Mn */
|
||||
{ 0x1d242, 0x1d244 }, /* Mn */
|
||||
{ 0x1da00, 0x1da36 }, /* Mn */
|
||||
{ 0x1da3b, 0x1da6c }, /* Mn */
|
||||
{ 0x1da75, 0x1da75 }, /* Mn */
|
||||
{ 0x1da84, 0x1da84 }, /* Mn */
|
||||
{ 0x1da9b, 0x1da9f }, /* Mn */
|
||||
{ 0x1daa1, 0x1daaf }, /* Mn */
|
||||
{ 0x1e000, 0x1e006 }, /* Mn */
|
||||
{ 0x1e008, 0x1e018 }, /* Mn */
|
||||
{ 0x1e01b, 0x1e021 }, /* Mn */
|
||||
{ 0x1e023, 0x1e024 }, /* Mn */
|
||||
{ 0x1e026, 0x1e02a }, /* Mn */
|
||||
{ 0x1e8d0, 0x1e8d6 }, /* Mn */
|
||||
{ 0x1e944, 0x1e94a }, /* Mn */
|
||||
{ 0xe0100, 0xe01ef }, /* Mn */
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 1984-2015 Mark Nudelman
|
||||
* Copyright (C) 1984-2017 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.
|
||||
@ -20,7 +20,9 @@ extern int utf_mode;
|
||||
* Get the length of a buffer needed to convert a string.
|
||||
*/
|
||||
public int
|
||||
cvt_length(int len, int ops)
|
||||
cvt_length(len, ops)
|
||||
int len;
|
||||
int ops;
|
||||
{
|
||||
if (utf_mode)
|
||||
/*
|
||||
@ -36,7 +38,8 @@ cvt_length(int len, int ops)
|
||||
* Allocate a chpos array for use by cvt_text.
|
||||
*/
|
||||
public int *
|
||||
cvt_alloc_chpos(int len)
|
||||
cvt_alloc_chpos(len)
|
||||
int len;
|
||||
{
|
||||
int i;
|
||||
int *chpos = (int *) ecalloc(sizeof(int), len);
|
||||
@ -52,7 +55,12 @@ cvt_alloc_chpos(int len)
|
||||
* odst character (when it was in osrc) is returned in the chpos array.
|
||||
*/
|
||||
public void
|
||||
cvt_text(char *odst, char *osrc, int *chpos, int *lenp, int ops)
|
||||
cvt_text(odst, osrc, chpos, lenp, ops)
|
||||
char *odst;
|
||||
char *osrc;
|
||||
int *chpos;
|
||||
int *lenp;
|
||||
int ops;
|
||||
{
|
||||
char *dst;
|
||||
char *edst = odst;
|
||||
@ -69,7 +77,7 @@ cvt_text(char *odst, char *osrc, int *chpos, int *lenp, int ops)
|
||||
{
|
||||
int src_pos = (int) (src - osrc);
|
||||
int dst_pos = (int) (dst - odst);
|
||||
ch = step_char((constant char **)&src, +1, src_end);
|
||||
ch = step_char(&src, +1, src_end);
|
||||
if ((ops & CVT_BS) && ch == '\b' && dst > odst)
|
||||
{
|
||||
/* Delete backspace and preceding char. */
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 1984-2015 Mark Nudelman
|
||||
* Copyright (C) 1984-2017 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.
|
||||
@ -94,8 +94,12 @@ static unsigned char cmdtable[] =
|
||||
ESC,']',0, A_RSHIFT,
|
||||
ESC,'(',0, A_LSHIFT,
|
||||
ESC,')',0, A_RSHIFT,
|
||||
ESC,'{',0, A_LLSHIFT,
|
||||
ESC,'}',0, A_RRSHIFT,
|
||||
SK(SK_RIGHT_ARROW),0, A_RSHIFT,
|
||||
SK(SK_LEFT_ARROW),0, A_LSHIFT,
|
||||
SK(SK_CTL_RIGHT_ARROW),0, A_RRSHIFT,
|
||||
SK(SK_CTL_LEFT_ARROW),0, A_LLSHIFT,
|
||||
'{',0, A_F_BRACKET|A_EXTRA, '{','}',0,
|
||||
'}',0, A_B_BRACKET|A_EXTRA, '{','}',0,
|
||||
'(',0, A_F_BRACKET|A_EXTRA, '(',')',0,
|
||||
@ -229,7 +233,9 @@ static struct tablelist *list_sysvar_tables = NULL;
|
||||
* Expand special key abbreviations in a command table.
|
||||
*/
|
||||
static void
|
||||
expand_special_keys(char *table, int len)
|
||||
expand_special_keys(table, len)
|
||||
char *table;
|
||||
int len;
|
||||
{
|
||||
char *fm;
|
||||
char *to;
|
||||
@ -288,7 +294,7 @@ expand_special_keys(char *table, int len)
|
||||
* Initialize the command lists.
|
||||
*/
|
||||
public void
|
||||
init_cmds(void)
|
||||
init_cmds()
|
||||
{
|
||||
/*
|
||||
* Add the default command tables.
|
||||
@ -318,7 +324,10 @@ init_cmds(void)
|
||||
* Add a command table.
|
||||
*/
|
||||
static int
|
||||
add_cmd_table(struct tablelist **tlist, char *buf, int len)
|
||||
add_cmd_table(tlist, buf, len)
|
||||
struct tablelist **tlist;
|
||||
char *buf;
|
||||
int len;
|
||||
{
|
||||
struct tablelist *t;
|
||||
|
||||
@ -345,7 +354,9 @@ add_cmd_table(struct tablelist **tlist, char *buf, int len)
|
||||
* Add a command table.
|
||||
*/
|
||||
public void
|
||||
add_fcmd_table(char *buf, int len)
|
||||
add_fcmd_table(buf, len)
|
||||
char *buf;
|
||||
int len;
|
||||
{
|
||||
if (add_cmd_table(&list_fcmd_tables, buf, len) < 0)
|
||||
error("Warning: some commands disabled", NULL_PARG);
|
||||
@ -355,7 +366,9 @@ add_fcmd_table(char *buf, int len)
|
||||
* Add an editing command table.
|
||||
*/
|
||||
public void
|
||||
add_ecmd_table(char *buf, int len)
|
||||
add_ecmd_table(buf, len)
|
||||
char *buf;
|
||||
int len;
|
||||
{
|
||||
if (add_cmd_table(&list_ecmd_tables, buf, len) < 0)
|
||||
error("Warning: some edit commands disabled", NULL_PARG);
|
||||
@ -365,7 +378,10 @@ add_ecmd_table(char *buf, int len)
|
||||
* Add an environment variable table.
|
||||
*/
|
||||
static void
|
||||
add_var_table(struct tablelist **tlist, char *buf, int len)
|
||||
add_var_table(tlist, buf, len)
|
||||
struct tablelist **tlist;
|
||||
char *buf;
|
||||
int len;
|
||||
{
|
||||
if (add_cmd_table(tlist, buf, len) < 0)
|
||||
error("Warning: environment variables from lesskey file unavailable", NULL_PARG);
|
||||
@ -375,7 +391,11 @@ add_var_table(struct tablelist **tlist, char *buf, int len)
|
||||
* Search a single command table for the command string in cmd.
|
||||
*/
|
||||
static int
|
||||
cmd_search(char *cmd, char *table, char *endtable, char **sp)
|
||||
cmd_search(cmd, table, endtable, sp)
|
||||
char *cmd;
|
||||
char *table;
|
||||
char *endtable;
|
||||
char **sp;
|
||||
{
|
||||
char *p;
|
||||
char *q;
|
||||
@ -463,7 +483,10 @@ cmd_search(char *cmd, char *table, char *endtable, char **sp)
|
||||
* The "extra" string, if any, is returned in sp.
|
||||
*/
|
||||
static int
|
||||
cmd_decode(struct tablelist *tlist, char *cmd, char **sp)
|
||||
cmd_decode(tlist, cmd, sp)
|
||||
struct tablelist *tlist;
|
||||
char *cmd;
|
||||
char **sp;
|
||||
{
|
||||
struct tablelist *t;
|
||||
int action = A_INVALID;
|
||||
@ -487,7 +510,9 @@ cmd_decode(struct tablelist *tlist, char *cmd, char **sp)
|
||||
* Decode a command from the cmdtables list.
|
||||
*/
|
||||
public int
|
||||
fcmd_decode(char *cmd, char **sp)
|
||||
fcmd_decode(cmd, sp)
|
||||
char *cmd;
|
||||
char **sp;
|
||||
{
|
||||
return (cmd_decode(list_fcmd_tables, cmd, sp));
|
||||
}
|
||||
@ -496,7 +521,9 @@ fcmd_decode(char *cmd, char **sp)
|
||||
* Decode a command from the edittables list.
|
||||
*/
|
||||
public int
|
||||
ecmd_decode(char *cmd, char **sp)
|
||||
ecmd_decode(cmd, sp)
|
||||
char *cmd;
|
||||
char **sp;
|
||||
{
|
||||
return (cmd_decode(list_ecmd_tables, cmd, sp));
|
||||
}
|
||||
@ -506,7 +533,8 @@ ecmd_decode(char *cmd, char **sp)
|
||||
* Looks first in the lesskey file, then in the real environment.
|
||||
*/
|
||||
public char *
|
||||
lgetenv(char *var)
|
||||
lgetenv(var)
|
||||
char *var;
|
||||
{
|
||||
int a;
|
||||
char *s;
|
||||
@ -530,7 +558,8 @@ lgetenv(char *var)
|
||||
* two bytes, low order first, in radix KRADIX.
|
||||
*/
|
||||
static int
|
||||
gint(char **sp)
|
||||
gint(sp)
|
||||
char **sp;
|
||||
{
|
||||
int n;
|
||||
|
||||
@ -543,7 +572,9 @@ gint(char **sp)
|
||||
* Process an old (pre-v241) lesskey file.
|
||||
*/
|
||||
static int
|
||||
old_lesskey(char *buf, int len)
|
||||
old_lesskey(buf, len)
|
||||
char *buf;
|
||||
int len;
|
||||
{
|
||||
/*
|
||||
* Old-style lesskey file.
|
||||
@ -562,7 +593,10 @@ old_lesskey(char *buf, int len)
|
||||
* Process a new (post-v241) lesskey file.
|
||||
*/
|
||||
static int
|
||||
new_lesskey(char *buf, int len, int sysvar)
|
||||
new_lesskey(buf, len, sysvar)
|
||||
char *buf;
|
||||
int len;
|
||||
int sysvar;
|
||||
{
|
||||
char *p;
|
||||
int c;
|
||||
@ -613,7 +647,9 @@ new_lesskey(char *buf, int len, int sysvar)
|
||||
* Set up a user command table, based on a "lesskey" file.
|
||||
*/
|
||||
public int
|
||||
lesskey(char *filename, int sysvar)
|
||||
lesskey(filename, sysvar)
|
||||
char *filename;
|
||||
int sysvar;
|
||||
{
|
||||
char *buf;
|
||||
POSITION len;
|
||||
@ -681,7 +717,10 @@ lesskey(char *filename, int sysvar)
|
||||
* Add the standard lesskey file "$HOME/.less"
|
||||
*/
|
||||
public void
|
||||
add_hometable(char *envname, char *def_filename, int sysvar)
|
||||
add_hometable(envname, def_filename, sysvar)
|
||||
char *envname;
|
||||
char *def_filename;
|
||||
int sysvar;
|
||||
{
|
||||
char *filename;
|
||||
PARG parg;
|
||||
@ -707,7 +746,9 @@ add_hometable(char *envname, char *def_filename, int sysvar)
|
||||
* See if a char is a special line-editing command.
|
||||
*/
|
||||
public int
|
||||
editchar(int c, int flags)
|
||||
editchar(c, flags)
|
||||
int c;
|
||||
int flags;
|
||||
{
|
||||
int action;
|
||||
int nch;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 1984-2015 Mark Nudelman
|
||||
* Copyright (C) 1984-2017 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.
|
||||
@ -26,7 +26,7 @@ extern int sigs;
|
||||
extern IFILE curr_ifile;
|
||||
extern IFILE old_ifile;
|
||||
extern struct scrpos initial_scrpos;
|
||||
extern void * constant ml_examine;
|
||||
extern void *ml_examine;
|
||||
#if SPACES_IN_FILENAMES
|
||||
extern char openquote;
|
||||
extern char closequote;
|
||||
@ -55,7 +55,9 @@ static void *curr_altpipe;
|
||||
* back_textlist does the same, but runs thru the list backwards.
|
||||
*/
|
||||
public void
|
||||
init_textlist(struct textlist *tlist, char *str)
|
||||
init_textlist(tlist, str)
|
||||
struct textlist *tlist;
|
||||
char *str;
|
||||
{
|
||||
char *s;
|
||||
#if SPACES_IN_FILENAMES
|
||||
@ -97,7 +99,9 @@ init_textlist(struct textlist *tlist, char *str)
|
||||
}
|
||||
|
||||
public char *
|
||||
forw_textlist(struct textlist *tlist, char *prev)
|
||||
forw_textlist(tlist, prev)
|
||||
struct textlist *tlist;
|
||||
char *prev;
|
||||
{
|
||||
char *s;
|
||||
|
||||
@ -119,7 +123,9 @@ forw_textlist(struct textlist *tlist, char *prev)
|
||||
}
|
||||
|
||||
public char *
|
||||
back_textlist(struct textlist *tlist, char *prev)
|
||||
back_textlist(tlist, prev)
|
||||
struct textlist *tlist;
|
||||
char *prev;
|
||||
{
|
||||
char *s;
|
||||
|
||||
@ -146,7 +152,7 @@ back_textlist(struct textlist *tlist, char *prev)
|
||||
* Close the current input file.
|
||||
*/
|
||||
static void
|
||||
close_file(void)
|
||||
close_file()
|
||||
{
|
||||
struct scrpos scrpos;
|
||||
|
||||
@ -190,7 +196,8 @@ close_file(void)
|
||||
* Filename == NULL means just close the current file.
|
||||
*/
|
||||
public int
|
||||
edit(char *filename)
|
||||
edit(filename)
|
||||
char *filename;
|
||||
{
|
||||
if (filename == NULL)
|
||||
return (edit_ifile(NULL_IFILE));
|
||||
@ -202,7 +209,8 @@ edit(char *filename)
|
||||
* ifile == NULL means just close the current file.
|
||||
*/
|
||||
public int
|
||||
edit_ifile(IFILE ifile)
|
||||
edit_ifile(ifile)
|
||||
IFILE ifile;
|
||||
{
|
||||
int f;
|
||||
int answer;
|
||||
@ -452,7 +460,8 @@ edit_ifile(IFILE ifile)
|
||||
* Then edit the first one.
|
||||
*/
|
||||
public int
|
||||
edit_list(char *filelist)
|
||||
edit_list(filelist)
|
||||
char *filelist;
|
||||
{
|
||||
IFILE save_ifile;
|
||||
char *good_filename;
|
||||
@ -509,7 +518,7 @@ edit_list(char *filelist)
|
||||
* Edit the first file in the command line (ifile) list.
|
||||
*/
|
||||
public int
|
||||
edit_first(void)
|
||||
edit_first()
|
||||
{
|
||||
curr_ifile = NULL_IFILE;
|
||||
return (edit_next(1));
|
||||
@ -519,7 +528,7 @@ edit_first(void)
|
||||
* Edit the last file in the command line (ifile) list.
|
||||
*/
|
||||
public int
|
||||
edit_last(void)
|
||||
edit_last()
|
||||
{
|
||||
curr_ifile = NULL_IFILE;
|
||||
return (edit_prev(1));
|
||||
@ -530,7 +539,10 @@ edit_last(void)
|
||||
* Edit the n-th next or previous file in the command line (ifile) list.
|
||||
*/
|
||||
static int
|
||||
edit_istep(IFILE h, int n, int dir)
|
||||
edit_istep(h, n, dir)
|
||||
IFILE h;
|
||||
int n;
|
||||
int dir;
|
||||
{
|
||||
IFILE next;
|
||||
|
||||
@ -569,25 +581,31 @@ edit_istep(IFILE h, int n, int dir)
|
||||
}
|
||||
|
||||
static int
|
||||
edit_inext(IFILE h, int n)
|
||||
edit_inext(h, n)
|
||||
IFILE h;
|
||||
int n;
|
||||
{
|
||||
return (edit_istep(h, n, +1));
|
||||
}
|
||||
|
||||
public int
|
||||
edit_next(int n)
|
||||
edit_next(n)
|
||||
int n;
|
||||
{
|
||||
return edit_istep(curr_ifile, n, +1);
|
||||
}
|
||||
|
||||
static int
|
||||
edit_iprev(IFILE h, int n)
|
||||
edit_iprev(h, n)
|
||||
IFILE h;
|
||||
int n;
|
||||
{
|
||||
return (edit_istep(h, n, -1));
|
||||
}
|
||||
|
||||
public int
|
||||
edit_prev(int n)
|
||||
edit_prev(n)
|
||||
int n;
|
||||
{
|
||||
return edit_istep(curr_ifile, n, -1);
|
||||
}
|
||||
@ -596,7 +614,8 @@ edit_prev(int n)
|
||||
* Edit a specific file in the command line (ifile) list.
|
||||
*/
|
||||
public int
|
||||
edit_index(int n)
|
||||
edit_index(n)
|
||||
int n;
|
||||
{
|
||||
IFILE h;
|
||||
|
||||
@ -616,7 +635,7 @@ edit_index(int n)
|
||||
}
|
||||
|
||||
public IFILE
|
||||
save_curr_ifile(void)
|
||||
save_curr_ifile()
|
||||
{
|
||||
if (curr_ifile != NULL_IFILE)
|
||||
hold_ifile(curr_ifile, 1);
|
||||
@ -624,7 +643,8 @@ save_curr_ifile(void)
|
||||
}
|
||||
|
||||
public void
|
||||
unsave_ifile(IFILE save_ifile)
|
||||
unsave_ifile(save_ifile)
|
||||
IFILE save_ifile;
|
||||
{
|
||||
if (save_ifile != NULL_IFILE)
|
||||
hold_ifile(save_ifile, -1);
|
||||
@ -634,7 +654,8 @@ unsave_ifile(IFILE save_ifile)
|
||||
* Reedit the ifile which was previously open.
|
||||
*/
|
||||
public void
|
||||
reedit_ifile(IFILE save_ifile)
|
||||
reedit_ifile(save_ifile)
|
||||
IFILE save_ifile;
|
||||
{
|
||||
IFILE next;
|
||||
IFILE prev;
|
||||
@ -667,7 +688,7 @@ reedit_ifile(IFILE save_ifile)
|
||||
}
|
||||
|
||||
public void
|
||||
reopen_curr_ifile(void)
|
||||
reopen_curr_ifile()
|
||||
{
|
||||
IFILE save_ifile = save_curr_ifile();
|
||||
close_file();
|
||||
@ -678,7 +699,7 @@ reopen_curr_ifile(void)
|
||||
* Edit standard input.
|
||||
*/
|
||||
public int
|
||||
edit_stdin(void)
|
||||
edit_stdin()
|
||||
{
|
||||
if (isatty(fd0))
|
||||
{
|
||||
@ -693,7 +714,7 @@ edit_stdin(void)
|
||||
* Used if standard output is not a tty.
|
||||
*/
|
||||
public void
|
||||
cat_file(void)
|
||||
cat_file()
|
||||
{
|
||||
int c;
|
||||
|
||||
@ -710,7 +731,8 @@ cat_file(void)
|
||||
* We take care not to blindly overwrite an existing file.
|
||||
*/
|
||||
public void
|
||||
use_logfile(char *filename)
|
||||
use_logfile(filename)
|
||||
char *filename;
|
||||
{
|
||||
int exists;
|
||||
int answer;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 1984-2015 Mark Nudelman
|
||||
* Copyright (C) 1984-2017 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.
|
||||
@ -63,7 +63,8 @@ extern char closequote;
|
||||
* Remove quotes around a filename.
|
||||
*/
|
||||
public char *
|
||||
shell_unquote(char *str)
|
||||
shell_unquote(str)
|
||||
char *str;
|
||||
{
|
||||
char *name;
|
||||
char *p;
|
||||
@ -101,7 +102,7 @@ shell_unquote(char *str)
|
||||
* Get the shell's escape character.
|
||||
*/
|
||||
public char *
|
||||
get_meta_escape(void)
|
||||
get_meta_escape()
|
||||
{
|
||||
char *s;
|
||||
|
||||
@ -115,7 +116,7 @@ get_meta_escape(void)
|
||||
* Get the characters which the shell considers to be "metacharacters".
|
||||
*/
|
||||
static char *
|
||||
metachars(void)
|
||||
metachars()
|
||||
{
|
||||
static char *mchars = NULL;
|
||||
|
||||
@ -132,7 +133,8 @@ metachars(void)
|
||||
* Is this a shell metacharacter?
|
||||
*/
|
||||
static int
|
||||
metachar(char c)
|
||||
metachar(c)
|
||||
char c;
|
||||
{
|
||||
return (strchr(metachars(), c) != NULL);
|
||||
}
|
||||
@ -141,7 +143,8 @@ metachar(char c)
|
||||
* Insert a backslash before each metacharacter in a string.
|
||||
*/
|
||||
public char *
|
||||
shell_quote(char *s)
|
||||
shell_quote(s)
|
||||
char *s;
|
||||
{
|
||||
char *p;
|
||||
char *newstr;
|
||||
@ -218,7 +221,9 @@ shell_quote(char *s)
|
||||
* Return NULL if the file does not exist in the directory.
|
||||
*/
|
||||
static char *
|
||||
dirfile(char *dirname, char *filename)
|
||||
dirfile(dirname, filename)
|
||||
char *dirname;
|
||||
char *filename;
|
||||
{
|
||||
char *pathname;
|
||||
char *qpathname;
|
||||
@ -256,7 +261,8 @@ dirfile(char *dirname, char *filename)
|
||||
* Return the full pathname of the given file in the "home directory".
|
||||
*/
|
||||
public char *
|
||||
homefile(char *filename)
|
||||
homefile(filename)
|
||||
char *filename;
|
||||
{
|
||||
char *pathname;
|
||||
|
||||
@ -305,7 +311,8 @@ homefile(char *filename)
|
||||
* {{ This is a lot of work just to support % and #. }}
|
||||
*/
|
||||
public char *
|
||||
fexpand(char *s)
|
||||
fexpand(s)
|
||||
char *s;
|
||||
{
|
||||
char *fr, *to;
|
||||
int n;
|
||||
@ -400,7 +407,8 @@ fexpand(char *s)
|
||||
* the given string.
|
||||
*/
|
||||
public char *
|
||||
fcomplete(char *s)
|
||||
fcomplete(s)
|
||||
char *s;
|
||||
{
|
||||
char *fpat;
|
||||
char *qs;
|
||||
@ -459,12 +467,13 @@ fcomplete(char *s)
|
||||
* This is just a guess, and we need not try too hard to make it accurate.
|
||||
*/
|
||||
public int
|
||||
bin_file(int f)
|
||||
bin_file(f)
|
||||
int f;
|
||||
{
|
||||
int n;
|
||||
int bin_count = 0;
|
||||
char data[256];
|
||||
constant char* p;
|
||||
char* p;
|
||||
char* pend;
|
||||
|
||||
if (!seekable(f))
|
||||
@ -503,7 +512,8 @@ bin_file(int f)
|
||||
* Try to determine the size of a file by seeking to the end.
|
||||
*/
|
||||
static POSITION
|
||||
seek_filesize(int f)
|
||||
seek_filesize(f)
|
||||
int f;
|
||||
{
|
||||
off_t spos;
|
||||
|
||||
@ -518,7 +528,8 @@ seek_filesize(int f)
|
||||
* Return a pointer to the string in memory.
|
||||
*/
|
||||
static char *
|
||||
readfd(FILE *fd)
|
||||
readfd(fd)
|
||||
FILE *fd;
|
||||
{
|
||||
int len;
|
||||
int ch;
|
||||
@ -566,7 +577,8 @@ FILE *popen();
|
||||
* Return a pointer to a pipe connected to the shell command's standard output.
|
||||
*/
|
||||
static FILE *
|
||||
shellcmd(char *cmd)
|
||||
shellcmd(cmd)
|
||||
char *cmd;
|
||||
{
|
||||
FILE *fd;
|
||||
|
||||
@ -616,7 +628,8 @@ shellcmd(char *cmd)
|
||||
* Expand a filename, doing any system-specific metacharacter substitutions.
|
||||
*/
|
||||
public char *
|
||||
lglob(char *filename)
|
||||
lglob(filename)
|
||||
char *filename;
|
||||
{
|
||||
char *gfilename;
|
||||
char *ofilename;
|
||||
@ -805,7 +818,8 @@ lglob(char *filename)
|
||||
* Return a large number if there are any other % escapes besides %s.
|
||||
*/
|
||||
static int
|
||||
num_pct_s(char *lessopen)
|
||||
num_pct_s(lessopen)
|
||||
char *lessopen;
|
||||
{
|
||||
int num = 0;
|
||||
|
||||
@ -830,7 +844,10 @@ num_pct_s(char *lessopen)
|
||||
* instead of the file we're about to open.
|
||||
*/
|
||||
public char *
|
||||
open_altfile(char *filename, int *pf, void **pfd)
|
||||
open_altfile(filename, pf, pfd)
|
||||
char *filename;
|
||||
int *pf;
|
||||
void **pfd;
|
||||
{
|
||||
#if !HAVE_POPEN
|
||||
return (NULL);
|
||||
@ -939,7 +956,10 @@ open_altfile(char *filename, int *pf, void **pfd)
|
||||
* Close a replacement file.
|
||||
*/
|
||||
public void
|
||||
close_altfile(char *altfilename, char *filename, void *pipefd)
|
||||
close_altfile(altfilename, filename, pipefd)
|
||||
char *altfilename;
|
||||
char *filename;
|
||||
void *pipefd;
|
||||
{
|
||||
#if HAVE_POPEN
|
||||
char *lessclose;
|
||||
@ -981,7 +1001,8 @@ close_altfile(char *altfilename, char *filename, void *pipefd)
|
||||
* Is the specified file a directory?
|
||||
*/
|
||||
public int
|
||||
is_dir(char *filename)
|
||||
is_dir(filename)
|
||||
char *filename;
|
||||
{
|
||||
int isdir = 0;
|
||||
|
||||
@ -1016,7 +1037,8 @@ is_dir(char *filename)
|
||||
* (if it cannot be opened or is a directory, etc.)
|
||||
*/
|
||||
public char *
|
||||
bad_file(char *filename)
|
||||
bad_file(filename)
|
||||
char *filename;
|
||||
{
|
||||
char *m = NULL;
|
||||
|
||||
@ -1061,7 +1083,8 @@ bad_file(char *filename)
|
||||
* In Unix, we can stat the file.
|
||||
*/
|
||||
public POSITION
|
||||
filesize(int f)
|
||||
filesize(f)
|
||||
int f;
|
||||
{
|
||||
#if HAVE_STAT
|
||||
struct stat statbuf;
|
||||
@ -1083,7 +1106,7 @@ filesize(int f)
|
||||
*
|
||||
*/
|
||||
public char *
|
||||
shell_coption(void)
|
||||
shell_coption()
|
||||
{
|
||||
return ("-c");
|
||||
}
|
||||
@ -1092,7 +1115,8 @@ shell_coption(void)
|
||||
* Return last component of a pathname.
|
||||
*/
|
||||
public char *
|
||||
last_component(char *name)
|
||||
last_component(name)
|
||||
char *name;
|
||||
{
|
||||
char *slash;
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* $FreeBSD$ */
|
||||
/*
|
||||
* Copyright (C) 1984-2015 Mark Nudelman
|
||||
* Copyright (C) 1984-2017 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.
|
||||
@ -48,7 +48,7 @@ extern char *tagoption;
|
||||
* Sound the bell to indicate user is trying to move past end of file.
|
||||
*/
|
||||
static void
|
||||
eof_bell(void)
|
||||
eof_bell()
|
||||
{
|
||||
if (quiet == NOT_QUIET)
|
||||
bell();
|
||||
@ -60,7 +60,7 @@ eof_bell(void)
|
||||
* Check to see if the end of file is currently displayed.
|
||||
*/
|
||||
public int
|
||||
eof_displayed(void)
|
||||
eof_displayed()
|
||||
{
|
||||
POSITION pos;
|
||||
|
||||
@ -87,7 +87,7 @@ eof_displayed(void)
|
||||
* Check to see if the entire file is currently displayed.
|
||||
*/
|
||||
public int
|
||||
entire_file_displayed(void)
|
||||
entire_file_displayed()
|
||||
{
|
||||
POSITION pos;
|
||||
|
||||
@ -107,7 +107,7 @@ entire_file_displayed(void)
|
||||
* for the first time.
|
||||
*/
|
||||
public void
|
||||
squish_check(void)
|
||||
squish_check()
|
||||
{
|
||||
if (!squished)
|
||||
return;
|
||||
@ -125,7 +125,12 @@ squish_check(void)
|
||||
* The first real line after the blanks will start at ch_zero().
|
||||
*/
|
||||
public void
|
||||
forw(int n, POSITION pos, int force, int only_last, int nblank)
|
||||
forw(n, pos, force, only_last, nblank)
|
||||
int n;
|
||||
POSITION pos;
|
||||
int force;
|
||||
int only_last;
|
||||
int nblank;
|
||||
{
|
||||
int nlines = 0;
|
||||
int do_repaint;
|
||||
@ -297,7 +302,11 @@ forw(int n, POSITION pos, int force, int only_last, int nblank)
|
||||
* Display n lines, scrolling backward.
|
||||
*/
|
||||
public void
|
||||
back(int n, POSITION pos, int force, int only_last)
|
||||
back(n, pos, force, only_last)
|
||||
int n;
|
||||
POSITION pos;
|
||||
int force;
|
||||
int only_last;
|
||||
{
|
||||
int nlines = 0;
|
||||
int do_repaint;
|
||||
@ -355,7 +364,10 @@ back(int n, POSITION pos, int force, int only_last)
|
||||
* Start just after the line currently displayed at the bottom of the screen.
|
||||
*/
|
||||
public void
|
||||
forward(int n, int force, int only_last)
|
||||
forward(n, force, only_last)
|
||||
int n;
|
||||
int force;
|
||||
int only_last;
|
||||
{
|
||||
POSITION pos;
|
||||
|
||||
@ -404,7 +416,10 @@ forward(int n, int force, int only_last)
|
||||
* Start just before the line currently displayed at the top of the screen.
|
||||
*/
|
||||
public void
|
||||
backward(int n, int force, int only_last)
|
||||
backward(n, force, only_last)
|
||||
int n;
|
||||
int force;
|
||||
int only_last;
|
||||
{
|
||||
POSITION pos;
|
||||
|
||||
@ -424,7 +439,7 @@ backward(int n, int force, int only_last)
|
||||
* top_scroll, as well as back_scroll.
|
||||
*/
|
||||
public int
|
||||
get_back_scroll(void)
|
||||
get_back_scroll()
|
||||
{
|
||||
if (no_back_scroll)
|
||||
return (0);
|
||||
@ -434,3 +449,21 @@ get_back_scroll(void)
|
||||
return (sc_height - 2);
|
||||
return (10000); /* infinity */
|
||||
}
|
||||
|
||||
/*
|
||||
* Get line count of file up to the screen height + 1 char
|
||||
*/
|
||||
public int
|
||||
get_line_count()
|
||||
{
|
||||
int nlines;
|
||||
POSITION pos;
|
||||
|
||||
pos = ch_zero();
|
||||
for (nlines = 0; nlines <= sc_height; nlines++)
|
||||
{
|
||||
pos = forw_line(pos);
|
||||
if (pos == NULL_POSITION) break;
|
||||
}
|
||||
return nlines;
|
||||
}
|
||||
|
@ -1,302 +1,300 @@
|
||||
public char * save (constant char *s);
|
||||
public VOID_POINTER ecalloc (int count, unsigned int size);
|
||||
public char * skipsp (char *s);
|
||||
public char * skipnsp(char *s);
|
||||
public int sprefix (char *ps, char *s, int uppercase);
|
||||
public void quit (int status);
|
||||
public void raw_mode (int on);
|
||||
public void scrsize (void);
|
||||
public char * special_key_str (int key);
|
||||
public void get_term (void);
|
||||
public void init (void);
|
||||
public void deinit (void);
|
||||
public void home (void);
|
||||
public void add_line (void);
|
||||
public void remove_top (int n);
|
||||
public void win32_scroll_up (int n);
|
||||
public void lower_left (void);
|
||||
public void line_left (void);
|
||||
public void check_winch (void);
|
||||
public void goto_line (int slinenum);
|
||||
public void vbell (void);
|
||||
public void bell (void);
|
||||
public void clear (void);
|
||||
public void clear_eol (void);
|
||||
public void clear_bot (void);
|
||||
public void at_enter (int attr);
|
||||
public void at_exit (void);
|
||||
public void at_switch (int attr);
|
||||
public int is_at_equiv (int attr1, int attr2);
|
||||
public int apply_at_specials (int attr);
|
||||
public void backspace (void);
|
||||
public void putbs (void);
|
||||
public char WIN32getch (int tty);
|
||||
public void WIN32setcolors (int fg, int bg);
|
||||
public void WIN32textout (char *text, int len);
|
||||
public void match_brac(int obrac, int cbrac, int forwdir, int n);
|
||||
public void ch_ungetchar (int c);
|
||||
public void end_logfile (void);
|
||||
public void sync_logfile (void);
|
||||
public int ch_seek (POSITION pos);
|
||||
public int ch_end_seek (void);
|
||||
public int ch_end_buffer_seek (void);
|
||||
public int ch_beg_seek (void);
|
||||
public POSITION ch_length (void);
|
||||
public POSITION ch_tell (void);
|
||||
public int ch_forw_get (void);
|
||||
public int ch_back_get (void);
|
||||
public void ch_setbufspace (int bufspace);
|
||||
public void ch_flush (void);
|
||||
public int seekable (int f);
|
||||
public void ch_set_eof (void);
|
||||
public void ch_init (int f, int flags);
|
||||
public void ch_close (void);
|
||||
public int ch_getflags (void);
|
||||
struct filestate;
|
||||
public void ch_dump (struct filestate *fs);
|
||||
public void init_charset (void);
|
||||
public int binary_char (LWCHAR c);
|
||||
public int control_char (LWCHAR c);
|
||||
public char * prchar (LWCHAR c);
|
||||
public char * prutfchar (LWCHAR ch);
|
||||
public int utf_len (char ch);
|
||||
public int is_utf8_well_formed (unsigned char *s, int slen);
|
||||
public int utf_bin_count (unsigned char *data, int len);
|
||||
public LWCHAR get_wchar (constant char *p);
|
||||
public void put_wchar (char **pp, LWCHAR ch);
|
||||
public LWCHAR step_char (constant char **pp, signed int dir, constant char *limit);
|
||||
public int is_composing_char (LWCHAR ch);
|
||||
public int is_ubin_char (LWCHAR ch);
|
||||
public int is_wide_char (LWCHAR ch);
|
||||
public int is_combining_char (LWCHAR ch1, LWCHAR ch2);
|
||||
public void cmd_reset (void);
|
||||
public void clear_cmd (void);
|
||||
public void cmd_putstr (constant char *s);
|
||||
public int len_cmdbuf (void);
|
||||
public void set_mlist (constant void *mlist, int cmdflags);
|
||||
struct mlist;
|
||||
public void cmd_addhist (struct mlist *constant mlist, char *cmd, int modified);
|
||||
public void cmd_accept (void);
|
||||
public int cmd_char (int c);
|
||||
public LINENUM cmd_int (long *frac);
|
||||
public char * get_cmdbuf (void);
|
||||
public char * cmd_lastpattern (void);
|
||||
public void init_cmdhist (void);
|
||||
public void save_cmdhist (void);
|
||||
public int in_mca (void);
|
||||
public void dispversion (void);
|
||||
public int getcc (void);
|
||||
public void ungetcc (int c);
|
||||
public void ungetsc (char *s);
|
||||
public void commands (void);
|
||||
public int cvt_length (int len, int ops);
|
||||
public int * cvt_alloc_chpos (int len);
|
||||
public void cvt_text (char *odst, char *osrc, int *chpos, int *lenp, int ops);
|
||||
public void init_cmds (void);
|
||||
public void add_fcmd_table (char *buf, int len);
|
||||
public void add_ecmd_table (char *buf, int len);
|
||||
public int fcmd_decode (char *cmd, char **sp);
|
||||
public int ecmd_decode (char *cmd, char **sp);
|
||||
public char * lgetenv (char *var);
|
||||
public int lesskey (char *filename, int sysvar);
|
||||
public void add_hometable (char *envname, char *def_filename, int sysvar);
|
||||
public int editchar (int c, int flags);
|
||||
public void init_textlist (struct textlist *tlist, char *str);
|
||||
public char * forw_textlist (struct textlist *tlist, char *prev);
|
||||
public char * back_textlist (struct textlist *tlist, char *prev);
|
||||
public int edit (char *filename);
|
||||
public int edit_ifile (IFILE ifile);
|
||||
public int edit_list (char *filelist);
|
||||
public int edit_first (void);
|
||||
public int edit_last (void);
|
||||
public int edit_next (int n);
|
||||
public int edit_prev (int n);
|
||||
public int edit_index (int n);
|
||||
public IFILE save_curr_ifile (void);
|
||||
public void unsave_ifile (IFILE save_ifile);
|
||||
public void reedit_ifile (IFILE save_ifiler);
|
||||
public void reopen_curr_ifile (void);
|
||||
public int edit_stdin (void);
|
||||
public void cat_file (void);
|
||||
public void use_logfile (char *filename);
|
||||
public char * shell_unquote (char *str);
|
||||
public char * get_meta_escape (void);
|
||||
public char * shell_quote (char *s);
|
||||
public char * homefile (char *filename);
|
||||
public char * fexpand (char *s);
|
||||
public char * fcomplete (char *s);
|
||||
public int bin_file (int f);
|
||||
public char * lglob (char *filename);
|
||||
public char * open_altfile (char *filename, int *pf, void **pfd);
|
||||
public void close_altfile (char *altfilename, char *filename, void *pipefd);
|
||||
public int is_dir (char *filename);
|
||||
public char * bad_file (char *filename);
|
||||
public POSITION filesize (int f);
|
||||
public char * shell_coption (void);
|
||||
public char * last_component (char *name);
|
||||
public int eof_displayed (void);
|
||||
public int entire_file_displayed (void);
|
||||
public void squish_check (void);
|
||||
public void forw (int n, POSITION pos, int force, int only_last, int nblank);
|
||||
public void back (int n, POSITION pos, int force, int only_last);
|
||||
public void forward (int n, int force, int only_last);
|
||||
public void backward (int n, int force, int only_last);
|
||||
public int get_back_scroll (void);
|
||||
public void del_ifile (IFILE h);
|
||||
public IFILE next_ifile (IFILE h);
|
||||
public IFILE prev_ifile (IFILE h);
|
||||
public IFILE getoff_ifile (IFILE ifile);
|
||||
public int nifile (void);
|
||||
public IFILE get_ifile (char *filename, IFILE prev);
|
||||
public char * get_filename (IFILE ifile);
|
||||
public int get_index (IFILE ifile);
|
||||
public void store_pos (IFILE ifile, struct scrpos *scrpos);
|
||||
public void get_pos (IFILE ifile, struct scrpos *scrpos);
|
||||
public void set_open (IFILE ifile);
|
||||
public int opened (IFILE ifile);
|
||||
public void hold_ifile (IFILE ifile, int incr);
|
||||
public int held_ifile (IFILE ifile);
|
||||
public void * get_filestate (IFILE ifile);
|
||||
public void set_filestate (IFILE ifile, void *filestate);
|
||||
public void if_dump (void);
|
||||
public POSITION forw_line (POSITION curr_pos);
|
||||
public POSITION back_line (POSITION curr_pos);
|
||||
public void set_attnpos (POSITION pos);
|
||||
public void jump_forw (void);
|
||||
public void jump_forw_buffered (void);
|
||||
public void jump_back (LINENUM linenum);
|
||||
public void repaint (void);
|
||||
public void jump_percent (int percent, long fraction);
|
||||
public void jump_line_loc (POSITION pos, int sline);
|
||||
public void jump_loc (POSITION pos, int sline);
|
||||
public void init_line (void);
|
||||
public int is_ascii_char (LWCHAR ch);
|
||||
public void prewind (void);
|
||||
public void plinenum (POSITION pos);
|
||||
public void pshift_all (void);
|
||||
public int is_ansi_end (LWCHAR ch);
|
||||
public int is_ansi_middle (LWCHAR ch);
|
||||
public int pappend (unsigned char c, POSITION pos);
|
||||
public int pflushmbc (void);
|
||||
public void pdone (int endline, int forw);
|
||||
public void set_status_col (char c);
|
||||
public int gline (int i, int *ap);
|
||||
public void null_line (void);
|
||||
public POSITION forw_raw_line (POSITION curr_pos, char **linep, int *line_lenp);
|
||||
public POSITION back_raw_line (POSITION curr_pos, char **linep, int *line_lenp);
|
||||
public void clr_linenum (void);
|
||||
public void add_lnum (LINENUM linenum, POSITION pos);
|
||||
public LINENUM find_linenum (POSITION pos);
|
||||
public POSITION find_pos (LINENUM linenum);
|
||||
public LINENUM currline (int where);
|
||||
public void lsystem (char *cmd, char *donemsg);
|
||||
public int pipe_mark (int c, char *cmd);
|
||||
public int pipe_data (char *cmd, POSITION spos, POSITION epos);
|
||||
public void init_mark (void);
|
||||
public int badmark (int c);
|
||||
public void setmark (int c);
|
||||
public void lastmark (void);
|
||||
public void gomark (int c);
|
||||
public POSITION markpos (int c);
|
||||
public void unmark (IFILE ifile);
|
||||
public void opt_o (int type, char *s);
|
||||
public void opt__O (int type, char *s);
|
||||
public void opt_j (int type, char *s);
|
||||
public void calc_jump_sline (void);
|
||||
public void opt_shift (int type, char *s);
|
||||
public void calc_shift_count (void);
|
||||
public void opt_k (int type, char *s);
|
||||
public void opt_t (int type, char *s);
|
||||
public void opt__T (int type, char *s);
|
||||
public void opt_p (int type, char *s);
|
||||
public void opt__P (int type, char *s);
|
||||
public void opt_b (int type, char *s);
|
||||
public void opt_i (int type, char *s);
|
||||
public void opt__V (int type, char *s);
|
||||
public void opt_D (int type, char *s);
|
||||
public void opt_x (int type, char *s);
|
||||
public void opt_quote (int type, char *s);
|
||||
public void opt_query (int type, char *s);
|
||||
public int get_swindow (void);
|
||||
public char * propt (int c);
|
||||
public void scan_option (char *s);
|
||||
struct loption;
|
||||
public void toggle_option (struct loption *o, int lower, char *s, int how_toggle);
|
||||
public int opt_has_param (struct loption *o);
|
||||
public char * opt_prompt (struct loption *o);
|
||||
public int isoptpending (void);
|
||||
public void nopendopt (void);
|
||||
public int getnum (char **sp, char *printopt, int *errp);
|
||||
public long getfraction (char **sp, char *printopt, int *errp);
|
||||
public int get_quit_at_eof (void);
|
||||
public void init_option (void);
|
||||
public struct loption * findopt (int c);
|
||||
public struct loption * findopt_name (char **p_optname, char **p_oname, int *p_err);
|
||||
public int iread (int fd, char *buf, unsigned int len);
|
||||
public void intread (void);
|
||||
public time_type get_time (void);
|
||||
public char * errno_message (char *filename);
|
||||
public int percentage (POSITION num, POSITION den);
|
||||
public POSITION percent_pos (POSITION pos, int percent, long fraction);
|
||||
public int os9_signal (int type, RETSIGTYPE (*handler)());
|
||||
public void put_line (void);
|
||||
public void flush (void);
|
||||
public int putchr (int c);
|
||||
public void putstr (constant char *s);
|
||||
public void get_return (void);
|
||||
public void error (char *fmt, PARG *parg);
|
||||
public void ierror (char *fmt, PARG *parg);
|
||||
public int query (char *fmt, PARG *parg);
|
||||
public int compile_pattern (char *pattern, int search_type, void **comp_pattern);
|
||||
public void uncompile_pattern (void **pattern);
|
||||
public int valid_pattern (char *pattern);
|
||||
public int is_null_pattern (void *pattern);
|
||||
public int match_pattern (void *pattern, char *tpattern, char *line, int line_len, char **sp, char **ep, int notbol, int search_type);
|
||||
public POSITION position (int where);
|
||||
public void add_forw_pos (POSITION pos);
|
||||
public void add_back_pos (POSITION pos);
|
||||
public void pos_clear (void);
|
||||
public void pos_init (void);
|
||||
public int onscreen (POSITION pos);
|
||||
public int empty_screen (void);
|
||||
public int empty_lines (int s, int e);
|
||||
public void get_scrpos (struct scrpos *scrpos);
|
||||
public int adjsline (int sline);
|
||||
public void init_prompt (void);
|
||||
public char * pr_expand (constant char *proto, int maxwidth);
|
||||
public char * eq_message (void);
|
||||
public char * pr_string (void);
|
||||
public char * wait_message (void);
|
||||
public void init_search (void);
|
||||
public void repaint_hilite (int on);
|
||||
public void clear_attn (void);
|
||||
public void undo_search (void);
|
||||
struct hilite_tree;
|
||||
public void clr_hlist (struct hilite_tree *anchor);
|
||||
public void clr_hilite (void);
|
||||
public void clr_filter (void);
|
||||
public int is_filtered (POSITION pos);
|
||||
public POSITION next_unfiltered (POSITION pos);
|
||||
public POSITION prev_unfiltered (POSITION pos);
|
||||
public int is_hilited (POSITION pos, POSITION epos, int nohide, int *p_matches);
|
||||
public void chg_caseless (void);
|
||||
public void chg_hilite (void);
|
||||
public int search (int search_type, char *pattern, int n);
|
||||
public void prep_hilite (POSITION spos, POSITION epos, int maxlines);
|
||||
public void set_filter_pattern (char *pattern, int search_type);
|
||||
public int is_filtering (void);
|
||||
public RETSIGTYPE winch (int type);
|
||||
public void init_signals (int on);
|
||||
public void psignals (void);
|
||||
public void cleantags (void);
|
||||
public int gettagtype (void);
|
||||
public void findtag (char *tag);
|
||||
public POSITION tagsearch (void);
|
||||
public char * nexttag (int n);
|
||||
public char * prevtag (int n);
|
||||
public int ntags (void);
|
||||
public int curr_tag (void);
|
||||
public int edit_tagfile (void);
|
||||
public void open_getchr (void);
|
||||
public void close_getchr (void);
|
||||
public int getchr (void);
|
||||
public char * save LESSPARAMS((constant char *s));
|
||||
public VOID_POINTER ecalloc LESSPARAMS((int count, unsigned int size));
|
||||
public char * skipsp LESSPARAMS((char *s));
|
||||
public int sprefix LESSPARAMS((char *ps, char *s, int uppercase));
|
||||
public void quit LESSPARAMS((int status));
|
||||
public void raw_mode LESSPARAMS((int on));
|
||||
public void scrsize LESSPARAMS((VOID_PARAM));
|
||||
public char * special_key_str LESSPARAMS((int key));
|
||||
public void get_term LESSPARAMS((VOID_PARAM));
|
||||
public void init LESSPARAMS((VOID_PARAM));
|
||||
public void deinit LESSPARAMS((VOID_PARAM));
|
||||
public void home LESSPARAMS((VOID_PARAM));
|
||||
public void add_line LESSPARAMS((VOID_PARAM));
|
||||
public void remove_top LESSPARAMS((int n));
|
||||
public void win32_scroll_up LESSPARAMS((int n));
|
||||
public void lower_left LESSPARAMS((VOID_PARAM));
|
||||
public void line_left LESSPARAMS((VOID_PARAM));
|
||||
public void check_winch LESSPARAMS((VOID_PARAM));
|
||||
public void goto_line LESSPARAMS((int slinenum));
|
||||
public void vbell LESSPARAMS((VOID_PARAM));
|
||||
public void bell LESSPARAMS((VOID_PARAM));
|
||||
public void clear LESSPARAMS((VOID_PARAM));
|
||||
public void clear_eol LESSPARAMS((VOID_PARAM));
|
||||
public void clear_bot LESSPARAMS((VOID_PARAM));
|
||||
public void at_enter LESSPARAMS((int attr));
|
||||
public void at_exit LESSPARAMS((VOID_PARAM));
|
||||
public void at_switch LESSPARAMS((int attr));
|
||||
public int is_at_equiv LESSPARAMS((int attr1, int attr2));
|
||||
public int apply_at_specials LESSPARAMS((int attr));
|
||||
public void backspace LESSPARAMS((VOID_PARAM));
|
||||
public void putbs LESSPARAMS((VOID_PARAM));
|
||||
public char WIN32getch LESSPARAMS((int tty));
|
||||
public void WIN32setcolors LESSPARAMS((int fg, int bg));
|
||||
public void WIN32textout LESSPARAMS((char *text, int len));
|
||||
public void match_brac LESSPARAMS((int obrac, int cbrac, int forwdir, int n));
|
||||
public void ch_ungetchar LESSPARAMS((int c));
|
||||
public void end_logfile LESSPARAMS((VOID_PARAM));
|
||||
public void sync_logfile LESSPARAMS((VOID_PARAM));
|
||||
public int ch_seek LESSPARAMS((POSITION pos));
|
||||
public int ch_end_seek LESSPARAMS((VOID_PARAM));
|
||||
public int ch_end_buffer_seek LESSPARAMS((VOID_PARAM));
|
||||
public int ch_beg_seek LESSPARAMS((VOID_PARAM));
|
||||
public POSITION ch_length LESSPARAMS((VOID_PARAM));
|
||||
public POSITION ch_tell LESSPARAMS((VOID_PARAM));
|
||||
public int ch_forw_get LESSPARAMS((VOID_PARAM));
|
||||
public int ch_back_get LESSPARAMS((VOID_PARAM));
|
||||
public void ch_setbufspace LESSPARAMS((int bufspace));
|
||||
public void ch_flush LESSPARAMS((VOID_PARAM));
|
||||
public int seekable LESSPARAMS((int f));
|
||||
public void ch_set_eof LESSPARAMS((VOID_PARAM));
|
||||
public void ch_init LESSPARAMS((int f, int flags));
|
||||
public void ch_close LESSPARAMS((VOID_PARAM));
|
||||
public int ch_getflags LESSPARAMS((VOID_PARAM));
|
||||
public void ch_dump LESSPARAMS((VOID_PARAM));
|
||||
public void init_charset LESSPARAMS((VOID_PARAM));
|
||||
public int binary_char LESSPARAMS((LWCHAR c));
|
||||
public int control_char LESSPARAMS((LWCHAR c));
|
||||
public char * prchar LESSPARAMS((LWCHAR c));
|
||||
public char * prutfchar LESSPARAMS((LWCHAR ch));
|
||||
public int utf_len LESSPARAMS((unsigned char ch));
|
||||
public int is_utf8_well_formed LESSPARAMS((char *ss, int slen));
|
||||
public int utf_bin_count LESSPARAMS((char *data, int len));
|
||||
public LWCHAR get_wchar LESSPARAMS((constant char *p));
|
||||
public void put_wchar LESSPARAMS((char **pp, LWCHAR ch));
|
||||
public LWCHAR step_char LESSPARAMS((char **pp, signed int dir, constant char *limit));
|
||||
public int is_composing_char LESSPARAMS((LWCHAR ch));
|
||||
public int is_ubin_char LESSPARAMS((LWCHAR ch));
|
||||
public int is_wide_char LESSPARAMS((LWCHAR ch));
|
||||
public int is_combining_char LESSPARAMS((LWCHAR ch1, LWCHAR ch2));
|
||||
public void cmd_reset LESSPARAMS((VOID_PARAM));
|
||||
public void clear_cmd LESSPARAMS((VOID_PARAM));
|
||||
public void cmd_putstr LESSPARAMS((constant char *s));
|
||||
public int len_cmdbuf LESSPARAMS((VOID_PARAM));
|
||||
public void set_mlist LESSPARAMS((void *mlist, int cmdflags));
|
||||
public void cmd_addhist LESSPARAMS((struct mlist *mlist, constant char *cmd, int modified));
|
||||
public void cmd_accept LESSPARAMS((VOID_PARAM));
|
||||
public int cmd_char LESSPARAMS((int c));
|
||||
public LINENUM cmd_int LESSPARAMS((long *frac));
|
||||
public char * get_cmdbuf LESSPARAMS((VOID_PARAM));
|
||||
public char * cmd_lastpattern LESSPARAMS((VOID_PARAM));
|
||||
public void init_cmdhist LESSPARAMS((VOID_PARAM));
|
||||
public void save_cmdhist LESSPARAMS((VOID_PARAM));
|
||||
public int in_mca LESSPARAMS((VOID_PARAM));
|
||||
public void dispversion LESSPARAMS((VOID_PARAM));
|
||||
public int getcc LESSPARAMS((VOID_PARAM));
|
||||
public void ungetcc LESSPARAMS((int c));
|
||||
public void ungetsc LESSPARAMS((char *s));
|
||||
public void commands LESSPARAMS((VOID_PARAM));
|
||||
public int cvt_length LESSPARAMS((int len, int ops));
|
||||
public int * cvt_alloc_chpos LESSPARAMS((int len));
|
||||
public void cvt_text LESSPARAMS((char *odst, char *osrc, int *chpos, int *lenp, int ops));
|
||||
public void init_cmds LESSPARAMS((VOID_PARAM));
|
||||
public void add_fcmd_table LESSPARAMS((char *buf, int len));
|
||||
public void add_ecmd_table LESSPARAMS((char *buf, int len));
|
||||
public int fcmd_decode LESSPARAMS((char *cmd, char **sp));
|
||||
public int ecmd_decode LESSPARAMS((char *cmd, char **sp));
|
||||
public char * lgetenv LESSPARAMS((char *var));
|
||||
public int lesskey LESSPARAMS((char *filename, int sysvar));
|
||||
public void add_hometable LESSPARAMS((char *envname, char *def_filename, int sysvar));
|
||||
public int editchar LESSPARAMS((int c, int flags));
|
||||
public void init_textlist LESSPARAMS((struct textlist *tlist, char *str));
|
||||
public char * forw_textlist LESSPARAMS((struct textlist *tlist, char *prev));
|
||||
public char * back_textlist LESSPARAMS((struct textlist *tlist, char *prev));
|
||||
public int edit LESSPARAMS((char *filename));
|
||||
public int edit_ifile LESSPARAMS((IFILE ifile));
|
||||
public int edit_list LESSPARAMS((char *filelist));
|
||||
public int edit_first LESSPARAMS((VOID_PARAM));
|
||||
public int edit_last LESSPARAMS((VOID_PARAM));
|
||||
public int edit_next LESSPARAMS((int n));
|
||||
public int edit_prev LESSPARAMS((int n));
|
||||
public int edit_index LESSPARAMS((int n));
|
||||
public IFILE save_curr_ifile LESSPARAMS((VOID_PARAM));
|
||||
public void unsave_ifile LESSPARAMS((IFILE save_ifile));
|
||||
public void reedit_ifile LESSPARAMS((IFILE save_ifile));
|
||||
public void reopen_curr_ifile LESSPARAMS((VOID_PARAM));
|
||||
public int edit_stdin LESSPARAMS((VOID_PARAM));
|
||||
public void cat_file LESSPARAMS((VOID_PARAM));
|
||||
public void use_logfile LESSPARAMS((char *filename));
|
||||
public char * shell_unquote LESSPARAMS((char *str));
|
||||
public char * get_meta_escape LESSPARAMS((VOID_PARAM));
|
||||
public char * shell_quote LESSPARAMS((char *s));
|
||||
public char * homefile LESSPARAMS((char *filename));
|
||||
public char * fexpand LESSPARAMS((char *s));
|
||||
public char * fcomplete LESSPARAMS((char *s));
|
||||
public int bin_file LESSPARAMS((int f));
|
||||
public char * lglob LESSPARAMS((char *filename));
|
||||
public char * open_altfile LESSPARAMS((char *filename, int *pf, void **pfd));
|
||||
public void close_altfile LESSPARAMS((char *altfilename, char *filename, void *pipefd));
|
||||
public int is_dir LESSPARAMS((char *filename));
|
||||
public char * bad_file LESSPARAMS((char *filename));
|
||||
public POSITION filesize LESSPARAMS((int f));
|
||||
public char * shell_coption LESSPARAMS((VOID_PARAM));
|
||||
public char * last_component LESSPARAMS((char *name));
|
||||
public int eof_displayed LESSPARAMS((VOID_PARAM));
|
||||
public int entire_file_displayed LESSPARAMS((VOID_PARAM));
|
||||
public void squish_check LESSPARAMS((VOID_PARAM));
|
||||
public void forw LESSPARAMS((int n, POSITION pos, int force, int only_last, int nblank));
|
||||
public void back LESSPARAMS((int n, POSITION pos, int force, int only_last));
|
||||
public void forward LESSPARAMS((int n, int force, int only_last));
|
||||
public void backward LESSPARAMS((int n, int force, int only_last));
|
||||
public int get_back_scroll LESSPARAMS((VOID_PARAM));
|
||||
public int get_line_count LESSPARAMS((VOID_PARAM));
|
||||
public void del_ifile LESSPARAMS((IFILE h));
|
||||
public IFILE next_ifile LESSPARAMS((IFILE h));
|
||||
public IFILE prev_ifile LESSPARAMS((IFILE h));
|
||||
public IFILE getoff_ifile LESSPARAMS((IFILE ifile));
|
||||
public int nifile LESSPARAMS((VOID_PARAM));
|
||||
public IFILE get_ifile LESSPARAMS((char *filename, IFILE prev));
|
||||
public char * get_filename LESSPARAMS((IFILE ifile));
|
||||
public int get_index LESSPARAMS((IFILE ifile));
|
||||
public void store_pos LESSPARAMS((IFILE ifile, struct scrpos *scrpos));
|
||||
public void get_pos LESSPARAMS((IFILE ifile, struct scrpos *scrpos));
|
||||
public void set_open LESSPARAMS((IFILE ifile));
|
||||
public int opened LESSPARAMS((IFILE ifile));
|
||||
public void hold_ifile LESSPARAMS((IFILE ifile, int incr));
|
||||
public int held_ifile LESSPARAMS((IFILE ifile));
|
||||
public void * get_filestate LESSPARAMS((IFILE ifile));
|
||||
public void set_filestate LESSPARAMS((IFILE ifile, void *filestate));
|
||||
public void if_dump LESSPARAMS((VOID_PARAM));
|
||||
public POSITION forw_line LESSPARAMS((POSITION curr_pos));
|
||||
public POSITION back_line LESSPARAMS((POSITION curr_pos));
|
||||
public void set_attnpos LESSPARAMS((POSITION pos));
|
||||
public void jump_forw LESSPARAMS((VOID_PARAM));
|
||||
public void jump_forw_buffered LESSPARAMS((VOID_PARAM));
|
||||
public void jump_back LESSPARAMS((LINENUM linenum));
|
||||
public void repaint LESSPARAMS((VOID_PARAM));
|
||||
public void jump_percent LESSPARAMS((int percent, long fraction));
|
||||
public void jump_line_loc LESSPARAMS((POSITION pos, int sline));
|
||||
public void jump_loc LESSPARAMS((POSITION pos, int sline));
|
||||
public void init_line LESSPARAMS((VOID_PARAM));
|
||||
public int is_ascii_char LESSPARAMS((LWCHAR ch));
|
||||
public void prewind LESSPARAMS((VOID_PARAM));
|
||||
public void plinenum LESSPARAMS((POSITION pos));
|
||||
public void pshift_all LESSPARAMS((VOID_PARAM));
|
||||
public int is_ansi_end LESSPARAMS((LWCHAR ch));
|
||||
public int is_ansi_middle LESSPARAMS((LWCHAR ch));
|
||||
public int pappend LESSPARAMS((unsigned char c, POSITION pos));
|
||||
public int pflushmbc LESSPARAMS((VOID_PARAM));
|
||||
public void pdone LESSPARAMS((int endline, int forw));
|
||||
public void set_status_col LESSPARAMS((char c));
|
||||
public int gline LESSPARAMS((int i, int *ap));
|
||||
public void null_line LESSPARAMS((VOID_PARAM));
|
||||
public POSITION forw_raw_line LESSPARAMS((POSITION curr_pos, char **linep, int *line_lenp));
|
||||
public POSITION back_raw_line LESSPARAMS((POSITION curr_pos, char **linep, int *line_lenp));
|
||||
public int rrshift LESSPARAMS((VOID_PARAM));
|
||||
public void clr_linenum LESSPARAMS((VOID_PARAM));
|
||||
public void add_lnum LESSPARAMS((LINENUM linenum, POSITION pos));
|
||||
public LINENUM find_linenum LESSPARAMS((POSITION pos));
|
||||
public POSITION find_pos LESSPARAMS((LINENUM linenum));
|
||||
public LINENUM currline LESSPARAMS((int where));
|
||||
public void lsystem LESSPARAMS((char *cmd, char *donemsg));
|
||||
public int pipe_mark LESSPARAMS((int c, char *cmd));
|
||||
public int pipe_data LESSPARAMS((char *cmd, POSITION spos, POSITION epos));
|
||||
public void init_mark LESSPARAMS((VOID_PARAM));
|
||||
public int badmark LESSPARAMS((int c));
|
||||
public void setmark LESSPARAMS((int c));
|
||||
public void lastmark LESSPARAMS((VOID_PARAM));
|
||||
public void gomark LESSPARAMS((int c));
|
||||
public POSITION markpos LESSPARAMS((int c));
|
||||
public void unmark LESSPARAMS((IFILE ifile));
|
||||
public void opt_o LESSPARAMS((int type, char *s));
|
||||
public void opt__O LESSPARAMS((int type, char *s));
|
||||
public void opt_j LESSPARAMS((int type, char *s));
|
||||
public void calc_jump_sline LESSPARAMS((VOID_PARAM));
|
||||
public void opt_shift LESSPARAMS((int type, char *s));
|
||||
public void calc_shift_count LESSPARAMS((VOID_PARAM));
|
||||
public void opt_k LESSPARAMS((int type, char *s));
|
||||
public void opt_t LESSPARAMS((int type, char *s));
|
||||
public void opt__T LESSPARAMS((int type, char *s));
|
||||
public void opt_p LESSPARAMS((int type, char *s));
|
||||
public void opt__P LESSPARAMS((int type, char *s));
|
||||
public void opt_b LESSPARAMS((int type, char *s));
|
||||
public void opt_i LESSPARAMS((int type, char *s));
|
||||
public void opt__V LESSPARAMS((int type, char *s));
|
||||
public void opt_D LESSPARAMS((int type, char *s));
|
||||
public void opt_x LESSPARAMS((int type, char *s));
|
||||
public void opt_quote LESSPARAMS((int type, char *s));
|
||||
public void opt_query LESSPARAMS((int type, char *s));
|
||||
public int get_swindow LESSPARAMS((VOID_PARAM));
|
||||
public char * propt LESSPARAMS((int c));
|
||||
public void scan_option LESSPARAMS((char *s));
|
||||
public void toggle_option LESSPARAMS((struct loption *o, int lower, char *s, int how_toggle));
|
||||
public int opt_has_param LESSPARAMS((struct loption *o));
|
||||
public char * opt_prompt LESSPARAMS((struct loption *o));
|
||||
public int isoptpending LESSPARAMS((VOID_PARAM));
|
||||
public void nopendopt LESSPARAMS((VOID_PARAM));
|
||||
public int getnum LESSPARAMS((char **sp, char *printopt, int *errp));
|
||||
public long getfraction LESSPARAMS((char **sp, char *printopt, int *errp));
|
||||
public int get_quit_at_eof LESSPARAMS((VOID_PARAM));
|
||||
public void init_option LESSPARAMS((VOID_PARAM));
|
||||
public struct loption * findopt LESSPARAMS((int c));
|
||||
public struct loption * findopt_name LESSPARAMS((char **p_optname, char **p_oname, int *p_err));
|
||||
public int iread LESSPARAMS((int fd, unsigned char *buf, unsigned int len));
|
||||
public void intread LESSPARAMS((VOID_PARAM));
|
||||
public time_type get_time LESSPARAMS((VOID_PARAM));
|
||||
public char * errno_message LESSPARAMS((char *filename));
|
||||
public int percentage LESSPARAMS((POSITION num, POSITION den));
|
||||
public POSITION percent_pos LESSPARAMS((POSITION pos, int percent, long fraction));
|
||||
public int os9_signal LESSPARAMS((int type, RETSIGTYPE (*handler)()));
|
||||
public void put_line LESSPARAMS((VOID_PARAM));
|
||||
public void flush LESSPARAMS((VOID_PARAM));
|
||||
public int putchr LESSPARAMS((int c));
|
||||
public void putstr LESSPARAMS((constant char *s));
|
||||
public void get_return LESSPARAMS((VOID_PARAM));
|
||||
public void error LESSPARAMS((char *fmt, PARG *parg));
|
||||
public void ierror LESSPARAMS((char *fmt, PARG *parg));
|
||||
public int query LESSPARAMS((char *fmt, PARG *parg));
|
||||
public int compile_pattern LESSPARAMS((char *pattern, int search_type, PATTERN_TYPE *comp_pattern));
|
||||
public void uncompile_pattern LESSPARAMS((PATTERN_TYPE *pattern));
|
||||
public int valid_pattern LESSPARAMS((char *pattern));
|
||||
public int is_null_pattern LESSPARAMS((PATTERN_TYPE pattern));
|
||||
public int match_pattern LESSPARAMS((PATTERN_TYPE pattern, char *tpattern, char *line, int line_len, char **sp, char **ep, int notbol, int search_type));
|
||||
public POSITION position LESSPARAMS((int where));
|
||||
public void add_forw_pos LESSPARAMS((POSITION pos));
|
||||
public void add_back_pos LESSPARAMS((POSITION pos));
|
||||
public void pos_clear LESSPARAMS((VOID_PARAM));
|
||||
public void pos_init LESSPARAMS((VOID_PARAM));
|
||||
public int onscreen LESSPARAMS((POSITION pos));
|
||||
public int empty_screen LESSPARAMS((VOID_PARAM));
|
||||
public int empty_lines LESSPARAMS((int s, int e));
|
||||
public void get_scrpos LESSPARAMS((struct scrpos *scrpos));
|
||||
public int adjsline LESSPARAMS((int sline));
|
||||
public void init_prompt LESSPARAMS((VOID_PARAM));
|
||||
public char * pr_expand LESSPARAMS((constant char *proto, int maxwidth));
|
||||
public char * eq_message LESSPARAMS((VOID_PARAM));
|
||||
public char * pr_string LESSPARAMS((VOID_PARAM));
|
||||
public char * wait_message LESSPARAMS((VOID_PARAM));
|
||||
public void init_search LESSPARAMS((VOID_PARAM));
|
||||
public void repaint_hilite LESSPARAMS((int on));
|
||||
public void clear_attn LESSPARAMS((VOID_PARAM));
|
||||
public void undo_search LESSPARAMS((VOID_PARAM));
|
||||
public void clr_hlist LESSPARAMS((struct hilite_tree *anchor));
|
||||
public void clr_hilite LESSPARAMS((VOID_PARAM));
|
||||
public void clr_filter LESSPARAMS((VOID_PARAM));
|
||||
public int is_filtered LESSPARAMS((POSITION pos));
|
||||
public POSITION next_unfiltered LESSPARAMS((POSITION pos));
|
||||
public POSITION prev_unfiltered LESSPARAMS((POSITION pos));
|
||||
public int is_hilited LESSPARAMS((POSITION pos, POSITION epos, int nohide, int *p_matches));
|
||||
public void chg_hilite LESSPARAMS((VOID_PARAM));
|
||||
public void chg_caseless LESSPARAMS((VOID_PARAM));
|
||||
public int search LESSPARAMS((int search_type, char *pattern, int n));
|
||||
public void prep_hilite LESSPARAMS((POSITION spos, POSITION epos, int maxlines));
|
||||
public void set_filter_pattern LESSPARAMS((char *pattern, int search_type));
|
||||
public int is_filtering LESSPARAMS((VOID_PARAM));
|
||||
public RETSIGTYPE winch LESSPARAMS((int type));
|
||||
public RETSIGTYPE winch LESSPARAMS((int type));
|
||||
public void init_signals LESSPARAMS((int on));
|
||||
public void psignals LESSPARAMS((VOID_PARAM));
|
||||
public void cleantags LESSPARAMS((VOID_PARAM));
|
||||
public int gettagtype LESSPARAMS((VOID_PARAM));
|
||||
public void findtag LESSPARAMS((char *tag));
|
||||
public POSITION tagsearch LESSPARAMS((VOID_PARAM));
|
||||
public char * nexttag LESSPARAMS((int n));
|
||||
public char * prevtag LESSPARAMS((int n));
|
||||
public int ntags LESSPARAMS((VOID_PARAM));
|
||||
public int curr_tag LESSPARAMS((VOID_PARAM));
|
||||
public int edit_tagfile LESSPARAMS((VOID_PARAM));
|
||||
public void open_getchr LESSPARAMS((VOID_PARAM));
|
||||
public void close_getchr LESSPARAMS((VOID_PARAM));
|
||||
public int getchr LESSPARAMS((VOID_PARAM));
|
||||
|
@ -23,8 +23,10 @@ constant char helpdata[] = {
|
||||
' ',' ','E','S','C','-','S','P','A','C','E',' ',' ',' ',' ',' ',' ',' ',' ',' ','*',' ',' ','F','o','r','w','a','r','d',' ',' ','o','n','e',' ','w','i','n','d','o','w',',',' ','b','u','t',' ','d','o','n','\'','t',' ','s','t','o','p',' ','a','t',' ','e','n','d','-','o','f','-','f','i','l','e','.','\n',
|
||||
' ',' ','d',' ',' ','^','D',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','*',' ',' ','F','o','r','w','a','r','d',' ',' ','o','n','e',' ','h','a','l','f','-','w','i','n','d','o','w',' ','(','a','n','d',' ','s','e','t',' ','h','a','l','f','-','w','i','n','d','o','w',' ','t','o',' ','_','\b','N',')','.','\n',
|
||||
' ',' ','u',' ',' ','^','U',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','*',' ',' ','B','a','c','k','w','a','r','d',' ','o','n','e',' ','h','a','l','f','-','w','i','n','d','o','w',' ','(','a','n','d',' ','s','e','t',' ','h','a','l','f','-','w','i','n','d','o','w',' ','t','o',' ','_','\b','N',')','.','\n',
|
||||
' ',' ','E','S','C','-',')',' ',' ','R','i','g','h','t','A','r','r','o','w',' ','*',' ',' ','L','e','f','t',' ',' ','o','n','e',' ','h','a','l','f',' ','s','c','r','e','e','n',' ','w','i','d','t','h',' ','(','o','r',' ','_','\b','N',' ','p','o','s','i','t','i','o','n','s',')','.','\n',
|
||||
' ',' ','E','S','C','-','(',' ',' ','L','e','f','t','A','r','r','o','w',' ',' ','*',' ',' ','R','i','g','h','t',' ','o','n','e',' ','h','a','l','f',' ','s','c','r','e','e','n',' ','w','i','d','t','h',' ','(','o','r',' ','_','\b','N',' ','p','o','s','i','t','i','o','n','s',')','.','\n',
|
||||
' ',' ','E','S','C','-',')',' ',' ','R','i','g','h','t','A','r','r','o','w',' ','*',' ',' ','R','i','g','h','t',' ','o','n','e',' ','h','a','l','f',' ','s','c','r','e','e','n',' ','w','i','d','t','h',' ','(','o','r',' ','_','\b','N',' ','p','o','s','i','t','i','o','n','s',')','.','\n',
|
||||
' ',' ','E','S','C','-','(',' ',' ','L','e','f','t','A','r','r','o','w',' ',' ','*',' ',' ','L','e','f','t',' ',' ','o','n','e',' ','h','a','l','f',' ','s','c','r','e','e','n',' ','w','i','d','t','h',' ','(','o','r',' ','_','\b','N',' ','p','o','s','i','t','i','o','n','s',')','.','\n',
|
||||
' ',' ','E','S','C','-','}',' ',' ','^','R','i','g','h','t','A','r','r','o','w',' ',' ',' ','R','i','g','h','t',' ','t','o',' ','l','a','s','t',' ','c','o','l','u','m','n',' ','d','i','s','p','l','a','y','e','d','.','\n',
|
||||
' ',' ','E','S','C','-','{',' ',' ','^','L','e','f','t','A','r','r','o','w',' ',' ',' ',' ','L','e','f','t',' ',' ','t','o',' ','f','i','r','s','t',' ','c','o','l','u','m','n','.','\n',
|
||||
' ',' ','F',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','F','o','r','w','a','r','d',' ','f','o','r','e','v','e','r',';',' ','l','i','k','e',' ','"','t','a','i','l',' ','-','f','"','.','\n',
|
||||
' ',' ','E','S','C','-','F',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','L','i','k','e',' ','F',' ','b','u','t',' ','s','t','o','p',' ','w','h','e','n',' ','s','e','a','r','c','h',' ','p','a','t','t','e','r','n',' ','i','s',' ','f','o','u','n','d','.','\n',
|
||||
' ',' ','r',' ',' ','^','R',' ',' ','^','L',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','R','e','p','a','i','n','t',' ','s','c','r','e','e','n','.','\n',
|
||||
@ -102,6 +104,7 @@ constant char helpdata[] = {
|
||||
'\n',
|
||||
' ',' ','!','_','\b','c','_','\b','o','_','\b','m','_','\b','m','_','\b','a','_','\b','n','_','\b','d',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','E','x','e','c','u','t','e',' ','t','h','e',' ','s','h','e','l','l',' ','c','o','m','m','a','n','d',' ','w','i','t','h',' ','$','S','H','E','L','L','.','\n',
|
||||
' ',' ','|','X','\b','X','_','\b','c','_','\b','o','_','\b','m','_','\b','m','_','\b','a','_','\b','n','_','\b','d',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','P','i','p','e',' ','f','i','l','e',' ','b','e','t','w','e','e','n',' ','c','u','r','r','e','n','t',' ','p','o','s',' ','&',' ','m','a','r','k',' ','X','\b','X',' ','t','o',' ','s','h','e','l','l',' ','c','o','m','m','a','n','d','.','\n',
|
||||
' ',' ','s',' ','_','\b','f','_','\b','i','_','\b','l','_','\b','e',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','S','a','v','e',' ','i','n','p','u','t',' ','t','o',' ','a',' ','f','i','l','e','.','\n',
|
||||
' ',' ','v',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','E','d','i','t',' ','t','h','e',' ','c','u','r','r','e','n','t',' ','f','i','l','e',' ','w','i','t','h',' ','$','V','I','S','U','A','L',' ','o','r',' ','$','E','D','I','T','O','R','.','\n',
|
||||
' ',' ','V',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','P','r','i','n','t',' ','v','e','r','s','i','o','n',' ','n','u','m','b','e','r',' ','o','f',' ','"','l','e','s','s','"','.','\n',
|
||||
' ','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','\n',
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 1984-2015 Mark Nudelman
|
||||
* Copyright (C) 1984-2017 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.
|
||||
@ -49,7 +49,9 @@ static struct ifile anchor = { &anchor, &anchor, NULL, NULL, 0, 0, '\0',
|
||||
static int ifiles = 0;
|
||||
|
||||
static void
|
||||
incr_index(struct ifile *p, int incr)
|
||||
incr_index(p, incr)
|
||||
struct ifile *p;
|
||||
int incr;
|
||||
{
|
||||
for (; p != &anchor; p = p->h_next)
|
||||
p->h_index += incr;
|
||||
@ -59,7 +61,9 @@ incr_index(struct ifile *p, int incr)
|
||||
* Link an ifile into the ifile list.
|
||||
*/
|
||||
static void
|
||||
link_ifile(struct ifile *p, struct ifile *prev)
|
||||
link_ifile(p, prev)
|
||||
struct ifile *p;
|
||||
struct ifile *prev;
|
||||
{
|
||||
/*
|
||||
* Link into list.
|
||||
@ -83,7 +87,8 @@ link_ifile(struct ifile *p, struct ifile *prev)
|
||||
* Unlink an ifile from the ifile list.
|
||||
*/
|
||||
static void
|
||||
unlink_ifile(struct ifile *p)
|
||||
unlink_ifile(p)
|
||||
struct ifile *p;
|
||||
{
|
||||
p->h_next->h_prev = p->h_prev;
|
||||
p->h_prev->h_next = p->h_next;
|
||||
@ -98,7 +103,9 @@ unlink_ifile(struct ifile *p)
|
||||
* Return a pointer to the new ifile structure.
|
||||
*/
|
||||
static struct ifile *
|
||||
new_ifile(char *filename, struct ifile *prev)
|
||||
new_ifile(filename, prev)
|
||||
char *filename;
|
||||
struct ifile *prev;
|
||||
{
|
||||
struct ifile *p;
|
||||
|
||||
@ -119,7 +126,8 @@ new_ifile(char *filename, struct ifile *prev)
|
||||
* Delete an existing ifile structure.
|
||||
*/
|
||||
public void
|
||||
del_ifile(IFILE h)
|
||||
del_ifile(h)
|
||||
IFILE h;
|
||||
{
|
||||
struct ifile *p;
|
||||
|
||||
@ -142,7 +150,8 @@ del_ifile(IFILE h)
|
||||
* Get the ifile after a given one in the list.
|
||||
*/
|
||||
public IFILE
|
||||
next_ifile(IFILE h)
|
||||
next_ifile(h)
|
||||
IFILE h;
|
||||
{
|
||||
struct ifile *p;
|
||||
|
||||
@ -156,7 +165,8 @@ next_ifile(IFILE h)
|
||||
* Get the ifile before a given one in the list.
|
||||
*/
|
||||
public IFILE
|
||||
prev_ifile(IFILE h)
|
||||
prev_ifile(h)
|
||||
IFILE h;
|
||||
{
|
||||
struct ifile *p;
|
||||
|
||||
@ -170,7 +180,8 @@ prev_ifile(IFILE h)
|
||||
* Return a different ifile from the given one.
|
||||
*/
|
||||
public IFILE
|
||||
getoff_ifile(IFILE ifile)
|
||||
getoff_ifile(ifile)
|
||||
IFILE ifile;
|
||||
{
|
||||
IFILE newifile;
|
||||
|
||||
@ -185,7 +196,7 @@ getoff_ifile(IFILE ifile)
|
||||
* Return the number of ifiles.
|
||||
*/
|
||||
public int
|
||||
nifile(void)
|
||||
nifile()
|
||||
{
|
||||
return (ifiles);
|
||||
}
|
||||
@ -194,7 +205,8 @@ nifile(void)
|
||||
* Find an ifile structure, given a filename.
|
||||
*/
|
||||
static struct ifile *
|
||||
find_ifile(char *filename)
|
||||
find_ifile(filename)
|
||||
char *filename;
|
||||
{
|
||||
struct ifile *p;
|
||||
|
||||
@ -210,7 +222,9 @@ find_ifile(char *filename)
|
||||
* insert the new ifile after "prev" in the list.
|
||||
*/
|
||||
public IFILE
|
||||
get_ifile(char *filename, IFILE prev)
|
||||
get_ifile(filename, prev)
|
||||
char *filename;
|
||||
IFILE prev;
|
||||
{
|
||||
struct ifile *p;
|
||||
|
||||
@ -223,7 +237,8 @@ get_ifile(char *filename, IFILE prev)
|
||||
* Get the filename associated with a ifile.
|
||||
*/
|
||||
public char *
|
||||
get_filename(IFILE ifile)
|
||||
get_filename(ifile)
|
||||
IFILE ifile;
|
||||
{
|
||||
if (ifile == NULL)
|
||||
return (NULL);
|
||||
@ -234,7 +249,8 @@ get_filename(IFILE ifile)
|
||||
* Get the index of the file associated with a ifile.
|
||||
*/
|
||||
public int
|
||||
get_index(IFILE ifile)
|
||||
get_index(ifile)
|
||||
IFILE ifile;
|
||||
{
|
||||
return (int_ifile(ifile)->h_index);
|
||||
}
|
||||
@ -243,7 +259,9 @@ get_index(IFILE ifile)
|
||||
* Save the file position to be associated with a given file.
|
||||
*/
|
||||
public void
|
||||
store_pos(IFILE ifile, struct scrpos *scrpos)
|
||||
store_pos(ifile, scrpos)
|
||||
IFILE ifile;
|
||||
struct scrpos *scrpos;
|
||||
{
|
||||
int_ifile(ifile)->h_scrpos = *scrpos;
|
||||
}
|
||||
@ -253,7 +271,9 @@ store_pos(IFILE ifile, struct scrpos *scrpos)
|
||||
* If no position has been associated with the file, return NULL_POSITION.
|
||||
*/
|
||||
public void
|
||||
get_pos(IFILE ifile, struct scrpos *scrpos)
|
||||
get_pos(ifile, scrpos)
|
||||
IFILE ifile;
|
||||
struct scrpos *scrpos;
|
||||
{
|
||||
*scrpos = int_ifile(ifile)->h_scrpos;
|
||||
}
|
||||
@ -262,7 +282,8 @@ get_pos(IFILE ifile, struct scrpos *scrpos)
|
||||
* Mark the ifile as "opened".
|
||||
*/
|
||||
public void
|
||||
set_open(IFILE ifile)
|
||||
set_open(ifile)
|
||||
IFILE ifile;
|
||||
{
|
||||
int_ifile(ifile)->h_opened = 1;
|
||||
}
|
||||
@ -271,38 +292,45 @@ set_open(IFILE ifile)
|
||||
* Return whether the ifile has been opened previously.
|
||||
*/
|
||||
public int
|
||||
opened(IFILE ifile)
|
||||
opened(ifile)
|
||||
IFILE ifile;
|
||||
{
|
||||
return (int_ifile(ifile)->h_opened);
|
||||
}
|
||||
|
||||
public void
|
||||
hold_ifile(IFILE ifile, int incr)
|
||||
hold_ifile(ifile, incr)
|
||||
IFILE ifile;
|
||||
int incr;
|
||||
{
|
||||
int_ifile(ifile)->h_hold += incr;
|
||||
}
|
||||
|
||||
public int
|
||||
held_ifile(IFILE ifile)
|
||||
held_ifile(ifile)
|
||||
IFILE ifile;
|
||||
{
|
||||
return (int_ifile(ifile)->h_hold);
|
||||
}
|
||||
|
||||
public void *
|
||||
get_filestate(IFILE ifile)
|
||||
get_filestate(ifile)
|
||||
IFILE ifile;
|
||||
{
|
||||
return (int_ifile(ifile)->h_filestate);
|
||||
}
|
||||
|
||||
public void
|
||||
set_filestate(IFILE ifile, void *filestate)
|
||||
set_filestate(ifile, filestate)
|
||||
IFILE ifile;
|
||||
void *filestate;
|
||||
{
|
||||
int_ifile(ifile)->h_filestate = filestate;
|
||||
}
|
||||
|
||||
#if 0
|
||||
public void
|
||||
if_dump(void)
|
||||
if_dump()
|
||||
{
|
||||
struct ifile *p;
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 1984-2015 Mark Nudelman
|
||||
* Copyright (C) 1984-2017 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.
|
||||
@ -42,7 +42,8 @@ extern int size_linebuf;
|
||||
* of the NEXT line. The line obtained is the line starting at curr_pos.
|
||||
*/
|
||||
public POSITION
|
||||
forw_line(POSITION curr_pos)
|
||||
forw_line(curr_pos)
|
||||
POSITION curr_pos;
|
||||
{
|
||||
POSITION base_pos;
|
||||
POSITION new_pos;
|
||||
@ -248,7 +249,8 @@ forw_line(POSITION curr_pos)
|
||||
* of the PREVIOUS line. The line obtained is the one starting at new_pos.
|
||||
*/
|
||||
public POSITION
|
||||
back_line(POSITION curr_pos)
|
||||
back_line(curr_pos)
|
||||
POSITION curr_pos;
|
||||
{
|
||||
POSITION new_pos, begin_new_pos, base_pos;
|
||||
int c;
|
||||
@ -427,7 +429,8 @@ back_line(POSITION curr_pos)
|
||||
* Set attnpos.
|
||||
*/
|
||||
public void
|
||||
set_attnpos(POSITION pos)
|
||||
set_attnpos(pos)
|
||||
POSITION pos;
|
||||
{
|
||||
int c;
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 1984-2015 Mark Nudelman
|
||||
* Copyright (C) 1984-2017 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.
|
||||
@ -26,7 +26,7 @@ extern int top_scroll;
|
||||
* Jump to the end of the file.
|
||||
*/
|
||||
public void
|
||||
jump_forw(void)
|
||||
jump_forw()
|
||||
{
|
||||
POSITION pos;
|
||||
POSITION end_pos;
|
||||
@ -64,7 +64,7 @@ jump_forw(void)
|
||||
* Jump to the last buffered line in the file.
|
||||
*/
|
||||
public void
|
||||
jump_forw_buffered(void)
|
||||
jump_forw_buffered()
|
||||
{
|
||||
POSITION end;
|
||||
|
||||
@ -82,7 +82,8 @@ jump_forw_buffered(void)
|
||||
* Jump to line n in the file.
|
||||
*/
|
||||
public void
|
||||
jump_back(LINENUM linenum)
|
||||
jump_back(linenum)
|
||||
LINENUM linenum;
|
||||
{
|
||||
POSITION pos;
|
||||
PARG parg;
|
||||
@ -114,7 +115,7 @@ jump_back(LINENUM linenum)
|
||||
* Repaint the screen.
|
||||
*/
|
||||
public void
|
||||
repaint(void)
|
||||
repaint()
|
||||
{
|
||||
struct scrpos scrpos;
|
||||
/*
|
||||
@ -123,14 +124,20 @@ repaint(void)
|
||||
*/
|
||||
get_scrpos(&scrpos);
|
||||
pos_clear();
|
||||
jump_loc(scrpos.pos, scrpos.ln);
|
||||
if (scrpos.pos == NULL_POSITION)
|
||||
/* Screen hasn't been drawn yet. */
|
||||
jump_loc(0, 0);
|
||||
else
|
||||
jump_loc(scrpos.pos, scrpos.ln);
|
||||
}
|
||||
|
||||
/*
|
||||
* Jump to a specified percentage into the file.
|
||||
*/
|
||||
public void
|
||||
jump_percent(int percent, long fraction)
|
||||
jump_percent(percent, fraction)
|
||||
int percent;
|
||||
long fraction;
|
||||
{
|
||||
POSITION pos, len;
|
||||
|
||||
@ -161,7 +168,9 @@ jump_percent(int percent, long fraction)
|
||||
* the first character in a line.
|
||||
*/
|
||||
public void
|
||||
jump_line_loc(POSITION pos, int sline)
|
||||
jump_line_loc(pos, sline)
|
||||
POSITION pos;
|
||||
int sline;
|
||||
{
|
||||
int c;
|
||||
|
||||
@ -187,7 +196,9 @@ jump_line_loc(POSITION pos, int sline)
|
||||
* Place the target line on a specified line on the screen.
|
||||
*/
|
||||
public void
|
||||
jump_loc(POSITION pos, int sline)
|
||||
jump_loc(pos, sline)
|
||||
POSITION pos;
|
||||
int sline;
|
||||
{
|
||||
int nline;
|
||||
POSITION tpos;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 1984-2015 Mark Nudelman
|
||||
* Copyright (C) 1984-2017 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.
|
||||
@ -39,10 +39,17 @@
|
||||
/*
|
||||
* Language details.
|
||||
*/
|
||||
#if HAVE_ANSI_PROTOS
|
||||
#define LESSPARAMS(a) a
|
||||
#else
|
||||
#define LESSPARAMS(a) ()
|
||||
#endif
|
||||
#if HAVE_VOID
|
||||
#define VOID_POINTER void *
|
||||
#define VOID_PARAM void
|
||||
#else
|
||||
#define VOID_POINTER char *
|
||||
#define VOID_PARAM
|
||||
#define void int
|
||||
#endif
|
||||
#if HAVE_CONST
|
||||
@ -525,9 +532,13 @@ struct wchar_range_table
|
||||
#define time_type long
|
||||
#endif
|
||||
|
||||
struct mlist;
|
||||
struct loption;
|
||||
struct hilite_tree;
|
||||
#include "pattern.h"
|
||||
#include "funcs.h"
|
||||
|
||||
/* Functions not included in funcs.h */
|
||||
void postoa(POSITION num, char *buf);
|
||||
void linenumtoa(LINENUM num, char *buf);
|
||||
void inttoa(int num, char *buf);
|
||||
void postoa();
|
||||
void linenumtoa();
|
||||
void inttoa();
|
||||
|
@ -20,8 +20,10 @@
|
||||
ESC-SPACE * Forward one window, but don't stop at end-of-file.
|
||||
d ^D * Forward one half-window (and set half-window to _N).
|
||||
u ^U * Backward one half-window (and set half-window to _N).
|
||||
ESC-) RightArrow * Left one half screen width (or _N positions).
|
||||
ESC-( LeftArrow * Right one half screen width (or _N positions).
|
||||
ESC-) RightArrow * Right one half screen width (or _N positions).
|
||||
ESC-( LeftArrow * Left one half screen width (or _N positions).
|
||||
ESC-} ^RightArrow Right to last column displayed.
|
||||
ESC-{ ^LeftArrow Left to first column.
|
||||
F Forward forever; like "tail -f".
|
||||
ESC-F Like F but stop when search pattern is found.
|
||||
r ^R ^L Repaint screen.
|
||||
@ -99,6 +101,7 @@
|
||||
|
||||
!_c_o_m_m_a_n_d Execute the shell command with $SHELL.
|
||||
|XX_c_o_m_m_a_n_d Pipe file between current pos & mark XX to shell command.
|
||||
s _f_i_l_e Save input to a file.
|
||||
v Edit the current file with $VISUAL or $EDITOR.
|
||||
V Print version number of "less".
|
||||
---------------------------------------------------------------------------
|
||||
|
@ -1,4 +1,4 @@
|
||||
.TH LESS 1 "Version 481: 31 Aug 2015"
|
||||
.TH LESS 1 "Version 491: 07 Apr 2017"
|
||||
.SH NAME
|
||||
less \- opposite of more
|
||||
.SH SYNOPSIS
|
||||
@ -101,6 +101,10 @@ Scroll horizontally left N characters, default half the screen width
|
||||
(see the \-# option).
|
||||
If a number N is specified, it becomes the default for future RIGHTARROW
|
||||
and LEFTARROW commands.
|
||||
.IP "ESC-} or ^RIGHTARROW"
|
||||
Scroll horizontally right to show the end of the longest displayed line.
|
||||
.IP "ESC-{ or ^LEFTARROW"
|
||||
Scroll horizontally left back to the first column.
|
||||
.IP "r or ^R or ^L"
|
||||
Repaint the screen.
|
||||
.IP R
|
||||
@ -547,6 +551,7 @@ The first number selects the foreground color and the second selects
|
||||
the background color of the text.
|
||||
A single number \fIN\fP is the same as \fIN.M\fP,
|
||||
where \fIM\fP is the normal background color.
|
||||
\fBx\fP may also be \fBa\fP to toggle strict ANSI sequence rendering (SGR mode).
|
||||
|
||||
.IP "\-e or \-\-quit-at-eof"
|
||||
Causes
|
||||
@ -1740,7 +1745,7 @@ The name of the editor (used for the v command).
|
||||
lesskey(1)
|
||||
|
||||
.SH COPYRIGHT
|
||||
Copyright (C) 1984-2015 Mark Nudelman
|
||||
Copyright (C) 1984-2017 Mark Nudelman
|
||||
.PP
|
||||
less is part of the GNU project and is free software.
|
||||
You can redistribute it and/or modify it
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 1984-2015 Mark Nudelman
|
||||
* Copyright (C) 1984-2017 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.
|
||||
@ -38,14 +38,14 @@ static char metachars[64] = "";
|
||||
static int num_metachars = 0;
|
||||
|
||||
static void
|
||||
pr_usage(void)
|
||||
pr_usage()
|
||||
{
|
||||
fprintf(stderr,
|
||||
"usage: lessecho [-ox] [-cx] [-pn] [-dn] [-mx] [-nn] [-ex] [-fn] [-a] file ...\n");
|
||||
}
|
||||
|
||||
static void
|
||||
pr_version(void)
|
||||
pr_version()
|
||||
{
|
||||
char *p;
|
||||
char buf[10];
|
||||
@ -61,14 +61,18 @@ pr_version(void)
|
||||
}
|
||||
|
||||
static void
|
||||
pr_error(char *s)
|
||||
pr_error(s)
|
||||
char *s;
|
||||
{
|
||||
fprintf(stderr, "%s\n", s);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
static long
|
||||
lstrtol(char *s, int radix, char **pend)
|
||||
lstrtol(s, radix, pend)
|
||||
char *s;
|
||||
int radix;
|
||||
char **pend;
|
||||
{
|
||||
int v;
|
||||
int neg = 0;
|
||||
|
@ -1,4 +1,4 @@
|
||||
.TH LESSECHO 1 "Version 481: 31 Aug 2015"
|
||||
.TH LESSECHO 1 "Version 491: 07 Apr 2017"
|
||||
.SH NAME
|
||||
lessecho \- expand metacharacters
|
||||
.SH SYNOPSIS
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 1984-2015 Mark Nudelman
|
||||
* Copyright (C) 1984-2017 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.
|
||||
@ -104,6 +104,7 @@ struct cmdname cmdnames[] =
|
||||
{ "display-flag", A_DISP_OPTION },
|
||||
{ "display-option", A_DISP_OPTION },
|
||||
{ "end", A_GOEND },
|
||||
{ "end-scroll", A_RRSHIFT },
|
||||
{ "examine", A_EXAMINE },
|
||||
{ "filter", A_FILTER },
|
||||
{ "first-cmd", A_FIRSTCMD },
|
||||
@ -130,6 +131,7 @@ struct cmdname cmdnames[] =
|
||||
{ "next-file", A_NEXT_FILE },
|
||||
{ "next-tag", A_NEXT_TAG },
|
||||
{ "noaction", A_NOACTION },
|
||||
{ "no-scroll", A_LLSHIFT },
|
||||
{ "percent", A_PERCENT },
|
||||
{ "pipe", A_PIPE },
|
||||
{ "prev-file", A_PREV_FILE },
|
||||
@ -213,19 +215,19 @@ char *outfile = NULL ;
|
||||
int linenum;
|
||||
int errors;
|
||||
|
||||
static void lk_error(char *s);
|
||||
|
||||
extern char version[];
|
||||
|
||||
void
|
||||
usage(void)
|
||||
usage()
|
||||
{
|
||||
fprintf(stderr, "usage: lesskey [-o output] [input]\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
char *
|
||||
mkpathname(char *dirname, char *filename)
|
||||
mkpathname(dirname, filename)
|
||||
char *dirname;
|
||||
char *filename;
|
||||
{
|
||||
char *pathname;
|
||||
|
||||
@ -240,7 +242,8 @@ mkpathname(char *dirname, char *filename)
|
||||
* Figure out the name of a default file (in the user's HOME directory).
|
||||
*/
|
||||
char *
|
||||
homefile(char *filename)
|
||||
homefile(filename)
|
||||
char *filename;
|
||||
{
|
||||
char *p;
|
||||
char *pathname;
|
||||
@ -263,7 +266,9 @@ homefile(char *filename)
|
||||
* Parse command line arguments.
|
||||
*/
|
||||
void
|
||||
parse_args(int argc, char **argv)
|
||||
parse_args(argc, argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
{
|
||||
char *arg;
|
||||
|
||||
@ -336,7 +341,7 @@ parse_args(int argc, char **argv)
|
||||
* Initialize data structures.
|
||||
*/
|
||||
void
|
||||
init_tables(void)
|
||||
init_tables()
|
||||
{
|
||||
cmdtable.names = cmdnames;
|
||||
cmdtable.pbuffer = cmdtable.buffer;
|
||||
@ -352,7 +357,9 @@ init_tables(void)
|
||||
* Parse one character of a string.
|
||||
*/
|
||||
char *
|
||||
tstr(char **pp, int xlate)
|
||||
tstr(pp, xlate)
|
||||
char **pp;
|
||||
int xlate;
|
||||
{
|
||||
char *p;
|
||||
char ch;
|
||||
@ -416,7 +423,7 @@ tstr(char **pp, int xlate)
|
||||
case 'e': ch = SK_END; break;
|
||||
case 'x': ch = SK_DELETE; break;
|
||||
default:
|
||||
lk_error("illegal char after \\k");
|
||||
error("illegal char after \\k", NULL_PARG);
|
||||
*pp = p+1;
|
||||
return ("");
|
||||
}
|
||||
@ -466,7 +473,8 @@ tstr(char **pp, int xlate)
|
||||
* Skip leading spaces in a string.
|
||||
*/
|
||||
public char *
|
||||
skipsp(char *s)
|
||||
skipsp(s)
|
||||
char *s;
|
||||
{
|
||||
while (*s == ' ' || *s == '\t')
|
||||
s++;
|
||||
@ -477,7 +485,8 @@ skipsp(char *s)
|
||||
* Skip non-space characters in a string.
|
||||
*/
|
||||
public char *
|
||||
skipnsp(char *s)
|
||||
skipnsp(s)
|
||||
char *s;
|
||||
{
|
||||
while (*s != '\0' && *s != ' ' && *s != '\t')
|
||||
s++;
|
||||
@ -489,7 +498,8 @@ skipnsp(char *s)
|
||||
* strip off the trailing newline & any trailing # comment.
|
||||
*/
|
||||
char *
|
||||
clean_line(char *s)
|
||||
clean_line(s)
|
||||
char *s;
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -505,11 +515,12 @@ clean_line(char *s)
|
||||
* Add a byte to the output command table.
|
||||
*/
|
||||
void
|
||||
add_cmd_char(int c)
|
||||
add_cmd_char(c)
|
||||
int c;
|
||||
{
|
||||
if (currtable->pbuffer >= currtable->buffer + MAX_USERCMD)
|
||||
{
|
||||
lk_error("too many commands");
|
||||
error("too many commands", NULL_PARG);
|
||||
exit(1);
|
||||
}
|
||||
*(currtable->pbuffer)++ = c;
|
||||
@ -519,7 +530,8 @@ add_cmd_char(int c)
|
||||
* Add a string to the output command table.
|
||||
*/
|
||||
void
|
||||
add_cmd_str(char *s)
|
||||
add_cmd_str(s)
|
||||
char *s;
|
||||
{
|
||||
for ( ; *s != '\0'; s++)
|
||||
add_cmd_char(*s);
|
||||
@ -529,7 +541,8 @@ add_cmd_str(char *s)
|
||||
* See if we have a special "control" line.
|
||||
*/
|
||||
int
|
||||
control_line(char *s)
|
||||
control_line(s)
|
||||
char *s;
|
||||
{
|
||||
#define PREFIX(str,pat) (strncmp(str,pat,strlen(pat)) == 0)
|
||||
|
||||
@ -561,7 +574,10 @@ control_line(char *s)
|
||||
* Output some bytes.
|
||||
*/
|
||||
void
|
||||
fputbytes(FILE *fd, char *buf, int len)
|
||||
fputbytes(fd, buf, len)
|
||||
FILE *fd;
|
||||
char *buf;
|
||||
int len;
|
||||
{
|
||||
while (len-- > 0)
|
||||
{
|
||||
@ -574,7 +590,9 @@ fputbytes(FILE *fd, char *buf, int len)
|
||||
* Output an integer, in special KRADIX form.
|
||||
*/
|
||||
void
|
||||
fputint(FILE *fd, unsigned int val)
|
||||
fputint(fd, val)
|
||||
FILE *fd;
|
||||
unsigned int val;
|
||||
{
|
||||
char c;
|
||||
|
||||
@ -594,27 +612,32 @@ fputint(FILE *fd, unsigned int val)
|
||||
* Find an action, given the name of the action.
|
||||
*/
|
||||
int
|
||||
findaction(char *actname)
|
||||
findaction(actname)
|
||||
char *actname;
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; currtable->names[i].cn_name != NULL; i++)
|
||||
if (strcmp(currtable->names[i].cn_name, actname) == 0)
|
||||
return (currtable->names[i].cn_action);
|
||||
lk_error("unknown action");
|
||||
error("unknown action", NULL_PARG);
|
||||
return (A_INVALID);
|
||||
}
|
||||
|
||||
static void
|
||||
lk_error(char *s)
|
||||
void
|
||||
error(s, parg)
|
||||
char *s;
|
||||
PARG *parg;
|
||||
{
|
||||
fprintf(stderr, "line %d: %s\n", linenum, s);
|
||||
errors++;
|
||||
(void) parg;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
parse_cmdline(char *p)
|
||||
parse_cmdline(p)
|
||||
char *p;
|
||||
{
|
||||
int cmdlen;
|
||||
char *actname;
|
||||
@ -631,7 +654,7 @@ parse_cmdline(char *p)
|
||||
s = tstr(&p, 1);
|
||||
cmdlen += (int) strlen(s);
|
||||
if (cmdlen > MAX_CMDLEN)
|
||||
lk_error("command too long");
|
||||
error("command too long", NULL_PARG);
|
||||
else
|
||||
add_cmd_str(s);
|
||||
} while (*p != ' ' && *p != '\t' && *p != '\0');
|
||||
@ -648,7 +671,7 @@ parse_cmdline(char *p)
|
||||
p = skipsp(p);
|
||||
if (*p == '\0')
|
||||
{
|
||||
lk_error("missing action");
|
||||
error("missing action", NULL_PARG);
|
||||
return;
|
||||
}
|
||||
actname = p;
|
||||
@ -683,7 +706,8 @@ parse_cmdline(char *p)
|
||||
}
|
||||
|
||||
void
|
||||
parse_varline(char *p)
|
||||
parse_varline(p)
|
||||
char *p;
|
||||
{
|
||||
char *s;
|
||||
|
||||
@ -700,7 +724,7 @@ parse_varline(char *p)
|
||||
p = skipsp(p);
|
||||
if (*p++ != '=')
|
||||
{
|
||||
lk_error("missing =");
|
||||
error("missing =", NULL_PARG);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -719,7 +743,8 @@ parse_varline(char *p)
|
||||
* Parse a line from the lesskey file.
|
||||
*/
|
||||
void
|
||||
parse_line(char *line)
|
||||
parse_line(line)
|
||||
char *line;
|
||||
{
|
||||
char *p;
|
||||
|
||||
@ -744,7 +769,9 @@ parse_line(char *line)
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
{
|
||||
FILE *desc;
|
||||
FILE *out;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 1984-2015 Mark Nudelman
|
||||
* Copyright (C) 1984-2017 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.
|
||||
|
@ -1,4 +1,4 @@
|
||||
.TH LESSKEY 1 "Version 481: 31 Aug 2015"
|
||||
.TH LESSKEY 1 "Version 491: 07 Apr 2017"
|
||||
.SH NAME
|
||||
lesskey \- specify key bindings for less
|
||||
.SH SYNOPSIS
|
||||
@ -134,7 +134,7 @@ default command keys used by less:
|
||||
\en forw-line
|
||||
e forw-line
|
||||
j forw-line
|
||||
\ekd forw-line
|
||||
\ekd forw-line
|
||||
^E forw-line
|
||||
^N forw-line
|
||||
k back-line
|
||||
@ -149,15 +149,15 @@ default command keys used by less:
|
||||
^D forw-scroll
|
||||
u back-scroll
|
||||
^U back-scroll
|
||||
\e40 forw-screen
|
||||
\e40 forw-screen
|
||||
f forw-screen
|
||||
^F forw-screen
|
||||
^V forw-screen
|
||||
\ekD forw-screen
|
||||
\ekD forw-screen
|
||||
b back-screen
|
||||
^B back-screen
|
||||
\eev back-screen
|
||||
\ekU back-screen
|
||||
\ekU back-screen
|
||||
z forw-window
|
||||
w back-window
|
||||
\ee\e40 forw-screen-force
|
||||
@ -169,7 +169,7 @@ default command keys used by less:
|
||||
^L repaint
|
||||
\eeu undo-hilite
|
||||
g goto-line
|
||||
\ekh goto-line
|
||||
\ekh goto-line
|
||||
< goto-line
|
||||
\ee< goto-line
|
||||
p percent
|
||||
@ -180,6 +180,8 @@ default command keys used by less:
|
||||
\ee) right-scroll
|
||||
\ekl left-scroll
|
||||
\ekr right-scroll
|
||||
\ee{ no-scroll
|
||||
\ee} end-scroll
|
||||
{ forw-bracket {}
|
||||
} back-bracket {}
|
||||
( forw-bracket ()
|
||||
@ -191,7 +193,7 @@ default command keys used by less:
|
||||
G goto-end
|
||||
\ee> goto-end
|
||||
> goto-end
|
||||
\eke goto-end
|
||||
\eke goto-end
|
||||
\eeG goto-end-buffered
|
||||
= status
|
||||
^G status
|
||||
@ -359,7 +361,7 @@ which start with a NUL character (0).
|
||||
This NUL character should be represented as \e340 in a lesskey file.
|
||||
|
||||
.SH COPYRIGHT
|
||||
Copyright (C) 1984-2015 Mark Nudelman
|
||||
Copyright (C) 1984-2017 Mark Nudelman
|
||||
.PP
|
||||
less is part of the GNU project and is free software.
|
||||
You can redistribute it and/or modify it
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 1984-2015 Mark Nudelman
|
||||
* Copyright (C) 1984-2017 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.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 1984-2015 Mark Nudelman
|
||||
* Copyright (C) 1984-2017 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.
|
||||
@ -16,6 +16,7 @@
|
||||
|
||||
#include "less.h"
|
||||
#include "charset.h"
|
||||
#include "position.h"
|
||||
|
||||
static char *linebuf = NULL; /* Buffer which holds the current output line */
|
||||
static char *attr = NULL; /* Extension of linebuf to hold attributes */
|
||||
@ -40,9 +41,9 @@ static POSITION pendpos;
|
||||
static char *end_ansi_chars;
|
||||
static char *mid_ansi_chars;
|
||||
|
||||
static int attr_swidth(int);
|
||||
static int attr_ewidth(int);
|
||||
static int do_append(LWCHAR, char *, POSITION);
|
||||
static int attr_swidth();
|
||||
static int attr_ewidth();
|
||||
static int do_append();
|
||||
|
||||
extern int sigs;
|
||||
extern int bs_mode;
|
||||
@ -70,7 +71,7 @@ static POSITION mbc_pos;
|
||||
* Initialize from environment variables.
|
||||
*/
|
||||
public void
|
||||
init_line(void)
|
||||
init_line()
|
||||
{
|
||||
end_ansi_chars = lgetenv("LESSANSIENDCHARS");
|
||||
if (end_ansi_chars == NULL || *end_ansi_chars == '\0')
|
||||
@ -89,7 +90,7 @@ init_line(void)
|
||||
* Expand the line buffer.
|
||||
*/
|
||||
static int
|
||||
expand_linebuf(void)
|
||||
expand_linebuf()
|
||||
{
|
||||
/* Double the size of the line buffer. */
|
||||
int new_size = size_linebuf * 2;
|
||||
@ -137,7 +138,8 @@ expand_linebuf(void)
|
||||
* Is a character ASCII?
|
||||
*/
|
||||
public int
|
||||
is_ascii_char(LWCHAR ch)
|
||||
is_ascii_char(ch)
|
||||
LWCHAR ch;
|
||||
{
|
||||
return (ch <= 0x7F);
|
||||
}
|
||||
@ -146,7 +148,7 @@ is_ascii_char(LWCHAR ch)
|
||||
* Rewind the line buffer.
|
||||
*/
|
||||
public void
|
||||
prewind(void)
|
||||
prewind()
|
||||
{
|
||||
curr = 0;
|
||||
column = 0;
|
||||
@ -165,7 +167,8 @@ prewind(void)
|
||||
* Insert the line number (of the given position) into the line buffer.
|
||||
*/
|
||||
public void
|
||||
plinenum(POSITION pos)
|
||||
plinenum(pos)
|
||||
POSITION pos;
|
||||
{
|
||||
LINENUM linenum = 0;
|
||||
int i;
|
||||
@ -213,7 +216,7 @@ plinenum(POSITION pos)
|
||||
sprintf(linebuf+curr, "%*s ", n, buf);
|
||||
n++; /* One space after the line number. */
|
||||
for (i = 0; i < n; i++)
|
||||
attr[curr+i] = AT_NORMAL;
|
||||
attr[curr+i] = AT_BOLD;
|
||||
curr += n;
|
||||
column += n;
|
||||
lmargin += n;
|
||||
@ -235,7 +238,8 @@ plinenum(POSITION pos)
|
||||
* This means discarding N printable chars at the start of the buffer.
|
||||
*/
|
||||
static void
|
||||
pshift(int shift)
|
||||
pshift(shift)
|
||||
int shift;
|
||||
{
|
||||
LWCHAR prev_ch = 0;
|
||||
unsigned char c;
|
||||
@ -352,7 +356,7 @@ pshift(int shift)
|
||||
*
|
||||
*/
|
||||
public void
|
||||
pshift_all(void)
|
||||
pshift_all()
|
||||
{
|
||||
pshift(column);
|
||||
}
|
||||
@ -362,7 +366,8 @@ pshift_all(void)
|
||||
* for a given character attribute.
|
||||
*/
|
||||
static int
|
||||
attr_swidth(int a)
|
||||
attr_swidth(a)
|
||||
int a;
|
||||
{
|
||||
int w = 0;
|
||||
|
||||
@ -385,7 +390,8 @@ attr_swidth(int a)
|
||||
* for a given character attribute.
|
||||
*/
|
||||
static int
|
||||
attr_ewidth(int a)
|
||||
attr_ewidth(a)
|
||||
int a;
|
||||
{
|
||||
int w = 0;
|
||||
|
||||
@ -410,7 +416,10 @@ attr_ewidth(int a)
|
||||
* attribute sequence to be inserted, so this must be taken into account.
|
||||
*/
|
||||
static int
|
||||
pwidth(LWCHAR ch, int a, LWCHAR prev_ch)
|
||||
pwidth(ch, a, prev_ch)
|
||||
LWCHAR ch;
|
||||
int a;
|
||||
LWCHAR prev_ch;
|
||||
{
|
||||
int w;
|
||||
|
||||
@ -471,10 +480,10 @@ pwidth(LWCHAR ch, int a, LWCHAR prev_ch)
|
||||
* Return 1 if one is found.
|
||||
*/
|
||||
static int
|
||||
backc(void)
|
||||
backc()
|
||||
{
|
||||
LWCHAR prev_ch;
|
||||
constant char *p = linebuf + curr;
|
||||
char *p = linebuf + curr;
|
||||
LWCHAR ch = step_char(&p, -1, linebuf + lmargin);
|
||||
int width;
|
||||
|
||||
@ -499,9 +508,9 @@ backc(void)
|
||||
* Are we currently within a recognized ANSI escape sequence?
|
||||
*/
|
||||
static int
|
||||
in_ansi_esc_seq(void)
|
||||
in_ansi_esc_seq()
|
||||
{
|
||||
constant char *p;
|
||||
char *p;
|
||||
|
||||
/*
|
||||
* Search backwards for either an ESC (which means we ARE in a seq);
|
||||
@ -522,7 +531,8 @@ in_ansi_esc_seq(void)
|
||||
* Is a character the end of an ANSI escape sequence?
|
||||
*/
|
||||
public int
|
||||
is_ansi_end(LWCHAR ch)
|
||||
is_ansi_end(ch)
|
||||
LWCHAR ch;
|
||||
{
|
||||
if (!is_ascii_char(ch))
|
||||
return (0);
|
||||
@ -533,7 +543,8 @@ is_ansi_end(LWCHAR ch)
|
||||
*
|
||||
*/
|
||||
public int
|
||||
is_ansi_middle(LWCHAR ch)
|
||||
is_ansi_middle(ch)
|
||||
LWCHAR ch;
|
||||
{
|
||||
if (!is_ascii_char(ch))
|
||||
return (0);
|
||||
@ -551,7 +562,11 @@ is_ansi_middle(LWCHAR ch)
|
||||
} while (0)
|
||||
|
||||
static int
|
||||
store_char(LWCHAR ch, int a, char *rep, POSITION pos)
|
||||
store_char(ch, a, rep, pos)
|
||||
LWCHAR ch;
|
||||
int a;
|
||||
char *rep;
|
||||
POSITION pos;
|
||||
{
|
||||
int w;
|
||||
int replen;
|
||||
@ -585,7 +600,7 @@ store_char(LWCHAR ch, int a, char *rep, POSITION pos)
|
||||
{
|
||||
if (!is_ansi_end(ch) && !is_ansi_middle(ch)) {
|
||||
/* Remove whole unrecognized sequence. */
|
||||
constant char *p = &linebuf[curr];
|
||||
char *p = &linebuf[curr];
|
||||
LWCHAR bch;
|
||||
do {
|
||||
bch = step_char(&p, -1, linebuf);
|
||||
@ -603,7 +618,7 @@ store_char(LWCHAR ch, int a, char *rep, POSITION pos)
|
||||
}
|
||||
else
|
||||
{
|
||||
constant char *p = &linebuf[curr];
|
||||
char *p = &linebuf[curr];
|
||||
LWCHAR prev_ch = step_char(&p, -1, linebuf);
|
||||
w = pwidth(ch, a, prev_ch);
|
||||
}
|
||||
@ -651,7 +666,9 @@ store_char(LWCHAR ch, int a, char *rep, POSITION pos)
|
||||
do { if (store_tab((a),(pos))) return (1); } while (0)
|
||||
|
||||
static int
|
||||
store_tab(int attr, POSITION pos)
|
||||
store_tab(attr, pos)
|
||||
int attr;
|
||||
POSITION pos;
|
||||
{
|
||||
int to_tab = column + cshift - lmargin;
|
||||
int i;
|
||||
@ -680,7 +697,9 @@ store_tab(int attr, POSITION pos)
|
||||
do { if (store_prchar((c), (pos))) return 1; } while (0)
|
||||
|
||||
static int
|
||||
store_prchar(LWCHAR c, POSITION pos)
|
||||
store_prchar(c, pos)
|
||||
LWCHAR c;
|
||||
POSITION pos;
|
||||
{
|
||||
char *s;
|
||||
|
||||
@ -704,7 +723,8 @@ store_prchar(LWCHAR c, POSITION pos)
|
||||
}
|
||||
|
||||
static int
|
||||
flush_mbc_buf(POSITION pos)
|
||||
flush_mbc_buf(pos)
|
||||
POSITION pos;
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -721,7 +741,9 @@ flush_mbc_buf(POSITION pos)
|
||||
* Returns 0 if ok, 1 if couldn't fit in buffer.
|
||||
*/
|
||||
public int
|
||||
pappend(unsigned char c, POSITION pos)
|
||||
pappend(c, pos)
|
||||
unsigned char c;
|
||||
POSITION pos;
|
||||
{
|
||||
int r;
|
||||
|
||||
@ -824,7 +846,10 @@ pappend(unsigned char c, POSITION pos)
|
||||
}
|
||||
|
||||
static int
|
||||
do_append(LWCHAR ch, char *rep, POSITION pos)
|
||||
do_append(ch, rep, pos)
|
||||
LWCHAR ch;
|
||||
char *rep;
|
||||
POSITION pos;
|
||||
{
|
||||
int a;
|
||||
LWCHAR prev_ch;
|
||||
@ -961,7 +986,7 @@ do_append(LWCHAR ch, char *rep, POSITION pos)
|
||||
*
|
||||
*/
|
||||
public int
|
||||
pflushmbc(void)
|
||||
pflushmbc()
|
||||
{
|
||||
int r = 0;
|
||||
|
||||
@ -978,7 +1003,9 @@ pflushmbc(void)
|
||||
* Terminate the line in the line buffer.
|
||||
*/
|
||||
public void
|
||||
pdone(int endline, int forw)
|
||||
pdone(endline, forw)
|
||||
int endline;
|
||||
int forw;
|
||||
{
|
||||
(void) pflushmbc();
|
||||
|
||||
@ -1055,7 +1082,8 @@ pdone(int endline, int forw)
|
||||
*
|
||||
*/
|
||||
public void
|
||||
set_status_col(char c)
|
||||
set_status_col(c)
|
||||
char c;
|
||||
{
|
||||
linebuf[0] = c;
|
||||
attr[0] = AT_NORMAL|AT_HILITE;
|
||||
@ -1067,7 +1095,9 @@ set_status_col(char c)
|
||||
* and the character attribute in *ap.
|
||||
*/
|
||||
public int
|
||||
gline(int i, int *ap)
|
||||
gline(i, ap)
|
||||
int i;
|
||||
int *ap;
|
||||
{
|
||||
if (is_null_line)
|
||||
{
|
||||
@ -1097,7 +1127,7 @@ gline(int i, int *ap)
|
||||
* Indicate that there is no current line.
|
||||
*/
|
||||
public void
|
||||
null_line(void)
|
||||
null_line()
|
||||
{
|
||||
is_null_line = 1;
|
||||
cshift = 0;
|
||||
@ -1109,7 +1139,10 @@ null_line(void)
|
||||
* {{ This is supposed to be more efficient than forw_line(). }}
|
||||
*/
|
||||
public POSITION
|
||||
forw_raw_line(POSITION curr_pos, char **linep, int *line_lenp)
|
||||
forw_raw_line(curr_pos, linep, line_lenp)
|
||||
POSITION curr_pos;
|
||||
char **linep;
|
||||
int *line_lenp;
|
||||
{
|
||||
int n;
|
||||
int c;
|
||||
@ -1155,7 +1188,10 @@ forw_raw_line(POSITION curr_pos, char **linep, int *line_lenp)
|
||||
* {{ This is supposed to be more efficient than back_line(). }}
|
||||
*/
|
||||
public POSITION
|
||||
back_raw_line(POSITION curr_pos, char **linep, int *line_lenp)
|
||||
back_raw_line(curr_pos, linep, line_lenp)
|
||||
POSITION curr_pos;
|
||||
char **linep;
|
||||
int *line_lenp;
|
||||
{
|
||||
int n;
|
||||
int c;
|
||||
@ -1220,3 +1256,30 @@ back_raw_line(POSITION curr_pos, char **linep, int *line_lenp)
|
||||
*line_lenp = size_linebuf - 1 - n;
|
||||
return (new_pos);
|
||||
}
|
||||
|
||||
/*
|
||||
* Find the shift necessary to show the end of the longest displayed line.
|
||||
*/
|
||||
public int
|
||||
rrshift()
|
||||
{
|
||||
POSITION pos;
|
||||
int save_width;
|
||||
int line;
|
||||
int longest = 0;
|
||||
|
||||
save_width = sc_width;
|
||||
sc_width = INT_MAX;
|
||||
hshift = 0;
|
||||
pos = position(TOP);
|
||||
for (line = 0; line < sc_height && pos != NULL_POSITION; line++)
|
||||
{
|
||||
pos = forw_line(pos);
|
||||
if (column > longest)
|
||||
longest = column;
|
||||
}
|
||||
sc_width = save_width;
|
||||
if (longest < sc_width)
|
||||
return 0;
|
||||
return longest - sc_width;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 1984-2015 Mark Nudelman
|
||||
* Copyright (C) 1984-2017 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.
|
||||
@ -73,7 +73,7 @@ extern int screen_trashed;
|
||||
* Initialize the line number structures.
|
||||
*/
|
||||
public void
|
||||
clr_linenum(void)
|
||||
clr_linenum()
|
||||
{
|
||||
struct linenum_info *p;
|
||||
|
||||
@ -101,7 +101,8 @@ clr_linenum(void)
|
||||
* Calculate the gap for an entry.
|
||||
*/
|
||||
static void
|
||||
calcgap(struct linenum_info *p)
|
||||
calcgap(p)
|
||||
struct linenum_info *p;
|
||||
{
|
||||
/*
|
||||
* Don't bother to compute a gap for the anchor.
|
||||
@ -120,7 +121,9 @@ calcgap(struct linenum_info *p)
|
||||
* FIRST character in the specified line.
|
||||
*/
|
||||
public void
|
||||
add_lnum(LINENUM linenum, POSITION pos)
|
||||
add_lnum(linenum, pos)
|
||||
LINENUM linenum;
|
||||
POSITION pos;
|
||||
{
|
||||
struct linenum_info *p;
|
||||
struct linenum_info *new;
|
||||
@ -206,7 +209,7 @@ add_lnum(LINENUM linenum, POSITION pos)
|
||||
* line number, print a message to tell the user what we're doing.
|
||||
*/
|
||||
static void
|
||||
longloopmessage(void)
|
||||
longloopmessage()
|
||||
{
|
||||
ierror("Calculating line numbers", NULL_PARG);
|
||||
}
|
||||
@ -217,7 +220,7 @@ static time_type startime;
|
||||
#endif
|
||||
|
||||
static void
|
||||
longish(void)
|
||||
longish()
|
||||
{
|
||||
#if HAVE_TIME
|
||||
if (loopcount >= 0 && ++loopcount > 100)
|
||||
@ -243,7 +246,7 @@ longish(void)
|
||||
* a lengthy line number calculation.
|
||||
*/
|
||||
static void
|
||||
abort_long(void)
|
||||
abort_long()
|
||||
{
|
||||
if (linenums == OPT_ONPLUS)
|
||||
/*
|
||||
@ -259,7 +262,8 @@ abort_long(void)
|
||||
* Return 0 if we can't figure it out.
|
||||
*/
|
||||
public LINENUM
|
||||
find_linenum(POSITION pos)
|
||||
find_linenum(pos)
|
||||
POSITION pos;
|
||||
{
|
||||
struct linenum_info *p;
|
||||
LINENUM linenum;
|
||||
@ -373,7 +377,8 @@ find_linenum(POSITION pos)
|
||||
* Return NULL_POSITION if we can't figure it out.
|
||||
*/
|
||||
public POSITION
|
||||
find_pos(LINENUM linenum)
|
||||
find_pos(linenum)
|
||||
LINENUM linenum;
|
||||
{
|
||||
struct linenum_info *p;
|
||||
POSITION cpos;
|
||||
@ -445,7 +450,8 @@ find_pos(LINENUM linenum)
|
||||
* the "current" line (e.g. TOP, BOTTOM, MIDDLE, etc).
|
||||
*/
|
||||
public LINENUM
|
||||
currline(int where)
|
||||
currline(where)
|
||||
int where;
|
||||
{
|
||||
POSITION pos;
|
||||
POSITION len;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 1984-2015 Mark Nudelman
|
||||
* Copyright (C) 1984-2017 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.
|
||||
@ -38,7 +38,9 @@ extern IFILE curr_ifile;
|
||||
* Like plain "system()", but handles resetting terminal modes, etc.
|
||||
*/
|
||||
public void
|
||||
lsystem(char *cmd, char *donemsg)
|
||||
lsystem(cmd, donemsg)
|
||||
char *cmd;
|
||||
char *donemsg;
|
||||
{
|
||||
int inp;
|
||||
#if HAVE_SHELL
|
||||
@ -248,7 +250,9 @@ lsystem(char *cmd, char *donemsg)
|
||||
* the whole current screen is piped.
|
||||
*/
|
||||
public int
|
||||
pipe_mark(int c, char *cmd)
|
||||
pipe_mark(c, cmd)
|
||||
int c;
|
||||
char *cmd;
|
||||
{
|
||||
POSITION mpos, tpos, bpos;
|
||||
|
||||
@ -280,7 +284,10 @@ pipe_mark(int c, char *cmd)
|
||||
* Feed it the file contents between the positions spos and epos.
|
||||
*/
|
||||
public int
|
||||
pipe_data(char *cmd, POSITION spos, POSITION epos)
|
||||
pipe_data(cmd, spos, epos)
|
||||
char *cmd;
|
||||
POSITION spos;
|
||||
POSITION epos;
|
||||
{
|
||||
FILE *f;
|
||||
int c;
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* $FreeBSD$ */
|
||||
/*
|
||||
* Copyright (C) 1984-2015 Mark Nudelman
|
||||
* Copyright (C) 1984-2017 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,11 +54,13 @@ extern int jump_sline;
|
||||
static char consoleTitle[256];
|
||||
#endif
|
||||
|
||||
public int line_count;
|
||||
extern int less_is_more;
|
||||
extern int missing_cap;
|
||||
extern int know_dumb;
|
||||
extern int no_init;
|
||||
extern int pr_type;
|
||||
extern int quit_if_one_screen;
|
||||
|
||||
|
||||
/*
|
||||
@ -283,10 +285,25 @@ main(argc, argv)
|
||||
{
|
||||
if (edit_stdin()) /* Edit standard input */
|
||||
quit(QUIT_ERROR);
|
||||
if (quit_if_one_screen)
|
||||
line_count = get_line_count();
|
||||
} else
|
||||
{
|
||||
if (edit_first()) /* Edit first valid file in cmd line */
|
||||
quit(QUIT_ERROR);
|
||||
/*
|
||||
* In case that we have only one file and -F, have to get a line
|
||||
* count fot init(). If the line count is less then a height of a term,
|
||||
* the content of the file is printed out and then less quits. Otherwise
|
||||
* -F can not be used
|
||||
*/
|
||||
if (quit_if_one_screen)
|
||||
{
|
||||
if (nifile() == 1)
|
||||
line_count = get_line_count();
|
||||
else /* In case more than one file, -F can not be used */
|
||||
quit_if_one_screen = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
init();
|
||||
@ -301,7 +318,8 @@ main(argc, argv)
|
||||
* (that is, to a buffer allocated by calloc).
|
||||
*/
|
||||
public char *
|
||||
save(constant char *s)
|
||||
save(s)
|
||||
constant char *s;
|
||||
{
|
||||
char *p;
|
||||
|
||||
@ -315,7 +333,9 @@ save(constant char *s)
|
||||
* Like calloc(), but never returns an error (NULL).
|
||||
*/
|
||||
public VOID_POINTER
|
||||
ecalloc(int count, unsigned int size)
|
||||
ecalloc(count, size)
|
||||
int count;
|
||||
unsigned int size;
|
||||
{
|
||||
VOID_POINTER p;
|
||||
|
||||
@ -332,7 +352,8 @@ ecalloc(int count, unsigned int size)
|
||||
* Skip leading spaces in a string.
|
||||
*/
|
||||
public char *
|
||||
skipsp(char *s)
|
||||
skipsp(s)
|
||||
char *s;
|
||||
{
|
||||
while (*s == ' ' || *s == '\t')
|
||||
s++;
|
||||
@ -345,7 +366,10 @@ skipsp(char *s)
|
||||
* character; the remainder of the first string may be either case.
|
||||
*/
|
||||
public int
|
||||
sprefix(char *ps, char *s, int uppercase)
|
||||
sprefix(ps, s, uppercase)
|
||||
char *ps;
|
||||
char *s;
|
||||
int uppercase;
|
||||
{
|
||||
int c;
|
||||
int sc;
|
||||
@ -375,7 +399,8 @@ sprefix(char *ps, char *s, int uppercase)
|
||||
* Exit the program.
|
||||
*/
|
||||
public void
|
||||
quit(int status)
|
||||
quit(status)
|
||||
int status;
|
||||
{
|
||||
static int save_status;
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 1984-2015 Mark Nudelman
|
||||
* Copyright (C) 1984-2017 Mark Nudelman
|
||||
*
|
||||
* You may distribute under the terms of either the GNU General Public
|
||||
* License or the Less License, as specified in the README file.
|
||||
@ -27,7 +27,7 @@ static struct mark marks[NMARKS];
|
||||
* Initialize the mark table to show no marks are set.
|
||||
*/
|
||||
public void
|
||||
init_mark(void)
|
||||
init_mark()
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -39,7 +39,8 @@ init_mark(void)
|
||||
* See if a mark letter is valid (between a and z).
|
||||
*/
|
||||
static struct mark *
|
||||
getumark(int c)
|
||||
getumark(c)
|
||||
int c;
|
||||
{
|
||||
if (c >= 'a' && c <= 'z')
|
||||
return (&marks[c-'a']);
|
||||
@ -57,7 +58,8 @@ getumark(int c)
|
||||
* or may be constructed on the fly for certain characters like ^, $.
|
||||
*/
|
||||
static struct mark *
|
||||
getmark(int c)
|
||||
getmark(c)
|
||||
int c;
|
||||
{
|
||||
struct mark *m;
|
||||
static struct mark sm;
|
||||
@ -122,7 +124,8 @@ getmark(int c)
|
||||
* Is a mark letter is invalid?
|
||||
*/
|
||||
public int
|
||||
badmark(int c)
|
||||
badmark(c)
|
||||
int c;
|
||||
{
|
||||
return (getmark(c) == NULL);
|
||||
}
|
||||
@ -131,7 +134,8 @@ badmark(int c)
|
||||
* Set a user-defined mark.
|
||||
*/
|
||||
public void
|
||||
setmark(int c)
|
||||
setmark(c)
|
||||
int c;
|
||||
{
|
||||
struct mark *m;
|
||||
struct scrpos scrpos;
|
||||
@ -148,7 +152,7 @@ setmark(int c)
|
||||
* Set lmark (the mark named by the apostrophe).
|
||||
*/
|
||||
public void
|
||||
lastmark(void)
|
||||
lastmark()
|
||||
{
|
||||
struct scrpos scrpos;
|
||||
|
||||
@ -165,7 +169,8 @@ lastmark(void)
|
||||
* Go to a mark.
|
||||
*/
|
||||
public void
|
||||
gomark(int c)
|
||||
gomark(c)
|
||||
int c;
|
||||
{
|
||||
struct mark *m;
|
||||
struct scrpos scrpos;
|
||||
@ -212,7 +217,8 @@ gomark(int c)
|
||||
* because it's always the first non-blank line on the screen.
|
||||
*/
|
||||
public POSITION
|
||||
markpos(int c)
|
||||
markpos(c)
|
||||
int c;
|
||||
{
|
||||
struct mark *m;
|
||||
|
||||
@ -232,7 +238,8 @@ markpos(int c)
|
||||
* Clear the marks associated with a specified ifile.
|
||||
*/
|
||||
public void
|
||||
unmark(IFILE ifile)
|
||||
unmark(ifile)
|
||||
IFILE ifile;
|
||||
{
|
||||
int i;
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 1984-2015 Mark Nudelman
|
||||
* Copyright (C) 1984-2017 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.
|
||||
@ -18,7 +18,9 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
{
|
||||
int ch;
|
||||
int prevch;
|
||||
|
@ -4,14 +4,14 @@ use strict;
|
||||
my $USAGE = <<__EOF__;
|
||||
usage: mkutable [-n] [-f#] type... [--] [<] UnicodeData.txt
|
||||
-n = take non-matching types
|
||||
-f = zero-based type field (default 2)
|
||||
-f = zero-based type field (default 2)
|
||||
__EOF__
|
||||
|
||||
use vars qw( $opt_f $opt_n );
|
||||
use Getopt::Std;
|
||||
my $type_field = 2;
|
||||
|
||||
exit (main() ? 1 : 0);
|
||||
exit (main() ? 0 : 1);
|
||||
|
||||
sub main {
|
||||
my $date = `date`;
|
||||
@ -28,48 +28,58 @@ sub main {
|
||||
$types{$arg} = 1;
|
||||
}
|
||||
my %out = ( 'types' => \%types );
|
||||
my $last_code = 0;
|
||||
|
||||
print $header;
|
||||
my $last_code = 0;
|
||||
while (<>) {
|
||||
chomp;
|
||||
s/#.*//;
|
||||
my @fields = split /;/;
|
||||
next if not @fields;
|
||||
my $code = hex $fields[0];
|
||||
my ($lo_code, $hi_code);
|
||||
my $codes = $fields[0];
|
||||
if ($codes =~ /(\w+)\.\.(\w+)/) {
|
||||
$lo_code = hex $1;
|
||||
$hi_code = hex $2;
|
||||
} else {
|
||||
$lo_code = $hi_code = hex $fields[0];
|
||||
}
|
||||
my $type = $fields[$type_field];
|
||||
$type =~ s/\s//g;
|
||||
while (++$last_code < $code) {
|
||||
output(\%out, $last_code, '?');
|
||||
for ($last_code = $lo_code; $last_code <= $hi_code; ++$last_code) {
|
||||
output(\%out, $last_code, $type);
|
||||
}
|
||||
output(\%out, $code, $type);
|
||||
}
|
||||
output(\%out, $last_code+1, '?');
|
||||
output(\%out, $last_code);
|
||||
return 1;
|
||||
}
|
||||
|
||||
sub output {
|
||||
my ($out, $code, $type) = @_;
|
||||
my $match = ${${$out}{types}}{$type};
|
||||
my $type_change = (not $$out{start_type} or $type ne $$out{start_type});
|
||||
$match = not $match if $opt_n;
|
||||
if ($match and (not $$out{in_run} or $type_change)) {
|
||||
end_run($out, $code-1);
|
||||
my $type_ok = ($type and ${${$out}{types}}{$type});
|
||||
$type_ok = not $type_ok if $opt_n;
|
||||
my $prev_code = $$out{prev_code};
|
||||
|
||||
if (not $type_ok) {
|
||||
end_run($out, $prev_code);
|
||||
} elsif (not $$out{in_run} or $type ne $$out{run_type} or $code != $prev_code+1) {
|
||||
end_run($out, $prev_code);
|
||||
start_run($out, $code, $type);
|
||||
} elsif (not $match and $$out{in_run}) {
|
||||
end_run($out, $code-1);
|
||||
}
|
||||
$$out{prev_code} = $code;
|
||||
}
|
||||
|
||||
sub start_run {
|
||||
my ($out, $code, $type) = @_;
|
||||
$$out{start_code} = $code;
|
||||
$$out{start_type} = $type;
|
||||
$$out{prev_code} = $code;
|
||||
$$out{run_type} = $type;
|
||||
$$out{in_run} = 1;
|
||||
}
|
||||
|
||||
sub end_run {
|
||||
my ($out, $code) = @_;
|
||||
return if not $$out{in_run};
|
||||
printf "\t{ 0x%04x, 0x%04x }, /* %s */\n", $$out{start_code}, $code, $$out{start_type};
|
||||
printf "\t{ 0x%04x, 0x%04x }, /* %s */\n", $$out{start_code}, $code, $$out{run_type};
|
||||
$$out{in_run} = 0;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 1984-2015 Mark Nudelman
|
||||
* Copyright (C) 1984-2017 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.
|
||||
@ -47,9 +47,9 @@ extern char *every_first_cmd;
|
||||
extern IFILE curr_ifile;
|
||||
extern char version[];
|
||||
extern int jump_sline;
|
||||
extern int jump_sline_fraction;
|
||||
extern long jump_sline_fraction;
|
||||
extern int shift_count;
|
||||
extern int shift_count_fraction;
|
||||
extern long shift_count_fraction;
|
||||
extern int less_is_more;
|
||||
#if LOGFILE
|
||||
extern char *namelogfile;
|
||||
@ -67,6 +67,7 @@ extern int bo_fg_color, bo_bg_color;
|
||||
extern int ul_fg_color, ul_bg_color;
|
||||
extern int so_fg_color, so_bg_color;
|
||||
extern int bl_fg_color, bl_bg_color;
|
||||
extern int sgr_mode;
|
||||
#endif
|
||||
|
||||
|
||||
@ -75,7 +76,9 @@ extern int bl_fg_color, bl_bg_color;
|
||||
* Handler for -o option.
|
||||
*/
|
||||
public void
|
||||
opt_o(int type, char *s)
|
||||
opt_o(type, s)
|
||||
int type;
|
||||
char *s;
|
||||
{
|
||||
PARG parg;
|
||||
|
||||
@ -123,7 +126,9 @@ opt_o(int type, char *s)
|
||||
* Handler for -O option.
|
||||
*/
|
||||
public void
|
||||
opt__O(int type, char *s)
|
||||
opt__O(type, s)
|
||||
int type;
|
||||
char *s;
|
||||
{
|
||||
force_logfile = TRUE;
|
||||
opt_o(type, s);
|
||||
@ -134,7 +139,9 @@ opt__O(int type, char *s)
|
||||
* Handlers for -j option.
|
||||
*/
|
||||
public void
|
||||
opt_j(int type, char *s)
|
||||
opt_j(type, s)
|
||||
int type;
|
||||
char *s;
|
||||
{
|
||||
PARG parg;
|
||||
char buf[16];
|
||||
@ -173,7 +180,7 @@ opt_j(int type, char *s)
|
||||
} else
|
||||
{
|
||||
|
||||
sprintf(buf, ".%06d", jump_sline_fraction);
|
||||
sprintf(buf, ".%06ld", jump_sline_fraction);
|
||||
len = (int) strlen(buf);
|
||||
while (len > 2 && buf[len-1] == '0')
|
||||
len--;
|
||||
@ -186,7 +193,7 @@ opt_j(int type, char *s)
|
||||
}
|
||||
|
||||
public void
|
||||
calc_jump_sline(void)
|
||||
calc_jump_sline()
|
||||
{
|
||||
if (jump_sline_fraction < 0)
|
||||
return;
|
||||
@ -197,7 +204,9 @@ calc_jump_sline(void)
|
||||
* Handlers for -# option.
|
||||
*/
|
||||
public void
|
||||
opt_shift(int type, char *s)
|
||||
opt_shift(type, s)
|
||||
int type;
|
||||
char *s;
|
||||
{
|
||||
PARG parg;
|
||||
char buf[16];
|
||||
@ -236,7 +245,7 @@ opt_shift(int type, char *s)
|
||||
} else
|
||||
{
|
||||
|
||||
sprintf(buf, ".%06d", shift_count_fraction);
|
||||
sprintf(buf, ".%06ld", shift_count_fraction);
|
||||
len = (int) strlen(buf);
|
||||
while (len > 2 && buf[len-1] == '0')
|
||||
len--;
|
||||
@ -248,7 +257,7 @@ opt_shift(int type, char *s)
|
||||
}
|
||||
}
|
||||
public void
|
||||
calc_shift_count(void)
|
||||
calc_shift_count()
|
||||
{
|
||||
if (shift_count_fraction < 0)
|
||||
return;
|
||||
@ -257,7 +266,9 @@ calc_shift_count(void)
|
||||
|
||||
#if USERFILE
|
||||
public void
|
||||
opt_k(int type, char *s)
|
||||
opt_k(type, s)
|
||||
int type;
|
||||
char *s;
|
||||
{
|
||||
PARG parg;
|
||||
|
||||
@ -279,7 +290,9 @@ opt_k(int type, char *s)
|
||||
* Handler for -t option.
|
||||
*/
|
||||
public void
|
||||
opt_t(int type, char *s)
|
||||
opt_t(type, s)
|
||||
int type;
|
||||
char *s;
|
||||
{
|
||||
IFILE save_ifile;
|
||||
POSITION pos;
|
||||
@ -318,7 +331,9 @@ opt_t(int type, char *s)
|
||||
* Handler for -T option.
|
||||
*/
|
||||
public void
|
||||
opt__T(int type, char *s)
|
||||
opt__T(type, s)
|
||||
int type;
|
||||
char *s;
|
||||
{
|
||||
PARG parg;
|
||||
|
||||
@ -345,7 +360,9 @@ opt__T(int type, char *s)
|
||||
* Handler for -p option.
|
||||
*/
|
||||
public void
|
||||
opt_p(int type, char *s)
|
||||
opt_p(type, s)
|
||||
int type;
|
||||
char *s;
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
@ -379,7 +396,9 @@ opt_p(int type, char *s)
|
||||
* Handler for -P option.
|
||||
*/
|
||||
public void
|
||||
opt__P(int type, char *s)
|
||||
opt__P(type, s)
|
||||
int type;
|
||||
char *s;
|
||||
{
|
||||
char **proto;
|
||||
PARG parg;
|
||||
@ -416,7 +435,9 @@ opt__P(int type, char *s)
|
||||
*/
|
||||
/*ARGSUSED*/
|
||||
public void
|
||||
opt_b(int type, char *s)
|
||||
opt_b(type, s)
|
||||
int type;
|
||||
char *s;
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
@ -437,7 +458,9 @@ opt_b(int type, char *s)
|
||||
*/
|
||||
/*ARGSUSED*/
|
||||
public void
|
||||
opt_i(int type, char *s)
|
||||
opt_i(type, s)
|
||||
int type;
|
||||
char *s;
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
@ -455,7 +478,9 @@ opt_i(int type, char *s)
|
||||
*/
|
||||
/*ARGSUSED*/
|
||||
public void
|
||||
opt__V(int type, char *s)
|
||||
opt__V(type, s)
|
||||
int type;
|
||||
char *s;
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
@ -493,7 +518,7 @@ opt__V(int type, char *s)
|
||||
putstr("no ");
|
||||
#endif
|
||||
putstr("regular expressions)\n");
|
||||
putstr("Copyright (C) 1984-2015 Mark Nudelman\n\n");
|
||||
putstr("Copyright (C) 1984-2017 Mark Nudelman\n\n");
|
||||
putstr("less comes with NO WARRANTY, to the extent permitted by law.\n");
|
||||
putstr("For information about the terms of redistribution,\n");
|
||||
putstr("see the file named README in the less distribution.\n");
|
||||
@ -508,7 +533,10 @@ opt__V(int type, char *s)
|
||||
* Parse an MSDOS color descriptor.
|
||||
*/
|
||||
static void
|
||||
colordesc(char *s, int *fg_color, int *bg_color)
|
||||
colordesc(s, fg_color, bg_color)
|
||||
char *s;
|
||||
int *fg_color;
|
||||
int *bg_color;
|
||||
{
|
||||
int fg, bg;
|
||||
int err;
|
||||
@ -542,8 +570,12 @@ colordesc(char *s, int *fg_color, int *bg_color)
|
||||
*/
|
||||
/*ARGSUSED*/
|
||||
public void
|
||||
opt_D(int type, char *s)
|
||||
opt_D(type, s)
|
||||
int type;
|
||||
char *s;
|
||||
{
|
||||
PARG p;
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case INIT:
|
||||
@ -565,8 +597,11 @@ opt_D(int type, char *s)
|
||||
case 's':
|
||||
colordesc(s, &so_fg_color, &so_bg_color);
|
||||
break;
|
||||
case 'a':
|
||||
sgr_mode = !sgr_mode;
|
||||
break;
|
||||
default:
|
||||
error("-D must be followed by n, d, u, k or s", NULL_PARG);
|
||||
error("-D must be followed by n, d, u, k, s or a", NULL_PARG);
|
||||
break;
|
||||
}
|
||||
if (type == TOGGLE)
|
||||
@ -576,6 +611,8 @@ opt_D(int type, char *s)
|
||||
}
|
||||
break;
|
||||
case QUERY:
|
||||
p.p_string = (sgr_mode) ? "on" : "off";
|
||||
error("SGR mode is %s", &p);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -585,7 +622,9 @@ opt_D(int type, char *s)
|
||||
* Handler for the -x option.
|
||||
*/
|
||||
public void
|
||||
opt_x(int type, char *s)
|
||||
opt_x(type, s)
|
||||
int type;
|
||||
char *s;
|
||||
{
|
||||
extern int tabstops[];
|
||||
extern int ntabstops;
|
||||
@ -641,7 +680,9 @@ opt_x(int type, char *s)
|
||||
* Handler for the -" option.
|
||||
*/
|
||||
public void
|
||||
opt_quote(int type, char *s)
|
||||
opt_quote(type, s)
|
||||
int type;
|
||||
char *s;
|
||||
{
|
||||
char buf[3];
|
||||
PARG parg;
|
||||
@ -682,7 +723,9 @@ opt_quote(int type, char *s)
|
||||
*/
|
||||
/*ARGSUSED*/
|
||||
public void
|
||||
opt_query(int type, char *s)
|
||||
opt_query(type, s)
|
||||
int type;
|
||||
char *s;
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
@ -699,7 +742,7 @@ opt_query(int type, char *s)
|
||||
* Get the "screen window" size.
|
||||
*/
|
||||
public int
|
||||
get_swindow(void)
|
||||
get_swindow()
|
||||
{
|
||||
if (swindow > 0)
|
||||
return (swindow);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 1984-2015 Mark Nudelman
|
||||
* Copyright (C) 1984-2017 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,8 +23,8 @@
|
||||
static struct loption *pendopt;
|
||||
public int plusoption = FALSE;
|
||||
|
||||
static char *optstring(char *s, char **p_str, char *printopt, char *validchars);
|
||||
static int flip_triple(int val, int lc);
|
||||
static char *optstring();
|
||||
static int flip_triple();
|
||||
|
||||
extern int screen_trashed;
|
||||
extern int less_is_more;
|
||||
@ -36,7 +36,8 @@ extern int opt_use_backslash;
|
||||
* Return a printable description of an option.
|
||||
*/
|
||||
static char *
|
||||
opt_desc(struct loption *o)
|
||||
opt_desc(o)
|
||||
struct loption *o;
|
||||
{
|
||||
static char buf[OPTNAME_MAX + 10];
|
||||
if (o->oletter == OLETTER_NONE)
|
||||
@ -51,7 +52,8 @@ opt_desc(struct loption *o)
|
||||
* For example, if the option letter is 'x', just return "-x".
|
||||
*/
|
||||
public char *
|
||||
propt(int c)
|
||||
propt(c)
|
||||
int c;
|
||||
{
|
||||
static char buf[8];
|
||||
|
||||
@ -64,7 +66,8 @@ propt(int c)
|
||||
* LESS environment variable) and process it.
|
||||
*/
|
||||
public void
|
||||
scan_option(char *s)
|
||||
scan_option(s)
|
||||
char *s;
|
||||
{
|
||||
struct loption *o;
|
||||
int optc;
|
||||
@ -296,7 +299,11 @@ scan_option(char *s)
|
||||
* OPT_SET set to the inverse of the default value
|
||||
*/
|
||||
public void
|
||||
toggle_option(struct loption *o, int lower, char *s, int how_toggle)
|
||||
toggle_option(o, lower, s, how_toggle)
|
||||
struct loption *o;
|
||||
int lower;
|
||||
char *s;
|
||||
int how_toggle;
|
||||
{
|
||||
int num;
|
||||
int no_prompt;
|
||||
@ -478,7 +485,9 @@ toggle_option(struct loption *o, int lower, char *s, int how_toggle)
|
||||
* "Toggle" a triple-valued option.
|
||||
*/
|
||||
static int
|
||||
flip_triple(int val, int lc)
|
||||
flip_triple(val, lc)
|
||||
int val;
|
||||
int lc;
|
||||
{
|
||||
if (lc)
|
||||
return ((val == OPT_ON) ? OPT_OFF : OPT_ON);
|
||||
@ -490,7 +499,8 @@ flip_triple(int val, int lc)
|
||||
* Determine if an option takes a parameter.
|
||||
*/
|
||||
public int
|
||||
opt_has_param(struct loption *o)
|
||||
opt_has_param(o)
|
||||
struct loption *o;
|
||||
{
|
||||
if (o == NULL)
|
||||
return (0);
|
||||
@ -504,7 +514,8 @@ opt_has_param(struct loption *o)
|
||||
* Only string and number valued options have prompts.
|
||||
*/
|
||||
public char *
|
||||
opt_prompt(struct loption *o)
|
||||
opt_prompt(o)
|
||||
struct loption *o;
|
||||
{
|
||||
if (o == NULL || (o->otype & (STRING|NUMBER)) == 0)
|
||||
return ("?");
|
||||
@ -519,7 +530,7 @@ opt_prompt(struct loption *o)
|
||||
* the previous option.
|
||||
*/
|
||||
public int
|
||||
isoptpending(void)
|
||||
isoptpending()
|
||||
{
|
||||
return (pendopt != NULL);
|
||||
}
|
||||
@ -528,7 +539,8 @@ isoptpending(void)
|
||||
* Print error message about missing string.
|
||||
*/
|
||||
static void
|
||||
nostring(char *printopt)
|
||||
nostring(printopt)
|
||||
char *printopt;
|
||||
{
|
||||
PARG parg;
|
||||
parg.p_string = printopt;
|
||||
@ -539,7 +551,7 @@ nostring(char *printopt)
|
||||
* Print error message if a STRING type option is not followed by a string.
|
||||
*/
|
||||
public void
|
||||
nopendopt(void)
|
||||
nopendopt()
|
||||
{
|
||||
nostring(opt_desc(pendopt));
|
||||
}
|
||||
@ -550,7 +562,11 @@ nopendopt(void)
|
||||
* Return a pointer to the remainder of the string, if any.
|
||||
*/
|
||||
static char *
|
||||
optstring(char *s, char **p_str, char *printopt, char *validchars)
|
||||
optstring(s, p_str, printopt, validchars)
|
||||
char *s;
|
||||
char **p_str;
|
||||
char *printopt;
|
||||
char *validchars;
|
||||
{
|
||||
char *p;
|
||||
char *out;
|
||||
@ -586,7 +602,9 @@ optstring(char *s, char **p_str, char *printopt, char *validchars)
|
||||
/*
|
||||
*/
|
||||
static int
|
||||
num_error(char *printopt, int *errp)
|
||||
num_error(printopt, errp)
|
||||
char *printopt;
|
||||
int *errp;
|
||||
{
|
||||
PARG parg;
|
||||
|
||||
@ -609,7 +627,10 @@ num_error(char *printopt, int *errp)
|
||||
* the char * to point after the translated number.
|
||||
*/
|
||||
public int
|
||||
getnum(char **sp, char *printopt, int *errp)
|
||||
getnum(sp, printopt, errp)
|
||||
char **sp;
|
||||
char *printopt;
|
||||
int *errp;
|
||||
{
|
||||
char *s;
|
||||
int n;
|
||||
@ -643,7 +664,10 @@ getnum(char **sp, char *printopt, int *errp)
|
||||
* That is, if "n" is returned, the fraction intended is n/NUM_FRAC_DENOM.
|
||||
*/
|
||||
public long
|
||||
getfraction(char **sp, char *printopt, int *errp)
|
||||
getfraction(sp, printopt, errp)
|
||||
char **sp;
|
||||
char *printopt;
|
||||
int *errp;
|
||||
{
|
||||
char *s;
|
||||
long frac = 0;
|
||||
@ -675,7 +699,7 @@ getfraction(char **sp, char *printopt, int *errp)
|
||||
* Get the value of the -e flag.
|
||||
*/
|
||||
public int
|
||||
get_quit_at_eof(void)
|
||||
get_quit_at_eof()
|
||||
{
|
||||
if (!less_is_more)
|
||||
return quit_at_eof;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 1984-2015 Mark Nudelman
|
||||
* Copyright (C) 1984-2017 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.
|
||||
@ -60,7 +60,7 @@ struct loption
|
||||
int otype; /* Type of the option */
|
||||
int odefault; /* Default value */
|
||||
int *ovar; /* Pointer to the associated variable */
|
||||
void (*ofunc)(); /* Pointer to special handling function */
|
||||
void (*ofunc) LESSPARAMS((int, char*)); /* Pointer to special handling function */
|
||||
char *odesc[3]; /* Description of each value */
|
||||
};
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 1984-2015 Mark Nudelman
|
||||
* Copyright (C) 1984-2017 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.
|
||||
@ -176,10 +176,10 @@ static struct loption option[] =
|
||||
},
|
||||
#if MSDOS_COMPILER
|
||||
{ 'D', &D__optname,
|
||||
STRING|REPAINT|NO_QUERY, 0, NULL, opt_D,
|
||||
STRING|REPAINT, 0, NULL, opt_D,
|
||||
{
|
||||
"color desc: ",
|
||||
"Ddknsu0123456789.",
|
||||
"Dadknsu0123456789.",
|
||||
NULL
|
||||
}
|
||||
},
|
||||
@ -464,7 +464,7 @@ static struct loption option[] =
|
||||
* Initialize each option to its default value.
|
||||
*/
|
||||
public void
|
||||
init_option(void)
|
||||
init_option()
|
||||
{
|
||||
struct loption *o;
|
||||
char *p;
|
||||
@ -489,7 +489,8 @@ init_option(void)
|
||||
* Find an option in the option table, given its option letter.
|
||||
*/
|
||||
public struct loption *
|
||||
findopt(int c)
|
||||
findopt(c)
|
||||
int c;
|
||||
{
|
||||
struct loption *o;
|
||||
|
||||
@ -507,7 +508,8 @@ findopt(int c)
|
||||
*
|
||||
*/
|
||||
static int
|
||||
is_optchar(char c)
|
||||
is_optchar(c)
|
||||
char c;
|
||||
{
|
||||
if (ASCII_IS_UPPER(c))
|
||||
return 1;
|
||||
@ -525,7 +527,10 @@ is_optchar(char c)
|
||||
* p_oname if non-NULL is set to point to the full option name.
|
||||
*/
|
||||
public struct loption *
|
||||
findopt_name(char **p_optname, char **p_oname, int *p_err)
|
||||
findopt_name(p_optname, p_oname, p_err)
|
||||
char **p_optname;
|
||||
char **p_oname;
|
||||
int *p_err;
|
||||
{
|
||||
char *optname = *p_optname;
|
||||
struct loption *o;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 1984-2015 Mark Nudelman
|
||||
* Copyright (C) 1984-2017 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.
|
||||
@ -60,7 +60,10 @@ extern int sigs;
|
||||
* any pending iread().
|
||||
*/
|
||||
public int
|
||||
iread(int fd, char *buf, unsigned int len)
|
||||
iread(fd, buf, len)
|
||||
int fd;
|
||||
unsigned char *buf;
|
||||
unsigned int len;
|
||||
{
|
||||
int n;
|
||||
|
||||
@ -173,7 +176,7 @@ iread(int fd, char *buf, unsigned int len)
|
||||
* Interrupt a pending iread().
|
||||
*/
|
||||
public void
|
||||
intread(void)
|
||||
intread()
|
||||
{
|
||||
LONG_JUMP(read_label, 1);
|
||||
}
|
||||
@ -183,7 +186,7 @@ intread(void)
|
||||
*/
|
||||
#if HAVE_TIME
|
||||
public time_type
|
||||
get_time(void)
|
||||
get_time()
|
||||
{
|
||||
time_type t;
|
||||
|
||||
@ -198,7 +201,8 @@ get_time(void)
|
||||
* Local version of strerror, if not available from the system.
|
||||
*/
|
||||
static char *
|
||||
strerror(int err)
|
||||
strerror(err)
|
||||
int err;
|
||||
{
|
||||
#if HAVE_SYS_ERRLIST
|
||||
static char buf[16];
|
||||
@ -219,7 +223,8 @@ strerror(int err)
|
||||
* errno_message: Return an error message based on the value of "errno".
|
||||
*/
|
||||
public char *
|
||||
errno_message(char *filename)
|
||||
errno_message(filename)
|
||||
char *filename;
|
||||
{
|
||||
char *p;
|
||||
char *m;
|
||||
@ -241,7 +246,8 @@ errno_message(char *filename)
|
||||
/* #define HAVE_FLOAT 0 */
|
||||
|
||||
static POSITION
|
||||
muldiv(POSITION val, POSITION num, POSITION den)
|
||||
muldiv(val, num, den)
|
||||
POSITION val, num, den;
|
||||
{
|
||||
#if HAVE_FLOAT
|
||||
double v = (((double) val) * num) / den;
|
||||
@ -264,7 +270,9 @@ muldiv(POSITION val, POSITION num, POSITION den)
|
||||
* {{ Assumes a POSITION is a long int. }}
|
||||
*/
|
||||
public int
|
||||
percentage(POSITION num, POSITION den)
|
||||
percentage(num, den)
|
||||
POSITION num;
|
||||
POSITION den;
|
||||
{
|
||||
return (int) muldiv(num, (POSITION) 100, den);
|
||||
}
|
||||
@ -273,7 +281,10 @@ percentage(POSITION num, POSITION den)
|
||||
* Return the specified percentage of a POSITION.
|
||||
*/
|
||||
public POSITION
|
||||
percent_pos(POSITION pos, int percent, long fraction)
|
||||
percent_pos(pos, percent, fraction)
|
||||
POSITION pos;
|
||||
int percent;
|
||||
long fraction;
|
||||
{
|
||||
/* Change percent (parts per 100) to perden (parts per NUM_FRAC_DENOM). */
|
||||
POSITION perden = (percent * (NUM_FRAC_DENOM / 100)) + (fraction / 100);
|
||||
@ -324,7 +335,9 @@ memcpy(dst, src, len)
|
||||
* This implements an ANSI-style intercept setup for Microware C 3.2
|
||||
*/
|
||||
public int
|
||||
os9_signal(int type, RETSIGTYPE (*handler)())
|
||||
os9_signal(type, handler)
|
||||
int type;
|
||||
RETSIGTYPE (*handler)();
|
||||
{
|
||||
intercept(handler);
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 1984-2015 Mark Nudelman
|
||||
* Copyright (C) 1984-2017 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,13 +37,14 @@ extern int bo_fg_color, bo_bg_color;
|
||||
extern int ul_fg_color, ul_bg_color;
|
||||
extern int so_fg_color, so_bg_color;
|
||||
extern int bl_fg_color, bl_bg_color;
|
||||
extern int sgr_mode;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Display the line which is in the line buffer.
|
||||
*/
|
||||
public void
|
||||
put_line(void)
|
||||
put_line()
|
||||
{
|
||||
int c;
|
||||
int i;
|
||||
@ -93,7 +94,7 @@ static char *ob = obuf;
|
||||
* overwritten or scrolled away.
|
||||
*/
|
||||
public void
|
||||
flush(void)
|
||||
flush()
|
||||
{
|
||||
int n;
|
||||
int fd;
|
||||
@ -126,8 +127,9 @@ flush(void)
|
||||
* the -D command-line option.
|
||||
*/
|
||||
char *anchor, *p, *p_next;
|
||||
unsigned char fg, bg;
|
||||
static unsigned char fg, fgi, bg, bgi;
|
||||
static unsigned char at;
|
||||
unsigned char f, b;
|
||||
#if MSDOS_COMPILER==WIN32C
|
||||
/* Screen colors used by 3x and 4x SGR commands. */
|
||||
static unsigned char screen_color[] = {
|
||||
@ -147,6 +149,13 @@ flush(void)
|
||||
};
|
||||
#endif
|
||||
|
||||
if (fg == 0 && bg == 0)
|
||||
{
|
||||
fg = nm_fg_color & 7;
|
||||
fgi = nm_fg_color & 8;
|
||||
bg = nm_bg_color & 7;
|
||||
bgi = nm_bg_color & 8;
|
||||
}
|
||||
for (anchor = p_next = obuf;
|
||||
(p_next = memchr(p_next, ESC, ob - p_next)) != NULL; )
|
||||
{
|
||||
@ -173,18 +182,21 @@ flush(void)
|
||||
*/
|
||||
p++;
|
||||
anchor = p_next = p;
|
||||
at = 0;
|
||||
fg = nm_fg_color & 7;
|
||||
fgi = nm_fg_color & 8;
|
||||
bg = nm_bg_color & 7;
|
||||
bgi = nm_bg_color & 8;
|
||||
at = 0;
|
||||
WIN32setcolors(nm_fg_color, nm_bg_color);
|
||||
continue;
|
||||
}
|
||||
p_next = p;
|
||||
at &= ~32;
|
||||
|
||||
/*
|
||||
* Select foreground/background colors
|
||||
* based on the escape sequence.
|
||||
*/
|
||||
fg = nm_fg_color;
|
||||
bg = nm_bg_color;
|
||||
while (!is_ansi_end(*p))
|
||||
{
|
||||
char *q;
|
||||
@ -212,17 +224,35 @@ flush(void)
|
||||
break;
|
||||
}
|
||||
if (*q == ';')
|
||||
{
|
||||
q++;
|
||||
at |= 32;
|
||||
}
|
||||
|
||||
switch (code)
|
||||
{
|
||||
default:
|
||||
/* case 0: all attrs off */
|
||||
fg = nm_fg_color;
|
||||
bg = nm_bg_color;
|
||||
at = 0;
|
||||
fg = nm_fg_color & 7;
|
||||
bg = nm_bg_color & 7;
|
||||
at &= 32;
|
||||
/*
|
||||
* \e[0m use normal
|
||||
* intensities, but
|
||||
* \e[0;...m resets them
|
||||
*/
|
||||
if (at & 32)
|
||||
{
|
||||
fgi = 0;
|
||||
bgi = 0;
|
||||
} else
|
||||
{
|
||||
fgi = nm_fg_color & 8;
|
||||
bgi = nm_bg_color & 8;
|
||||
}
|
||||
break;
|
||||
case 1: /* bold on */
|
||||
fgi = 8;
|
||||
at |= 1;
|
||||
break;
|
||||
case 3: /* italic on */
|
||||
@ -230,16 +260,19 @@ flush(void)
|
||||
at |= 2;
|
||||
break;
|
||||
case 4: /* underline on */
|
||||
bgi = 8;
|
||||
at |= 4;
|
||||
break;
|
||||
case 5: /* slow blink on */
|
||||
case 6: /* fast blink on */
|
||||
bgi = 8;
|
||||
at |= 8;
|
||||
break;
|
||||
case 8: /* concealed on */
|
||||
fg = (bg & 7) | 8;
|
||||
at |= 16;
|
||||
break;
|
||||
case 22: /* bold off */
|
||||
fgi = 0;
|
||||
at &= ~1;
|
||||
break;
|
||||
case 23: /* italic off */
|
||||
@ -247,62 +280,84 @@ flush(void)
|
||||
at &= ~2;
|
||||
break;
|
||||
case 24: /* underline off */
|
||||
bgi = 0;
|
||||
at &= ~4;
|
||||
break;
|
||||
case 28: /* concealed off */
|
||||
at &= ~16;
|
||||
break;
|
||||
case 30: case 31: case 32:
|
||||
case 33: case 34: case 35:
|
||||
case 36: case 37:
|
||||
fg = (fg & 8) | (screen_color[code - 30]);
|
||||
fg = screen_color[code - 30];
|
||||
at |= 32;
|
||||
break;
|
||||
case 39: /* default fg */
|
||||
fg = nm_fg_color;
|
||||
fg = nm_fg_color & 7;
|
||||
at |= 32;
|
||||
break;
|
||||
case 40: case 41: case 42:
|
||||
case 43: case 44: case 45:
|
||||
case 46: case 47:
|
||||
bg = (bg & 8) | (screen_color[code - 40]);
|
||||
bg = screen_color[code - 40];
|
||||
at |= 32;
|
||||
break;
|
||||
case 49: /* default fg */
|
||||
bg = nm_bg_color;
|
||||
case 49: /* default bg */
|
||||
bg = nm_bg_color & 7;
|
||||
at |= 32;
|
||||
break;
|
||||
}
|
||||
p = q;
|
||||
}
|
||||
if (!is_ansi_end(*p) || p == p_next)
|
||||
break;
|
||||
if (at & 1)
|
||||
/*
|
||||
* In SGR mode, the ANSI sequence is
|
||||
* always honored; otherwise if an attr
|
||||
* is used by itself ("\e[1m" versus
|
||||
* "\e[1;33m", for example), set the
|
||||
* color assigned to that attribute.
|
||||
*/
|
||||
if (sgr_mode || (at & 32))
|
||||
{
|
||||
/*
|
||||
* If \e[1m use defined bold
|
||||
* color, else set intensity.
|
||||
*/
|
||||
if (p[-2] == '[')
|
||||
if (at & 2)
|
||||
{
|
||||
#if MSDOS_COMPILER==WIN32C
|
||||
fg |= FOREGROUND_INTENSITY;
|
||||
bg |= BACKGROUND_INTENSITY;
|
||||
#else
|
||||
fg = bo_fg_color;
|
||||
bg = bo_bg_color;
|
||||
#endif
|
||||
f = bg | bgi;
|
||||
b = fg | fgi;
|
||||
} else
|
||||
fg |= 8;
|
||||
} else if (at & 2)
|
||||
{
|
||||
f = fg | fgi;
|
||||
b = bg | bgi;
|
||||
}
|
||||
} else
|
||||
{
|
||||
fg = so_fg_color;
|
||||
bg = so_bg_color;
|
||||
} else if (at & 4)
|
||||
{
|
||||
fg = ul_fg_color;
|
||||
bg = ul_bg_color;
|
||||
} else if (at & 8)
|
||||
{
|
||||
fg = bl_fg_color;
|
||||
bg = bl_bg_color;
|
||||
if (at & 1)
|
||||
{
|
||||
f = bo_fg_color;
|
||||
b = bo_bg_color;
|
||||
} else if (at & 2)
|
||||
{
|
||||
f = so_fg_color;
|
||||
b = so_bg_color;
|
||||
} else if (at & 4)
|
||||
{
|
||||
f = ul_fg_color;
|
||||
b = ul_bg_color;
|
||||
} else if (at & 8)
|
||||
{
|
||||
f = bl_fg_color;
|
||||
b = bl_bg_color;
|
||||
} else
|
||||
{
|
||||
f = nm_fg_color;
|
||||
b = nm_bg_color;
|
||||
}
|
||||
}
|
||||
fg &= 0xf;
|
||||
bg &= 0xf;
|
||||
WIN32setcolors(fg, bg);
|
||||
if (at & 16)
|
||||
f = b ^ 8;
|
||||
f &= 0xf;
|
||||
b &= 0xf;
|
||||
WIN32setcolors(f, b);
|
||||
p_next = anchor = p + 1;
|
||||
} else
|
||||
p_next++;
|
||||
@ -326,7 +381,8 @@ flush(void)
|
||||
* Output a character.
|
||||
*/
|
||||
public int
|
||||
putchr(int c)
|
||||
putchr(c)
|
||||
int c;
|
||||
{
|
||||
#if 0 /* fake UTF-8 output for testing */
|
||||
extern int utf_mode;
|
||||
@ -379,7 +435,8 @@ putchr(int c)
|
||||
* Output a string.
|
||||
*/
|
||||
public void
|
||||
putstr(constant char *s)
|
||||
putstr(s)
|
||||
constant char *s;
|
||||
{
|
||||
while (*s != '\0')
|
||||
putchr(*s++);
|
||||
@ -414,7 +471,8 @@ TYPE_TO_A_FUNC(inttoa, int)
|
||||
* Output an integer in a given radix.
|
||||
*/
|
||||
static int
|
||||
iprint_int(int num)
|
||||
iprint_int(num)
|
||||
int num;
|
||||
{
|
||||
char buf[INT_STRLEN_BOUND(num)];
|
||||
|
||||
@ -427,7 +485,8 @@ iprint_int(int num)
|
||||
* Output a line number in a given radix.
|
||||
*/
|
||||
static int
|
||||
iprint_linenum(LINENUM num)
|
||||
iprint_linenum(num)
|
||||
LINENUM num;
|
||||
{
|
||||
char buf[INT_STRLEN_BOUND(num)];
|
||||
|
||||
@ -441,7 +500,9 @@ iprint_linenum(LINENUM num)
|
||||
* using a more portable argument list mechanism than printf's.
|
||||
*/
|
||||
static int
|
||||
less_printf(char *fmt, PARG *parg)
|
||||
less_printf(fmt, parg)
|
||||
char *fmt;
|
||||
PARG *parg;
|
||||
{
|
||||
char *s;
|
||||
int col;
|
||||
@ -487,7 +548,7 @@ less_printf(char *fmt, PARG *parg)
|
||||
* become the next command.
|
||||
*/
|
||||
public void
|
||||
get_return(void)
|
||||
get_return()
|
||||
{
|
||||
int c;
|
||||
|
||||
@ -506,7 +567,9 @@ get_return(void)
|
||||
* and wait for carriage return.
|
||||
*/
|
||||
public void
|
||||
error(char *fmt, PARG *parg)
|
||||
error(fmt, parg)
|
||||
char *fmt;
|
||||
PARG *parg;
|
||||
{
|
||||
int col = 0;
|
||||
static char return_to_continue[] = " (press RETURN)";
|
||||
@ -559,7 +622,9 @@ static char intr_to_abort[] = "... (interrupt to abort)";
|
||||
* time-consuming operation.
|
||||
*/
|
||||
public void
|
||||
ierror(char *fmt, PARG *parg)
|
||||
ierror(fmt, parg)
|
||||
char *fmt;
|
||||
PARG *parg;
|
||||
{
|
||||
at_exit();
|
||||
clear_bot();
|
||||
@ -576,7 +641,9 @@ ierror(char *fmt, PARG *parg)
|
||||
* and return a single-character response.
|
||||
*/
|
||||
public int
|
||||
query(char *fmt, PARG *parg)
|
||||
query(fmt, parg)
|
||||
char *fmt;
|
||||
PARG *parg;
|
||||
{
|
||||
int c;
|
||||
int col = 0;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 1984-2015 Mark Nudelman
|
||||
* Copyright (C) 1984-2017 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.
|
||||
@ -12,7 +12,6 @@
|
||||
*/
|
||||
|
||||
#include "less.h"
|
||||
#include "pattern.h"
|
||||
|
||||
extern int caseless;
|
||||
|
||||
@ -20,7 +19,11 @@ extern int caseless;
|
||||
* Compile a search pattern, for future use by match_pattern.
|
||||
*/
|
||||
static int
|
||||
compile_pattern2(char *pattern, int search_type, void **comp_pattern, int show_error)
|
||||
compile_pattern2(pattern, search_type, comp_pattern, show_error)
|
||||
char *pattern;
|
||||
int search_type;
|
||||
PATTERN_TYPE *comp_pattern;
|
||||
int show_error;
|
||||
{
|
||||
if (search_type & SRCH_NO_REGEX)
|
||||
return (0);
|
||||
@ -28,8 +31,6 @@ compile_pattern2(char *pattern, int search_type, void **comp_pattern, int show_e
|
||||
#if HAVE_GNU_REGEX
|
||||
struct re_pattern_buffer *comp = (struct re_pattern_buffer *)
|
||||
ecalloc(1, sizeof(struct re_pattern_buffer));
|
||||
struct re_pattern_buffer **pcomp =
|
||||
(struct re_pattern_buffer **) comp_pattern;
|
||||
re_set_syntax(RE_SYNTAX_POSIX_EXTENDED);
|
||||
if (re_compile_pattern(pattern, strlen(pattern), comp))
|
||||
{
|
||||
@ -38,13 +39,15 @@ compile_pattern2(char *pattern, int search_type, void **comp_pattern, int show_e
|
||||
error("Invalid pattern", NULL_PARG);
|
||||
return (-1);
|
||||
}
|
||||
if (*pcomp != NULL)
|
||||
regfree(*pcomp);
|
||||
*pcomp = comp;
|
||||
if (*comp_pattern != NULL)
|
||||
{
|
||||
regfree(*comp_pattern);
|
||||
free(*comp_pattern);
|
||||
}
|
||||
*comp_pattern = comp;
|
||||
#endif
|
||||
#if HAVE_POSIX_REGCOMP
|
||||
regex_t *comp = (regex_t *) ecalloc(1, sizeof(regex_t));
|
||||
regex_t **pcomp = (regex_t **) comp_pattern;
|
||||
if (regcomp(comp, pattern, REGCOMP_FLAG))
|
||||
{
|
||||
free(comp);
|
||||
@ -52,13 +55,15 @@ compile_pattern2(char *pattern, int search_type, void **comp_pattern, int show_e
|
||||
error("Invalid pattern", NULL_PARG);
|
||||
return (-1);
|
||||
}
|
||||
if (*pcomp != NULL)
|
||||
regfree(*pcomp);
|
||||
*pcomp = comp;
|
||||
if (*comp_pattern != NULL)
|
||||
{
|
||||
regfree(*comp_pattern);
|
||||
free(*comp_pattern);
|
||||
}
|
||||
*comp_pattern = comp;
|
||||
#endif
|
||||
#if HAVE_PCRE
|
||||
pcre *comp;
|
||||
pcre **pcomp = (pcre **) comp_pattern;
|
||||
constant char *errstring;
|
||||
int erroffset;
|
||||
PARG parg;
|
||||
@ -71,35 +76,32 @@ compile_pattern2(char *pattern, int search_type, void **comp_pattern, int show_e
|
||||
error("%s", &parg);
|
||||
return (-1);
|
||||
}
|
||||
*pcomp = comp;
|
||||
*comp_pattern = comp;
|
||||
#endif
|
||||
#if HAVE_RE_COMP
|
||||
PARG parg;
|
||||
int *pcomp = (int *) comp_pattern;
|
||||
if ((parg.p_string = re_comp(pattern)) != NULL)
|
||||
{
|
||||
if (show_error)
|
||||
error("%s", &parg);
|
||||
return (-1);
|
||||
}
|
||||
*pcomp = 1;
|
||||
*comp_pattern = 1;
|
||||
#endif
|
||||
#if HAVE_REGCMP
|
||||
char *comp;
|
||||
char **pcomp = (char **) comp_pattern;
|
||||
if ((comp = regcmp(pattern, 0)) == NULL)
|
||||
{
|
||||
if (show_error)
|
||||
error("Invalid pattern", NULL_PARG);
|
||||
return (-1);
|
||||
}
|
||||
if (pcomp != NULL)
|
||||
free(*pcomp);
|
||||
*pcomp = comp;
|
||||
if (comp_pattern != NULL)
|
||||
free(*comp_pattern);
|
||||
*comp_pattern = comp;
|
||||
#endif
|
||||
#if HAVE_V8_REGCOMP
|
||||
struct regexp *comp;
|
||||
struct regexp **pcomp = (struct regexp **) comp_pattern;
|
||||
reg_show_error = show_error;
|
||||
comp = regcomp(pattern);
|
||||
reg_show_error = 1;
|
||||
@ -111,9 +113,9 @@ compile_pattern2(char *pattern, int search_type, void **comp_pattern, int show_e
|
||||
*/
|
||||
return (-1);
|
||||
}
|
||||
if (*pcomp != NULL)
|
||||
free(*pcomp);
|
||||
*pcomp = comp;
|
||||
if (*comp_pattern != NULL)
|
||||
free(*comp_pattern);
|
||||
*comp_pattern = comp;
|
||||
#endif
|
||||
}
|
||||
return (0);
|
||||
@ -123,7 +125,10 @@ compile_pattern2(char *pattern, int search_type, void **comp_pattern, int show_e
|
||||
* Like compile_pattern2, but convert the pattern to lowercase if necessary.
|
||||
*/
|
||||
public int
|
||||
compile_pattern(char *pattern, int search_type, void **comp_pattern)
|
||||
compile_pattern(pattern, search_type, comp_pattern)
|
||||
char *pattern;
|
||||
int search_type;
|
||||
PATTERN_TYPE *comp_pattern;
|
||||
{
|
||||
char *cvt_pattern;
|
||||
int result;
|
||||
@ -145,41 +150,42 @@ compile_pattern(char *pattern, int search_type, void **comp_pattern)
|
||||
* Forget that we have a compiled pattern.
|
||||
*/
|
||||
public void
|
||||
uncompile_pattern(void **pattern)
|
||||
uncompile_pattern(pattern)
|
||||
PATTERN_TYPE *pattern;
|
||||
{
|
||||
#if HAVE_GNU_REGEX
|
||||
struct re_pattern_buffer **pcomp = (struct re_pattern_buffer **) pattern;
|
||||
if (*pcomp != NULL)
|
||||
regfree(*pcomp);
|
||||
*pcomp = NULL;
|
||||
if (*pattern != NULL)
|
||||
{
|
||||
regfree(*pattern);
|
||||
free(*pattern);
|
||||
}
|
||||
*pattern = NULL;
|
||||
#endif
|
||||
#if HAVE_POSIX_REGCOMP
|
||||
regex_t **pcomp = (regex_t **) pattern;
|
||||
if (*pcomp != NULL)
|
||||
regfree(*pcomp);
|
||||
*pcomp = NULL;
|
||||
if (*pattern != NULL)
|
||||
{
|
||||
regfree(*pattern);
|
||||
free(*pattern);
|
||||
}
|
||||
*pattern = NULL;
|
||||
#endif
|
||||
#if HAVE_PCRE
|
||||
pcre **pcomp = (pcre **) pattern;
|
||||
if (*pcomp != NULL)
|
||||
pcre_free(*pcomp);
|
||||
*pcomp = NULL;
|
||||
if (*pattern != NULL)
|
||||
pcre_free(*pattern);
|
||||
*pattern = NULL;
|
||||
#endif
|
||||
#if HAVE_RE_COMP
|
||||
int *pcomp = (int *) pattern;
|
||||
*pcomp = 0;
|
||||
*pattern = 0;
|
||||
#endif
|
||||
#if HAVE_REGCMP
|
||||
char **pcomp = (char **) pattern;
|
||||
if (*pcomp != NULL)
|
||||
free(*pcomp);
|
||||
*pcomp = NULL;
|
||||
if (*pattern != NULL)
|
||||
free(*pattern);
|
||||
*pattern = NULL;
|
||||
#endif
|
||||
#if HAVE_V8_REGCOMP
|
||||
struct regexp **pcomp = (struct regexp **) pattern;
|
||||
if (*pcomp != NULL)
|
||||
free(*pcomp);
|
||||
*pcomp = NULL;
|
||||
if (*pattern != NULL)
|
||||
free(*pattern);
|
||||
*pattern = NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -187,9 +193,10 @@ uncompile_pattern(void **pattern)
|
||||
* Can a pattern be successfully compiled?
|
||||
*/
|
||||
public int
|
||||
valid_pattern(char *pattern)
|
||||
valid_pattern(pattern)
|
||||
char *pattern;
|
||||
{
|
||||
void *comp_pattern;
|
||||
PATTERN_TYPE comp_pattern;
|
||||
int result;
|
||||
|
||||
CLEAR_PATTERN(comp_pattern);
|
||||
@ -204,7 +211,8 @@ valid_pattern(char *pattern)
|
||||
* Is a compiled pattern null?
|
||||
*/
|
||||
public int
|
||||
is_null_pattern(void *pattern)
|
||||
is_null_pattern(pattern)
|
||||
PATTERN_TYPE pattern;
|
||||
{
|
||||
#if HAVE_GNU_REGEX
|
||||
return (pattern == NULL);
|
||||
@ -234,7 +242,12 @@ is_null_pattern(void *pattern)
|
||||
* It supports no metacharacters like *, etc.
|
||||
*/
|
||||
static int
|
||||
match(char *pattern, int pattern_len, char *buf, int buf_len, char **pfound, char **pend)
|
||||
match(pattern, pattern_len, buf, buf_len, pfound, pend)
|
||||
char *pattern;
|
||||
int pattern_len;
|
||||
char *buf;
|
||||
int buf_len;
|
||||
char **pfound, **pend;
|
||||
{
|
||||
char *pp, *lp;
|
||||
char *pattern_end = pattern + pattern_len;
|
||||
@ -270,27 +283,17 @@ match(char *pattern, int pattern_len, char *buf, int buf_len, char **pfound, cha
|
||||
* Set sp and ep to the start and end of the matched string.
|
||||
*/
|
||||
public int
|
||||
match_pattern(void *pattern, char *tpattern, char *line, int line_len, char **sp, char **ep, int notbol, int search_type)
|
||||
match_pattern(pattern, tpattern, line, line_len, sp, ep, notbol, search_type)
|
||||
PATTERN_TYPE pattern;
|
||||
char *tpattern;
|
||||
char *line;
|
||||
int line_len;
|
||||
char **sp;
|
||||
char **ep;
|
||||
int notbol;
|
||||
int search_type;
|
||||
{
|
||||
int matched;
|
||||
#if HAVE_GNU_REGEX
|
||||
struct re_pattern_buffer *spattern = (struct re_pattern_buffer *) pattern;
|
||||
#endif
|
||||
#if HAVE_POSIX_REGCOMP
|
||||
regex_t *spattern = (regex_t *) pattern;
|
||||
#endif
|
||||
#if HAVE_PCRE
|
||||
pcre *spattern = (pcre *) pattern;
|
||||
#endif
|
||||
#if HAVE_RE_COMP
|
||||
int spattern = (int) pattern;
|
||||
#endif
|
||||
#if HAVE_REGCMP
|
||||
char *spattern = (char *) pattern;
|
||||
#endif
|
||||
#if HAVE_V8_REGCOMP
|
||||
struct regexp *spattern = (struct regexp *) pattern;
|
||||
#endif
|
||||
|
||||
*sp = *ep = NULL;
|
||||
#if NO_REGEX
|
||||
@ -303,9 +306,9 @@ match_pattern(void *pattern, char *tpattern, char *line, int line_len, char **sp
|
||||
#if HAVE_GNU_REGEX
|
||||
{
|
||||
struct re_registers search_regs;
|
||||
spattern->not_bol = notbol;
|
||||
spattern->regs_allocated = REGS_UNALLOCATED;
|
||||
matched = re_search(spattern, line, line_len, 0, line_len, &search_regs) >= 0;
|
||||
pattern->not_bol = notbol;
|
||||
pattern->regs_allocated = REGS_UNALLOCATED;
|
||||
matched = re_search(pattern, line, line_len, 0, line_len, &search_regs) >= 0;
|
||||
if (matched)
|
||||
{
|
||||
*sp = line + search_regs.start[0];
|
||||
@ -322,7 +325,7 @@ match_pattern(void *pattern, char *tpattern, char *line, int line_len, char **sp
|
||||
rm.rm_so = 0;
|
||||
rm.rm_eo = line_len;
|
||||
#endif
|
||||
matched = !regexec(spattern, line, 1, &rm, flags);
|
||||
matched = !regexec(pattern, line, 1, &rm, flags);
|
||||
if (matched)
|
||||
{
|
||||
#ifndef __WATCOMC__
|
||||
@ -339,7 +342,7 @@ match_pattern(void *pattern, char *tpattern, char *line, int line_len, char **sp
|
||||
{
|
||||
int flags = (notbol) ? PCRE_NOTBOL : 0;
|
||||
int ovector[3];
|
||||
matched = pcre_exec(spattern, NULL, line, line_len,
|
||||
matched = pcre_exec(pattern, NULL, line, line_len,
|
||||
0, flags, ovector, 3) >= 0;
|
||||
if (matched)
|
||||
{
|
||||
@ -356,21 +359,21 @@ match_pattern(void *pattern, char *tpattern, char *line, int line_len, char **sp
|
||||
*sp = *ep = NULL;
|
||||
#endif
|
||||
#if HAVE_REGCMP
|
||||
*ep = regex(spattern, line);
|
||||
*ep = regex(pattern, line);
|
||||
matched = (*ep != NULL);
|
||||
if (matched)
|
||||
*sp = __loc1;
|
||||
#endif
|
||||
#if HAVE_V8_REGCOMP
|
||||
#if HAVE_REGEXEC2
|
||||
matched = regexec2(spattern, line, notbol);
|
||||
matched = regexec2(pattern, line, notbol);
|
||||
#else
|
||||
matched = regexec(spattern, line);
|
||||
matched = regexec(pattern, line);
|
||||
#endif
|
||||
if (matched)
|
||||
{
|
||||
*sp = spattern->startp[0];
|
||||
*ep = spattern->endp[0];
|
||||
*sp = pattern->startp[0];
|
||||
*ep = pattern->endp[0];
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 1984-2015 Mark Nudelman
|
||||
* Copyright (C) 1984-2017 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.
|
||||
@ -10,7 +10,7 @@
|
||||
#if HAVE_GNU_REGEX
|
||||
#define __USE_GNU 1
|
||||
#include <regex.h>
|
||||
#define DEFINE_PATTERN(name) struct re_pattern_buffer *name
|
||||
#define PATTERN_TYPE struct re_pattern_buffer *
|
||||
#define CLEAR_PATTERN(name) name = NULL
|
||||
#endif
|
||||
|
||||
@ -18,24 +18,24 @@
|
||||
#include <regex.h>
|
||||
#ifdef REG_EXTENDED
|
||||
extern int less_is_more;
|
||||
#define REGCOMP_FLAG (less_is_more ? 0 : REG_EXTENDED)
|
||||
#define REGCOMP_FLAG (less_is_more ? 0 : REG_EXTENDED)
|
||||
#else
|
||||
#define REGCOMP_FLAG 0
|
||||
#define REGCOMP_FLAG 0
|
||||
#endif
|
||||
#define DEFINE_PATTERN(name) regex_t *name
|
||||
#define PATTERN_TYPE regex_t *
|
||||
#define CLEAR_PATTERN(name) name = NULL
|
||||
#endif
|
||||
|
||||
#if HAVE_PCRE
|
||||
#include <pcre.h>
|
||||
#define DEFINE_PATTERN(name) pcre *name
|
||||
#define PATTERN_TYPE pcre *
|
||||
#define CLEAR_PATTERN(name) name = NULL
|
||||
#endif
|
||||
|
||||
#if HAVE_RE_COMP
|
||||
char *re_comp();
|
||||
int re_exec();
|
||||
#define DEFINE_PATTERN(name) int name
|
||||
#define PATTERN_TYPE int
|
||||
#define CLEAR_PATTERN(name) name = 0
|
||||
#endif
|
||||
|
||||
@ -43,18 +43,18 @@ int re_exec();
|
||||
char *regcmp();
|
||||
char *regex();
|
||||
extern char *__loc1;
|
||||
#define DEFINE_PATTERN(name) char *name
|
||||
#define PATTERN_TYPE char **
|
||||
#define CLEAR_PATTERN(name) name = NULL
|
||||
#endif
|
||||
|
||||
#if HAVE_V8_REGCOMP
|
||||
#include "regexp.h"
|
||||
extern int reg_show_error;
|
||||
#define DEFINE_PATTERN(name) struct regexp *name
|
||||
#define PATTERN_TYPE struct regexp *
|
||||
#define CLEAR_PATTERN(name) name = NULL
|
||||
#endif
|
||||
|
||||
#if NO_REGEX
|
||||
#define DEFINE_PATTERN(name)
|
||||
#define PATTERN_TYPE void *
|
||||
#define CLEAR_PATTERN(name)
|
||||
#endif
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 1984-2015 Mark Nudelman
|
||||
* Copyright (C) 1984-2017 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.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 1984-2015 Mark Nudelman
|
||||
* Copyright (C) 1984-2017 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.
|
||||
@ -36,7 +36,8 @@ extern int sc_width, sc_height;
|
||||
* the line after the bottom line on the screen
|
||||
*/
|
||||
public POSITION
|
||||
position(int where)
|
||||
position(where)
|
||||
int where;
|
||||
{
|
||||
switch (where)
|
||||
{
|
||||
@ -56,7 +57,8 @@ position(int where)
|
||||
* Add a new file position to the bottom of the position table.
|
||||
*/
|
||||
public void
|
||||
add_forw_pos(POSITION pos)
|
||||
add_forw_pos(pos)
|
||||
POSITION pos;
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -72,7 +74,8 @@ add_forw_pos(POSITION pos)
|
||||
* Add a new file position to the top of the position table.
|
||||
*/
|
||||
public void
|
||||
add_back_pos(POSITION pos)
|
||||
add_back_pos(pos)
|
||||
POSITION pos;
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -88,7 +91,7 @@ add_back_pos(POSITION pos)
|
||||
* Initialize the position table, done whenever we clear the screen.
|
||||
*/
|
||||
public void
|
||||
pos_clear(void)
|
||||
pos_clear()
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -100,7 +103,7 @@ pos_clear(void)
|
||||
* Allocate or reallocate the position table.
|
||||
*/
|
||||
public void
|
||||
pos_init(void)
|
||||
pos_init()
|
||||
{
|
||||
struct scrpos scrpos;
|
||||
|
||||
@ -129,7 +132,8 @@ pos_init(void)
|
||||
* Return the position table entry if found, -1 if not.
|
||||
*/
|
||||
public int
|
||||
onscreen(POSITION pos)
|
||||
onscreen(pos)
|
||||
POSITION pos;
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -145,13 +149,15 @@ onscreen(POSITION pos)
|
||||
* See if the entire screen is empty.
|
||||
*/
|
||||
public int
|
||||
empty_screen(void)
|
||||
empty_screen()
|
||||
{
|
||||
return (empty_lines(0, sc_height-1));
|
||||
}
|
||||
|
||||
public int
|
||||
empty_lines(int s, int e)
|
||||
empty_lines(s, e)
|
||||
int s;
|
||||
int e;
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -170,7 +176,8 @@ empty_lines(int s, int e)
|
||||
* the screen line to a number > 0.
|
||||
*/
|
||||
public void
|
||||
get_scrpos(struct scrpos *scrpos)
|
||||
get_scrpos(scrpos)
|
||||
struct scrpos *scrpos;
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -201,7 +208,8 @@ get_scrpos(struct scrpos *scrpos)
|
||||
* relative to the bottom of the screen.
|
||||
*/
|
||||
public int
|
||||
adjsline(int sline)
|
||||
adjsline(sline)
|
||||
int sline;
|
||||
{
|
||||
/*
|
||||
* Negative screen line number means
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 1984-2015 Mark Nudelman
|
||||
* Copyright (C) 1984-2017 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.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 1984-2015 Mark Nudelman
|
||||
* Copyright (C) 1984-2017 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.
|
||||
@ -66,7 +66,7 @@ static char *mp;
|
||||
* Initialize the prompt prototype strings.
|
||||
*/
|
||||
public void
|
||||
init_prompt(void)
|
||||
init_prompt()
|
||||
{
|
||||
prproto[0] = save(s_proto);
|
||||
prproto[1] = save(less_is_more ? more_proto : m_proto);
|
||||
@ -80,7 +80,8 @@ init_prompt(void)
|
||||
* Append a string to the end of the message.
|
||||
*/
|
||||
static void
|
||||
ap_str(char *s)
|
||||
ap_str(s)
|
||||
char *s;
|
||||
{
|
||||
int len;
|
||||
|
||||
@ -96,7 +97,8 @@ ap_str(char *s)
|
||||
* Append a character to the end of the message.
|
||||
*/
|
||||
static void
|
||||
ap_char(char c)
|
||||
ap_char(c)
|
||||
char c;
|
||||
{
|
||||
char buf[2];
|
||||
|
||||
@ -109,7 +111,8 @@ ap_char(char c)
|
||||
* Append a POSITION (as a decimal integer) to the end of the message.
|
||||
*/
|
||||
static void
|
||||
ap_pos(POSITION pos)
|
||||
ap_pos(pos)
|
||||
POSITION pos;
|
||||
{
|
||||
char buf[INT_STRLEN_BOUND(pos) + 2];
|
||||
|
||||
@ -121,7 +124,8 @@ ap_pos(POSITION pos)
|
||||
* Append a line number to the end of the message.
|
||||
*/
|
||||
static void
|
||||
ap_linenum(LINENUM linenum)
|
||||
ap_linenum(linenum)
|
||||
LINENUM linenum;
|
||||
{
|
||||
char buf[INT_STRLEN_BOUND(linenum) + 2];
|
||||
|
||||
@ -133,7 +137,8 @@ ap_linenum(LINENUM linenum)
|
||||
* Append an integer to the end of the message.
|
||||
*/
|
||||
static void
|
||||
ap_int(int num)
|
||||
ap_int(num)
|
||||
int num;
|
||||
{
|
||||
char buf[INT_STRLEN_BOUND(num) + 2];
|
||||
|
||||
@ -145,7 +150,7 @@ ap_int(int num)
|
||||
* Append a question mark to the end of the message.
|
||||
*/
|
||||
static void
|
||||
ap_quest(void)
|
||||
ap_quest()
|
||||
{
|
||||
ap_str("?");
|
||||
}
|
||||
@ -154,7 +159,8 @@ ap_quest(void)
|
||||
* Return the "current" byte offset in the file.
|
||||
*/
|
||||
static POSITION
|
||||
curr_byte(int where)
|
||||
curr_byte(where)
|
||||
int where;
|
||||
{
|
||||
POSITION pos;
|
||||
|
||||
@ -173,7 +179,9 @@ curr_byte(int where)
|
||||
* Here we decode that letter and return the appropriate boolean value.
|
||||
*/
|
||||
static int
|
||||
cond(char c, int where)
|
||||
cond(c, where)
|
||||
char c;
|
||||
int where;
|
||||
{
|
||||
POSITION len;
|
||||
|
||||
@ -235,7 +243,10 @@ cond(char c, int where)
|
||||
* usually by appending something to the message being built.
|
||||
*/
|
||||
static void
|
||||
protochar(int c, int where, int iseditproto)
|
||||
protochar(c, where, iseditproto)
|
||||
int c;
|
||||
int where;
|
||||
int iseditproto;
|
||||
{
|
||||
POSITION pos;
|
||||
POSITION len;
|
||||
@ -382,7 +393,8 @@ protochar(int c, int where, int iseditproto)
|
||||
* We must keep track of nested IFs and skip them properly.
|
||||
*/
|
||||
static constant char *
|
||||
skipcond(constant char *p)
|
||||
skipcond(p)
|
||||
constant char *p;
|
||||
{
|
||||
int iflevel;
|
||||
|
||||
@ -439,7 +451,9 @@ skipcond(constant char *p)
|
||||
* Decode a char that represents a position on the screen.
|
||||
*/
|
||||
static constant char *
|
||||
wherechar(char constant *p, int *wp)
|
||||
wherechar(p, wp)
|
||||
char constant *p;
|
||||
int *wp;
|
||||
{
|
||||
switch (*p)
|
||||
{
|
||||
@ -461,7 +475,9 @@ wherechar(char constant *p, int *wp)
|
||||
* Construct a message based on a prototype string.
|
||||
*/
|
||||
public char *
|
||||
pr_expand(constant char *proto, int maxwidth)
|
||||
pr_expand(proto, maxwidth)
|
||||
constant char *proto;
|
||||
int maxwidth;
|
||||
{
|
||||
constant char *p;
|
||||
int c;
|
||||
@ -535,7 +551,7 @@ pr_expand(constant char *proto, int maxwidth)
|
||||
* Return a message suitable for printing by the "=" command.
|
||||
*/
|
||||
public char *
|
||||
eq_message(void)
|
||||
eq_message()
|
||||
{
|
||||
return (pr_expand(eqproto, 0));
|
||||
}
|
||||
@ -547,7 +563,7 @@ eq_message(void)
|
||||
* and the caller will prompt with a colon.
|
||||
*/
|
||||
public char *
|
||||
pr_string(void)
|
||||
pr_string()
|
||||
{
|
||||
char *prompt;
|
||||
int type;
|
||||
@ -564,7 +580,7 @@ pr_string(void)
|
||||
* Return a message suitable for printing while waiting in the F command.
|
||||
*/
|
||||
public char *
|
||||
wait_message(void)
|
||||
wait_message()
|
||||
{
|
||||
return (pr_expand(wproto, sc_width-so_s_width-so_e_width-2));
|
||||
}
|
||||
|
@ -207,12 +207,13 @@ STATIC int strcspn();
|
||||
* of the structure of the compiled regexp.
|
||||
*/
|
||||
regexp *
|
||||
regcomp(char *exp)
|
||||
regcomp(exp)
|
||||
char *exp;
|
||||
{
|
||||
regexp *r;
|
||||
char *scan;
|
||||
char *longest;
|
||||
int len;
|
||||
register regexp *r;
|
||||
register char *scan;
|
||||
register char *longest;
|
||||
register int len;
|
||||
int flags;
|
||||
|
||||
if (exp == NULL)
|
||||
@ -296,12 +297,14 @@ regcomp(char *exp)
|
||||
* follows makes it hard to avoid.
|
||||
*/
|
||||
static char *
|
||||
reg(int paren, int *flagp)
|
||||
reg(paren, flagp)
|
||||
int paren; /* Parenthesized? */
|
||||
int *flagp;
|
||||
{
|
||||
char *ret;
|
||||
char *br;
|
||||
char *ender;
|
||||
int parno = 0;
|
||||
register char *ret;
|
||||
register char *br;
|
||||
register char *ender;
|
||||
register int parno = 0;
|
||||
int flags;
|
||||
|
||||
*flagp = HASWIDTH; /* Tentatively. */
|
||||
@ -366,11 +369,12 @@ reg(int paren, int *flagp)
|
||||
* Implements the concatenation operator.
|
||||
*/
|
||||
static char *
|
||||
regbranch(int *flagp)
|
||||
regbranch(flagp)
|
||||
int *flagp;
|
||||
{
|
||||
char *ret;
|
||||
char *chain;
|
||||
char *latest;
|
||||
register char *ret;
|
||||
register char *chain;
|
||||
register char *latest;
|
||||
int flags;
|
||||
|
||||
*flagp = WORST; /* Tentatively. */
|
||||
@ -404,11 +408,12 @@ regbranch(int *flagp)
|
||||
* endmarker role is not redundant.
|
||||
*/
|
||||
static char *
|
||||
regpiece(int *flagp)
|
||||
regpiece(flagp)
|
||||
int *flagp;
|
||||
{
|
||||
char *ret;
|
||||
char op;
|
||||
char *next;
|
||||
register char *ret;
|
||||
register char op;
|
||||
register char *next;
|
||||
int flags;
|
||||
|
||||
ret = regatom(&flags);
|
||||
@ -467,9 +472,10 @@ regpiece(int *flagp)
|
||||
* separate node; the code is simpler that way and it's not worth fixing.
|
||||
*/
|
||||
static char *
|
||||
regatom(int *flagp)
|
||||
regatom(flagp)
|
||||
int *flagp;
|
||||
{
|
||||
char *ret;
|
||||
register char *ret;
|
||||
int flags;
|
||||
|
||||
*flagp = WORST; /* Tentatively. */
|
||||
@ -486,8 +492,8 @@ regatom(int *flagp)
|
||||
*flagp |= HASWIDTH|SIMPLE;
|
||||
break;
|
||||
case '[': {
|
||||
int clss;
|
||||
int classend;
|
||||
register int clss;
|
||||
register int classend;
|
||||
|
||||
if (*regparse == '^') { /* Complement of range. */
|
||||
ret = regnode(ANYBUT);
|
||||
@ -547,8 +553,8 @@ regatom(int *flagp)
|
||||
*flagp |= HASWIDTH|SIMPLE;
|
||||
break;
|
||||
default: {
|
||||
int len;
|
||||
char ender;
|
||||
register int len;
|
||||
register char ender;
|
||||
|
||||
regparse--;
|
||||
len = (int) strcspn(regparse, META);
|
||||
@ -577,10 +583,11 @@ regatom(int *flagp)
|
||||
- regnode - emit a node
|
||||
*/
|
||||
static char * /* Location. */
|
||||
regnode(char op)
|
||||
regnode(op)
|
||||
char op;
|
||||
{
|
||||
char *ret;
|
||||
char *ptr;
|
||||
register char *ret;
|
||||
register char *ptr;
|
||||
|
||||
ret = regcode;
|
||||
if (ret == ®dummy) {
|
||||
@ -601,7 +608,8 @@ regnode(char op)
|
||||
- regc - emit (if appropriate) a byte of code
|
||||
*/
|
||||
static void
|
||||
regc(char b)
|
||||
regc(b)
|
||||
char b;
|
||||
{
|
||||
if (regcode != ®dummy)
|
||||
*regcode++ = b;
|
||||
@ -615,11 +623,13 @@ regc(char b)
|
||||
* Means relocating the operand.
|
||||
*/
|
||||
static void
|
||||
reginsert(char op, char *opnd)
|
||||
reginsert(op, opnd)
|
||||
char op;
|
||||
char *opnd;
|
||||
{
|
||||
char *src;
|
||||
char *dst;
|
||||
char *place;
|
||||
register char *src;
|
||||
register char *dst;
|
||||
register char *place;
|
||||
|
||||
if (regcode == ®dummy) {
|
||||
regsize += 3;
|
||||
@ -642,11 +652,13 @@ reginsert(char op, char *opnd)
|
||||
- regtail - set the next-pointer at the end of a node chain
|
||||
*/
|
||||
static void
|
||||
regtail(char *p, char *val)
|
||||
regtail(p, val)
|
||||
char *p;
|
||||
char *val;
|
||||
{
|
||||
char *scan;
|
||||
char *temp;
|
||||
int offset;
|
||||
register char *scan;
|
||||
register char *temp;
|
||||
register int offset;
|
||||
|
||||
if (p == ®dummy)
|
||||
return;
|
||||
@ -672,7 +684,9 @@ regtail(char *p, char *val)
|
||||
- regoptail - regtail on operand of first argument; nop if operandless
|
||||
*/
|
||||
static void
|
||||
regoptail(char *p, char *val)
|
||||
regoptail(p, val)
|
||||
char *p;
|
||||
char *val;
|
||||
{
|
||||
/* "Operandless" and "op != BRANCH" are synonymous in practice. */
|
||||
if (p == NULL || p == ®dummy || OP(p) != BRANCH)
|
||||
@ -709,9 +723,12 @@ STATIC char *regprop();
|
||||
- regexec - match a regexp against a string
|
||||
*/
|
||||
int
|
||||
regexec2(regexp *prog, char *string, int notbol)
|
||||
regexec2(prog, string, notbol)
|
||||
register regexp *prog;
|
||||
register char *string;
|
||||
int notbol;
|
||||
{
|
||||
char *s;
|
||||
register char *s;
|
||||
|
||||
/* Be paranoid... */
|
||||
if (prog == NULL || string == NULL) {
|
||||
@ -768,7 +785,9 @@ regexec2(regexp *prog, char *string, int notbol)
|
||||
}
|
||||
|
||||
int
|
||||
regexec(regexp *prog, char *string)
|
||||
regexec(prog, string)
|
||||
register regexp *prog;
|
||||
register char *string;
|
||||
{
|
||||
return regexec2(prog, string, 0);
|
||||
}
|
||||
@ -777,11 +796,13 @@ regexec(regexp *prog, char *string)
|
||||
- regtry - try match at specific point
|
||||
*/
|
||||
static int /* 0 failure, 1 success */
|
||||
regtry(regexp *prog, char *string)
|
||||
regtry(prog, string)
|
||||
regexp *prog;
|
||||
char *string;
|
||||
{
|
||||
int i;
|
||||
char **sp;
|
||||
char **ep;
|
||||
register int i;
|
||||
register char **sp;
|
||||
register char **ep;
|
||||
|
||||
reginput = string;
|
||||
regstartp = prog->startp;
|
||||
@ -812,10 +833,11 @@ regtry(regexp *prog, char *string)
|
||||
* by recursion.
|
||||
*/
|
||||
static int /* 0 failure, 1 success */
|
||||
regmatch(char *prog)
|
||||
regmatch(prog)
|
||||
char *prog;
|
||||
{
|
||||
char *scan; /* Current node. */
|
||||
char *next; /* Next node. */
|
||||
register char *scan; /* Current node. */
|
||||
char *next; /* Next node. */
|
||||
|
||||
scan = prog;
|
||||
#ifdef DEBUG
|
||||
@ -844,8 +866,8 @@ regmatch(char *prog)
|
||||
reginput++;
|
||||
break;
|
||||
case EXACTLY: {
|
||||
int len;
|
||||
char *opnd;
|
||||
register int len;
|
||||
register char *opnd;
|
||||
|
||||
opnd = OPERAND(scan);
|
||||
/* Inline the first character, for speed. */
|
||||
@ -880,8 +902,8 @@ regmatch(char *prog)
|
||||
case OPEN+7:
|
||||
case OPEN+8:
|
||||
case OPEN+9: {
|
||||
int no;
|
||||
char *save;
|
||||
register int no;
|
||||
register char *save;
|
||||
|
||||
no = OP(scan) - OPEN;
|
||||
save = reginput;
|
||||
@ -909,8 +931,8 @@ regmatch(char *prog)
|
||||
case CLOSE+7:
|
||||
case CLOSE+8:
|
||||
case CLOSE+9: {
|
||||
int no;
|
||||
char *save;
|
||||
register int no;
|
||||
register char *save;
|
||||
|
||||
no = OP(scan) - CLOSE;
|
||||
save = reginput;
|
||||
@ -930,7 +952,7 @@ regmatch(char *prog)
|
||||
/* NOTREACHED */
|
||||
break;
|
||||
case BRANCH: {
|
||||
char *save;
|
||||
register char *save;
|
||||
|
||||
if (OP(next) != BRANCH) /* No choice. */
|
||||
next = OPERAND(scan); /* Avoid recursion. */
|
||||
@ -950,10 +972,10 @@ regmatch(char *prog)
|
||||
break;
|
||||
case STAR:
|
||||
case PLUS: {
|
||||
char nextch;
|
||||
int no;
|
||||
char *save;
|
||||
int min;
|
||||
register char nextch;
|
||||
register int no;
|
||||
register char *save;
|
||||
register int min;
|
||||
|
||||
/*
|
||||
* Lookahead to avoid useless match attempts
|
||||
@ -1004,11 +1026,12 @@ regmatch(char *prog)
|
||||
- regrepeat - repeatedly match something simple, report how many
|
||||
*/
|
||||
static int
|
||||
regrepeat(char *p)
|
||||
regrepeat(p)
|
||||
char *p;
|
||||
{
|
||||
int count = 0;
|
||||
char *scan;
|
||||
char *opnd;
|
||||
register int count = 0;
|
||||
register char *scan;
|
||||
register char *opnd;
|
||||
|
||||
scan = reginput;
|
||||
opnd = OPERAND(p);
|
||||
@ -1049,9 +1072,10 @@ regrepeat(char *p)
|
||||
- regnext - dig the "next" pointer out of a node
|
||||
*/
|
||||
static char *
|
||||
regnext(char *p)
|
||||
regnext(p)
|
||||
register char *p;
|
||||
{
|
||||
int offset;
|
||||
register int offset;
|
||||
|
||||
if (p == ®dummy)
|
||||
return(NULL);
|
||||
@ -1074,11 +1098,12 @@ STATIC char *regprop();
|
||||
- regdump - dump a regexp onto stdout in vaguely comprehensible form
|
||||
*/
|
||||
void
|
||||
regdump(regexp *r)
|
||||
regdump(r)
|
||||
regexp *r;
|
||||
{
|
||||
char *s;
|
||||
char op = EXACTLY; /* Arbitrary non-END op. */
|
||||
char *next;
|
||||
register char *s;
|
||||
register char op = EXACTLY; /* Arbitrary non-END op. */
|
||||
register char *next;
|
||||
|
||||
|
||||
s = r->program + 1;
|
||||
@ -1116,9 +1141,10 @@ regdump(regexp *r)
|
||||
- regprop - printable representation of opcode
|
||||
*/
|
||||
static char *
|
||||
regprop(char *op)
|
||||
regprop(op)
|
||||
char *op;
|
||||
{
|
||||
char *p;
|
||||
register char *p;
|
||||
static char buf[50];
|
||||
|
||||
(void) strcpy(buf, ":");
|
||||
@ -1207,11 +1233,13 @@ regprop(char *op)
|
||||
*/
|
||||
|
||||
static int
|
||||
strcspn(char *s1, char *s2)
|
||||
strcspn(s1, s2)
|
||||
char *s1;
|
||||
char *s2;
|
||||
{
|
||||
char *scan1;
|
||||
char *scan2;
|
||||
int count;
|
||||
register char *scan1;
|
||||
register char *scan2;
|
||||
register int count;
|
||||
|
||||
count = 0;
|
||||
for (scan1 = s1; *scan1 != '\0'; scan1++) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 1984-2015 Mark Nudelman
|
||||
* Copyright (C) 1984-2017 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.
|
||||
@ -151,6 +151,7 @@ public int bl_fg_color; /* Color of blinking text */
|
||||
public int bl_bg_color;
|
||||
static int sy_fg_color; /* Color of system text (before less) */
|
||||
static int sy_bg_color;
|
||||
public int sgr_mode; /* Honor ANSI sequences rather than using above */
|
||||
|
||||
#else
|
||||
|
||||
@ -203,11 +204,11 @@ public int missing_cap = 0; /* Some capability is missing */
|
||||
|
||||
static int attrmode = AT_NORMAL;
|
||||
extern int binattr;
|
||||
extern int line_count;
|
||||
|
||||
#if !MSDOS_COMPILER
|
||||
static char *cheaper(char *t1, char *t2, char *def);
|
||||
static void tmodes(char *incap, char *outcap, char **instr, char **outstr,
|
||||
char *def_instr, char *def_outstr, char **spp);
|
||||
static char *cheaper();
|
||||
static void tmodes();
|
||||
#endif
|
||||
|
||||
/*
|
||||
@ -233,6 +234,7 @@ extern int wscroll;
|
||||
extern int screen_trashed;
|
||||
extern int tty;
|
||||
extern int top_scroll;
|
||||
extern int quit_if_one_screen;
|
||||
extern int oldbot;
|
||||
#if HILITE_SEARCH
|
||||
extern int hilite_search;
|
||||
@ -254,7 +256,8 @@ extern char *tgoto();
|
||||
* It doesn't matter whether an input \n is mapped to \r, or vice versa.
|
||||
*/
|
||||
public void
|
||||
raw_mode(int on)
|
||||
raw_mode(on)
|
||||
int on;
|
||||
{
|
||||
static int curr_on = 0;
|
||||
|
||||
@ -618,7 +621,8 @@ raw_mode(int on)
|
||||
static int hardcopy;
|
||||
|
||||
static char *
|
||||
ltget_env(char *capname)
|
||||
ltget_env(capname)
|
||||
char *capname;
|
||||
{
|
||||
char name[16];
|
||||
char *s;
|
||||
@ -646,7 +650,8 @@ ltget_env(char *capname)
|
||||
}
|
||||
|
||||
static int
|
||||
ltgetflag(char *capname)
|
||||
ltgetflag(capname)
|
||||
char *capname;
|
||||
{
|
||||
char *s;
|
||||
|
||||
@ -658,7 +663,8 @@ ltgetflag(char *capname)
|
||||
}
|
||||
|
||||
static int
|
||||
ltgetnum(char *capname)
|
||||
ltgetnum(capname)
|
||||
char *capname;
|
||||
{
|
||||
char *s;
|
||||
|
||||
@ -670,7 +676,9 @@ ltgetnum(char *capname)
|
||||
}
|
||||
|
||||
static char *
|
||||
ltgetstr(char *capname, char **pp)
|
||||
ltgetstr(capname, pp)
|
||||
char *capname;
|
||||
char **pp;
|
||||
{
|
||||
char *s;
|
||||
|
||||
@ -686,7 +694,7 @@ ltgetstr(char *capname, char **pp)
|
||||
* Get size of the output screen.
|
||||
*/
|
||||
public void
|
||||
scrsize(void)
|
||||
scrsize()
|
||||
{
|
||||
char *s;
|
||||
int sys_height;
|
||||
@ -816,7 +824,7 @@ scrsize(void)
|
||||
* Figure out how many empty loops it takes to delay a millisecond.
|
||||
*/
|
||||
static void
|
||||
get_clock(void)
|
||||
get_clock()
|
||||
{
|
||||
clock_t start;
|
||||
|
||||
@ -844,14 +852,15 @@ get_clock(void)
|
||||
* Delay for a specified number of milliseconds.
|
||||
*/
|
||||
static void
|
||||
dummy_func(void)
|
||||
dummy_func()
|
||||
{
|
||||
static long delay_dummy = 0;
|
||||
delay_dummy++;
|
||||
}
|
||||
|
||||
static void
|
||||
delay(int msec)
|
||||
delay(msec)
|
||||
int msec;
|
||||
{
|
||||
long i;
|
||||
|
||||
@ -873,7 +882,8 @@ delay(int msec)
|
||||
* Return the characters actually input by a "special" key.
|
||||
*/
|
||||
public char *
|
||||
special_key_str(int key)
|
||||
special_key_str(key)
|
||||
int key;
|
||||
{
|
||||
static char tbuf[40];
|
||||
char *s;
|
||||
@ -1045,7 +1055,7 @@ special_key_str(int key)
|
||||
* Get terminal capabilities via termcap.
|
||||
*/
|
||||
public void
|
||||
get_term(void)
|
||||
get_term()
|
||||
{
|
||||
#if MSDOS_COMPILER
|
||||
auto_wrap = 1;
|
||||
@ -1099,6 +1109,7 @@ get_term(void)
|
||||
so_bg_color = 9;
|
||||
bl_fg_color = 15;
|
||||
bl_bg_color = 0;
|
||||
sgr_mode = 0;
|
||||
|
||||
/*
|
||||
* Get size of the screen.
|
||||
@ -1342,14 +1353,16 @@ static int costcount;
|
||||
|
||||
/*ARGSUSED*/
|
||||
static int
|
||||
inc_costcount(int c)
|
||||
inc_costcount(c)
|
||||
int c;
|
||||
{
|
||||
costcount++;
|
||||
return (c);
|
||||
}
|
||||
|
||||
static int
|
||||
cost(char *t)
|
||||
cost(t)
|
||||
char *t;
|
||||
{
|
||||
costcount = 0;
|
||||
tputs(t, sc_height, inc_costcount);
|
||||
@ -1362,7 +1375,9 @@ cost(char *t)
|
||||
* cost (see cost() function).
|
||||
*/
|
||||
static char *
|
||||
cheaper(char *t1, char *t2, char *def)
|
||||
cheaper(t1, t2, def)
|
||||
char *t1, *t2;
|
||||
char *def;
|
||||
{
|
||||
if (*t1 == '\0' && *t2 == '\0')
|
||||
{
|
||||
@ -1379,8 +1394,14 @@ cheaper(char *t1, char *t2, char *def)
|
||||
}
|
||||
|
||||
static void
|
||||
tmodes(char *incap, char *outcap, char **instr, char **outstr, char *def_instr,
|
||||
char *def_outstr, char **spp)
|
||||
tmodes(incap, outcap, instr, outstr, def_instr, def_outstr, spp)
|
||||
char *incap;
|
||||
char *outcap;
|
||||
char **instr;
|
||||
char **outstr;
|
||||
char *def_instr;
|
||||
char *def_outstr;
|
||||
char **spp;
|
||||
{
|
||||
*instr = ltgetstr(incap, spp);
|
||||
if (*instr == NULL)
|
||||
@ -1429,8 +1450,11 @@ _settextposition(int row, int col)
|
||||
* Initialize the screen to the correct color at startup.
|
||||
*/
|
||||
static void
|
||||
initcolor(void)
|
||||
initcolor()
|
||||
{
|
||||
#if MSDOS_COMPILER==BORLANDC || MSDOS_COMPILER==DJGPPC
|
||||
intensevideo();
|
||||
#endif
|
||||
SETCOLORS(nm_fg_color, nm_bg_color);
|
||||
#if 0
|
||||
/*
|
||||
@ -1462,7 +1486,7 @@ initcolor(void)
|
||||
* Termcap-like init with a private win32 console.
|
||||
*/
|
||||
static void
|
||||
win32_init_term(void)
|
||||
win32_init_term()
|
||||
{
|
||||
CONSOLE_SCREEN_BUFFER_INFO scr;
|
||||
COORD size;
|
||||
@ -1513,10 +1537,12 @@ win32_deinit_term()
|
||||
* Initialize terminal
|
||||
*/
|
||||
public void
|
||||
init(void)
|
||||
init()
|
||||
{
|
||||
#if !MSDOS_COMPILER
|
||||
if (!no_init)
|
||||
if (quit_if_one_screen && line_count >= sc_height)
|
||||
quit_if_one_screen = FALSE;
|
||||
if (!no_init && !quit_if_one_screen)
|
||||
tputs(sc_init, sc_height, putchr);
|
||||
if (!no_keypad)
|
||||
tputs(sc_s_keypad, sc_height, putchr);
|
||||
@ -1549,14 +1575,14 @@ init(void)
|
||||
* Deinitialize terminal
|
||||
*/
|
||||
public void
|
||||
deinit(void)
|
||||
deinit()
|
||||
{
|
||||
if (!init_done)
|
||||
return;
|
||||
#if !MSDOS_COMPILER
|
||||
if (!no_keypad)
|
||||
tputs(sc_e_keypad, sc_height, putchr);
|
||||
if (!no_init)
|
||||
if (!no_init && !quit_if_one_screen)
|
||||
tputs(sc_deinit, sc_height, putchr);
|
||||
#else
|
||||
/* Restore system colors. */
|
||||
@ -1576,7 +1602,7 @@ deinit(void)
|
||||
* Home cursor (move to upper left corner of screen).
|
||||
*/
|
||||
public void
|
||||
home(void)
|
||||
home()
|
||||
{
|
||||
#if !MSDOS_COMPILER
|
||||
tputs(sc_home, 1, putchr);
|
||||
@ -1591,7 +1617,7 @@ home(void)
|
||||
* Should scroll the display down.
|
||||
*/
|
||||
public void
|
||||
add_line(void)
|
||||
add_line()
|
||||
{
|
||||
#if !MSDOS_COMPILER
|
||||
tputs(sc_addline, sc_height, putchr);
|
||||
@ -1649,7 +1675,8 @@ add_line(void)
|
||||
* into the scrollback buffer when we go down-one-line (in WIN32).
|
||||
*/
|
||||
public void
|
||||
remove_top(int n)
|
||||
remove_top(n)
|
||||
int n;
|
||||
{
|
||||
#if MSDOS_COMPILER==WIN32C
|
||||
SMALL_RECT rcSrc, rcClip;
|
||||
@ -1702,7 +1729,7 @@ remove_top(int n)
|
||||
* Clear the screen.
|
||||
*/
|
||||
static void
|
||||
win32_clear(void)
|
||||
win32_clear()
|
||||
{
|
||||
/*
|
||||
* This will clear only the currently visible rows of the NT
|
||||
@ -1733,7 +1760,8 @@ win32_clear(void)
|
||||
* window upward.
|
||||
*/
|
||||
public void
|
||||
win32_scroll_up(int n)
|
||||
win32_scroll_up(n)
|
||||
int n;
|
||||
{
|
||||
SMALL_RECT rcSrc, rcClip;
|
||||
CHAR_INFO fillchar;
|
||||
@ -1798,7 +1826,7 @@ win32_scroll_up(int n)
|
||||
* Move cursor to lower left corner of screen.
|
||||
*/
|
||||
public void
|
||||
lower_left(void)
|
||||
lower_left()
|
||||
{
|
||||
#if !MSDOS_COMPILER
|
||||
tputs(sc_lower_left, 1, putchr);
|
||||
@ -1812,7 +1840,7 @@ lower_left(void)
|
||||
* Move cursor to left position of current line.
|
||||
*/
|
||||
public void
|
||||
line_left(void)
|
||||
line_left()
|
||||
{
|
||||
#if !MSDOS_COMPILER
|
||||
tputs(sc_return, 1, putchr);
|
||||
@ -1844,7 +1872,7 @@ line_left(void)
|
||||
* (in lieu of SIGWINCH for WIN32).
|
||||
*/
|
||||
public void
|
||||
check_winch(void)
|
||||
check_winch()
|
||||
{
|
||||
#if MSDOS_COMPILER==WIN32C
|
||||
CONSOLE_SCREEN_BUFFER_INFO scr;
|
||||
@ -1874,7 +1902,8 @@ check_winch(void)
|
||||
* Goto a specific line on the screen.
|
||||
*/
|
||||
public void
|
||||
goto_line(int slinenum)
|
||||
goto_line(slinenum)
|
||||
int slinenum;
|
||||
{
|
||||
#if !MSDOS_COMPILER
|
||||
tputs(tgoto(sc_move, 0, slinenum), 1, putchr);
|
||||
@ -1892,7 +1921,7 @@ goto_line(int slinenum)
|
||||
* {{ Yuck! There must be a better way to get a visual bell. }}
|
||||
*/
|
||||
static void
|
||||
create_flash(void)
|
||||
create_flash()
|
||||
{
|
||||
#if MSDOS_COMPILER==MSOFTC
|
||||
struct videoconfig w;
|
||||
@ -1951,7 +1980,7 @@ create_flash(void)
|
||||
* Output the "visual bell", if there is one.
|
||||
*/
|
||||
public void
|
||||
vbell(void)
|
||||
vbell()
|
||||
{
|
||||
#if !MSDOS_COMPILER
|
||||
if (*sc_visual_bell == '\0')
|
||||
@ -2015,7 +2044,7 @@ vbell(void)
|
||||
* Make a noise.
|
||||
*/
|
||||
static void
|
||||
beep(void)
|
||||
beep()
|
||||
{
|
||||
#if !MSDOS_COMPILER
|
||||
putchr(CONTROL('G'));
|
||||
@ -2032,7 +2061,7 @@ beep(void)
|
||||
* Ring the terminal bell.
|
||||
*/
|
||||
public void
|
||||
bell(void)
|
||||
bell()
|
||||
{
|
||||
if (quiet == VERY_QUIET)
|
||||
vbell();
|
||||
@ -2044,7 +2073,7 @@ bell(void)
|
||||
* Clear the screen.
|
||||
*/
|
||||
public void
|
||||
clear(void)
|
||||
clear()
|
||||
{
|
||||
#if !MSDOS_COMPILER
|
||||
tputs(sc_clear, sc_height, putchr);
|
||||
@ -2063,7 +2092,7 @@ clear(void)
|
||||
* {{ This must not move the cursor. }}
|
||||
*/
|
||||
public void
|
||||
clear_eol(void)
|
||||
clear_eol()
|
||||
{
|
||||
#if !MSDOS_COMPILER
|
||||
tputs(sc_eol_clear, 1, putchr);
|
||||
@ -2122,7 +2151,7 @@ clear_eol(void)
|
||||
* Clear the screen if there's off-screen memory below the display.
|
||||
*/
|
||||
static void
|
||||
clear_eol_bot(void)
|
||||
clear_eol_bot()
|
||||
{
|
||||
#if MSDOS_COMPILER
|
||||
clear_eol();
|
||||
@ -2139,7 +2168,7 @@ clear_eol_bot(void)
|
||||
* Leave the cursor at the beginning of the bottom line.
|
||||
*/
|
||||
public void
|
||||
clear_bot(void)
|
||||
clear_bot()
|
||||
{
|
||||
/*
|
||||
* If we're in a non-normal attribute mode, temporarily exit
|
||||
@ -2164,7 +2193,8 @@ clear_bot(void)
|
||||
}
|
||||
|
||||
public void
|
||||
at_enter(int attr)
|
||||
at_enter(attr)
|
||||
int attr;
|
||||
{
|
||||
attr = apply_at_specials(attr);
|
||||
|
||||
@ -2202,7 +2232,7 @@ at_enter(int attr)
|
||||
}
|
||||
|
||||
public void
|
||||
at_exit(void)
|
||||
at_exit()
|
||||
{
|
||||
#if !MSDOS_COMPILER
|
||||
/* Undo things in the reverse order we did them. */
|
||||
@ -2223,7 +2253,8 @@ at_exit(void)
|
||||
}
|
||||
|
||||
public void
|
||||
at_switch(int attr)
|
||||
at_switch(attr)
|
||||
int attr;
|
||||
{
|
||||
int new_attrmode = apply_at_specials(attr);
|
||||
int ignore_modes = AT_ANSI;
|
||||
@ -2236,7 +2267,9 @@ at_switch(int attr)
|
||||
}
|
||||
|
||||
public int
|
||||
is_at_equiv(int attr1, int attr2)
|
||||
is_at_equiv(attr1, attr2)
|
||||
int attr1;
|
||||
int attr2;
|
||||
{
|
||||
attr1 = apply_at_specials(attr1);
|
||||
attr2 = apply_at_specials(attr2);
|
||||
@ -2245,7 +2278,8 @@ is_at_equiv(int attr1, int attr2)
|
||||
}
|
||||
|
||||
public int
|
||||
apply_at_specials(int attr)
|
||||
apply_at_specials(attr)
|
||||
int attr;
|
||||
{
|
||||
if (attr & AT_BINARY)
|
||||
attr |= binattr;
|
||||
@ -2262,7 +2296,7 @@ apply_at_specials(int attr)
|
||||
* and move the cursor left.
|
||||
*/
|
||||
public void
|
||||
backspace(void)
|
||||
backspace()
|
||||
{
|
||||
#if !MSDOS_COMPILER
|
||||
/*
|
||||
@ -2311,7 +2345,7 @@ backspace(void)
|
||||
* Output a plain backspace, without erasing the previous char.
|
||||
*/
|
||||
public void
|
||||
putbs(void)
|
||||
putbs()
|
||||
{
|
||||
#if !MSDOS_COMPILER
|
||||
tputs(sc_backspace, 1, putchr);
|
||||
@ -2350,7 +2384,8 @@ putbs(void)
|
||||
* Determine whether an input character is waiting to be read.
|
||||
*/
|
||||
static int
|
||||
win32_kbhit(HANDLE tty)
|
||||
win32_kbhit(tty)
|
||||
HANDLE tty;
|
||||
{
|
||||
INPUT_RECORD ip;
|
||||
DWORD read;
|
||||
@ -2406,7 +2441,16 @@ win32_kbhit(HANDLE tty)
|
||||
currentKey.scan = PCK_CTL_DELETE;
|
||||
break;
|
||||
}
|
||||
} else if (ip.Event.KeyEvent.dwControlKeyState & SHIFT_PRESSED)
|
||||
{
|
||||
switch (currentKey.scan)
|
||||
{
|
||||
case PCK_SHIFT_TAB: /* tab */
|
||||
currentKey.ascii = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
@ -2414,7 +2458,8 @@ win32_kbhit(HANDLE tty)
|
||||
* Read a character from the keyboard.
|
||||
*/
|
||||
public char
|
||||
WIN32getch(int tty)
|
||||
WIN32getch(tty)
|
||||
int tty;
|
||||
{
|
||||
int ascii;
|
||||
|
||||
@ -2447,7 +2492,9 @@ WIN32getch(int tty)
|
||||
/*
|
||||
*/
|
||||
public void
|
||||
WIN32setcolors(int fg, int bg)
|
||||
WIN32setcolors(fg, bg)
|
||||
int fg;
|
||||
int bg;
|
||||
{
|
||||
SETCOLORS(fg, bg);
|
||||
}
|
||||
@ -2455,7 +2502,9 @@ WIN32setcolors(int fg, int bg)
|
||||
/*
|
||||
*/
|
||||
public void
|
||||
WIN32textout(char *text, int len)
|
||||
WIN32textout(text, len)
|
||||
char *text;
|
||||
int len;
|
||||
{
|
||||
#if MSDOS_COMPILER==WIN32C
|
||||
DWORD written;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 1984-2015 Mark Nudelman
|
||||
* Copyright (C) 1984-2017 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.
|
||||
@ -45,7 +45,11 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
static int get_winsize(Display *dpy, Window window, int *p_width, int *p_height)
|
||||
static int get_winsize(dpy, window, p_width, p_height)
|
||||
Display *dpy;
|
||||
Window window;
|
||||
int *p_width;
|
||||
int *p_height;
|
||||
{
|
||||
XWindowAttributes win_attributes;
|
||||
XSizeHints hints;
|
||||
@ -75,7 +79,9 @@ static int get_winsize(Display *dpy, Window window, int *p_width, int *p_height)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
int main(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
{
|
||||
char *cp;
|
||||
Display *dpy;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 1984-2015 Mark Nudelman
|
||||
* Copyright (C) 1984-2017 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.
|
||||
@ -13,7 +13,6 @@
|
||||
*/
|
||||
|
||||
#include "less.h"
|
||||
#include "pattern.h"
|
||||
#include "position.h"
|
||||
#include "charset.h"
|
||||
|
||||
@ -29,7 +28,7 @@ extern int jump_sline;
|
||||
extern int bs_mode;
|
||||
extern int ctldisp;
|
||||
extern int status_col;
|
||||
extern void * constant ml_search;
|
||||
extern void *ml_search;
|
||||
extern POSITION start_attnpos;
|
||||
extern POSITION end_attnpos;
|
||||
extern int utf_mode;
|
||||
@ -103,7 +102,7 @@ static struct hilite_tree filter_anchor = HILITE_INITIALIZER();
|
||||
* search pattern and filter pattern.
|
||||
*/
|
||||
struct pattern_info {
|
||||
DEFINE_PATTERN(compiled);
|
||||
PATTERN_TYPE compiled;
|
||||
char* text;
|
||||
int search_type;
|
||||
};
|
||||
@ -121,9 +120,10 @@ static struct pattern_info filter_info;
|
||||
* Are there any uppercase letters in this string?
|
||||
*/
|
||||
static int
|
||||
is_ucase(constant char *str)
|
||||
is_ucase(str)
|
||||
char *str;
|
||||
{
|
||||
constant char *str_end = str + strlen(str);
|
||||
char *str_end = str + strlen(str);
|
||||
LWCHAR ch;
|
||||
|
||||
while (str < str_end)
|
||||
@ -139,13 +139,15 @@ is_ucase(constant char *str)
|
||||
* Compile and save a search pattern.
|
||||
*/
|
||||
static int
|
||||
set_pattern(struct pattern_info *info, char *pattern, int search_type)
|
||||
set_pattern(info, pattern, search_type)
|
||||
struct pattern_info *info;
|
||||
char *pattern;
|
||||
int search_type;
|
||||
{
|
||||
#if !NO_REGEX
|
||||
if (pattern == NULL)
|
||||
CLEAR_PATTERN(info->compiled);
|
||||
else if (compile_pattern(pattern, search_type,
|
||||
(void **)&info->compiled) < 0)
|
||||
else if (compile_pattern(pattern, search_type, &info->compiled) < 0)
|
||||
return -1;
|
||||
#endif
|
||||
/* Pattern compiled successfully; save the text too. */
|
||||
@ -175,13 +177,14 @@ set_pattern(struct pattern_info *info, char *pattern, int search_type)
|
||||
* Discard a saved pattern.
|
||||
*/
|
||||
static void
|
||||
clear_pattern(struct pattern_info *info)
|
||||
clear_pattern(info)
|
||||
struct pattern_info *info;
|
||||
{
|
||||
if (info->text != NULL)
|
||||
free(info->text);
|
||||
info->text = NULL;
|
||||
#if !NO_REGEX
|
||||
uncompile_pattern((void **)&info->compiled);
|
||||
uncompile_pattern(&info->compiled);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -189,7 +192,8 @@ clear_pattern(struct pattern_info *info)
|
||||
* Initialize saved pattern to nothing.
|
||||
*/
|
||||
static void
|
||||
init_pattern(struct pattern_info *info)
|
||||
init_pattern(info)
|
||||
struct pattern_info *info;
|
||||
{
|
||||
CLEAR_PATTERN(info->compiled);
|
||||
info->text = NULL;
|
||||
@ -200,7 +204,7 @@ init_pattern(struct pattern_info *info)
|
||||
* Initialize search variables.
|
||||
*/
|
||||
public void
|
||||
init_search(void)
|
||||
init_search()
|
||||
{
|
||||
init_pattern(&search_info);
|
||||
init_pattern(&filter_info);
|
||||
@ -210,7 +214,7 @@ init_search(void)
|
||||
* Determine which text conversions to perform before pattern matching.
|
||||
*/
|
||||
static int
|
||||
get_cvt_ops(void)
|
||||
get_cvt_ops()
|
||||
{
|
||||
int ops = 0;
|
||||
if (is_caseless || bs_mode == BS_SPECIAL)
|
||||
@ -234,7 +238,8 @@ get_cvt_ops(void)
|
||||
* Is there a previous (remembered) search pattern?
|
||||
*/
|
||||
static int
|
||||
prev_pattern(struct pattern_info *info)
|
||||
prev_pattern(info)
|
||||
struct pattern_info *info;
|
||||
{
|
||||
#if !NO_REGEX
|
||||
if ((info->search_type & SRCH_NO_REGEX) == 0)
|
||||
@ -250,7 +255,8 @@ prev_pattern(struct pattern_info *info)
|
||||
* If on==0, force all hilites off.
|
||||
*/
|
||||
public void
|
||||
repaint_hilite(int on)
|
||||
repaint_hilite(on)
|
||||
int on;
|
||||
{
|
||||
int slinenum;
|
||||
POSITION pos;
|
||||
@ -291,7 +297,7 @@ repaint_hilite(int on)
|
||||
* Clear the attn hilite.
|
||||
*/
|
||||
public void
|
||||
clear_attn(void)
|
||||
clear_attn()
|
||||
{
|
||||
int slinenum;
|
||||
POSITION old_start_attnpos;
|
||||
@ -338,7 +344,7 @@ clear_attn(void)
|
||||
* Hide search string highlighting.
|
||||
*/
|
||||
public void
|
||||
undo_search(void)
|
||||
undo_search()
|
||||
{
|
||||
if (!prev_pattern(&search_info))
|
||||
{
|
||||
@ -356,7 +362,8 @@ undo_search(void)
|
||||
* Clear the hilite list.
|
||||
*/
|
||||
public void
|
||||
clr_hlist(struct hilite_tree *anchor)
|
||||
clr_hlist(anchor)
|
||||
struct hilite_tree *anchor;
|
||||
{
|
||||
struct hilite_storage *hls;
|
||||
struct hilite_storage *nexthls;
|
||||
@ -377,13 +384,13 @@ clr_hlist(struct hilite_tree *anchor)
|
||||
}
|
||||
|
||||
public void
|
||||
clr_hilite(void)
|
||||
clr_hilite()
|
||||
{
|
||||
clr_hlist(&hilite_anchor);
|
||||
}
|
||||
|
||||
public void
|
||||
clr_filter(void)
|
||||
clr_filter()
|
||||
{
|
||||
clr_hlist(&filter_anchor);
|
||||
}
|
||||
@ -512,7 +519,9 @@ hlist_find(anchor, pos)
|
||||
* Should any characters in a specified range be highlighted?
|
||||
*/
|
||||
static int
|
||||
is_hilited_range(POSITION pos, POSITION epos)
|
||||
is_hilited_range(pos, epos)
|
||||
POSITION pos;
|
||||
POSITION epos;
|
||||
{
|
||||
struct hilite_node *n = hlist_find(&hilite_anchor, pos);
|
||||
return (n != NULL && (epos == NULL_POSITION || epos > n->r.hl_startpos));
|
||||
@ -522,7 +531,8 @@ is_hilited_range(POSITION pos, POSITION epos)
|
||||
* Is a line "filtered" -- that is, should it be hidden?
|
||||
*/
|
||||
public int
|
||||
is_filtered(POSITION pos)
|
||||
is_filtered(pos)
|
||||
POSITION pos;
|
||||
{
|
||||
struct hilite_node *n;
|
||||
|
||||
@ -538,7 +548,8 @@ is_filtered(POSITION pos)
|
||||
* just return pos.
|
||||
*/
|
||||
public POSITION
|
||||
next_unfiltered(POSITION pos)
|
||||
next_unfiltered(pos)
|
||||
POSITION pos;
|
||||
{
|
||||
struct hilite_node *n;
|
||||
|
||||
@ -559,7 +570,8 @@ next_unfiltered(POSITION pos)
|
||||
* we're filtered right to the beginning, otherwise just return pos.
|
||||
*/
|
||||
public POSITION
|
||||
prev_unfiltered(POSITION pos)
|
||||
prev_unfiltered(pos)
|
||||
POSITION pos;
|
||||
{
|
||||
struct hilite_node *n;
|
||||
|
||||
@ -584,7 +596,11 @@ prev_unfiltered(POSITION pos)
|
||||
* If nohide is nonzero, don't consider hide_hilite.
|
||||
*/
|
||||
public int
|
||||
is_hilited(POSITION pos, POSITION epos, int nohide, int *p_matches)
|
||||
is_hilited(pos, epos, nohide, p_matches)
|
||||
POSITION pos;
|
||||
POSITION epos;
|
||||
int nohide;
|
||||
int *p_matches;
|
||||
{
|
||||
int match;
|
||||
|
||||
@ -630,7 +646,8 @@ is_hilited(POSITION pos, POSITION epos, int nohide, int *p_matches)
|
||||
* capacity, or create a new one if not.
|
||||
*/
|
||||
static struct hilite_storage*
|
||||
hlist_getstorage(struct hilite_tree *anchor)
|
||||
hlist_getstorage(anchor)
|
||||
struct hilite_tree *anchor;
|
||||
{
|
||||
int capacity = 1;
|
||||
struct hilite_storage *s;
|
||||
@ -660,7 +677,8 @@ hlist_getstorage(struct hilite_tree *anchor)
|
||||
* tree.
|
||||
*/
|
||||
static struct hilite_node*
|
||||
hlist_getnode(struct hilite_tree *anchor)
|
||||
hlist_getnode(anchor)
|
||||
struct hilite_tree *anchor;
|
||||
{
|
||||
struct hilite_storage *s = hlist_getstorage(anchor);
|
||||
return &s->nodes[s->used++];
|
||||
@ -670,7 +688,9 @@ hlist_getnode(struct hilite_tree *anchor)
|
||||
* Rotate the tree left around a pivot node.
|
||||
*/
|
||||
static void
|
||||
hlist_rotate_left(struct hilite_tree *anchor, struct hilite_node *n)
|
||||
hlist_rotate_left(anchor, n)
|
||||
struct hilite_tree *anchor;
|
||||
struct hilite_node *n;
|
||||
{
|
||||
struct hilite_node *np = n->parent;
|
||||
struct hilite_node *nr = n->right;
|
||||
@ -699,7 +719,9 @@ hlist_rotate_left(struct hilite_tree *anchor, struct hilite_node *n)
|
||||
* Rotate the tree right around a pivot node.
|
||||
*/
|
||||
static void
|
||||
hlist_rotate_right(struct hilite_tree *anchor, struct hilite_node *n)
|
||||
hlist_rotate_right(anchor, n)
|
||||
struct hilite_tree *anchor;
|
||||
struct hilite_node *n;
|
||||
{
|
||||
struct hilite_node *np = n->parent;
|
||||
struct hilite_node *nl = n->left;
|
||||
@ -729,7 +751,9 @@ hlist_rotate_right(struct hilite_tree *anchor, struct hilite_node *n)
|
||||
* Add a new hilite to a hilite list.
|
||||
*/
|
||||
static void
|
||||
add_hilite(struct hilite_tree *anchor, struct hilite *hl)
|
||||
add_hilite(anchor, hl)
|
||||
struct hilite_tree *anchor;
|
||||
struct hilite *hl;
|
||||
{
|
||||
struct hilite_node *p, *n, *u;
|
||||
|
||||
@ -906,7 +930,11 @@ add_hilite(struct hilite_tree *anchor, struct hilite *hl)
|
||||
* Hilight every character in a range of displayed characters.
|
||||
*/
|
||||
static void
|
||||
create_hilites(POSITION linepos, int start_index, int end_index, int *chpos)
|
||||
create_hilites(linepos, start_index, end_index, chpos)
|
||||
POSITION linepos;
|
||||
int start_index;
|
||||
int end_index;
|
||||
int *chpos;
|
||||
{
|
||||
struct hilite hl;
|
||||
int i;
|
||||
@ -943,8 +971,14 @@ create_hilites(POSITION linepos, int start_index, int end_index, int *chpos)
|
||||
* sp,ep delimit the first match already found.
|
||||
*/
|
||||
static void
|
||||
hilite_line(POSITION linepos, char *line, int line_len, int *chpos, char *sp,
|
||||
char *ep, int cvt_ops)
|
||||
hilite_line(linepos, line, line_len, chpos, sp, ep, cvt_ops)
|
||||
POSITION linepos;
|
||||
char *line;
|
||||
int line_len;
|
||||
int *chpos;
|
||||
char *sp;
|
||||
char *ep;
|
||||
int cvt_ops;
|
||||
{
|
||||
char *searchp;
|
||||
char *line_end = line + line_len;
|
||||
@ -980,33 +1014,12 @@ hilite_line(POSITION linepos, char *line, int line_len, int *chpos, char *sp,
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Change the caseless-ness of searches.
|
||||
* Updates the internal search state to reflect a change in the -i flag.
|
||||
*/
|
||||
public void
|
||||
chg_caseless(void)
|
||||
{
|
||||
if (!is_ucase_pattern)
|
||||
/*
|
||||
* Pattern did not have uppercase.
|
||||
* Just set the search caselessness to the global caselessness.
|
||||
*/
|
||||
is_caseless = caseless;
|
||||
else
|
||||
/*
|
||||
* Pattern did have uppercase.
|
||||
* Discard the pattern; we can't change search caselessness now.
|
||||
*/
|
||||
clear_pattern(&search_info);
|
||||
}
|
||||
|
||||
#if HILITE_SEARCH
|
||||
/*
|
||||
* Find matching text which is currently on screen and highlight it.
|
||||
*/
|
||||
static void
|
||||
hilite_screen(void)
|
||||
hilite_screen()
|
||||
{
|
||||
struct scrpos scrpos;
|
||||
|
||||
@ -1021,7 +1034,7 @@ hilite_screen(void)
|
||||
* Change highlighting parameters.
|
||||
*/
|
||||
public void
|
||||
chg_hilite(void)
|
||||
chg_hilite()
|
||||
{
|
||||
/*
|
||||
* Erase any highlights currently on screen.
|
||||
@ -1041,7 +1054,8 @@ chg_hilite(void)
|
||||
* Figure out where to start a search.
|
||||
*/
|
||||
static POSITION
|
||||
search_pos(int search_type)
|
||||
search_pos(search_type)
|
||||
int search_type;
|
||||
{
|
||||
POSITION pos;
|
||||
int linenum;
|
||||
@ -1078,18 +1092,18 @@ search_pos(int search_type)
|
||||
* Search does not include current screen.
|
||||
*/
|
||||
if (search_type & SRCH_FORW)
|
||||
linenum = BOTTOM_PLUS_ONE;
|
||||
linenum = sc_height-1; /* BOTTOM_PLUS_ONE */
|
||||
else
|
||||
linenum = TOP;
|
||||
linenum = 0; /* TOP */
|
||||
} else if (how_search == OPT_ONPLUS && !(search_type & SRCH_AFTER_TARGET))
|
||||
{
|
||||
/*
|
||||
* Search includes all of displayed screen.
|
||||
*/
|
||||
if (search_type & SRCH_FORW)
|
||||
linenum = TOP;
|
||||
linenum = 0; /* TOP */
|
||||
else
|
||||
linenum = BOTTOM_PLUS_ONE;
|
||||
linenum = sc_height-1; /* BOTTOM_PLUS_ONE */
|
||||
} else
|
||||
{
|
||||
/*
|
||||
@ -1133,8 +1147,14 @@ search_pos(int search_type)
|
||||
* Search a subset of the file, specified by start/end position.
|
||||
*/
|
||||
static int
|
||||
search_range(POSITION pos, POSITION endpos, int search_type, int matches,
|
||||
int maxlines, POSITION *plinepos, POSITION *pendpos)
|
||||
search_range(pos, endpos, search_type, matches, maxlines, plinepos, pendpos)
|
||||
POSITION pos;
|
||||
POSITION endpos;
|
||||
int search_type;
|
||||
int matches;
|
||||
int maxlines;
|
||||
POSITION *plinepos;
|
||||
POSITION *pendpos;
|
||||
{
|
||||
char *line;
|
||||
char *cline;
|
||||
@ -1250,6 +1270,8 @@ search_range(POSITION pos, POSITION endpos, int search_type, int matches,
|
||||
hl.hl_startpos = linepos;
|
||||
hl.hl_endpos = pos;
|
||||
add_hilite(&filter_anchor, &hl);
|
||||
free(cline);
|
||||
free(chpos);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@ -1313,7 +1335,8 @@ search_range(POSITION pos, POSITION endpos, int search_type, int matches,
|
||||
* search for a pattern in history. If found, compile that pattern.
|
||||
*/
|
||||
static int
|
||||
hist_pattern(int search_type)
|
||||
hist_pattern(search_type)
|
||||
int search_type;
|
||||
{
|
||||
#if CMD_HISTORY
|
||||
char *pattern;
|
||||
@ -1337,6 +1360,30 @@ hist_pattern(int search_type)
|
||||
#endif /* CMD_HISTORY */
|
||||
}
|
||||
|
||||
/*
|
||||
* Change the caseless-ness of searches.
|
||||
* Updates the internal search state to reflect a change in the -i flag.
|
||||
*/
|
||||
public void
|
||||
chg_caseless()
|
||||
{
|
||||
if (!is_ucase_pattern)
|
||||
/*
|
||||
* Pattern did not have uppercase.
|
||||
* Just set the search caselessness to the global caselessness.
|
||||
*/
|
||||
is_caseless = caseless;
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Pattern did have uppercase.
|
||||
* Regenerate the pattern using the new state.
|
||||
*/
|
||||
clear_pattern(&search_info);
|
||||
hist_pattern(search_info.search_type);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Search for the n-th occurrence of a specified pattern,
|
||||
* either forward or backward.
|
||||
@ -1347,7 +1394,10 @@ hist_pattern(int search_type)
|
||||
* if less than n matches are found in this file.
|
||||
*/
|
||||
public int
|
||||
search(int search_type, char *pattern, int n)
|
||||
search(search_type, pattern, n)
|
||||
int search_type;
|
||||
char *pattern;
|
||||
int n;
|
||||
{
|
||||
POSITION pos;
|
||||
|
||||
@ -1481,7 +1531,10 @@ search(int search_type, char *pattern, int n)
|
||||
* prep_hilite asks that the range (spos,epos) be covered by the prep region.
|
||||
*/
|
||||
public void
|
||||
prep_hilite(POSITION spos, POSITION epos, int maxlines)
|
||||
prep_hilite(spos, epos, maxlines)
|
||||
POSITION spos;
|
||||
POSITION epos;
|
||||
int maxlines;
|
||||
{
|
||||
POSITION nprep_startpos = prep_startpos;
|
||||
POSITION nprep_endpos = prep_endpos;
|
||||
@ -1648,7 +1701,9 @@ prep_hilite(POSITION spos, POSITION epos, int maxlines)
|
||||
* Set the pattern to be used for line filtering.
|
||||
*/
|
||||
public void
|
||||
set_filter_pattern(char *pattern, int search_type)
|
||||
set_filter_pattern(pattern, search_type)
|
||||
char *pattern;
|
||||
int search_type;
|
||||
{
|
||||
clr_filter();
|
||||
if (pattern == NULL || *pattern == '\0')
|
||||
@ -1662,7 +1717,7 @@ set_filter_pattern(char *pattern, int search_type)
|
||||
* Is there a line filter in effect?
|
||||
*/
|
||||
public int
|
||||
is_filtering(void)
|
||||
is_filtering()
|
||||
{
|
||||
if (ch_getflags() & CH_HELPFILE)
|
||||
return (0);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 1984-2015 Mark Nudelman
|
||||
* Copyright (C) 1984-2017 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.
|
||||
@ -42,7 +42,8 @@ extern long jump_sline_fraction;
|
||||
*/
|
||||
/* ARGSUSED*/
|
||||
static RETSIGTYPE
|
||||
u_interrupt(int type)
|
||||
u_interrupt(type)
|
||||
int type;
|
||||
{
|
||||
bell();
|
||||
#if OS2
|
||||
@ -71,7 +72,8 @@ u_interrupt(int type)
|
||||
*/
|
||||
/* ARGSUSED*/
|
||||
static RETSIGTYPE
|
||||
stop(int type)
|
||||
stop(type)
|
||||
int type;
|
||||
{
|
||||
LSIGNAL(SIGTSTP, stop);
|
||||
sigs |= S_STOP;
|
||||
@ -86,7 +88,8 @@ stop(int type)
|
||||
*/
|
||||
/* ARGSUSED*/
|
||||
public RETSIGTYPE
|
||||
winch(int type)
|
||||
winch(type)
|
||||
int type;
|
||||
{
|
||||
LSIGNAL(SIGWINCH, winch);
|
||||
sigs |= S_WINCH;
|
||||
@ -100,7 +103,8 @@ winch(int type)
|
||||
*/
|
||||
/* ARGSUSED*/
|
||||
public RETSIGTYPE
|
||||
winch(int type)
|
||||
winch(type)
|
||||
int type;
|
||||
{
|
||||
LSIGNAL(SIGWIND, winch);
|
||||
sigs |= S_WINCH;
|
||||
@ -117,7 +121,8 @@ winch(int type)
|
||||
#include "windows.h"
|
||||
|
||||
static BOOL WINAPI
|
||||
wbreak_handler(DWORD dwCtrlType)
|
||||
wbreak_handler(dwCtrlType)
|
||||
DWORD dwCtrlType;
|
||||
{
|
||||
switch (dwCtrlType)
|
||||
{
|
||||
@ -136,7 +141,8 @@ wbreak_handler(DWORD dwCtrlType)
|
||||
* Set up the signal handlers.
|
||||
*/
|
||||
public void
|
||||
init_signals(int on)
|
||||
init_signals(on)
|
||||
int on;
|
||||
{
|
||||
if (on)
|
||||
{
|
||||
@ -188,7 +194,7 @@ init_signals(int on)
|
||||
* A received signal cause a bit to be set in "sigs".
|
||||
*/
|
||||
public void
|
||||
psignals(void)
|
||||
psignals()
|
||||
{
|
||||
int tsignals;
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 1984-2015 Mark Nudelman
|
||||
* Copyright (C) 1984-2017 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.
|
||||
@ -43,13 +43,13 @@ enum {
|
||||
T_GPATH /* 'GPATH': path name (global) */
|
||||
};
|
||||
|
||||
static enum tag_result findctag(char *tag);
|
||||
static enum tag_result findgtag(char *tag, int type);
|
||||
static char *nextgtag(void);
|
||||
static char *prevgtag(void);
|
||||
static POSITION ctagsearch(void);
|
||||
static POSITION gtagsearch(void);
|
||||
static int getentry(char *buf, char **tag, char **file, char **line);
|
||||
static enum tag_result findctag();
|
||||
static enum tag_result findgtag();
|
||||
static char *nextgtag();
|
||||
static char *prevgtag();
|
||||
static POSITION ctagsearch();
|
||||
static POSITION gtagsearch();
|
||||
static int getentry();
|
||||
|
||||
/*
|
||||
* The list of tags generated by the last findgtag() call.
|
||||
@ -63,8 +63,6 @@ struct taglist {
|
||||
struct tag *tl_first;
|
||||
struct tag *tl_last;
|
||||
};
|
||||
#define TAG_END ((struct tag *) &taglist)
|
||||
static struct taglist taglist = { TAG_END, TAG_END };
|
||||
struct tag {
|
||||
struct tag *next, *prev; /* List links */
|
||||
char *tag_file; /* Source file containing the tag */
|
||||
@ -72,6 +70,8 @@ struct tag {
|
||||
char *tag_pattern; /* Pattern used to find the tag */
|
||||
char tag_endline; /* True if the pattern includes '$' */
|
||||
};
|
||||
#define TAG_END ((struct tag *) &taglist)
|
||||
static struct taglist taglist = { TAG_END, TAG_END };
|
||||
static struct tag *curtag;
|
||||
|
||||
#define TAG_INS(tp) \
|
||||
@ -88,7 +88,7 @@ static struct tag *curtag;
|
||||
* Delete tag structures.
|
||||
*/
|
||||
public void
|
||||
cleantags(void)
|
||||
cleantags()
|
||||
{
|
||||
struct tag *tp;
|
||||
|
||||
@ -110,7 +110,12 @@ cleantags(void)
|
||||
* Create a new tag entry.
|
||||
*/
|
||||
static struct tag *
|
||||
maketagent(char *name, char *file, LINENUM linenum, char *pattern, int endline)
|
||||
maketagent(name, file, linenum, pattern, endline)
|
||||
char *name;
|
||||
char *file;
|
||||
LINENUM linenum;
|
||||
char *pattern;
|
||||
int endline;
|
||||
{
|
||||
struct tag *tp;
|
||||
|
||||
@ -133,7 +138,7 @@ maketagent(char *name, char *file, LINENUM linenum, char *pattern, int endline)
|
||||
* Get tag mode.
|
||||
*/
|
||||
public int
|
||||
gettagtype(void)
|
||||
gettagtype()
|
||||
{
|
||||
int f;
|
||||
|
||||
@ -164,7 +169,8 @@ gettagtype(void)
|
||||
* to find the tag.
|
||||
*/
|
||||
public void
|
||||
findtag(char *tag)
|
||||
findtag(tag)
|
||||
char *tag;
|
||||
{
|
||||
int type = gettagtype();
|
||||
enum tag_result result;
|
||||
@ -194,7 +200,7 @@ findtag(char *tag)
|
||||
* Search for a tag.
|
||||
*/
|
||||
public POSITION
|
||||
tagsearch(void)
|
||||
tagsearch()
|
||||
{
|
||||
if (curtag == NULL)
|
||||
return (NULL_POSITION); /* No gtags loaded! */
|
||||
@ -208,7 +214,8 @@ tagsearch(void)
|
||||
* Go to the next tag.
|
||||
*/
|
||||
public char *
|
||||
nexttag(int n)
|
||||
nexttag(n)
|
||||
int n;
|
||||
{
|
||||
char *tagfile = (char *) NULL;
|
||||
|
||||
@ -221,7 +228,8 @@ nexttag(int n)
|
||||
* Go to the previous tag.
|
||||
*/
|
||||
public char *
|
||||
prevtag(int n)
|
||||
prevtag(n)
|
||||
int n;
|
||||
{
|
||||
char *tagfile = (char *) NULL;
|
||||
|
||||
@ -234,7 +242,7 @@ prevtag(int n)
|
||||
* Return the total number of tags.
|
||||
*/
|
||||
public int
|
||||
ntags(void)
|
||||
ntags()
|
||||
{
|
||||
return total;
|
||||
}
|
||||
@ -243,7 +251,7 @@ ntags(void)
|
||||
* Return the sequence number of current tag.
|
||||
*/
|
||||
public int
|
||||
curr_tag(void)
|
||||
curr_tag()
|
||||
{
|
||||
return curseq;
|
||||
}
|
||||
@ -257,7 +265,8 @@ curr_tag(void)
|
||||
* Sets curtag to the first tag entry.
|
||||
*/
|
||||
static enum tag_result
|
||||
findctag(char *tag)
|
||||
findctag(tag)
|
||||
char *tag;
|
||||
{
|
||||
char *p;
|
||||
FILE *f;
|
||||
@ -368,7 +377,7 @@ findctag(char *tag)
|
||||
* Edit current tagged file.
|
||||
*/
|
||||
public int
|
||||
edit_tagfile(void)
|
||||
edit_tagfile()
|
||||
{
|
||||
if (curtag == NULL)
|
||||
return (1);
|
||||
@ -385,7 +394,7 @@ edit_tagfile(void)
|
||||
* parentheses (which are almost always found in a tag).
|
||||
*/
|
||||
static POSITION
|
||||
ctagsearch(void)
|
||||
ctagsearch()
|
||||
{
|
||||
POSITION pos, linepos;
|
||||
LINENUM linenum;
|
||||
@ -461,7 +470,9 @@ ctagsearch(void)
|
||||
* Sets curtag to the first tag entry.
|
||||
*/
|
||||
static enum tag_result
|
||||
findgtag(char *tag, int type)
|
||||
findgtag(tag, type)
|
||||
char *tag; /* tag to load */
|
||||
int type; /* tags type */
|
||||
{
|
||||
char buf[256];
|
||||
FILE *fp;
|
||||
@ -594,7 +605,7 @@ static int circular = 0; /* 1: circular tag structure */
|
||||
* appropriate tag.
|
||||
*/
|
||||
static char *
|
||||
nextgtag(void)
|
||||
nextgtag()
|
||||
{
|
||||
struct tag *tp;
|
||||
|
||||
@ -624,7 +635,7 @@ nextgtag(void)
|
||||
* at the appropriate tag.
|
||||
*/
|
||||
static char *
|
||||
prevgtag(void)
|
||||
prevgtag()
|
||||
{
|
||||
struct tag *tp;
|
||||
|
||||
@ -654,7 +665,7 @@ prevgtag(void)
|
||||
* if it was unable to position at the tag, 0 if successful.
|
||||
*/
|
||||
static POSITION
|
||||
gtagsearch(void)
|
||||
gtagsearch()
|
||||
{
|
||||
if (curtag == NULL)
|
||||
return (NULL_POSITION); /* No gtags loaded! */
|
||||
@ -690,7 +701,11 @@ gtagsearch(void)
|
||||
* into buf.
|
||||
*/
|
||||
static int
|
||||
getentry(char *buf, char **tag, char **file, char **line)
|
||||
getentry(buf, tag, file, line)
|
||||
char *buf; /* standard or extended ctags -x format data */
|
||||
char **tag; /* name of the tag we actually found */
|
||||
char **file; /* file in which to find this tag */
|
||||
char **line; /* line number of file where this tag is found */
|
||||
{
|
||||
char *p = buf;
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 1984-2015 Mark Nudelman
|
||||
* Copyright (C) 1984-2017 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.
|
||||
@ -31,7 +31,7 @@ extern int utf_mode;
|
||||
* Open keyboard for input.
|
||||
*/
|
||||
public void
|
||||
open_getchr(void)
|
||||
open_getchr()
|
||||
{
|
||||
#if MSDOS_COMPILER==WIN32C
|
||||
/* Need this to let child processes inherit our console handle */
|
||||
@ -85,7 +85,7 @@ open_getchr(void)
|
||||
* Close the keyboard.
|
||||
*/
|
||||
public void
|
||||
close_getchr(void)
|
||||
close_getchr()
|
||||
{
|
||||
#if MSDOS_COMPILER==WIN32C
|
||||
SetConsoleMode((HANDLE)tty, console_mode);
|
||||
@ -97,7 +97,7 @@ close_getchr(void)
|
||||
* Get a character from the keyboard.
|
||||
*/
|
||||
public int
|
||||
getchr(void)
|
||||
getchr()
|
||||
{
|
||||
char c;
|
||||
int result;
|
||||
@ -120,7 +120,11 @@ getchr(void)
|
||||
if (c == '\003')
|
||||
return (READ_INTR);
|
||||
#else
|
||||
result = iread(tty, &c, sizeof(char));
|
||||
{
|
||||
unsigned char uc;
|
||||
result = iread(tty, &uc, sizeof(char));
|
||||
c = (char) uc;
|
||||
}
|
||||
if (result == READ_INTR)
|
||||
return (READ_INTR);
|
||||
if (result < 0)
|
||||
@ -135,8 +139,8 @@ getchr(void)
|
||||
#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;
|
||||
static int hex_in = 0;
|
||||
static int hex_value = 0;
|
||||
if (c == CONTROL('A'))
|
||||
{
|
||||
hex_in = 2;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Generated by "./mkutable -f2 Cc Cf Cs Co Zl Zp -- unicode/UnicodeData.txt" on Mon Jul 14 16:21:22 PDT 2014 */
|
||||
/* Generated by "./mkutable -f2 Cc Cf Cs Co Zl Zp -- unicode/UnicodeData.txt" on Tue Sep 20 10:51:43 PDT 2016 */
|
||||
{ 0x0000, 0x001f }, /* Cc */
|
||||
{ 0x007f, 0x009f }, /* Cc */
|
||||
{ 0x00ad, 0x00ad }, /* Cf */
|
||||
@ -6,6 +6,7 @@
|
||||
{ 0x061c, 0x061c }, /* Cf */
|
||||
{ 0x06dd, 0x06dd }, /* Cf */
|
||||
{ 0x070f, 0x070f }, /* Cf */
|
||||
{ 0x08e2, 0x08e2 }, /* Cf */
|
||||
{ 0x180e, 0x180e }, /* Cf */
|
||||
{ 0x200b, 0x200f }, /* Cf */
|
||||
{ 0x2028, 0x2028 }, /* Zl */
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 1984-2015 Mark Nudelman
|
||||
* Copyright (C) 1984-2017 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.
|
||||
@ -789,8 +789,28 @@ v477 5/19/15 Fix off-by-one in jump_forw_buffered;
|
||||
don't add FAKE_* files to cmd history.
|
||||
v478 5/21/15 Fix nonportable pointer usage in hilite tree.
|
||||
v479 7/6/15 Allow %% escapes in LESSOPEN variable.
|
||||
v480 7/24/15 Fix bug in no-regex searches; support MSVC v1900.
|
||||
v481 8/20/15 Fix broken -g option.
|
||||
v480 7/24/15 Fix bug in no-regex searches; support MSVC v1900.
|
||||
v481 8/20/15 Fix broken -g option.
|
||||
-----------------------------------------------------------------
|
||||
v482 2/25/16 Update Unicode database to "2015-06-16, 20:24:00 GMT [KW]".
|
||||
v483 2/27/16 Regenerate hilite when change search caselessness.
|
||||
(Thanks to Jason Hood)
|
||||
Fix bug when terminal has no "cm". (Thanks to Noel Cragg)
|
||||
v484 9/20/16 Update to Unicode 9.0.0 database.
|
||||
v485 10/21/16 Fix "nothing to search" bug when top/bottom line is empty;
|
||||
Display line numbers in bold. (thanks to Jason Hood);
|
||||
Fix incorrect display when entering double-width chars in
|
||||
search string.
|
||||
v486 10/22/16 New commands ESC-{ and ESC-} to shift to start/end of
|
||||
displayed lines; new option -Da in Windows version to
|
||||
enable SGR mode (thanks to Jason Hood).
|
||||
v487 10/23/16 configure --help formatting.
|
||||
-----------------------------------------------------------------
|
||||
v488 2/23/17 Fix memory leaks in search (thanks to John Brooks).
|
||||
v489 3/30/17 Make -F not do init/deinit if file fits on one screen
|
||||
(thanks to Jindrich Novy).
|
||||
v490 4/5/17 Switch to ANSI prototypes in funcs.h; remove "register".
|
||||
v491 4/7/17 Fix signed char bug.
|
||||
*/
|
||||
|
||||
char version[] = "481";
|
||||
char version[] = "491";
|
||||
|
@ -1,81 +1,108 @@
|
||||
/* Generated by "./mkutable -f1 W -- unicode/EastAsianWidth.txt" on Mon Jul 14 16:21:23 PDT 2014 */
|
||||
{ 0x1100, 0x1100 }, /* W */
|
||||
/* Generated by "./mkutable -f1 W F -- unicode/EastAsianWidth.txt" on Tue Sep 20 10:51:43 PDT 2016 */
|
||||
{ 0x1100, 0x115f }, /* W */
|
||||
{ 0x231a, 0x231b }, /* W */
|
||||
{ 0x2329, 0x232a }, /* W */
|
||||
{ 0x2e80, 0x2e80 }, /* W */
|
||||
{ 0x2e9b, 0x2e9b }, /* W */
|
||||
{ 0x2f00, 0x2f00 }, /* W */
|
||||
{ 0x2ff0, 0x2ff0 }, /* W */
|
||||
{ 0x3001, 0x3001 }, /* W */
|
||||
{ 0x3004, 0x3012 }, /* W */
|
||||
{ 0x3014, 0x301e }, /* W */
|
||||
{ 0x3020, 0x3021 }, /* W */
|
||||
{ 0x302a, 0x302a }, /* W */
|
||||
{ 0x302e, 0x302e }, /* W */
|
||||
{ 0x3030, 0x3031 }, /* W */
|
||||
{ 0x3036, 0x3036 }, /* W */
|
||||
{ 0x3038, 0x3038 }, /* W */
|
||||
{ 0x303b, 0x303e }, /* W */
|
||||
{ 0x3041, 0x3041 }, /* W */
|
||||
{ 0x3099, 0x3099 }, /* W */
|
||||
{ 0x309b, 0x309b }, /* W */
|
||||
{ 0x309d, 0x309d }, /* W */
|
||||
{ 0x309f, 0x30a1 }, /* W */
|
||||
{ 0x30fb, 0x30fc }, /* W */
|
||||
{ 0x30ff, 0x30ff }, /* W */
|
||||
{ 0x3105, 0x3105 }, /* W */
|
||||
{ 0x3131, 0x3131 }, /* W */
|
||||
{ 0x3190, 0x3190 }, /* W */
|
||||
{ 0x3192, 0x3192 }, /* W */
|
||||
{ 0x3196, 0x3196 }, /* W */
|
||||
{ 0x31a0, 0x31a0 }, /* W */
|
||||
{ 0x31c0, 0x31c0 }, /* W */
|
||||
{ 0x31f0, 0x31f0 }, /* W */
|
||||
{ 0x3200, 0x3200 }, /* W */
|
||||
{ 0x3220, 0x3220 }, /* W */
|
||||
{ 0x322a, 0x322a }, /* W */
|
||||
{ 0x3250, 0x3251 }, /* W */
|
||||
{ 0x3260, 0x3260 }, /* W */
|
||||
{ 0x3280, 0x3280 }, /* W */
|
||||
{ 0x328a, 0x328a }, /* W */
|
||||
{ 0x32b1, 0x32b1 }, /* W */
|
||||
{ 0x32c0, 0x32c0 }, /* W */
|
||||
{ 0x3300, 0x3300 }, /* W */
|
||||
{ 0x3400, 0x3400 }, /* W */
|
||||
{ 0x4db6, 0x4db6 }, /* W */
|
||||
{ 0x4e00, 0x4e00 }, /* W */
|
||||
{ 0x9fcd, 0x9fcd }, /* W */
|
||||
{ 0xa000, 0xa000 }, /* W */
|
||||
{ 0xa015, 0xa016 }, /* W */
|
||||
{ 0xa490, 0xa490 }, /* W */
|
||||
{ 0xa960, 0xa960 }, /* W */
|
||||
{ 0xac00, 0xac00 }, /* W */
|
||||
{ 0xf900, 0xf900 }, /* W */
|
||||
{ 0xfa6e, 0xfa6e }, /* W */
|
||||
{ 0xfa70, 0xfa70 }, /* W */
|
||||
{ 0xfada, 0xfada }, /* W */
|
||||
{ 0xfe10, 0xfe10 }, /* W */
|
||||
{ 0xfe17, 0xfe19 }, /* W */
|
||||
{ 0xfe30, 0xfe31 }, /* W */
|
||||
{ 0xfe33, 0xfe33 }, /* W */
|
||||
{ 0xfe35, 0xfe45 }, /* W */
|
||||
{ 0xfe47, 0xfe49 }, /* W */
|
||||
{ 0xfe4d, 0xfe4d }, /* W */
|
||||
{ 0xfe50, 0xfe50 }, /* W */
|
||||
{ 0xfe54, 0xfe54 }, /* W */
|
||||
{ 0xfe58, 0xfe5f }, /* W */
|
||||
{ 0xfe62, 0xfe64 }, /* W */
|
||||
{ 0xfe68, 0xfe6a }, /* W */
|
||||
{ 0x1b000, 0x1b000 }, /* W */
|
||||
{ 0x1f200, 0x1f200 }, /* W */
|
||||
{ 0x1f210, 0x1f210 }, /* W */
|
||||
{ 0x1f240, 0x1f240 }, /* W */
|
||||
{ 0x1f250, 0x1f250 }, /* W */
|
||||
{ 0x20000, 0x20000 }, /* W */
|
||||
{ 0x2a6d7, 0x2a6d7 }, /* W */
|
||||
{ 0x2a700, 0x2a700 }, /* W */
|
||||
{ 0x2b735, 0x2b735 }, /* W */
|
||||
{ 0x2b740, 0x2b740 }, /* W */
|
||||
{ 0x2b81e, 0x2b81e }, /* W */
|
||||
{ 0x2f800, 0x2f800 }, /* W */
|
||||
{ 0x2fa1e, 0x2fa1e }, /* W */
|
||||
{ 0x30000, 0x30000 }, /* W */
|
||||
{ 0x23e9, 0x23ec }, /* W */
|
||||
{ 0x23f0, 0x23f0 }, /* W */
|
||||
{ 0x23f3, 0x23f3 }, /* W */
|
||||
{ 0x25fd, 0x25fe }, /* W */
|
||||
{ 0x2614, 0x2615 }, /* W */
|
||||
{ 0x2648, 0x2653 }, /* W */
|
||||
{ 0x267f, 0x267f }, /* W */
|
||||
{ 0x2693, 0x2693 }, /* W */
|
||||
{ 0x26a1, 0x26a1 }, /* W */
|
||||
{ 0x26aa, 0x26ab }, /* W */
|
||||
{ 0x26bd, 0x26be }, /* W */
|
||||
{ 0x26c4, 0x26c5 }, /* W */
|
||||
{ 0x26ce, 0x26ce }, /* W */
|
||||
{ 0x26d4, 0x26d4 }, /* W */
|
||||
{ 0x26ea, 0x26ea }, /* W */
|
||||
{ 0x26f2, 0x26f3 }, /* W */
|
||||
{ 0x26f5, 0x26f5 }, /* W */
|
||||
{ 0x26fa, 0x26fa }, /* W */
|
||||
{ 0x26fd, 0x26fd }, /* W */
|
||||
{ 0x2705, 0x2705 }, /* W */
|
||||
{ 0x270a, 0x270b }, /* W */
|
||||
{ 0x2728, 0x2728 }, /* W */
|
||||
{ 0x274c, 0x274c }, /* W */
|
||||
{ 0x274e, 0x274e }, /* W */
|
||||
{ 0x2753, 0x2755 }, /* W */
|
||||
{ 0x2757, 0x2757 }, /* W */
|
||||
{ 0x2795, 0x2797 }, /* W */
|
||||
{ 0x27b0, 0x27b0 }, /* W */
|
||||
{ 0x27bf, 0x27bf }, /* W */
|
||||
{ 0x2b1b, 0x2b1c }, /* W */
|
||||
{ 0x2b50, 0x2b50 }, /* W */
|
||||
{ 0x2b55, 0x2b55 }, /* W */
|
||||
{ 0x2e80, 0x2e99 }, /* W */
|
||||
{ 0x2e9b, 0x2ef3 }, /* W */
|
||||
{ 0x2f00, 0x2fd5 }, /* W */
|
||||
{ 0x2ff0, 0x2ffb }, /* W */
|
||||
{ 0x3000, 0x3000 }, /* F */
|
||||
{ 0x3001, 0x303e }, /* W */
|
||||
{ 0x3041, 0x3096 }, /* W */
|
||||
{ 0x3099, 0x30ff }, /* W */
|
||||
{ 0x3105, 0x312d }, /* W */
|
||||
{ 0x3131, 0x318e }, /* W */
|
||||
{ 0x3190, 0x31ba }, /* W */
|
||||
{ 0x31c0, 0x31e3 }, /* W */
|
||||
{ 0x31f0, 0x321e }, /* W */
|
||||
{ 0x3220, 0x3247 }, /* W */
|
||||
{ 0x3250, 0x32fe }, /* W */
|
||||
{ 0x3300, 0x4dbf }, /* W */
|
||||
{ 0x4e00, 0xa48c }, /* W */
|
||||
{ 0xa490, 0xa4c6 }, /* W */
|
||||
{ 0xa960, 0xa97c }, /* W */
|
||||
{ 0xac00, 0xd7a3 }, /* W */
|
||||
{ 0xf900, 0xfaff }, /* W */
|
||||
{ 0xfe10, 0xfe19 }, /* W */
|
||||
{ 0xfe30, 0xfe52 }, /* W */
|
||||
{ 0xfe54, 0xfe66 }, /* W */
|
||||
{ 0xfe68, 0xfe6b }, /* W */
|
||||
{ 0xff01, 0xff60 }, /* F */
|
||||
{ 0xffe0, 0xffe6 }, /* F */
|
||||
{ 0x16fe0, 0x16fe0 }, /* W */
|
||||
{ 0x17000, 0x187ec }, /* W */
|
||||
{ 0x18800, 0x18af2 }, /* W */
|
||||
{ 0x1b000, 0x1b001 }, /* W */
|
||||
{ 0x1f004, 0x1f004 }, /* W */
|
||||
{ 0x1f0cf, 0x1f0cf }, /* W */
|
||||
{ 0x1f18e, 0x1f18e }, /* W */
|
||||
{ 0x1f191, 0x1f19a }, /* W */
|
||||
{ 0x1f200, 0x1f202 }, /* W */
|
||||
{ 0x1f210, 0x1f23b }, /* W */
|
||||
{ 0x1f240, 0x1f248 }, /* W */
|
||||
{ 0x1f250, 0x1f251 }, /* W */
|
||||
{ 0x1f300, 0x1f320 }, /* W */
|
||||
{ 0x1f32d, 0x1f335 }, /* W */
|
||||
{ 0x1f337, 0x1f37c }, /* W */
|
||||
{ 0x1f37e, 0x1f393 }, /* W */
|
||||
{ 0x1f3a0, 0x1f3ca }, /* W */
|
||||
{ 0x1f3cf, 0x1f3d3 }, /* W */
|
||||
{ 0x1f3e0, 0x1f3f0 }, /* W */
|
||||
{ 0x1f3f4, 0x1f3f4 }, /* W */
|
||||
{ 0x1f3f8, 0x1f43e }, /* W */
|
||||
{ 0x1f440, 0x1f440 }, /* W */
|
||||
{ 0x1f442, 0x1f4fc }, /* W */
|
||||
{ 0x1f4ff, 0x1f53d }, /* W */
|
||||
{ 0x1f54b, 0x1f54e }, /* W */
|
||||
{ 0x1f550, 0x1f567 }, /* W */
|
||||
{ 0x1f57a, 0x1f57a }, /* W */
|
||||
{ 0x1f595, 0x1f596 }, /* W */
|
||||
{ 0x1f5a4, 0x1f5a4 }, /* W */
|
||||
{ 0x1f5fb, 0x1f64f }, /* W */
|
||||
{ 0x1f680, 0x1f6c5 }, /* W */
|
||||
{ 0x1f6cc, 0x1f6cc }, /* W */
|
||||
{ 0x1f6d0, 0x1f6d2 }, /* W */
|
||||
{ 0x1f6eb, 0x1f6ec }, /* W */
|
||||
{ 0x1f6f4, 0x1f6f6 }, /* W */
|
||||
{ 0x1f910, 0x1f91e }, /* W */
|
||||
{ 0x1f920, 0x1f927 }, /* W */
|
||||
{ 0x1f930, 0x1f930 }, /* W */
|
||||
{ 0x1f933, 0x1f93e }, /* W */
|
||||
{ 0x1f940, 0x1f94b }, /* W */
|
||||
{ 0x1f950, 0x1f95e }, /* W */
|
||||
{ 0x1f980, 0x1f991 }, /* W */
|
||||
{ 0x1f9c0, 0x1f9c0 }, /* W */
|
||||
{ 0x20000, 0x2fffd }, /* W */
|
||||
{ 0x30000, 0x3fffd }, /* W */
|
||||
|
@ -135,6 +135,11 @@
|
||||
*/
|
||||
#define TGETENT_OK 1
|
||||
|
||||
/*
|
||||
* HAVE_ANSI_PROTOS is 1 if your compiler supports ANSI function prototypes.
|
||||
*/
|
||||
#define HAVE_ANSI_PROTOS 1
|
||||
|
||||
/*
|
||||
* HAVE_SYS_TYPES_H is 1 if your system has <sys/types.h>.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user