Vendor import of less v491.

This commit is contained in:
Xin LI 2017-04-29 06:30:21 +00:00
parent 9c83c2751d
commit 6f90225e83
65 changed files with 831 additions and 698 deletions

View File

@ -32,7 +32,7 @@ DISTFILES = \
install.sh defines.h.in mkinstalldirs \ install.sh defines.h.in mkinstalldirs \
less.nro less.man lesskey.nro lesskey.man lessecho.nro lessecho.man \ less.nro less.man lesskey.nro lesskey.man lessecho.nro lessecho.man \
less.hlp \ less.hlp \
mkfuncs.awk mkhelp.c \ mkfuncs.pl mkhelp.c \
mkutable $(UNICODE_FILES) \ mkutable $(UNICODE_FILES) \
${DISTFILES_W} ${DISTFILES_W}
@ -61,7 +61,7 @@ ${srcdir}/configure: ${srcdir}/configure.ac \
funcs.h: ${SRC:%=${srcdir}/%} funcs.h: ${SRC:%=${srcdir}/%}
-mv -f ${srcdir}/funcs.h ${srcdir}/funcs.h.old -mv -f ${srcdir}/funcs.h ${srcdir}/funcs.h.old
awk -f ${srcdir}/mkfuncs.awk ${SRC:%=${srcdir}/%} >${srcdir}/funcs.h perl ${srcdir}/mkfuncs.pl ${SRC:%=${srcdir}/%} >${srcdir}/funcs.h
if cmp -s funcs.h funcs.h.old; then mv -f funcs.h.old funcs.h; fi if cmp -s funcs.h funcs.h.old; then mv -f funcs.h.old funcs.h; fi
lint: lint:

View File

@ -73,10 +73,6 @@ installcheck:
TAGS: TAGS:
etags *.c *.h etags *.c *.h
newfuncs:
command.com /c if exist funcs.h del funcs.h
${AWK} -f mkfuncs.awk ${OBJ:.${O}=.c} > funcs.h
clean: clean:
command.com /c for %f in (*.${O} less lesskey lessecho *.exe) do if exist %f del %f command.com /c for %f in (*.${O} less lesskey lessecho *.exe) do if exist %f del %f

14
NEWS
View File

@ -9,6 +9,20 @@
To report bugs, suggestions or comments, send email to bug-less@gnu.org To report bugs, suggestions or comments, send email to bug-less@gnu.org
======================================================================
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 Major changes between "less" versions 481 and 487

4
README
View File

@ -1,7 +1,7 @@
Less, version 487 Less, version 491
This is the distribution of less, version 487, released 25 Oct 2016. 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 part of the GNU project (http://www.gnu.org).
This program is free software. You may redistribute it and/or This program is free software. You may redistribute it and/or

10
brac.c
View File

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 1984-2016 Mark Nudelman * Copyright (C) 1984-2017 Mark Nudelman
* *
* You may distribute under the terms of either the GNU General Public * You may distribute under the terms of either the GNU General Public
* License or the Less License, as specified in the README file. * License or the Less License, as specified in the README file.
@ -25,13 +25,13 @@
*/ */
public void public void
match_brac(obrac, cbrac, forwdir, n) match_brac(obrac, cbrac, forwdir, n)
register int obrac; int obrac;
register int cbrac; int cbrac;
int forwdir; int forwdir;
int n; int n;
{ {
register int c; int c;
register int nest; int nest;
POSITION pos; POSITION pos;
int (*chget)(); int (*chget)();

44
ch.c
View File

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 1984-2016 Mark Nudelman * Copyright (C) 1984-2017 Mark Nudelman
* *
* You may distribute under the terms of either the GNU General Public * You may distribute under the terms of either the GNU General Public
* License or the Less License, as specified in the README file. * License or the Less License, as specified in the README file.
@ -146,11 +146,11 @@ static int ch_addbuf();
int int
ch_get() ch_get()
{ {
register struct buf *bp; struct buf *bp;
register struct bufnode *bn; struct bufnode *bn;
register int n; int n;
register int slept; int slept;
register int h; int h;
POSITION pos; POSITION pos;
POSITION len; POSITION len;
@ -419,8 +419,8 @@ end_logfile()
public void public void
sync_logfile() sync_logfile()
{ {
register struct buf *bp; struct buf *bp;
register struct bufnode *bn; struct bufnode *bn;
int warned = FALSE; int warned = FALSE;
BLOCKNUM block; BLOCKNUM block;
BLOCKNUM nblocks; BLOCKNUM nblocks;
@ -457,9 +457,9 @@ sync_logfile()
buffered(block) buffered(block)
BLOCKNUM block; BLOCKNUM block;
{ {
register struct buf *bp; struct buf *bp;
register struct bufnode *bn; struct bufnode *bn;
register int h; int h;
h = BUFHASH(block); h = BUFHASH(block);
FOR_BUFS_IN_CHAIN(h, bn) FOR_BUFS_IN_CHAIN(h, bn)
@ -477,7 +477,7 @@ buffered(block)
*/ */
public int public int
ch_seek(pos) ch_seek(pos)
register POSITION pos; POSITION pos;
{ {
BLOCKNUM new_block; BLOCKNUM new_block;
POSITION len; POSITION len;
@ -544,8 +544,8 @@ ch_end_seek()
public int public int
ch_end_buffer_seek() ch_end_buffer_seek()
{ {
register struct buf *bp; struct buf *bp;
register struct bufnode *bn; struct bufnode *bn;
POSITION buf_pos; POSITION buf_pos;
POSITION end_pos; POSITION end_pos;
@ -572,8 +572,8 @@ ch_end_buffer_seek()
public int public int
ch_beg_seek() ch_beg_seek()
{ {
register struct bufnode *bn; struct bufnode *bn;
register struct bufnode *firstbn; struct bufnode *firstbn;
/* /*
* Try a plain ch_seek first. * Try a plain ch_seek first.
@ -632,7 +632,7 @@ ch_tell()
public int public int
ch_forw_get() ch_forw_get()
{ {
register int c; int c;
if (thisfile == NULL) if (thisfile == NULL)
return (EOI); return (EOI);
@ -695,7 +695,7 @@ ch_setbufspace(bufspace)
public void public void
ch_flush() ch_flush()
{ {
register struct bufnode *bn; struct bufnode *bn;
if (thisfile == NULL) if (thisfile == NULL)
return; return;
@ -762,8 +762,8 @@ ch_flush()
static int static int
ch_addbuf() ch_addbuf()
{ {
register struct buf *bp; struct buf *bp;
register struct bufnode *bn; struct bufnode *bn;
/* /*
* Allocate and initialize a new buffer and link it * Allocate and initialize a new buffer and link it
@ -787,7 +787,7 @@ ch_addbuf()
static void static void
init_hashtbl() init_hashtbl()
{ {
register int h; int h;
for (h = 0; h < BUFHASH_SIZE; h++) for (h = 0; h < BUFHASH_SIZE; h++)
{ {
@ -802,7 +802,7 @@ init_hashtbl()
static void static void
ch_delbufs() ch_delbufs()
{ {
register struct bufnode *bn; struct bufnode *bn;
while (ch_bufhead != END_OF_CHAIN) while (ch_bufhead != END_OF_CHAIN)
{ {

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 1984-2016 Mark Nudelman * Copyright (C) 1984-2017 Mark Nudelman
* *
* You may distribute under the terms of either the GNU General Public * You may distribute under the terms of either the GNU General Public
* License or the Less License, as specified in the README file. * License or the Less License, as specified in the README file.
@ -135,9 +135,9 @@ public int binattr = AT_STANDOUT;
ichardef(s) ichardef(s)
char *s; char *s;
{ {
register char *cp; char *cp;
register int n; int n;
register char v; char v;
n = 0; n = 0;
v = 0; v = 0;
@ -190,11 +190,11 @@ ichardef(s)
*/ */
static int static int
icharset(name, no_error) icharset(name, no_error)
register char *name; char *name;
int no_error; int no_error;
{ {
register struct charset *p; struct charset *p;
register struct cs_alias *a; struct cs_alias *a;
if (name == NULL || *name == '\0') if (name == NULL || *name == '\0')
return (0); return (0);
@ -234,7 +234,7 @@ icharset(name, no_error)
static void static void
ilocale() ilocale()
{ {
register int c; int c;
for (c = 0; c < (int) sizeof(chardef); c++) for (c = 0; c < (int) sizeof(chardef); c++)
{ {
@ -486,7 +486,7 @@ prutfchar(ch)
*/ */
public int public int
utf_len(ch) utf_len(ch)
char ch; unsigned char ch;
{ {
if ((ch & 0x80) == 0) if ((ch & 0x80) == 0)
return 1; return 1;
@ -508,17 +508,18 @@ utf_len(ch)
* Does the parameter point to the lead byte of a well-formed UTF-8 character? * Does the parameter point to the lead byte of a well-formed UTF-8 character?
*/ */
public int public int
is_utf8_well_formed(s, slen) is_utf8_well_formed(ss, slen)
unsigned char *s; char *ss;
int slen; int slen;
{ {
int i; int i;
int len; int len;
unsigned char *s = (unsigned char *) ss;
if (IS_UTF8_INVALID(s[0])) if (IS_UTF8_INVALID(s[0]))
return (0); return (0);
len = utf_len((char) s[0]); len = utf_len(s[0]);
if (len > slen) if (len > slen)
return (0); return (0);
if (len == 1) if (len == 1)
@ -546,7 +547,7 @@ is_utf8_well_formed(s, slen)
*/ */
public int public int
utf_bin_count(data, len) utf_bin_count(data, len)
unsigned char *data; char *data;
int len; int len;
{ {
int bin_count = 0; int bin_count = 0;
@ -554,7 +555,7 @@ utf_bin_count(data, len)
{ {
if (is_utf8_well_formed(data, len)) if (is_utf8_well_formed(data, len))
{ {
int clen = utf_len(*data); int clen = utf_len(*data & 0377);
data += clen; data += clen;
len -= clen; len -= clen;
} else } else
@ -564,7 +565,7 @@ utf_bin_count(data, len)
do { do {
++data; ++data;
--len; --len;
} while (len > 0 && !IS_UTF8_LEAD(*data)); } while (len > 0 && !IS_UTF8_LEAD(*data & 0377));
} }
} }
return (bin_count); return (bin_count);
@ -575,7 +576,7 @@ utf_bin_count(data, len)
*/ */
public LWCHAR public LWCHAR
get_wchar(p) get_wchar(p)
char *p; constant char *p;
{ {
switch (utf_len(p[0])) switch (utf_len(p[0]))
{ {
@ -679,7 +680,7 @@ put_wchar(pp, ch)
step_char(pp, dir, limit) step_char(pp, dir, limit)
char **pp; char **pp;
signed int dir; signed int dir;
char *limit; constant char *limit;
{ {
LWCHAR ch; LWCHAR ch;
int len; int len;
@ -698,7 +699,7 @@ step_char(pp, dir, limit)
if (p + len > limit) if (p + len > limit)
{ {
ch = 0; ch = 0;
p = limit; p = (char *) limit;
} else } else
{ {
ch = get_wchar(p); ch = get_wchar(p);

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 1984-2016 Mark Nudelman * Copyright (C) 1984-2017 Mark Nudelman
* *
* You may distribute under the terms of either the GNU General Public * You may distribute under the terms of either the GNU General Public
* License or the Less License, as specified in the README file. * License or the Less License, as specified in the README file.

2
cmd.h
View File

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 1984-2016 Mark Nudelman * Copyright (C) 1984-2017 Mark Nudelman
* *
* You may distribute under the terms of either the GNU General Public * You may distribute under the terms of either the GNU General Public
* License or the Less License, as specified in the README file. * License or the Less License, as specified in the README file.

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 1984-2016 Mark Nudelman * Copyright (C) 1984-2017 Mark Nudelman
* *
* You may distribute under the terms of either the GNU General Public * You may distribute under the terms of either the GNU General Public
* License or the Less License, as specified in the README file. * License or the Less License, as specified in the README file.
@ -76,25 +76,25 @@ struct mlist
*/ */
struct mlist mlist_search = struct mlist mlist_search =
{ &mlist_search, &mlist_search, &mlist_search, NULL, 0 }; { &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 = struct mlist mlist_examine =
{ &mlist_examine, &mlist_examine, &mlist_examine, NULL, 0 }; { &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 #if SHELL_ESCAPE || PIPEC
struct mlist mlist_shell = struct mlist mlist_shell =
{ &mlist_shell, &mlist_shell, &mlist_shell, NULL, 0 }; { &mlist_shell, &mlist_shell, &mlist_shell, NULL, 0 };
public void * constant ml_shell = (void *) &mlist_shell; public void *ml_shell = (void *) &mlist_shell;
#endif #endif
#else /* CMD_HISTORY */ #else /* CMD_HISTORY */
/* If CMD_HISTORY is off, these are just flags. */ /* If CMD_HISTORY is off, these are just flags. */
public void * constant ml_search = (void *)1; public void *ml_search = (void *)1;
public void * constant ml_examine = (void *)2; public void *ml_examine = (void *)2;
#if SHELL_ESCAPE || PIPEC #if SHELL_ESCAPE || PIPEC
public void * constant ml_shell = (void *)3; public void *ml_shell = (void *)3;
#endif #endif
#endif /* CMD_HISTORY */ #endif /* CMD_HISTORY */
@ -141,14 +141,14 @@ clear_cmd()
*/ */
public void public void
cmd_putstr(s) cmd_putstr(s)
char *s; constant char *s;
{ {
LWCHAR prev_ch = 0; LWCHAR prev_ch = 0;
LWCHAR ch; LWCHAR ch;
char *endline = s + strlen(s); constant char *endline = s + strlen(s);
while (*s != '\0') while (*s != '\0')
{ {
char *ns = s; char *ns = (char *) s;
int width; int width;
ch = step_char(&ns, +1, endline); ch = step_char(&ns, +1, endline);
while (s < ns) while (s < ns)
@ -262,7 +262,7 @@ cmd_step_left(pp, pwidth, bswidth)
*/ */
static void static void
cmd_repaint(old_cp) cmd_repaint(old_cp)
char *old_cp; constant char *old_cp;
{ {
/* /*
* Repaint the line from the current position. * Repaint the line from the current position.
@ -323,8 +323,8 @@ cmd_home()
static void static void
cmd_lshift() cmd_lshift()
{ {
char *s; constant char *s;
char *save_cp; constant char *save_cp;
int cols; int cols;
/* /*
@ -342,7 +342,7 @@ cmd_lshift()
while (*s != '\0') while (*s != '\0')
{ {
int width; int width;
char *ns = s; constant char *ns = s;
cmd_step_right(&ns, &width, NULL); cmd_step_right(&ns, &width, NULL);
if (width > 0) if (width > 0)
break; break;
@ -361,8 +361,8 @@ cmd_lshift()
static void static void
cmd_rshift() cmd_rshift()
{ {
char *s; constant char *s;
char *save_cp; constant char *save_cp;
int cols; int cols;
/* /*
@ -493,7 +493,7 @@ cmd_ichar(cs, clen)
static int static int
cmd_erase() cmd_erase()
{ {
register char *s; char *s;
int clen; int clen;
if (cp == cmdbuf) if (cp == cmdbuf)
@ -661,7 +661,7 @@ set_mlist(mlist, cmdflags)
cmd_updown(action) cmd_updown(action)
int action; int action;
{ {
char *s; constant char *s;
struct mlist *ml; struct mlist *ml;
if (curr_mlist == NULL) if (curr_mlist == NULL)
@ -723,7 +723,7 @@ cmd_updown(action)
public void public void
cmd_addhist(mlist, cmd, modified) cmd_addhist(mlist, cmd, modified)
struct mlist *mlist; struct mlist *mlist;
char *cmd; constant char *cmd;
int modified; int modified;
{ {
#if CMD_HISTORY #if CMD_HISTORY
@ -940,7 +940,7 @@ delimit_word()
char *p; char *p;
int delim_quoted = 0; int delim_quoted = 0;
int meta_quoted = 0; int meta_quoted = 0;
char *esc = get_meta_escape(); constant char *esc = get_meta_escape();
int esclen = (int) strlen(esc); int esclen = (int) strlen(esc);
#endif #endif

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 1984-2016 Mark Nudelman * Copyright (C) 1984-2017 Mark Nudelman
* *
* You may distribute under the terms of either the GNU General Public * You may distribute under the terms of either the GNU General Public
* License or the Less License, as specified in the README file. * License or the Less License, as specified in the README file.
@ -42,10 +42,10 @@ extern char *curr_altfilename;
extern char version[]; extern char version[];
extern struct scrpos initial_scrpos; extern struct scrpos initial_scrpos;
extern IFILE curr_ifile; extern IFILE curr_ifile;
extern void constant *ml_search; extern void *ml_search;
extern void constant *ml_examine; extern void *ml_examine;
#if SHELL_ESCAPE || PIPEC #if SHELL_ESCAPE || PIPEC
extern void constant *ml_shell; extern void *ml_shell;
#endif #endif
#if EDITOR #if EDITOR
extern char *editor; extern char *editor;
@ -106,7 +106,7 @@ cmd_exec()
start_mca(action, prompt, mlist, cmdflags) start_mca(action, prompt, mlist, cmdflags)
int action; int action;
constant char *prompt; constant char *prompt;
constant void *mlist; void *mlist;
int cmdflags; int cmdflags;
{ {
mca = action; mca = action;
@ -206,7 +206,7 @@ mca_opt_toggle()
static void static void
exec_mca() exec_mca()
{ {
register char *cbuf; char *cbuf;
cmd_exec(); cmd_exec();
cbuf = get_cmdbuf(); cbuf = get_cmdbuf();
@ -685,7 +685,7 @@ make_display()
static void static void
prompt() prompt()
{ {
register constant char *p; constant char *p;
if (ungot != NULL && !ungot->ug_end_command) if (ungot != NULL && !ungot->ug_end_command)
{ {
@ -849,7 +849,7 @@ ungetcc(c)
ungetsc(s) ungetsc(s)
char *s; char *s;
{ {
register char *p; char *p;
for (p = s + strlen(s) - 1; p >= s; p--) for (p = s + strlen(s) - 1; p >= s; p--)
ungetcc(*p); ungetcc(*p);
@ -866,7 +866,7 @@ multi_search(pattern, n, silent)
int n; int n;
int silent; int silent;
{ {
register int nomore; int nomore;
IFILE save_ifile; IFILE save_ifile;
int changed_file; int changed_file;
@ -1001,9 +1001,9 @@ forw_loop(until_hilite)
public void public void
commands() commands()
{ {
register int c; int c;
register int action; int action;
register char *cbuf; char *cbuf;
int newaction; int newaction;
int save_search_type; int save_search_type;
char *extra; char *extra;

24
configure vendored
View File

@ -4713,6 +4713,30 @@ $as_echo "no" >&6; }
fi fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
# Checks for ANSI function prototypes.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI function prototypes" >&5
$as_echo_n "checking for ANSI function prototypes... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
int f(int a) { return a; }
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }; $as_echo "#define HAVE_ANSI_PROTOS 1" >>confdefs.h
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
# Checks for library functions. # Checks for library functions.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking return type of signal handlers" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking return type of signal handlers" >&5
$as_echo_n "checking return type of signal handlers... " >&6; } $as_echo_n "checking return type of signal handlers... " >&6; }

View File

@ -251,6 +251,11 @@ AC_TRY_COMPILE([#include <sys/types.h>
[struct stat s; dev_t dev = s.st_dev; ino_t ino = s.st_ino;], [struct stat s; dev_t dev = s.st_dev; ino_t ino = s.st_ino;],
[AC_MSG_RESULT(yes); AC_DEFINE(HAVE_STAT_INO)], [AC_MSG_RESULT(no)]) [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_STAT_INO)], [AC_MSG_RESULT(no)])
# Checks for ANSI function prototypes.
AC_MSG_CHECKING(for ANSI function prototypes)
AC_TRY_COMPILE([], [int f(int a) { return a; }],
[AC_MSG_RESULT(yes); AC_DEFINE(HAVE_ANSI_PROTOS)], [AC_MSG_RESULT(no)])
# Checks for library functions. # Checks for library functions.
AC_TYPE_SIGNAL AC_TYPE_SIGNAL
AC_CHECK_FUNCS([fsync popen _setjmp sigprocmask sigsetmask snprintf stat system fchmod]) AC_CHECK_FUNCS([fsync popen _setjmp sigprocmask sigsetmask snprintf stat system fchmod])
@ -620,6 +625,11 @@ AH_TOP([
*/ */
#define TGETENT_OK 1 #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>. * HAVE_SYS_TYPES_H is 1 if your system has <sys/types.h>.
*/ */

4
cvt.c
View File

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 1984-2016 Mark Nudelman * Copyright (C) 1984-2017 Mark Nudelman
* *
* You may distribute under the terms of either the GNU General Public * You may distribute under the terms of either the GNU General Public
* License or the Less License, as specified in the README file. * License or the Less License, as specified in the README file.
@ -65,7 +65,7 @@ cvt_text(odst, osrc, chpos, lenp, ops)
char *dst; char *dst;
char *edst = odst; char *edst = odst;
char *src; char *src;
register char *src_end; char *src_end;
LWCHAR ch; LWCHAR ch;
if (lenp != NULL) if (lenp != NULL)

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 1984-2016 Mark Nudelman * Copyright (C) 1984-2017 Mark Nudelman
* *
* You may distribute under the terms of either the GNU General Public * You may distribute under the terms of either the GNU General Public
* License or the Less License, as specified in the README file. * License or the Less License, as specified in the README file.
@ -237,9 +237,9 @@ expand_special_keys(table, len)
char *table; char *table;
int len; int len;
{ {
register char *fm; char *fm;
register char *to; char *to;
register int a; int a;
char *repl; char *repl;
int klen; int klen;
@ -329,7 +329,7 @@ add_cmd_table(tlist, buf, len)
char *buf; char *buf;
int len; int len;
{ {
register struct tablelist *t; struct tablelist *t;
if (len == 0) if (len == 0)
return (0); return (0);
@ -397,9 +397,9 @@ cmd_search(cmd, table, endtable, sp)
char *endtable; char *endtable;
char **sp; char **sp;
{ {
register char *p; char *p;
register char *q; char *q;
register int a; int a;
*sp = NULL; *sp = NULL;
for (p = table, q = cmd; p < endtable; p++, q++) for (p = table, q = cmd; p < endtable; p++, q++)
@ -488,8 +488,8 @@ cmd_decode(tlist, cmd, sp)
char *cmd; char *cmd;
char **sp; char **sp;
{ {
register struct tablelist *t; struct tablelist *t;
register int action = A_INVALID; int action = A_INVALID;
/* /*
* Search thru all the command tables. * Search thru all the command tables.
@ -599,8 +599,8 @@ new_lesskey(buf, len, sysvar)
int sysvar; int sysvar;
{ {
char *p; char *p;
register int c; int c;
register int n; int n;
/* /*
* New-style lesskey file. * New-style lesskey file.
@ -651,10 +651,10 @@ lesskey(filename, sysvar)
char *filename; char *filename;
int sysvar; int sysvar;
{ {
register char *buf; char *buf;
register POSITION len; POSITION len;
register long n; long n;
register int f; int f;
if (secure) if (secure)
return (1); return (1);

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 1984-2016 Mark Nudelman * Copyright (C) 1984-2017 Mark Nudelman
* *
* You may distribute under the terms of either the GNU General Public * You may distribute under the terms of either the GNU General Public
* License or the Less License, as specified in the README file. * License or the Less License, as specified in the README file.
@ -145,6 +145,11 @@
*/ */
#define PATHNAME_SEP "\\" #define PATHNAME_SEP "\\"
/*
* 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>. * HAVE_SYS_TYPES_H is 1 if your system has <sys/types.h>.
*/ */

View File

@ -133,6 +133,11 @@
*/ */
#define TGETENT_OK 1 #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>. * HAVE_SYS_TYPES_H is 1 if your system has <sys/types.h>.
*/ */

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 1984-2016 Mark Nudelman * Copyright (C) 1984-2017 Mark Nudelman
* *
* You may distribute under the terms of either the GNU General Public * You may distribute under the terms of either the GNU General Public
* License or the Less License, as specified in the README file. * License or the Less License, as specified in the README file.
@ -126,6 +126,11 @@
*/ */
#define PATHNAME_SEP "\\" #define PATHNAME_SEP "\\"
/*
* 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>. * HAVE_SYS_TYPES_H is 1 if your system has <sys/types.h>.
*/ */

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 1984-2016 Mark Nudelman * Copyright (C) 1984-2017 Mark Nudelman
* *
* You may distribute under the terms of either the GNU General Public * You may distribute under the terms of either the GNU General Public
* License or the Less License, as specified in the README file. * License or the Less License, as specified in the README file.
@ -129,6 +129,11 @@
*/ */
#define PATHNAME_SEP "/" #define PATHNAME_SEP "/"
/*
* 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>. * HAVE_SYS_TYPES_H is 1 if your system has <sys/types.h>.
*/ */

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 1984-2016 Mark Nudelman * Copyright (C) 1984-2017 Mark Nudelman
* *
* You may distribute under the terms of either the GNU General Public * You may distribute under the terms of either the GNU General Public
* License or the Less License, as specified in the README file. * License or the Less License, as specified in the README file.
@ -127,6 +127,11 @@
*/ */
#define PATHNAME_SEP "\\" #define PATHNAME_SEP "\\"
/*
* 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>. * HAVE_SYS_TYPES_H is 1 if your system has <sys/types.h>.
*/ */

10
edit.c
View File

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 1984-2016 Mark Nudelman * Copyright (C) 1984-2017 Mark Nudelman
* *
* You may distribute under the terms of either the GNU General Public * You may distribute under the terms of either the GNU General Public
* License or the Less License, as specified in the README file. * License or the Less License, as specified in the README file.
@ -26,7 +26,7 @@ extern int sigs;
extern IFILE curr_ifile; extern IFILE curr_ifile;
extern IFILE old_ifile; extern IFILE old_ifile;
extern struct scrpos initial_scrpos; extern struct scrpos initial_scrpos;
extern void constant *ml_examine; extern void *ml_examine;
#if SPACES_IN_FILENAMES #if SPACES_IN_FILENAMES
extern char openquote; extern char openquote;
extern char closequote; extern char closequote;
@ -716,7 +716,7 @@ edit_stdin()
public void public void
cat_file() cat_file()
{ {
register int c; int c;
while ((c = ch_forw_get()) != EOI) while ((c = ch_forw_get()) != EOI)
putchr(c); putchr(c);
@ -734,8 +734,8 @@ cat_file()
use_logfile(filename) use_logfile(filename)
char *filename; char *filename;
{ {
register int exists; int exists;
register int answer; int answer;
PARG parg; PARG parg;
if (ch_getflags() & CH_CANSEEK) if (ch_getflags() & CH_CANSEEK)

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 1984-2016 Mark Nudelman * Copyright (C) 1984-2017 Mark Nudelman
* *
* You may distribute under the terms of either the GNU General Public * You may distribute under the terms of either the GNU General Public
* License or the Less License, as specified in the README file. * License or the Less License, as specified in the README file.
@ -264,7 +264,7 @@ dirfile(dirname, filename)
homefile(filename) homefile(filename)
char *filename; char *filename;
{ {
register char *pathname; char *pathname;
/* /*
* Try $HOME/filename. * Try $HOME/filename.
@ -314,9 +314,9 @@ homefile(filename)
fexpand(s) fexpand(s)
char *s; char *s;
{ {
register char *fr, *to; char *fr, *to;
register int n; int n;
register char *e; char *e;
IFILE ifile; IFILE ifile;
#define fchar_ifile(c) \ #define fchar_ifile(c) \
@ -690,9 +690,9 @@ lglob(filename)
* The globbing function returns a single name, and * The globbing function returns a single name, and
* is called multiple times to walk thru all names. * is called multiple times to walk thru all names.
*/ */
register char *p; char *p;
register int len; int len;
register int n; int n;
char *pathname; char *pathname;
char *qpathname; char *qpathname;
DECL_GLOB_NAME(fnd,drive,dir,fname,ext,handle) DECL_GLOB_NAME(fnd,drive,dir,fname,ext,handle)
@ -1018,7 +1018,7 @@ is_dir(filename)
#else #else
#ifdef _OSK #ifdef _OSK
{ {
register int f; int f;
f = open(filename, S_IREAD | S_IFDIR); f = open(filename, S_IREAD | S_IFDIR);
if (f >= 0) if (f >= 0)
@ -1040,7 +1040,7 @@ is_dir(filename)
bad_file(filename) bad_file(filename)
char *filename; char *filename;
{ {
register char *m = NULL; char *m = NULL;
filename = shell_unquote(filename); filename = shell_unquote(filename);
if (!force_open && is_dir(filename)) if (!force_open && is_dir(filename))

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 1984-2016 Mark Nudelman * Copyright (C) 1984-2017 Mark Nudelman
* *
* You may distribute under the terms of either the GNU General Public * You may distribute under the terms of either the GNU General Public
* License or the Less License, as specified in the README file. * License or the Less License, as specified in the README file.
@ -124,7 +124,7 @@ squish_check()
*/ */
public void public void
forw(n, pos, force, only_last, nblank) forw(n, pos, force, only_last, nblank)
register int n; int n;
POSITION pos; POSITION pos;
int force; int force;
int only_last; int only_last;
@ -298,7 +298,7 @@ forw(n, pos, force, only_last, nblank)
*/ */
public void public void
back(n, pos, force, only_last) back(n, pos, force, only_last)
register int n; int n;
POSITION pos; POSITION pos;
int force; int force;
int only_last; int only_last;
@ -444,3 +444,21 @@ get_back_scroll()
return (sc_height - 2); return (sc_height - 2);
return (10000); /* infinity */ 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;
}

599
funcs.h
View File

@ -1,299 +1,300 @@
public char * save (); public char * save LESSPARAMS((constant char *s));
public VOID_POINTER ecalloc (); public VOID_POINTER ecalloc LESSPARAMS((int count, unsigned int size));
public char * skipsp (); public char * skipsp LESSPARAMS((char *s));
public int sprefix (); public int sprefix LESSPARAMS((char *ps, char *s, int uppercase));
public void quit (); public void quit LESSPARAMS((int status));
public void raw_mode (); public void raw_mode LESSPARAMS((int on));
public void scrsize (); public void scrsize LESSPARAMS((VOID_PARAM));
public char * special_key_str (); public char * special_key_str LESSPARAMS((int key));
public void get_term (); public void get_term LESSPARAMS((VOID_PARAM));
public void init (); public void init LESSPARAMS((VOID_PARAM));
public void deinit (); public void deinit LESSPARAMS((VOID_PARAM));
public void home (); public void home LESSPARAMS((VOID_PARAM));
public void add_line (); public void add_line LESSPARAMS((VOID_PARAM));
public void remove_top (); public void remove_top LESSPARAMS((int n));
public void win32_scroll_up (); public void win32_scroll_up LESSPARAMS((int n));
public void lower_left (); public void lower_left LESSPARAMS((VOID_PARAM));
public void line_left (); public void line_left LESSPARAMS((VOID_PARAM));
public void check_winch (); public void check_winch LESSPARAMS((VOID_PARAM));
public void goto_line (); public void goto_line LESSPARAMS((int slinenum));
public void vbell (); public void vbell LESSPARAMS((VOID_PARAM));
public void bell (); public void bell LESSPARAMS((VOID_PARAM));
public void clear (); public void clear LESSPARAMS((VOID_PARAM));
public void clear_eol (); public void clear_eol LESSPARAMS((VOID_PARAM));
public void clear_bot (); public void clear_bot LESSPARAMS((VOID_PARAM));
public void at_enter (); public void at_enter LESSPARAMS((int attr));
public void at_exit (); public void at_exit LESSPARAMS((VOID_PARAM));
public void at_switch (); public void at_switch LESSPARAMS((int attr));
public int is_at_equiv (); public int is_at_equiv LESSPARAMS((int attr1, int attr2));
public int apply_at_specials (); public int apply_at_specials LESSPARAMS((int attr));
public void backspace (); public void backspace LESSPARAMS((VOID_PARAM));
public void putbs (); public void putbs LESSPARAMS((VOID_PARAM));
public char WIN32getch (); public char WIN32getch LESSPARAMS((int tty));
public void WIN32setcolors (); public void WIN32setcolors LESSPARAMS((int fg, int bg));
public void WIN32textout (); public void WIN32textout LESSPARAMS((char *text, int len));
public void match_brac (); public void match_brac LESSPARAMS((int obrac, int cbrac, int forwdir, int n));
public void ch_ungetchar (); public void ch_ungetchar LESSPARAMS((int c));
public void end_logfile (); public void end_logfile LESSPARAMS((VOID_PARAM));
public void sync_logfile (); public void sync_logfile LESSPARAMS((VOID_PARAM));
public int ch_seek (); public int ch_seek LESSPARAMS((POSITION pos));
public int ch_end_seek (); public int ch_end_seek LESSPARAMS((VOID_PARAM));
public int ch_end_buffer_seek (); public int ch_end_buffer_seek LESSPARAMS((VOID_PARAM));
public int ch_beg_seek (); public int ch_beg_seek LESSPARAMS((VOID_PARAM));
public POSITION ch_length (); public POSITION ch_length LESSPARAMS((VOID_PARAM));
public POSITION ch_tell (); public POSITION ch_tell LESSPARAMS((VOID_PARAM));
public int ch_forw_get (); public int ch_forw_get LESSPARAMS((VOID_PARAM));
public int ch_back_get (); public int ch_back_get LESSPARAMS((VOID_PARAM));
public void ch_setbufspace (); public void ch_setbufspace LESSPARAMS((int bufspace));
public void ch_flush (); public void ch_flush LESSPARAMS((VOID_PARAM));
public int seekable (); public int seekable LESSPARAMS((int f));
public void ch_set_eof (); public void ch_set_eof LESSPARAMS((VOID_PARAM));
public void ch_init (); public void ch_init LESSPARAMS((int f, int flags));
public void ch_close (); public void ch_close LESSPARAMS((VOID_PARAM));
public int ch_getflags (); public int ch_getflags LESSPARAMS((VOID_PARAM));
public void ch_dump (); public void ch_dump LESSPARAMS((VOID_PARAM));
public void init_charset (); public void init_charset LESSPARAMS((VOID_PARAM));
public int binary_char (); public int binary_char LESSPARAMS((LWCHAR c));
public int control_char (); public int control_char LESSPARAMS((LWCHAR c));
public char * prchar (); public char * prchar LESSPARAMS((LWCHAR c));
public char * prutfchar (); public char * prutfchar LESSPARAMS((LWCHAR ch));
public int utf_len (); public int utf_len LESSPARAMS((unsigned char ch));
public int is_utf8_well_formed (); public int is_utf8_well_formed LESSPARAMS((char *ss, int slen));
public int utf_bin_count (); public int utf_bin_count LESSPARAMS((char *data, int len));
public LWCHAR get_wchar (); public LWCHAR get_wchar LESSPARAMS((constant char *p));
public void put_wchar (); public void put_wchar LESSPARAMS((char **pp, LWCHAR ch));
public LWCHAR step_char (); public LWCHAR step_char LESSPARAMS((char **pp, signed int dir, constant char *limit));
public int is_composing_char (); public int is_composing_char LESSPARAMS((LWCHAR ch));
public int is_ubin_char (); public int is_ubin_char LESSPARAMS((LWCHAR ch));
public int is_wide_char (); public int is_wide_char LESSPARAMS((LWCHAR ch));
public int is_combining_char (); public int is_combining_char LESSPARAMS((LWCHAR ch1, LWCHAR ch2));
public void cmd_reset (); public void cmd_reset LESSPARAMS((VOID_PARAM));
public void clear_cmd (); public void clear_cmd LESSPARAMS((VOID_PARAM));
public void cmd_putstr (); public void cmd_putstr LESSPARAMS((constant char *s));
public int len_cmdbuf (); public int len_cmdbuf LESSPARAMS((VOID_PARAM));
public void set_mlist (); public void set_mlist LESSPARAMS((void *mlist, int cmdflags));
public void cmd_addhist (); public void cmd_addhist LESSPARAMS((struct mlist *mlist, constant char *cmd, int modified));
public void cmd_accept (); public void cmd_accept LESSPARAMS((VOID_PARAM));
public int cmd_char (); public int cmd_char LESSPARAMS((int c));
public LINENUM cmd_int (); public LINENUM cmd_int LESSPARAMS((long *frac));
public char * get_cmdbuf (); public char * get_cmdbuf LESSPARAMS((VOID_PARAM));
public char * cmd_lastpattern (); public char * cmd_lastpattern LESSPARAMS((VOID_PARAM));
public void init_cmdhist (); public void init_cmdhist LESSPARAMS((VOID_PARAM));
public void save_cmdhist (); public void save_cmdhist LESSPARAMS((VOID_PARAM));
public int in_mca (); public int in_mca LESSPARAMS((VOID_PARAM));
public void dispversion (); public void dispversion LESSPARAMS((VOID_PARAM));
public int getcc (); public int getcc LESSPARAMS((VOID_PARAM));
public void ungetcc (); public void ungetcc LESSPARAMS((int c));
public void ungetsc (); public void ungetsc LESSPARAMS((char *s));
public void commands (); public void commands LESSPARAMS((VOID_PARAM));
public int cvt_length (); public int cvt_length LESSPARAMS((int len, int ops));
public int * cvt_alloc_chpos (); public int * cvt_alloc_chpos LESSPARAMS((int len));
public void cvt_text (); public void cvt_text LESSPARAMS((char *odst, char *osrc, int *chpos, int *lenp, int ops));
public void init_cmds (); public void init_cmds LESSPARAMS((VOID_PARAM));
public void add_fcmd_table (); public void add_fcmd_table LESSPARAMS((char *buf, int len));
public void add_ecmd_table (); public void add_ecmd_table LESSPARAMS((char *buf, int len));
public int fcmd_decode (); public int fcmd_decode LESSPARAMS((char *cmd, char **sp));
public int ecmd_decode (); public int ecmd_decode LESSPARAMS((char *cmd, char **sp));
public char * lgetenv (); public char * lgetenv LESSPARAMS((char *var));
public int lesskey (); public int lesskey LESSPARAMS((char *filename, int sysvar));
public void add_hometable (); public void add_hometable LESSPARAMS((char *envname, char *def_filename, int sysvar));
public int editchar (); public int editchar LESSPARAMS((int c, int flags));
public void init_textlist (); public void init_textlist LESSPARAMS((struct textlist *tlist, char *str));
public char * forw_textlist (); public char * forw_textlist LESSPARAMS((struct textlist *tlist, char *prev));
public char * back_textlist (); public char * back_textlist LESSPARAMS((struct textlist *tlist, char *prev));
public int edit (); public int edit LESSPARAMS((char *filename));
public int edit_ifile (); public int edit_ifile LESSPARAMS((IFILE ifile));
public int edit_list (); public int edit_list LESSPARAMS((char *filelist));
public int edit_first (); public int edit_first LESSPARAMS((VOID_PARAM));
public int edit_last (); public int edit_last LESSPARAMS((VOID_PARAM));
public int edit_next (); public int edit_next LESSPARAMS((int n));
public int edit_prev (); public int edit_prev LESSPARAMS((int n));
public int edit_index (); public int edit_index LESSPARAMS((int n));
public IFILE save_curr_ifile (); public IFILE save_curr_ifile LESSPARAMS((VOID_PARAM));
public void unsave_ifile (); public void unsave_ifile LESSPARAMS((IFILE save_ifile));
public void reedit_ifile (); public void reedit_ifile LESSPARAMS((IFILE save_ifile));
public void reopen_curr_ifile (); public void reopen_curr_ifile LESSPARAMS((VOID_PARAM));
public int edit_stdin (); public int edit_stdin LESSPARAMS((VOID_PARAM));
public void cat_file (); public void cat_file LESSPARAMS((VOID_PARAM));
public void use_logfile (); public void use_logfile LESSPARAMS((char *filename));
public char * shell_unquote (); public char * shell_unquote LESSPARAMS((char *str));
public char * get_meta_escape (); public char * get_meta_escape LESSPARAMS((VOID_PARAM));
public char * shell_quote (); public char * shell_quote LESSPARAMS((char *s));
public char * homefile (); public char * homefile LESSPARAMS((char *filename));
public char * fexpand (); public char * fexpand LESSPARAMS((char *s));
public char * fcomplete (); public char * fcomplete LESSPARAMS((char *s));
public int bin_file (); public int bin_file LESSPARAMS((int f));
public char * lglob (); public char * lglob LESSPARAMS((char *filename));
public char * open_altfile (); public char * open_altfile LESSPARAMS((char *filename, int *pf, void **pfd));
public void close_altfile (); public void close_altfile LESSPARAMS((char *altfilename, char *filename, void *pipefd));
public int is_dir (); public int is_dir LESSPARAMS((char *filename));
public char * bad_file (); public char * bad_file LESSPARAMS((char *filename));
public POSITION filesize (); public POSITION filesize LESSPARAMS((int f));
public char * shell_coption (); public char * shell_coption LESSPARAMS((VOID_PARAM));
public char * last_component (); public char * last_component LESSPARAMS((char *name));
public int eof_displayed (); public int eof_displayed LESSPARAMS((VOID_PARAM));
public int entire_file_displayed (); public int entire_file_displayed LESSPARAMS((VOID_PARAM));
public void squish_check (); public void squish_check LESSPARAMS((VOID_PARAM));
public void forw (); public void forw LESSPARAMS((int n, POSITION pos, int force, int only_last, int nblank));
public void back (); public void back LESSPARAMS((int n, POSITION pos, int force, int only_last));
public void forward (); public void forward LESSPARAMS((int n, int force, int only_last));
public void backward (); public void backward LESSPARAMS((int n, int force, int only_last));
public int get_back_scroll (); public int get_back_scroll LESSPARAMS((VOID_PARAM));
public void del_ifile (); public int get_line_count LESSPARAMS((VOID_PARAM));
public IFILE next_ifile (); public void del_ifile LESSPARAMS((IFILE h));
public IFILE prev_ifile (); public IFILE next_ifile LESSPARAMS((IFILE h));
public IFILE getoff_ifile (); public IFILE prev_ifile LESSPARAMS((IFILE h));
public int nifile (); public IFILE getoff_ifile LESSPARAMS((IFILE ifile));
public IFILE get_ifile (); public int nifile LESSPARAMS((VOID_PARAM));
public char * get_filename (); public IFILE get_ifile LESSPARAMS((char *filename, IFILE prev));
public int get_index (); public char * get_filename LESSPARAMS((IFILE ifile));
public void store_pos (); public int get_index LESSPARAMS((IFILE ifile));
public void get_pos (); public void store_pos LESSPARAMS((IFILE ifile, struct scrpos *scrpos));
public void set_open (); public void get_pos LESSPARAMS((IFILE ifile, struct scrpos *scrpos));
public int opened (); public void set_open LESSPARAMS((IFILE ifile));
public void hold_ifile (); public int opened LESSPARAMS((IFILE ifile));
public int held_ifile (); public void hold_ifile LESSPARAMS((IFILE ifile, int incr));
public void * get_filestate (); public int held_ifile LESSPARAMS((IFILE ifile));
public void set_filestate (); public void * get_filestate LESSPARAMS((IFILE ifile));
public void if_dump (); public void set_filestate LESSPARAMS((IFILE ifile, void *filestate));
public POSITION forw_line (); public void if_dump LESSPARAMS((VOID_PARAM));
public POSITION back_line (); public POSITION forw_line LESSPARAMS((POSITION curr_pos));
public void set_attnpos (); public POSITION back_line LESSPARAMS((POSITION curr_pos));
public void jump_forw (); public void set_attnpos LESSPARAMS((POSITION pos));
public void jump_forw_buffered (); public void jump_forw LESSPARAMS((VOID_PARAM));
public void jump_back (); public void jump_forw_buffered LESSPARAMS((VOID_PARAM));
public void repaint (); public void jump_back LESSPARAMS((LINENUM linenum));
public void jump_percent (); public void repaint LESSPARAMS((VOID_PARAM));
public void jump_line_loc (); public void jump_percent LESSPARAMS((int percent, long fraction));
public void jump_loc (); public void jump_line_loc LESSPARAMS((POSITION pos, int sline));
public void init_line (); public void jump_loc LESSPARAMS((POSITION pos, int sline));
public int is_ascii_char (); public void init_line LESSPARAMS((VOID_PARAM));
public void prewind (); public int is_ascii_char LESSPARAMS((LWCHAR ch));
public void plinenum (); public void prewind LESSPARAMS((VOID_PARAM));
public void pshift_all (); public void plinenum LESSPARAMS((POSITION pos));
public int is_ansi_end (); public void pshift_all LESSPARAMS((VOID_PARAM));
public int is_ansi_middle (); public int is_ansi_end LESSPARAMS((LWCHAR ch));
public int pappend (); public int is_ansi_middle LESSPARAMS((LWCHAR ch));
public int pflushmbc (); public int pappend LESSPARAMS((unsigned char c, POSITION pos));
public void pdone (); public int pflushmbc LESSPARAMS((VOID_PARAM));
public void set_status_col (); public void pdone LESSPARAMS((int endline, int forw));
public int gline (); public void set_status_col LESSPARAMS((char c));
public void null_line (); public int gline LESSPARAMS((int i, int *ap));
public POSITION forw_raw_line (); public void null_line LESSPARAMS((VOID_PARAM));
public POSITION back_raw_line (); public POSITION forw_raw_line LESSPARAMS((POSITION curr_pos, char **linep, int *line_lenp));
public int rrshift (); public POSITION back_raw_line LESSPARAMS((POSITION curr_pos, char **linep, int *line_lenp));
public void clr_linenum (); public int rrshift LESSPARAMS((VOID_PARAM));
public void add_lnum (); public void clr_linenum LESSPARAMS((VOID_PARAM));
public LINENUM find_linenum (); public void add_lnum LESSPARAMS((LINENUM linenum, POSITION pos));
public POSITION find_pos (); public LINENUM find_linenum LESSPARAMS((POSITION pos));
public LINENUM currline (); public POSITION find_pos LESSPARAMS((LINENUM linenum));
public void lsystem (); public LINENUM currline LESSPARAMS((int where));
public int pipe_mark (); public void lsystem LESSPARAMS((char *cmd, char *donemsg));
public int pipe_data (); public int pipe_mark LESSPARAMS((int c, char *cmd));
public void init_mark (); public int pipe_data LESSPARAMS((char *cmd, POSITION spos, POSITION epos));
public int badmark (); public void init_mark LESSPARAMS((VOID_PARAM));
public void setmark (); public int badmark LESSPARAMS((int c));
public void lastmark (); public void setmark LESSPARAMS((int c));
public void gomark (); public void lastmark LESSPARAMS((VOID_PARAM));
public POSITION markpos (); public void gomark LESSPARAMS((int c));
public void unmark (); public POSITION markpos LESSPARAMS((int c));
public void opt_o (); public void unmark LESSPARAMS((IFILE ifile));
public void opt__O (); public void opt_o LESSPARAMS((int type, char *s));
public void opt_j (); public void opt__O LESSPARAMS((int type, char *s));
public void calc_jump_sline (); public void opt_j LESSPARAMS((int type, char *s));
public void opt_shift (); public void calc_jump_sline LESSPARAMS((VOID_PARAM));
public void calc_shift_count (); public void opt_shift LESSPARAMS((int type, char *s));
public void opt_k (); public void calc_shift_count LESSPARAMS((VOID_PARAM));
public void opt_t (); public void opt_k LESSPARAMS((int type, char *s));
public void opt__T (); public void opt_t LESSPARAMS((int type, char *s));
public void opt_p (); public void opt__T LESSPARAMS((int type, char *s));
public void opt__P (); public void opt_p LESSPARAMS((int type, char *s));
public void opt_b (); public void opt__P LESSPARAMS((int type, char *s));
public void opt_i (); public void opt_b LESSPARAMS((int type, char *s));
public void opt__V (); public void opt_i LESSPARAMS((int type, char *s));
public void opt_D (); public void opt__V LESSPARAMS((int type, char *s));
public void opt_x (); public void opt_D LESSPARAMS((int type, char *s));
public void opt_quote (); public void opt_x LESSPARAMS((int type, char *s));
public void opt_query (); public void opt_quote LESSPARAMS((int type, char *s));
public int get_swindow (); public void opt_query LESSPARAMS((int type, char *s));
public char * propt (); public int get_swindow LESSPARAMS((VOID_PARAM));
public void scan_option (); public char * propt LESSPARAMS((int c));
public void toggle_option (); public void scan_option LESSPARAMS((char *s));
public int opt_has_param (); public void toggle_option LESSPARAMS((struct loption *o, int lower, char *s, int how_toggle));
public char * opt_prompt (); public int opt_has_param LESSPARAMS((struct loption *o));
public int isoptpending (); public char * opt_prompt LESSPARAMS((struct loption *o));
public void nopendopt (); public int isoptpending LESSPARAMS((VOID_PARAM));
public int getnum (); public void nopendopt LESSPARAMS((VOID_PARAM));
public long getfraction (); public int getnum LESSPARAMS((char **sp, char *printopt, int *errp));
public int get_quit_at_eof (); public long getfraction LESSPARAMS((char **sp, char *printopt, int *errp));
public void init_option (); public int get_quit_at_eof LESSPARAMS((VOID_PARAM));
public struct loption * findopt (); public void init_option LESSPARAMS((VOID_PARAM));
public struct loption * findopt_name (); public struct loption * findopt LESSPARAMS((int c));
public int iread (); public struct loption * findopt_name LESSPARAMS((char **p_optname, char **p_oname, int *p_err));
public void intread (); public int iread LESSPARAMS((int fd, unsigned char *buf, unsigned int len));
public time_type get_time (); public void intread LESSPARAMS((VOID_PARAM));
public char * errno_message (); public time_type get_time LESSPARAMS((VOID_PARAM));
public int percentage (); public char * errno_message LESSPARAMS((char *filename));
public POSITION percent_pos (); public int percentage LESSPARAMS((POSITION num, POSITION den));
public int os9_signal (); public POSITION percent_pos LESSPARAMS((POSITION pos, int percent, long fraction));
public void put_line (); public int os9_signal LESSPARAMS((int type, RETSIGTYPE (*handler)()));
public void flush (); public void put_line LESSPARAMS((VOID_PARAM));
public int putchr (); public void flush LESSPARAMS((VOID_PARAM));
public void putstr (); public int putchr LESSPARAMS((int c));
public void get_return (); public void putstr LESSPARAMS((constant char *s));
public void error (); public void get_return LESSPARAMS((VOID_PARAM));
public void ierror (); public void error LESSPARAMS((char *fmt, PARG *parg));
public int query (); public void ierror LESSPARAMS((char *fmt, PARG *parg));
public int compile_pattern (); public int query LESSPARAMS((char *fmt, PARG *parg));
public void uncompile_pattern (); public int compile_pattern LESSPARAMS((char *pattern, int search_type, PATTERN_TYPE *comp_pattern));
public int valid_pattern (); public void uncompile_pattern LESSPARAMS((PATTERN_TYPE *pattern));
public int is_null_pattern (); public int valid_pattern LESSPARAMS((char *pattern));
public int match_pattern (); public int is_null_pattern LESSPARAMS((PATTERN_TYPE pattern));
public POSITION position (); 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 void add_forw_pos (); public POSITION position LESSPARAMS((int where));
public void add_back_pos (); public void add_forw_pos LESSPARAMS((POSITION pos));
public void pos_clear (); public void add_back_pos LESSPARAMS((POSITION pos));
public void pos_init (); public void pos_clear LESSPARAMS((VOID_PARAM));
public int onscreen (); public void pos_init LESSPARAMS((VOID_PARAM));
public int empty_screen (); public int onscreen LESSPARAMS((POSITION pos));
public int empty_lines (); public int empty_screen LESSPARAMS((VOID_PARAM));
public void get_scrpos (); public int empty_lines LESSPARAMS((int s, int e));
public int adjsline (); public void get_scrpos LESSPARAMS((struct scrpos *scrpos));
public void init_prompt (); public int adjsline LESSPARAMS((int sline));
public char * pr_expand (); public void init_prompt LESSPARAMS((VOID_PARAM));
public char * eq_message (); public char * pr_expand LESSPARAMS((constant char *proto, int maxwidth));
public char * pr_string (); public char * eq_message LESSPARAMS((VOID_PARAM));
public char * wait_message (); public char * pr_string LESSPARAMS((VOID_PARAM));
public void init_search (); public char * wait_message LESSPARAMS((VOID_PARAM));
public void repaint_hilite (); public void init_search LESSPARAMS((VOID_PARAM));
public void clear_attn (); public void repaint_hilite LESSPARAMS((int on));
public void undo_search (); public void clear_attn LESSPARAMS((VOID_PARAM));
public void clr_hlist (); public void undo_search LESSPARAMS((VOID_PARAM));
public void clr_hilite (); public void clr_hlist LESSPARAMS((struct hilite_tree *anchor));
public void clr_filter (); public void clr_hilite LESSPARAMS((VOID_PARAM));
public int is_filtered (); public void clr_filter LESSPARAMS((VOID_PARAM));
public POSITION next_unfiltered (); public int is_filtered LESSPARAMS((POSITION pos));
public POSITION prev_unfiltered (); public POSITION next_unfiltered LESSPARAMS((POSITION pos));
public int is_hilited (); public POSITION prev_unfiltered LESSPARAMS((POSITION pos));
public void chg_hilite (); public int is_hilited LESSPARAMS((POSITION pos, POSITION epos, int nohide, int *p_matches));
public void chg_caseless (); public void chg_hilite LESSPARAMS((VOID_PARAM));
public int search (); public void chg_caseless LESSPARAMS((VOID_PARAM));
public void prep_hilite (); public int search LESSPARAMS((int search_type, char *pattern, int n));
public void set_filter_pattern (); public void prep_hilite LESSPARAMS((POSITION spos, POSITION epos, int maxlines));
public int is_filtering (); public void set_filter_pattern LESSPARAMS((char *pattern, int search_type));
public RETSIGTYPE winch (); public int is_filtering LESSPARAMS((VOID_PARAM));
public RETSIGTYPE winch (); public RETSIGTYPE winch LESSPARAMS((int type));
public void init_signals (); public RETSIGTYPE winch LESSPARAMS((int type));
public void psignals (); public void init_signals LESSPARAMS((int on));
public void cleantags (); public void psignals LESSPARAMS((VOID_PARAM));
public int gettagtype (); public void cleantags LESSPARAMS((VOID_PARAM));
public void findtag (); public int gettagtype LESSPARAMS((VOID_PARAM));
public POSITION tagsearch (); public void findtag LESSPARAMS((char *tag));
public char * nexttag (); public POSITION tagsearch LESSPARAMS((VOID_PARAM));
public char * prevtag (); public char * nexttag LESSPARAMS((int n));
public int ntags (); public char * prevtag LESSPARAMS((int n));
public int curr_tag (); public int ntags LESSPARAMS((VOID_PARAM));
public int edit_tagfile (); public int curr_tag LESSPARAMS((VOID_PARAM));
public void open_getchr (); public int edit_tagfile LESSPARAMS((VOID_PARAM));
public void close_getchr (); public void open_getchr LESSPARAMS((VOID_PARAM));
public int getchr (); public void close_getchr LESSPARAMS((VOID_PARAM));
public int getchr LESSPARAMS((VOID_PARAM));

18
ifile.c
View File

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 1984-2016 Mark Nudelman * Copyright (C) 1984-2017 Mark Nudelman
* *
* You may distribute under the terms of either the GNU General Public * You may distribute under the terms of either the GNU General Public
* License or the Less License, as specified in the README file. * License or the Less License, as specified in the README file.
@ -50,7 +50,7 @@ static int ifiles = 0;
static void static void
incr_index(p, incr) incr_index(p, incr)
register struct ifile *p; struct ifile *p;
int incr; int incr;
{ {
for (; p != &anchor; p = p->h_next) for (; p != &anchor; p = p->h_next)
@ -107,7 +107,7 @@ new_ifile(filename, prev)
char *filename; char *filename;
struct ifile *prev; struct ifile *prev;
{ {
register struct ifile *p; struct ifile *p;
/* /*
* Allocate and initialize structure. * Allocate and initialize structure.
@ -129,7 +129,7 @@ new_ifile(filename, prev)
del_ifile(h) del_ifile(h)
IFILE h; IFILE h;
{ {
register struct ifile *p; struct ifile *p;
if (h == NULL_IFILE) if (h == NULL_IFILE)
return; return;
@ -153,7 +153,7 @@ del_ifile(h)
next_ifile(h) next_ifile(h)
IFILE h; IFILE h;
{ {
register struct ifile *p; struct ifile *p;
p = (h == NULL_IFILE) ? &anchor : int_ifile(h); p = (h == NULL_IFILE) ? &anchor : int_ifile(h);
if (p->h_next == &anchor) if (p->h_next == &anchor)
@ -168,7 +168,7 @@ next_ifile(h)
prev_ifile(h) prev_ifile(h)
IFILE h; IFILE h;
{ {
register struct ifile *p; struct ifile *p;
p = (h == NULL_IFILE) ? &anchor : int_ifile(h); p = (h == NULL_IFILE) ? &anchor : int_ifile(h);
if (p->h_prev == &anchor) if (p->h_prev == &anchor)
@ -208,7 +208,7 @@ nifile()
find_ifile(filename) find_ifile(filename)
char *filename; char *filename;
{ {
register struct ifile *p; struct ifile *p;
for (p = anchor.h_next; p != &anchor; p = p->h_next) for (p = anchor.h_next; p != &anchor; p = p->h_next)
if (strcmp(filename, p->h_filename) == 0) if (strcmp(filename, p->h_filename) == 0)
@ -226,7 +226,7 @@ get_ifile(filename, prev)
char *filename; char *filename;
IFILE prev; IFILE prev;
{ {
register struct ifile *p; struct ifile *p;
if ((p = find_ifile(filename)) == NULL) if ((p = find_ifile(filename)) == NULL)
p = new_ifile(filename, int_ifile(prev)); p = new_ifile(filename, int_ifile(prev));
@ -332,7 +332,7 @@ set_filestate(ifile, filestate)
public void public void
if_dump() if_dump()
{ {
register struct ifile *p; struct ifile *p;
for (p = anchor.h_next; p != &anchor; p = p->h_next) for (p = anchor.h_next; p != &anchor; p = p->h_next)
{ {

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 1984-2016 Mark Nudelman * Copyright (C) 1984-2017 Mark Nudelman
* *
* You may distribute under the terms of either the GNU General Public * You may distribute under the terms of either the GNU General Public
* License or the Less License, as specified in the README file. * License or the Less License, as specified in the README file.
@ -47,7 +47,7 @@ forw_line(curr_pos)
{ {
POSITION base_pos; POSITION base_pos;
POSITION new_pos; POSITION new_pos;
register int c; int c;
int blankline; int blankline;
int endline; int endline;
int backchars; int backchars;

4
jump.c
View File

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 1984-2016 Mark Nudelman * Copyright (C) 1984-2017 Mark Nudelman
* *
* You may distribute under the terms of either the GNU General Public * You may distribute under the terms of either the GNU General Public
* License or the Less License, as specified in the README file. * License or the Less License, as specified in the README file.
@ -200,7 +200,7 @@ jump_loc(pos, sline)
POSITION pos; POSITION pos;
int sline; int sline;
{ {
register int nline; int nline;
POSITION tpos; POSITION tpos;
POSITION bpos; POSITION bpos;

13
less.h
View File

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 1984-2016 Mark Nudelman * Copyright (C) 1984-2017 Mark Nudelman
* *
* You may distribute under the terms of either the GNU General Public * You may distribute under the terms of either the GNU General Public
* License or the Less License, as specified in the README file. * License or the Less License, as specified in the README file.
@ -39,10 +39,17 @@
/* /*
* Language details. * Language details.
*/ */
#if HAVE_ANSI_PROTOS
#define LESSPARAMS(a) a
#else
#define LESSPARAMS(a) ()
#endif
#if HAVE_VOID #if HAVE_VOID
#define VOID_POINTER void * #define VOID_POINTER void *
#define VOID_PARAM void
#else #else
#define VOID_POINTER char * #define VOID_POINTER char *
#define VOID_PARAM
#define void int #define void int
#endif #endif
#if HAVE_CONST #if HAVE_CONST
@ -525,6 +532,10 @@ struct wchar_range_table
#define time_type long #define time_type long
#endif #endif
struct mlist;
struct loption;
struct hilite_tree;
#include "pattern.h"
#include "funcs.h" #include "funcs.h"
/* Functions not included in funcs.h */ /* Functions not included in funcs.h */

View File

@ -1617,7 +1617,7 @@ LESS(1) General Commands Manual LESS(1)
COPYRIGHT COPYRIGHT
Copyright (C) 1984-2016 Mark Nudelman Copyright (C) 1984-2017 Mark Nudelman
less is part of the GNU project and is free software. You can redis- less is part of the GNU project and is free software. You can redis-
tribute it and/or modify it under the terms of either (1) the GNU Gen- tribute it and/or modify it under the terms of either (1) the GNU Gen-
@ -1645,4 +1645,4 @@ LESS(1) General Commands Manual LESS(1)
Version 487: 25 Oct 2016 LESS(1) Version 491: 07 Apr 2017 LESS(1)

View File

@ -1,4 +1,4 @@
.TH LESS 1 "Version 487: 25 Oct 2016" .TH LESS 1 "Version 491: 07 Apr 2017"
.SH NAME .SH NAME
less \- opposite of more less \- opposite of more
.SH SYNOPSIS .SH SYNOPSIS
@ -1745,7 +1745,7 @@ The name of the editor (used for the v command).
lesskey(1) lesskey(1)
.SH COPYRIGHT .SH COPYRIGHT
Copyright (C) 1984-2016 Mark Nudelman Copyright (C) 1984-2017 Mark Nudelman
.PP .PP
less is part of the GNU project and is free software. less is part of the GNU project and is free software.
You can redistribute it and/or modify it You can redistribute it and/or modify it

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 1984-2016 Mark Nudelman * Copyright (C) 1984-2017 Mark Nudelman
* *
* You may distribute under the terms of either the GNU General Public * You may distribute under the terms of either the GNU General Public
* License or the Less License, as specified in the README file. * License or the Less License, as specified in the README file.

View File

@ -51,4 +51,4 @@ LESSECHO(1) General Commands Manual LESSECHO(1)
Version 487: 25 Oct 2016 LESSECHO(1) Version 491: 07 Apr 2017 LESSECHO(1)

View File

@ -1,4 +1,4 @@
.TH LESSECHO 1 "Version 487: 25 Oct 2016" .TH LESSECHO 1 "Version 491: 07 Apr 2017"
.SH NAME .SH NAME
lessecho \- expand metacharacters lessecho \- expand metacharacters
.SH SYNOPSIS .SH SYNOPSIS

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 1984-2016 Mark Nudelman * Copyright (C) 1984-2017 Mark Nudelman
* *
* You may distribute under the terms of either the GNU General Public * You may distribute under the terms of either the GNU General Public
* License or the Less License, as specified in the README file. * License or the Less License, as specified in the README file.
@ -361,9 +361,9 @@ tstr(pp, xlate)
char **pp; char **pp;
int xlate; int xlate;
{ {
register char *p; char *p;
register char ch; char ch;
register int i; int i;
static char buf[10]; static char buf[10];
static char tstr_control_k[] = static char tstr_control_k[] =
{ SK_SPECIAL_KEY, SK_CONTROL_K, 6, 1, 1, 1, '\0' }; { SK_SPECIAL_KEY, SK_CONTROL_K, 6, 1, 1, 1, '\0' };
@ -423,7 +423,7 @@ tstr(pp, xlate)
case 'e': ch = SK_END; break; case 'e': ch = SK_END; break;
case 'x': ch = SK_DELETE; break; case 'x': ch = SK_DELETE; break;
default: default:
error("illegal char after \\k"); error("illegal char after \\k", NULL_PARG);
*pp = p+1; *pp = p+1;
return (""); return ("");
} }
@ -474,7 +474,7 @@ tstr(pp, xlate)
*/ */
public char * public char *
skipsp(s) skipsp(s)
register char *s; char *s;
{ {
while (*s == ' ' || *s == '\t') while (*s == ' ' || *s == '\t')
s++; s++;
@ -486,7 +486,7 @@ skipsp(s)
*/ */
public char * public char *
skipnsp(s) skipnsp(s)
register char *s; char *s;
{ {
while (*s != '\0' && *s != ' ' && *s != '\t') while (*s != '\0' && *s != ' ' && *s != '\t')
s++; s++;
@ -501,7 +501,7 @@ skipnsp(s)
clean_line(s) clean_line(s)
char *s; char *s;
{ {
register int i; int i;
s = skipsp(s); s = skipsp(s);
for (i = 0; s[i] != '\n' && s[i] != '\r' && s[i] != '\0'; i++) for (i = 0; s[i] != '\n' && s[i] != '\r' && s[i] != '\0'; i++)
@ -520,7 +520,7 @@ add_cmd_char(c)
{ {
if (currtable->pbuffer >= currtable->buffer + MAX_USERCMD) if (currtable->pbuffer >= currtable->buffer + MAX_USERCMD)
{ {
error("too many commands"); error("too many commands", NULL_PARG);
exit(1); exit(1);
} }
*(currtable->pbuffer)++ = c; *(currtable->pbuffer)++ = c;
@ -620,16 +620,18 @@ findaction(actname)
for (i = 0; currtable->names[i].cn_name != NULL; i++) for (i = 0; currtable->names[i].cn_name != NULL; i++)
if (strcmp(currtable->names[i].cn_name, actname) == 0) if (strcmp(currtable->names[i].cn_name, actname) == 0)
return (currtable->names[i].cn_action); return (currtable->names[i].cn_action);
error("unknown action"); error("unknown action", NULL_PARG);
return (A_INVALID); return (A_INVALID);
} }
void void
error(s) error(s, parg)
char *s; char *s;
PARG *parg;
{ {
fprintf(stderr, "line %d: %s\n", linenum, s); fprintf(stderr, "line %d: %s\n", linenum, s);
errors++; errors++;
(void) parg;
} }
@ -652,7 +654,7 @@ parse_cmdline(p)
s = tstr(&p, 1); s = tstr(&p, 1);
cmdlen += (int) strlen(s); cmdlen += (int) strlen(s);
if (cmdlen > MAX_CMDLEN) if (cmdlen > MAX_CMDLEN)
error("command too long"); error("command too long", NULL_PARG);
else else
add_cmd_str(s); add_cmd_str(s);
} while (*p != ' ' && *p != '\t' && *p != '\0'); } while (*p != ' ' && *p != '\t' && *p != '\0');
@ -669,7 +671,7 @@ parse_cmdline(p)
p = skipsp(p); p = skipsp(p);
if (*p == '\0') if (*p == '\0')
{ {
error("missing action"); error("missing action", NULL_PARG);
return; return;
} }
actname = p; actname = p;
@ -722,7 +724,7 @@ parse_varline(p)
p = skipsp(p); p = skipsp(p);
if (*p++ != '=') if (*p++ != '=')
{ {
error("missing ="); error("missing =", NULL_PARG);
return; return;
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 1984-2016 Mark Nudelman * Copyright (C) 1984-2017 Mark Nudelman
* *
* You may distribute under the terms of either the GNU General Public * You may distribute under the terms of either the GNU General Public
* License or the Less License, as specified in the README file. * License or the Less License, as specified in the README file.

View File

@ -335,7 +335,7 @@ LESSKEY(1) General Commands Manual LESSKEY(1)
COPYRIGHT COPYRIGHT
Copyright (C) 1984-2016 Mark Nudelman Copyright (C) 1984-2017 Mark Nudelman
less is part of the GNU project and is free software. You can redis- less is part of the GNU project and is free software. You can redis-
tribute it and/or modify it under the terms of either (1) the GNU Gen- tribute it and/or modify it under the terms of either (1) the GNU Gen-
@ -359,4 +359,4 @@ LESSKEY(1) General Commands Manual LESSKEY(1)
Version 487: 25 Oct 2016 LESSKEY(1) Version 491: 07 Apr 2017 LESSKEY(1)

View File

@ -1,4 +1,4 @@
.TH LESSKEY 1 "Version 487: 25 Oct 2016" .TH LESSKEY 1 "Version 491: 07 Apr 2017"
.SH NAME .SH NAME
lesskey \- specify key bindings for less lesskey \- specify key bindings for less
.SH SYNOPSIS .SH SYNOPSIS
@ -361,7 +361,7 @@ which start with a NUL character (0).
This NUL character should be represented as \e340 in a lesskey file. This NUL character should be represented as \e340 in a lesskey file.
.SH COPYRIGHT .SH COPYRIGHT
Copyright (C) 1984-2016 Mark Nudelman Copyright (C) 1984-2017 Mark Nudelman
.PP .PP
less is part of the GNU project and is free software. less is part of the GNU project and is free software.
You can redistribute it and/or modify it You can redistribute it and/or modify it

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 1984-2016 Mark Nudelman * Copyright (C) 1984-2017 Mark Nudelman
* *
* You may distribute under the terms of either the GNU General Public * You may distribute under the terms of either the GNU General Public
* License or the Less License, as specified in the README file. * License or the Less License, as specified in the README file.

20
line.c
View File

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 1984-2016 Mark Nudelman * Copyright (C) 1984-2017 Mark Nudelman
* *
* You may distribute under the terms of either the GNU General Public * You may distribute under the terms of either the GNU General Public
* License or the Less License, as specified in the README file. * License or the Less License, as specified in the README file.
@ -170,8 +170,8 @@ prewind()
plinenum(pos) plinenum(pos)
POSITION pos; POSITION pos;
{ {
register LINENUM linenum = 0; LINENUM linenum = 0;
register int i; int i;
if (linenums == OPT_ONPLUS) if (linenums == OPT_ONPLUS)
{ {
@ -851,7 +851,7 @@ do_append(ch, rep, pos)
char *rep; char *rep;
POSITION pos; POSITION pos;
{ {
register int a; int a;
LWCHAR prev_ch; LWCHAR prev_ch;
a = AT_NORMAL; a = AT_NORMAL;
@ -1096,8 +1096,8 @@ set_status_col(c)
*/ */
public int public int
gline(i, ap) gline(i, ap)
register int i; int i;
register int *ap; int *ap;
{ {
if (is_null_line) if (is_null_line)
{ {
@ -1144,8 +1144,8 @@ forw_raw_line(curr_pos, linep, line_lenp)
char **linep; char **linep;
int *line_lenp; int *line_lenp;
{ {
register int n; int n;
register int c; int c;
POSITION new_pos; POSITION new_pos;
if (curr_pos == NULL_POSITION || ch_seek(curr_pos) || if (curr_pos == NULL_POSITION || ch_seek(curr_pos) ||
@ -1193,8 +1193,8 @@ back_raw_line(curr_pos, linep, line_lenp)
char **linep; char **linep;
int *line_lenp; int *line_lenp;
{ {
register int n; int n;
register int c; int c;
POSITION new_pos; POSITION new_pos;
if (curr_pos == NULL_POSITION || curr_pos <= ch_zero() || if (curr_pos == NULL_POSITION || curr_pos <= ch_zero() ||

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 1984-2016 Mark Nudelman * Copyright (C) 1984-2017 Mark Nudelman
* *
* You may distribute under the terms of either the GNU General Public * You may distribute under the terms of either the GNU General Public
* License or the Less License, as specified in the README file. * License or the Less License, as specified in the README file.
@ -75,7 +75,7 @@ extern int screen_trashed;
public void public void
clr_linenum() clr_linenum()
{ {
register struct linenum_info *p; struct linenum_info *p;
/* /*
* Put all the entries on the free list. * Put all the entries on the free list.
@ -102,7 +102,7 @@ clr_linenum()
*/ */
static void static void
calcgap(p) calcgap(p)
register struct linenum_info *p; struct linenum_info *p;
{ {
/* /*
* Don't bother to compute a gap for the anchor. * Don't bother to compute a gap for the anchor.
@ -125,11 +125,11 @@ add_lnum(linenum, pos)
LINENUM linenum; LINENUM linenum;
POSITION pos; POSITION pos;
{ {
register struct linenum_info *p; struct linenum_info *p;
register struct linenum_info *new; struct linenum_info *new;
register struct linenum_info *nextp; struct linenum_info *nextp;
register struct linenum_info *prevp; struct linenum_info *prevp;
register POSITION mingap; POSITION mingap;
/* /*
* Find the proper place in the list for the new one. * Find the proper place in the list for the new one.
@ -265,8 +265,8 @@ abort_long()
find_linenum(pos) find_linenum(pos)
POSITION pos; POSITION pos;
{ {
register struct linenum_info *p; struct linenum_info *p;
register LINENUM linenum; LINENUM linenum;
POSITION cpos; POSITION cpos;
if (!linenums) if (!linenums)
@ -380,7 +380,7 @@ find_linenum(pos)
find_pos(linenum) find_pos(linenum)
LINENUM linenum; LINENUM linenum;
{ {
register struct linenum_info *p; struct linenum_info *p;
POSITION cpos; POSITION cpos;
LINENUM clinenum; LINENUM clinenum;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 1984-2016 Mark Nudelman * Copyright (C) 1984-2017 Mark Nudelman
* *
* You may distribute under the terms of either the GNU General Public * You may distribute under the terms of either the GNU General Public
* License or the Less License, as specified in the README file. * License or the Less License, as specified in the README file.
@ -42,10 +42,10 @@ lsystem(cmd, donemsg)
char *cmd; char *cmd;
char *donemsg; char *donemsg;
{ {
register int inp; int inp;
#if HAVE_SHELL #if HAVE_SHELL
register char *shell; char *shell;
register char *p; char *p;
#endif #endif
IFILE save_ifile; IFILE save_ifile;
#if MSDOS_COMPILER && MSDOS_COMPILER!=WIN32C #if MSDOS_COMPILER && MSDOS_COMPILER!=WIN32C
@ -289,8 +289,8 @@ pipe_data(cmd, spos, epos)
POSITION spos; POSITION spos;
POSITION epos; POSITION epos;
{ {
register FILE *f; FILE *f;
register int c; int c;
extern FILE *popen(); extern FILE *popen();
/* /*

33
main.c
View File

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 1984-2016 Mark Nudelman * Copyright (C) 1984-2017 Mark Nudelman
* *
* You may distribute under the terms of either the GNU General Public * You may distribute under the terms of either the GNU General Public
* License or the Less License, as specified in the README file. * License or the Less License, as specified in the README file.
@ -53,10 +53,12 @@ extern int jump_sline;
static char consoleTitle[256]; static char consoleTitle[256];
#endif #endif
public int line_count;
extern int less_is_more; extern int less_is_more;
extern int missing_cap; extern int missing_cap;
extern int know_dumb; extern int know_dumb;
extern int pr_type; extern int pr_type;
extern int quit_if_one_screen;
/* /*
@ -273,10 +275,25 @@ main(argc, argv)
{ {
if (edit_stdin()) /* Edit standard input */ if (edit_stdin()) /* Edit standard input */
quit(QUIT_ERROR); quit(QUIT_ERROR);
if (quit_if_one_screen)
line_count = get_line_count();
} else } else
{ {
if (edit_first()) /* Edit first valid file in cmd line */ if (edit_first()) /* Edit first valid file in cmd line */
quit(QUIT_ERROR); 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(); init();
@ -292,9 +309,9 @@ main(argc, argv)
*/ */
public char * public char *
save(s) save(s)
char *s; constant char *s;
{ {
register char *p; char *p;
p = (char *) ecalloc(strlen(s)+1, sizeof(char)); p = (char *) ecalloc(strlen(s)+1, sizeof(char));
strcpy(p, s); strcpy(p, s);
@ -310,7 +327,7 @@ ecalloc(count, size)
int count; int count;
unsigned int size; unsigned int size;
{ {
register VOID_POINTER p; VOID_POINTER p;
p = (VOID_POINTER) calloc(count, size); p = (VOID_POINTER) calloc(count, size);
if (p != NULL) if (p != NULL)
@ -326,7 +343,7 @@ ecalloc(count, size)
*/ */
public char * public char *
skipsp(s) skipsp(s)
register char *s; char *s;
{ {
while (*s == ' ' || *s == '\t') while (*s == ' ' || *s == '\t')
s++; s++;
@ -344,9 +361,9 @@ sprefix(ps, s, uppercase)
char *s; char *s;
int uppercase; int uppercase;
{ {
register int c; int c;
register int sc; int sc;
register int len = 0; int len = 0;
for ( ; *s != '\0'; s++, ps++) for ( ; *s != '\0'; s++, ps++)
{ {

10
mark.c
View File

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 1984-2016 Mark Nudelman * Copyright (C) 1984-2017 Mark Nudelman
* *
* You may distribute under the terms of either the GNU General Public * You may distribute under the terms of either the GNU General Public
* License or the Less License, as specified in the README file. * License or the Less License, as specified in the README file.
@ -61,7 +61,7 @@ getumark(c)
getmark(c) getmark(c)
int c; int c;
{ {
register struct mark *m; struct mark *m;
static struct mark sm; static struct mark sm;
switch (c) switch (c)
@ -137,7 +137,7 @@ badmark(c)
setmark(c) setmark(c)
int c; int c;
{ {
register struct mark *m; struct mark *m;
struct scrpos scrpos; struct scrpos scrpos;
m = getumark(c); m = getumark(c);
@ -172,7 +172,7 @@ lastmark()
gomark(c) gomark(c)
int c; int c;
{ {
register struct mark *m; struct mark *m;
struct scrpos scrpos; struct scrpos scrpos;
m = getmark(c); m = getmark(c);
@ -220,7 +220,7 @@ gomark(c)
markpos(c) markpos(c)
int c; int c;
{ {
register struct mark *m; struct mark *m;
m = getmark(c); m = getmark(c);
if (m == NULL) if (m == NULL)

View File

@ -1,9 +0,0 @@
BEGIN { FS="("; state = 0 }
/^ public/ { ftype = $0; state = 1 }
{ if (state == 1)
state = 2
else if (state == 2)
{ print ftype,$1,"();"; state = 0 }
}

27
mkfuncs.pl Normal file
View File

@ -0,0 +1,27 @@
#! /usr/bin/perl
use strict;
my $state = 0;
my $def;
my $params;
while (<>) {
if (/^\tpublic\s+(.*)/) {
$def = "public $1";
$state = 1;
$params = 0;
} elsif ($state == 1 and /(\w+)\s*\(/) {
$def .= " $1 LESSPARAMS((";
$state = 2;
} elsif ($state == 2) {
if (/^{/) {
$def .= 'VOID_PARAM' if not $params;
print "$def));\n";
$state = 0;
} elsif (/^\s*([^;]*)/) {
$def .= ', ' if substr($def,-1) ne '(';
$def .= $1;
$params = 1;
}
}
}

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 1984-2016 Mark Nudelman * Copyright (C) 1984-2017 Mark Nudelman
* *
* You may distribute under the terms of either the GNU General Public * You may distribute under the terms of either the GNU General Public
* License or the Less License, as specified in the README file. * License or the Less License, as specified in the README file.

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 1984-2016 Mark Nudelman * Copyright (C) 1984-2017 Mark Nudelman
* *
* You may distribute under the terms of either the GNU General Public * You may distribute under the terms of either the GNU General Public
* License or the Less License, as specified in the README file. * 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 IFILE curr_ifile;
extern char version[]; extern char version[];
extern int jump_sline; extern int jump_sline;
extern int jump_sline_fraction; extern long jump_sline_fraction;
extern int shift_count; extern int shift_count;
extern int shift_count_fraction; extern long shift_count_fraction;
extern int less_is_more; extern int less_is_more;
#if LOGFILE #if LOGFILE
extern char *namelogfile; extern char *namelogfile;
@ -180,7 +180,7 @@ opt_j(type, s)
} else } else
{ {
sprintf(buf, ".%06d", jump_sline_fraction); sprintf(buf, ".%06ld", jump_sline_fraction);
len = (int) strlen(buf); len = (int) strlen(buf);
while (len > 2 && buf[len-1] == '0') while (len > 2 && buf[len-1] == '0')
len--; len--;
@ -245,7 +245,7 @@ opt_shift(type, s)
} else } else
{ {
sprintf(buf, ".%06d", shift_count_fraction); sprintf(buf, ".%06ld", shift_count_fraction);
len = (int) strlen(buf); len = (int) strlen(buf);
while (len > 2 && buf[len-1] == '0') while (len > 2 && buf[len-1] == '0')
len--; len--;
@ -362,7 +362,7 @@ opt__T(type, s)
public void public void
opt_p(type, s) opt_p(type, s)
int type; int type;
register char *s; char *s;
{ {
switch (type) switch (type)
{ {
@ -398,9 +398,9 @@ opt_p(type, s)
public void public void
opt__P(type, s) opt__P(type, s)
int type; int type;
register char *s; char *s;
{ {
register char **proto; char **proto;
PARG parg; PARG parg;
switch (type) switch (type)
@ -518,7 +518,7 @@ opt__V(type, s)
putstr("no "); putstr("no ");
#endif #endif
putstr("regular expressions)\n"); putstr("regular expressions)\n");
putstr("Copyright (C) 1984-2016 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("less comes with NO WARRANTY, to the extent permitted by law.\n");
putstr("For information about the terms of redistribution,\n"); putstr("For information about the terms of redistribution,\n");
putstr("see the file named README in the less distribution.\n"); putstr("see the file named README in the less distribution.\n");
@ -624,7 +624,7 @@ opt_D(type, s)
public void public void
opt_x(type, s) opt_x(type, s)
int type; int type;
register char *s; char *s;
{ {
extern int tabstops[]; extern int tabstops[];
extern int ntabstops; extern int ntabstops;
@ -682,7 +682,7 @@ opt_x(type, s)
public void public void
opt_quote(type, s) opt_quote(type, s)
int type; int type;
register char *s; char *s;
{ {
char buf[3]; char buf[3];
PARG parg; PARG parg;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 1984-2016 Mark Nudelman * Copyright (C) 1984-2017 Mark Nudelman
* *
* You may distribute under the terms of either the GNU General Public * You may distribute under the terms of either the GNU General Public
* License or the Less License, as specified in the README file. * License or the Less License, as specified in the README file.
@ -69,8 +69,8 @@ propt(c)
scan_option(s) scan_option(s)
char *s; char *s;
{ {
register struct loption *o; struct loption *o;
register int optc; int optc;
char *optname; char *optname;
char *printopt; char *printopt;
char *str; char *str;
@ -305,7 +305,7 @@ toggle_option(o, lower, s, how_toggle)
char *s; char *s;
int how_toggle; int how_toggle;
{ {
register int num; int num;
int no_prompt; int no_prompt;
int err; int err;
PARG parg; PARG parg;
@ -568,8 +568,8 @@ optstring(s, p_str, printopt, validchars)
char *printopt; char *printopt;
char *validchars; char *validchars;
{ {
register char *p; char *p;
register char *out; char *out;
if (*s == '\0') if (*s == '\0')
{ {
@ -632,9 +632,9 @@ getnum(sp, printopt, errp)
char *printopt; char *printopt;
int *errp; int *errp;
{ {
register char *s; char *s;
register int n; int n;
register int neg; int neg;
s = skipsp(*sp); s = skipsp(*sp);
neg = FALSE; neg = FALSE;
@ -669,7 +669,7 @@ getfraction(sp, printopt, errp)
char *printopt; char *printopt;
int *errp; int *errp;
{ {
register char *s; char *s;
long frac = 0; long frac = 0;
int fraclen = 0; int fraclen = 0;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 1984-2016 Mark Nudelman * Copyright (C) 1984-2017 Mark Nudelman
* *
* You may distribute under the terms of either the GNU General Public * You may distribute under the terms of either the GNU General Public
* License or the Less License, as specified in the README file. * License or the Less License, as specified in the README file.
@ -60,7 +60,7 @@ struct loption
int otype; /* Type of the option */ int otype; /* Type of the option */
int odefault; /* Default value */ int odefault; /* Default value */
int *ovar; /* Pointer to the associated variable */ 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 */ char *odesc[3]; /* Description of each value */
}; };

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 1984-2016 Mark Nudelman * Copyright (C) 1984-2017 Mark Nudelman
* *
* You may distribute under the terms of either the GNU General Public * You may distribute under the terms of either the GNU General Public
* License or the Less License, as specified in the README file. * License or the Less License, as specified in the README file.
@ -466,7 +466,7 @@ static struct loption option[] =
public void public void
init_option() init_option()
{ {
register struct loption *o; struct loption *o;
char *p; char *p;
p = lgetenv("LESS_IS_MORE"); p = lgetenv("LESS_IS_MORE");
@ -492,7 +492,7 @@ init_option()
findopt(c) findopt(c)
int c; int c;
{ {
register struct loption *o; struct loption *o;
for (o = option; o->oletter != '\0'; o++) for (o = option; o->oletter != '\0'; o++)
{ {
@ -533,9 +533,9 @@ findopt_name(p_optname, p_oname, p_err)
int *p_err; int *p_err;
{ {
char *optname = *p_optname; char *optname = *p_optname;
register struct loption *o; struct loption *o;
register struct optname *oname; struct optname *oname;
register int len; int len;
int uppercase; int uppercase;
struct loption *maxo = NULL; struct loption *maxo = NULL;
struct optname *maxoname = NULL; struct optname *maxoname = NULL;

13
os.c
View File

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 1984-2016 Mark Nudelman * Copyright (C) 1984-2017 Mark Nudelman
* *
* You may distribute under the terms of either the GNU General Public * You may distribute under the terms of either the GNU General Public
* License or the Less License, as specified in the README file. * License or the Less License, as specified in the README file.
@ -62,10 +62,10 @@ extern int sigs;
public int public int
iread(fd, buf, len) iread(fd, buf, len)
int fd; int fd;
char *buf; unsigned char *buf;
unsigned int len; unsigned int len;
{ {
register int n; int n;
start: start:
#if MSDOS_COMPILER==WIN32C #if MSDOS_COMPILER==WIN32C
@ -226,8 +226,8 @@ strerror(err)
errno_message(filename) errno_message(filename)
char *filename; char *filename;
{ {
register char *p; char *p;
register char *m; char *m;
int len; int len;
#if HAVE_ERRNO #if HAVE_ERRNO
#if MUST_DEFINE_ERRNO #if MUST_DEFINE_ERRNO
@ -271,7 +271,8 @@ muldiv(val, num, den)
*/ */
public int public int
percentage(num, den) percentage(num, den)
POSITION num, den; POSITION num;
POSITION den;
{ {
return (int) muldiv(num, (POSITION) 100, den); return (int) muldiv(num, (POSITION) 100, den);
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 1984-2016 Mark Nudelman * Copyright (C) 1984-2017 Mark Nudelman
* *
* You may distribute under the terms of either the GNU General Public * You may distribute under the terms of either the GNU General Public
* License or the Less License, as specified in the README file. * License or the Less License, as specified in the README file.
@ -46,8 +46,8 @@ extern int sgr_mode;
public void public void
put_line() put_line()
{ {
register int c; int c;
register int i; int i;
int a; int a;
if (ABORT_SIGS()) if (ABORT_SIGS())
@ -96,8 +96,8 @@ static char *ob = obuf;
public void public void
flush() flush()
{ {
register int n; int n;
register int fd; int fd;
n = (int) (ob - obuf); n = (int) (ob - obuf);
if (n == 0) if (n == 0)
@ -436,7 +436,7 @@ putchr(c)
*/ */
public void public void
putstr(s) putstr(s)
register char *s; constant char *s;
{ {
while (*s != '\0') while (*s != '\0')
putchr(*s++); putchr(*s++);
@ -453,7 +453,7 @@ void funcname(num, buf) \
{ \ { \
int neg = (num < 0); \ int neg = (num < 0); \
char tbuf[INT_STRLEN_BOUND(num)+2]; \ char tbuf[INT_STRLEN_BOUND(num)+2]; \
register char *s = tbuf + sizeof(tbuf); \ char *s = tbuf + sizeof(tbuf); \
if (neg) num = -num; \ if (neg) num = -num; \
*--s = '\0'; \ *--s = '\0'; \
do { \ do { \
@ -501,11 +501,11 @@ iprint_linenum(num)
*/ */
static int static int
less_printf(fmt, parg) less_printf(fmt, parg)
register char *fmt; char *fmt;
PARG *parg; PARG *parg;
{ {
register char *s; char *s;
register int col; int col;
col = 0; col = 0;
while (*fmt != '\0') while (*fmt != '\0')
@ -645,7 +645,7 @@ query(fmt, parg)
char *fmt; char *fmt;
PARG *parg; PARG *parg;
{ {
register int c; int c;
int col = 0; int col = 0;
if (any_display && is_tty) if (any_display && is_tty)

144
pattern.c
View File

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 1984-2016 Mark Nudelman * Copyright (C) 1984-2017 Mark Nudelman
* *
* You may distribute under the terms of either the GNU General Public * You may distribute under the terms of either the GNU General Public
* License or the Less License, as specified in the README file. * License or the Less License, as specified in the README file.
@ -12,7 +12,6 @@
*/ */
#include "less.h" #include "less.h"
#include "pattern.h"
extern int caseless; extern int caseless;
@ -23,7 +22,7 @@ extern int caseless;
compile_pattern2(pattern, search_type, comp_pattern, show_error) compile_pattern2(pattern, search_type, comp_pattern, show_error)
char *pattern; char *pattern;
int search_type; int search_type;
void **comp_pattern; PATTERN_TYPE *comp_pattern;
int show_error; int show_error;
{ {
if (search_type & SRCH_NO_REGEX) if (search_type & SRCH_NO_REGEX)
@ -32,8 +31,6 @@ compile_pattern2(pattern, search_type, comp_pattern, show_error)
#if HAVE_GNU_REGEX #if HAVE_GNU_REGEX
struct re_pattern_buffer *comp = (struct re_pattern_buffer *) struct re_pattern_buffer *comp = (struct re_pattern_buffer *)
ecalloc(1, sizeof(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); re_set_syntax(RE_SYNTAX_POSIX_EXTENDED);
if (re_compile_pattern(pattern, strlen(pattern), comp)) if (re_compile_pattern(pattern, strlen(pattern), comp))
{ {
@ -42,13 +39,15 @@ compile_pattern2(pattern, search_type, comp_pattern, show_error)
error("Invalid pattern", NULL_PARG); error("Invalid pattern", NULL_PARG);
return (-1); return (-1);
} }
if (*pcomp != NULL) if (*comp_pattern != NULL)
regfree(*pcomp); {
*pcomp = comp; regfree(*comp_pattern);
free(*comp_pattern);
}
*comp_pattern = comp;
#endif #endif
#if HAVE_POSIX_REGCOMP #if HAVE_POSIX_REGCOMP
regex_t *comp = (regex_t *) ecalloc(1, sizeof(regex_t)); regex_t *comp = (regex_t *) ecalloc(1, sizeof(regex_t));
regex_t **pcomp = (regex_t **) comp_pattern;
if (regcomp(comp, pattern, REGCOMP_FLAG)) if (regcomp(comp, pattern, REGCOMP_FLAG))
{ {
free(comp); free(comp);
@ -56,13 +55,15 @@ compile_pattern2(pattern, search_type, comp_pattern, show_error)
error("Invalid pattern", NULL_PARG); error("Invalid pattern", NULL_PARG);
return (-1); return (-1);
} }
if (*pcomp != NULL) if (*comp_pattern != NULL)
regfree(*pcomp); {
*pcomp = comp; regfree(*comp_pattern);
free(*comp_pattern);
}
*comp_pattern = comp;
#endif #endif
#if HAVE_PCRE #if HAVE_PCRE
pcre *comp; pcre *comp;
pcre **pcomp = (pcre **) comp_pattern;
constant char *errstring; constant char *errstring;
int erroffset; int erroffset;
PARG parg; PARG parg;
@ -75,35 +76,32 @@ compile_pattern2(pattern, search_type, comp_pattern, show_error)
error("%s", &parg); error("%s", &parg);
return (-1); return (-1);
} }
*pcomp = comp; *comp_pattern = comp;
#endif #endif
#if HAVE_RE_COMP #if HAVE_RE_COMP
PARG parg; PARG parg;
int *pcomp = (int *) comp_pattern;
if ((parg.p_string = re_comp(pattern)) != NULL) if ((parg.p_string = re_comp(pattern)) != NULL)
{ {
if (show_error) if (show_error)
error("%s", &parg); error("%s", &parg);
return (-1); return (-1);
} }
*pcomp = 1; *comp_pattern = 1;
#endif #endif
#if HAVE_REGCMP #if HAVE_REGCMP
char *comp; char *comp;
char **pcomp = (char **) comp_pattern;
if ((comp = regcmp(pattern, 0)) == NULL) if ((comp = regcmp(pattern, 0)) == NULL)
{ {
if (show_error) if (show_error)
error("Invalid pattern", NULL_PARG); error("Invalid pattern", NULL_PARG);
return (-1); return (-1);
} }
if (pcomp != NULL) if (comp_pattern != NULL)
free(*pcomp); free(*comp_pattern);
*pcomp = comp; *comp_pattern = comp;
#endif #endif
#if HAVE_V8_REGCOMP #if HAVE_V8_REGCOMP
struct regexp *comp; struct regexp *comp;
struct regexp **pcomp = (struct regexp **) comp_pattern;
reg_show_error = show_error; reg_show_error = show_error;
comp = regcomp(pattern); comp = regcomp(pattern);
reg_show_error = 1; reg_show_error = 1;
@ -115,9 +113,9 @@ compile_pattern2(pattern, search_type, comp_pattern, show_error)
*/ */
return (-1); return (-1);
} }
if (*pcomp != NULL) if (*comp_pattern != NULL)
free(*pcomp); free(*comp_pattern);
*pcomp = comp; *comp_pattern = comp;
#endif #endif
} }
return (0); return (0);
@ -130,7 +128,7 @@ compile_pattern2(pattern, search_type, comp_pattern, show_error)
compile_pattern(pattern, search_type, comp_pattern) compile_pattern(pattern, search_type, comp_pattern)
char *pattern; char *pattern;
int search_type; int search_type;
void **comp_pattern; PATTERN_TYPE *comp_pattern;
{ {
char *cvt_pattern; char *cvt_pattern;
int result; int result;
@ -153,41 +151,41 @@ compile_pattern(pattern, search_type, comp_pattern)
*/ */
public void public void
uncompile_pattern(pattern) uncompile_pattern(pattern)
void **pattern; PATTERN_TYPE *pattern;
{ {
#if HAVE_GNU_REGEX #if HAVE_GNU_REGEX
struct re_pattern_buffer **pcomp = (struct re_pattern_buffer **) pattern; if (*pattern != NULL)
if (*pcomp != NULL) {
regfree(*pcomp); regfree(*pattern);
*pcomp = NULL; free(*pattern);
}
*pattern = NULL;
#endif #endif
#if HAVE_POSIX_REGCOMP #if HAVE_POSIX_REGCOMP
regex_t **pcomp = (regex_t **) pattern; if (*pattern != NULL)
if (*pcomp != NULL) {
regfree(*pcomp); regfree(*pattern);
*pcomp = NULL; free(*pattern);
}
*pattern = NULL;
#endif #endif
#if HAVE_PCRE #if HAVE_PCRE
pcre **pcomp = (pcre **) pattern; if (*pattern != NULL)
if (*pcomp != NULL) pcre_free(*pattern);
pcre_free(*pcomp); *pattern = NULL;
*pcomp = NULL;
#endif #endif
#if HAVE_RE_COMP #if HAVE_RE_COMP
int *pcomp = (int *) pattern; *pattern = 0;
*pcomp = 0;
#endif #endif
#if HAVE_REGCMP #if HAVE_REGCMP
char **pcomp = (char **) pattern; if (*pattern != NULL)
if (*pcomp != NULL) free(*pattern);
free(*pcomp); *pattern = NULL;
*pcomp = NULL;
#endif #endif
#if HAVE_V8_REGCOMP #if HAVE_V8_REGCOMP
struct regexp **pcomp = (struct regexp **) pattern; if (*pattern != NULL)
if (*pcomp != NULL) free(*pattern);
free(*pcomp); *pattern = NULL;
*pcomp = NULL;
#endif #endif
} }
@ -198,7 +196,7 @@ uncompile_pattern(pattern)
valid_pattern(pattern) valid_pattern(pattern)
char *pattern; char *pattern;
{ {
void *comp_pattern; PATTERN_TYPE comp_pattern;
int result; int result;
CLEAR_PATTERN(comp_pattern); CLEAR_PATTERN(comp_pattern);
@ -214,7 +212,7 @@ valid_pattern(pattern)
*/ */
public int public int
is_null_pattern(pattern) is_null_pattern(pattern)
void *pattern; PATTERN_TYPE pattern;
{ {
#if HAVE_GNU_REGEX #if HAVE_GNU_REGEX
return (pattern == NULL); return (pattern == NULL);
@ -251,9 +249,9 @@ match(pattern, pattern_len, buf, buf_len, pfound, pend)
int buf_len; int buf_len;
char **pfound, **pend; char **pfound, **pend;
{ {
register char *pp, *lp; char *pp, *lp;
register char *pattern_end = pattern + pattern_len; char *pattern_end = pattern + pattern_len;
register char *buf_end = buf + buf_len; char *buf_end = buf + buf_len;
for ( ; buf < buf_end; buf++) for ( ; buf < buf_end; buf++)
{ {
@ -286,7 +284,7 @@ match(pattern, pattern_len, buf, buf_len, pfound, pend)
*/ */
public int public int
match_pattern(pattern, tpattern, line, line_len, sp, ep, notbol, search_type) match_pattern(pattern, tpattern, line, line_len, sp, ep, notbol, search_type)
void *pattern; PATTERN_TYPE pattern;
char *tpattern; char *tpattern;
char *line; char *line;
int line_len; int line_len;
@ -296,24 +294,6 @@ match_pattern(pattern, tpattern, line, line_len, sp, ep, notbol, search_type)
int search_type; int search_type;
{ {
int matched; 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; *sp = *ep = NULL;
#if NO_REGEX #if NO_REGEX
@ -326,9 +306,9 @@ match_pattern(pattern, tpattern, line, line_len, sp, ep, notbol, search_type)
#if HAVE_GNU_REGEX #if HAVE_GNU_REGEX
{ {
struct re_registers search_regs; struct re_registers search_regs;
spattern->not_bol = notbol; pattern->not_bol = notbol;
spattern->regs_allocated = REGS_UNALLOCATED; pattern->regs_allocated = REGS_UNALLOCATED;
matched = re_search(spattern, line, line_len, 0, line_len, &search_regs) >= 0; matched = re_search(pattern, line, line_len, 0, line_len, &search_regs) >= 0;
if (matched) if (matched)
{ {
*sp = line + search_regs.start[0]; *sp = line + search_regs.start[0];
@ -345,7 +325,7 @@ match_pattern(pattern, tpattern, line, line_len, sp, ep, notbol, search_type)
rm.rm_so = 0; rm.rm_so = 0;
rm.rm_eo = line_len; rm.rm_eo = line_len;
#endif #endif
matched = !regexec(spattern, line, 1, &rm, flags); matched = !regexec(pattern, line, 1, &rm, flags);
if (matched) if (matched)
{ {
#ifndef __WATCOMC__ #ifndef __WATCOMC__
@ -362,7 +342,7 @@ match_pattern(pattern, tpattern, line, line_len, sp, ep, notbol, search_type)
{ {
int flags = (notbol) ? PCRE_NOTBOL : 0; int flags = (notbol) ? PCRE_NOTBOL : 0;
int ovector[3]; int ovector[3];
matched = pcre_exec(spattern, NULL, line, line_len, matched = pcre_exec(pattern, NULL, line, line_len,
0, flags, ovector, 3) >= 0; 0, flags, ovector, 3) >= 0;
if (matched) if (matched)
{ {
@ -379,21 +359,21 @@ match_pattern(pattern, tpattern, line, line_len, sp, ep, notbol, search_type)
*sp = *ep = NULL; *sp = *ep = NULL;
#endif #endif
#if HAVE_REGCMP #if HAVE_REGCMP
*ep = regex(spattern, line); *ep = regex(pattern, line);
matched = (*ep != NULL); matched = (*ep != NULL);
if (matched) if (matched)
*sp = __loc1; *sp = __loc1;
#endif #endif
#if HAVE_V8_REGCOMP #if HAVE_V8_REGCOMP
#if HAVE_REGEXEC2 #if HAVE_REGEXEC2
matched = regexec2(spattern, line, notbol); matched = regexec2(pattern, line, notbol);
#else #else
matched = regexec(spattern, line); matched = regexec(pattern, line);
#endif #endif
if (matched) if (matched)
{ {
*sp = spattern->startp[0]; *sp = pattern->startp[0];
*ep = spattern->endp[0]; *ep = pattern->endp[0];
} }
#endif #endif
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 1984-2016 Mark Nudelman * Copyright (C) 1984-2017 Mark Nudelman
* *
* You may distribute under the terms of either the GNU General Public * You may distribute under the terms of either the GNU General Public
* License or the Less License, as specified in the README file. * License or the Less License, as specified in the README file.
@ -10,7 +10,7 @@
#if HAVE_GNU_REGEX #if HAVE_GNU_REGEX
#define __USE_GNU 1 #define __USE_GNU 1
#include <regex.h> #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 #define CLEAR_PATTERN(name) name = NULL
#endif #endif
@ -21,20 +21,20 @@
#else #else
#define REGCOMP_FLAG 0 #define REGCOMP_FLAG 0
#endif #endif
#define DEFINE_PATTERN(name) regex_t *name #define PATTERN_TYPE regex_t *
#define CLEAR_PATTERN(name) name = NULL #define CLEAR_PATTERN(name) name = NULL
#endif #endif
#if HAVE_PCRE #if HAVE_PCRE
#include <pcre.h> #include <pcre.h>
#define DEFINE_PATTERN(name) pcre *name #define PATTERN_TYPE pcre *
#define CLEAR_PATTERN(name) name = NULL #define CLEAR_PATTERN(name) name = NULL
#endif #endif
#if HAVE_RE_COMP #if HAVE_RE_COMP
char *re_comp(); char *re_comp();
int re_exec(); int re_exec();
#define DEFINE_PATTERN(name) int name #define PATTERN_TYPE int
#define CLEAR_PATTERN(name) name = 0 #define CLEAR_PATTERN(name) name = 0
#endif #endif
@ -42,18 +42,18 @@ int re_exec();
char *regcmp(); char *regcmp();
char *regex(); char *regex();
extern char *__loc1; extern char *__loc1;
#define DEFINE_PATTERN(name) char *name #define PATTERN_TYPE char **
#define CLEAR_PATTERN(name) name = NULL #define CLEAR_PATTERN(name) name = NULL
#endif #endif
#if HAVE_V8_REGCOMP #if HAVE_V8_REGCOMP
#include "regexp.h" #include "regexp.h"
extern int reg_show_error; extern int reg_show_error;
#define DEFINE_PATTERN(name) struct regexp *name #define PATTERN_TYPE struct regexp *
#define CLEAR_PATTERN(name) name = NULL #define CLEAR_PATTERN(name) name = NULL
#endif #endif
#if NO_REGEX #if NO_REGEX
#define DEFINE_PATTERN(name) #define PATTERN_TYPE void *
#define CLEAR_PATTERN(name) #define CLEAR_PATTERN(name)
#endif #endif

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 1984-2016 Mark Nudelman * Copyright (C) 1984-2017 Mark Nudelman
* *
* You may distribute under the terms of either the GNU General Public * You may distribute under the terms of either the GNU General Public
* License or the Less License, as specified in the README file. * License or the Less License, as specified in the README file.

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 1984-2016 Mark Nudelman * Copyright (C) 1984-2017 Mark Nudelman
* *
* You may distribute under the terms of either the GNU General Public * You may distribute under the terms of either the GNU General Public
* License or the Less License, as specified in the README file. * License or the Less License, as specified in the README file.
@ -60,7 +60,7 @@ position(where)
add_forw_pos(pos) add_forw_pos(pos)
POSITION pos; POSITION pos;
{ {
register int i; int i;
/* /*
* Scroll the position table up. * Scroll the position table up.
@ -77,7 +77,7 @@ add_forw_pos(pos)
add_back_pos(pos) add_back_pos(pos)
POSITION pos; POSITION pos;
{ {
register int i; int i;
/* /*
* Scroll the position table down. * Scroll the position table down.
@ -93,7 +93,7 @@ add_back_pos(pos)
public void public void
pos_clear() pos_clear()
{ {
register int i; int i;
for (i = 0; i < sc_height; i++) for (i = 0; i < sc_height; i++)
table[i] = NULL_POSITION; table[i] = NULL_POSITION;
@ -135,7 +135,7 @@ pos_init()
onscreen(pos) onscreen(pos)
POSITION pos; POSITION pos;
{ {
register int i; int i;
if (pos < table[0]) if (pos < table[0])
return (-1); return (-1);
@ -159,7 +159,7 @@ empty_lines(s, e)
int s; int s;
int e; int e;
{ {
register int i; int i;
for (i = s; i <= e; i++) for (i = s; i <= e; i++)
if (table[i] != NULL_POSITION && table[i] != 0) if (table[i] != NULL_POSITION && table[i] != 0)
@ -179,7 +179,7 @@ empty_lines(s, e)
get_scrpos(scrpos) get_scrpos(scrpos)
struct scrpos *scrpos; struct scrpos *scrpos;
{ {
register int i; int i;
/* /*
* Find the first line on the screen which has something on it, * Find the first line on the screen which has something on it,

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 1984-2016 Mark Nudelman * Copyright (C) 1984-2017 Mark Nudelman
* *
* You may distribute under the terms of either the GNU General Public * You may distribute under the terms of either the GNU General Public
* License or the Less License, as specified in the README file. * License or the Less License, as specified in the README file.

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 1984-2016 Mark Nudelman * Copyright (C) 1984-2017 Mark Nudelman
* *
* You may distribute under the terms of either the GNU General Public * You may distribute under the terms of either the GNU General Public
* License or the Less License, as specified in the README file. * License or the Less License, as specified in the README file.
@ -394,9 +394,9 @@ protochar(c, where, iseditproto)
*/ */
static constant char * static constant char *
skipcond(p) skipcond(p)
register constant char *p; constant char *p;
{ {
register int iflevel; int iflevel;
/* /*
* We came in here after processing a ? or :, * We came in here after processing a ? or :,
@ -479,8 +479,8 @@ pr_expand(proto, maxwidth)
constant char *proto; constant char *proto;
int maxwidth; int maxwidth;
{ {
register constant char *p; constant char *p;
register int c; int c;
int where; int where;
mp = message; mp = message;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 1984-2016 Mark Nudelman * Copyright (C) 1984-2017 Mark Nudelman
* *
* You may distribute under the terms of either the GNU General Public * You may distribute under the terms of either the GNU General Public
* License or the Less License, as specified in the README file. * License or the Less License, as specified in the README file.
@ -204,6 +204,7 @@ public int missing_cap = 0; /* Some capability is missing */
static int attrmode = AT_NORMAL; static int attrmode = AT_NORMAL;
extern int binattr; extern int binattr;
extern int line_count;
#if !MSDOS_COMPILER #if !MSDOS_COMPILER
static char *cheaper(); static char *cheaper();
@ -233,6 +234,7 @@ extern int wscroll;
extern int screen_trashed; extern int screen_trashed;
extern int tty; extern int tty;
extern int top_scroll; extern int top_scroll;
extern int quit_if_one_screen;
extern int oldbot; extern int oldbot;
#if HILITE_SEARCH #if HILITE_SEARCH
extern int hilite_search; extern int hilite_search;
@ -694,7 +696,7 @@ ltgetstr(capname, pp)
public void public void
scrsize() scrsize()
{ {
register char *s; char *s;
int sys_height; int sys_height;
int sys_width; int sys_width;
#if !MSDOS_COMPILER #if !MSDOS_COMPILER
@ -1119,7 +1121,7 @@ get_term()
#else /* !MSDOS_COMPILER */ #else /* !MSDOS_COMPILER */
char *sp; char *sp;
register char *t1, *t2; char *t1, *t2;
char *term; char *term;
char termbuf[TERMBUF_SIZE]; char termbuf[TERMBUF_SIZE];
@ -1538,7 +1540,9 @@ win32_deinit_term()
init() init()
{ {
#if !MSDOS_COMPILER #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); tputs(sc_init, sc_height, putchr);
if (!no_keypad) if (!no_keypad)
tputs(sc_s_keypad, sc_height, putchr); tputs(sc_s_keypad, sc_height, putchr);
@ -1578,7 +1582,7 @@ deinit()
#if !MSDOS_COMPILER #if !MSDOS_COMPILER
if (!no_keypad) if (!no_keypad)
tputs(sc_e_keypad, sc_height, putchr); tputs(sc_e_keypad, sc_height, putchr);
if (!no_init) if (!no_init && !quit_if_one_screen)
tputs(sc_deinit, sc_height, putchr); tputs(sc_deinit, sc_height, putchr);
#else #else
/* Restore system colors. */ /* Restore system colors. */
@ -1946,7 +1950,7 @@ create_flash()
} }
#else #else
#if MSDOS_COMPILER==BORLANDC #if MSDOS_COMPILER==BORLANDC
register int n; int n;
whitescreen = (unsigned short *) whitescreen = (unsigned short *)
malloc(sc_width * sc_height * sizeof(short)); malloc(sc_width * sc_height * sizeof(short));
@ -1956,7 +1960,7 @@ create_flash()
whitescreen[n] = 0x7020; whitescreen[n] = 0x7020;
#else #else
#if MSDOS_COMPILER==WIN32C #if MSDOS_COMPILER==WIN32C
register int n; int n;
whitescreen = (WORD *) whitescreen = (WORD *)
malloc(sc_height * sc_width * sizeof(WORD)); malloc(sc_height * sc_width * sizeof(WORD));

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 1984-2016 Mark Nudelman * Copyright (C) 1984-2017 Mark Nudelman
* *
* You may distribute under the terms of either the GNU General Public * You may distribute under the terms of either the GNU General Public
* License or the Less License, as specified in the README file. * License or the Less License, as specified in the README file.

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 1984-2016 Mark Nudelman * Copyright (C) 1984-2017 Mark Nudelman
* *
* You may distribute under the terms of either the GNU General Public * You may distribute under the terms of either the GNU General Public
* License or the Less License, as specified in the README file. * License or the Less License, as specified in the README file.
@ -13,7 +13,6 @@
*/ */
#include "less.h" #include "less.h"
#include "pattern.h"
#include "position.h" #include "position.h"
#include "charset.h" #include "charset.h"
@ -29,7 +28,7 @@ extern int jump_sline;
extern int bs_mode; extern int bs_mode;
extern int ctldisp; extern int ctldisp;
extern int status_col; extern int status_col;
extern void * constant ml_search; extern void *ml_search;
extern POSITION start_attnpos; extern POSITION start_attnpos;
extern POSITION end_attnpos; extern POSITION end_attnpos;
extern int utf_mode; extern int utf_mode;
@ -103,7 +102,7 @@ static struct hilite_tree filter_anchor = HILITE_INITIALIZER();
* search pattern and filter pattern. * search pattern and filter pattern.
*/ */
struct pattern_info { struct pattern_info {
DEFINE_PATTERN(compiled); PATTERN_TYPE compiled;
char* text; char* text;
int search_type; int search_type;
}; };
@ -1271,6 +1270,8 @@ search_range(pos, endpos, search_type, matches, maxlines, plinepos, pendpos)
hl.hl_startpos = linepos; hl.hl_startpos = linepos;
hl.hl_endpos = pos; hl.hl_endpos = pos;
add_hilite(&filter_anchor, &hl); add_hilite(&filter_anchor, &hl);
free(cline);
free(chpos);
continue; continue;
} }
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 1984-2016 Mark Nudelman * Copyright (C) 1984-2017 Mark Nudelman
* *
* You may distribute under the terms of either the GNU General Public * You may distribute under the terms of either the GNU General Public
* License or the Less License, as specified in the README file. * License or the Less License, as specified in the README file.
@ -192,7 +192,7 @@ init_signals(on)
public void public void
psignals() psignals()
{ {
register int tsignals; int tsignals;
if ((tsignals = sigs) == 0) if ((tsignals = sigs) == 0)
return; return;

18
tags.c
View File

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 1984-2016 Mark Nudelman * Copyright (C) 1984-2017 Mark Nudelman
* *
* You may distribute under the terms of either the GNU General Public * You may distribute under the terms of either the GNU General Public
* License or the Less License, as specified in the README file. * License or the Less License, as specified in the README file.
@ -63,8 +63,6 @@ struct taglist {
struct tag *tl_first; struct tag *tl_first;
struct tag *tl_last; struct tag *tl_last;
}; };
#define TAG_END ((struct tag *) &taglist)
static struct taglist taglist = { TAG_END, TAG_END };
struct tag { struct tag {
struct tag *next, *prev; /* List links */ struct tag *next, *prev; /* List links */
char *tag_file; /* Source file containing the tag */ 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_pattern; /* Pattern used to find the tag */
char tag_endline; /* True if the pattern includes '$' */ 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; static struct tag *curtag;
#define TAG_INS(tp) \ #define TAG_INS(tp) \
@ -90,7 +90,7 @@ static struct tag *curtag;
public void public void
cleantags() cleantags()
{ {
register struct tag *tp; struct tag *tp;
/* /*
* Delete any existing tag list. * Delete any existing tag list.
@ -117,7 +117,7 @@ maketagent(name, file, linenum, pattern, endline)
char *pattern; char *pattern;
int endline; int endline;
{ {
register struct tag *tp; struct tag *tp;
tp = (struct tag *) ecalloc(sizeof(struct tag), 1); tp = (struct tag *) ecalloc(sizeof(struct tag), 1);
tp->tag_file = (char *) ecalloc(strlen(file) + 1, sizeof(char)); tp->tag_file = (char *) ecalloc(strlen(file) + 1, sizeof(char));
@ -170,7 +170,7 @@ gettagtype()
*/ */
public void public void
findtag(tag) findtag(tag)
register char *tag; char *tag;
{ {
int type = gettagtype(); int type = gettagtype();
enum tag_result result; enum tag_result result;
@ -266,11 +266,11 @@ curr_tag()
*/ */
static enum tag_result static enum tag_result
findctag(tag) findctag(tag)
register char *tag; char *tag;
{ {
char *p; char *p;
register FILE *f; FILE *f;
register int taglen; int taglen;
LINENUM taglinenum; LINENUM taglinenum;
char *tagfile; char *tagfile;
char *tagpattern; char *tagpattern;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 1984-2016 Mark Nudelman * Copyright (C) 1984-2017 Mark Nudelman
* *
* You may distribute under the terms of either the GNU General Public * You may distribute under the terms of either the GNU General Public
* License or the Less License, as specified in the README file. * License or the Less License, as specified in the README file.
@ -120,7 +120,11 @@ getchr()
if (c == '\003') if (c == '\003')
return (READ_INTR); return (READ_INTR);
#else #else
result = iread(tty, &c, sizeof(char)); {
unsigned char uc;
result = iread(tty, &uc, sizeof(char));
c = (char) uc;
}
if (result == READ_INTR) if (result == READ_INTR)
return (READ_INTR); return (READ_INTR);
if (result < 0) if (result < 0)

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 1984-2016 Mark Nudelman * Copyright (C) 1984-2017 Mark Nudelman
* *
* You may distribute under the terms of either the GNU General Public * You may distribute under the terms of either the GNU General Public
* License or the Less License, as specified in the README file. * License or the Less License, as specified in the README file.
@ -805,6 +805,12 @@ v486 10/22/16 New commands ESC-{ and ESC-} to shift to start/end of
displayed lines; new option -Da in Windows version to displayed lines; new option -Da in Windows version to
enable SGR mode (thanks to Jason Hood). enable SGR mode (thanks to Jason Hood).
v487 10/23/16 configure --help formatting. 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[] = "487"; char version[] = "491";