svn commit: r349535 - vendor/less/dist

Xin LI delphij at FreeBSD.org
Sat Jun 29 04:39:04 UTC 2019


Author: delphij
Date: Sat Jun 29 04:39:01 2019
New Revision: 349535
URL: https://svnweb.freebsd.org/changeset/base/349535

Log:
  Vendor import of less v551.

Modified:
  vendor/less/dist/LICENSE
  vendor/less/dist/Makefile.aut
  vendor/less/dist/NEWS
  vendor/less/dist/README
  vendor/less/dist/brac.c
  vendor/less/dist/ch.c
  vendor/less/dist/charset.c
  vendor/less/dist/charset.h
  vendor/less/dist/cmd.h
  vendor/less/dist/cmdbuf.c
  vendor/less/dist/command.c
  vendor/less/dist/compose.uni
  vendor/less/dist/configure
  vendor/less/dist/configure.ac
  vendor/less/dist/cvt.c
  vendor/less/dist/decode.c
  vendor/less/dist/defines.ds
  vendor/less/dist/defines.h.in
  vendor/less/dist/defines.o2
  vendor/less/dist/defines.o9
  vendor/less/dist/defines.wn
  vendor/less/dist/edit.c
  vendor/less/dist/filename.c
  vendor/less/dist/fmt.uni
  vendor/less/dist/forwback.c
  vendor/less/dist/funcs.h
  vendor/less/dist/help.c
  vendor/less/dist/ifile.c
  vendor/less/dist/input.c
  vendor/less/dist/jump.c
  vendor/less/dist/less.h
  vendor/less/dist/less.hlp
  vendor/less/dist/less.man
  vendor/less/dist/less.nro
  vendor/less/dist/lessecho.c
  vendor/less/dist/lessecho.man
  vendor/less/dist/lessecho.nro
  vendor/less/dist/lesskey.c
  vendor/less/dist/lesskey.h
  vendor/less/dist/lesskey.man
  vendor/less/dist/lesskey.nro
  vendor/less/dist/lglob.h
  vendor/less/dist/line.c
  vendor/less/dist/linenum.c
  vendor/less/dist/lsystem.c
  vendor/less/dist/main.c
  vendor/less/dist/mark.c
  vendor/less/dist/mkutable
  vendor/less/dist/optfunc.c
  vendor/less/dist/option.c
  vendor/less/dist/option.h
  vendor/less/dist/opttbl.c
  vendor/less/dist/os.c
  vendor/less/dist/output.c
  vendor/less/dist/pattern.c
  vendor/less/dist/pattern.h
  vendor/less/dist/pckeys.h
  vendor/less/dist/position.c
  vendor/less/dist/position.h
  vendor/less/dist/prompt.c
  vendor/less/dist/screen.c
  vendor/less/dist/scrsize.c
  vendor/less/dist/search.c
  vendor/less/dist/signal.c
  vendor/less/dist/tags.c
  vendor/less/dist/ttyin.c
  vendor/less/dist/ubin.uni
  vendor/less/dist/version.c
  vendor/less/dist/wide.uni

Modified: vendor/less/dist/LICENSE
==============================================================================
--- vendor/less/dist/LICENSE	Sat Jun 29 00:53:07 2019	(r349534)
+++ vendor/less/dist/LICENSE	Sat Jun 29 04:39:01 2019	(r349535)
@@ -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: vendor/less/dist/Makefile.aut
==============================================================================
--- vendor/less/dist/Makefile.aut	Sat Jun 29 00:53:07 2019	(r349534)
+++ vendor/less/dist/Makefile.aut	Sat Jun 29 04:39:01 2019	(r349535)
@@ -112,6 +112,13 @@ ubin.uni: unicode/UnicodeData.txt
 wide.uni: unicode/EastAsianWidth.txt
 	./mkutable -f1 W F -- unicode/EastAsianWidth.txt > $@
 
+unicode/UnicodeData.txt:
+	mkdir -p unicode
+	curl -s -o $@ ftp://ftp.unicode.org/Public/UNIDATA/UnicodeData.txt
+unicode/EastAsianWidth.txt:
+	mkdir -p unicode
+	curl -s -o $@ ftp://ftp.unicode.org/Public/UNIDATA/EastAsianWidth.txt
+
 distfiles: ${DISTFILES}
 
 dist: ${DISTFILES}
@@ -137,4 +144,4 @@ dist: ${DISTFILES}
 tagall:
 	@REL=`sed -e '/char version/!d' -e 's/[^0-9.]*\([0-9.]*\).*/v\1/' -e q ${srcdir}/version.c`; \
 	echo "tagging $$REL"; \
-	$(GIT) tag -f "$$REL"
+	$(GIT) tag -a -f -m "$$REL" "$$REL"

Modified: vendor/less/dist/NEWS
==============================================================================
--- vendor/less/dist/NEWS	Sat Jun 29 00:53:07 2019	(r349534)
+++ vendor/less/dist/NEWS	Sat Jun 29 04:39:01 2019	(r349535)
@@ -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: vendor/less/dist/README
==============================================================================
--- vendor/less/dist/README	Sat Jun 29 00:53:07 2019	(r349534)
+++ vendor/less/dist/README	Sat Jun 29 04:39:01 2019	(r349535)
@@ -1,7 +1,7 @@
 
-                            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
@@ -48,6 +48,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.
@@ -55,6 +56,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: vendor/less/dist/brac.c
==============================================================================
--- vendor/less/dist/brac.c	Sat Jun 29 00:53:07 2019	(r349534)
+++ vendor/less/dist/brac.c	Sat Jun 29 04:39:01 2019	(r349535)
@@ -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: vendor/less/dist/ch.c
==============================================================================
--- vendor/less/dist/ch.c	Sat Jun 29 00:53:07 2019	(r349534)
+++ vendor/less/dist/ch.c	Sat Jun 29 04:39:01 2019	(r349535)
@@ -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: vendor/less/dist/charset.c
==============================================================================
--- vendor/less/dist/charset.c	Sat Jun 29 00:53:07 2019	(r349534)
+++ vendor/less/dist/charset.c	Sat Jun 29 04:39:01 2019	(r349535)
@@ -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: vendor/less/dist/charset.h
==============================================================================
--- vendor/less/dist/charset.h	Sat Jun 29 00:53:07 2019	(r349534)
+++ vendor/less/dist/charset.h	Sat Jun 29 04:39:01 2019	(r349535)
@@ -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: vendor/less/dist/cmd.h
==============================================================================
--- vendor/less/dist/cmd.h	Sat Jun 29 00:53:07 2019	(r349534)
+++ vendor/less/dist/cmd.h	Sat Jun 29 04:39:01 2019	(r349535)
@@ -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: vendor/less/dist/cmdbuf.c
==============================================================================
--- vendor/less/dist/cmdbuf.c	Sat Jun 29 00:53:07 2019	(r349534)
+++ vendor/less/dist/cmdbuf.c	Sat Jun 29 04:39:01 2019	(r349535)
@@ -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(&copy_hist, &ctx, skip_search, skip_shell);
+		save_marks(fout, HISTFILE_MARK_SECTION);
 		fclose(fout);
 #if MSDOS_COMPILER==WIN32C
 		/*

Modified: vendor/less/dist/command.c
==============================================================================
--- vendor/less/dist/command.c	Sat Jun 29 00:53:07 2019	(r349534)
+++ vendor/less/dist/command.c	Sat Jun 29 04:39:01 2019	(r349535)
@@ -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.
@@ -47,6 +47,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
@@ -58,6 +59,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 "!!" */
@@ -92,14 +96,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
@@ -109,15 +138,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);
 }
@@ -126,21 +153,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)
@@ -169,7 +193,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;
@@ -179,9 +203,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);
@@ -204,7 +226,7 @@ mca_opt_toggle()
  * Execute a multicharacter command.
  */
 	static void
-exec_mca()
+exec_mca(VOID_PARAM)
 {
 	char *cbuf;
 
@@ -371,6 +393,7 @@ mca_opt_nonfirst_char(c)
 {
 	char *p;
 	char *oname;
+	int err;
 
 	if (curropt != NULL)
 	{
@@ -390,7 +413,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)
 	{
 		/*
@@ -408,6 +432,9 @@ mca_opt_nonfirst_char(c)
 			if (cmd_char(c) != CC_OK)
 				return (MCA_DONE);
 		}
+	} else if (err != OPT_AMBIG)
+	{
+		bell();
 	}
 	return (MCA_MORE);
 }
@@ -459,6 +486,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 
@@ -468,7 +496,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);
 	}
 	/*
@@ -571,7 +599,7 @@ mca_char(c)
 			 * as a normal command character.
 			 */
 			number = cmd_int(&fraction);
-			mca = 0;
+			clear_mca();
 			cmd_accept();
 			return (NO_MCA);
 		}
@@ -638,7 +666,7 @@ mca_char(c)
  * Discard any buffered file data.
  */
 	static void
-clear_buffers()
+clear_buffers(VOID_PARAM)
 {
 	if (!(ch_getflags() & CH_CANSEEK))
 		return;
@@ -653,7 +681,7 @@ clear_buffers()
  * Make sure the screen is displayed.

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***


More information about the svn-src-all mailing list