From owner-dev-commits-src-branches@freebsd.org Sun May 9 02:31:59 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F24D5646E8D; Sun, 9 May 2021 02:31:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fd7Vl6S9jz4W19; Sun, 9 May 2021 02:31:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D04A719AF; Sun, 9 May 2021 02:31:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1492VxpK028180; Sun, 9 May 2021 02:31:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1492VxqD028179; Sun, 9 May 2021 02:31:59 GMT (envelope-from git) Date: Sun, 9 May 2021 02:31:59 GMT Message-Id: <202105090231.1492VxqD028179@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Xin LI Subject: git: 3c540c328d56 - stable/12 - less: upgrade to v581.2. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: delphij X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 3c540c328d566fc6e60e489d0ed3aa4e50cd4e33 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 May 2021 02:32:00 -0000 The branch stable/12 has been updated by delphij: URL: https://cgit.FreeBSD.org/src/commit/?id=3c540c328d566fc6e60e489d0ed3aa4e50cd4e33 commit 3c540c328d566fc6e60e489d0ed3aa4e50cd4e33 Author: Xin LI AuthorDate: 2021-04-19 02:46:19 +0000 Commit: Xin LI CommitDate: 2021-05-09 02:31:53 +0000 less: upgrade to v581.2. (cherry picked from commit 50d31dbc6e2bc3aa6007edb8cdecbcb84e85d6c0) less: upgrade to v581. (cherry picked from commit 2235c7feac959bcc9ddfd6a2bc6be32102b1f84c) --- contrib/less/INSTALL | 10 +- contrib/less/NEWS | 50 ++- contrib/less/README | 38 +- contrib/less/brac.c | 2 +- contrib/less/ch.c | 54 ++- contrib/less/charset.c | 154 ++++---- contrib/less/charset.h | 2 +- contrib/less/cmd.h | 20 +- contrib/less/cmdbuf.c | 87 ++--- contrib/less/command.c | 189 +++++++--- contrib/less/cvt.c | 12 +- contrib/less/decode.c | 367 ++++++++++--------- contrib/less/edit.c | 33 +- contrib/less/filename.c | 29 +- contrib/less/forwback.c | 11 +- contrib/less/funcs.h | 35 +- contrib/less/help.c | 24 +- contrib/less/ifile.c | 39 +- contrib/less/input.c | 45 ++- contrib/less/jump.c | 2 +- contrib/less/less.h | 419 +++++++++++---------- contrib/less/less.hlp | 22 +- contrib/less/less.nro | 204 +++++++++-- contrib/less/lessecho.c | 14 +- contrib/less/lessecho.nro | 8 +- contrib/less/lesskey.c | 163 ++++----- contrib/less/lesskey.h | 38 +- contrib/less/lesskey.nro | 25 +- contrib/less/lglob.h | 110 +++--- contrib/less/line.c | 905 ++++++++++++++++++++++++++-------------------- contrib/less/linenum.c | 31 +- contrib/less/lsystem.c | 44 +-- contrib/less/main.c | 85 +++-- contrib/less/mark.c | 26 +- contrib/less/optfunc.c | 309 ++++++++++++---- contrib/less/option.c | 25 +- contrib/less/option.h | 62 ++-- contrib/less/opttbl.c | 154 +++++--- contrib/less/os.c | 94 ++++- contrib/less/output.c | 612 ++++++++++++++++--------------- contrib/less/pattern.c | 11 +- contrib/less/pattern.h | 18 +- contrib/less/pckeys.h | 38 +- contrib/less/position.c | 12 +- contrib/less/position.h | 12 +- contrib/less/prompt.c | 88 ++--- contrib/less/regexp.h | 14 +- contrib/less/screen.c | 796 ++++++++++++++++++++++++++++------------ contrib/less/scrsize.c | 2 +- contrib/less/search.c | 359 +++++++++++++----- contrib/less/signal.c | 14 +- contrib/less/tags.c | 77 ++-- contrib/less/ttyin.c | 51 ++- contrib/less/version.c | 30 +- usr.bin/less/defines.h | 13 +- 55 files changed, 3782 insertions(+), 2306 deletions(-) diff --git a/contrib/less/INSTALL b/contrib/less/INSTALL index c2ab230e4470..78ae93246d88 100644 --- a/contrib/less/INSTALL +++ b/contrib/less/INSTALL @@ -1,6 +1,6 @@ - This file describes how to build and install less using -the "configure" script. This only works on Unix systems. -To install on other systems, read the README file. +This file contains generic instructions on how to build and +install software using autoconf. For specific instructions +on how to build "less", see the README or README.VER file. Basic Installation @@ -24,8 +24,8 @@ diffs or instructions to the address given in the `README' so they can be considered for the next release. If at some point `config.cache' contains results you don't want to keep, you may remove or edit it. - The file `configure.in' is used to create `configure' by a program -called `autoconf'. You only need `configure.in' if you want to change + The file `configure.ac' is used to create `configure' by a program +called `autoconf'. You only need `configure.ac' if you want to change it or regenerate `configure' using a newer version of `autoconf'. The simplest way to compile this package is: diff --git a/contrib/less/NEWS b/contrib/less/NEWS index b0644fd2e0de..bc5afd655ddc 100644 --- a/contrib/less/NEWS +++ b/contrib/less/NEWS @@ -4,10 +4,56 @@ ====================================================================== For the latest news about less, see the "less" Web page: - http://www.greenwoodsoftware.com/less + https://greenwoodsoftware.com/less You can also download the latest version of less from there. - To report bugs, suggestions or comments, send email to bug-less@gnu.org + Report bugs, suggestions or comments at + https://github.com/gwsw/less/issues. + +====================================================================== + + Major changes between "less" versions 563 and 581.2 + +* Change ESC-u command to toggle, not disable, highlighting per man page. + +* Add ESC-U command. + +* Add ctrl-W search modifier for wrapping search. + +* F command can be interrupted by ^X. + +* Support OSC 8 hyperlinks when -R is in effect. + +* g command with no number will ignore -j and put first line at top of screen. + +* Multiple + or -p command line options are handled better. + +* Add the --incsearch option. + +* Add the --line-num-width option. + +* Add the --status-col-width option. + +* Add the --use-color and --color options. + +* Display -w highlight even if highlighted line is empty. + +* If search result is in a long line, scroll to ensure it is visible. + +* Editing the same file under different names now creates only + one entry in the file list. + +* Make visual bell more visible on some terminals. + +* Ring end-of-file bell no more than once per second. + +* Build can use either Python or Perl for Makefile.aut operations. + +* Fix crash when using the @ search modifier. + +* Fix crash in the 's' command due to duplicate free. + +* Fix realpath crash on Darwin. ====================================================================== diff --git a/contrib/less/README b/contrib/less/README index 81cb7e091296..2acbd00d762a 100644 --- a/contrib/less/README +++ b/contrib/less/README @@ -7,9 +7,9 @@ ************************************************************************** ************************************************************************** - Less, version 563 + Less, version 581.2 - This is the distribution of less, version 563, released 13 Jun 2020. + This is the distribution of less, version 581.2, released 28 Apr 2021. This program is part of the GNU project (http://www.gnu.org). This program is free software. You may redistribute it and/or @@ -21,33 +21,29 @@ or 2. The Less License, in the file LICENSE. - Please report any problems to bug-less@gnu.org. - See http://www.greenwoodsoftware.com/less for the latest info. + Please report any problems at https://github.com/gwsw/less/issues. + See https://greenwoodsoftware.com/less for the latest info. Source repository is at https://github.com/gwsw/less.git. ========================================================================= -This is the distribution of "less", a paginator similar to "more" or "pg". - The formatted manual page is in less.man. The manual page nroff source is in less.nro. Major changes made since the last posted version are in NEWS. ======================================================================= -PRE-INSTALLATION (when using git) - -If you are building from a clone of a git repository, -type "make -f Makefile.aut". -If you are building from a numbered release package (a tar or zip file -with a name like less-999.tar.gz or less-999.zip), you should skip this step. - -======================================================================= -INSTALLATION (Unix systems only): +INSTALLATION (Unix & Linux systems only): 1. Move the distributed source to its own directory and unpack it, if you have not already done so. -2. Type "sh configure". +2. If you are building from a clone of a git repository, + type "make -f Makefile.aut". + If you are building from a numbered release package (a tar or + zip file with a name like less-999.tar.gz or less-999.zip downloaded + from greenwoodsoftware.com, not from github), you should skip this step. + +3. Type "sh configure". This will generate a Makefile and a defines.h. Warning: if you have a GNU sed, make sure it is version 2.05 or later. @@ -79,7 +75,7 @@ INSTALLATION (Unix systems only): commands, etc. -3. It is a good idea to look over the generated Makefile and defines.h +4. It is a good idea to look over the generated Makefile and defines.h and make sure they look ok. If you know of any peculiarities of your system that configure might not have detected, you may fix the Makefile now. Take particular notice of the list of "terminal" @@ -93,13 +89,13 @@ INSTALLATION (Unix systems only): to remove the descriptions of the features which you are removing. If you edit less.hlp, you should run "make -f Makefile.aut help.c". -4. Type "make" and watch the fun. +5. Type "make" and watch the fun. -5. If the make succeeds, it will generate the programs "less", +6. If the make succeeds, it will generate the programs "less", "lesskey" and "lessecho" in your current directory. Test the generated programs. -6. When satisfied that it works, if you wish to install it +7. When satisfied that it works, if you wish to install it in a public place, type "make install". The default install destinations are: @@ -108,8 +104,6 @@ INSTALLATION (Unix systems only): If you want to install any of these files elsewhere, define bindir and/or mandir to the appropriate directories. -If you have any problems building or running "less", suggestions, -complaints, etc., you may mail to bug-less@gnu.org. Note to hackers: comments noting possible improvements are enclosed in double curly brackets {{ like this }}. diff --git a/contrib/less/brac.c b/contrib/less/brac.c index db3a2951db08..53ada50aab56 100644 --- a/contrib/less/brac.c +++ b/contrib/less/brac.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2020 Mark Nudelman + * Copyright (C) 1984-2021 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. diff --git a/contrib/less/ch.c b/contrib/less/ch.c index 70fad1002dbf..bab0692f7437 100644 --- a/contrib/less/ch.c +++ b/contrib/less/ch.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2020 Mark Nudelman + * Copyright (C) 1984-2021 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. @@ -41,7 +41,7 @@ struct bufnode { struct bufnode *hnext, *hprev; }; -#define LBUFSIZE 8192 +#define LBUFSIZE 8192 struct buf { struct bufnode node; BLOCKNUM block; @@ -54,7 +54,7 @@ struct buf { * The file state is maintained in a filestate structure. * A pointer to the filestate is kept in the ifile structure. */ -#define BUFHASH_SIZE 1024 +#define BUFHASH_SIZE 1024 struct filestate { struct bufnode buflist; struct bufnode hashtbl[BUFHASH_SIZE]; @@ -67,24 +67,24 @@ struct filestate { POSITION fsize; }; -#define ch_bufhead thisfile->buflist.next -#define ch_buftail thisfile->buflist.prev -#define ch_nbufs thisfile->nbufs -#define ch_block thisfile->block -#define ch_offset thisfile->offset -#define ch_fpos thisfile->fpos -#define ch_fsize thisfile->fsize -#define ch_flags thisfile->flags -#define ch_file thisfile->file +#define ch_bufhead thisfile->buflist.next +#define ch_buftail thisfile->buflist.prev +#define ch_nbufs thisfile->nbufs +#define ch_block thisfile->block +#define ch_offset thisfile->offset +#define ch_fpos thisfile->fpos +#define ch_fsize thisfile->fsize +#define ch_flags thisfile->flags +#define ch_file thisfile->file -#define END_OF_CHAIN (&thisfile->buflist) -#define END_OF_HCHAIN(h) (&thisfile->hashtbl[h]) -#define BUFHASH(blk) ((blk) & (BUFHASH_SIZE-1)) +#define END_OF_CHAIN (&thisfile->buflist) +#define END_OF_HCHAIN(h) (&thisfile->hashtbl[h]) +#define BUFHASH(blk) ((blk) & (BUFHASH_SIZE-1)) /* * Macros to manipulate the list of buffers in thisfile->buflist. */ -#define FOR_BUFS(bn) \ +#define FOR_BUFS(bn) \ for (bn = ch_bufhead; bn != END_OF_CHAIN; bn = bn->next) #define BUF_RM(bn) \ @@ -106,15 +106,15 @@ struct filestate { /* * Macros to manipulate the list of buffers in thisfile->hashtbl[n]. */ -#define FOR_BUFS_IN_CHAIN(h,bn) \ +#define FOR_BUFS_IN_CHAIN(h,bn) \ for (bn = thisfile->hashtbl[h].hnext; \ bn != END_OF_HCHAIN(h); bn = bn->hnext) -#define BUF_HASH_RM(bn) \ +#define BUF_HASH_RM(bn) \ (bn)->hnext->hprev = (bn)->hprev; \ (bn)->hprev->hnext = (bn)->hnext; -#define BUF_HASH_INS(bn,h) \ +#define BUF_HASH_INS(bn,h) \ (bn)->hnext = thisfile->hashtbl[h].hnext; \ (bn)->hprev = END_OF_HCHAIN(h); \ thisfile->hashtbl[h].hnext->hprev = (bn); \ @@ -240,12 +240,12 @@ ch_get(VOID_PARAM) return ('?'); if (lseek(ch_file, (off_t)pos, SEEK_SET) == BAD_LSEEK) { - error("seek error", NULL_PARG); + error("seek error", NULL_PARG); clear_eol(); return (EOI); - } - ch_fpos = pos; - } + } + ch_fpos = pos; + } /* * Read the block. @@ -311,13 +311,7 @@ ch_get(VOID_PARAM) parg.p_string = wait_message(); ierror("%s", &parg); } -#if !MSDOS_COMPILER - sleep(1); -#else -#if MSDOS_COMPILER==WIN32C - Sleep(1000); -#endif -#endif + sleep_ms(2); /* Reduce system load */ slept = TRUE; #if HAVE_STAT_INO diff --git a/contrib/less/charset.c b/contrib/less/charset.c index 4897cbaf6adc..b37c8a29cbd9 100644 --- a/contrib/less/charset.c +++ b/contrib/less/charset.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2020 Mark Nudelman + * Copyright (C) 1984-2021 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -40,27 +40,27 @@ struct charset { int *p_flag; char *desc; } charsets[] = { - { "ascii", NULL, "8bcccbcc18b95.b" }, - { "utf-8", &utf_mode, "8bcccbcc18b95.b126.bb" }, - { "iso8859", NULL, "8bcccbcc18b95.33b." }, - { "latin3", NULL, "8bcccbcc18b95.33b5.b8.b15.b4.b12.b18.b12.b." }, - { "arabic", NULL, "8bcccbcc18b95.33b.3b.7b2.13b.3b.b26.5b19.b" }, - { "greek", NULL, "8bcccbcc18b95.33b4.2b4.b3.b35.b44.b" }, - { "greek2005", NULL, "8bcccbcc18b95.33b14.b35.b44.b" }, - { "hebrew", NULL, "8bcccbcc18b95.33b.b29.32b28.2b2.b" }, - { "koi8-r", NULL, "8bcccbcc18b95.b." }, - { "KOI8-T", NULL, "8bcccbcc18b95.b8.b6.b8.b.b.5b7.3b4.b4.b3.b.b.3b." }, - { "georgianps", NULL, "8bcccbcc18b95.3b11.4b12.2b." }, - { "tcvn", NULL, "b..b...bcccbccbbb7.8b95.b48.5b." }, - { "TIS-620", NULL, "8bcccbcc18b95.b.4b.11b7.8b." }, - { "next", NULL, "8bcccbcc18b95.bb125.bb" }, - { "dos", NULL, "8bcccbcc12bc5b95.b." }, - { "windows-1251", NULL, "8bcccbcc12bc5b95.b24.b." }, - { "windows-1252", NULL, "8bcccbcc12bc5b95.b.b11.b.2b12.b." }, - { "windows-1255", NULL, "8bcccbcc12bc5b95.b.b8.b.5b9.b.4b." }, - { "ebcdic", NULL, "5bc6bcc7bcc41b.9b7.9b5.b..8b6.10b6.b9.7b9.8b8.17b3.3b9.7b9.8b8.6b10.b.b.b." }, - { "IBM-1047", NULL, "4cbcbc3b9cbccbccbb4c6bcc5b3cbbc4bc4bccbc191.b" }, - { NULL, NULL, NULL } + { "ascii", NULL, "8bcccbcc18b95.b" }, + { "utf-8", &utf_mode, "8bcccbcc18b95.b126.bb" }, + { "iso8859", NULL, "8bcccbcc18b95.33b." }, + { "latin3", NULL, "8bcccbcc18b95.33b5.b8.b15.b4.b12.b18.b12.b." }, + { "arabic", NULL, "8bcccbcc18b95.33b.3b.7b2.13b.3b.b26.5b19.b" }, + { "greek", NULL, "8bcccbcc18b95.33b4.2b4.b3.b35.b44.b" }, + { "greek2005", NULL, "8bcccbcc18b95.33b14.b35.b44.b" }, + { "hebrew", NULL, "8bcccbcc18b95.33b.b29.32b28.2b2.b" }, + { "koi8-r", NULL, "8bcccbcc18b95.b." }, + { "KOI8-T", NULL, "8bcccbcc18b95.b8.b6.b8.b.b.5b7.3b4.b4.b3.b.b.3b." }, + { "georgianps", NULL, "8bcccbcc18b95.3b11.4b12.2b." }, + { "tcvn", NULL, "b..b...bcccbccbbb7.8b95.b48.5b." }, + { "TIS-620", NULL, "8bcccbcc18b95.b.4b.11b7.8b." }, + { "next", NULL, "8bcccbcc18b95.bb125.bb" }, + { "dos", NULL, "8bcccbcc12bc5b95.b." }, + { "windows-1251", NULL, "8bcccbcc12bc5b95.b24.b." }, + { "windows-1252", NULL, "8bcccbcc12bc5b95.b.b11.b.2b12.b." }, + { "windows-1255", NULL, "8bcccbcc12bc5b95.b.b8.b.5b9.b.4b." }, + { "ebcdic", NULL, "5bc6bcc7bcc41b.9b7.9b5.b..8b6.10b6.b9.7b9.8b8.17b3.3b9.7b9.8b8.6b10.b.b.b." }, + { "IBM-1047", NULL, "4cbcbc3b9cbccbccbb4c6bcc5b3cbbc4bc4bccbc191.b" }, + { NULL, NULL, NULL } }; /* @@ -70,58 +70,58 @@ struct cs_alias { char *name; char *oname; } cs_aliases[] = { - { "UTF-8", "utf-8" }, - { "utf8", "utf-8" }, - { "UTF8", "utf-8" }, - { "ANSI_X3.4-1968", "ascii" }, - { "US-ASCII", "ascii" }, - { "latin1", "iso8859" }, - { "ISO-8859-1", "iso8859" }, - { "latin9", "iso8859" }, - { "ISO-8859-15", "iso8859" }, - { "latin2", "iso8859" }, - { "ISO-8859-2", "iso8859" }, - { "ISO-8859-3", "latin3" }, - { "latin4", "iso8859" }, - { "ISO-8859-4", "iso8859" }, - { "cyrillic", "iso8859" }, - { "ISO-8859-5", "iso8859" }, - { "ISO-8859-6", "arabic" }, - { "ISO-8859-7", "greek" }, - { "IBM9005", "greek2005" }, - { "ISO-8859-8", "hebrew" }, - { "latin5", "iso8859" }, - { "ISO-8859-9", "iso8859" }, - { "latin6", "iso8859" }, - { "ISO-8859-10", "iso8859" }, - { "latin7", "iso8859" }, - { "ISO-8859-13", "iso8859" }, - { "latin8", "iso8859" }, - { "ISO-8859-14", "iso8859" }, - { "latin10", "iso8859" }, - { "ISO-8859-16", "iso8859" }, - { "IBM437", "dos" }, - { "EBCDIC-US", "ebcdic" }, - { "IBM1047", "IBM-1047" }, - { "KOI8-R", "koi8-r" }, - { "KOI8-U", "koi8-r" }, - { "GEORGIAN-PS", "georgianps" }, - { "TCVN5712-1", "tcvn" }, - { "NEXTSTEP", "next" }, - { "windows", "windows-1252" }, /* backward compatibility */ - { "CP1251", "windows-1251" }, - { "CP1252", "windows-1252" }, - { "CP1255", "windows-1255" }, + { "UTF-8", "utf-8" }, + { "utf8", "utf-8" }, + { "UTF8", "utf-8" }, + { "ANSI_X3.4-1968", "ascii" }, + { "US-ASCII", "ascii" }, + { "latin1", "iso8859" }, + { "ISO-8859-1", "iso8859" }, + { "latin9", "iso8859" }, + { "ISO-8859-15", "iso8859" }, + { "latin2", "iso8859" }, + { "ISO-8859-2", "iso8859" }, + { "ISO-8859-3", "latin3" }, + { "latin4", "iso8859" }, + { "ISO-8859-4", "iso8859" }, + { "cyrillic", "iso8859" }, + { "ISO-8859-5", "iso8859" }, + { "ISO-8859-6", "arabic" }, + { "ISO-8859-7", "greek" }, + { "IBM9005", "greek2005" }, + { "ISO-8859-8", "hebrew" }, + { "latin5", "iso8859" }, + { "ISO-8859-9", "iso8859" }, + { "latin6", "iso8859" }, + { "ISO-8859-10", "iso8859" }, + { "latin7", "iso8859" }, + { "ISO-8859-13", "iso8859" }, + { "latin8", "iso8859" }, + { "ISO-8859-14", "iso8859" }, + { "latin10", "iso8859" }, + { "ISO-8859-16", "iso8859" }, + { "IBM437", "dos" }, + { "EBCDIC-US", "ebcdic" }, + { "IBM1047", "IBM-1047" }, + { "KOI8-R", "koi8-r" }, + { "KOI8-U", "koi8-r" }, + { "GEORGIAN-PS", "georgianps" }, + { "TCVN5712-1", "tcvn" }, + { "NEXTSTEP", "next" }, + { "windows", "windows-1252" }, /* backward compatibility */ + { "CP1251", "windows-1251" }, + { "CP1252", "windows-1252" }, + { "CP1255", "windows-1255" }, { NULL, NULL } }; -#define IS_BINARY_CHAR 01 -#define IS_CONTROL_CHAR 02 +#define IS_BINARY_CHAR 01 +#define IS_CONTROL_CHAR 02 static char chardef[256]; static char *binfmt = NULL; static char *utfbinfmt = NULL; -public int binattr = AT_STANDOUT; +public int binattr = AT_STANDOUT|AT_COLOR_BIN; /* @@ -134,9 +134,9 @@ public int binattr = AT_STANDOUT; * repetition of the letter. * * Each letter is one of: - * . normal character - * b binary character - * c control character + * . normal character + * b binary character + * c control character */ static void ichardef(s) @@ -457,16 +457,16 @@ prchar(c) SNPRINTF1(buf, sizeof(buf), "^%c", /* * This array roughly inverts CONTROL() #defined in less.h, - * and should be kept in sync with CONTROL() and IBM-1047. - */ + * and should be kept in sync with CONTROL() and IBM-1047. + */ "@ABC.I.?...KLMNO" "PQRS.JH.XY.." "\\]^_" "......W[.....EFG" "..V....D....TU.Z"[c]); #else - else if (c < 128 && !control_char(c ^ 0100)) - SNPRINTF1(buf, sizeof(buf), "^%c", (int) (c ^ 0100)); + else if (c < 128 && !control_char(c ^ 0100)) + SNPRINTF1(buf, sizeof(buf), "^%c", (int) (c ^ 0100)); #endif else SNPRINTF1(buf, sizeof(buf), binfmt, c); @@ -484,7 +484,7 @@ prutfchar(ch) if (ch == ESC) strcpy(buf, "ESC"); - else if (ch < 128 && control_char(ch)) + else if (ch < 128 && control_char(ch)) { if (!control_char(ch ^ 0100)) SNPRINTF1(buf, sizeof(buf), "^%c", ((char) ch) ^ 0100); @@ -732,9 +732,9 @@ step_char(pp, dir, limit) */ #define DECLARE_RANGE_TABLE_START(name) \ - static struct wchar_range name##_array[] = { + static struct wchar_range name##_array[] = { #define DECLARE_RANGE_TABLE_END(name) \ - }; struct wchar_range_table name##_table = { name##_array, sizeof(name##_array)/sizeof(*name##_array) }; + }; struct wchar_range_table name##_table = { name##_array, sizeof(name##_array)/sizeof(*name##_array) }; DECLARE_RANGE_TABLE_START(compose) #include "compose.uni" diff --git a/contrib/less/charset.h b/contrib/less/charset.h index cc0c3af59e89..3e7ecf73db94 100644 --- a/contrib/less/charset.h +++ b/contrib/less/charset.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2020 Mark Nudelman + * Copyright (C) 1984-2021 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. diff --git a/contrib/less/cmd.h b/contrib/less/cmd.h index 95a2e5801717..c51f0bc5c4f3 100644 --- a/contrib/less/cmd.h +++ b/contrib/less/cmd.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2020 Mark Nudelman + * Copyright (C) 1984-2021 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -31,7 +31,6 @@ #define A_HELP 19 #define A_NEXT_FILE 20 #define A_PERCENT 21 -#define A_PREFIX 22 #define A_PREV_FILE 23 #define A_QUIT 24 #define A_REPAINT 25 @@ -72,19 +71,19 @@ #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_CLR_SEARCH 70 +/* These values must not conflict with any A_* or EC_* value. */ #define A_INVALID 100 #define A_NOACTION 101 #define A_UINVALID 102 #define A_END_LIST 103 #define A_SPECIAL_KEY 104 - +#define A_PREFIX 105 #define A_SKIP 127 #define A_EXTRA 0200 @@ -111,15 +110,16 @@ #define EC_B_COMPLETE 18 #define EC_LITERAL 19 #define EC_ABORT 20 +#define EC_X11MOUSE 21 +#define EC_X116MOUSE 22 -#define EC_NOACTION 101 #define EC_UINVALID 102 /* Flags for editchar() */ -#define EC_PEEK 01 -#define EC_NOHISTORY 02 -#define EC_NOCOMPLETE 04 -#define EC_NORIGHTLEFT 010 +#define ECF_PEEK 01 +#define ECF_NOHISTORY 02 +#define ECF_NOCOMPLETE 04 +#define ECF_NORIGHTLEFT 010 /* Environment variable stuff */ #define EV_OK 01 diff --git a/contrib/less/cmdbuf.c b/contrib/less/cmdbuf.c index ed78ded00307..9cc1f3e94977 100644 --- a/contrib/less/cmdbuf.c +++ b/contrib/less/cmdbuf.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2020 Mark Nudelman + * Copyright (C) 1984-2021 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -26,12 +26,12 @@ 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 */ -static int prompt_col; /* Column of cursor just after prompt */ -static char *cp; /* Pointer into cmdbuf */ -static int cmd_offset; /* Index into cmdbuf of first displayed char */ -static int literal; /* Next input char should not be interpreted */ -static int updown_match = -1; /* Prefix length in up/down movement */ +static int cmd_col; /* Current column of the cursor */ +static int prompt_col; /* Column of cursor just after prompt */ +static char *cp; /* Pointer into cmdbuf */ +static int cmd_offset; /* Index into cmdbuf of first displayed char */ +static int literal; /* Next input char should not be interpreted */ +static int updown_match = -1; /* Prefix length in up/down movement */ #if TAB_COMPLETE_FILENAME static int cmd_complete LESSPARAMS((int action)); @@ -223,7 +223,7 @@ cmd_step_common(p, ch, len, pwidth, bswidth) } } if (pwidth != NULL) - *pwidth = width; + *pwidth = width; if (bswidth != NULL) *bswidth = width; return (pr); @@ -259,17 +259,42 @@ cmd_step_left(pp, pwidth, bswidth) return cmd_step_common(*pp, ch, p - *pp, pwidth, bswidth); } +/* + * Put the cursor at "home" (just after the prompt), + * and set cp to the corresponding char in cmdbuf. + */ + static void +cmd_home(VOID_PARAM) +{ + while (cmd_col > prompt_col) + { + int width, bswidth; + + cmd_step_left(&cp, &width, &bswidth); + while (bswidth-- > 0) + putbs(); + cmd_col -= width; + } + + cp = &cmdbuf[cmd_offset]; +} + /* * Repaint the line from cp onwards. * Then position the cursor just after the char old_cp (a pointer into cmdbuf). */ - static void + public void cmd_repaint(old_cp) constant char *old_cp; { /* * Repaint the line from the current position. */ + if (old_cp == NULL) + { + old_cp = cp; + cmd_home(); + } clear_eol(); while (*cp != '\0') { @@ -300,26 +325,6 @@ cmd_repaint(old_cp) cmd_left(); } -/* - * Put the cursor at "home" (just after the prompt), - * and set cp to the corresponding char in cmdbuf. - */ - static void -cmd_home(VOID_PARAM) -{ - while (cmd_col > prompt_col) - { - int width, bswidth; - - cmd_step_left(&cp, &width, &bswidth); - while (bswidth-- > 0) - putbs(); - cmd_col -= width; - } - - cp = &cmdbuf[cmd_offset]; -} - /* * Shift the cmdbuf display left a half-screen. */ @@ -826,9 +831,9 @@ cmd_accept(VOID_PARAM) * Try to perform a line-edit function on the command buffer, * using a specified char as a line-editing command. * Returns: - * CC_PASS The char does not invoke a line edit function. - * CC_OK Line edit function done. - * CC_QUIT The char requests the current command to be aborted. + * CC_PASS The char does not invoke a line edit function. + * CC_OK Line edit function done. + * CC_QUIT The char requests the current command to be aborted. */ static int cmd_edit(c) @@ -838,9 +843,9 @@ cmd_edit(c) int flags; #if TAB_COMPLETE_FILENAME -#define not_in_completion() in_completion = 0 +#define not_in_completion() in_completion = 0 #else -#define not_in_completion(VOID_PARAM) +#define not_in_completion(VOID_PARAM) #endif /* @@ -852,20 +857,22 @@ cmd_edit(c) /* * No current history; don't accept history manipulation cmds. */ - flags |= EC_NOHISTORY; + flags |= ECF_NOHISTORY; #endif #if TAB_COMPLETE_FILENAME if (curr_mlist == ml_search) /* * In a search command; don't accept file-completion cmds. */ - flags |= EC_NOCOMPLETE; + flags |= ECF_NOCOMPLETE; #endif action = editchar(c, flags); switch (action) { + case A_NOACTION: + return (CC_OK); case EC_RIGHT: not_in_completion(); return (cmd_right()); @@ -934,8 +941,6 @@ cmd_edit(c) case EC_EXPAND: return (cmd_complete(action)); #endif - case EC_NOACTION: - return (CC_OK); default: not_in_completion(); return (CC_PASS); @@ -1237,9 +1242,9 @@ fail: * Process a single character of a multi-character command, such as * a number, or the pattern of a search command. * Returns: - * CC_OK The char was accepted. - * CC_QUIT The char requests the command to be aborted. - * CC_ERROR The char could not be accepted due to an error. + * CC_OK The char was accepted. + * CC_QUIT The char requests the command to be aborted. + * CC_ERROR The char could not be accepted due to an error. */ public int cmd_char(c) diff --git a/contrib/less/command.c b/contrib/less/command.c index 8e0ae4b34d67..ae59181c2827 100644 --- a/contrib/less/command.c +++ b/contrib/less/command.c @@ -1,6 +1,6 @@ /* $FreeBSD$ */ /* - * Copyright (C) 1984-2020 Mark Nudelman + * Copyright (C) 1984-2021 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. @@ -57,21 +57,22 @@ extern void *ml_shell; extern char *editor; extern char *editproto; #endif -extern int screen_trashed; /* The screen has been overwritten */ +extern int screen_trashed; /* The screen has been overwritten */ extern int shift_count; extern int oldbot; extern int forw_prompt; +extern int incr_search; #if MSDOS_COMPILER==WIN32C extern int utf_mode; #endif #if SHELL_ESCAPE -static char *shellcmd = NULL; /* For holding last shell command for "!!" */ +static char *shellcmd = NULL; /* For holding last shell command for "!!" */ #endif -static int mca; /* The multicharacter command (action) */ -static int search_type; /* The previous type of search */ -static LINENUM number; /* The number typed by the user */ -static long fraction; /* The fractional part of the number */ +static int mca; /* The multicharacter command (action) */ +static int search_type; /* The previous type of search */ +static LINENUM number; /* The number typed by the user */ +static long fraction; /* The fractional part of the number */ static struct loption *curropt; static int opt_lower; static int optflag; @@ -113,7 +114,6 @@ set_mca(action) int action; { mca = action; - deinit_mouse(); /* we don't want mouse events while entering a cmd */ clear_bot(); clear_cmd(); } @@ -127,7 +127,6 @@ clear_mca(VOID_PARAM) if (mca == 0) return; mca = 0; - init_mouse(); } /* @@ -177,6 +176,8 @@ mca_search(VOID_PARAM) cmd_putstr("Keep-pos "); if (search_type & SRCH_NO_REGEX) cmd_putstr("Regex-off "); + if (search_type & SRCH_WRAP) + cmd_putstr("Wrap "); #if HILITE_SEARCH if (search_type & SRCH_FILTER) @@ -520,9 +521,9 @@ mca_search_char(c) /* * Certain characters as the first char of * the pattern have special meaning: - * ! Toggle the NO_MATCH flag - * * Toggle the PAST_EOF flag - * @ Toggle the FIRST_FILE flag + * ! Toggle the NO_MATCH flag + * * Toggle the PAST_EOF flag + * @ Toggle the FIRST_FILE flag */ if (len_cmdbuf() > 0) return (NO_MCA); @@ -547,6 +548,10 @@ mca_search_char(c) if (mca != A_FILTER) flag = SRCH_NO_MOVE; break; + case CONTROL('W'): /* WRAP around */ + if (mca != A_FILTER) + flag = SRCH_WRAP; + break; case CONTROL('R'): /* Don't use REGULAR EXPRESSIONS */ flag = SRCH_NO_REGEX; break; @@ -558,7 +563,8 @@ mca_search_char(c) if (flag != 0) { - search_type ^= flag; + /* Toggle flag, but keep PAST_EOF and WRAP mutually exclusive. */ + search_type ^= flag | (search_type & (SRCH_PAST_EOF|SRCH_WRAP)); mca_search(); return (MCA_MORE); } @@ -596,9 +602,16 @@ mca_char(c) * Entering digits of a number. * Terminated by a non-digit. */ - if (!((c >= '0' && c <= '9') || c == '.') && - editchar(c, EC_PEEK|EC_NOHISTORY|EC_NOCOMPLETE|EC_NORIGHTLEFT) == A_INVALID) + if ((c >= '0' && c <= '9') || c == '.') + break; + switch (editchar(c, ECF_PEEK|ECF_NOHISTORY|ECF_NOCOMPLETE|ECF_NORIGHTLEFT)) { + case A_NOACTION: + /* + * Ignore this char and get another one. + */ + return (MCA_MORE); + case A_INVALID: /* * Not part of the number. * End the number and treat this char @@ -651,15 +664,44 @@ mca_char(c) */ return (MCA_DONE); - if ((mca == A_F_BRACKET || mca == A_B_BRACKET) && len_cmdbuf() >= 2) *** 9553 LINES SKIPPED ***