svn commit: r355503 - in stable/12: contrib/less usr.bin/less
Xin LI
delphij at FreeBSD.org
Sat Dec 7 19:02:11 UTC 2019
Author: delphij
Date: Sat Dec 7 19:02:09 2019
New Revision: 355503
URL: https://svnweb.freebsd.org/changeset/base/355503
Log:
MFC r349549: MFV r349535: less v551.
Relnotes: yes
Modified:
stable/12/contrib/less/LICENSE
stable/12/contrib/less/NEWS
stable/12/contrib/less/README
stable/12/contrib/less/brac.c
stable/12/contrib/less/ch.c
stable/12/contrib/less/charset.c
stable/12/contrib/less/charset.h
stable/12/contrib/less/cmd.h
stable/12/contrib/less/cmdbuf.c
stable/12/contrib/less/command.c
stable/12/contrib/less/compose.uni
stable/12/contrib/less/cvt.c
stable/12/contrib/less/decode.c
stable/12/contrib/less/edit.c
stable/12/contrib/less/filename.c
stable/12/contrib/less/fmt.uni
stable/12/contrib/less/forwback.c
stable/12/contrib/less/funcs.h
stable/12/contrib/less/help.c
stable/12/contrib/less/ifile.c
stable/12/contrib/less/input.c
stable/12/contrib/less/jump.c
stable/12/contrib/less/less.h
stable/12/contrib/less/less.hlp
stable/12/contrib/less/less.nro
stable/12/contrib/less/lessecho.c
stable/12/contrib/less/lessecho.nro
stable/12/contrib/less/lesskey.c
stable/12/contrib/less/lesskey.h
stable/12/contrib/less/lesskey.nro
stable/12/contrib/less/lglob.h
stable/12/contrib/less/line.c
stable/12/contrib/less/linenum.c
stable/12/contrib/less/lsystem.c
stable/12/contrib/less/main.c
stable/12/contrib/less/mark.c
stable/12/contrib/less/mkutable
stable/12/contrib/less/optfunc.c
stable/12/contrib/less/option.c
stable/12/contrib/less/option.h
stable/12/contrib/less/opttbl.c
stable/12/contrib/less/os.c
stable/12/contrib/less/output.c
stable/12/contrib/less/pattern.c
stable/12/contrib/less/pattern.h
stable/12/contrib/less/pckeys.h
stable/12/contrib/less/position.c
stable/12/contrib/less/position.h
stable/12/contrib/less/prompt.c
stable/12/contrib/less/screen.c
stable/12/contrib/less/scrsize.c
stable/12/contrib/less/search.c
stable/12/contrib/less/signal.c
stable/12/contrib/less/tags.c
stable/12/contrib/less/ttyin.c
stable/12/contrib/less/ubin.uni
stable/12/contrib/less/version.c
stable/12/contrib/less/wide.uni
stable/12/usr.bin/less/defines.h
Directory Properties:
stable/12/ (props changed)
Modified: stable/12/contrib/less/LICENSE
==============================================================================
--- stable/12/contrib/less/LICENSE Sat Dec 7 18:40:46 2019 (r355502)
+++ stable/12/contrib/less/LICENSE Sat Dec 7 19:02:09 2019 (r355503)
@@ -2,7 +2,7 @@
------------
Less
-Copyright (C) 1984-2016 Mark Nudelman
+Copyright (C) 1984-2018 Mark Nudelman
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
Modified: stable/12/contrib/less/NEWS
==============================================================================
--- stable/12/contrib/less/NEWS Sat Dec 7 18:40:46 2019 (r355502)
+++ stable/12/contrib/less/NEWS Sat Dec 7 19:02:09 2019 (r355503)
@@ -11,6 +11,38 @@
======================================================================
+ Major changes between "less" versions 530 and 551
+
+* Add --mouse option.
+
+* Add --wheel-lines option.
+
+* Add --no-histdups option.
+
+* Add --save-marks option.
+
+* Support PCRE2 regular expression library.
+
+* Redraw screen on SIGWINCH even if screen size doesn't change.
+
+* Shell-escape filenames in history so they can be used again.
+
+* Ring bell if user enters invalid long option name.
+
+* Use PCRE_UTF8 flag for pcre regular expressions when in UTF-8 mode.
+
+* Windows: use wide-char string to set console title.
+
+* Don't count lines in initial screen if using -X with -F.
+
+* Support mingw build system.
+
+* Fix bug in v command on empty file.
+
+* Fix bug in v command when filename contains shell metacharacters.
+
+======================================================================
+
Major changes between "less" versions 487 and 530
* Don't output terminal init sequence if using -F and file fits on one screen.
Modified: stable/12/contrib/less/README
==============================================================================
--- stable/12/contrib/less/README Sat Dec 7 18:40:46 2019 (r355502)
+++ stable/12/contrib/less/README Sat Dec 7 19:02:09 2019 (r355503)
@@ -7,9 +7,9 @@
**************************************************************************
**************************************************************************
- Less, version 530
+ Less, version 551
- This is the distribution of less, version 530, released 05 Dec 2017.
+ This is the distribution of less, version 551, released 11 Jun 2019.
This program is part of the GNU project (http://www.gnu.org).
This program is free software. You may redistribute it and/or
@@ -56,6 +56,7 @@ INSTALLATION (Unix systems only):
finds a regular expression library automatically. Other values are:
gnu Use the GNU regex library.
pcre Use the PCRE library.
+ pcre2 Use the PCRE2 library.
posix Use the POSIX-compatible regcomp.
regcmp Use the regcmp library.
re_comp Use the re_comp library.
@@ -63,6 +64,7 @@ INSTALLATION (Unix systems only):
regcomp-local Use Henry Spencer's V8-compatible regcomp
(source is supplied with less).
none No regular expressions, only simple string matching.
+
--with-secure
Builds a "secure" version of less, with some features disabled
to prevent users from viewing other files, accessing shell
Modified: stable/12/contrib/less/brac.c
==============================================================================
--- stable/12/contrib/less/brac.c Sat Dec 7 18:40:46 2019 (r355502)
+++ stable/12/contrib/less/brac.c Sat Dec 7 19:02:09 2019 (r355503)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 1984-2017 Mark Nudelman
+ * Copyright (C) 1984-2019 Mark Nudelman
*
* You may distribute under the terms of either the GNU General Public
* License or the Less License, as specified in the README file.
Modified: stable/12/contrib/less/ch.c
==============================================================================
--- stable/12/contrib/less/ch.c Sat Dec 7 18:40:46 2019 (r355502)
+++ stable/12/contrib/less/ch.c Sat Dec 7 19:02:09 2019 (r355503)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 1984-2017 Mark Nudelman
+ * Copyright (C) 1984-2019 Mark Nudelman
*
* You may distribute under the terms of either the GNU General Public
* License or the Less License, as specified in the README file.
@@ -144,7 +144,7 @@ static int ch_addbuf();
* Get the character pointed to by the read pointer.
*/
int
-ch_get()
+ch_get(VOID_PARAM)
{
struct buf *bp;
struct bufnode *bn;
@@ -392,7 +392,7 @@ ch_ungetchar(c)
* If we haven't read all of standard input into it, do that now.
*/
public void
-end_logfile()
+end_logfile(VOID_PARAM)
{
static int tried = FALSE;
@@ -417,7 +417,7 @@ end_logfile()
* Write all the existing buffered data to the log file.
*/
public void
-sync_logfile()
+sync_logfile(VOID_PARAM)
{
struct buf *bp;
struct bufnode *bn;
@@ -515,7 +515,7 @@ ch_seek(pos)
* Seek to the end of the file.
*/
public int
-ch_end_seek()
+ch_end_seek(VOID_PARAM)
{
POSITION len;
@@ -542,7 +542,7 @@ ch_end_seek()
* Seek to the last position in the file that is currently buffered.
*/
public int
-ch_end_buffer_seek()
+ch_end_buffer_seek(VOID_PARAM)
{
struct buf *bp;
struct bufnode *bn;
@@ -570,7 +570,7 @@ ch_end_buffer_seek()
* beginning of the pipe is no longer buffered.
*/
public int
-ch_beg_seek()
+ch_beg_seek(VOID_PARAM)
{
struct bufnode *bn;
struct bufnode *firstbn;
@@ -602,7 +602,7 @@ ch_beg_seek()
* Return the length of the file, if known.
*/
public POSITION
-ch_length()
+ch_length(VOID_PARAM)
{
if (thisfile == NULL)
return (NULL_POSITION);
@@ -619,7 +619,7 @@ ch_length()
* Return the current position in the file.
*/
public POSITION
-ch_tell()
+ch_tell(VOID_PARAM)
{
if (thisfile == NULL)
return (NULL_POSITION);
@@ -630,7 +630,7 @@ ch_tell()
* Get the current char and post-increment the read pointer.
*/
public int
-ch_forw_get()
+ch_forw_get(VOID_PARAM)
{
int c;
@@ -653,7 +653,7 @@ ch_forw_get()
* Pre-decrement the read pointer and get the new current char.
*/
public int
-ch_back_get()
+ch_back_get(VOID_PARAM)
{
if (thisfile == NULL)
return (EOI);
@@ -693,7 +693,7 @@ ch_setbufspace(bufspace)
* Flush (discard) any saved file state, including buffer contents.
*/
public void
-ch_flush()
+ch_flush(VOID_PARAM)
{
struct bufnode *bn;
@@ -760,7 +760,7 @@ ch_flush()
* The buffer is added to the tail of the buffer chain.
*/
static int
-ch_addbuf()
+ch_addbuf(VOID_PARAM)
{
struct buf *bp;
struct bufnode *bn;
@@ -785,7 +785,7 @@ ch_addbuf()
*
*/
static void
-init_hashtbl()
+init_hashtbl(VOID_PARAM)
{
int h;
@@ -800,7 +800,7 @@ init_hashtbl()
* Delete all buffers for this file.
*/
static void
-ch_delbufs()
+ch_delbufs(VOID_PARAM)
{
struct bufnode *bn;
@@ -840,7 +840,7 @@ seekable(f)
* This is used after an ignore_eof read, during which the EOF may change.
*/
public void
-ch_set_eof()
+ch_set_eof(VOID_PARAM)
{
ch_fsize = ch_fpos;
}
@@ -890,7 +890,7 @@ ch_init(f, flags)
* Close a filestate.
*/
public void
-ch_close()
+ch_close(VOID_PARAM)
{
int keepstate = FALSE;
@@ -933,7 +933,7 @@ ch_close()
* Return ch_flags for the current file.
*/
public int
-ch_getflags()
+ch_getflags(VOID_PARAM)
{
if (thisfile == NULL)
return (0);
Modified: stable/12/contrib/less/charset.c
==============================================================================
--- stable/12/contrib/less/charset.c Sat Dec 7 18:40:46 2019 (r355502)
+++ stable/12/contrib/less/charset.c Sat Dec 7 19:02:09 2019 (r355503)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 1984-2017 Mark Nudelman
+ * Copyright (C) 1984-2019 Mark Nudelman
*
* You may distribute under the terms of either the GNU General Public
* License or the Less License, as specified in the README file.
@@ -245,7 +245,7 @@ icharset(name, no_error)
* Define a charset, given a locale name.
*/
static void
-ilocale()
+ilocale(VOID_PARAM)
{
int c;
@@ -315,7 +315,7 @@ setfmt(s, fmtvarptr, attrptr, default_fmt)
*
*/
static void
-set_charset()
+set_charset(VOID_PARAM)
{
char *s;
@@ -338,7 +338,7 @@ set_charset()
* LESSCHARSET is not defined: try LESSCHARDEF.
*/
s = lgetenv("LESSCHARDEF");
- if (s != NULL && *s != '\0')
+ if (!isnullenv(s))
{
ichardef(s);
return;
@@ -395,7 +395,7 @@ set_charset()
* Initialize charset data structures.
*/
public void
-init_charset()
+init_charset(VOID_PARAM)
{
char *s;
Modified: stable/12/contrib/less/charset.h
==============================================================================
--- stable/12/contrib/less/charset.h Sat Dec 7 18:40:46 2019 (r355502)
+++ stable/12/contrib/less/charset.h Sat Dec 7 19:02:09 2019 (r355503)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 1984-2017 Mark Nudelman
+ * Copyright (C) 1984-2019 Mark Nudelman
*
* You may distribute under the terms of either the GNU General Public
* License or the Less License, as specified in the README file.
Modified: stable/12/contrib/less/cmd.h
==============================================================================
--- stable/12/contrib/less/cmd.h Sat Dec 7 18:40:46 2019 (r355502)
+++ stable/12/contrib/less/cmd.h Sat Dec 7 19:02:09 2019 (r355503)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 1984-2017 Mark Nudelman
+ * Copyright (C) 1984-2019 Mark Nudelman
*
* You may distribute under the terms of either the GNU General Public
* License or the Less License, as specified in the README file.
@@ -71,6 +71,13 @@
#define A_RRSHIFT 59
#define A_CLRMARK 62
#define A_SETMARKBOT 63
+#define A_X11MOUSE_IN 64
+#define A_X11MOUSE_IGNORE 65
+#define A_F_MOUSE 66
+#define A_B_MOUSE 67
+/* Note "X116" refers to extended (1006) X11 mouse reporting. */
+#define A_X116MOUSE_IN 68
+#define A_X116MOUSE_IGNORE 69
#define A_INVALID 100
#define A_NOACTION 101
Modified: stable/12/contrib/less/cmdbuf.c
==============================================================================
--- stable/12/contrib/less/cmdbuf.c Sat Dec 7 18:40:46 2019 (r355502)
+++ stable/12/contrib/less/cmdbuf.c Sat Dec 7 19:02:09 2019 (r355503)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 1984-2017 Mark Nudelman
+ * Copyright (C) 1984-2019 Mark Nudelman
*
* You may distribute under the terms of either the GNU General Public
* License or the Less License, as specified in the README file.
@@ -22,6 +22,8 @@
extern int sc_width;
extern int utf_mode;
+extern int no_hist_dups;
+extern int marks_modified;
static char cmdbuf[CMDBUF_SIZE]; /* Buffer for holding a multi-char command */
static int cmd_col; /* Current column of the cursor */
@@ -58,6 +60,7 @@ public char closequote = '"';
#define HISTFILE_FIRST_LINE ".less-history-file:"
#define HISTFILE_SEARCH_SECTION ".search"
#define HISTFILE_SHELL_SECTION ".shell"
+#define HISTFILE_MARK_SECTION ".mark"
/*
* A mlist structure represents a command history.
@@ -114,7 +117,7 @@ static int cmd_mbc_buf_index;
* Reset command buffer (to empty).
*/
public void
-cmd_reset()
+cmd_reset(VOID_PARAM)
{
cp = cmdbuf;
*cp = '\0';
@@ -129,7 +132,7 @@ cmd_reset()
* Clear command line.
*/
public void
-clear_cmd()
+clear_cmd(VOID_PARAM)
{
cmd_col = prompt_col = 0;
cmd_mbc_buf_len = 0;
@@ -169,7 +172,7 @@ cmd_putstr(s)
* How many characters are in the command buffer?
*/
public int
-len_cmdbuf()
+len_cmdbuf(VOID_PARAM)
{
char *s = cmdbuf;
char *endline = s + strlen(s);
@@ -302,7 +305,7 @@ cmd_repaint(old_cp)
* and set cp to the corresponding char in cmdbuf.
*/
static void
-cmd_home()
+cmd_home(VOID_PARAM)
{
while (cmd_col > prompt_col)
{
@@ -321,7 +324,7 @@ cmd_home()
* Shift the cmdbuf display left a half-screen.
*/
static void
-cmd_lshift()
+cmd_lshift(VOID_PARAM)
{
char *s;
char *save_cp;
@@ -359,7 +362,7 @@ cmd_lshift()
* Shift the cmdbuf display right a half-screen.
*/
static void
-cmd_rshift()
+cmd_rshift(VOID_PARAM)
{
char *s;
char *save_cp;
@@ -389,7 +392,7 @@ cmd_rshift()
* Move cursor right one character.
*/
static int
-cmd_right()
+cmd_right(VOID_PARAM)
{
char *pr;
char *ncp;
@@ -424,7 +427,7 @@ cmd_right()
* Move cursor left one character.
*/
static int
-cmd_left()
+cmd_left(VOID_PARAM)
{
char *ncp;
int width = 0;
@@ -492,7 +495,7 @@ cmd_ichar(cs, clen)
* Delete the char to the left of the cursor.
*/
static int
-cmd_erase()
+cmd_erase(VOID_PARAM)
{
char *s;
int clen;
@@ -541,7 +544,7 @@ cmd_erase()
* Delete the char under the cursor.
*/
static int
-cmd_delete()
+cmd_delete(VOID_PARAM)
{
if (*cp == '\0')
{
@@ -560,7 +563,7 @@ cmd_delete()
* Delete the "word" to the left of the cursor.
*/
static int
-cmd_werase()
+cmd_werase(VOID_PARAM)
{
if (cp > cmdbuf && cp[-1] == ' ')
{
@@ -586,7 +589,7 @@ cmd_werase()
* Delete the "word" under the cursor.
*/
static int
-cmd_wdelete()
+cmd_wdelete(VOID_PARAM)
{
if (*cp == ' ')
{
@@ -612,7 +615,7 @@ cmd_wdelete()
* Delete all chars in the command buffer.
*/
static int
-cmd_kill()
+cmd_kill(VOID_PARAM)
{
if (cmdbuf[0] == '\0')
{
@@ -702,6 +705,7 @@ cmd_updown(action)
s = ml->string;
if (s == NULL)
s = "";
+ cmd_offset = 0;
cmd_home();
clear_eol();
strcpy(cmdbuf, s);
@@ -719,6 +723,31 @@ cmd_updown(action)
#endif
/*
+ *
+ */
+ static void
+ml_link(mlist, ml)
+ struct mlist *mlist;
+ struct mlist *ml;
+{
+ ml->next = mlist;
+ ml->prev = mlist->prev;
+ mlist->prev->next = ml;
+ mlist->prev = ml;
+}
+
+/*
+ *
+ */
+ static void
+ml_unlink(ml)
+ struct mlist *ml;
+{
+ ml->prev->next = ml->next;
+ ml->next->prev = ml->prev;
+}
+
+/*
* Add a string to an mlist.
*/
public void
@@ -736,6 +765,21 @@ cmd_addhist(mlist, cmd, modified)
if (strlen(cmd) == 0)
return;
+ if (no_hist_dups)
+ {
+ struct mlist *next = NULL;
+ for (ml = mlist->next; ml->string != NULL; ml = next)
+ {
+ next = ml->next;
+ if (strcmp(ml->string, cmd) == 0)
+ {
+ ml_unlink(ml);
+ free(ml->string);
+ free(ml);
+ }
+ }
+ }
+
/*
* Save the command unless it's a duplicate of the
* last command in the history.
@@ -750,10 +794,7 @@ cmd_addhist(mlist, cmd, modified)
ml = (struct mlist *) ecalloc(1, sizeof(struct mlist));
ml->string = save(cmd);
ml->modified = modified;
- ml->next = mlist;
- ml->prev = mlist->prev;
- mlist->prev->next = ml;
- mlist->prev = ml;
+ ml_link(mlist, ml);
}
/*
* Point to the cmd just after the just-accepted command.
@@ -768,13 +809,13 @@ cmd_addhist(mlist, cmd, modified)
* Add it to the currently selected history list.
*/
public void
-cmd_accept()
+cmd_accept(VOID_PARAM)
{
#if CMD_HISTORY
/*
* Nothing to do if there is no currently selected history list.
*/
- if (curr_mlist == NULL)
+ if (curr_mlist == NULL || curr_mlist == ml_examine)
return;
cmd_addhist(curr_mlist, cmdbuf, 1);
curr_mlist->modified = 1;
@@ -799,7 +840,7 @@ cmd_edit(c)
#if TAB_COMPLETE_FILENAME
#define not_in_completion() in_completion = 0
#else
-#define not_in_completion()
+#define not_in_completion(VOID_PARAM)
#endif
/*
@@ -934,7 +975,7 @@ cmd_istr(str)
* cursor at the end of the word.
*/
static char *
-delimit_word()
+delimit_word(VOID_PARAM)
{
char *word;
#if SPACES_IN_FILENAMES
@@ -1021,7 +1062,7 @@ delimit_word()
* which start with that word, and set tk_text to that list.
*/
static void
-init_compl()
+init_compl(VOID_PARAM)
{
char *word;
char c;
@@ -1148,9 +1189,9 @@ cmd_complete(action)
tk_trial = next_compl(action, tk_trial);
}
- /*
- * Remove the original word, or the previous trial completion.
- */
+ /*
+ * Remove the original word, or the previous trial completion.
+ */
while (cp > tk_ipoint)
(void) cmd_erase();
@@ -1323,7 +1364,7 @@ cmd_int(frac)
* Return a pointer to the command buffer.
*/
public char *
-get_cmdbuf()
+get_cmdbuf(VOID_PARAM)
{
return (cmdbuf);
}
@@ -1333,7 +1374,7 @@ get_cmdbuf()
* Return the last (most recent) string in the current command history.
*/
public char *
-cmd_lastpattern()
+cmd_lastpattern(VOID_PARAM)
{
if (curr_mlist == NULL)
return (NULL);
@@ -1358,7 +1399,7 @@ mlist_size(ml)
* Get the name of the history file.
*/
static char *
-histfile_name()
+histfile_name(VOID_PARAM)
{
char *home;
char *name;
@@ -1366,7 +1407,7 @@ histfile_name()
/* See if filename is explicitly specified by $LESSHISTFILE. */
name = lgetenv("LESSHISTFILE");
- if (name != NULL && *name != '\0')
+ if (!isnullenv(name))
{
if (strcmp(name, "-") == 0 || strcmp(name, "/dev/null") == 0)
/* $LESSHISTFILE == "-" means don't use a history file. */
@@ -1380,11 +1421,11 @@ histfile_name()
/* Otherwise, file is in $HOME. */
home = lgetenv("HOME");
- if (home == NULL || *home == '\0')
+ if (isnullenv(home))
{
#if OS2
home = lgetenv("INIT");
- if (home == NULL || *home == '\0')
+ if (isnullenv(home))
#endif
return (NULL);
}
@@ -1447,6 +1488,9 @@ read_cmdhist2(action, uparam, skip_search, skip_shell)
ml = NULL;
skip = NULL;
#endif
+ } else if (strcmp(line, HISTFILE_MARK_SECTION) == 0)
+ {
+ ml = NULL;
} else if (*line == '"')
{
if (ml != NULL)
@@ -1456,6 +1500,9 @@ read_cmdhist2(action, uparam, skip_search, skip_shell)
else
(*action)(uparam, ml, line+1);
}
+ } else if (*line == 'm')
+ {
+ (*action)(uparam, NULL, line);
}
}
fclose(f);
@@ -1475,9 +1522,10 @@ read_cmdhist(action, uparam, skip_search, skip_shell)
static void
addhist_init(void *uparam, struct mlist *ml, char *string)
{
- if (ml == NULL || string == NULL)
- return;
- cmd_addhist(ml, string, 0);
+ if (ml != NULL)
+ cmd_addhist(ml, string, 0);
+ else if (string != NULL)
+ restore_mark(string);
}
#endif /* CMD_HISTORY */
@@ -1485,7 +1533,7 @@ addhist_init(void *uparam, struct mlist *ml, char *str
* Initialize history from a .lesshist file.
*/
public void
-init_cmdhist()
+init_cmdhist(VOID_PARAM)
{
#if CMD_HISTORY
read_cmdhist(&addhist_init, NULL, 0, 0);
@@ -1558,7 +1606,7 @@ copy_hist(void *uparam, struct mlist *ml, char *string
{
struct save_ctx *ctx = (struct save_ctx *) uparam;
- if (ml != ctx->mlist) {
+ if (ml != NULL && ml != ctx->mlist) {
/* We're changing mlists. */
if (ctx->mlist)
/* Append any new entries to the end of the current mlist. */
@@ -1567,13 +1615,9 @@ copy_hist(void *uparam, struct mlist *ml, char *string
ctx->mlist = ml;
write_mlist_header(ctx->mlist, ctx->fout);
}
- if (string != NULL)
+
+ if (string == NULL) /* End of file */
{
- /* Copy the entry. */
- fprintf(ctx->fout, "\"%s\n", string);
- }
- if (ml == NULL) /* End of file */
- {
/* Write any sections that were not in the original file. */
if (mlist_search.modified)
{
@@ -1587,7 +1631,12 @@ copy_hist(void *uparam, struct mlist *ml, char *string
write_mlist(&mlist_shell, ctx->fout);
}
#endif
+ } else if (ml != NULL)
+ {
+ /* Copy mlist entry. */
+ fprintf(ctx->fout, "\"%s\n", string);
}
+ /* Skip marks */
}
#endif /* CMD_HISTORY */
@@ -1616,7 +1665,7 @@ make_file_private(f)
* Does the history file need to be updated?
*/
static int
-histfile_modified()
+histfile_modified(VOID_PARAM)
{
if (mlist_search.modified)
return 1;
@@ -1624,6 +1673,10 @@ histfile_modified()
if (mlist_shell.modified)
return 1;
#endif
+#if CMD_HISTORY
+ if (marks_modified)
+ return 1;
+#endif
return 0;
}
@@ -1631,7 +1684,7 @@ histfile_modified()
* Update the .lesshst file.
*/
public void
-save_cmdhist()
+save_cmdhist(VOID_PARAM)
{
#if CMD_HISTORY
char *histname;
@@ -1665,7 +1718,8 @@ save_cmdhist()
fprintf(fout, "%s\n", HISTFILE_FIRST_LINE);
ctx.fout = fout;
ctx.mlist = NULL;
- read_cmdhist(copy_hist, &ctx, skip_search, skip_shell);
+ read_cmdhist(©_hist, &ctx, skip_search, skip_shell);
+ save_marks(fout, HISTFILE_MARK_SECTION);
fclose(fout);
#if MSDOS_COMPILER==WIN32C
/*
Modified: stable/12/contrib/less/command.c
==============================================================================
--- stable/12/contrib/less/command.c Sat Dec 7 18:40:46 2019 (r355502)
+++ stable/12/contrib/less/command.c Sat Dec 7 19:02:09 2019 (r355503)
@@ -1,6 +1,6 @@
/* $FreeBSD$ */
/*
- * Copyright (C) 1984-2017 Mark Nudelman
+ * Copyright (C) 1984-2019 Mark Nudelman
*
* You may distribute under the terms of either the GNU General Public
* License or the Less License, as specified in the README file.
@@ -49,6 +49,7 @@ extern struct scrpos initial_scrpos;
extern IFILE curr_ifile;
extern void *ml_search;
extern void *ml_examine;
+extern int wheel_lines;
#if SHELL_ESCAPE || PIPEC
extern void *ml_shell;
#endif
@@ -60,6 +61,9 @@ extern int screen_trashed; /* The screen has been over
extern int shift_count;
extern int oldbot;
extern int forw_prompt;
+#if MSDOS_COMPILER==WIN32C
+extern int utf_mode;
+#endif
#if SHELL_ESCAPE
static char *shellcmd = NULL; /* For holding last shell command for "!!" */
@@ -94,14 +98,39 @@ static void multi_search();
* updating the screen.
*/
static void
-cmd_exec()
+cmd_exec(VOID_PARAM)
{
- clear_attn();
+ clear_attn();
clear_bot();
flush();
}
/*
+ * Indicate we are reading a multi-character command.
+ */
+ static void
+set_mca(action)
+ int action;
+{
+ mca = action;
+ deinit_mouse(); /* we don't want mouse events while entering a cmd */
+ clear_bot();
+ clear_cmd();
+}
+
+/*
+ * Indicate we are not reading a multi-character command.
+ */
+ static void
+clear_mca(VOID_PARAM)
+{
+ if (mca == 0)
+ return;
+ mca = 0;
+ init_mouse();
+}
+
+/*
* Set up the display to start a new multi-character command.
*/
static void
@@ -111,15 +140,13 @@ start_mca(action, prompt, mlist, cmdflags)
void *mlist;
int cmdflags;
{
- mca = action;
- clear_bot();
- clear_cmd();
+ set_mca(action);
cmd_putstr(prompt);
set_mlist(mlist, cmdflags);
}
public int
-in_mca()
+in_mca(VOID_PARAM)
{
return (mca != 0 && mca != A_PREFIX);
}
@@ -128,21 +155,18 @@ in_mca()
* Set up the display to start a new search command.
*/
static void
-mca_search()
+mca_search(VOID_PARAM)
{
#if HILITE_SEARCH
if (search_type & SRCH_FILTER)
- mca = A_FILTER;
+ set_mca(A_FILTER);
else
#endif
if (search_type & SRCH_FORW)
- mca = A_F_SEARCH;
+ set_mca(A_F_SEARCH);
else
- mca = A_B_SEARCH;
+ set_mca(A_B_SEARCH);
- clear_bot();
- clear_cmd();
-
if (search_type & SRCH_NO_MATCH)
cmd_putstr("Non-match ");
if (search_type & SRCH_FIRST_FILE)
@@ -171,7 +195,7 @@ mca_search()
* Set up the display to start a new toggle-option command.
*/
static void
-mca_opt_toggle()
+mca_opt_toggle(VOID_PARAM)
{
int no_prompt;
int flag;
@@ -181,9 +205,7 @@ mca_opt_toggle()
flag = (optflag & ~OPT_NO_PROMPT);
dash = (flag == OPT_NO_TOGGLE) ? "_" : "-";
- mca = A_OPT_TOGGLE;
- clear_bot();
- clear_cmd();
+ set_mca(A_OPT_TOGGLE);
cmd_putstr(dash);
if (optgetname)
cmd_putstr(dash);
@@ -206,7 +228,7 @@ mca_opt_toggle()
* Execute a multicharacter command.
*/
static void
-exec_mca()
+exec_mca(VOID_PARAM)
{
char *cbuf;
@@ -373,6 +395,7 @@ mca_opt_nonfirst_char(c)
{
char *p;
char *oname;
+ int err;
if (curropt != NULL)
{
@@ -392,7 +415,8 @@ mca_opt_nonfirst_char(c)
return (MCA_DONE);
p = get_cmdbuf();
opt_lower = ASCII_IS_LOWER(p[0]);
- curropt = findopt_name(&p, &oname, NULL);
+ err = 0;
+ curropt = findopt_name(&p, &oname, &err);
if (curropt != NULL)
{
/*
@@ -410,6 +434,9 @@ mca_opt_nonfirst_char(c)
if (cmd_char(c) != CC_OK)
return (MCA_DONE);
}
+ } else if (err != OPT_AMBIG)
+ {
+ bell();
}
return (MCA_MORE);
}
@@ -461,6 +488,7 @@ mca_opt_char(c)
error("There is no %s option", &parg);
return (MCA_DONE);
}
+ opt_lower = ASCII_IS_LOWER(c);
}
/*
* If the option which was entered does not take a
@@ -470,7 +498,7 @@ mca_opt_char(c)
if ((optflag & ~OPT_NO_PROMPT) != OPT_TOGGLE ||
!opt_has_param(curropt))
{
- toggle_option(curropt, ASCII_IS_LOWER(c), "", optflag);
+ toggle_option(curropt, opt_lower, "", optflag);
return (MCA_DONE);
}
/*
@@ -577,7 +605,7 @@ mca_char(c)
* as a normal command character.
*/
number = cmd_int(&fraction);
- mca = 0;
+ clear_mca();
cmd_accept();
return (NO_MCA);
}
@@ -644,7 +672,7 @@ mca_char(c)
* Discard any buffered file data.
*/
static void
-clear_buffers()
+clear_buffers(VOID_PARAM)
{
if (!(ch_getflags() & CH_CANSEEK))
return;
@@ -659,7 +687,7 @@ clear_buffers()
* Make sure the screen is displayed.
*/
static void
-make_display()
+make_display(VOID_PARAM)
{
/*
* If nothing is displayed yet, display starting from initial_scrpos.
@@ -699,7 +727,7 @@ make_display()
* Display the appropriate prompt.
*/
static void
-prompt()
+prompt(VOID_PARAM)
{
constant char *p;
@@ -739,8 +767,14 @@ prompt()
* In Win32, display the file name in the window title.
*/
*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
More information about the svn-src-all
mailing list