Browse Source

Merge branch 'freebsd/current/master' into hardened/current/master

* freebsd/current/master:
  MFV r349535: less v551.
  Build lib32 libl.  The library is built from usr.bin/lex/lib.  It would be better to move this directory to lib/libl, but this requires more extensive changes to Makefile.inc1.  This simple fix can be MFCed quickly.
  Use a consistent snapshot of the fd's rights in fget_mmap().
  Fix mutual exclusion in pipe_direct_write().
  Fix VOP_PUTPAGES(9) in regards to the use of VM_PAGER_CLUSTER_OK
  Skip sys.netpfil.pf.names.names and sys.netpfil.pf.synproxy.synproxy temporarily because kernel panics when flushing epair queue.
hardened/current/master
Oliver Pinter + 1 year ago
parent
commit
91c8397a7a
65 changed files with 1485 additions and 574 deletions
  1. +1
    -0
      Makefile.libcompat
  2. +1
    -1
      contrib/less/LICENSE
  3. +32
    -0
      contrib/less/NEWS
  4. +4
    -2
      contrib/less/README
  5. +1
    -1
      contrib/less/brac.c
  6. +18
    -18
      contrib/less/ch.c
  7. +5
    -5
      contrib/less/charset.c
  8. +1
    -1
      contrib/less/charset.h
  9. +8
    -1
      contrib/less/cmd.h
  10. +100
    -46
      contrib/less/cmdbuf.c
  11. +93
    -35
      contrib/less/command.c
  12. +18
    -24
      contrib/less/compose.uni
  13. +1
    -1
      contrib/less/cvt.c
  14. +138
    -3
      contrib/less/decode.c
  15. +16
    -9
      contrib/less/edit.c
  16. +22
    -9
      contrib/less/filename.c
  17. +2
    -1
      contrib/less/fmt.uni
  18. +10
    -11
      contrib/less/forwback.c
  19. +14
    -2
      contrib/less/funcs.h
  20. +17
    -7
      contrib/less/help.c
  21. +27
    -6
      contrib/less/ifile.c
  22. +1
    -1
      contrib/less/input.c
  23. +4
    -4
      contrib/less/jump.c
  24. +16
    -10
      contrib/less/less.h
  25. +16
    -6
      contrib/less/less.hlp
  26. +51
    -16
      contrib/less/less.nro
  27. +3
    -3
      contrib/less/lessecho.c
  28. +1
    -1
      contrib/less/lessecho.nro
  29. +3
    -3
      contrib/less/lesskey.c
  30. +1
    -1
      contrib/less/lesskey.h
  31. +2
    -2
      contrib/less/lesskey.nro
  32. +2
    -2
      contrib/less/lglob.h
  33. +17
    -25
      contrib/less/line.c
  34. +5
    -5
      contrib/less/linenum.c
  35. +6
    -2
      contrib/less/lsystem.c
  36. +20
    -28
      contrib/less/main.c
  37. +203
    -34
      contrib/less/mark.c
  38. +1
    -1
      contrib/less/mkutable
  39. +55
    -29
      contrib/less/optfunc.c
  40. +8
    -5
      contrib/less/option.c
  41. +1
    -1
      contrib/less/option.h
  42. +44
    -4
      contrib/less/opttbl.c
  43. +3
    -3
      contrib/less/os.c
  44. +25
    -4
      contrib/less/output.c
  45. +82
    -3
      contrib/less/pattern.c
  46. +8
    -1
      contrib/less/pattern.h
  47. +1
    -1
      contrib/less/pckeys.h
  48. +19
    -7
      contrib/less/position.c
  49. +1
    -1
      contrib/less/position.h
  50. +16
    -7
      contrib/less/prompt.c
  51. +175
    -103
      contrib/less/screen.c
  52. +1
    -1
      contrib/less/scrsize.c
  53. +11
    -11
      contrib/less/search.c
  54. +11
    -6
      contrib/less/signal.c
  55. +13
    -13
      contrib/less/tags.c
  56. +53
    -15
      contrib/less/ttyin.c
  57. +1
    -1
      contrib/less/ubin.uni
  58. +29
    -2
      contrib/less/version.c
  59. +11
    -9
      contrib/less/wide.uni
  60. +2
    -2
      share/man/man9/VOP_GETPAGES.9
  61. +8
    -4
      sys/kern/kern_descrip.c
  62. +17
    -13
      sys/kern/sys_pipe.c
  63. +1
    -0
      tests/sys/netpfil/pf/names.sh
  64. +1
    -0
      tests/sys/netpfil/pf/synproxy.sh
  65. +7
    -1
      usr.bin/less/defines.h

+ 1
- 0
Makefile.libcompat View File

@@ -143,6 +143,7 @@ LIBCOMPATIMAKE+= ${LIBCOMPATWMAKE:NINSTALL=*:NDESTDIR=*} \

_LC_LIBDIRS.yes= lib
_LC_LIBDIRS.yes+= gnu/lib
_LC_LIBDIRS.yes+= usr.bin/lex/lib
_LC_LIBDIRS.${MK_CDDL:tl}+= cddl/lib
_LC_LIBDIRS.${MK_CRYPT:tl}+= secure/lib
_LC_LIBDIRS.${MK_KERBEROS:tl}+= kerberos5/lib

+ 1
- 1
contrib/less/LICENSE View File

@@ -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

+ 32
- 0
contrib/less/NEWS View File

@@ -9,6 +9,38 @@

To report bugs, suggestions or comments, send email to bug-less@gnu.org

======================================================================

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

+ 4
- 2
contrib/less/README View File

@@ -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

+ 1
- 1
contrib/less/brac.c View File

@@ -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.

+ 18
- 18
contrib/less/ch.c View File

@@ -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);

+ 5
- 5
contrib/less/charset.c View File

@@ -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;


+ 1
- 1
contrib/less/charset.h View File

@@ -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.

+ 8
- 1
contrib/less/cmd.h View File

@@ -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

+ 100
- 46
contrib/less/cmdbuf.c View File

@@ -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);
@@ -718,6 +722,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.
*/
@@ -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 *string)
* 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,12 +1615,8 @@ copy_hist(void *uparam, struct mlist *ml, char *string)
ctx->mlist = ml;
write_mlist_header(ctx->mlist, ctx->fout);
}
if (string != NULL)
{
/* Copy the entry. */
fprintf(ctx->fout, "\"%s\n", string);
}
if (ml == NULL) /* End of file */

if (string == 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,13 +1665,17 @@ 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;
#if SHELL_ESCAPE || PIPEC
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
/*

+ 93
- 35
contrib/less/command.c View File

@@ -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 overwritten */
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,13 +98,38 @@ 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.
*/
@@ -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,20 +155,17 @@ 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;

clear_bot();
clear_cmd();
set_mca(A_B_SEARCH);

if (search_type & SRCH_NO_MATCH)
cmd_putstr("Non-match ");
@@ -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.
*/
if (!(ch_getflags() & CH_HELPFILE))
SetConsoleTitle(pr_expand("Less?f - %f.", 0));
{
WCHAR w[MAX_PATH+16];
p = pr_expand("Less?f - %f.", 0);
MultiByteToWideChar(CP_ACP, 0, p, -1, w, sizeof(w)/sizeof(*w));
SetConsoleTitleW(w);
}
#endif

/*
* Select the proper prompt and display it.
*/
@@ -765,6 +799,14 @@ prompt()
putchr(':');
else
{
#if MSDOS_COMPILER==WIN32C
WCHAR w[MAX_PATH*2];
char a[MAX_PATH*2];
MultiByteToWideChar(CP_ACP, 0, p, -1, w, sizeof(w)/sizeof(*w));
WideCharToMultiByte(utf_mode ? CP_UTF8 : GetConsoleOutputCP(),
0, w, -1, a, sizeof(a), NULL, NULL);
p = a;
#endif
at_enter(AT_STANDOUT);
putstr(p);
at_exit();
@@ -776,7 +818,7 @@ prompt()
* Display the less version message.
*/
public void
dispversion()
dispversion(VOID_PARAM)
{
PARG parg;

@@ -788,7 +830,7 @@ dispversion()
* Return a character to complete a partial command, if possible.
*/
static LWCHAR
getcc_end_command()
getcc_end_command(VOID_PARAM)
{
switch (mca)
{
@@ -884,10 +926,10 @@ getcc_repl(orig, repl, gr_getc, gr_ungetc)
* Get command character.
*/
public int
getcc()
getcc(VOID_PARAM)
{
/* Replace kent (keypad Enter) with a newline. */
return getcc_repl(kent, "\n", getccu, ungetcc);
/* Replace kent (keypad Enter) with a newline. */
return getcc_repl(kent, "\n", getccu, ungetcc);
}

/*
@@ -923,7 +965,7 @@ ungetsc(s)
* Peek the next command character, without consuming it.
*/
public LWCHAR
peekcc()
peekcc(VOID_PARAM)
{
LWCHAR c = getcc();
ungetcc(c);
@@ -1074,7 +1116,7 @@ forw_loop(until_hilite)
* Accept and execute commands until a quit command.
*/
public void
commands()
commands(VOID_PARAM)
{
int c;
int action;
@@ -1094,7 +1136,7 @@ commands()

for (;;)
{
mca = 0;
clear_mca();
cmd_accept();
number = 0;
curropt = NULL;
@@ -1276,6 +1318,22 @@ commands()
backward((int) number, 0, 0);
break;

case A_F_MOUSE:
/*
* Forward wheel_lines lines.
*/
cmd_exec();
forward(wheel_lines, 0, 0);
break;

case A_B_MOUSE:
/*
* Backward wheel_lines lines.
*/
cmd_exec();
backward(wheel_lines, 0, 0);
break;

case A_FF_LINE:
/*
* Force forward N (default 1) line.
@@ -1381,7 +1439,7 @@ commands()
number = 0;
fraction = 0;
}
if (number > 100)
if (number > 100 || (number == 100 && fraction != 0))
{
number = 100;
fraction = 0;

+ 18
- 24
contrib/less/compose.uni View File

@@ -1,5 +1,4 @@
/* Generated by "./mkutable -f2 Mn Me Cf -- unicode/UnicodeData.txt" on Tue Jul 25 09:04:35 PDT 2017 */
{ 0x00ad, 0x00ad }, /* Cf */
/* Generated by "./mkutable -f2 Mn Me -- unicode/UnicodeData.txt" on Wed Feb 13 17:57:05 PST 2019 */
{ 0x0300, 0x036f }, /* Mn */
{ 0x0483, 0x0487 }, /* Mn */
{ 0x0488, 0x0489 }, /* Me */
@@ -8,28 +7,24 @@
{ 0x05c1, 0x05c2 }, /* Mn */
{ 0x05c4, 0x05c5 }, /* Mn */
{ 0x05c7, 0x05c7 }, /* Mn */
{ 0x0600, 0x0605 }, /* Cf */
{ 0x0610, 0x061a }, /* Mn */
{ 0x061c, 0x061c }, /* Cf */
{ 0x064b, 0x065f }, /* Mn */
{ 0x0670, 0x0670 }, /* Mn */
{ 0x06d6, 0x06dc }, /* Mn */
{ 0x06dd, 0x06dd }, /* Cf */
{ 0x06df, 0x06e4 }, /* Mn */
{ 0x06e7, 0x06e8 }, /* Mn */
{ 0x06ea, 0x06ed }, /* Mn */
{ 0x070f, 0x070f }, /* Cf */
{ 0x0711, 0x0711 }, /* Mn */
{ 0x0730, 0x074a }, /* Mn */
{ 0x07a6, 0x07b0 }, /* Mn */
{ 0x07eb, 0x07f3 }, /* Mn */
{ 0x07fd, 0x07fd }, /* Mn */
{ 0x0816, 0x0819 }, /* Mn */
{ 0x081b, 0x0823 }, /* Mn */
{ 0x0825, 0x0827 }, /* Mn */
{ 0x0829, 0x082d }, /* Mn */
{ 0x0859, 0x085b }, /* Mn */
{ 0x08d4, 0x08e1 }, /* Mn */
{ 0x08e2, 0x08e2 }, /* Cf */
{ 0x08d3, 0x08e1 }, /* Mn */
{ 0x08e3, 0x0902 }, /* Mn */
{ 0x093a, 0x093a }, /* Mn */
{ 0x093c, 0x093c }, /* Mn */
@@ -42,6 +37,7 @@
{ 0x09c1, 0x09c4 }, /* Mn */
{ 0x09cd, 0x09cd }, /* Mn */
{ 0x09e2, 0x09e3 }, /* Mn */
{ 0x09fe, 0x09fe }, /* Mn */
{ 0x0a01, 0x0a02 }, /* Mn */
{ 0x0a3c, 0x0a3c }, /* Mn */
{ 0x0a41, 0x0a42 }, /* Mn */
@@ -68,6 +64,7 @@
{ 0x0bc0, 0x0bc0 }, /* Mn */
{ 0x0bcd, 0x0bcd }, /* Mn */
{ 0x0c00, 0x0c00 }, /* Mn */
{ 0x0c04, 0x0c04 }, /* Mn */
{ 0x0c3e, 0x0c40 }, /* Mn */
{ 0x0c46, 0x0c48 }, /* Mn */
{ 0x0c4a, 0x0c4d }, /* Mn */
@@ -126,7 +123,6 @@
{ 0x17c9, 0x17d3 }, /* Mn */
{ 0x17dd, 0x17dd }, /* Mn */
{ 0x180b, 0x180d }, /* Mn */
{ 0x180e, 0x180e }, /* Cf */
{ 0x1885, 0x1886 }, /* Mn */
{ 0x18a9, 0x18a9 }, /* Mn */
{ 0x1920, 0x1922 }, /* Mn */
@@ -168,10 +164,6 @@
{ 0x1cf8, 0x1cf9 }, /* Mn */
{ 0x1dc0, 0x1df9 }, /* Mn */
{ 0x1dfb, 0x1dff }, /* Mn */
{ 0x200b, 0x200f }, /* Cf */
{ 0x202a, 0x202e }, /* Cf */
{ 0x2060, 0x2064 }, /* Cf */
{ 0x2066, 0x206f }, /* Cf */
{ 0x20d0, 0x20dc }, /* Mn */
{ 0x20dd, 0x20e0 }, /* Me */
{ 0x20e1, 0x20e1 }, /* Mn */
@@ -193,6 +185,7 @@
{ 0xa825, 0xa826 }, /* Mn */
{ 0xa8c4, 0xa8c5 }, /* Mn */
{ 0xa8e0, 0xa8f1 }, /* Mn */
{ 0xa8ff, 0xa8ff }, /* Mn */
{ 0xa926, 0xa92d }, /* Mn */
{ 0xa947, 0xa951 }, /* Mn */
{ 0xa980, 0xa982 }, /* Mn */
@@ -219,8 +212,6 @@
{ 0xfb1e, 0xfb1e }, /* Mn */
{ 0xfe00, 0xfe0f }, /* Mn */
{ 0xfe20, 0xfe2f }, /* Mn */
{ 0xfeff, 0xfeff }, /* Cf */
{ 0xfff9, 0xfffb }, /* Cf */
{ 0x101fd, 0x101fd }, /* Mn */
{ 0x102e0, 0x102e0 }, /* Mn */
{ 0x10376, 0x1037a }, /* Mn */
@@ -230,19 +221,20 @@
{ 0x10a38, 0x10a3a }, /* Mn */
{ 0x10a3f, 0x10a3f }, /* Mn */
{ 0x10ae5, 0x10ae6 }, /* Mn */
{ 0x10d24, 0x10d27 }, /* Mn */
{ 0x10f46, 0x10f50 }, /* Mn */
{ 0x11001, 0x11001 }, /* Mn */
{ 0x11038, 0x11046 }, /* Mn */
{ 0x1107f, 0x11081 }, /* Mn */
{ 0x110b3, 0x110b6 }, /* Mn */
{ 0x110b9, 0x110ba }, /* Mn */
{ 0x110bd, 0x110bd }, /* Cf */
{ 0x11100, 0x11102 }, /* Mn */
{ 0x11127, 0x1112b }, /* Mn */
{ 0x1112d, 0x11134 }, /* Mn */
{ 0x11173, 0x11173 }, /* Mn */
{ 0x11180, 0x11181 }, /* Mn */
{ 0x111b6, 0x111be }, /* Mn */
{ 0x111ca, 0x111cc }, /* Mn */
{ 0x111c9, 0x111cc }, /* Mn */
{ 0x1122f, 0x11231 }, /* Mn */
{ 0x11234, 0x11234 }, /* Mn */
{ 0x11236, 0x11237 }, /* Mn */
@@ -250,13 +242,14 @@
{ 0x112df, 0x112df }, /* Mn */
{ 0x112e3, 0x112ea }, /* Mn */
{ 0x11300, 0x11301 }, /* Mn */
{ 0x1133c, 0x1133c }, /* Mn */
{ 0x1133b, 0x1133c }, /* Mn */
{ 0x11340, 0x11340 }, /* Mn */
{ 0x11366, 0x1136c }, /* Mn */
{ 0x11370, 0x11374 }, /* Mn */
{ 0x11438, 0x1143f }, /* Mn */
{ 0x11442, 0x11444 }, /* Mn */
{ 0x11446, 0x11446 }, /* Mn */
{ 0x1145e, 0x1145e }, /* Mn */
{ 0x114b3, 0x114b8 }, /* Mn */
{ 0x114ba, 0x114ba }, /* Mn */
{ 0x114bf, 0x114c0 }, /* Mn */
@@ -275,8 +268,9 @@
{ 0x1171d, 0x1171f }, /* Mn */
{ 0x11722, 0x11725 }, /* Mn */
{ 0x11727, 0x1172b }, /* Mn */
{ 0x11a01, 0x11a06 }, /* Mn */
{ 0x11a09, 0x11a0a }, /* Mn */
{ 0x1182f, 0x11837 }, /* Mn */
{ 0x11839, 0x1183a }, /* Mn */
{ 0x11a01, 0x11a0a }, /* Mn */
{ 0x11a33, 0x11a38 }, /* Mn */
{ 0x11a3b, 0x11a3e }, /* Mn */
{ 0x11a47, 0x11a47 }, /* Mn */
@@ -296,13 +290,15 @@
{ 0x11d3c, 0x11d3d }, /* Mn */
{ 0x11d3f, 0x11d45 }, /* Mn */
{ 0x11d47, 0x11d47 }, /* Mn */
{ 0x11d90, 0x11d91 }, /* Mn */
{ 0x11d95, 0x11d95 }, /* Mn */
{ 0x11d97, 0x11d97 }, /* Mn */
{ 0x11ef3, 0x11ef4 }, /* Mn */
{ 0x16af0, 0x16af4 }, /* Mn */
{ 0x16b30, 0x16b36 }, /* Mn */
{ 0x16f8f, 0x16f92 }, /* Mn */
{ 0x1bc9d, 0x1bc9e }, /* Mn */
{ 0x1bca0, 0x1bca3 }, /* Cf */
{ 0x1d167, 0x1d169 }, /* Mn */
{ 0x1d173, 0x1d17a }, /* Cf */
{ 0x1d17b, 0x1d182 }, /* Mn */
{ 0x1d185, 0x1d18b }, /* Mn */
{ 0x1d1aa, 0x1d1ad }, /* Mn */
@@ -320,6 +316,4 @@
{ 0x1e026, 0x1e02a }, /* Mn */
{ 0x1e8d0, 0x1e8d6 }, /* Mn */
{ 0x1e944, 0x1e94a }, /* Mn */
{ 0xe0001, 0xe0001 }, /* Cf */
{ 0xe0020, 0xe007f }, /* Cf */
{ 0xe0100, 0xe01ef }, /* Mn */

+ 1
- 1
contrib/less/cvt.c View File

@@ -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.

+ 138
- 3
contrib/less/decode.c View File

@@ -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.
@@ -35,6 +35,9 @@

extern int erase_char, erase2_char, kill_char;
extern int secure;
extern int mousecap;
extern int screen_trashed;
extern int sc_height;

#define SK(k) \
SK_SPECIAL_KEY, (k), 6, 1, 1, 1
@@ -65,6 +68,8 @@ static unsigned char cmdtable[] =
CONTROL('D'),0, A_F_SCROLL,
'u',0, A_B_SCROLL,
CONTROL('U'),0, A_B_SCROLL,
ESC,'[','M',0, A_X11MOUSE_IN,
ESC,'[','<',0, A_X116MOUSE_IN,
' ',0, A_F_SCREEN,
'f',0, A_F_SCREEN,
CONTROL('F'),0, A_F_SCREEN,
@@ -310,7 +315,7 @@ expand_cmd_table(tlist)
* Expand special key abbreviations in all command tables.
*/
public void
expand_cmd_tables()
expand_cmd_tables(VOID_PARAM)
{
expand_cmd_table(list_fcmd_tables);
expand_cmd_table(list_ecmd_tables);
@@ -323,7 +328,7 @@ expand_cmd_tables()
* Initialize the command lists.
*/
public void
init_cmds()
init_cmds(VOID_PARAM)
{
/*
* Add the default command tables.
@@ -415,6 +420,116 @@ add_var_table(tlist, buf, len)
error("Warning: environment variables from lesskey file unavailable", NULL_PARG);
}

/*
* Return action for a mouse wheel down event.
*/
static int
mouse_wheel_down(VOID_PARAM)
{
return ((mousecap == OPT_ONPLUS) ? A_B_MOUSE : A_F_MOUSE);
}

/*
* Return action for a mouse wheel up event.
*/
static int
mouse_wheel_up(VOID_PARAM)
{
return ((mousecap == OPT_ONPLUS) ? A_F_MOUSE : A_B_MOUSE);
}

/*
* Return action for a mouse button release event.
*/
static int
mouse_button_rel(x, y)
int x;
int y;
{
/*
* {{ It would be better to return an action and then do this
* in commands() but it's nontrivial to pass y to it. }}
*/
if (y < sc_height-1)
{
setmark('#', y);
screen_trashed = 1;
}
return (A_NOACTION);
}

/*
* Read a decimal integer. Return the integer and set *pterm to the terminating char.
*/
static int
getcc_int(pterm)
char* pterm;
{
int num = 0;
int digits = 0;
for (;;)
{
char ch = getcc();
if (ch < '0' || ch > '9')
{
if (pterm != NULL) *pterm = ch;
if (digits == 0)
return (-1);
return (num);
}
num = (10 * num) + (ch - '0');
++digits;
}
}

/*
* Read suffix of mouse input and return the action to take.
* The prefix ("\e[M") has already been read.
*/
static int
x11mouse_action(VOID_PARAM)
{
int b = getcc() - X11MOUSE_OFFSET;
int x = getcc() - X11MOUSE_OFFSET-1;
int y = getcc() - X11MOUSE_OFFSET-1;
switch (b) {
default:
return (A_NOACTION);
case X11MOUSE_WHEEL_DOWN:
return mouse_wheel_down();
case X11MOUSE_WHEEL_UP:
return mouse_wheel_up();
case X11MOUSE_BUTTON_REL:
return mouse_button_rel(x, y);
}
}

/*
* Read suffix of mouse input and return the action to take.
* The prefix ("\e[<") has already been read.
*/
static int
x116mouse_action(VOID_PARAM)
{
char ch;
int x, y;
int b = getcc_int(&ch);
if (b < 0 || ch != ';') return (A_NOACTION);
x = getcc_int(&ch) - 1;
if (x < 0 || ch != ';') return (A_NOACTION);
y = getcc_int(&ch) - 1;
if (y < 0) return (A_NOACTION);
switch (b) {
case X11MOUSE_WHEEL_DOWN:
return mouse_wheel_down();
case X11MOUSE_WHEEL_UP:
return mouse_wheel_up();
default:
if (ch != 'm') return (A_NOACTION);
return mouse_button_rel(x, y);
}
}

/*
* Search a single command table for the command string in cmd.
*/
@@ -464,6 +579,10 @@ cmd_search(cmd, table, endtable, sp)
*sp = ++p;
a &= ~A_EXTRA;
}
if (a == A_X11MOUSE_IN)
a = x11mouse_action();
else if (a == A_X116MOUSE_IN)
a = x116mouse_action();
return (a);
}
} else if (*q == '\0')
@@ -579,6 +698,16 @@ lgetenv(var)
return (NULL);
}

/*
* Is a string null or empty?
*/
public int
isnullenv(s)
char* s;
{
return (s == NULL || *s == '\0');
}

#if USERFILE
/*
* Get an "integer" from a lesskey file.
@@ -791,7 +920,13 @@ editchar(c, flags)
if (c == erase_char || c == erase2_char)
return (EC_BACKSPACE);
if (c == kill_char)
{
#if MSDOS_COMPILER==WIN32C
if (!win32_kbhit())
#endif

return (EC_LINEKILL);
}
/*
* Collect characters in a buffer.

+ 16
- 9
contrib/less/edit.c View File

@@ -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.
@@ -171,7 +171,7 @@ close_pipe(FILE *pipefd)
* Close the current input file.
*/
static void
close_file()
close_file(VOID_PARAM)
{
struct scrpos scrpos;
int chflags;
@@ -486,7 +486,12 @@ edit_ifile(ifile)
clr_hilite();
#endif
if (strcmp(filename, FAKE_HELPFILE) && strcmp(filename, FAKE_EMPTYFILE))
cmd_addhist(ml_examine, filename, 1);
{
char *qfilename = shell_quote(filename);
cmd_addhist(ml_examine, qfilename, 1);
free(qfilename);
}

if (no_display && errmsgs > 0)
{
/*
@@ -570,8 +575,10 @@ edit_list(filelist)
* Edit the first file in the command line (ifile) list.
*/
public int
edit_first()
edit_first(VOID_PARAM)
{
if (nifile() == 0)
return (edit_stdin());
curr_ifile = NULL_IFILE;
return (edit_next(1));
}
@@ -580,7 +587,7 @@ edit_first()
* Edit the last file in the command line (ifile) list.
*/
public int
edit_last()
edit_last(VOID_PARAM)
{
curr_ifile = NULL_IFILE;
return (edit_prev(1));
@@ -687,7 +694,7 @@ edit_index(n)
}

public IFILE
save_curr_ifile()
save_curr_ifile(VOID_PARAM)
{
if (curr_ifile != NULL_IFILE)
hold_ifile(curr_ifile, 1);
@@ -740,7 +747,7 @@ reedit_ifile(save_ifile)
}

public void
reopen_curr_ifile()
reopen_curr_ifile(VOID_PARAM)
{
IFILE save_ifile = save_curr_ifile();
close_file();
@@ -751,7 +758,7 @@ reopen_curr_ifile()
* Edit standard input.
*/
public int
edit_stdin()
edit_stdin(VOID_PARAM)
{
if (isatty(fd0))
{
@@ -766,7 +773,7 @@ edit_stdin()
* Used if standard output is not a tty.
*/
public void
cat_file()
cat_file(VOID_PARAM)
{
int c;


+ 22
- 9
contrib/less/filename.c View File

@@ -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.
@@ -98,7 +98,7 @@ shell_unquote(str)
* Get the shell's escape character.
*/
public char *
get_meta_escape()
get_meta_escape(VOID_PARAM)
{
char *s;

@@ -112,7 +112,7 @@ get_meta_escape()
* Get the characters which the shell considers to be "metacharacters".
*/
static char *
metachars()
metachars(VOID_PARAM)
{
static char *mchars = NULL;

@@ -561,8 +561,6 @@ readfd(fd)

#if HAVE_POPEN

FILE *popen();

/*
* Execute a shell command.
* Return a pointer to a pipe connected to the shell command's standard output.
@@ -577,7 +575,7 @@ shellcmd(cmd)
char *shell;

shell = lgetenv("SHELL");
if (shell != NULL && *shell != '\0')
if (!isnullenv(shell))
{
char *scmd;
char *esccmd;
@@ -754,7 +752,7 @@ lglob(filename)
return (filename);
}
lessecho = lgetenv("LESSECHO");
if (lessecho == NULL || *lessecho == '\0')
if (isnullenv(lessecho))
lessecho = "lessecho";
/*
* Invoke lessecho, and read its output (a globbed list of filenames).
@@ -781,7 +779,7 @@ lglob(filename)
if (*gfilename == '\0')
{
free(gfilename);
return (save(filename));
return (filename);
}
}
#else
@@ -796,6 +794,21 @@ lglob(filename)
return (gfilename);
}

/*
* @@@
*/
public char *
lrealpath(path)
char *path;
{
#if HAVE_REALPATH
char rpath[PATH_MAX];
if (realpath(path, rpath) != NULL)
return (save(rpath));
#endif
return (save(path));
}

/*
* Return number of %s escapes in a string.
* Return a large number if there are any other % escapes besides %s.
@@ -1080,7 +1093,7 @@ filesize(f)
*
*/
public char *
shell_coption()
shell_coption(VOID_PARAM)
{
return ("-c");
}

+ 2
- 1
contrib/less/fmt.uni View File

@@ -1,4 +1,4 @@
/* Generated by "./mkutable -f2 Cf -- unicode/UnicodeData.txt" on Sun Nov 12 16:13:49 PST 2017 */
/* Generated by "./mkutable -f2 Cf -- unicode/UnicodeData.txt" on Wed Feb 13 17:57:05 PST 2019 */
{ 0x00ad, 0x00ad }, /* Cf */
{ 0x0600, 0x0605 }, /* Cf */
{ 0x061c, 0x061c }, /* Cf */
@@ -13,6 +13,7 @@
{ 0xfeff, 0xfeff }, /* Cf */
{ 0xfff9, 0xfffb }, /* Cf */
{ 0x110bd, 0x110bd }, /* Cf */
{ 0x110cd, 0x110cd }, /* Cf */
{ 0x1bca0, 0x1bca3 }, /* Cf */
{ 0x1d173, 0x1d17a }, /* Cf */
{ 0xe0001, 0xe0001 }, /* Cf */

+ 10
- 11
contrib/less/forwback.c View File

@@ -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.
@@ -48,7 +48,7 @@ extern char *tagoption;
* Sound the bell to indicate user is trying to move past end of file.
*/
static void
eof_bell()
eof_bell(VOID_PARAM)
{
if (quiet == NOT_QUIET)
bell();
@@ -60,7 +60,7 @@ eof_bell()
* Check to see if the end of file is currently displayed.
*/
public int
eof_displayed()
eof_displayed(VOID_PARAM)
{
POSITION pos;

@@ -87,7 +87,7 @@ eof_displayed()
* Check to see if the entire file is currently displayed.
*/
public int
entire_file_displayed()
entire_file_displayed(VOID_PARAM)
{
POSITION pos;

@@ -107,7 +107,7 @@ entire_file_displayed()
* for the first time.
*/
public void
squish_check()
squish_check(VOID_PARAM)
{
if (!squished)
return;
@@ -439,7 +439,7 @@ backward(n, force, only_last)
* top_scroll, as well as back_scroll.
*/
public int
get_back_scroll()
get_back_scroll(VOID_PARAM)
{
if (no_back_scroll)
return (0);
@@ -451,19 +451,18 @@ get_back_scroll()
}

/*
* Return number of displayable lines in the file.
* Stop counting at screen height + 1.
* Will the entire file fit on one screen?
*/
public int
get_line_count()
get_one_screen(VOID_PARAM)
{
int nlines;
POSITION pos = ch_zero();

for (nlines = 0; nlines <= sc_height; nlines++)
for (nlines = 0; nlines < sc_height; nlines++)
{
pos = forw_line(pos);
if (pos == NULL_POSITION) break;
}
return nlines;
return (nlines < sc_height);
}

+ 14
- 2
contrib/less/funcs.h View File

@@ -7,6 +7,8 @@ public void raw_mode LESSPARAMS ((int on));
public void scrsize LESSPARAMS ((VOID_PARAM));
public char * special_key_str LESSPARAMS ((int key));
public void get_term LESSPARAMS ((VOID_PARAM));
public void init_mouse LESSPARAMS ((VOID_PARAM));
public void deinit_mouse LESSPARAMS ((VOID_PARAM));
public void init LESSPARAMS ((VOID_PARAM));
public void deinit LESSPARAMS ((VOID_PARAM));
public void home LESSPARAMS ((VOID_PARAM));
@@ -29,7 +31,8 @@ public int is_at_equiv LESSPARAMS ((int attr1, int attr2));
public int apply_at_specials LESSPARAMS ((int attr));
public void backspace LESSPARAMS ((VOID_PARAM));
public void putbs LESSPARAMS ((VOID_PARAM));
public char WIN32getch LESSPARAMS ((int tty));
public int win32_kbhit LESSPARAMS ((VOID_PARAM));
public char WIN32getch LESSPARAMS ((VOID_PARAM));
public void WIN32setcolors LESSPARAMS ((int fg, int bg));
public void WIN32textout LESSPARAMS ((char *text, int len));
public void match_brac LESSPARAMS ((int obrac, int cbrac, int forwdir, int n));
@@ -98,6 +101,7 @@ public void add_ecmd_table LESSPARAMS ((char *buf, int len));
public int fcmd_decode LESSPARAMS ((char *cmd, char **sp));
public int ecmd_decode LESSPARAMS ((char *cmd, char **sp));
public char * lgetenv LESSPARAMS ((char *var));
public int isnullenv LESSPARAMS ((char* s));
public int lesskey LESSPARAMS ((char *filename, int sysvar));
public void add_hometable LESSPARAMS ((char *envname, char *def_filename, int sysvar));
public int editchar LESSPARAMS ((int c, int flags));
@@ -127,6 +131,7 @@ public char * fexpand LESSPARAMS ((char *s));
public char * fcomplete LESSPARAMS ((char *s));
public int bin_file LESSPARAMS ((int f));
public char * lglob LESSPARAMS ((char *filename));
public char * lrealpath LESSPARAMS ((char *path));
public char * open_altfile LESSPARAMS ((char *filename, int *pf, void **pfd));
public void close_altfile LESSPARAMS ((char *altfilename, char *filename));
public int is_dir LESSPARAMS ((char *filename));
@@ -142,7 +147,7 @@ public void back LESSPARAMS ((int n, POSITION pos, int force, int only_last));
public void forward LESSPARAMS ((int n, int force, int only_last));
public void backward LESSPARAMS ((int n, int force, int only_last));
public int get_back_scroll LESSPARAMS ((VOID_PARAM));
public int get_line_count LESSPARAMS ((VOID_PARAM));
public int get_one_screen LESSPARAMS ((VOID_PARAM));
public void del_ifile LESSPARAMS ((IFILE h));
public IFILE next_ifile LESSPARAMS ((IFILE h));
public IFILE prev_ifile LESSPARAMS ((IFILE h));
@@ -208,6 +213,9 @@ public void gomark LESSPARAMS ((int c));
public POSITION markpos LESSPARAMS ((int c));
public char posmark LESSPARAMS ((POSITION pos));
public void unmark LESSPARAMS ((IFILE ifile));
public void mark_check_ifile LESSPARAMS ((IFILE ifile));
public void save_marks LESSPARAMS ((FILE *fout, char *hdr));
public void restore_mark LESSPARAMS ((char *line));
public void opt_o LESSPARAMS ((int type, char *s));
public void opt__O LESSPARAMS ((int type, char *s));
public void opt_j LESSPARAMS ((int type, char *s));
@@ -227,6 +235,8 @@ public void opt_x LESSPARAMS ((int type, char *s));
public void opt_quote LESSPARAMS ((int type, char *s));
public void opt_rscroll LESSPARAMS ((int type, char *s));
public void opt_query LESSPARAMS ((int type, char *s));
public void opt_mousecap LESSPARAMS ((int type, char *s));
public void opt_wheel_lines LESSPARAMS ((int type, char *s));
public int get_swindow LESSPARAMS ((VOID_PARAM));
public char * propt LESSPARAMS ((int c));
public void scan_option LESSPARAMS ((char *s));
@@ -261,6 +271,7 @@ public void uncompile_pattern LESSPARAMS ((PATTERN_TYPE *pattern));
public int valid_pattern LESSPARAMS ((char *pattern));
public int is_null_pattern LESSPARAMS ((PATTERN_TYPE pattern));
public int match_pattern LESSPARAMS ((PATTERN_TYPE pattern, char *tpattern, char *line, int line_len, char **sp, char **ep, int notbol, int search_type));
public char * pattern_lib_name LESSPARAMS ((VOID_PARAM));
public POSITION position LESSPARAMS ((int sindex));
public void add_forw_pos LESSPARAMS ((POSITION pos));
public void add_back_pos LESSPARAMS ((POSITION pos));
@@ -307,4 +318,5 @@ public int curr_tag LESSPARAMS ((VOID_PARAM));
public int edit_tagfile LESSPARAMS ((VOID_PARAM));
public void open_getchr LESSPARAMS ((VOID_PARAM));
public void close_getchr LESSPARAMS ((VOID_PARAM));
public int default_wheel_lines LESSPARAMS ((VOID_PARAM));
public int getchr LESSPARAMS ((VOID_PARAM));

+ 17
- 7
contrib/less/help.c View File

@@ -1,4 +1,4 @@
/* This file was generated by mkhelp.pl from less.hlp at 22:56 on 2017/12/5 */
/* This file was generated by mkhelp.pl from less.hlp at 18:12 on 2019/6/11 */
#include "less.h"
constant char helpdata[] = {
'\n',
@@ -47,7 +47,7 @@ constant char helpdata[] = {
' ',' ','E','S','C','-','u',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','U','n','d','o',' ','(','t','o','g','g','l','e',')',' ','s','e','a','r','c','h',' ','h','i','g','h','l','i','g','h','t','i','n','g','.','\n',
' ',' ','&','_','\b','p','_','\b','a','_','\b','t','_','\b','t','_','\b','e','_','\b','r','_','\b','n',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','*',' ',' ','D','i','s','p','l','a','y',' ','o','n','l','y',' ','m','a','t','c','h','i','n','g',' ','l','i','n','e','s','\n',
' ',' ',' ',' ',' ',' ',' ',' ','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','\n',
' ',' ',' ',' ',' ',' ',' ',' ','A',' ','s','e','a','r','c','h',' ','p','a','t','t','e','r','n',' ','m','a','y',' ','b','e',' ','p','r','e','c','e','d','e','d',' ','b','y',' ','o','n','e',' ','o','r',' ','m','o','r','e',' ','o','f',':','\n',
' ',' ',' ',' ',' ',' ',' ',' ','A',' ','s','e','a','r','c','h',' ','p','a','t','t','e','r','n',' ','m','a','y',' ','b','e','g','i','n',' ','w','i','t','h',' ','o','n','e',' ','o','r',' ','m','o','r','e',' ','o','f',':','\n',
' ',' ',' ',' ',' ',' ',' ',' ','^','N',' ','o','r',' ','!',' ',' ','S','e','a','r','c','h',' ','f','o','r',' ','N','O','N','-','m','a','t','c','h','i','n','g',' ','l','i','n','e','s','.','\n',
' ',' ',' ',' ',' ',' ',' ',' ','^','E',' ','o','r',' ','*',' ',' ','S','e','a','r','c','h',' ','m','u','l','t','i','p','l','e',' ','f','i','l','e','s',' ','(','p','a','s','s',' ','t','h','r','u',' ','E','N','D',' ','O','F',' ','F','I','L','E',')','.','\n',
' ',' ',' ',' ',' ',' ',' ',' ','^','F',' ','o','r',' ','@',' ',' ','S','t','a','r','t',' ','s','e','a','r','c','h',' ','a','t',' ','F','I','R','S','T',' ','f','i','l','e',' ','(','f','o','r',' ','/',')',' ','o','r',' ','l','a','s','t',' ','f','i','l','e',' ','(','f','o','r',' ','?',')','.','\n',
@@ -156,7 +156,7 @@ constant char helpdata[] = {
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','D','i','s','p','l','a','y',' ','a',' ','s','t','a','t','u','s',' ','c','o','l','u','m','n',' ','a','t',' ','l','e','f','t',' ','e','d','g','e',' ','o','f',' ','s','c','r','e','e','n','.','\n',
' ',' ','-','k',' ','[','_','\b','f','_','\b','i','_','\b','l','_','\b','e',']',' ',' ','.',' ',' ','-','-','l','e','s','s','k','e','y','-','f','i','l','e','=','[','_','\b','f','_','\b','i','_','\b','l','_','\b','e',']','\n',
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','U','s','e',' ','a',' ','l','e','s','s','k','e','y',' ','f','i','l','e','.','\n',
' ',' ','-','K',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','-','-','q','u','i','t','-','o','n','-','i','n','t','r','\n',
' ',' ','-','K',' ',' ','.','.','.','.','.','.','.','.',' ',' ','-','-','q','u','i','t','-','o','n','-','i','n','t','r','\n',
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','E','x','i','t',' ','l','e','s','s',' ','i','n',' ','r','e','s','p','o','n','s','e',' ','t','o',' ','c','t','r','l','-','C','.','\n',
' ',' ','-','L',' ',' ','.','.','.','.','.','.','.','.',' ',' ','-','-','n','o','-','l','e','s','s','o','p','e','n','\n',
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','I','g','n','o','r','e',' ','t','h','e',' ','L','E','S','S','O','P','E','N',' ','e','n','v','i','r','o','n','m','e','n','t',' ','v','a','r','i','a','b','l','e','.','\n',
@@ -206,12 +206,22 @@ constant char helpdata[] = {
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','D','o','n','\'','t',' ','d','i','s','p','l','a','y',' ','t','i','l','d','e','s',' ','a','f','t','e','r',' ','e','n','d',' ','o','f',' ','f','i','l','e','.','\n',
' ',' ','-','#',' ','[','_','\b','N',']',' ',' ','.','.','.','.',' ',' ','-','-','s','h','i','f','t','=','[','_','\b','N',']','\n',
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','H','o','r','i','z','o','n','t','a','l',' ','s','c','r','o','l','l',' ','a','m','o','u','n','t',' ','(','0',' ','=',' ','o','n','e',' ','h','a','l','f',' ','s','c','r','e','e','n',' ','w','i','d','t','h',')','\n',
' ',' ',' ',' ',' ',' ','.','.','.','.','.','.','.','.',' ',' ','-','-','n','o','-','k','e','y','p','a','d','\n',
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','D','o','n','\'','t',' ','s','e','n','d',' ','t','e','r','m','c','a','p',' ','k','e','y','p','a','d',' ','i','n','i','t','/','d','e','i','n','i','t',' ','s','t','r','i','n','g','s','.','\n',
' ',' ',' ',' ',' ',' ','.','.','.','.','.','.','.','.',' ',' ','-','-','f','o','l','l','o','w','-','n','a','m','e','\n',
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','-','-','f','o','l','l','o','w','-','n','a','m','e','\n',
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','T','h','e',' ','F',' ','c','o','m','m','a','n','d',' ','c','h','a','n','g','e','s',' ','f','i','l','e','s',' ','i','f',' ','t','h','e',' ','i','n','p','u','t',' ','f','i','l','e',' ','i','s',' ','r','e','n','a','m','e','d','.','\n',
' ',' ',' ',' ',' ',' ','.','.','.','.','.','.','.','.',' ',' ','-','-','u','s','e','-','b','a','c','k','s','l','a','s','h','\n',
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','-','-','m','o','u','s','e','\n',
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','E','n','a','b','l','e',' ','m','o','u','s','e',' ','i','n','p','u','t','.','\n',
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','-','-','n','o','-','k','e','y','p','a','d','\n',
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','D','o','n','\'','t',' ','s','e','n','d',' ','t','e','r','m','c','a','p',' ','k','e','y','p','a','d',' ','i','n','i','t','/','d','e','i','n','i','t',' ','s','t','r','i','n','g','s','.','\n',
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','-','-','n','o','-','h','i','s','t','d','u','p','s','\n',
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','R','e','m','o','v','e',' ','d','u','p','l','i','c','a','t','e','s',' ','f','r','o','m',' ','c','o','m','m','a','n','d',' ','h','i','s','t','o','r','y','.','\n',
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','-','-','r','s','c','r','o','l','l','=','C','\n',
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','S','e','t',' ','t','h','e',' ','c','h','a','r','a','c','t','e','r',' ','u','s','e','d',' ','t','o',' ','m','a','r','k',' ','t','r','u','n','c','a','t','e','d',' ','l','i','n','e','s','.','\n',
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','-','-','s','a','v','e','-','m','a','r','k','s','\n',
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','R','e','t','a','i','n',' ','m','a','r','k','s',' ','a','c','r','o','s','s',' ','i','n','v','o','c','a','t','i','o','n','s',' ','o','f',' ','l','e','s','s','.','\n',
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','-','-','u','s','e','-','b','a','c','k','s','l','a','s','h','\n',
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','S','u','b','s','e','q','u','e','n','t',' ','o','p','t','i','o','n','s',' ','u','s','e',' ','b','a','c','k','s','l','a','s','h',' ','a','s',' ','e','s','c','a','p','e',' ','c','h','a','r','.','\n',
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','-','-','w','h','e','e','l','-','l','i','n','e','s','=','N','\n',
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','E','a','c','h',' ','c','l','i','c','k',' ','o','f',' ','t','h','e',' ','m','o','u','s','e',' ','w','h','e','e','l',' ','m','o','v','e','s',' ','N',' ','l','i','n','e','s','.','\n',
'\n',
'\n',
' ','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','\n',

+ 27
- 6
contrib/less/ifile.c View File

@@ -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.
@@ -121,6 +121,12 @@ new_ifile(filename, prev)
p->h_hold = 0;
p->h_filestate = NULL;
link_ifile(p, prev);
/*
* {{ It's dodgy to call mark.c functions from here;
* there is potentially dangerous recursion.
* Probably need to revisit this design. }}
*/
mark_check_ifile(ext_ifile(p));
return (p);
}

@@ -198,7 +204,7 @@ getoff_ifile(ifile)
* Return the number of ifiles.
*/
public int
nifile()
nifile(VOID_PARAM)
{
return (ifiles);
}
@@ -211,11 +217,26 @@ find_ifile(filename)
char *filename;
{
struct ifile *p;
char *rfilename = lrealpath(filename);

for (p = anchor.h_next; p != &anchor; p = p->h_next)
if (strcmp(filename, p->h_filename) == 0)
return (p);
return (NULL);
{
if (strcmp(filename, p->h_filename) == 0 ||
strcmp(rfilename, p->h_filename) == 0)
{
/*
* If given name is shorter than the name we were
* previously using for this file, adopt shorter name.
*/
if (strlen(filename) < strlen(p->h_filename))
strcpy(p->h_filename, filename);
break;
}
}
free(rfilename);
if (p == &anchor)
p = NULL;
return (p);
}

/*
@@ -365,7 +386,7 @@ get_altfilename(ifile)

#if 0
public void
if_dump()
if_dump(VOID_PARAM)
{
struct ifile *p;


+ 1
- 1
contrib/less/input.c View File

@@ -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.

+ 4
- 4
contrib/less/jump.c View File

@@ -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.
@@ -26,7 +26,7 @@ extern int top_scroll;
* Jump to the end of the file.
*/
public void
jump_forw()
jump_forw(VOID_PARAM)
{
POSITION pos;
POSITION end_pos;
@@ -64,7 +64,7 @@ jump_forw()
* Jump to the last buffered line in the file.
*/
public void
jump_forw_buffered()
jump_forw_buffered(VOID_PARAM)
{
POSITION end;

@@ -115,7 +115,7 @@ jump_back(linenum)
* Repaint the screen.
*/
public void
repaint()
repaint(VOID_PARAM)
{
struct scrpos scrpos;
/*

+ 16
- 10
contrib/less/less.h View File

@@ -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.
@@ -302,15 +302,6 @@ struct scrpos
int ln;
};

/*
* A mark is an ifile (input file) plus a position within the file.
*/
struct mark
{
IFILE m_ifile;