diff options
author | Xin LI <delphij@FreeBSD.org> | 2017-04-25 03:42:16 +0000 |
---|---|---|
committer | Xin LI <delphij@FreeBSD.org> | 2017-04-25 03:42:16 +0000 |
commit | 9c83c2751d26fe2e059d6956f0398b56ed919a6a (patch) | |
tree | b75ed451f9f8336fb4958dbae186b6bd98aa65c0 | |
parent | 1cabeb1f0c93e44ebc8a1d3a78100a962ac3f047 (diff) |
Vendor import of less 487.vendor/less/v487
Notes
Notes:
svn path=/vendor/less/dist/; revision=317397
svn path=/vendor/less/v487/; revision=317398; tag=vendor/less/v487
-rw-r--r-- | LICENSE | 2 | ||||
-rw-r--r-- | Makefile.aut | 2 | ||||
-rw-r--r-- | Makefile.wnm | 7 | ||||
-rw-r--r-- | NEWS | 20 | ||||
-rw-r--r-- | README | 4 | ||||
-rw-r--r-- | brac.c | 16 | ||||
-rw-r--r-- | ch.c | 95 | ||||
-rw-r--r-- | charset.c | 88 | ||||
-rw-r--r-- | charset.h | 2 | ||||
-rw-r--r-- | cmd.h | 4 | ||||
-rw-r--r-- | cmdbuf.c | 233 | ||||
-rw-r--r-- | command.c | 88 | ||||
-rw-r--r-- | compose.uni | 44 | ||||
-rwxr-xr-x | configure | 8 | ||||
-rw-r--r-- | configure.ac | 8 | ||||
-rw-r--r-- | cvt.c | 20 | ||||
-rw-r--r-- | decode.c | 107 | ||||
-rw-r--r-- | defines.ds | 2 | ||||
-rw-r--r-- | defines.o2 | 2 | ||||
-rw-r--r-- | defines.o9 | 2 | ||||
-rw-r--r-- | defines.wn | 2 | ||||
-rw-r--r-- | edit.c | 76 | ||||
-rw-r--r-- | filename.c | 90 | ||||
-rw-r--r-- | forwback.c | 35 | ||||
-rw-r--r-- | funcs.h | 601 | ||||
-rw-r--r-- | help.c | 7 | ||||
-rw-r--r-- | ifile.c | 88 | ||||
-rw-r--r-- | input.c | 13 | ||||
-rw-r--r-- | jump.c | 31 | ||||
-rw-r--r-- | less.h | 8 | ||||
-rw-r--r-- | less.hlp | 7 | ||||
-rw-r--r-- | less.man | 360 | ||||
-rw-r--r-- | less.nro | 9 | ||||
-rw-r--r-- | lessecho.c | 14 | ||||
-rw-r--r-- | lessecho.man | 2 | ||||
-rw-r--r-- | lessecho.nro | 2 | ||||
-rw-r--r-- | lesskey.c | 93 | ||||
-rw-r--r-- | lesskey.h | 2 | ||||
-rw-r--r-- | lesskey.man | 18 | ||||
-rw-r--r-- | lesskey.nro | 18 | ||||
-rw-r--r-- | lglob.h | 2 | ||||
-rw-r--r-- | line.c | 149 | ||||
-rw-r--r-- | linenum.c | 44 | ||||
-rw-r--r-- | lsystem.c | 25 | ||||
-rw-r--r-- | main.c | 30 | ||||
-rw-r--r-- | mark.c | 35 | ||||
-rw-r--r-- | mkhelp.c | 6 | ||||
-rwxr-xr-x | mkutable | 44 | ||||
-rw-r--r-- | optfunc.c | 91 | ||||
-rw-r--r-- | option.c | 78 | ||||
-rw-r--r-- | option.h | 2 | ||||
-rw-r--r-- | opttbl.c | 29 | ||||
-rw-r--r-- | os.c | 38 | ||||
-rw-r--r-- | output.c | 189 | ||||
-rw-r--r-- | pattern.c | 45 | ||||
-rw-r--r-- | pattern.h | 2 | ||||
-rw-r--r-- | pckeys.h | 2 | ||||
-rw-r--r-- | position.c | 42 | ||||
-rw-r--r-- | position.h | 2 | ||||
-rw-r--r-- | prompt.c | 56 | ||||
-rw-r--r-- | regexp.c | 176 | ||||
-rw-r--r-- | screen.c | 157 | ||||
-rw-r--r-- | scrsize.c | 12 | ||||
-rw-r--r-- | search.c | 186 | ||||
-rw-r--r-- | signal.c | 24 | ||||
-rw-r--r-- | tags.c | 73 | ||||
-rw-r--r-- | ttyin.c | 12 | ||||
-rw-r--r-- | ubin.uni | 3 | ||||
-rw-r--r-- | version.c | 22 | ||||
-rw-r--r-- | wide.uni | 187 |
70 files changed, 2411 insertions, 1582 deletions
@@ -2,7 +2,7 @@ ------------ Less -Copyright (C) 1984-2015 Mark Nudelman +Copyright (C) 1984-2016 Mark Nudelman Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions diff --git a/Makefile.aut b/Makefile.aut index 6d299c978463..9cc04cea2735 100644 --- a/Makefile.aut +++ b/Makefile.aut @@ -111,7 +111,7 @@ compose.uni: unicode/UnicodeData.txt ubin.uni: unicode/UnicodeData.txt ./mkutable -f2 Cc Cf Cs Co Zl Zp -- unicode/UnicodeData.txt > $@ wide.uni: unicode/EastAsianWidth.txt - ./mkutable -f1 W -- unicode/EastAsianWidth.txt > $@ + ./mkutable -f1 W F -- unicode/EastAsianWidth.txt > $@ distfiles: ${DISTFILES} diff --git a/Makefile.wnm b/Makefile.wnm index 2e1cb60ac4db..1127328932ff 100644 --- a/Makefile.wnm +++ b/Makefile.wnm @@ -20,7 +20,7 @@ LIBS = user32.lib # This rule allows us to supply the necessary -D options # in addition to whatever the user asks for. -.c.obj: +.c.obj:: $(CC) $(CFLAGS) $< OBJ = \ @@ -33,11 +33,8 @@ OBJ = \ all: less.exe lesskey.exe -# This is really horrible, but the command line is too long for -# MS-DOS if we try to link ${OBJ}. less.exe: $(OBJ) - -del lesskey.obj - $(LD) $(LDFLAGS) *.obj $(LIBS) /out:$@ + $(LD) $(LDFLAGS) $** $(LIBS) /out:$@ lesskey.exe: lesskey.obj version.obj $(LD) $(LDFLAGS) lesskey.obj version.obj $(LIBS) /out:$@ @@ -11,6 +11,26 @@ ====================================================================== + Major changes between "less" versions 481 and 487 + +* New commands ESC-{ and ESC-} to shift to start/end of displayed lines. + +* Make search highlights work correctly when changing caselessness with -i. + +* New option -Da in Windows version to enable SGR mode. + +* Fix "nothing to search" error when top or bottom line on screen is empty. + +* Fix bug when terminal has no "cm" termcap entry. + +* Fix incorrect display when entering double-width chars in search string. + +* Fix bug in Unicode handling that missed some double width characters. + +* Update Unicode database to 9.0.0. + +====================================================================== + Major changes between "less" versions 458 and 481 * Don't overwrite history file; just append to it. @@ -1,7 +1,7 @@ - Less, version 481 + Less, version 487 - This is the distribution of less, version 481, released 31 Aug 2015. + This is the distribution of less, version 487, released 25 Oct 2016. This program is part of the GNU project (http://www.gnu.org). This program is free software. You may redistribute it and/or @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2015 Mark Nudelman + * Copyright (C) 1984-2016 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. @@ -24,14 +24,18 @@ * "close bracket" are given. */ public void -match_brac(int obrac, int cbrac, int forwdir, int n) +match_brac(obrac, cbrac, forwdir, n) + register int obrac; + register int cbrac; + int forwdir; + int n; { - int c; - int nest; + register int c; + register int nest; POSITION pos; - int (*chget)(void); + int (*chget)(); - extern int ch_forw_get(void), ch_back_get(void); + extern int ch_forw_get(), ch_back_get(); /* * Seek to the line containing the open bracket. @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2015 Mark Nudelman + * Copyright (C) 1984-2016 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,13 +144,13 @@ static int ch_addbuf(); * Get the character pointed to by the read pointer. */ int -ch_get(void) +ch_get() { - struct buf *bp; - struct bufnode *bn; - int n; - int slept; - int h; + register struct buf *bp; + register struct bufnode *bn; + register int n; + register int slept; + register int h; POSITION pos; POSITION len; @@ -378,7 +378,8 @@ ch_get(void) * a single char onto an input file descriptor. */ public void -ch_ungetchar(int c) +ch_ungetchar(c) + int c; { if (c != -1 && ch_ungotchar != -1) error("ch_ungetchar overrun", NULL_PARG); @@ -391,7 +392,7 @@ ch_ungetchar(int c) * If we haven't read all of standard input into it, do that now. */ public void -end_logfile(void) +end_logfile() { static int tried = FALSE; @@ -416,10 +417,10 @@ end_logfile(void) * Write all the existing buffered data to the log file. */ public void -sync_logfile(void) +sync_logfile() { - struct buf *bp; - struct bufnode *bn; + register struct buf *bp; + register struct bufnode *bn; int warned = FALSE; BLOCKNUM block; BLOCKNUM nblocks; @@ -453,11 +454,12 @@ sync_logfile(void) * Determine if a specific block is currently in one of the buffers. */ static int -buffered(BLOCKNUM block) +buffered(block) + BLOCKNUM block; { - struct buf *bp; - struct bufnode *bn; - int h; + register struct buf *bp; + register struct bufnode *bn; + register int h; h = BUFHASH(block); FOR_BUFS_IN_CHAIN(h, bn) @@ -474,7 +476,8 @@ buffered(BLOCKNUM block) * Return 0 if successful, non-zero if can't seek there. */ public int -ch_seek(POSITION pos) +ch_seek(pos) + register POSITION pos; { BLOCKNUM new_block; POSITION len; @@ -512,7 +515,7 @@ ch_seek(POSITION pos) * Seek to the end of the file. */ public int -ch_end_seek(void) +ch_end_seek() { POSITION len; @@ -539,10 +542,10 @@ ch_end_seek(void) * Seek to the last position in the file that is currently buffered. */ public int -ch_end_buffer_seek(void) +ch_end_buffer_seek() { - struct buf *bp; - struct bufnode *bn; + register struct buf *bp; + register struct bufnode *bn; POSITION buf_pos; POSITION end_pos; @@ -567,10 +570,10 @@ ch_end_buffer_seek(void) * beginning of the pipe is no longer buffered. */ public int -ch_beg_seek(void) +ch_beg_seek() { - struct bufnode *bn; - struct bufnode *firstbn; + register struct bufnode *bn; + register struct bufnode *firstbn; /* * Try a plain ch_seek first. @@ -599,7 +602,7 @@ ch_beg_seek(void) * Return the length of the file, if known. */ public POSITION -ch_length(void) +ch_length() { if (thisfile == NULL) return (NULL_POSITION); @@ -616,7 +619,7 @@ ch_length(void) * Return the current position in the file. */ public POSITION -ch_tell(void) +ch_tell() { if (thisfile == NULL) return (NULL_POSITION); @@ -627,9 +630,9 @@ ch_tell(void) * Get the current char and post-increment the read pointer. */ public int -ch_forw_get(void) +ch_forw_get() { - int c; + register int c; if (thisfile == NULL) return (EOI); @@ -650,7 +653,7 @@ ch_forw_get(void) * Pre-decrement the read pointer and get the new current char. */ public int -ch_back_get(void) +ch_back_get() { if (thisfile == NULL) return (EOI); @@ -673,7 +676,8 @@ ch_back_get(void) * bufspace is in units of 1024 bytes. -1 mean no limit. */ public void -ch_setbufspace(int bufspace) +ch_setbufspace(bufspace) + int bufspace; { if (bufspace < 0) maxbufs = -1; @@ -689,9 +693,9 @@ ch_setbufspace(int bufspace) * Flush (discard) any saved file state, including buffer contents. */ public void -ch_flush(void) +ch_flush() { - struct bufnode *bn; + register struct bufnode *bn; if (thisfile == NULL) return; @@ -756,10 +760,10 @@ ch_flush(void) * The buffer is added to the tail of the buffer chain. */ static int -ch_addbuf(void) +ch_addbuf() { - struct buf *bp; - struct bufnode *bn; + register struct buf *bp; + register struct bufnode *bn; /* * Allocate and initialize a new buffer and link it @@ -781,9 +785,9 @@ ch_addbuf(void) * */ static void -init_hashtbl(void) +init_hashtbl() { - int h; + register int h; for (h = 0; h < BUFHASH_SIZE; h++) { @@ -796,9 +800,9 @@ init_hashtbl(void) * Delete all buffers for this file. */ static void -ch_delbufs(void) +ch_delbufs() { - struct bufnode *bn; + register struct bufnode *bn; while (ch_bufhead != END_OF_CHAIN) { @@ -814,7 +818,8 @@ ch_delbufs(void) * Is it possible to seek on a file descriptor? */ public int -seekable(int f) +seekable(f) + int f; { #if MSDOS_COMPILER extern int fd0; @@ -835,7 +840,7 @@ seekable(int f) * This is used after an ignore_eof read, during which the EOF may change. */ public void -ch_set_eof(void) +ch_set_eof() { ch_fsize = ch_fpos; } @@ -845,7 +850,9 @@ ch_set_eof(void) * Initialize file state for a new file. */ public void -ch_init(int f, int flags) +ch_init(f, flags) + int f; + int flags; { /* * See if we already have a filestate for this file. @@ -884,7 +891,7 @@ ch_init(int f, int flags) * Close a filestate. */ public void -ch_close(void) +ch_close() { int keepstate = FALSE; @@ -927,7 +934,7 @@ ch_close(void) * Return ch_flags for the current file. */ public int -ch_getflags(void) +ch_getflags() { if (thisfile == NULL) return (0); diff --git a/charset.c b/charset.c index db7e848f0c87..16613cc79396 100644 --- a/charset.c +++ b/charset.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2015 Mark Nudelman + * Copyright (C) 1984-2016 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. @@ -64,6 +64,8 @@ struct cs_alias { char *oname; } cs_aliases[] = { { "UTF-8", "utf-8" }, + { "utf8", "utf-8" }, + { "UTF8", "utf-8" }, { "ANSI_X3.4-1968", "ascii" }, { "US-ASCII", "ascii" }, { "latin1", "iso8859" }, @@ -130,11 +132,12 @@ public int binattr = AT_STANDOUT; * c control character */ static void -ichardef(char *s) +ichardef(s) + char *s; { - char *cp; - int n; - char v; + register char *cp; + register int n; + register char v; n = 0; v = 0; @@ -186,10 +189,12 @@ ichardef(char *s) * The valid charset names are listed in the "charsets" array. */ static int -icharset(char *name, int no_error) +icharset(name, no_error) + register char *name; + int no_error; { - struct charset *p; - struct cs_alias *a; + register struct charset *p; + register struct cs_alias *a; if (name == NULL || *name == '\0') return (0); @@ -227,9 +232,9 @@ icharset(char *name, int no_error) * Define a charset, given a locale name. */ static void -ilocale(void) +ilocale() { - int c; + register int c; for (c = 0; c < (int) sizeof(chardef); c++) { @@ -247,7 +252,10 @@ ilocale(void) * Define the printing format for control (or binary utf) chars. */ static void -setbinfmt(char *s, char **fmtvarptr, char *default_fmt) +setbinfmt(s, fmtvarptr, default_fmt) + char *s; + char **fmtvarptr; + char *default_fmt; { if (s && utf_mode) { @@ -293,7 +301,7 @@ setbinfmt(char *s, char **fmtvarptr, char *default_fmt) * */ static void -set_charset(void) +set_charset() { char *s; @@ -364,7 +372,7 @@ set_charset(void) * Initialize charset data structures. */ public void -init_charset(void) +init_charset() { char *s; @@ -385,7 +393,8 @@ init_charset(void) * Is a given character a "binary" character? */ public int -binary_char(LWCHAR c) +binary_char(c) + LWCHAR c; { if (utf_mode) return (is_ubin_char(c)); @@ -397,7 +406,8 @@ binary_char(LWCHAR c) * Is a given character a "control" character? */ public int -control_char(LWCHAR c) +control_char(c) + LWCHAR c; { c &= 0377; return (chardef[c] & IS_CONTROL_CHAR); @@ -408,7 +418,8 @@ control_char(LWCHAR c) * For example, in the "ascii" charset '\3' is printed as "^C". */ public char * -prchar(LWCHAR c) +prchar(c) + LWCHAR c; { /* {{ This buffer can be overrun if LESSBINFMT is a long string. }} */ static char buf[32]; @@ -443,7 +454,8 @@ prchar(LWCHAR c) * Return the printable form of a UTF-8 character. */ public char * -prutfchar(LWCHAR ch) +prutfchar(ch) + LWCHAR ch; { static char buf[32]; @@ -473,7 +485,8 @@ prutfchar(LWCHAR ch) * Get the length of a UTF-8 character in bytes. */ public int -utf_len(char ch) +utf_len(ch) + char ch; { if ((ch & 0x80) == 0) return 1; @@ -495,7 +508,9 @@ utf_len(char ch) * Does the parameter point to the lead byte of a well-formed UTF-8 character? */ public int -is_utf8_well_formed(unsigned char *s, int slen) +is_utf8_well_formed(s, slen) + unsigned char *s; + int slen; { int i; int len; @@ -530,7 +545,9 @@ is_utf8_well_formed(unsigned char *s, int slen) * Return number of invalid UTF-8 sequences found in a buffer. */ public int -utf_bin_count(unsigned char *data, int len) +utf_bin_count(data, len) + unsigned char *data; + int len; { int bin_count = 0; while (len > 0) @@ -557,7 +574,8 @@ utf_bin_count(unsigned char *data, int len) * Get the value of a UTF-8 character. */ public LWCHAR -get_wchar(constant char *p) +get_wchar(p) + char *p; { switch (utf_len(p[0])) { @@ -608,7 +626,9 @@ get_wchar(constant char *p) * Store a character into a UTF-8 string. */ public void -put_wchar(char **pp, LWCHAR ch) +put_wchar(pp, ch) + char **pp; + LWCHAR ch; { if (!utf_mode || ch < 0x80) { @@ -656,11 +676,14 @@ put_wchar(char **pp, LWCHAR ch) * Step forward or backward one character in a string. */ public LWCHAR -step_char(constant char **pp, signed int dir, constant char *limit) +step_char(pp, dir, limit) + char **pp; + signed int dir; + char *limit; { LWCHAR ch; int len; - constant char *p = *pp; + char *p = *pp; if (!utf_mode) { @@ -723,7 +746,9 @@ static struct wchar_range comb_table[] = { static int -is_in_table(LWCHAR ch, struct wchar_range_table *table) +is_in_table(ch, table) + LWCHAR ch; + struct wchar_range_table *table; { int hi; int lo; @@ -751,7 +776,8 @@ is_in_table(LWCHAR ch, struct wchar_range_table *table) * If a composing character follows any char, the two combine into one glyph. */ public int -is_composing_char(LWCHAR ch) +is_composing_char(ch) + LWCHAR ch; { return is_in_table(ch, &compose_table); } @@ -760,7 +786,8 @@ is_composing_char(LWCHAR ch) * Should this UTF-8 character be treated as binary? */ public int -is_ubin_char(LWCHAR ch) +is_ubin_char(ch) + LWCHAR ch; { return is_in_table(ch, &ubin_table); } @@ -769,7 +796,8 @@ is_ubin_char(LWCHAR ch) * Is this a double width UTF-8 character? */ public int -is_wide_char(LWCHAR ch) +is_wide_char(ch) + LWCHAR ch; { return is_in_table(ch, &wide_table); } @@ -780,7 +808,9 @@ is_wide_char(LWCHAR ch) * a specific char (not any char), the two combine into one glyph. */ public int -is_combining_char(LWCHAR ch1, LWCHAR ch2) +is_combining_char(ch1, ch2) + LWCHAR ch1; + LWCHAR ch2; { /* The table is small; use linear search. */ int i; diff --git a/charset.h b/charset.h index bb1e4376cbd5..a4e3bf1d96b4 100644 --- a/charset.h +++ b/charset.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2015 Mark Nudelman + * Copyright (C) 1984-2016 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. @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2015 Mark Nudelman + * Copyright (C) 1984-2016 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. @@ -67,6 +67,8 @@ #define A_FILTER 55 #define A_F_UNTIL_HILITE 56 #define A_GOEND_BUF 57 +#define A_LLSHIFT 58 +#define A_RRSHIFT 59 #define A_INVALID 100 #define A_NOACTION 101 @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2015 Mark Nudelman + * Copyright (C) 1984-2016 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. @@ -32,7 +32,7 @@ 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(int action); +static int cmd_complete(); /* * These variables are statics used by cmd_complete. */ @@ -114,7 +114,7 @@ static int cmd_mbc_buf_index; * Reset command buffer (to empty). */ public void -cmd_reset(void) +cmd_reset() { cp = cmdbuf; *cp = '\0'; @@ -129,7 +129,7 @@ cmd_reset(void) * Clear command line. */ public void -clear_cmd(void) +clear_cmd() { cmd_col = prompt_col = 0; cmd_mbc_buf_len = 0; @@ -140,28 +140,27 @@ clear_cmd(void) * Display a string, usually as a prompt for input into the command buffer. */ public void -cmd_putstr(constant char *s) +cmd_putstr(s) + char *s; { LWCHAR prev_ch = 0; LWCHAR ch; - constant char *endline = s + strlen(s); + char *endline = s + strlen(s); while (*s != '\0') { - constant char *ns = s; + char *ns = s; + int width; ch = step_char(&ns, +1, endline); while (s < ns) putchr(*s++); if (!utf_mode) - { - cmd_col++; - prompt_col++; - } else if (!is_composing_char(ch) && - !is_combining_char(prev_ch, ch)) - { - int width = is_wide_char(ch) ? 2 : 1; - cmd_col += width; - prompt_col += width; - } + width = 1; + else if (is_composing_char(ch) || is_combining_char(prev_ch, ch)) + width = 0; + else + width = is_wide_char(ch) ? 2 : 1; + cmd_col += width; + prompt_col += width; prev_ch = ch; } } @@ -170,10 +169,10 @@ cmd_putstr(constant char *s) * How many characters are in the command buffer? */ public int -len_cmdbuf(void) +len_cmdbuf() { - constant char *s = cmdbuf; - constant char *endline = s + strlen(s); + char *s = cmdbuf; + char *endline = s + strlen(s); int len = 0; while (*s != '\0') @@ -186,63 +185,44 @@ len_cmdbuf(void) /* * Common part of cmd_step_right() and cmd_step_left(). + * {{ Returning pwidth and bswidth separately is a historical artifact + * since they're always the same. Maybe clean this up someday. }} */ static char * -cmd_step_common(constant char *p, LWCHAR ch, int len, int *pwidth, int *bswidth) +cmd_step_common(p, ch, len, pwidth, bswidth) + char *p; + LWCHAR ch; + int len; + int *pwidth; + int *bswidth; { char *pr; + int width; if (len == 1) { pr = prchar((int) ch); - if (pwidth != NULL || bswidth != NULL) - { - int len = (int) strlen(pr); - if (pwidth != NULL) - *pwidth = len; - if (bswidth != NULL) - *bswidth = len; - } + width = (int) strlen(pr); } else { pr = prutfchar(ch); - if (pwidth != NULL || bswidth != NULL) + if (is_composing_char(ch)) + width = 0; + else if (is_ubin_char(ch)) + width = (int) strlen(pr); + else { - if (is_composing_char(ch)) - { - if (pwidth != NULL) - *pwidth = 0; - if (bswidth != NULL) - *bswidth = 0; - } else if (is_ubin_char(ch)) - { - int len = (int) strlen(pr); - if (pwidth != NULL) - *pwidth = len; - if (bswidth != NULL) - *bswidth = len; - } else - { - LWCHAR prev_ch = step_char(&p, -1, cmdbuf); - if (is_combining_char(prev_ch, ch)) - { - if (pwidth != NULL) - *pwidth = 0; - if (bswidth != NULL) - *bswidth = 0; - } else - { - if (pwidth != NULL) - *pwidth = is_wide_char(ch) - ? 2 - : 1; - if (bswidth != NULL) - *bswidth = 1; - } - } + LWCHAR prev_ch = step_char(&p, -1, cmdbuf); + if (is_combining_char(prev_ch, ch)) + width = 0; + else + width = is_wide_char(ch) ? 2 : 1; } } - + if (pwidth != NULL) + *pwidth = width; + if (bswidth != NULL) + *bswidth = width; return (pr); } @@ -250,10 +230,13 @@ cmd_step_common(constant char *p, LWCHAR ch, int len, int *pwidth, int *bswidth) * Step a pointer one character right in the command buffer. */ static char * -cmd_step_right(char **pp, int *pwidth, int *bswidth) +cmd_step_right(pp, pwidth, bswidth) + char **pp; + int *pwidth; + int *bswidth; { char *p = *pp; - LWCHAR ch = step_char((constant char **)pp, +1, p + strlen(p)); + LWCHAR ch = step_char(pp, +1, p + strlen(p)); return cmd_step_common(p, ch, *pp - p, pwidth, bswidth); } @@ -262,10 +245,13 @@ cmd_step_right(char **pp, int *pwidth, int *bswidth) * Step a pointer one character left in the command buffer. */ static char * -cmd_step_left(char **pp, int *pwidth, int *bswidth) +cmd_step_left(pp, pwidth, bswidth) + char **pp; + int *pwidth; + int *bswidth; { char *p = *pp; - LWCHAR ch = step_char((constant char **)pp, -1, cmdbuf); + LWCHAR ch = step_char(pp, -1, cmdbuf); return cmd_step_common(*pp, ch, p - *pp, pwidth, bswidth); } @@ -275,7 +261,8 @@ cmd_step_left(char **pp, int *pwidth, int *bswidth) * Then position the cursor just after the char old_cp (a pointer into cmdbuf). */ static void -cmd_repaint(char *old_cp) +cmd_repaint(old_cp) + char *old_cp; { /* * Repaint the line from the current position. @@ -285,7 +272,7 @@ cmd_repaint(char *old_cp) { char *np = cp; int width; - constant char *pr = cmd_step_right(&np, &width, NULL); + char *pr = cmd_step_right(&np, &width, NULL); if (cmd_col + width >= sc_width) break; cp = np; @@ -315,7 +302,7 @@ cmd_repaint(char *old_cp) * and set cp to the corresponding char in cmdbuf. */ static void -cmd_home(void) +cmd_home() { while (cmd_col > prompt_col) { @@ -334,7 +321,7 @@ cmd_home(void) * Shift the cmdbuf display left a half-screen. */ static void -cmd_lshift(void) +cmd_lshift() { char *s; char *save_cp; @@ -372,7 +359,7 @@ cmd_lshift(void) * Shift the cmdbuf display right a half-screen. */ static void -cmd_rshift(void) +cmd_rshift() { char *s; char *save_cp; @@ -402,7 +389,7 @@ cmd_rshift(void) * Move cursor right one character. */ static int -cmd_right(void) +cmd_right() { char *pr; char *ncp; @@ -437,7 +424,7 @@ cmd_right(void) * Move cursor left one character. */ static int -cmd_left(void) +cmd_left() { char *ncp; int width, bswidth; @@ -467,7 +454,9 @@ cmd_left(void) * Insert a char into the command buffer, at the current position. */ static int -cmd_ichar(char *cs, int clen) +cmd_ichar(cs, clen) + char *cs; + int clen; { char *s; @@ -502,9 +491,9 @@ cmd_ichar(char *cs, int clen) * Delete the char to the left of the cursor. */ static int -cmd_erase(void) +cmd_erase() { - char *s; + register char *s; int clen; if (cp == cmdbuf) @@ -551,7 +540,7 @@ cmd_erase(void) * Delete the char under the cursor. */ static int -cmd_delete(void) +cmd_delete() { if (*cp == '\0') { @@ -570,7 +559,7 @@ cmd_delete(void) * Delete the "word" to the left of the cursor. */ static int -cmd_werase(void) +cmd_werase() { if (cp > cmdbuf && cp[-1] == ' ') { @@ -596,7 +585,7 @@ cmd_werase(void) * Delete the "word" under the cursor. */ static int -cmd_wdelete(void) +cmd_wdelete() { if (*cp == ' ') { @@ -622,7 +611,7 @@ cmd_wdelete(void) * Delete all chars in the command buffer. */ static int -cmd_kill(void) +cmd_kill() { if (cmdbuf[0] == '\0') { @@ -648,7 +637,9 @@ cmd_kill(void) * Select an mlist structure to be the current command history. */ public void -set_mlist(constant void *mlist, int cmdflags) +set_mlist(mlist, cmdflags) + void *mlist; + int cmdflags; { #if CMD_HISTORY curr_mlist = (struct mlist *) mlist; @@ -667,7 +658,8 @@ set_mlist(constant void *mlist, int cmdflags) * cmdbuf's corresponding chars. */ static int -cmd_updown(int action) +cmd_updown(action) + int action; { char *s; struct mlist *ml; @@ -729,7 +721,10 @@ cmd_updown(int action) * Add a string to an mlist. */ public void -cmd_addhist(struct mlist *constant mlist, char *cmd, int modified) +cmd_addhist(mlist, cmd, modified) + struct mlist *mlist; + char *cmd; + int modified; { #if CMD_HISTORY struct mlist *ml; @@ -772,7 +767,7 @@ cmd_addhist(struct mlist *constant mlist, char *cmd, int modified) * Add it to the currently selected history list. */ public void -cmd_accept(void) +cmd_accept() { #if CMD_HISTORY /* @@ -794,7 +789,8 @@ cmd_accept(void) * CC_QUIT The char requests the current command to be aborted. */ static int -cmd_edit(int c) +cmd_edit(c) + int c; { int action; int flags; @@ -909,7 +905,8 @@ cmd_edit(int c) * Insert a string into the command buffer, at the current position. */ static int -cmd_istr(char *str) +cmd_istr(str) + char *str; { char *s; int action; @@ -918,7 +915,7 @@ cmd_istr(char *str) for (s = str; *s != '\0'; ) { char *os = s; - step_char((constant char **)&s, +1, endline); + step_char(&s, +1, endline); action = cmd_ichar(os, s - os); if (action != CC_OK) { @@ -936,7 +933,7 @@ cmd_istr(char *str) * cursor at the end of the word. */ static char * -delimit_word(void) +delimit_word() { char *word; #if SPACES_IN_FILENAMES @@ -1023,7 +1020,7 @@ delimit_word(void) * which start with that word, and set tk_text to that list. */ static void -init_compl(void) +init_compl() { char *word; char c; @@ -1086,7 +1083,9 @@ init_compl(void) * Return the next word in the current completion list. */ static char * -next_compl(int action, char *prev) +next_compl(action, prev) + int action; + char *prev; { switch (action) { @@ -1106,7 +1105,8 @@ next_compl(int action, char *prev) * or a subsequent time (step thru the list). */ static int -cmd_complete(int action) +cmd_complete(action) + int action; { char *s; @@ -1203,7 +1203,8 @@ fail: * CC_ERROR The char could not be accepted due to an error. */ public int -cmd_char(int c) +cmd_char(c) + int c; { int action; int len; @@ -1292,7 +1293,8 @@ cmd_char(int c) * Return the number currently in the command buffer. */ public LINENUM -cmd_int(long *frac) +cmd_int(frac) + long *frac; { char *p; LINENUM n = 0; @@ -1313,7 +1315,7 @@ cmd_int(long *frac) * Return a pointer to the command buffer. */ public char * -get_cmdbuf(void) +get_cmdbuf() { return (cmdbuf); } @@ -1323,7 +1325,7 @@ get_cmdbuf(void) * Return the last (most recent) string in the current command history. */ public char * -cmd_lastpattern(void) +cmd_lastpattern() { if (curr_mlist == NULL) return (NULL); @@ -1335,7 +1337,8 @@ cmd_lastpattern(void) /* */ static int -mlist_size(struct mlist *ml) +mlist_size(ml) + struct mlist *ml; { int size = 0; for (ml = ml->next; ml->string != NULL; ml = ml->next) @@ -1347,7 +1350,7 @@ mlist_size(struct mlist *ml) * Get the name of the history file. */ static char * -histfile_name(void) +histfile_name() { char *home; char *name; @@ -1387,8 +1390,11 @@ histfile_name(void) * Read a .lesshst file and call a callback for each line in the file. */ static void -read_cmdhist2(void (*action)(void*,struct mlist*,char*), void *uparam, - int skip_search, int skip_shell) +read_cmdhist2(action, uparam, skip_search, skip_shell) + void (*action)(void*,struct mlist*,char*); + void *uparam; + int skip_search; + int skip_shell; { struct mlist *ml = NULL; char line[CMDBUF_SIZE]; @@ -1448,8 +1454,11 @@ read_cmdhist2(void (*action)(void*,struct mlist*,char*), void *uparam, } static void -read_cmdhist(void (*action)(void*,struct mlist*,char*), void *uparam, - int skip_search, int skip_shell) +read_cmdhist(action, uparam, skip_search, skip_shell) + void (*action)(void*,struct mlist*,char*); + void *uparam; + int skip_search; + int skip_shell; { read_cmdhist2(action, uparam, skip_search, skip_shell); (*action)(uparam, NULL, NULL); /* signal end of file */ @@ -1468,7 +1477,7 @@ addhist_init(void *uparam, struct mlist *ml, char *string) * Initialize history from a .lesshist file. */ public void -init_cmdhist(void) +init_cmdhist() { #if CMD_HISTORY read_cmdhist(&addhist_init, NULL, 0, 0); @@ -1480,7 +1489,9 @@ init_cmdhist(void) */ #if CMD_HISTORY static void -write_mlist_header(struct mlist *ml, FILE *f) +write_mlist_header(ml, f) + struct mlist *ml; + FILE *f; { if (ml == &mlist_search) fprintf(f, "%s\n", HISTFILE_SEARCH_SECTION); @@ -1494,7 +1505,9 @@ write_mlist_header(struct mlist *ml, FILE *f) * Write all modified entries in an mlist to the history file. */ static void -write_mlist(struct mlist *ml, FILE *f) +write_mlist(ml, f) + struct mlist *ml; + FILE *f; { for (ml = ml->next; ml->string != NULL; ml = ml->next) { @@ -1510,7 +1523,8 @@ write_mlist(struct mlist *ml, FILE *f) * Make a temp name in the same directory as filename. */ static char * -make_tempname(char *filename) +make_tempname(filename) + char *filename; { char lastch; char *tempname = ecalloc(1, strlen(filename)+1); @@ -1573,7 +1587,8 @@ copy_hist(void *uparam, struct mlist *ml, char *string) * Make a file readable only by its owner. */ static void -make_file_private(FILE *f) +make_file_private(f) + FILE *f; { #if HAVE_FCHMOD int do_chmod = 1; @@ -1593,7 +1608,7 @@ make_file_private(FILE *f) * Does the history file need to be updated? */ static int -histfile_modified(void) +histfile_modified() { if (mlist_search.modified) return 1; @@ -1608,7 +1623,7 @@ histfile_modified(void) * Update the .lesshst file. */ public void -save_cmdhist(void) +save_cmdhist() { #if CMD_HISTORY char *histname; diff --git a/command.c b/command.c index 34f636af4d0a..955a18fbdeac 100644 --- a/command.c +++ b/command.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2015 Mark Nudelman + * Copyright (C) 1984-2016 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. @@ -82,7 +82,7 @@ struct ungot { }; static struct ungot* ungot = NULL; -static void multi_search(char *pattern, int n, int silent); +static void multi_search(); /* * Move the cursor to start of prompt line before executing a command. @@ -90,7 +90,7 @@ static void multi_search(char *pattern, int n, int silent); * updating the screen. */ static void -cmd_exec(void) +cmd_exec() { #if HILITE_SEARCH clear_attn(); @@ -103,7 +103,11 @@ cmd_exec(void) * Set up the display to start a new multi-character command. */ static void -start_mca(int action, constant char *prompt, constant void *mlist, int cmdflags) +start_mca(action, prompt, mlist, cmdflags) + int action; + constant char *prompt; + constant void *mlist; + int cmdflags; { mca = action; clear_bot(); @@ -113,7 +117,7 @@ start_mca(int action, constant char *prompt, constant void *mlist, int cmdflags) } public int -in_mca(void) +in_mca() { return (mca != 0 && mca != A_PREFIX); } @@ -122,7 +126,7 @@ in_mca(void) * Set up the display to start a new search command. */ static void -mca_search(void) +mca_search() { #if HILITE_SEARCH if (search_type & SRCH_FILTER) @@ -165,7 +169,7 @@ mca_search(void) * Set up the display to start a new toggle-option command. */ static void -mca_opt_toggle(void) +mca_opt_toggle() { int no_prompt; int flag; @@ -200,9 +204,9 @@ mca_opt_toggle(void) * Execute a multicharacter command. */ static void -exec_mca(void) +exec_mca() { - char *cbuf; + register char *cbuf; cmd_exec(); cbuf = get_cmdbuf(); @@ -290,7 +294,8 @@ exec_mca(void) * Is a character an erase or kill char? */ static int -is_erase_char(int c) +is_erase_char(c) + int c; { return (c == erase_char || c == erase2_char || c == kill_char); } @@ -299,7 +304,8 @@ is_erase_char(int c) * Handle the first char of an option (after the initial dash). */ static int -mca_opt_first_char(int c) +mca_opt_first_char(c) + int c; { int flag = (optflag & ~OPT_NO_PROMPT); if (flag == OPT_NO_TOGGLE) @@ -350,7 +356,8 @@ mca_opt_first_char(int c) * accepting chars until user hits RETURN. */ static int -mca_opt_nonfirst_char(int c) +mca_opt_nonfirst_char(c) + int c; { char *p; char *oname; @@ -399,7 +406,8 @@ mca_opt_nonfirst_char(int c) * Handle a char of an option toggle command. */ static int -mca_opt_char(int c) +mca_opt_char(c) + int c; { PARG parg; @@ -464,7 +472,8 @@ mca_opt_char(int c) * Handle a char of a search command. */ static int -mca_search_char(int c) +mca_search_char(c) + int c; { int flag = 0; @@ -516,7 +525,8 @@ mca_search_char(int c) * Handle a character of a multi-character command. */ static int -mca_char(int c) +mca_char(c) + int c; { int ret; @@ -618,7 +628,7 @@ mca_char(int c) * Discard any buffered file data. */ static void -clear_buffers(void) +clear_buffers() { if (!(ch_getflags() & CH_CANSEEK)) return; @@ -633,7 +643,7 @@ clear_buffers(void) * Make sure the screen is displayed. */ static void -make_display(void) +make_display() { /* * If nothing is displayed yet, display starting from initial_scrpos. @@ -673,9 +683,9 @@ make_display(void) * Display the appropriate prompt. */ static void -prompt(void) +prompt() { - constant char *p; + register constant char *p; if (ungot != NULL && !ungot->ug_end_command) { @@ -750,7 +760,7 @@ prompt(void) * Display the less version message. */ public void -dispversion(void) +dispversion() { PARG parg; @@ -765,7 +775,7 @@ dispversion(void) * (characters previously given to ungetcc or ungetsc). */ public int -getcc(void) +getcc() { if (ungot == NULL) { @@ -820,7 +830,8 @@ getcc(void) * The next getcc() will return this character. */ public void -ungetcc(int c) +ungetcc(c) + int c; { struct ungot *ug = (struct ungot *) ecalloc(1, sizeof(struct ungot)); @@ -835,9 +846,10 @@ ungetcc(int c) * The next sequence of getcc()'s will return this string. */ public void -ungetsc(char *s) +ungetsc(s) + char *s; { - char *p; + register char *p; for (p = s + strlen(s) - 1; p >= s; p--) ungetcc(*p); @@ -849,9 +861,12 @@ ungetsc(char *s) * If SRCH_PAST_EOF is set, continue the search thru multiple files. */ static void -multi_search(char *pattern, int n, int silent) +multi_search(pattern, n, silent) + char *pattern; + int n; + int silent; { - int nomore; + register int nomore; IFILE save_ifile; int changed_file; @@ -943,7 +958,8 @@ multi_search(char *pattern, int n, int silent) * Forward forever, or until a highlighted line appears. */ static int -forw_loop(int until_hilite) +forw_loop(until_hilite) + int until_hilite; { POSITION curr_len; @@ -983,11 +999,11 @@ forw_loop(int until_hilite) * Accept and execute commands until a quit command. */ public void -commands(void) +commands() { - int c; - int action; - char *cbuf; + register int c; + register int action; + register char *cbuf; int newaction; int save_search_type; char *extra; @@ -1763,6 +1779,16 @@ commands(void) screen_trashed = 1; break; + case A_LLSHIFT: + hshift = 0; + screen_trashed = 1; + break; + + case A_RRSHIFT: + hshift = rrshift(); + screen_trashed = 1; + break; + case A_PREFIX: /* * The command is incomplete (more chars are needed). diff --git a/compose.uni b/compose.uni index b814ce9916ae..e3e1fa4017eb 100644 --- a/compose.uni +++ b/compose.uni @@ -1,4 +1,4 @@ -/* Generated by "./mkutable -f2 Mn Me -- unicode/UnicodeData.txt" on Mon Jul 14 16:21:21 PDT 2014 */ +/* Generated by "./mkutable -f2 Mn Me -- unicode/UnicodeData.txt" on Tue Sep 20 10:51:43 PDT 2016 */ { 0x0300, 0x036f }, /* Mn */ { 0x0483, 0x0487 }, /* Mn */ { 0x0488, 0x0489 }, /* Me */ @@ -23,7 +23,8 @@ { 0x0825, 0x0827 }, /* Mn */ { 0x0829, 0x082d }, /* Mn */ { 0x0859, 0x085b }, /* Mn */ - { 0x08e4, 0x0902 }, /* Mn */ + { 0x08d4, 0x08e1 }, /* Mn */ + { 0x08e3, 0x0902 }, /* Mn */ { 0x093a, 0x093a }, /* Mn */ { 0x093c, 0x093c }, /* Mn */ { 0x0941, 0x0948 }, /* Mn */ @@ -117,6 +118,7 @@ { 0x17c9, 0x17d3 }, /* Mn */ { 0x17dd, 0x17dd }, /* Mn */ { 0x180b, 0x180d }, /* Mn */ + { 0x1885, 0x1886 }, /* Mn */ { 0x18a9, 0x18a9 }, /* Mn */ { 0x1920, 0x1922 }, /* Mn */ { 0x1927, 0x1928 }, /* Mn */ @@ -156,7 +158,7 @@ { 0x1cf4, 0x1cf4 }, /* Mn */ { 0x1cf8, 0x1cf9 }, /* Mn */ { 0x1dc0, 0x1df5 }, /* Mn */ - { 0x1dfc, 0x1dff }, /* Mn */ + { 0x1dfb, 0x1dff }, /* Mn */ { 0x20d0, 0x20dc }, /* Mn */ { 0x20dd, 0x20e0 }, /* Me */ { 0x20e1, 0x20e1 }, /* Mn */ @@ -170,13 +172,13 @@ { 0xa66f, 0xa66f }, /* Mn */ { 0xa670, 0xa672 }, /* Me */ { 0xa674, 0xa67d }, /* Mn */ - { 0xa69f, 0xa69f }, /* Mn */ + { 0xa69e, 0xa69f }, /* Mn */ { 0xa6f0, 0xa6f1 }, /* Mn */ { 0xa802, 0xa802 }, /* Mn */ { 0xa806, 0xa806 }, /* Mn */ { 0xa80b, 0xa80b }, /* Mn */ { 0xa825, 0xa826 }, /* Mn */ - { 0xa8c4, 0xa8c4 }, /* Mn */ + { 0xa8c4, 0xa8c5 }, /* Mn */ { 0xa8e0, 0xa8f1 }, /* Mn */ { 0xa926, 0xa92d }, /* Mn */ { 0xa947, 0xa951 }, /* Mn */ @@ -203,7 +205,7 @@ { 0xabed, 0xabed }, /* Mn */ { 0xfb1e, 0xfb1e }, /* Mn */ { 0xfe00, 0xfe0f }, /* Mn */ - { 0xfe20, 0xfe2d }, /* Mn */ + { 0xfe20, 0xfe2f }, /* Mn */ { 0x101fd, 0x101fd }, /* Mn */ { 0x102e0, 0x102e0 }, /* Mn */ { 0x10376, 0x1037a }, /* Mn */ @@ -224,16 +226,21 @@ { 0x11173, 0x11173 }, /* Mn */ { 0x11180, 0x11181 }, /* Mn */ { 0x111b6, 0x111be }, /* Mn */ + { 0x111ca, 0x111cc }, /* Mn */ { 0x1122f, 0x11231 }, /* Mn */ { 0x11234, 0x11234 }, /* Mn */ { 0x11236, 0x11237 }, /* Mn */ + { 0x1123e, 0x1123e }, /* Mn */ { 0x112df, 0x112df }, /* Mn */ { 0x112e3, 0x112ea }, /* Mn */ - { 0x11301, 0x11301 }, /* Mn */ + { 0x11300, 0x11301 }, /* Mn */ { 0x1133c, 0x1133c }, /* Mn */ { 0x11340, 0x11340 }, /* Mn */ { 0x11366, 0x1136c }, /* Mn */ { 0x11370, 0x11374 }, /* Mn */ + { 0x11438, 0x1143f }, /* Mn */ + { 0x11442, 0x11444 }, /* Mn */ + { 0x11446, 0x11446 }, /* Mn */ { 0x114b3, 0x114b8 }, /* Mn */ { 0x114ba, 0x114ba }, /* Mn */ { 0x114bf, 0x114c0 }, /* Mn */ @@ -241,6 +248,7 @@ { 0x115b2, 0x115b5 }, /* Mn */ { 0x115bc, 0x115bd }, /* Mn */ { 0x115bf, 0x115c0 }, /* Mn */ + { 0x115dc, 0x115dd }, /* Mn */ { 0x11633, 0x1163a }, /* Mn */ { 0x1163d, 0x1163d }, /* Mn */ { 0x1163f, 0x11640 }, /* Mn */ @@ -248,6 +256,16 @@ { 0x116ad, 0x116ad }, /* Mn */ { 0x116b0, 0x116b5 }, /* Mn */ { 0x116b7, 0x116b7 }, /* Mn */ + { 0x1171d, 0x1171f }, /* Mn */ + { 0x11722, 0x11725 }, /* Mn */ + { 0x11727, 0x1172b }, /* Mn */ + { 0x11c30, 0x11c36 }, /* Mn */ + { 0x11c38, 0x11c3d }, /* Mn */ + { 0x11c3f, 0x11c3f }, /* Mn */ + { 0x11c92, 0x11ca7 }, /* Mn */ + { 0x11caa, 0x11cb0 }, /* Mn */ + { 0x11cb2, 0x11cb3 }, /* Mn */ + { 0x11cb5, 0x11cb6 }, /* Mn */ { 0x16af0, 0x16af4 }, /* Mn */ { 0x16b30, 0x16b36 }, /* Mn */ { 0x16f8f, 0x16f92 }, /* Mn */ @@ -257,5 +275,17 @@ { 0x1d185, 0x1d18b }, /* Mn */ { 0x1d1aa, 0x1d1ad }, /* Mn */ { 0x1d242, 0x1d244 }, /* Mn */ + { 0x1da00, 0x1da36 }, /* Mn */ + { 0x1da3b, 0x1da6c }, /* Mn */ + { 0x1da75, 0x1da75 }, /* Mn */ + { 0x1da84, 0x1da84 }, /* Mn */ + { 0x1da9b, 0x1da9f }, /* Mn */ + { 0x1daa1, 0x1daaf }, /* Mn */ + { 0x1e000, 0x1e006 }, /* Mn */ + { 0x1e008, 0x1e018 }, /* Mn */ + { 0x1e01b, 0x1e021 }, /* Mn */ + { 0x1e023, 0x1e024 }, /* Mn */ + { 0x1e026, 0x1e02a }, /* Mn */ { 0x1e8d0, 0x1e8d6 }, /* Mn */ + { 0x1e944, 0x1e94a }, /* Mn */ { 0xe0100, 0xe01ef }, /* Mn */ diff --git a/configure b/configure index 234aec49f749..53b4634d07ab 100755 --- a/configure +++ b/configure @@ -1305,10 +1305,10 @@ Optional Features: Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) - --with-secure Compile in secure mode - --with-no-float Do not use floating point - --with-regex={auto,gnu,pcre,posix,regcmp,re_comp,regcomp,regcomp-local,none} Select a regular expression library auto - --with-editor=PROGRAM use PROGRAM as the default editor vi + --with-secure Compile in secure mode + --with-no-float Do not use floating point + --with-regex=LIB select regular expression library (LIB is one of auto,none,gnu,pcre,posix,regcmp,re_comp,regcomp,regcomp-local) [auto] + --with-editor=PROGRAM use PROGRAM as the default editor [vi] Some influential environment variables: CC C compiler command diff --git a/configure.ac b/configure.ac index 4ac9a351ddd6..42bdd6b2cbd0 100644 --- a/configure.ac +++ b/configure.ac @@ -365,13 +365,13 @@ fi # Compile in secure mode? AC_ARG_WITH(secure, - [ --with-secure Compile in secure mode], + [ --with-secure Compile in secure mode], AC_DEFINE(SECURE_COMPILE, 1), AC_DEFINE(SECURE_COMPILE, 0)) # Should we use floating point? AC_MSG_CHECKING(for floating point) AC_ARG_WITH(no-float, - [ --with-no-float Do not use floating point], + [ --with-no-float Do not use floating point], WANT_NO_FLOAT=1, WANT_NO_FLOAT=0) if test $WANT_NO_FLOAT = 0; then AC_TRY_LINK(, [double f1 = 12.5; double f2 = f1*f1/2.5;], @@ -388,7 +388,7 @@ supported_regex="" # Select a regular expression library. WANT_REGEX=auto AC_ARG_WITH(regex, - [ --with-regex={auto,gnu,pcre,posix,regcmp,re_comp,regcomp,regcomp-local,none} Select a regular expression library [auto]], + [ --with-regex=LIB select regular expression library (LIB is one of auto,none,gnu,pcre,posix,regcmp,re_comp,regcomp,regcomp-local) [[auto]]], WANT_REGEX="$withval") if test $have_regex = no; then @@ -484,7 +484,7 @@ fi AC_MSG_RESULT(regular expression library: $supported_regex) AC_ARG_WITH(editor, - [ --with-editor=PROGRAM use PROGRAM as the default editor [vi]], + [ --with-editor=PROGRAM use PROGRAM as the default editor [[vi]]], AC_DEFINE_UNQUOTED(EDIT_PGM, "$withval"), AC_DEFINE(EDIT_PGM, "vi")) AH_TOP([ @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2015 Mark Nudelman + * Copyright (C) 1984-2016 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. @@ -20,7 +20,9 @@ extern int utf_mode; * Get the length of a buffer needed to convert a string. */ public int -cvt_length(int len, int ops) +cvt_length(len, ops) + int len; + int ops; { if (utf_mode) /* @@ -36,7 +38,8 @@ cvt_length(int len, int ops) * Allocate a chpos array for use by cvt_text. */ public int * -cvt_alloc_chpos(int len) +cvt_alloc_chpos(len) + int len; { int i; int *chpos = (int *) ecalloc(sizeof(int), len); @@ -52,12 +55,17 @@ cvt_alloc_chpos(int len) * odst character (when it was in osrc) is returned in the chpos array. */ public void -cvt_text(char *odst, char *osrc, int *chpos, int *lenp, int ops) +cvt_text(odst, osrc, chpos, lenp, ops) + char *odst; + char *osrc; + int *chpos; + int *lenp; + int ops; { char *dst; char *edst = odst; char *src; - char *src_end; + register char *src_end; LWCHAR ch; if (lenp != NULL) @@ -69,7 +77,7 @@ cvt_text(char *odst, char *osrc, int *chpos, int *lenp, int ops) { int src_pos = (int) (src - osrc); int dst_pos = (int) (dst - odst); - ch = step_char((constant char **)&src, +1, src_end); + ch = step_char(&src, +1, src_end); if ((ops & CVT_BS) && ch == '\b' && dst > odst) { /* Delete backspace and preceding char. */ @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2015 Mark Nudelman + * Copyright (C) 1984-2016 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. @@ -94,8 +94,12 @@ static unsigned char cmdtable[] = ESC,']',0, A_RSHIFT, ESC,'(',0, A_LSHIFT, ESC,')',0, A_RSHIFT, + ESC,'{',0, A_LLSHIFT, + ESC,'}',0, A_RRSHIFT, SK(SK_RIGHT_ARROW),0, A_RSHIFT, SK(SK_LEFT_ARROW),0, A_LSHIFT, + SK(SK_CTL_RIGHT_ARROW),0, A_RRSHIFT, + SK(SK_CTL_LEFT_ARROW),0, A_LLSHIFT, '{',0, A_F_BRACKET|A_EXTRA, '{','}',0, '}',0, A_B_BRACKET|A_EXTRA, '{','}',0, '(',0, A_F_BRACKET|A_EXTRA, '(',')',0, @@ -229,11 +233,13 @@ static struct tablelist *list_sysvar_tables = NULL; * Expand special key abbreviations in a command table. */ static void -expand_special_keys(char *table, int len) +expand_special_keys(table, len) + char *table; + int len; { - char *fm; - char *to; - int a; + register char *fm; + register char *to; + register int a; char *repl; int klen; @@ -288,7 +294,7 @@ expand_special_keys(char *table, int len) * Initialize the command lists. */ public void -init_cmds(void) +init_cmds() { /* * Add the default command tables. @@ -318,9 +324,12 @@ init_cmds(void) * Add a command table. */ static int -add_cmd_table(struct tablelist **tlist, char *buf, int len) +add_cmd_table(tlist, buf, len) + struct tablelist **tlist; + char *buf; + int len; { - struct tablelist *t; + register struct tablelist *t; if (len == 0) return (0); @@ -345,7 +354,9 @@ add_cmd_table(struct tablelist **tlist, char *buf, int len) * Add a command table. */ public void -add_fcmd_table(char *buf, int len) +add_fcmd_table(buf, len) + char *buf; + int len; { if (add_cmd_table(&list_fcmd_tables, buf, len) < 0) error("Warning: some commands disabled", NULL_PARG); @@ -355,7 +366,9 @@ add_fcmd_table(char *buf, int len) * Add an editing command table. */ public void -add_ecmd_table(char *buf, int len) +add_ecmd_table(buf, len) + char *buf; + int len; { if (add_cmd_table(&list_ecmd_tables, buf, len) < 0) error("Warning: some edit commands disabled", NULL_PARG); @@ -365,7 +378,10 @@ add_ecmd_table(char *buf, int len) * Add an environment variable table. */ static void -add_var_table(struct tablelist **tlist, char *buf, int len) +add_var_table(tlist, buf, len) + struct tablelist **tlist; + char *buf; + int len; { if (add_cmd_table(tlist, buf, len) < 0) error("Warning: environment variables from lesskey file unavailable", NULL_PARG); @@ -375,11 +391,15 @@ add_var_table(struct tablelist **tlist, char *buf, int len) * Search a single command table for the command string in cmd. */ static int -cmd_search(char *cmd, char *table, char *endtable, char **sp) +cmd_search(cmd, table, endtable, sp) + char *cmd; + char *table; + char *endtable; + char **sp; { - char *p; - char *q; - int a; + register char *p; + register char *q; + register int a; *sp = NULL; for (p = table, q = cmd; p < endtable; p++, q++) @@ -463,10 +483,13 @@ cmd_search(char *cmd, char *table, char *endtable, char **sp) * The "extra" string, if any, is returned in sp. */ static int -cmd_decode(struct tablelist *tlist, char *cmd, char **sp) +cmd_decode(tlist, cmd, sp) + struct tablelist *tlist; + char *cmd; + char **sp; { - struct tablelist *t; - int action = A_INVALID; + register struct tablelist *t; + register int action = A_INVALID; /* * Search thru all the command tables. @@ -487,7 +510,9 @@ cmd_decode(struct tablelist *tlist, char *cmd, char **sp) * Decode a command from the cmdtables list. */ public int -fcmd_decode(char *cmd, char **sp) +fcmd_decode(cmd, sp) + char *cmd; + char **sp; { return (cmd_decode(list_fcmd_tables, cmd, sp)); } @@ -496,7 +521,9 @@ fcmd_decode(char *cmd, char **sp) * Decode a command from the edittables list. */ public int -ecmd_decode(char *cmd, char **sp) +ecmd_decode(cmd, sp) + char *cmd; + char **sp; { return (cmd_decode(list_ecmd_tables, cmd, sp)); } @@ -506,7 +533,8 @@ ecmd_decode(char *cmd, char **sp) * Looks first in the lesskey file, then in the real environment. */ public char * -lgetenv(char *var) +lgetenv(var) + char *var; { int a; char *s; @@ -530,7 +558,8 @@ lgetenv(char *var) * two bytes, low order first, in radix KRADIX. */ static int -gint(char **sp) +gint(sp) + char **sp; { int n; @@ -543,7 +572,9 @@ gint(char **sp) * Process an old (pre-v241) lesskey file. */ static int -old_lesskey(char *buf, int len) +old_lesskey(buf, len) + char *buf; + int len; { /* * Old-style lesskey file. @@ -562,11 +593,14 @@ old_lesskey(char *buf, int len) * Process a new (post-v241) lesskey file. */ static int -new_lesskey(char *buf, int len, int sysvar) +new_lesskey(buf, len, sysvar) + char *buf; + int len; + int sysvar; { char *p; - int c; - int n; + register int c; + register int n; /* * New-style lesskey file. @@ -613,12 +647,14 @@ new_lesskey(char *buf, int len, int sysvar) * Set up a user command table, based on a "lesskey" file. */ public int -lesskey(char *filename, int sysvar) +lesskey(filename, sysvar) + char *filename; + int sysvar; { - char *buf; - POSITION len; - long n; - int f; + register char *buf; + register POSITION len; + register long n; + register int f; if (secure) return (1); @@ -681,7 +717,10 @@ lesskey(char *filename, int sysvar) * Add the standard lesskey file "$HOME/.less" */ public void -add_hometable(char *envname, char *def_filename, int sysvar) +add_hometable(envname, def_filename, sysvar) + char *envname; + char *def_filename; + int sysvar; { char *filename; PARG parg; @@ -707,7 +746,9 @@ add_hometable(char *envname, char *def_filename, int sysvar) * See if a char is a special line-editing command. */ public int -editchar(int c, int flags) +editchar(c, flags) + int c; + int flags; { int action; int nch; diff --git a/defines.ds b/defines.ds index 6ef2771ab5fa..6009129db2a5 100644 --- a/defines.ds +++ b/defines.ds @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2015 Mark Nudelman + * Copyright (C) 1984-2016 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/defines.o2 b/defines.o2 index f58693f5af4a..615686b8a80a 100644 --- a/defines.o2 +++ b/defines.o2 @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2015 Mark Nudelman + * Copyright (C) 1984-2016 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/defines.o9 b/defines.o9 index 9ebc636428ae..2e7b95745713 100644 --- a/defines.o9 +++ b/defines.o9 @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2015 Mark Nudelman + * Copyright (C) 1984-2016 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/defines.wn b/defines.wn index f37911d7daac..6d6e242df0cb 100644 --- a/defines.wn +++ b/defines.wn @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2015 Mark Nudelman + * Copyright (C) 1984-2016 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. @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2015 Mark Nudelman + * Copyright (C) 1984-2016 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 sigs; extern IFILE curr_ifile; extern IFILE old_ifile; extern struct scrpos initial_scrpos; -extern void * constant ml_examine; +extern void constant *ml_examine; #if SPACES_IN_FILENAMES extern char openquote; extern char closequote; @@ -55,7 +55,9 @@ static void *curr_altpipe; * back_textlist does the same, but runs thru the list backwards. */ public void -init_textlist(struct textlist *tlist, char *str) +init_textlist(tlist, str) + struct textlist *tlist; + char *str; { char *s; #if SPACES_IN_FILENAMES @@ -97,7 +99,9 @@ init_textlist(struct textlist *tlist, char *str) } public char * -forw_textlist(struct textlist *tlist, char *prev) +forw_textlist(tlist, prev) + struct textlist *tlist; + char *prev; { char *s; @@ -119,7 +123,9 @@ forw_textlist(struct textlist *tlist, char *prev) } public char * -back_textlist(struct textlist *tlist, char *prev) +back_textlist(tlist, prev) + struct textlist *tlist; + char *prev; { char *s; @@ -146,7 +152,7 @@ back_textlist(struct textlist *tlist, char *prev) * Close the current input file. */ static void -close_file(void) +close_file() { struct scrpos scrpos; @@ -190,7 +196,8 @@ close_file(void) * Filename == NULL means just close the current file. */ public int -edit(char *filename) +edit(filename) + char *filename; { if (filename == NULL) return (edit_ifile(NULL_IFILE)); @@ -202,7 +209,8 @@ edit(char *filename) * ifile == NULL means just close the current file. */ public int -edit_ifile(IFILE ifile) +edit_ifile(ifile) + IFILE ifile; { int f; int answer; @@ -452,7 +460,8 @@ edit_ifile(IFILE ifile) * Then edit the first one. */ public int -edit_list(char *filelist) +edit_list(filelist) + char *filelist; { IFILE save_ifile; char *good_filename; @@ -509,7 +518,7 @@ edit_list(char *filelist) * Edit the first file in the command line (ifile) list. */ public int -edit_first(void) +edit_first() { curr_ifile = NULL_IFILE; return (edit_next(1)); @@ -519,7 +528,7 @@ edit_first(void) * Edit the last file in the command line (ifile) list. */ public int -edit_last(void) +edit_last() { curr_ifile = NULL_IFILE; return (edit_prev(1)); @@ -530,7 +539,10 @@ edit_last(void) * Edit the n-th next or previous file in the command line (ifile) list. */ static int -edit_istep(IFILE h, int n, int dir) +edit_istep(h, n, dir) + IFILE h; + int n; + int dir; { IFILE next; @@ -569,25 +581,31 @@ edit_istep(IFILE h, int n, int dir) } static int -edit_inext(IFILE h, int n) +edit_inext(h, n) + IFILE h; + int n; { return (edit_istep(h, n, +1)); } public int -edit_next(int n) +edit_next(n) + int n; { return edit_istep(curr_ifile, n, +1); } static int -edit_iprev(IFILE h, int n) +edit_iprev(h, n) + IFILE h; + int n; { return (edit_istep(h, n, -1)); } public int -edit_prev(int n) +edit_prev(n) + int n; { return edit_istep(curr_ifile, n, -1); } @@ -596,7 +614,8 @@ edit_prev(int n) * Edit a specific file in the command line (ifile) list. */ public int -edit_index(int n) +edit_index(n) + int n; { IFILE h; @@ -616,7 +635,7 @@ edit_index(int n) } public IFILE -save_curr_ifile(void) +save_curr_ifile() { if (curr_ifile != NULL_IFILE) hold_ifile(curr_ifile, 1); @@ -624,7 +643,8 @@ save_curr_ifile(void) } public void -unsave_ifile(IFILE save_ifile) +unsave_ifile(save_ifile) + IFILE save_ifile; { if (save_ifile != NULL_IFILE) hold_ifile(save_ifile, -1); @@ -634,7 +654,8 @@ unsave_ifile(IFILE save_ifile) * Reedit the ifile which was previously open. */ public void -reedit_ifile(IFILE save_ifile) +reedit_ifile(save_ifile) + IFILE save_ifile; { IFILE next; IFILE prev; @@ -667,7 +688,7 @@ reedit_ifile(IFILE save_ifile) } public void -reopen_curr_ifile(void) +reopen_curr_ifile() { IFILE save_ifile = save_curr_ifile(); close_file(); @@ -678,7 +699,7 @@ reopen_curr_ifile(void) * Edit standard input. */ public int -edit_stdin(void) +edit_stdin() { if (isatty(fd0)) { @@ -693,9 +714,9 @@ edit_stdin(void) * Used if standard output is not a tty. */ public void -cat_file(void) +cat_file() { - int c; + register int c; while ((c = ch_forw_get()) != EOI) putchr(c); @@ -710,10 +731,11 @@ cat_file(void) * We take care not to blindly overwrite an existing file. */ public void -use_logfile(char *filename) +use_logfile(filename) + char *filename; { - int exists; - int answer; + register int exists; + register int answer; PARG parg; if (ch_getflags() & CH_CANSEEK) diff --git a/filename.c b/filename.c index 715a96a85a78..62cc6e5a1134 100644 --- a/filename.c +++ b/filename.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2015 Mark Nudelman + * Copyright (C) 1984-2016 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. @@ -63,7 +63,8 @@ extern char closequote; * Remove quotes around a filename. */ public char * -shell_unquote(char *str) +shell_unquote(str) + char *str; { char *name; char *p; @@ -101,7 +102,7 @@ shell_unquote(char *str) * Get the shell's escape character. */ public char * -get_meta_escape(void) +get_meta_escape() { char *s; @@ -115,7 +116,7 @@ get_meta_escape(void) * Get the characters which the shell considers to be "metacharacters". */ static char * -metachars(void) +metachars() { static char *mchars = NULL; @@ -132,7 +133,8 @@ metachars(void) * Is this a shell metacharacter? */ static int -metachar(char c) +metachar(c) + char c; { return (strchr(metachars(), c) != NULL); } @@ -141,7 +143,8 @@ metachar(char c) * Insert a backslash before each metacharacter in a string. */ public char * -shell_quote(char *s) +shell_quote(s) + char *s; { char *p; char *newstr; @@ -218,7 +221,9 @@ shell_quote(char *s) * Return NULL if the file does not exist in the directory. */ static char * -dirfile(char *dirname, char *filename) +dirfile(dirname, filename) + char *dirname; + char *filename; { char *pathname; char *qpathname; @@ -256,9 +261,10 @@ dirfile(char *dirname, char *filename) * Return the full pathname of the given file in the "home directory". */ public char * -homefile(char *filename) +homefile(filename) + char *filename; { - char *pathname; + register char *pathname; /* * Try $HOME/filename. @@ -305,11 +311,12 @@ homefile(char *filename) * {{ This is a lot of work just to support % and #. }} */ public char * -fexpand(char *s) +fexpand(s) + char *s; { - char *fr, *to; - int n; - char *e; + register char *fr, *to; + register int n; + register char *e; IFILE ifile; #define fchar_ifile(c) \ @@ -400,7 +407,8 @@ fexpand(char *s) * the given string. */ public char * -fcomplete(char *s) +fcomplete(s) + char *s; { char *fpat; char *qs; @@ -459,12 +467,13 @@ fcomplete(char *s) * This is just a guess, and we need not try too hard to make it accurate. */ public int -bin_file(int f) +bin_file(f) + int f; { int n; int bin_count = 0; char data[256]; - constant char* p; + char* p; char* pend; if (!seekable(f)) @@ -503,7 +512,8 @@ bin_file(int f) * Try to determine the size of a file by seeking to the end. */ static POSITION -seek_filesize(int f) +seek_filesize(f) + int f; { off_t spos; @@ -518,7 +528,8 @@ seek_filesize(int f) * Return a pointer to the string in memory. */ static char * -readfd(FILE *fd) +readfd(fd) + FILE *fd; { int len; int ch; @@ -566,7 +577,8 @@ FILE *popen(); * Return a pointer to a pipe connected to the shell command's standard output. */ static FILE * -shellcmd(char *cmd) +shellcmd(cmd) + char *cmd; { FILE *fd; @@ -616,7 +628,8 @@ shellcmd(char *cmd) * Expand a filename, doing any system-specific metacharacter substitutions. */ public char * -lglob(char *filename) +lglob(filename) + char *filename; { char *gfilename; char *ofilename; @@ -677,9 +690,9 @@ lglob(char *filename) * The globbing function returns a single name, and * is called multiple times to walk thru all names. */ - char *p; - int len; - int n; + register char *p; + register int len; + register int n; char *pathname; char *qpathname; DECL_GLOB_NAME(fnd,drive,dir,fname,ext,handle) @@ -805,7 +818,8 @@ lglob(char *filename) * Return a large number if there are any other % escapes besides %s. */ static int -num_pct_s(char *lessopen) +num_pct_s(lessopen) + char *lessopen; { int num = 0; @@ -830,7 +844,10 @@ num_pct_s(char *lessopen) * instead of the file we're about to open. */ public char * -open_altfile(char *filename, int *pf, void **pfd) +open_altfile(filename, pf, pfd) + char *filename; + int *pf; + void **pfd; { #if !HAVE_POPEN return (NULL); @@ -939,7 +956,10 @@ open_altfile(char *filename, int *pf, void **pfd) * Close a replacement file. */ public void -close_altfile(char *altfilename, char *filename, void *pipefd) +close_altfile(altfilename, filename, pipefd) + char *altfilename; + char *filename; + void *pipefd; { #if HAVE_POPEN char *lessclose; @@ -981,7 +1001,8 @@ close_altfile(char *altfilename, char *filename, void *pipefd) * Is the specified file a directory? */ public int -is_dir(char *filename) +is_dir(filename) + char *filename; { int isdir = 0; @@ -997,7 +1018,7 @@ is_dir(char *filename) #else #ifdef _OSK { - int f; + register int f; f = open(filename, S_IREAD | S_IFDIR); if (f >= 0) @@ -1016,9 +1037,10 @@ is_dir(char *filename) * (if it cannot be opened or is a directory, etc.) */ public char * -bad_file(char *filename) +bad_file(filename) + char *filename; { - char *m = NULL; + register char *m = NULL; filename = shell_unquote(filename); if (!force_open && is_dir(filename)) @@ -1061,7 +1083,8 @@ bad_file(char *filename) * In Unix, we can stat the file. */ public POSITION -filesize(int f) +filesize(f) + int f; { #if HAVE_STAT struct stat statbuf; @@ -1083,7 +1106,7 @@ filesize(int f) * */ public char * -shell_coption(void) +shell_coption() { return ("-c"); } @@ -1092,7 +1115,8 @@ shell_coption(void) * Return last component of a pathname. */ public char * -last_component(char *name) +last_component(name) + char *name; { char *slash; diff --git a/forwback.c b/forwback.c index 056f4752701c..83ae78efb28c 100644 --- a/forwback.c +++ b/forwback.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2015 Mark Nudelman + * Copyright (C) 1984-2016 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. @@ -46,7 +46,7 @@ extern char *tagoption; * Sound the bell to indicate user is trying to move past end of file. */ static void -eof_bell(void) +eof_bell() { if (quiet == NOT_QUIET) bell(); @@ -58,7 +58,7 @@ eof_bell(void) * Check to see if the end of file is currently displayed. */ public int -eof_displayed(void) +eof_displayed() { POSITION pos; @@ -85,7 +85,7 @@ eof_displayed(void) * Check to see if the entire file is currently displayed. */ public int -entire_file_displayed(void) +entire_file_displayed() { POSITION pos; @@ -105,7 +105,7 @@ entire_file_displayed(void) * for the first time. */ public void -squish_check(void) +squish_check() { if (!squished) return; @@ -123,7 +123,12 @@ squish_check(void) * The first real line after the blanks will start at ch_zero(). */ public void -forw(int n, POSITION pos, int force, int only_last, int nblank) +forw(n, pos, force, only_last, nblank) + register int n; + POSITION pos; + int force; + int only_last; + int nblank; { int nlines = 0; int do_repaint; @@ -292,7 +297,11 @@ forw(int n, POSITION pos, int force, int only_last, int nblank) * Display n lines, scrolling backward. */ public void -back(int n, POSITION pos, int force, int only_last) +back(n, pos, force, only_last) + register int n; + POSITION pos; + int force; + int only_last; { int nlines = 0; int do_repaint; @@ -350,7 +359,10 @@ back(int n, POSITION pos, int force, int only_last) * Start just after the line currently displayed at the bottom of the screen. */ public void -forward(int n, int force, int only_last) +forward(n, force, only_last) + int n; + int force; + int only_last; { POSITION pos; @@ -399,7 +411,10 @@ forward(int n, int force, int only_last) * Start just before the line currently displayed at the top of the screen. */ public void -backward(int n, int force, int only_last) +backward(n, force, only_last) + int n; + int force; + int only_last; { POSITION pos; @@ -419,7 +434,7 @@ backward(int n, int force, int only_last) * top_scroll, as well as back_scroll. */ public int -get_back_scroll(void) +get_back_scroll() { if (no_back_scroll) return (0); @@ -1,302 +1,299 @@ - public char * save (constant char *s); - public VOID_POINTER ecalloc (int count, unsigned int size); - public char * skipsp (char *s); - public char * skipnsp(char *s); - public int sprefix (char *ps, char *s, int uppercase); - public void quit (int status); - public void raw_mode (int on); - public void scrsize (void); - public char * special_key_str (int key); - public void get_term (void); - public void init (void); - public void deinit (void); - public void home (void); - public void add_line (void); - public void remove_top (int n); - public void win32_scroll_up (int n); - public void lower_left (void); - public void line_left (void); - public void check_winch (void); - public void goto_line (int slinenum); - public void vbell (void); - public void bell (void); - public void clear (void); - public void clear_eol (void); - public void clear_bot (void); - public void at_enter (int attr); - public void at_exit (void); - public void at_switch (int attr); - public int is_at_equiv (int attr1, int attr2); - public int apply_at_specials (int attr); - public void backspace (void); - public void putbs (void); - public char WIN32getch (int tty); - public void WIN32setcolors (int fg, int bg); - public void WIN32textout (char *text, int len); - public void match_brac(int obrac, int cbrac, int forwdir, int n); - public void ch_ungetchar (int c); - public void end_logfile (void); - public void sync_logfile (void); - public int ch_seek (POSITION pos); - public int ch_end_seek (void); - public int ch_end_buffer_seek (void); - public int ch_beg_seek (void); - public POSITION ch_length (void); - public POSITION ch_tell (void); - public int ch_forw_get (void); - public int ch_back_get (void); - public void ch_setbufspace (int bufspace); - public void ch_flush (void); - public int seekable (int f); - public void ch_set_eof (void); - public void ch_init (int f, int flags); - public void ch_close (void); - public int ch_getflags (void); -struct filestate; - public void ch_dump (struct filestate *fs); - public void init_charset (void); - public int binary_char (LWCHAR c); - public int control_char (LWCHAR c); - public char * prchar (LWCHAR c); - public char * prutfchar (LWCHAR ch); - public int utf_len (char ch); - public int is_utf8_well_formed (unsigned char *s, int slen); - public int utf_bin_count (unsigned char *data, int len); - public LWCHAR get_wchar (constant char *p); - public void put_wchar (char **pp, LWCHAR ch); - public LWCHAR step_char (constant char **pp, signed int dir, constant char *limit); - public int is_composing_char (LWCHAR ch); - public int is_ubin_char (LWCHAR ch); - public int is_wide_char (LWCHAR ch); - public int is_combining_char (LWCHAR ch1, LWCHAR ch2); - public void cmd_reset (void); - public void clear_cmd (void); - public void cmd_putstr (constant char *s); - public int len_cmdbuf (void); - public void set_mlist (constant void *mlist, int cmdflags); -struct mlist; - public void cmd_addhist (struct mlist *constant mlist, char *cmd, int modified); - public void cmd_accept (void); - public int cmd_char (int c); - public LINENUM cmd_int (long *frac); - public char * get_cmdbuf (void); - public char * cmd_lastpattern (void); - public void init_cmdhist (void); - public void save_cmdhist (void); - public int in_mca (void); - public void dispversion (void); - public int getcc (void); - public void ungetcc (int c); - public void ungetsc (char *s); - public void commands (void); - public int cvt_length (int len, int ops); - public int * cvt_alloc_chpos (int len); - public void cvt_text (char *odst, char *osrc, int *chpos, int *lenp, int ops); - public void init_cmds (void); - public void add_fcmd_table (char *buf, int len); - public void add_ecmd_table (char *buf, int len); - public int fcmd_decode (char *cmd, char **sp); - public int ecmd_decode (char *cmd, char **sp); - public char * lgetenv (char *var); - public int lesskey (char *filename, int sysvar); - public void add_hometable (char *envname, char *def_filename, int sysvar); - public int editchar (int c, int flags); - public void init_textlist (struct textlist *tlist, char *str); - public char * forw_textlist (struct textlist *tlist, char *prev); - public char * back_textlist (struct textlist *tlist, char *prev); - public int edit (char *filename); - public int edit_ifile (IFILE ifile); - public int edit_list (char *filelist); - public int edit_first (void); - public int edit_last (void); - public int edit_next (int n); - public int edit_prev (int n); - public int edit_index (int n); - public IFILE save_curr_ifile (void); - public void unsave_ifile (IFILE save_ifile); - public void reedit_ifile (IFILE save_ifiler); - public void reopen_curr_ifile (void); - public int edit_stdin (void); - public void cat_file (void); - public void use_logfile (char *filename); - public char * shell_unquote (char *str); - public char * get_meta_escape (void); - public char * shell_quote (char *s); - public char * homefile (char *filename); - public char * fexpand (char *s); - public char * fcomplete (char *s); - public int bin_file (int f); - public char * lglob (char *filename); - public char * open_altfile (char *filename, int *pf, void **pfd); - public void close_altfile (char *altfilename, char *filename, void *pipefd); - public int is_dir (char *filename); - public char * bad_file (char *filename); - public POSITION filesize (int f); - public char * shell_coption (void); - public char * last_component (char *name); - public int eof_displayed (void); - public int entire_file_displayed (void); - public void squish_check (void); - public void forw (int n, POSITION pos, int force, int only_last, int nblank); - public void back (int n, POSITION pos, int force, int only_last); - public void forward (int n, int force, int only_last); - public void backward (int n, int force, int only_last); - public int get_back_scroll (void); - public void del_ifile (IFILE h); - public IFILE next_ifile (IFILE h); - public IFILE prev_ifile (IFILE h); - public IFILE getoff_ifile (IFILE ifile); - public int nifile (void); - public IFILE get_ifile (char *filename, IFILE prev); - public char * get_filename (IFILE ifile); - public int get_index (IFILE ifile); - public void store_pos (IFILE ifile, struct scrpos *scrpos); - public void get_pos (IFILE ifile, struct scrpos *scrpos); - public void set_open (IFILE ifile); - public int opened (IFILE ifile); - public void hold_ifile (IFILE ifile, int incr); - public int held_ifile (IFILE ifile); - public void * get_filestate (IFILE ifile); - public void set_filestate (IFILE ifile, void *filestate); - public void if_dump (void); - public POSITION forw_line (POSITION curr_pos); - public POSITION back_line (POSITION curr_pos); - public void set_attnpos (POSITION pos); - public void jump_forw (void); - public void jump_forw_buffered (void); - public void jump_back (LINENUM linenum); - public void repaint (void); - public void jump_percent (int percent, long fraction); - public void jump_line_loc (POSITION pos, int sline); - public void jump_loc (POSITION pos, int sline); - public void init_line (void); - public int is_ascii_char (LWCHAR ch); - public void prewind (void); - public void plinenum (POSITION pos); - public void pshift_all (void); - public int is_ansi_end (LWCHAR ch); - public int is_ansi_middle (LWCHAR ch); - public int pappend (unsigned char c, POSITION pos); - public int pflushmbc (void); - public void pdone (int endline, int forw); - public void set_status_col (char c); - public int gline (int i, int *ap); - public void null_line (void); - public POSITION forw_raw_line (POSITION curr_pos, char **linep, int *line_lenp); - public POSITION back_raw_line (POSITION curr_pos, char **linep, int *line_lenp); - public void clr_linenum (void); - public void add_lnum (LINENUM linenum, POSITION pos); - public LINENUM find_linenum (POSITION pos); - public POSITION find_pos (LINENUM linenum); - public LINENUM currline (int where); - public void lsystem (char *cmd, char *donemsg); - public int pipe_mark (int c, char *cmd); - public int pipe_data (char *cmd, POSITION spos, POSITION epos); - public void init_mark (void); - public int badmark (int c); - public void setmark (int c); - public void lastmark (void); - public void gomark (int c); - public POSITION markpos (int c); - public void unmark (IFILE ifile); - public void opt_o (int type, char *s); - public void opt__O (int type, char *s); - public void opt_j (int type, char *s); - public void calc_jump_sline (void); - public void opt_shift (int type, char *s); - public void calc_shift_count (void); - public void opt_k (int type, char *s); - public void opt_t (int type, char *s); - public void opt__T (int type, char *s); - public void opt_p (int type, char *s); - public void opt__P (int type, char *s); - public void opt_b (int type, char *s); - public void opt_i (int type, char *s); - public void opt__V (int type, char *s); - public void opt_D (int type, char *s); - public void opt_x (int type, char *s); - public void opt_quote (int type, char *s); - public void opt_query (int type, char *s); - public int get_swindow (void); - public char * propt (int c); - public void scan_option (char *s); -struct loption; - public void toggle_option (struct loption *o, int lower, char *s, int how_toggle); - public int opt_has_param (struct loption *o); - public char * opt_prompt (struct loption *o); - public int isoptpending (void); - public void nopendopt (void); - public int getnum (char **sp, char *printopt, int *errp); - public long getfraction (char **sp, char *printopt, int *errp); - public int get_quit_at_eof (void); - public void init_option (void); - public struct loption * findopt (int c); - public struct loption * findopt_name (char **p_optname, char **p_oname, int *p_err); - public int iread (int fd, char *buf, unsigned int len); - public void intread (void); - public time_type get_time (void); - public char * errno_message (char *filename); - public int percentage (POSITION num, POSITION den); - public POSITION percent_pos (POSITION pos, int percent, long fraction); - public int os9_signal (int type, RETSIGTYPE (*handler)()); - public void put_line (void); - public void flush (void); - public int putchr (int c); - public void putstr (constant char *s); - public void get_return (void); - public void error (char *fmt, PARG *parg); - public void ierror (char *fmt, PARG *parg); - public int query (char *fmt, PARG *parg); - public int compile_pattern (char *pattern, int search_type, void **comp_pattern); - public void uncompile_pattern (void **pattern); - public int valid_pattern (char *pattern); - public int is_null_pattern (void *pattern); - public int match_pattern (void *pattern, char *tpattern, char *line, int line_len, char **sp, char **ep, int notbol, int search_type); - public POSITION position (int where); - public void add_forw_pos (POSITION pos); - public void add_back_pos (POSITION pos); - public void pos_clear (void); - public void pos_init (void); - public int onscreen (POSITION pos); - public int empty_screen (void); - public int empty_lines (int s, int e); - public void get_scrpos (struct scrpos *scrpos); - public int adjsline (int sline); - public void init_prompt (void); - public char * pr_expand (constant char *proto, int maxwidth); - public char * eq_message (void); - public char * pr_string (void); - public char * wait_message (void); - public void init_search (void); - public void repaint_hilite (int on); - public void clear_attn (void); - public void undo_search (void); -struct hilite_tree; - public void clr_hlist (struct hilite_tree *anchor); - public void clr_hilite (void); - public void clr_filter (void); - public int is_filtered (POSITION pos); - public POSITION next_unfiltered (POSITION pos); - public POSITION prev_unfiltered (POSITION pos); - public int is_hilited (POSITION pos, POSITION epos, int nohide, int *p_matches); - public void chg_caseless (void); - public void chg_hilite (void); - public int search (int search_type, char *pattern, int n); - public void prep_hilite (POSITION spos, POSITION epos, int maxlines); - public void set_filter_pattern (char *pattern, int search_type); - public int is_filtering (void); - public RETSIGTYPE winch (int type); - public void init_signals (int on); - public void psignals (void); - public void cleantags (void); - public int gettagtype (void); - public void findtag (char *tag); - public POSITION tagsearch (void); - public char * nexttag (int n); - public char * prevtag (int n); - public int ntags (void); - public int curr_tag (void); - public int edit_tagfile (void); - public void open_getchr (void); - public void close_getchr (void); - public int getchr (void); + public char * save (); + public VOID_POINTER ecalloc (); + public char * skipsp (); + public int sprefix (); + public void quit (); + public void raw_mode (); + public void scrsize (); + public char * special_key_str (); + public void get_term (); + public void init (); + public void deinit (); + public void home (); + public void add_line (); + public void remove_top (); + public void win32_scroll_up (); + public void lower_left (); + public void line_left (); + public void check_winch (); + public void goto_line (); + public void vbell (); + public void bell (); + public void clear (); + public void clear_eol (); + public void clear_bot (); + public void at_enter (); + public void at_exit (); + public void at_switch (); + public int is_at_equiv (); + public int apply_at_specials (); + public void backspace (); + public void putbs (); + public char WIN32getch (); + public void WIN32setcolors (); + public void WIN32textout (); + public void match_brac (); + public void ch_ungetchar (); + public void end_logfile (); + public void sync_logfile (); + public int ch_seek (); + public int ch_end_seek (); + public int ch_end_buffer_seek (); + public int ch_beg_seek (); + public POSITION ch_length (); + public POSITION ch_tell (); + public int ch_forw_get (); + public int ch_back_get (); + public void ch_setbufspace (); + public void ch_flush (); + public int seekable (); + public void ch_set_eof (); + public void ch_init (); + public void ch_close (); + public int ch_getflags (); + public void ch_dump (); + public void init_charset (); + public int binary_char (); + public int control_char (); + public char * prchar (); + public char * prutfchar (); + public int utf_len (); + public int is_utf8_well_formed (); + public int utf_bin_count (); + public LWCHAR get_wchar (); + public void put_wchar (); + public LWCHAR step_char (); + public int is_composing_char (); + public int is_ubin_char (); + public int is_wide_char (); + public int is_combining_char (); + public void cmd_reset (); + public void clear_cmd (); + public void cmd_putstr (); + public int len_cmdbuf (); + public void set_mlist (); + public void cmd_addhist (); + public void cmd_accept (); + public int cmd_char (); + public LINENUM cmd_int (); + public char * get_cmdbuf (); + public char * cmd_lastpattern (); + public void init_cmdhist (); + public void save_cmdhist (); + public int in_mca (); + public void dispversion (); + public int getcc (); + public void ungetcc (); + public void ungetsc (); + public void commands (); + public int cvt_length (); + public int * cvt_alloc_chpos (); + public void cvt_text (); + public void init_cmds (); + public void add_fcmd_table (); + public void add_ecmd_table (); + public int fcmd_decode (); + public int ecmd_decode (); + public char * lgetenv (); + public int lesskey (); + public void add_hometable (); + public int editchar (); + public void init_textlist (); + public char * forw_textlist (); + public char * back_textlist (); + public int edit (); + public int edit_ifile (); + public int edit_list (); + public int edit_first (); + public int edit_last (); + public int edit_next (); + public int edit_prev (); + public int edit_index (); + public IFILE save_curr_ifile (); + public void unsave_ifile (); + public void reedit_ifile (); + public void reopen_curr_ifile (); + public int edit_stdin (); + public void cat_file (); + public void use_logfile (); + public char * shell_unquote (); + public char * get_meta_escape (); + public char * shell_quote (); + public char * homefile (); + public char * fexpand (); + public char * fcomplete (); + public int bin_file (); + public char * lglob (); + public char * open_altfile (); + public void close_altfile (); + public int is_dir (); + public char * bad_file (); + public POSITION filesize (); + public char * shell_coption (); + public char * last_component (); + public int eof_displayed (); + public int entire_file_displayed (); + public void squish_check (); + public void forw (); + public void back (); + public void forward (); + public void backward (); + public int get_back_scroll (); + public void del_ifile (); + public IFILE next_ifile (); + public IFILE prev_ifile (); + public IFILE getoff_ifile (); + public int nifile (); + public IFILE get_ifile (); + public char * get_filename (); + public int get_index (); + public void store_pos (); + public void get_pos (); + public void set_open (); + public int opened (); + public void hold_ifile (); + public int held_ifile (); + public void * get_filestate (); + public void set_filestate (); + public void if_dump (); + public POSITION forw_line (); + public POSITION back_line (); + public void set_attnpos (); + public void jump_forw (); + public void jump_forw_buffered (); + public void jump_back (); + public void repaint (); + public void jump_percent (); + public void jump_line_loc (); + public void jump_loc (); + public void init_line (); + public int is_ascii_char (); + public void prewind (); + public void plinenum (); + public void pshift_all (); + public int is_ansi_end (); + public int is_ansi_middle (); + public int pappend (); + public int pflushmbc (); + public void pdone (); + public void set_status_col (); + public int gline (); + public void null_line (); + public POSITION forw_raw_line (); + public POSITION back_raw_line (); + public int rrshift (); + public void clr_linenum (); + public void add_lnum (); + public LINENUM find_linenum (); + public POSITION find_pos (); + public LINENUM currline (); + public void lsystem (); + public int pipe_mark (); + public int pipe_data (); + public void init_mark (); + public int badmark (); + public void setmark (); + public void lastmark (); + public void gomark (); + public POSITION markpos (); + public void unmark (); + public void opt_o (); + public void opt__O (); + public void opt_j (); + public void calc_jump_sline (); + public void opt_shift (); + public void calc_shift_count (); + public void opt_k (); + public void opt_t (); + public void opt__T (); + public void opt_p (); + public void opt__P (); + public void opt_b (); + public void opt_i (); + public void opt__V (); + public void opt_D (); + public void opt_x (); + public void opt_quote (); + public void opt_query (); + public int get_swindow (); + public char * propt (); + public void scan_option (); + public void toggle_option (); + public int opt_has_param (); + public char * opt_prompt (); + public int isoptpending (); + public void nopendopt (); + public int getnum (); + public long getfraction (); + public int get_quit_at_eof (); + public void init_option (); + public struct loption * findopt (); + public struct loption * findopt_name (); + public int iread (); + public void intread (); + public time_type get_time (); + public char * errno_message (); + public int percentage (); + public POSITION percent_pos (); + public int os9_signal (); + public void put_line (); + public void flush (); + public int putchr (); + public void putstr (); + public void get_return (); + public void error (); + public void ierror (); + public int query (); + public int compile_pattern (); + public void uncompile_pattern (); + public int valid_pattern (); + public int is_null_pattern (); + public int match_pattern (); + public POSITION position (); + public void add_forw_pos (); + public void add_back_pos (); + public void pos_clear (); + public void pos_init (); + public int onscreen (); + public int empty_screen (); + public int empty_lines (); + public void get_scrpos (); + public int adjsline (); + public void init_prompt (); + public char * pr_expand (); + public char * eq_message (); + public char * pr_string (); + public char * wait_message (); + public void init_search (); + public void repaint_hilite (); + public void clear_attn (); + public void undo_search (); + public void clr_hlist (); + public void clr_hilite (); + public void clr_filter (); + public int is_filtered (); + public POSITION next_unfiltered (); + public POSITION prev_unfiltered (); + public int is_hilited (); + public void chg_hilite (); + public void chg_caseless (); + public int search (); + public void prep_hilite (); + public void set_filter_pattern (); + public int is_filtering (); + public RETSIGTYPE winch (); + public RETSIGTYPE winch (); + public void init_signals (); + public void psignals (); + public void cleantags (); + public int gettagtype (); + public void findtag (); + public POSITION tagsearch (); + public char * nexttag (); + public char * prevtag (); + public int ntags (); + public int curr_tag (); + public int edit_tagfile (); + public void open_getchr (); + public void close_getchr (); + public int getchr (); @@ -23,8 +23,10 @@ constant char helpdata[] = { ' ',' ','E','S','C','-','S','P','A','C','E',' ',' ',' ',' ',' ',' ',' ',' ',' ','*',' ',' ','F','o','r','w','a','r','d',' ',' ','o','n','e',' ','w','i','n','d','o','w',',',' ','b','u','t',' ','d','o','n','\'','t',' ','s','t','o','p',' ','a','t',' ','e','n','d','-','o','f','-','f','i','l','e','.','\n', ' ',' ','d',' ',' ','^','D',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','*',' ',' ','F','o','r','w','a','r','d',' ',' ','o','n','e',' ','h','a','l','f','-','w','i','n','d','o','w',' ','(','a','n','d',' ','s','e','t',' ','h','a','l','f','-','w','i','n','d','o','w',' ','t','o',' ','_','\b','N',')','.','\n', ' ',' ','u',' ',' ','^','U',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','*',' ',' ','B','a','c','k','w','a','r','d',' ','o','n','e',' ','h','a','l','f','-','w','i','n','d','o','w',' ','(','a','n','d',' ','s','e','t',' ','h','a','l','f','-','w','i','n','d','o','w',' ','t','o',' ','_','\b','N',')','.','\n', -' ',' ','E','S','C','-',')',' ',' ','R','i','g','h','t','A','r','r','o','w',' ','*',' ',' ','L','e','f','t',' ',' ','o','n','e',' ','h','a','l','f',' ','s','c','r','e','e','n',' ','w','i','d','t','h',' ','(','o','r',' ','_','\b','N',' ','p','o','s','i','t','i','o','n','s',')','.','\n', -' ',' ','E','S','C','-','(',' ',' ','L','e','f','t','A','r','r','o','w',' ',' ','*',' ',' ','R','i','g','h','t',' ','o','n','e',' ','h','a','l','f',' ','s','c','r','e','e','n',' ','w','i','d','t','h',' ','(','o','r',' ','_','\b','N',' ','p','o','s','i','t','i','o','n','s',')','.','\n', +' ',' ','E','S','C','-',')',' ',' ','R','i','g','h','t','A','r','r','o','w',' ','*',' ',' ','R','i','g','h','t',' ','o','n','e',' ','h','a','l','f',' ','s','c','r','e','e','n',' ','w','i','d','t','h',' ','(','o','r',' ','_','\b','N',' ','p','o','s','i','t','i','o','n','s',')','.','\n', +' ',' ','E','S','C','-','(',' ',' ','L','e','f','t','A','r','r','o','w',' ',' ','*',' ',' ','L','e','f','t',' ',' ','o','n','e',' ','h','a','l','f',' ','s','c','r','e','e','n',' ','w','i','d','t','h',' ','(','o','r',' ','_','\b','N',' ','p','o','s','i','t','i','o','n','s',')','.','\n', +' ',' ','E','S','C','-','}',' ',' ','^','R','i','g','h','t','A','r','r','o','w',' ',' ',' ','R','i','g','h','t',' ','t','o',' ','l','a','s','t',' ','c','o','l','u','m','n',' ','d','i','s','p','l','a','y','e','d','.','\n', +' ',' ','E','S','C','-','{',' ',' ','^','L','e','f','t','A','r','r','o','w',' ',' ',' ',' ','L','e','f','t',' ',' ','t','o',' ','f','i','r','s','t',' ','c','o','l','u','m','n','.','\n', ' ',' ','F',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','F','o','r','w','a','r','d',' ','f','o','r','e','v','e','r',';',' ','l','i','k','e',' ','"','t','a','i','l',' ','-','f','"','.','\n', ' ',' ','E','S','C','-','F',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','L','i','k','e',' ','F',' ','b','u','t',' ','s','t','o','p',' ','w','h','e','n',' ','s','e','a','r','c','h',' ','p','a','t','t','e','r','n',' ','i','s',' ','f','o','u','n','d','.','\n', ' ',' ','r',' ',' ','^','R',' ',' ','^','L',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','R','e','p','a','i','n','t',' ','s','c','r','e','e','n','.','\n', @@ -102,6 +104,7 @@ constant char helpdata[] = { '\n', ' ',' ','!','_','\b','c','_','\b','o','_','\b','m','_','\b','m','_','\b','a','_','\b','n','_','\b','d',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','E','x','e','c','u','t','e',' ','t','h','e',' ','s','h','e','l','l',' ','c','o','m','m','a','n','d',' ','w','i','t','h',' ','$','S','H','E','L','L','.','\n', ' ',' ','|','X','\b','X','_','\b','c','_','\b','o','_','\b','m','_','\b','m','_','\b','a','_','\b','n','_','\b','d',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','P','i','p','e',' ','f','i','l','e',' ','b','e','t','w','e','e','n',' ','c','u','r','r','e','n','t',' ','p','o','s',' ','&',' ','m','a','r','k',' ','X','\b','X',' ','t','o',' ','s','h','e','l','l',' ','c','o','m','m','a','n','d','.','\n', +' ',' ','s',' ','_','\b','f','_','\b','i','_','\b','l','_','\b','e',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','S','a','v','e',' ','i','n','p','u','t',' ','t','o',' ','a',' ','f','i','l','e','.','\n', ' ',' ','v',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','E','d','i','t',' ','t','h','e',' ','c','u','r','r','e','n','t',' ','f','i','l','e',' ','w','i','t','h',' ','$','V','I','S','U','A','L',' ','o','r',' ','$','E','D','I','T','O','R','.','\n', ' ',' ','V',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','P','r','i','n','t',' ','v','e','r','s','i','o','n',' ','n','u','m','b','e','r',' ','o','f',' ','"','l','e','s','s','"','.','\n', ' ','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','\n', @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2015 Mark Nudelman + * Copyright (C) 1984-2016 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,7 +49,9 @@ static struct ifile anchor = { &anchor, &anchor, NULL, NULL, 0, 0, '\0', static int ifiles = 0; static void -incr_index(struct ifile *p, int incr) +incr_index(p, incr) + register struct ifile *p; + int incr; { for (; p != &anchor; p = p->h_next) p->h_index += incr; @@ -59,7 +61,9 @@ incr_index(struct ifile *p, int incr) * Link an ifile into the ifile list. */ static void -link_ifile(struct ifile *p, struct ifile *prev) +link_ifile(p, prev) + struct ifile *p; + struct ifile *prev; { /* * Link into list. @@ -83,7 +87,8 @@ link_ifile(struct ifile *p, struct ifile *prev) * Unlink an ifile from the ifile list. */ static void -unlink_ifile(struct ifile *p) +unlink_ifile(p) + struct ifile *p; { p->h_next->h_prev = p->h_prev; p->h_prev->h_next = p->h_next; @@ -98,9 +103,11 @@ unlink_ifile(struct ifile *p) * Return a pointer to the new ifile structure. */ static struct ifile * -new_ifile(char *filename, struct ifile *prev) +new_ifile(filename, prev) + char *filename; + struct ifile *prev; { - struct ifile *p; + register struct ifile *p; /* * Allocate and initialize structure. @@ -119,9 +126,10 @@ new_ifile(char *filename, struct ifile *prev) * Delete an existing ifile structure. */ public void -del_ifile(IFILE h) +del_ifile(h) + IFILE h; { - struct ifile *p; + register struct ifile *p; if (h == NULL_IFILE) return; @@ -142,9 +150,10 @@ del_ifile(IFILE h) * Get the ifile after a given one in the list. */ public IFILE -next_ifile(IFILE h) +next_ifile(h) + IFILE h; { - struct ifile *p; + register struct ifile *p; p = (h == NULL_IFILE) ? &anchor : int_ifile(h); if (p->h_next == &anchor) @@ -156,9 +165,10 @@ next_ifile(IFILE h) * Get the ifile before a given one in the list. */ public IFILE -prev_ifile(IFILE h) +prev_ifile(h) + IFILE h; { - struct ifile *p; + register struct ifile *p; p = (h == NULL_IFILE) ? &anchor : int_ifile(h); if (p->h_prev == &anchor) @@ -170,7 +180,8 @@ prev_ifile(IFILE h) * Return a different ifile from the given one. */ public IFILE -getoff_ifile(IFILE ifile) +getoff_ifile(ifile) + IFILE ifile; { IFILE newifile; @@ -185,7 +196,7 @@ getoff_ifile(IFILE ifile) * Return the number of ifiles. */ public int -nifile(void) +nifile() { return (ifiles); } @@ -194,9 +205,10 @@ nifile(void) * Find an ifile structure, given a filename. */ static struct ifile * -find_ifile(char *filename) +find_ifile(filename) + char *filename; { - struct ifile *p; + register struct ifile *p; for (p = anchor.h_next; p != &anchor; p = p->h_next) if (strcmp(filename, p->h_filename) == 0) @@ -210,9 +222,11 @@ find_ifile(char *filename) * insert the new ifile after "prev" in the list. */ public IFILE -get_ifile(char *filename, IFILE prev) +get_ifile(filename, prev) + char *filename; + IFILE prev; { - struct ifile *p; + register struct ifile *p; if ((p = find_ifile(filename)) == NULL) p = new_ifile(filename, int_ifile(prev)); @@ -223,7 +237,8 @@ get_ifile(char *filename, IFILE prev) * Get the filename associated with a ifile. */ public char * -get_filename(IFILE ifile) +get_filename(ifile) + IFILE ifile; { if (ifile == NULL) return (NULL); @@ -234,7 +249,8 @@ get_filename(IFILE ifile) * Get the index of the file associated with a ifile. */ public int -get_index(IFILE ifile) +get_index(ifile) + IFILE ifile; { return (int_ifile(ifile)->h_index); } @@ -243,7 +259,9 @@ get_index(IFILE ifile) * Save the file position to be associated with a given file. */ public void -store_pos(IFILE ifile, struct scrpos *scrpos) +store_pos(ifile, scrpos) + IFILE ifile; + struct scrpos *scrpos; { int_ifile(ifile)->h_scrpos = *scrpos; } @@ -253,7 +271,9 @@ store_pos(IFILE ifile, struct scrpos *scrpos) * If no position has been associated with the file, return NULL_POSITION. */ public void -get_pos(IFILE ifile, struct scrpos *scrpos) +get_pos(ifile, scrpos) + IFILE ifile; + struct scrpos *scrpos; { *scrpos = int_ifile(ifile)->h_scrpos; } @@ -262,7 +282,8 @@ get_pos(IFILE ifile, struct scrpos *scrpos) * Mark the ifile as "opened". */ public void -set_open(IFILE ifile) +set_open(ifile) + IFILE ifile; { int_ifile(ifile)->h_opened = 1; } @@ -271,40 +292,47 @@ set_open(IFILE ifile) * Return whether the ifile has been opened previously. */ public int -opened(IFILE ifile) +opened(ifile) + IFILE ifile; { return (int_ifile(ifile)->h_opened); } public void -hold_ifile(IFILE ifile, int incr) +hold_ifile(ifile, incr) + IFILE ifile; + int incr; { int_ifile(ifile)->h_hold += incr; } public int -held_ifile(IFILE ifile) +held_ifile(ifile) + IFILE ifile; { return (int_ifile(ifile)->h_hold); } public void * -get_filestate(IFILE ifile) +get_filestate(ifile) + IFILE ifile; { return (int_ifile(ifile)->h_filestate); } public void -set_filestate(IFILE ifile, void *filestate) +set_filestate(ifile, filestate) + IFILE ifile; + void *filestate; { int_ifile(ifile)->h_filestate = filestate; } #if 0 public void -if_dump(void) +if_dump() { - struct ifile *p; + register struct ifile *p; for (p = anchor.h_next; p != &anchor; p = p->h_next) { @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2015 Mark Nudelman + * Copyright (C) 1984-2016 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. @@ -42,11 +42,12 @@ extern int size_linebuf; * of the NEXT line. The line obtained is the line starting at curr_pos. */ public POSITION -forw_line(POSITION curr_pos) +forw_line(curr_pos) + POSITION curr_pos; { POSITION base_pos; POSITION new_pos; - int c; + register int c; int blankline; int endline; int backchars; @@ -248,7 +249,8 @@ get_forw_line: * of the PREVIOUS line. The line obtained is the one starting at new_pos. */ public POSITION -back_line(POSITION curr_pos) +back_line(curr_pos) + POSITION curr_pos; { POSITION new_pos, begin_new_pos, base_pos; int c; @@ -427,7 +429,8 @@ get_back_line: * Set attnpos. */ public void -set_attnpos(POSITION pos) +set_attnpos(pos) + POSITION pos; { int c; @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2015 Mark Nudelman + * Copyright (C) 1984-2016 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(void) +jump_forw() { POSITION pos; POSITION end_pos; @@ -64,7 +64,7 @@ jump_forw(void) * Jump to the last buffered line in the file. */ public void -jump_forw_buffered(void) +jump_forw_buffered() { POSITION end; @@ -82,7 +82,8 @@ jump_forw_buffered(void) * Jump to line n in the file. */ public void -jump_back(LINENUM linenum) +jump_back(linenum) + LINENUM linenum; { POSITION pos; PARG parg; @@ -114,7 +115,7 @@ jump_back(LINENUM linenum) * Repaint the screen. */ public void -repaint(void) +repaint() { struct scrpos scrpos; /* @@ -123,14 +124,20 @@ repaint(void) */ get_scrpos(&scrpos); pos_clear(); - jump_loc(scrpos.pos, scrpos.ln); + if (scrpos.pos == NULL_POSITION) + /* Screen hasn't been drawn yet. */ + jump_loc(0, 0); + else + jump_loc(scrpos.pos, scrpos.ln); } /* * Jump to a specified percentage into the file. */ public void -jump_percent(int percent, long fraction) +jump_percent(percent, fraction) + int percent; + long fraction; { POSITION pos, len; @@ -161,7 +168,9 @@ jump_percent(int percent, long fraction) * the first character in a line. */ public void -jump_line_loc(POSITION pos, int sline) +jump_line_loc(pos, sline) + POSITION pos; + int sline; { int c; @@ -187,9 +196,11 @@ jump_line_loc(POSITION pos, int sline) * Place the target line on a specified line on the screen. */ public void -jump_loc(POSITION pos, int sline) +jump_loc(pos, sline) + POSITION pos; + int sline; { - int nline; + register int nline; POSITION tpos; POSITION bpos; @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2015 Mark Nudelman + * Copyright (C) 1984-2016 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. @@ -528,6 +528,6 @@ struct wchar_range_table #include "funcs.h" /* Functions not included in funcs.h */ -void postoa(POSITION num, char *buf); -void linenumtoa(LINENUM num, char *buf); -void inttoa(int num, char *buf); +void postoa(); +void linenumtoa(); +void inttoa(); @@ -20,8 +20,10 @@ ESC-SPACE * Forward one window, but don't stop at end-of-file. d ^D * Forward one half-window (and set half-window to _N). u ^U * Backward one half-window (and set half-window to _N). - ESC-) RightArrow * Left one half screen width (or _N positions). - ESC-( LeftArrow * Right one half screen width (or _N positions). + ESC-) RightArrow * Right one half screen width (or _N positions). + ESC-( LeftArrow * Left one half screen width (or _N positions). + ESC-} ^RightArrow Right to last column displayed. + ESC-{ ^LeftArrow Left to first column. F Forward forever; like "tail -f". ESC-F Like F but stop when search pattern is found. r ^R ^L Repaint screen. @@ -99,6 +101,7 @@ !_c_o_m_m_a_n_d Execute the shell command with $SHELL. |XX_c_o_m_m_a_n_d Pipe file between current pos & mark XX to shell command. + s _f_i_l_e Save input to a file. v Edit the current file with $VISUAL or $EDITOR. V Print version number of "less". --------------------------------------------------------------------------- @@ -100,20 +100,27 @@ LESS(1) General Commands Manual LESS(1) becomes the default for future RIGHTARROW and LEFTARROW com- mands. + ESC-} or ^RIGHTARROW + Scroll horizontally right to show the end of the longest dis- + played line. + + ESC-{ or ^LEFTARROW + Scroll horizontally left back to the first column. + r or ^R or ^L Repaint the screen. - R Repaint the screen, discarding any buffered input. Useful if + R Repaint the screen, discarding any buffered input. Useful if the file is changing while it is being viewed. - F Scroll forward, and keep trying to read when the end of file is - reached. Normally this command would be used when already at - the end of the file. It is a way to monitor the tail of a file - which is growing while it is being viewed. (The behavior is + F Scroll forward, and keep trying to read when the end of file is + reached. Normally this command would be used when already at + the end of the file. It is a way to monitor the tail of a file + which is growing while it is being viewed. (The behavior is similar to the "tail -f" command.) - ESC-F Like F, but as soon as a line is found which matches the last - search pattern, the terminal bell is rung and forward scrolling + ESC-F Like F, but as soon as a line is found which matches the last + search pattern, the terminal bell is rung and forward scrolling stops. g or < or ESC-< @@ -121,12 +128,12 @@ LESS(1) General Commands Manual LESS(1) ing: this may be slow if N is large.) G or > or ESC-> - Go to line N in the file, default the end of the file. (Warn- - ing: this may be slow if N is large, or if N is not specified + Go to line N in the file, default the end of the file. (Warn- + ing: this may be slow if N is large, or if N is not specified and standard input, rather than a file, is being read.) - ESC-G Same as G, except if no number N is specified and the input is - standard input, goes to the last line which is currently + ESC-G Same as G, except if no number N is specified and the input is + standard input, goes to the last line which is currently buffered. p or % Go to a position N percent into the file. N should be between 0 @@ -135,48 +142,48 @@ LESS(1) General Commands Manual LESS(1) P Go to the line containing byte offset N in the file. { If a left curly bracket appears in the top line displayed on the - screen, the { command will go to the matching right curly - bracket. The matching right curly bracket is positioned on the + screen, the { command will go to the matching right curly + bracket. The matching right curly bracket is positioned on the bottom line of the screen. If there is more than one left curly - bracket on the top line, a number N may be used to specify the + bracket on the top line, a number N may be used to specify the N-th bracket on the line. } If a right curly bracket appears in the bottom line displayed on - the screen, the } command will go to the matching left curly - bracket. The matching left curly bracket is positioned on the - top line of the screen. If there is more than one right curly - bracket on the top line, a number N may be used to specify the + the screen, the } command will go to the matching left curly + bracket. The matching left curly bracket is positioned on the + top line of the screen. If there is more than one right curly + bracket on the top line, a number N may be used to specify the N-th bracket on the line. ( Like {, but applies to parentheses rather than curly brackets. ) Like }, but applies to parentheses rather than curly brackets. - [ Like {, but applies to square brackets rather than curly brack- + [ Like {, but applies to square brackets rather than curly brack- ets. - ] Like }, but applies to square brackets rather than curly brack- + ] Like }, but applies to square brackets rather than curly brack- ets. - ESC-^F Followed by two characters, acts like {, but uses the two char- - acters as open and close brackets, respectively. For example, - "ESC ^F < >" could be used to go forward to the > which matches + ESC-^F Followed by two characters, acts like {, but uses the two char- + acters as open and close brackets, respectively. For example, + "ESC ^F < >" could be used to go forward to the > which matches the < in the top displayed line. - ESC-^B Followed by two characters, acts like }, but uses the two char- - acters as open and close brackets, respectively. For example, + ESC-^B Followed by two characters, acts like }, but uses the two char- + acters as open and close brackets, respectively. For example, "ESC ^B < >" could be used to go backward to the < which matches the > in the bottom displayed line. - m Followed by any lowercase letter, marks the current position + m Followed by any lowercase letter, marks the current position with that letter. - ' (Single quote.) Followed by any lowercase letter, returns to + ' (Single quote.) Followed by any lowercase letter, returns to the position which was previously marked with that letter. Fol- - lowed by another single quote, returns to the position at which + lowed by another single quote, returns to the position at which the last "large" movement command was executed. Followed by a ^ - or $, jumps to the beginning or end of the file respectively. - Marks are preserved when a new file is examined, so the ' com- + or $, jumps to the beginning or end of the file respectively. + Marks are preserved when a new file is examined, so the ' com- mand can be used to switch between input files. ^X^X Same as single quote. @@ -184,39 +191,39 @@ LESS(1) General Commands Manual LESS(1) /pattern Search forward in the file for the N-th line containing the pat- tern. N defaults to 1. The pattern is a regular expression, as - recognized by the regular expression library supplied by your - system. The search starts at the first line displayed (but see + recognized by the regular expression library supplied by your + system. The search starts at the first line displayed (but see the -a and -j options, which change this). - Certain characters are special if entered at the beginning of - the pattern; they modify the type of search rather than become + Certain characters are special if entered at the beginning of + the pattern; they modify the type of search rather than become part of the pattern: ^N or ! Search for lines which do NOT match the pattern. ^E or * - Search multiple files. That is, if the search reaches - the END of the current file without finding a match, the - search continues in the next file in the command line + Search multiple files. That is, if the search reaches + the END of the current file without finding a match, the + search continues in the next file in the command line list. ^F or @ - Begin the search at the first line of the FIRST file in - the command line list, regardless of what is currently - displayed on the screen or the settings of the -a or -j + Begin the search at the first line of the FIRST file in + the command line list, regardless of what is currently + displayed on the screen or the settings of the -a or -j options. - ^K Highlight any text which matches the pattern on the cur- + ^K Highlight any text which matches the pattern on the cur- rent screen, but don't move to the first match (KEEP cur- rent position). - ^R Don't interpret regular expression metacharacters; that + ^R Don't interpret regular expression metacharacters; that is, do a simple textual comparison. ?pattern - Search backward in the file for the N-th line containing the - pattern. The search starts at the last line displayed (but see + Search backward in the file for the N-th line containing the + pattern. The search starts at the last line displayed (but see the -a and -j options, which change this). Certain characters are special as in the / command: @@ -225,15 +232,15 @@ LESS(1) General Commands Manual LESS(1) Search for lines which do NOT match the pattern. ^E or * - Search multiple files. That is, if the search reaches - the beginning of the current file without finding a - match, the search continues in the previous file in the + Search multiple files. That is, if the search reaches + the beginning of the current file without finding a + match, the search continues in the previous file in the command line list. ^F or @ Begin the search at the last line of the last file in the - command line list, regardless of what is currently dis- - played on the screen or the settings of the -a or -j + command line list, regardless of what is currently dis- + played on the screen or the settings of the -a or -j options. ^K As in forward searches. @@ -246,36 +253,36 @@ LESS(1) General Commands Manual LESS(1) ESC-?pattern Same as "?*". - n Repeat previous search, for N-th line containing the last pat- - tern. If the previous search was modified by ^N, the search is - made for the N-th line NOT containing the pattern. If the pre- - vious search was modified by ^E, the search continues in the - next (or previous) file if not satisfied in the current file. - If the previous search was modified by ^R, the search is done - without using regular expressions. There is no effect if the + n Repeat previous search, for N-th line containing the last pat- + tern. If the previous search was modified by ^N, the search is + made for the N-th line NOT containing the pattern. If the pre- + vious search was modified by ^E, the search continues in the + next (or previous) file if not satisfied in the current file. + If the previous search was modified by ^R, the search is done + without using regular expressions. There is no effect if the previous search was modified by ^F or ^K. N Repeat previous search, but in the reverse direction. - ESC-n Repeat previous search, but crossing file boundaries. The + ESC-n Repeat previous search, but crossing file boundaries. The effect is as if the previous search were modified by *. - ESC-N Repeat previous search, but in the reverse direction and cross- + ESC-N Repeat previous search, but in the reverse direction and cross- ing file boundaries. - ESC-u Undo search highlighting. Turn off highlighting of strings + ESC-u Undo search highlighting. Turn off highlighting of strings matching the current search pattern. If highlighting is already - off because of a previous ESC-u command, turn highlighting back - on. Any search command will also turn highlighting back on. + off because of a previous ESC-u command, turn highlighting back + on. Any search command will also turn highlighting back on. (Highlighting can also be disabled by toggling the -G option; in that case search commands do not turn highlighting back on.) &pattern - Display only lines which match the pattern; lines which do not - match the pattern are not displayed. If pattern is empty (if - you type & immediately followed by ENTER), any filtering is - turned off, and all lines are displayed. While filtering is in - effect, an ampersand is displayed at the beginning of the + Display only lines which match the pattern; lines which do not + match the pattern are not displayed. If pattern is empty (if + you type & immediately followed by ENTER), any filtering is + turned off, and all lines are displayed. While filtering is in + effect, an ampersand is displayed at the beginning of the prompt, as a reminder that some lines in the file may be hidden. Certain characters are special as in the / command: @@ -283,98 +290,98 @@ LESS(1) General Commands Manual LESS(1) ^N or ! Display only lines which do NOT match the pattern. - ^R Don't interpret regular expression metacharacters; that + ^R Don't interpret regular expression metacharacters; that is, do a simple textual comparison. :e [filename] - Examine a new file. If the filename is missing, the "current" - file (see the :n and :p commands below) from the list of files - in the command line is re-examined. A percent sign (%) in the - filename is replaced by the name of the current file. A pound - sign (#) is replaced by the name of the previously examined - file. However, two consecutive percent signs are simply + Examine a new file. If the filename is missing, the "current" + file (see the :n and :p commands below) from the list of files + in the command line is re-examined. A percent sign (%) in the + filename is replaced by the name of the current file. A pound + sign (#) is replaced by the name of the previously examined + file. However, two consecutive percent signs are simply replaced with a single percent sign. This allows you to enter a - filename that contains a percent sign in the name. Similarly, - two consecutive pound signs are replaced with a single pound - sign. The filename is inserted into the command line list of - files so that it can be seen by subsequent :n and :p commands. + filename that contains a percent sign in the name. Similarly, + two consecutive pound signs are replaced with a single pound + sign. The filename is inserted into the command line list of + files so that it can be seen by subsequent :n and :p commands. If the filename consists of several files, they are all inserted - into the list of files and the first one is examined. If the + into the list of files and the first one is examined. If the filename contains one or more spaces, the entire filename should be enclosed in double quotes (also see the -" option). ^X^V or E - Same as :e. Warning: some systems use ^V as a special literal- - ization character. On such systems, you may not be able to use + Same as :e. Warning: some systems use ^V as a special literal- + ization character. On such systems, you may not be able to use ^V. - :n Examine the next file (from the list of files given in the com- - mand line). If a number N is specified, the N-th next file is + :n Examine the next file (from the list of files given in the com- + mand line). If a number N is specified, the N-th next file is examined. :p Examine the previous file in the command line list. If a number N is specified, the N-th previous file is examined. - :x Examine the first file in the command line list. If a number N + :x Examine the first file in the command line list. If a number N is specified, the N-th file in the list is examined. :d Remove the current file from the list of files. - t Go to the next tag, if there were more than one matches for the + t Go to the next tag, if there were more than one matches for the current tag. See the -t option for more details about tags. - T Go to the previous tag, if there were more than one matches for + T Go to the previous tag, if there were more than one matches for the current tag. = or ^G or :f - Prints some information about the file being viewed, including - its name and the line number and byte offset of the bottom line - being displayed. If possible, it also prints the length of the - file, the number of lines in the file and the percent of the + Prints some information about the file being viewed, including + its name and the line number and byte offset of the bottom line + being displayed. If possible, it also prints the length of the + file, the number of lines in the file and the percent of the file above the last displayed line. - - Followed by one of the command line option letters (see OPTIONS - below), this will change the setting of that option and print a - message describing the new setting. If a ^P (CONTROL-P) is + - Followed by one of the command line option letters (see OPTIONS + below), this will change the setting of that option and print a + message describing the new setting. If a ^P (CONTROL-P) is entered immediately after the dash, the setting of the option is - changed but no message is printed. If the option letter has a - numeric value (such as -b or -h), or a string value (such as -P - or -t), a new value may be entered after the option letter. If - no new value is entered, a message describing the current set- + changed but no message is printed. If the option letter has a + numeric value (such as -b or -h), or a string value (such as -P + or -t), a new value may be entered after the option letter. If + no new value is entered, a message describing the current set- ting is printed and nothing is changed. - -- Like the - command, but takes a long option name (see OPTIONS + -- Like the - command, but takes a long option name (see OPTIONS below) rather than a single option letter. You must press ENTER - or RETURN after typing the option name. A ^P immediately after - the second dash suppresses printing of a message describing the + or RETURN after typing the option name. A ^P immediately after + the second dash suppresses printing of a message describing the new setting, as in the - command. - -+ Followed by one of the command line option letters this will - reset the option to its default setting and print a message - describing the new setting. (The "-+[4mX[24m" command does the same - thing as "-+[4mX[24m" on the command line.) This does not work for + -+ Followed by one of the command line option letters this will + reset the option to its default setting and print a message + describing the new setting. (The "-+[4mX[24m" command does the same + thing as "-+[4mX[24m" on the command line.) This does not work for string-valued options. - --+ Like the -+ command, but takes a long option name rather than a + --+ Like the -+ command, but takes a long option name rather than a single option letter. - -! Followed by one of the command line option letters, this will - reset the option to the "opposite" of its default setting and - print a message describing the new setting. This does not work + -! Followed by one of the command line option letters, this will + reset the option to the "opposite" of its default setting and + print a message describing the new setting. This does not work for numeric or string-valued options. - --! Like the -! command, but takes a long option name rather than a + --! Like the -! command, but takes a long option name rather than a single option letter. - _ (Underscore.) Followed by one of the command line option let- - ters, this will print a message describing the current setting + _ (Underscore.) Followed by one of the command line option let- + ters, this will print a message describing the current setting of that option. The setting of the option is not changed. __ (Double underscore.) Like the _ (underscore) command, but takes a long option name rather than a single option letter. You must press ENTER or RETURN after typing the option name. - +cmd Causes the specified cmd to be executed each time a new file is + +cmd Causes the specified cmd to be executed each time a new file is examined. For example, +G causes [4mless[24m to initially display each file starting at the end rather than the beginning. @@ -383,49 +390,49 @@ LESS(1) General Commands Manual LESS(1) q or Q or :q or :Q or ZZ Exits [4mless.[0m - The following four commands may or may not be valid, depending on your + The following four commands may or may not be valid, depending on your particular installation. - v Invokes an editor to edit the current file being viewed. The + v Invokes an editor to edit the current file being viewed. The editor is taken from the environment variable VISUAL if defined, - or EDITOR if VISUAL is not defined, or defaults to "vi" if nei- - ther VISUAL nor EDITOR is defined. See also the discussion of + or EDITOR if VISUAL is not defined, or defaults to "vi" if nei- + ther VISUAL nor EDITOR is defined. See also the discussion of LESSEDIT under the section on PROMPTS below. ! shell-command - Invokes a shell to run the shell-command given. A percent sign - (%) in the command is replaced by the name of the current file. + Invokes a shell to run the shell-command given. A percent sign + (%) in the command is replaced by the name of the current file. A pound sign (#) is replaced by the name of the previously exam- - ined file. "!!" repeats the last shell command. "!" with no - shell command simply invokes a shell. On Unix systems, the - shell is taken from the environment variable SHELL, or defaults - to "sh". On MS-DOS and OS/2 systems, the shell is the normal + ined file. "!!" repeats the last shell command. "!" with no + shell command simply invokes a shell. On Unix systems, the + shell is taken from the environment variable SHELL, or defaults + to "sh". On MS-DOS and OS/2 systems, the shell is the normal command processor. | <m> shell-command - <m> represents any mark letter. Pipes a section of the input - file to the given shell command. The section of the file to be - piped is between the first line on the current screen and the - position marked by the letter. <m> may also be ^ or $ to indi- + <m> represents any mark letter. Pipes a section of the input + file to the given shell command. The section of the file to be + piped is between the first line on the current screen and the + position marked by the letter. <m> may also be ^ or $ to indi- cate beginning or end of file respectively. If <m> is . or new- line, the current screen is piped. s filename - Save the input to a file. This only works if the input is a + Save the input to a file. This only works if the input is a pipe, not an ordinary file. [1mOPTIONS[0m - Command line options are described below. Most options may be changed + Command line options are described below. Most options may be changed while [4mless[24m is running, via the "-" command. - Most options may be given in one of two forms: either a dash followed - by a single letter, or two dashes followed by a long option name. A - long option name may be abbreviated as long as the abbreviation is + Most options may be given in one of two forms: either a dash followed + by a single letter, or two dashes followed by a long option name. A + long option name may be abbreviated as long as the abbreviation is unambiguous. For example, --quit-at-eof may be abbreviated --quit, but not --qui, since both --quit-at-eof and --quiet begin with --qui. Some - long option names are in uppercase, such as --QUIT-AT-EOF, as distinct - from --quit-at-eof. Such option names need only have their first let- - ter capitalized; the remainder of the name may be in either case. For + long option names are in uppercase, such as --QUIT-AT-EOF, as distinct + from --quit-at-eof. Such option names need only have their first let- + ter capitalized; the remainder of the name may be in either case. For example, --Quit-at-eof is equivalent to --QUIT-AT-EOF. Options are also taken from the environment variable "LESS". For exam- @@ -438,76 +445,76 @@ LESS(1) General Commands Manual LESS(1) LESS="-options"; export LESS - On MS-DOS, you don't need the quotes, but you should replace any per- + On MS-DOS, you don't need the quotes, but you should replace any per- cent signs in the options string by double percent signs. - The environment variable is parsed before the command line, so command - line options override the LESS environment variable. If an option - appears in the LESS variable, it can be reset to its default value on + The environment variable is parsed before the command line, so command + line options override the LESS environment variable. If an option + appears in the LESS variable, it can be reset to its default value on the command line by beginning the command line option with "-+". - Some options like -k or -D require a string to follow the option let- - ter. The string for that option is considered to end when a dollar - sign ($) is found. For example, you can set two -D options on MS-DOS + Some options like -k or -D require a string to follow the option let- + ter. The string for that option is considered to end when a dollar + sign ($) is found. For example, you can set two -D options on MS-DOS like this: LESS="Dn9.1$Ds4.1" - If the --use-backslash option appears earlier in the options, then a - dollar sign or backslash may be included literally in an option string + If the --use-backslash option appears earlier in the options, then a + dollar sign or backslash may be included literally in an option string by preceding it with a backslash. If the --use-backslash option is not - in effect, then backslashes are not treated specially, and there is no + in effect, then backslashes are not treated specially, and there is no way to include a dollar sign in the option string. -? or --help - This option displays a summary of the commands accepted by [4mless[0m - (the same as the h command). (Depending on how your shell - interprets the question mark, it may be necessary to quote the + This option displays a summary of the commands accepted by [4mless[0m + (the same as the h command). (Depending on how your shell + interprets the question mark, it may be necessary to quote the question mark, thus: "-\?".) -a or --search-skip-screen - By default, forward searches start at the top of the displayed - screen and backwards searches start at the bottom of the dis- - played screen (except for repeated searches invoked by the n or - N commands, which start after or before the "target" line + By default, forward searches start at the top of the displayed + screen and backwards searches start at the bottom of the dis- + played screen (except for repeated searches invoked by the n or + N commands, which start after or before the "target" line respectively; see the -j option for more about the target line). - The -a option causes forward searches to instead start at the - bottom of the screen and backward searches to start at the top + The -a option causes forward searches to instead start at the + bottom of the screen and backward searches to start at the top of the screen, thus skipping all lines displayed on the screen. -A or --SEARCH-SKIP-SCREEN - Causes all forward searches (not just non-repeated searches) to - start just after the target line, and all backward searches to - start just before the target line. Thus, forward searches will + Causes all forward searches (not just non-repeated searches) to + start just after the target line, and all backward searches to + start just before the target line. Thus, forward searches will skip part of the displayed screen (from the first line up to and - including the target line). Similarly backwards searches will + including the target line). Similarly backwards searches will skip the displayed screen from the last line up to and including the target line. This was the default behavior in less versions prior to 441. -b[4mn[24m or --buffers=[4mn[0m - Specifies the amount of buffer space [4mless[24m will use for each - file, in units of kilobytes (1024 bytes). By default 64 K of - buffer space is used for each file (unless the file is a pipe; - see the -B option). The -b option specifies instead that [4mn[0m + Specifies the amount of buffer space [4mless[24m will use for each + file, in units of kilobytes (1024 bytes). By default 64 K of + buffer space is used for each file (unless the file is a pipe; + see the -B option). The -b option specifies instead that [4mn[0m kilobytes of buffer space should be used for each file. If [4mn[24m is - -1, buffer space is unlimited; that is, the entire file can be + -1, buffer space is unlimited; that is, the entire file can be read into memory. -B or --auto-buffers By default, when data is read from a pipe, buffers are allocated automatically as needed. If a large amount of data is read from - the pipe, this can cause a large amount of memory to be allo- + the pipe, this can cause a large amount of memory to be allo- cated. The -B option disables this automatic allocation of buf- fers for pipes, so that only 64 K (or the amount of space speci- fied by the -b option) is used for the pipe. Warning: use of -B - can result in erroneous display, since only the most recently - viewed part of the piped data is kept in memory; any earlier + can result in erroneous display, since only the most recently + viewed part of the piped data is kept in memory; any earlier data is lost. -c or --clear-screen - Causes full screen repaints to be painted from the top line - down. By default, full screen repaints are done by scrolling + Causes full screen repaints to be painted from the top line + down. By default, full screen repaints are done by scrolling from the bottom of the screen. -C or --CLEAR-SCREEN @@ -515,19 +522,20 @@ LESS(1) General Commands Manual LESS(1) -d or --dumb The -d option suppresses the error message normally displayed if - the terminal is dumb; that is, lacks some important capability, + the terminal is dumb; that is, lacks some important capability, such as the ability to clear the screen or scroll backward. The - -d option does not otherwise change the behavior of [4mless[24m on a + -d option does not otherwise change the behavior of [4mless[24m on a dumb terminal. -D[1mx[4m[22mcolor[24m or --color=[1mx[4m[22mcolor[0m [MS-DOS only] Sets the color of the text displayed. [1mx [22mis a sin- - gle character which selects the type of text whose color is - being set: n=normal, s=standout, d=bold, u=underlined, k=blink. - [4mcolor[24m is a pair of numbers separated by a period. The first - number selects the foreground color and the second selects the - background color of the text. A single number [4mN[24m is the same as - [4mN.M[24m, where [4mM[24m is the normal background color. + gle character which selects the type of text whose color is + being set: n=normal, s=standout, d=bold, u=underlined, k=blink. + [4mcolor[24m is a pair of numbers separated by a period. The first + number selects the foreground color and the second selects the + background color of the text. A single number [4mN[24m is the same as + [4mN.M[24m, where [4mM[24m is the normal background color. [1mx [22mmay also be [1ma [22mto + toggle strict ANSI sequence rendering (SGR mode). -e or --quit-at-eof @@ -1609,7 +1617,7 @@ LESS(1) General Commands Manual LESS(1) [1mCOPYRIGHT[0m - Copyright (C) 1984-2015 Mark Nudelman + Copyright (C) 1984-2016 Mark Nudelman less is part of the GNU project and is free software. You can redis- tribute it and/or modify it under the terms of either (1) the GNU Gen- @@ -1637,4 +1645,4 @@ LESS(1) General Commands Manual LESS(1) - Version 481: 31 Aug 2015 LESS(1) + Version 487: 25 Oct 2016 LESS(1) @@ -1,4 +1,4 @@ -.TH LESS 1 "Version 481: 31 Aug 2015" +.TH LESS 1 "Version 487: 25 Oct 2016" .SH NAME less \- opposite of more .SH SYNOPSIS @@ -101,6 +101,10 @@ Scroll horizontally left N characters, default half the screen width (see the \-# option). If a number N is specified, it becomes the default for future RIGHTARROW and LEFTARROW commands. +.IP "ESC-} or ^RIGHTARROW" +Scroll horizontally right to show the end of the longest displayed line. +.IP "ESC-{ or ^LEFTARROW" +Scroll horizontally left back to the first column. .IP "r or ^R or ^L" Repaint the screen. .IP R @@ -547,6 +551,7 @@ The first number selects the foreground color and the second selects the background color of the text. A single number \fIN\fP is the same as \fIN.M\fP, where \fIM\fP is the normal background color. +\fBx\fP may also be \fBa\fP to toggle strict ANSI sequence rendering (SGR mode). .IP "\-e or \-\-quit-at-eof" Causes @@ -1740,7 +1745,7 @@ The name of the editor (used for the v command). lesskey(1) .SH COPYRIGHT -Copyright (C) 1984-2015 Mark Nudelman +Copyright (C) 1984-2016 Mark Nudelman .PP less is part of the GNU project and is free software. You can redistribute it and/or modify it diff --git a/lessecho.c b/lessecho.c index e4a23f5f39c5..ec7e0803163a 100644 --- a/lessecho.c +++ b/lessecho.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2015 Mark Nudelman + * Copyright (C) 1984-2016 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. @@ -38,14 +38,14 @@ static char metachars[64] = ""; static int num_metachars = 0; static void -pr_usage(void) +pr_usage() { fprintf(stderr, "usage: lessecho [-ox] [-cx] [-pn] [-dn] [-mx] [-nn] [-ex] [-fn] [-a] file ...\n"); } static void -pr_version(void) +pr_version() { char *p; char buf[10]; @@ -61,14 +61,18 @@ pr_version(void) } static void -pr_error(char *s) +pr_error(s) + char *s; { fprintf(stderr, "%s\n", s); exit(1); } static long -lstrtol(char *s, int radix, char **pend) +lstrtol(s, radix, pend) + char *s; + int radix; + char **pend; { int v; int neg = 0; diff --git a/lessecho.man b/lessecho.man index 56ba94312f97..5f26d4aff315 100644 --- a/lessecho.man +++ b/lessecho.man @@ -51,4 +51,4 @@ LESSECHO(1) General Commands Manual LESSECHO(1) - Version 481: 31 Aug 2015 LESSECHO(1) + Version 487: 25 Oct 2016 LESSECHO(1) diff --git a/lessecho.nro b/lessecho.nro index 78b893f18d97..d1302c838c4d 100644 --- a/lessecho.nro +++ b/lessecho.nro @@ -1,4 +1,4 @@ -.TH LESSECHO 1 "Version 481: 31 Aug 2015" +.TH LESSECHO 1 "Version 487: 25 Oct 2016" .SH NAME lessecho \- expand metacharacters .SH SYNOPSIS diff --git a/lesskey.c b/lesskey.c index 47b765424fbc..f565ec62f764 100644 --- a/lesskey.c +++ b/lesskey.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2015 Mark Nudelman + * Copyright (C) 1984-2016 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. @@ -104,6 +104,7 @@ struct cmdname cmdnames[] = { "display-flag", A_DISP_OPTION }, { "display-option", A_DISP_OPTION }, { "end", A_GOEND }, + { "end-scroll", A_RRSHIFT }, { "examine", A_EXAMINE }, { "filter", A_FILTER }, { "first-cmd", A_FIRSTCMD }, @@ -130,6 +131,7 @@ struct cmdname cmdnames[] = { "next-file", A_NEXT_FILE }, { "next-tag", A_NEXT_TAG }, { "noaction", A_NOACTION }, + { "no-scroll", A_LLSHIFT }, { "percent", A_PERCENT }, { "pipe", A_PIPE }, { "prev-file", A_PREV_FILE }, @@ -213,19 +215,19 @@ char *outfile = NULL ; int linenum; int errors; -static void lk_error(char *s); - extern char version[]; void -usage(void) +usage() { fprintf(stderr, "usage: lesskey [-o output] [input]\n"); exit(1); } char * -mkpathname(char *dirname, char *filename) +mkpathname(dirname, filename) + char *dirname; + char *filename; { char *pathname; @@ -240,7 +242,8 @@ mkpathname(char *dirname, char *filename) * Figure out the name of a default file (in the user's HOME directory). */ char * -homefile(char *filename) +homefile(filename) + char *filename; { char *p; char *pathname; @@ -263,7 +266,9 @@ homefile(char *filename) * Parse command line arguments. */ void -parse_args(int argc, char **argv) +parse_args(argc, argv) + int argc; + char **argv; { char *arg; @@ -336,7 +341,7 @@ parse_args(int argc, char **argv) * Initialize data structures. */ void -init_tables(void) +init_tables() { cmdtable.names = cmdnames; cmdtable.pbuffer = cmdtable.buffer; @@ -352,11 +357,13 @@ init_tables(void) * Parse one character of a string. */ char * -tstr(char **pp, int xlate) +tstr(pp, xlate) + char **pp; + int xlate; { - char *p; - char ch; - int i; + register char *p; + register char ch; + register int i; static char buf[10]; static char tstr_control_k[] = { SK_SPECIAL_KEY, SK_CONTROL_K, 6, 1, 1, 1, '\0' }; @@ -416,7 +423,7 @@ tstr(char **pp, int xlate) case 'e': ch = SK_END; break; case 'x': ch = SK_DELETE; break; default: - lk_error("illegal char after \\k"); + error("illegal char after \\k"); *pp = p+1; return (""); } @@ -466,7 +473,8 @@ tstr(char **pp, int xlate) * Skip leading spaces in a string. */ public char * -skipsp(char *s) +skipsp(s) + register char *s; { while (*s == ' ' || *s == '\t') s++; @@ -477,7 +485,8 @@ skipsp(char *s) * Skip non-space characters in a string. */ public char * -skipnsp(char *s) +skipnsp(s) + register char *s; { while (*s != '\0' && *s != ' ' && *s != '\t') s++; @@ -489,9 +498,10 @@ skipnsp(char *s) * strip off the trailing newline & any trailing # comment. */ char * -clean_line(char *s) +clean_line(s) + char *s; { - int i; + register int i; s = skipsp(s); for (i = 0; s[i] != '\n' && s[i] != '\r' && s[i] != '\0'; i++) @@ -505,11 +515,12 @@ clean_line(char *s) * Add a byte to the output command table. */ void -add_cmd_char(int c) +add_cmd_char(c) + int c; { if (currtable->pbuffer >= currtable->buffer + MAX_USERCMD) { - lk_error("too many commands"); + error("too many commands"); exit(1); } *(currtable->pbuffer)++ = c; @@ -519,7 +530,8 @@ add_cmd_char(int c) * Add a string to the output command table. */ void -add_cmd_str(char *s) +add_cmd_str(s) + char *s; { for ( ; *s != '\0'; s++) add_cmd_char(*s); @@ -529,7 +541,8 @@ add_cmd_str(char *s) * See if we have a special "control" line. */ int -control_line(char *s) +control_line(s) + char *s; { #define PREFIX(str,pat) (strncmp(str,pat,strlen(pat)) == 0) @@ -561,7 +574,10 @@ control_line(char *s) * Output some bytes. */ void -fputbytes(FILE *fd, char *buf, int len) +fputbytes(fd, buf, len) + FILE *fd; + char *buf; + int len; { while (len-- > 0) { @@ -574,7 +590,9 @@ fputbytes(FILE *fd, char *buf, int len) * Output an integer, in special KRADIX form. */ void -fputint(FILE *fd, unsigned int val) +fputint(fd, val) + FILE *fd; + unsigned int val; { char c; @@ -594,19 +612,21 @@ fputint(FILE *fd, unsigned int val) * Find an action, given the name of the action. */ int -findaction(char *actname) +findaction(actname) + char *actname; { int i; for (i = 0; currtable->names[i].cn_name != NULL; i++) if (strcmp(currtable->names[i].cn_name, actname) == 0) return (currtable->names[i].cn_action); - lk_error("unknown action"); + error("unknown action"); return (A_INVALID); } - static void -lk_error(char *s) + void +error(s) + char *s; { fprintf(stderr, "line %d: %s\n", linenum, s); errors++; @@ -614,7 +634,8 @@ lk_error(char *s) void -parse_cmdline(char *p) +parse_cmdline(p) + char *p; { int cmdlen; char *actname; @@ -631,7 +652,7 @@ parse_cmdline(char *p) s = tstr(&p, 1); cmdlen += (int) strlen(s); if (cmdlen > MAX_CMDLEN) - lk_error("command too long"); + error("command too long"); else add_cmd_str(s); } while (*p != ' ' && *p != '\t' && *p != '\0'); @@ -648,7 +669,7 @@ parse_cmdline(char *p) p = skipsp(p); if (*p == '\0') { - lk_error("missing action"); + error("missing action"); return; } actname = p; @@ -683,7 +704,8 @@ parse_cmdline(char *p) } void -parse_varline(char *p) +parse_varline(p) + char *p; { char *s; @@ -700,7 +722,7 @@ parse_varline(char *p) p = skipsp(p); if (*p++ != '=') { - lk_error("missing ="); + error("missing ="); return; } @@ -719,7 +741,8 @@ parse_varline(char *p) * Parse a line from the lesskey file. */ void -parse_line(char *line) +parse_line(line) + char *line; { char *p; @@ -744,7 +767,9 @@ parse_line(char *line) } int -main(int argc, char *argv[]) +main(argc, argv) + int argc; + char *argv[]; { FILE *desc; FILE *out; diff --git a/lesskey.h b/lesskey.h index 34b8c1758c7b..1b6f350b0715 100644 --- a/lesskey.h +++ b/lesskey.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2015 Mark Nudelman + * Copyright (C) 1984-2016 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/lesskey.man b/lesskey.man index 2e9000fd61ee..9811e8e9a705 100644 --- a/lesskey.man +++ b/lesskey.man @@ -117,7 +117,7 @@ LESSKEY(1) General Commands Manual LESSKEY(1) \n forw-line e forw-line j forw-line - \kd forw-line + \kd forw-line ^E forw-line ^N forw-line k back-line @@ -132,15 +132,15 @@ LESSKEY(1) General Commands Manual LESSKEY(1) ^D forw-scroll u back-scroll ^U back-scroll - \40 forw-screen + \40 forw-screen f forw-screen ^F forw-screen ^V forw-screen - \kD forw-screen + \kD forw-screen b back-screen ^B back-screen \ev back-screen - \kU back-screen + \kU back-screen z forw-window w back-window \e\40 forw-screen-force @@ -152,7 +152,7 @@ LESSKEY(1) General Commands Manual LESSKEY(1) ^L repaint \eu undo-hilite g goto-line - \kh goto-line + \kh goto-line < goto-line \e< goto-line p percent @@ -163,6 +163,8 @@ LESSKEY(1) General Commands Manual LESSKEY(1) \e) right-scroll \kl left-scroll \kr right-scroll + \e{ no-scroll + \e} end-scroll { forw-bracket {} } back-bracket {} ( forw-bracket () @@ -174,7 +176,7 @@ LESSKEY(1) General Commands Manual LESSKEY(1) G goto-end \e> goto-end > goto-end - \ke goto-end + \ke goto-end \eG goto-end-buffered = status ^G status @@ -333,7 +335,7 @@ LESSKEY(1) General Commands Manual LESSKEY(1) [1mCOPYRIGHT[0m - Copyright (C) 1984-2015 Mark Nudelman + Copyright (C) 1984-2016 Mark Nudelman less is part of the GNU project and is free software. You can redis- tribute it and/or modify it under the terms of either (1) the GNU Gen- @@ -357,4 +359,4 @@ LESSKEY(1) General Commands Manual LESSKEY(1) - Version 481: 31 Aug 2015 LESSKEY(1) + Version 487: 25 Oct 2016 LESSKEY(1) diff --git a/lesskey.nro b/lesskey.nro index 826332de5eff..252496cac8ac 100644 --- a/lesskey.nro +++ b/lesskey.nro @@ -1,4 +1,4 @@ -.TH LESSKEY 1 "Version 481: 31 Aug 2015" +.TH LESSKEY 1 "Version 487: 25 Oct 2016" .SH NAME lesskey \- specify key bindings for less .SH SYNOPSIS @@ -134,7 +134,7 @@ default command keys used by less: \en forw-line e forw-line j forw-line - \ekd forw-line + \ekd forw-line ^E forw-line ^N forw-line k back-line @@ -149,15 +149,15 @@ default command keys used by less: ^D forw-scroll u back-scroll ^U back-scroll - \e40 forw-screen + \e40 forw-screen f forw-screen ^F forw-screen ^V forw-screen - \ekD forw-screen + \ekD forw-screen b back-screen ^B back-screen \eev back-screen - \ekU back-screen + \ekU back-screen z forw-window w back-window \ee\e40 forw-screen-force @@ -169,7 +169,7 @@ default command keys used by less: ^L repaint \eeu undo-hilite g goto-line - \ekh goto-line + \ekh goto-line < goto-line \ee< goto-line p percent @@ -180,6 +180,8 @@ default command keys used by less: \ee) right-scroll \ekl left-scroll \ekr right-scroll + \ee{ no-scroll + \ee} end-scroll { forw-bracket {} } back-bracket {} ( forw-bracket () @@ -191,7 +193,7 @@ default command keys used by less: G goto-end \ee> goto-end > goto-end - \eke goto-end + \eke goto-end \eeG goto-end-buffered = status ^G status @@ -359,7 +361,7 @@ which start with a NUL character (0). This NUL character should be represented as \e340 in a lesskey file. .SH COPYRIGHT -Copyright (C) 1984-2015 Mark Nudelman +Copyright (C) 1984-2016 Mark Nudelman .PP less is part of the GNU project and is free software. You can redistribute it and/or modify it @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2015 Mark Nudelman + * Copyright (C) 1984-2016 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. @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2015 Mark Nudelman + * Copyright (C) 1984-2016 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. @@ -16,6 +16,7 @@ #include "less.h" #include "charset.h" +#include "position.h" static char *linebuf = NULL; /* Buffer which holds the current output line */ static char *attr = NULL; /* Extension of linebuf to hold attributes */ @@ -40,9 +41,9 @@ static POSITION pendpos; static char *end_ansi_chars; static char *mid_ansi_chars; -static int attr_swidth(int); -static int attr_ewidth(int); -static int do_append(LWCHAR, char *, POSITION); +static int attr_swidth(); +static int attr_ewidth(); +static int do_append(); extern int sigs; extern int bs_mode; @@ -70,7 +71,7 @@ static POSITION mbc_pos; * Initialize from environment variables. */ public void -init_line(void) +init_line() { end_ansi_chars = lgetenv("LESSANSIENDCHARS"); if (end_ansi_chars == NULL || *end_ansi_chars == '\0') @@ -89,7 +90,7 @@ init_line(void) * Expand the line buffer. */ static int -expand_linebuf(void) +expand_linebuf() { /* Double the size of the line buffer. */ int new_size = size_linebuf * 2; @@ -137,7 +138,8 @@ expand_linebuf(void) * Is a character ASCII? */ public int -is_ascii_char(LWCHAR ch) +is_ascii_char(ch) + LWCHAR ch; { return (ch <= 0x7F); } @@ -146,7 +148,7 @@ is_ascii_char(LWCHAR ch) * Rewind the line buffer. */ public void -prewind(void) +prewind() { curr = 0; column = 0; @@ -165,10 +167,11 @@ prewind(void) * Insert the line number (of the given position) into the line buffer. */ public void -plinenum(POSITION pos) +plinenum(pos) + POSITION pos; { - LINENUM linenum = 0; - int i; + register LINENUM linenum = 0; + register int i; if (linenums == OPT_ONPLUS) { @@ -213,7 +216,7 @@ plinenum(POSITION pos) sprintf(linebuf+curr, "%*s ", n, buf); n++; /* One space after the line number. */ for (i = 0; i < n; i++) - attr[curr+i] = AT_NORMAL; + attr[curr+i] = AT_BOLD; curr += n; column += n; lmargin += n; @@ -235,7 +238,8 @@ plinenum(POSITION pos) * This means discarding N printable chars at the start of the buffer. */ static void -pshift(int shift) +pshift(shift) + int shift; { LWCHAR prev_ch = 0; unsigned char c; @@ -352,7 +356,7 @@ pshift(int shift) * */ public void -pshift_all(void) +pshift_all() { pshift(column); } @@ -362,7 +366,8 @@ pshift_all(void) * for a given character attribute. */ static int -attr_swidth(int a) +attr_swidth(a) + int a; { int w = 0; @@ -385,7 +390,8 @@ attr_swidth(int a) * for a given character attribute. */ static int -attr_ewidth(int a) +attr_ewidth(a) + int a; { int w = 0; @@ -410,7 +416,10 @@ attr_ewidth(int a) * attribute sequence to be inserted, so this must be taken into account. */ static int -pwidth(LWCHAR ch, int a, LWCHAR prev_ch) +pwidth(ch, a, prev_ch) + LWCHAR ch; + int a; + LWCHAR prev_ch; { int w; @@ -471,10 +480,10 @@ pwidth(LWCHAR ch, int a, LWCHAR prev_ch) * Return 1 if one is found. */ static int -backc(void) +backc() { LWCHAR prev_ch; - constant char *p = linebuf + curr; + char *p = linebuf + curr; LWCHAR ch = step_char(&p, -1, linebuf + lmargin); int width; @@ -499,9 +508,9 @@ backc(void) * Are we currently within a recognized ANSI escape sequence? */ static int -in_ansi_esc_seq(void) +in_ansi_esc_seq() { - constant char *p; + char *p; /* * Search backwards for either an ESC (which means we ARE in a seq); @@ -522,7 +531,8 @@ in_ansi_esc_seq(void) * Is a character the end of an ANSI escape sequence? */ public int -is_ansi_end(LWCHAR ch) +is_ansi_end(ch) + LWCHAR ch; { if (!is_ascii_char(ch)) return (0); @@ -533,7 +543,8 @@ is_ansi_end(LWCHAR ch) * */ public int -is_ansi_middle(LWCHAR ch) +is_ansi_middle(ch) + LWCHAR ch; { if (!is_ascii_char(ch)) return (0); @@ -551,7 +562,11 @@ is_ansi_middle(LWCHAR ch) } while (0) static int -store_char(LWCHAR ch, int a, char *rep, POSITION pos) +store_char(ch, a, rep, pos) + LWCHAR ch; + int a; + char *rep; + POSITION pos; { int w; int replen; @@ -585,7 +600,7 @@ store_char(LWCHAR ch, int a, char *rep, POSITION pos) { if (!is_ansi_end(ch) && !is_ansi_middle(ch)) { /* Remove whole unrecognized sequence. */ - constant char *p = &linebuf[curr]; + char *p = &linebuf[curr]; LWCHAR bch; do { bch = step_char(&p, -1, linebuf); @@ -603,7 +618,7 @@ store_char(LWCHAR ch, int a, char *rep, POSITION pos) } else { - constant char *p = &linebuf[curr]; + char *p = &linebuf[curr]; LWCHAR prev_ch = step_char(&p, -1, linebuf); w = pwidth(ch, a, prev_ch); } @@ -651,7 +666,9 @@ store_char(LWCHAR ch, int a, char *rep, POSITION pos) do { if (store_tab((a),(pos))) return (1); } while (0) static int -store_tab(int attr, POSITION pos) +store_tab(attr, pos) + int attr; + POSITION pos; { int to_tab = column + cshift - lmargin; int i; @@ -680,7 +697,9 @@ store_tab(int attr, POSITION pos) do { if (store_prchar((c), (pos))) return 1; } while (0) static int -store_prchar(LWCHAR c, POSITION pos) +store_prchar(c, pos) + LWCHAR c; + POSITION pos; { char *s; @@ -704,7 +723,8 @@ store_prchar(LWCHAR c, POSITION pos) } static int -flush_mbc_buf(POSITION pos) +flush_mbc_buf(pos) + POSITION pos; { int i; @@ -721,7 +741,9 @@ flush_mbc_buf(POSITION pos) * Returns 0 if ok, 1 if couldn't fit in buffer. */ public int -pappend(unsigned char c, POSITION pos) +pappend(c, pos) + unsigned char c; + POSITION pos; { int r; @@ -824,9 +846,12 @@ pappend(unsigned char c, POSITION pos) } static int -do_append(LWCHAR ch, char *rep, POSITION pos) +do_append(ch, rep, pos) + LWCHAR ch; + char *rep; + POSITION pos; { - int a; + register int a; LWCHAR prev_ch; a = AT_NORMAL; @@ -961,7 +986,7 @@ do_append(LWCHAR ch, char *rep, POSITION pos) * */ public int -pflushmbc(void) +pflushmbc() { int r = 0; @@ -978,7 +1003,9 @@ pflushmbc(void) * Terminate the line in the line buffer. */ public void -pdone(int endline, int forw) +pdone(endline, forw) + int endline; + int forw; { (void) pflushmbc(); @@ -1055,7 +1082,8 @@ pdone(int endline, int forw) * */ public void -set_status_col(char c) +set_status_col(c) + char c; { linebuf[0] = c; attr[0] = AT_NORMAL|AT_HILITE; @@ -1067,7 +1095,9 @@ set_status_col(char c) * and the character attribute in *ap. */ public int -gline(int i, int *ap) +gline(i, ap) + register int i; + register int *ap; { if (is_null_line) { @@ -1097,7 +1127,7 @@ gline(int i, int *ap) * Indicate that there is no current line. */ public void -null_line(void) +null_line() { is_null_line = 1; cshift = 0; @@ -1109,10 +1139,13 @@ null_line(void) * {{ This is supposed to be more efficient than forw_line(). }} */ public POSITION -forw_raw_line(POSITION curr_pos, char **linep, int *line_lenp) +forw_raw_line(curr_pos, linep, line_lenp) + POSITION curr_pos; + char **linep; + int *line_lenp; { - int n; - int c; + register int n; + register int c; POSITION new_pos; if (curr_pos == NULL_POSITION || ch_seek(curr_pos) || @@ -1155,10 +1188,13 @@ forw_raw_line(POSITION curr_pos, char **linep, int *line_lenp) * {{ This is supposed to be more efficient than back_line(). }} */ public POSITION -back_raw_line(POSITION curr_pos, char **linep, int *line_lenp) +back_raw_line(curr_pos, linep, line_lenp) + POSITION curr_pos; + char **linep; + int *line_lenp; { - int n; - int c; + register int n; + register int c; POSITION new_pos; if (curr_pos == NULL_POSITION || curr_pos <= ch_zero() || @@ -1220,3 +1256,30 @@ back_raw_line(POSITION curr_pos, char **linep, int *line_lenp) *line_lenp = size_linebuf - 1 - n; return (new_pos); } + +/* + * Find the shift necessary to show the end of the longest displayed line. + */ + public int +rrshift() +{ + POSITION pos; + int save_width; + int line; + int longest = 0; + + save_width = sc_width; + sc_width = INT_MAX; + hshift = 0; + pos = position(TOP); + for (line = 0; line < sc_height && pos != NULL_POSITION; line++) + { + pos = forw_line(pos); + if (column > longest) + longest = column; + } + sc_width = save_width; + if (longest < sc_width) + return 0; + return longest - sc_width; +} diff --git a/linenum.c b/linenum.c index 776db34352c5..c1a8128f14d1 100644 --- a/linenum.c +++ b/linenum.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2015 Mark Nudelman + * Copyright (C) 1984-2016 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. @@ -73,9 +73,9 @@ extern int screen_trashed; * Initialize the line number structures. */ public void -clr_linenum(void) +clr_linenum() { - struct linenum_info *p; + register struct linenum_info *p; /* * Put all the entries on the free list. @@ -101,7 +101,8 @@ clr_linenum(void) * Calculate the gap for an entry. */ static void -calcgap(struct linenum_info *p) +calcgap(p) + register struct linenum_info *p; { /* * Don't bother to compute a gap for the anchor. @@ -120,13 +121,15 @@ calcgap(struct linenum_info *p) * FIRST character in the specified line. */ public void -add_lnum(LINENUM linenum, POSITION pos) +add_lnum(linenum, pos) + LINENUM linenum; + POSITION pos; { - struct linenum_info *p; - struct linenum_info *new; - struct linenum_info *nextp; - struct linenum_info *prevp; - POSITION mingap; + register struct linenum_info *p; + register struct linenum_info *new; + register struct linenum_info *nextp; + register struct linenum_info *prevp; + register POSITION mingap; /* * Find the proper place in the list for the new one. @@ -206,7 +209,7 @@ add_lnum(LINENUM linenum, POSITION pos) * line number, print a message to tell the user what we're doing. */ static void -longloopmessage(void) +longloopmessage() { ierror("Calculating line numbers", NULL_PARG); } @@ -217,7 +220,7 @@ static time_type startime; #endif static void -longish(void) +longish() { #if HAVE_TIME if (loopcount >= 0 && ++loopcount > 100) @@ -243,7 +246,7 @@ longish(void) * a lengthy line number calculation. */ static void -abort_long(void) +abort_long() { if (linenums == OPT_ONPLUS) /* @@ -259,10 +262,11 @@ abort_long(void) * Return 0 if we can't figure it out. */ public LINENUM -find_linenum(POSITION pos) +find_linenum(pos) + POSITION pos; { - struct linenum_info *p; - LINENUM linenum; + register struct linenum_info *p; + register LINENUM linenum; POSITION cpos; if (!linenums) @@ -373,9 +377,10 @@ find_linenum(POSITION pos) * Return NULL_POSITION if we can't figure it out. */ public POSITION -find_pos(LINENUM linenum) +find_pos(linenum) + LINENUM linenum; { - struct linenum_info *p; + register struct linenum_info *p; POSITION cpos; LINENUM clinenum; @@ -445,7 +450,8 @@ find_pos(LINENUM linenum) * the "current" line (e.g. TOP, BOTTOM, MIDDLE, etc). */ public LINENUM -currline(int where) +currline(where) + int where; { POSITION pos; POSITION len; diff --git a/lsystem.c b/lsystem.c index 93a5e03ae590..ea3cfb0159d1 100644 --- a/lsystem.c +++ b/lsystem.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2015 Mark Nudelman + * Copyright (C) 1984-2016 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. @@ -38,12 +38,14 @@ extern IFILE curr_ifile; * Like plain "system()", but handles resetting terminal modes, etc. */ public void -lsystem(char *cmd, char *donemsg) +lsystem(cmd, donemsg) + char *cmd; + char *donemsg; { - int inp; + register int inp; #if HAVE_SHELL - char *shell; - char *p; + register char *shell; + register char *p; #endif IFILE save_ifile; #if MSDOS_COMPILER && MSDOS_COMPILER!=WIN32C @@ -248,7 +250,9 @@ lsystem(char *cmd, char *donemsg) * the whole current screen is piped. */ public int -pipe_mark(int c, char *cmd) +pipe_mark(c, cmd) + int c; + char *cmd; { POSITION mpos, tpos, bpos; @@ -280,10 +284,13 @@ pipe_mark(int c, char *cmd) * Feed it the file contents between the positions spos and epos. */ public int -pipe_data(char *cmd, POSITION spos, POSITION epos) +pipe_data(cmd, spos, epos) + char *cmd; + POSITION spos; + POSITION epos; { - FILE *f; - int c; + register FILE *f; + register int c; extern FILE *popen(); /* @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2015 Mark Nudelman + * Copyright (C) 1984-2016 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. @@ -291,9 +291,10 @@ main(argc, argv) * (that is, to a buffer allocated by calloc). */ public char * -save(constant char *s) +save(s) + char *s; { - char *p; + register char *p; p = (char *) ecalloc(strlen(s)+1, sizeof(char)); strcpy(p, s); @@ -305,9 +306,11 @@ save(constant char *s) * Like calloc(), but never returns an error (NULL). */ public VOID_POINTER -ecalloc(int count, unsigned int size) +ecalloc(count, size) + int count; + unsigned int size; { - VOID_POINTER p; + register VOID_POINTER p; p = (VOID_POINTER) calloc(count, size); if (p != NULL) @@ -322,7 +325,8 @@ ecalloc(int count, unsigned int size) * Skip leading spaces in a string. */ public char * -skipsp(char *s) +skipsp(s) + register char *s; { while (*s == ' ' || *s == '\t') s++; @@ -335,11 +339,14 @@ skipsp(char *s) * character; the remainder of the first string may be either case. */ public int -sprefix(char *ps, char *s, int uppercase) +sprefix(ps, s, uppercase) + char *ps; + char *s; + int uppercase; { - int c; - int sc; - int len = 0; + register int c; + register int sc; + register int len = 0; for ( ; *s != '\0'; s++, ps++) { @@ -365,7 +372,8 @@ sprefix(char *ps, char *s, int uppercase) * Exit the program. */ public void -quit(int status) +quit(status) + int status; { static int save_status; @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2015 Mark Nudelman + * Copyright (C) 1984-2016 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. @@ -27,7 +27,7 @@ static struct mark marks[NMARKS]; * Initialize the mark table to show no marks are set. */ public void -init_mark(void) +init_mark() { int i; @@ -39,7 +39,8 @@ init_mark(void) * See if a mark letter is valid (between a and z). */ static struct mark * -getumark(int c) +getumark(c) + int c; { if (c >= 'a' && c <= 'z') return (&marks[c-'a']); @@ -57,9 +58,10 @@ getumark(int c) * or may be constructed on the fly for certain characters like ^, $. */ static struct mark * -getmark(int c) +getmark(c) + int c; { - struct mark *m; + register struct mark *m; static struct mark sm; switch (c) @@ -122,7 +124,8 @@ getmark(int c) * Is a mark letter is invalid? */ public int -badmark(int c) +badmark(c) + int c; { return (getmark(c) == NULL); } @@ -131,9 +134,10 @@ badmark(int c) * Set a user-defined mark. */ public void -setmark(int c) +setmark(c) + int c; { - struct mark *m; + register struct mark *m; struct scrpos scrpos; m = getumark(c); @@ -148,7 +152,7 @@ setmark(int c) * Set lmark (the mark named by the apostrophe). */ public void -lastmark(void) +lastmark() { struct scrpos scrpos; @@ -165,9 +169,10 @@ lastmark(void) * Go to a mark. */ public void -gomark(int c) +gomark(c) + int c; { - struct mark *m; + register struct mark *m; struct scrpos scrpos; m = getmark(c); @@ -212,9 +217,10 @@ gomark(int c) * because it's always the first non-blank line on the screen. */ public POSITION -markpos(int c) +markpos(c) + int c; { - struct mark *m; + register struct mark *m; m = getmark(c); if (m == NULL) @@ -232,7 +238,8 @@ markpos(int c) * Clear the marks associated with a specified ifile. */ public void -unmark(IFILE ifile) +unmark(ifile) + IFILE ifile; { int i; @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2015 Mark Nudelman + * Copyright (C) 1984-2016 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,7 +18,9 @@ #include <stdio.h> int -main(int argc, char *argv[]) +main(argc, argv) + int argc; + char *argv[]; { int ch; int prevch; @@ -4,14 +4,14 @@ use strict; my $USAGE = <<__EOF__; usage: mkutable [-n] [-f#] type... [--] [<] UnicodeData.txt -n = take non-matching types - -f = zero-based type field (default 2) + -f = zero-based type field (default 2) __EOF__ use vars qw( $opt_f $opt_n ); use Getopt::Std; my $type_field = 2; -exit (main() ? 1 : 0); +exit (main() ? 0 : 1); sub main { my $date = `date`; @@ -28,48 +28,58 @@ sub main { $types{$arg} = 1; } my %out = ( 'types' => \%types ); - my $last_code = 0; print $header; + my $last_code = 0; while (<>) { chomp; s/#.*//; my @fields = split /;/; next if not @fields; - my $code = hex $fields[0]; + my ($lo_code, $hi_code); + my $codes = $fields[0]; + if ($codes =~ /(\w+)\.\.(\w+)/) { + $lo_code = hex $1; + $hi_code = hex $2; + } else { + $lo_code = $hi_code = hex $fields[0]; + } my $type = $fields[$type_field]; $type =~ s/\s//g; - while (++$last_code < $code) { - output(\%out, $last_code, '?'); + for ($last_code = $lo_code; $last_code <= $hi_code; ++$last_code) { + output(\%out, $last_code, $type); } - output(\%out, $code, $type); } - output(\%out, $last_code+1, '?'); + output(\%out, $last_code); + return 1; } sub output { my ($out, $code, $type) = @_; - my $match = ${${$out}{types}}{$type}; - my $type_change = (not $$out{start_type} or $type ne $$out{start_type}); - $match = not $match if $opt_n; - if ($match and (not $$out{in_run} or $type_change)) { - end_run($out, $code-1); + my $type_ok = ($type and ${${$out}{types}}{$type}); + $type_ok = not $type_ok if $opt_n; + my $prev_code = $$out{prev_code}; + + if (not $type_ok) { + end_run($out, $prev_code); + } elsif (not $$out{in_run} or $type ne $$out{run_type} or $code != $prev_code+1) { + end_run($out, $prev_code); start_run($out, $code, $type); - } elsif (not $match and $$out{in_run}) { - end_run($out, $code-1); } + $$out{prev_code} = $code; } sub start_run { my ($out, $code, $type) = @_; $$out{start_code} = $code; - $$out{start_type} = $type; + $$out{prev_code} = $code; + $$out{run_type} = $type; $$out{in_run} = 1; } sub end_run { my ($out, $code) = @_; return if not $$out{in_run}; - printf "\t{ 0x%04x, 0x%04x }, /* %s */\n", $$out{start_code}, $code, $$out{start_type}; + printf "\t{ 0x%04x, 0x%04x }, /* %s */\n", $$out{start_code}, $code, $$out{run_type}; $$out{in_run} = 0; } diff --git a/optfunc.c b/optfunc.c index 20ff1ea4cc04..44f8e5fa7038 100644 --- a/optfunc.c +++ b/optfunc.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2015 Mark Nudelman + * Copyright (C) 1984-2016 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. @@ -67,6 +67,7 @@ extern int bo_fg_color, bo_bg_color; extern int ul_fg_color, ul_bg_color; extern int so_fg_color, so_bg_color; extern int bl_fg_color, bl_bg_color; +extern int sgr_mode; #endif @@ -75,7 +76,9 @@ extern int bl_fg_color, bl_bg_color; * Handler for -o option. */ public void -opt_o(int type, char *s) +opt_o(type, s) + int type; + char *s; { PARG parg; @@ -123,7 +126,9 @@ opt_o(int type, char *s) * Handler for -O option. */ public void -opt__O(int type, char *s) +opt__O(type, s) + int type; + char *s; { force_logfile = TRUE; opt_o(type, s); @@ -134,7 +139,9 @@ opt__O(int type, char *s) * Handlers for -j option. */ public void -opt_j(int type, char *s) +opt_j(type, s) + int type; + char *s; { PARG parg; char buf[16]; @@ -186,7 +193,7 @@ opt_j(int type, char *s) } public void -calc_jump_sline(void) +calc_jump_sline() { if (jump_sline_fraction < 0) return; @@ -197,7 +204,9 @@ calc_jump_sline(void) * Handlers for -# option. */ public void -opt_shift(int type, char *s) +opt_shift(type, s) + int type; + char *s; { PARG parg; char buf[16]; @@ -248,7 +257,7 @@ opt_shift(int type, char *s) } } public void -calc_shift_count(void) +calc_shift_count() { if (shift_count_fraction < 0) return; @@ -257,7 +266,9 @@ calc_shift_count(void) #if USERFILE public void -opt_k(int type, char *s) +opt_k(type, s) + int type; + char *s; { PARG parg; @@ -279,7 +290,9 @@ opt_k(int type, char *s) * Handler for -t option. */ public void -opt_t(int type, char *s) +opt_t(type, s) + int type; + char *s; { IFILE save_ifile; POSITION pos; @@ -318,7 +331,9 @@ opt_t(int type, char *s) * Handler for -T option. */ public void -opt__T(int type, char *s) +opt__T(type, s) + int type; + char *s; { PARG parg; @@ -345,7 +360,9 @@ opt__T(int type, char *s) * Handler for -p option. */ public void -opt_p(int type, char *s) +opt_p(type, s) + int type; + register char *s; { switch (type) { @@ -379,9 +396,11 @@ opt_p(int type, char *s) * Handler for -P option. */ public void -opt__P(int type, char *s) +opt__P(type, s) + int type; + register char *s; { - char **proto; + register char **proto; PARG parg; switch (type) @@ -416,7 +435,9 @@ opt__P(int type, char *s) */ /*ARGSUSED*/ public void -opt_b(int type, char *s) +opt_b(type, s) + int type; + char *s; { switch (type) { @@ -437,7 +458,9 @@ opt_b(int type, char *s) */ /*ARGSUSED*/ public void -opt_i(int type, char *s) +opt_i(type, s) + int type; + char *s; { switch (type) { @@ -455,7 +478,9 @@ opt_i(int type, char *s) */ /*ARGSUSED*/ public void -opt__V(int type, char *s) +opt__V(type, s) + int type; + char *s; { switch (type) { @@ -493,7 +518,7 @@ opt__V(int type, char *s) putstr("no "); #endif putstr("regular expressions)\n"); - putstr("Copyright (C) 1984-2015 Mark Nudelman\n\n"); + putstr("Copyright (C) 1984-2016 Mark Nudelman\n\n"); putstr("less comes with NO WARRANTY, to the extent permitted by law.\n"); putstr("For information about the terms of redistribution,\n"); putstr("see the file named README in the less distribution.\n"); @@ -508,7 +533,10 @@ opt__V(int type, char *s) * Parse an MSDOS color descriptor. */ static void -colordesc(char *s, int *fg_color, int *bg_color) +colordesc(s, fg_color, bg_color) + char *s; + int *fg_color; + int *bg_color; { int fg, bg; int err; @@ -542,8 +570,12 @@ colordesc(char *s, int *fg_color, int *bg_color) */ /*ARGSUSED*/ public void -opt_D(int type, char *s) +opt_D(type, s) + int type; + char *s; { + PARG p; + switch (type) { case INIT: @@ -565,8 +597,11 @@ opt_D(int type, char *s) case 's': colordesc(s, &so_fg_color, &so_bg_color); break; + case 'a': + sgr_mode = !sgr_mode; + break; default: - error("-D must be followed by n, d, u, k or s", NULL_PARG); + error("-D must be followed by n, d, u, k, s or a", NULL_PARG); break; } if (type == TOGGLE) @@ -576,6 +611,8 @@ opt_D(int type, char *s) } break; case QUERY: + p.p_string = (sgr_mode) ? "on" : "off"; + error("SGR mode is %s", &p); break; } } @@ -585,7 +622,9 @@ opt_D(int type, char *s) * Handler for the -x option. */ public void -opt_x(int type, char *s) +opt_x(type, s) + int type; + register char *s; { extern int tabstops[]; extern int ntabstops; @@ -641,7 +680,9 @@ opt_x(int type, char *s) * Handler for the -" option. */ public void -opt_quote(int type, char *s) +opt_quote(type, s) + int type; + register char *s; { char buf[3]; PARG parg; @@ -682,7 +723,9 @@ opt_quote(int type, char *s) */ /*ARGSUSED*/ public void -opt_query(int type, char *s) +opt_query(type, s) + int type; + char *s; { switch (type) { @@ -699,7 +742,7 @@ opt_query(int type, char *s) * Get the "screen window" size. */ public int -get_swindow(void) +get_swindow() { if (swindow > 0) return (swindow); @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2015 Mark Nudelman + * Copyright (C) 1984-2016 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. @@ -23,8 +23,8 @@ static struct loption *pendopt; public int plusoption = FALSE; -static char *optstring(char *s, char **p_str, char *printopt, char *validchars); -static int flip_triple(int val, int lc); +static char *optstring(); +static int flip_triple(); extern int screen_trashed; extern int less_is_more; @@ -36,7 +36,8 @@ extern int opt_use_backslash; * Return a printable description of an option. */ static char * -opt_desc(struct loption *o) +opt_desc(o) + struct loption *o; { static char buf[OPTNAME_MAX + 10]; if (o->oletter == OLETTER_NONE) @@ -51,7 +52,8 @@ opt_desc(struct loption *o) * For example, if the option letter is 'x', just return "-x". */ public char * -propt(int c) +propt(c) + int c; { static char buf[8]; @@ -64,10 +66,11 @@ propt(int c) * LESS environment variable) and process it. */ public void -scan_option(char *s) +scan_option(s) + char *s; { - struct loption *o; - int optc; + register struct loption *o; + register int optc; char *optname; char *printopt; char *str; @@ -296,9 +299,13 @@ scan_option(char *s) * OPT_SET set to the inverse of the default value */ public void -toggle_option(struct loption *o, int lower, char *s, int how_toggle) +toggle_option(o, lower, s, how_toggle) + struct loption *o; + int lower; + char *s; + int how_toggle; { - int num; + register int num; int no_prompt; int err; PARG parg; @@ -478,7 +485,9 @@ toggle_option(struct loption *o, int lower, char *s, int how_toggle) * "Toggle" a triple-valued option. */ static int -flip_triple(int val, int lc) +flip_triple(val, lc) + int val; + int lc; { if (lc) return ((val == OPT_ON) ? OPT_OFF : OPT_ON); @@ -490,7 +499,8 @@ flip_triple(int val, int lc) * Determine if an option takes a parameter. */ public int -opt_has_param(struct loption *o) +opt_has_param(o) + struct loption *o; { if (o == NULL) return (0); @@ -504,7 +514,8 @@ opt_has_param(struct loption *o) * Only string and number valued options have prompts. */ public char * -opt_prompt(struct loption *o) +opt_prompt(o) + struct loption *o; { if (o == NULL || (o->otype & (STRING|NUMBER)) == 0) return ("?"); @@ -519,7 +530,7 @@ opt_prompt(struct loption *o) * the previous option. */ public int -isoptpending(void) +isoptpending() { return (pendopt != NULL); } @@ -528,7 +539,8 @@ isoptpending(void) * Print error message about missing string. */ static void -nostring(char *printopt) +nostring(printopt) + char *printopt; { PARG parg; parg.p_string = printopt; @@ -539,7 +551,7 @@ nostring(char *printopt) * Print error message if a STRING type option is not followed by a string. */ public void -nopendopt(void) +nopendopt() { nostring(opt_desc(pendopt)); } @@ -550,10 +562,14 @@ nopendopt(void) * Return a pointer to the remainder of the string, if any. */ static char * -optstring(char *s, char **p_str, char *printopt, char *validchars) +optstring(s, p_str, printopt, validchars) + char *s; + char **p_str; + char *printopt; + char *validchars; { - char *p; - char *out; + register char *p; + register char *out; if (*s == '\0') { @@ -586,7 +602,9 @@ optstring(char *s, char **p_str, char *printopt, char *validchars) /* */ static int -num_error(char *printopt, int *errp) +num_error(printopt, errp) + char *printopt; + int *errp; { PARG parg; @@ -609,11 +627,14 @@ num_error(char *printopt, int *errp) * the char * to point after the translated number. */ public int -getnum(char **sp, char *printopt, int *errp) +getnum(sp, printopt, errp) + char **sp; + char *printopt; + int *errp; { - char *s; - int n; - int neg; + register char *s; + register int n; + register int neg; s = skipsp(*sp); neg = FALSE; @@ -643,9 +664,12 @@ getnum(char **sp, char *printopt, int *errp) * That is, if "n" is returned, the fraction intended is n/NUM_FRAC_DENOM. */ public long -getfraction(char **sp, char *printopt, int *errp) +getfraction(sp, printopt, errp) + char **sp; + char *printopt; + int *errp; { - char *s; + register char *s; long frac = 0; int fraclen = 0; @@ -675,7 +699,7 @@ getfraction(char **sp, char *printopt, int *errp) * Get the value of the -e flag. */ public int -get_quit_at_eof(void) +get_quit_at_eof() { if (!less_is_more) return quit_at_eof; @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2015 Mark Nudelman + * Copyright (C) 1984-2016 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. @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2015 Mark Nudelman + * Copyright (C) 1984-2016 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. @@ -176,10 +176,10 @@ static struct loption option[] = }, #if MSDOS_COMPILER { 'D', &D__optname, - STRING|REPAINT|NO_QUERY, 0, NULL, opt_D, + STRING|REPAINT, 0, NULL, opt_D, { "color desc: ", - "Ddknsu0123456789.", + "Dadknsu0123456789.", NULL } }, @@ -464,9 +464,9 @@ static struct loption option[] = * Initialize each option to its default value. */ public void -init_option(void) +init_option() { - struct loption *o; + register struct loption *o; char *p; p = lgetenv("LESS_IS_MORE"); @@ -489,9 +489,10 @@ init_option(void) * Find an option in the option table, given its option letter. */ public struct loption * -findopt(int c) +findopt(c) + int c; { - struct loption *o; + register struct loption *o; for (o = option; o->oletter != '\0'; o++) { @@ -507,7 +508,8 @@ findopt(int c) * */ static int -is_optchar(char c) +is_optchar(c) + char c; { if (ASCII_IS_UPPER(c)) return 1; @@ -525,12 +527,15 @@ is_optchar(char c) * p_oname if non-NULL is set to point to the full option name. */ public struct loption * -findopt_name(char **p_optname, char **p_oname, int *p_err) +findopt_name(p_optname, p_oname, p_err) + char **p_optname; + char **p_oname; + int *p_err; { char *optname = *p_optname; - struct loption *o; - struct optname *oname; - int len; + register struct loption *o; + register struct optname *oname; + register int len; int uppercase; struct loption *maxo = NULL; struct optname *maxoname = NULL; @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2015 Mark Nudelman + * Copyright (C) 1984-2016 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. @@ -60,9 +60,12 @@ extern int sigs; * any pending iread(). */ public int -iread(int fd, char *buf, unsigned int len) +iread(fd, buf, len) + int fd; + char *buf; + unsigned int len; { - int n; + register int n; start: #if MSDOS_COMPILER==WIN32C @@ -173,7 +176,7 @@ start: * Interrupt a pending iread(). */ public void -intread(void) +intread() { LONG_JUMP(read_label, 1); } @@ -183,7 +186,7 @@ intread(void) */ #if HAVE_TIME public time_type -get_time(void) +get_time() { time_type t; @@ -198,7 +201,8 @@ get_time(void) * Local version of strerror, if not available from the system. */ static char * -strerror(int err) +strerror(err) + int err; { #if HAVE_SYS_ERRLIST static char buf[16]; @@ -219,10 +223,11 @@ strerror(int err) * errno_message: Return an error message based on the value of "errno". */ public char * -errno_message(char *filename) +errno_message(filename) + char *filename; { - char *p; - char *m; + register char *p; + register char *m; int len; #if HAVE_ERRNO #if MUST_DEFINE_ERRNO @@ -241,7 +246,8 @@ errno_message(char *filename) /* #define HAVE_FLOAT 0 */ static POSITION -muldiv(POSITION val, POSITION num, POSITION den) +muldiv(val, num, den) + POSITION val, num, den; { #if HAVE_FLOAT double v = (((double) val) * num) / den; @@ -264,7 +270,8 @@ muldiv(POSITION val, POSITION num, POSITION den) * {{ Assumes a POSITION is a long int. }} */ public int -percentage(POSITION num, POSITION den) +percentage(num, den) + POSITION num, den; { return (int) muldiv(num, (POSITION) 100, den); } @@ -273,7 +280,10 @@ percentage(POSITION num, POSITION den) * Return the specified percentage of a POSITION. */ public POSITION -percent_pos(POSITION pos, int percent, long fraction) +percent_pos(pos, percent, fraction) + POSITION pos; + int percent; + long fraction; { /* Change percent (parts per 100) to perden (parts per NUM_FRAC_DENOM). */ POSITION perden = (percent * (NUM_FRAC_DENOM / 100)) + (fraction / 100); @@ -324,7 +334,9 @@ memcpy(dst, src, len) * This implements an ANSI-style intercept setup for Microware C 3.2 */ public int -os9_signal(int type, RETSIGTYPE (*handler)()) +os9_signal(type, handler) + int type; + RETSIGTYPE (*handler)(); { intercept(handler); } @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2015 Mark Nudelman + * Copyright (C) 1984-2016 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. @@ -37,16 +37,17 @@ extern int bo_fg_color, bo_bg_color; extern int ul_fg_color, ul_bg_color; extern int so_fg_color, so_bg_color; extern int bl_fg_color, bl_bg_color; +extern int sgr_mode; #endif /* * Display the line which is in the line buffer. */ public void -put_line(void) +put_line() { - int c; - int i; + register int c; + register int i; int a; if (ABORT_SIGS()) @@ -93,10 +94,10 @@ static char *ob = obuf; * overwritten or scrolled away. */ public void -flush(void) +flush() { - int n; - int fd; + register int n; + register int fd; n = (int) (ob - obuf); if (n == 0) @@ -126,8 +127,9 @@ flush(void) * the -D command-line option. */ char *anchor, *p, *p_next; - unsigned char fg, bg; + static unsigned char fg, fgi, bg, bgi; static unsigned char at; + unsigned char f, b; #if MSDOS_COMPILER==WIN32C /* Screen colors used by 3x and 4x SGR commands. */ static unsigned char screen_color[] = { @@ -147,6 +149,13 @@ flush(void) }; #endif + if (fg == 0 && bg == 0) + { + fg = nm_fg_color & 7; + fgi = nm_fg_color & 8; + bg = nm_bg_color & 7; + bgi = nm_bg_color & 8; + } for (anchor = p_next = obuf; (p_next = memchr(p_next, ESC, ob - p_next)) != NULL; ) { @@ -173,18 +182,21 @@ flush(void) */ p++; anchor = p_next = p; - at = 0; + fg = nm_fg_color & 7; + fgi = nm_fg_color & 8; + bg = nm_bg_color & 7; + bgi = nm_bg_color & 8; + at = 0; WIN32setcolors(nm_fg_color, nm_bg_color); continue; } p_next = p; + at &= ~32; /* * Select foreground/background colors * based on the escape sequence. */ - fg = nm_fg_color; - bg = nm_bg_color; while (!is_ansi_end(*p)) { char *q; @@ -212,17 +224,35 @@ flush(void) break; } if (*q == ';') + { q++; + at |= 32; + } switch (code) { default: /* case 0: all attrs off */ - fg = nm_fg_color; - bg = nm_bg_color; - at = 0; + fg = nm_fg_color & 7; + bg = nm_bg_color & 7; + at &= 32; + /* + * \e[0m use normal + * intensities, but + * \e[0;...m resets them + */ + if (at & 32) + { + fgi = 0; + bgi = 0; + } else + { + fgi = nm_fg_color & 8; + bgi = nm_bg_color & 8; + } break; case 1: /* bold on */ + fgi = 8; at |= 1; break; case 3: /* italic on */ @@ -230,16 +260,19 @@ flush(void) at |= 2; break; case 4: /* underline on */ + bgi = 8; at |= 4; break; case 5: /* slow blink on */ case 6: /* fast blink on */ + bgi = 8; at |= 8; break; case 8: /* concealed on */ - fg = (bg & 7) | 8; + at |= 16; break; case 22: /* bold off */ + fgi = 0; at &= ~1; break; case 23: /* italic off */ @@ -247,62 +280,84 @@ flush(void) at &= ~2; break; case 24: /* underline off */ + bgi = 0; at &= ~4; break; + case 28: /* concealed off */ + at &= ~16; + break; case 30: case 31: case 32: case 33: case 34: case 35: case 36: case 37: - fg = (fg & 8) | (screen_color[code - 30]); + fg = screen_color[code - 30]; + at |= 32; break; case 39: /* default fg */ - fg = nm_fg_color; + fg = nm_fg_color & 7; + at |= 32; break; case 40: case 41: case 42: case 43: case 44: case 45: case 46: case 47: - bg = (bg & 8) | (screen_color[code - 40]); + bg = screen_color[code - 40]; + at |= 32; break; - case 49: /* default fg */ - bg = nm_bg_color; + case 49: /* default bg */ + bg = nm_bg_color & 7; + at |= 32; break; } p = q; } if (!is_ansi_end(*p) || p == p_next) break; - if (at & 1) + /* + * In SGR mode, the ANSI sequence is + * always honored; otherwise if an attr + * is used by itself ("\e[1m" versus + * "\e[1;33m", for example), set the + * color assigned to that attribute. + */ + if (sgr_mode || (at & 32)) { - /* - * If \e[1m use defined bold - * color, else set intensity. - */ - if (p[-2] == '[') + if (at & 2) { -#if MSDOS_COMPILER==WIN32C - fg |= FOREGROUND_INTENSITY; - bg |= BACKGROUND_INTENSITY; -#else - fg = bo_fg_color; - bg = bo_bg_color; -#endif + f = bg | bgi; + b = fg | fgi; } else - fg |= 8; - } else if (at & 2) - { - fg = so_fg_color; - bg = so_bg_color; - } else if (at & 4) - { - fg = ul_fg_color; - bg = ul_bg_color; - } else if (at & 8) + { + f = fg | fgi; + b = bg | bgi; + } + } else { - fg = bl_fg_color; - bg = bl_bg_color; + if (at & 1) + { + f = bo_fg_color; + b = bo_bg_color; + } else if (at & 2) + { + f = so_fg_color; + b = so_bg_color; + } else if (at & 4) + { + f = ul_fg_color; + b = ul_bg_color; + } else if (at & 8) + { + f = bl_fg_color; + b = bl_bg_color; + } else + { + f = nm_fg_color; + b = nm_bg_color; + } } - fg &= 0xf; - bg &= 0xf; - WIN32setcolors(fg, bg); + if (at & 16) + f = b ^ 8; + f &= 0xf; + b &= 0xf; + WIN32setcolors(f, b); p_next = anchor = p + 1; } else p_next++; @@ -326,7 +381,8 @@ flush(void) * Output a character. */ public int -putchr(int c) +putchr(c) + int c; { #if 0 /* fake UTF-8 output for testing */ extern int utf_mode; @@ -379,7 +435,8 @@ putchr(int c) * Output a string. */ public void -putstr(constant char *s) +putstr(s) + register char *s; { while (*s != '\0') putchr(*s++); @@ -396,7 +453,7 @@ void funcname(num, buf) \ { \ int neg = (num < 0); \ char tbuf[INT_STRLEN_BOUND(num)+2]; \ - char *s = tbuf + sizeof(tbuf); \ + register char *s = tbuf + sizeof(tbuf); \ if (neg) num = -num; \ *--s = '\0'; \ do { \ @@ -414,7 +471,8 @@ TYPE_TO_A_FUNC(inttoa, int) * Output an integer in a given radix. */ static int -iprint_int(int num) +iprint_int(num) + int num; { char buf[INT_STRLEN_BOUND(num)]; @@ -427,7 +485,8 @@ iprint_int(int num) * Output a line number in a given radix. */ static int -iprint_linenum(LINENUM num) +iprint_linenum(num) + LINENUM num; { char buf[INT_STRLEN_BOUND(num)]; @@ -441,10 +500,12 @@ iprint_linenum(LINENUM num) * using a more portable argument list mechanism than printf's. */ static int -less_printf(char *fmt, PARG *parg) +less_printf(fmt, parg) + register char *fmt; + PARG *parg; { - char *s; - int col; + register char *s; + register int col; col = 0; while (*fmt != '\0') @@ -487,7 +548,7 @@ less_printf(char *fmt, PARG *parg) * become the next command. */ public void -get_return(void) +get_return() { int c; @@ -506,7 +567,9 @@ get_return(void) * and wait for carriage return. */ public void -error(char *fmt, PARG *parg) +error(fmt, parg) + char *fmt; + PARG *parg; { int col = 0; static char return_to_continue[] = " (press RETURN)"; @@ -559,7 +622,9 @@ static char intr_to_abort[] = "... (interrupt to abort)"; * time-consuming operation. */ public void -ierror(char *fmt, PARG *parg) +ierror(fmt, parg) + char *fmt; + PARG *parg; { at_exit(); clear_bot(); @@ -576,9 +641,11 @@ ierror(char *fmt, PARG *parg) * and return a single-character response. */ public int -query(char *fmt, PARG *parg) +query(fmt, parg) + char *fmt; + PARG *parg; { - int c; + register int c; int col = 0; if (any_display && is_tty) diff --git a/pattern.c b/pattern.c index 0706f7258819..97a73e9b0e27 100644 --- a/pattern.c +++ b/pattern.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2015 Mark Nudelman + * Copyright (C) 1984-2016 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. @@ -20,7 +20,11 @@ extern int caseless; * Compile a search pattern, for future use by match_pattern. */ static int -compile_pattern2(char *pattern, int search_type, void **comp_pattern, int show_error) +compile_pattern2(pattern, search_type, comp_pattern, show_error) + char *pattern; + int search_type; + void **comp_pattern; + int show_error; { if (search_type & SRCH_NO_REGEX) return (0); @@ -123,7 +127,10 @@ compile_pattern2(char *pattern, int search_type, void **comp_pattern, int show_e * Like compile_pattern2, but convert the pattern to lowercase if necessary. */ public int -compile_pattern(char *pattern, int search_type, void **comp_pattern) +compile_pattern(pattern, search_type, comp_pattern) + char *pattern; + int search_type; + void **comp_pattern; { char *cvt_pattern; int result; @@ -145,7 +152,8 @@ compile_pattern(char *pattern, int search_type, void **comp_pattern) * Forget that we have a compiled pattern. */ public void -uncompile_pattern(void **pattern) +uncompile_pattern(pattern) + void **pattern; { #if HAVE_GNU_REGEX struct re_pattern_buffer **pcomp = (struct re_pattern_buffer **) pattern; @@ -187,7 +195,8 @@ uncompile_pattern(void **pattern) * Can a pattern be successfully compiled? */ public int -valid_pattern(char *pattern) +valid_pattern(pattern) + char *pattern; { void *comp_pattern; int result; @@ -204,7 +213,8 @@ valid_pattern(char *pattern) * Is a compiled pattern null? */ public int -is_null_pattern(void *pattern) +is_null_pattern(pattern) + void *pattern; { #if HAVE_GNU_REGEX return (pattern == NULL); @@ -234,11 +244,16 @@ is_null_pattern(void *pattern) * It supports no metacharacters like *, etc. */ static int -match(char *pattern, int pattern_len, char *buf, int buf_len, char **pfound, char **pend) +match(pattern, pattern_len, buf, buf_len, pfound, pend) + char *pattern; + int pattern_len; + char *buf; + int buf_len; + char **pfound, **pend; { - char *pp, *lp; - char *pattern_end = pattern + pattern_len; - char *buf_end = buf + buf_len; + register char *pp, *lp; + register char *pattern_end = pattern + pattern_len; + register char *buf_end = buf + buf_len; for ( ; buf < buf_end; buf++) { @@ -270,7 +285,15 @@ match(char *pattern, int pattern_len, char *buf, int buf_len, char **pfound, cha * Set sp and ep to the start and end of the matched string. */ public int -match_pattern(void *pattern, char *tpattern, char *line, int line_len, char **sp, char **ep, int notbol, int search_type) +match_pattern(pattern, tpattern, line, line_len, sp, ep, notbol, search_type) + void *pattern; + char *tpattern; + char *line; + int line_len; + char **sp; + char **ep; + int notbol; + int search_type; { int matched; #if HAVE_GNU_REGEX diff --git a/pattern.h b/pattern.h index ca4b8648c69c..67035952af24 100644 --- a/pattern.h +++ b/pattern.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2015 Mark Nudelman + * Copyright (C) 1984-2016 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. @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2015 Mark Nudelman + * Copyright (C) 1984-2016 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/position.c b/position.c index a0e4e3a64417..4f8e60f48c24 100644 --- a/position.c +++ b/position.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2015 Mark Nudelman + * Copyright (C) 1984-2016 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. @@ -36,7 +36,8 @@ extern int sc_width, sc_height; * the line after the bottom line on the screen */ public POSITION -position(int where) +position(where) + int where; { switch (where) { @@ -56,9 +57,10 @@ position(int where) * Add a new file position to the bottom of the position table. */ public void -add_forw_pos(POSITION pos) +add_forw_pos(pos) + POSITION pos; { - int i; + register int i; /* * Scroll the position table up. @@ -72,9 +74,10 @@ add_forw_pos(POSITION pos) * Add a new file position to the top of the position table. */ public void -add_back_pos(POSITION pos) +add_back_pos(pos) + POSITION pos; { - int i; + register int i; /* * Scroll the position table down. @@ -88,9 +91,9 @@ add_back_pos(POSITION pos) * Initialize the position table, done whenever we clear the screen. */ public void -pos_clear(void) +pos_clear() { - int i; + register int i; for (i = 0; i < sc_height; i++) table[i] = NULL_POSITION; @@ -100,7 +103,7 @@ pos_clear(void) * Allocate or reallocate the position table. */ public void -pos_init(void) +pos_init() { struct scrpos scrpos; @@ -129,9 +132,10 @@ pos_init(void) * Return the position table entry if found, -1 if not. */ public int -onscreen(POSITION pos) +onscreen(pos) + POSITION pos; { - int i; + register int i; if (pos < table[0]) return (-1); @@ -145,15 +149,17 @@ onscreen(POSITION pos) * See if the entire screen is empty. */ public int -empty_screen(void) +empty_screen() { return (empty_lines(0, sc_height-1)); } public int -empty_lines(int s, int e) +empty_lines(s, e) + int s; + int e; { - int i; + register int i; for (i = s; i <= e; i++) if (table[i] != NULL_POSITION && table[i] != 0) @@ -170,9 +176,10 @@ empty_lines(int s, int e) * the screen line to a number > 0. */ public void -get_scrpos(struct scrpos *scrpos) +get_scrpos(scrpos) + struct scrpos *scrpos; { - int i; + register int i; /* * Find the first line on the screen which has something on it, @@ -201,7 +208,8 @@ get_scrpos(struct scrpos *scrpos) * relative to the bottom of the screen. */ public int -adjsline(int sline) +adjsline(sline) + int sline; { /* * Negative screen line number means diff --git a/position.h b/position.h index e0e2bff490e4..a0b20c5b6f3a 100644 --- a/position.h +++ b/position.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2015 Mark Nudelman + * Copyright (C) 1984-2016 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. @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2015 Mark Nudelman + * Copyright (C) 1984-2016 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. @@ -66,7 +66,7 @@ static char *mp; * Initialize the prompt prototype strings. */ public void -init_prompt(void) +init_prompt() { prproto[0] = save(s_proto); prproto[1] = save(less_is_more ? more_proto : m_proto); @@ -80,7 +80,8 @@ init_prompt(void) * Append a string to the end of the message. */ static void -ap_str(char *s) +ap_str(s) + char *s; { int len; @@ -96,7 +97,8 @@ ap_str(char *s) * Append a character to the end of the message. */ static void -ap_char(char c) +ap_char(c) + char c; { char buf[2]; @@ -109,7 +111,8 @@ ap_char(char c) * Append a POSITION (as a decimal integer) to the end of the message. */ static void -ap_pos(POSITION pos) +ap_pos(pos) + POSITION pos; { char buf[INT_STRLEN_BOUND(pos) + 2]; @@ -121,7 +124,8 @@ ap_pos(POSITION pos) * Append a line number to the end of the message. */ static void -ap_linenum(LINENUM linenum) +ap_linenum(linenum) + LINENUM linenum; { char buf[INT_STRLEN_BOUND(linenum) + 2]; @@ -133,7 +137,8 @@ ap_linenum(LINENUM linenum) * Append an integer to the end of the message. */ static void -ap_int(int num) +ap_int(num) + int num; { char buf[INT_STRLEN_BOUND(num) + 2]; @@ -145,7 +150,7 @@ ap_int(int num) * Append a question mark to the end of the message. */ static void -ap_quest(void) +ap_quest() { ap_str("?"); } @@ -154,7 +159,8 @@ ap_quest(void) * Return the "current" byte offset in the file. */ static POSITION -curr_byte(int where) +curr_byte(where) + int where; { POSITION pos; @@ -173,7 +179,9 @@ curr_byte(int where) * Here we decode that letter and return the appropriate boolean value. */ static int -cond(char c, int where) +cond(c, where) + char c; + int where; { POSITION len; @@ -235,7 +243,10 @@ cond(char c, int where) * usually by appending something to the message being built. */ static void -protochar(int c, int where, int iseditproto) +protochar(c, where, iseditproto) + int c; + int where; + int iseditproto; { POSITION pos; POSITION len; @@ -382,9 +393,10 @@ protochar(int c, int where, int iseditproto) * We must keep track of nested IFs and skip them properly. */ static constant char * -skipcond(constant char *p) +skipcond(p) + register constant char *p; { - int iflevel; + register int iflevel; /* * We came in here after processing a ? or :, @@ -439,7 +451,9 @@ skipcond(constant char *p) * Decode a char that represents a position on the screen. */ static constant char * -wherechar(char constant *p, int *wp) +wherechar(p, wp) + char constant *p; + int *wp; { switch (*p) { @@ -461,10 +475,12 @@ wherechar(char constant *p, int *wp) * Construct a message based on a prototype string. */ public char * -pr_expand(constant char *proto, int maxwidth) +pr_expand(proto, maxwidth) + constant char *proto; + int maxwidth; { - constant char *p; - int c; + register constant char *p; + register int c; int where; mp = message; @@ -535,7 +551,7 @@ pr_expand(constant char *proto, int maxwidth) * Return a message suitable for printing by the "=" command. */ public char * -eq_message(void) +eq_message() { return (pr_expand(eqproto, 0)); } @@ -547,7 +563,7 @@ eq_message(void) * and the caller will prompt with a colon. */ public char * -pr_string(void) +pr_string() { char *prompt; int type; @@ -564,7 +580,7 @@ pr_string(void) * Return a message suitable for printing while waiting in the F command. */ public char * -wait_message(void) +wait_message() { return (pr_expand(wproto, sc_width-so_s_width-so_e_width-2)); } @@ -207,12 +207,13 @@ STATIC int strcspn(); * of the structure of the compiled regexp. */ regexp * -regcomp(char *exp) +regcomp(exp) +char *exp; { - regexp *r; - char *scan; - char *longest; - int len; + register regexp *r; + register char *scan; + register char *longest; + register int len; int flags; if (exp == NULL) @@ -296,12 +297,14 @@ regcomp(char *exp) * follows makes it hard to avoid. */ static char * -reg(int paren, int *flagp) +reg(paren, flagp) +int paren; /* Parenthesized? */ +int *flagp; { - char *ret; - char *br; - char *ender; - int parno = 0; + register char *ret; + register char *br; + register char *ender; + register int parno = 0; int flags; *flagp = HASWIDTH; /* Tentatively. */ @@ -366,11 +369,12 @@ reg(int paren, int *flagp) * Implements the concatenation operator. */ static char * -regbranch(int *flagp) +regbranch(flagp) +int *flagp; { - char *ret; - char *chain; - char *latest; + register char *ret; + register char *chain; + register char *latest; int flags; *flagp = WORST; /* Tentatively. */ @@ -404,11 +408,12 @@ regbranch(int *flagp) * endmarker role is not redundant. */ static char * -regpiece(int *flagp) +regpiece(flagp) +int *flagp; { - char *ret; - char op; - char *next; + register char *ret; + register char op; + register char *next; int flags; ret = regatom(&flags); @@ -467,9 +472,10 @@ regpiece(int *flagp) * separate node; the code is simpler that way and it's not worth fixing. */ static char * -regatom(int *flagp) +regatom(flagp) +int *flagp; { - char *ret; + register char *ret; int flags; *flagp = WORST; /* Tentatively. */ @@ -486,8 +492,8 @@ regatom(int *flagp) *flagp |= HASWIDTH|SIMPLE; break; case '[': { - int clss; - int classend; + register int clss; + register int classend; if (*regparse == '^') { /* Complement of range. */ ret = regnode(ANYBUT); @@ -547,8 +553,8 @@ regatom(int *flagp) *flagp |= HASWIDTH|SIMPLE; break; default: { - int len; - char ender; + register int len; + register char ender; regparse--; len = (int) strcspn(regparse, META); @@ -577,10 +583,11 @@ regatom(int *flagp) - regnode - emit a node */ static char * /* Location. */ -regnode(char op) +regnode(op) +char op; { - char *ret; - char *ptr; + register char *ret; + register char *ptr; ret = regcode; if (ret == ®dummy) { @@ -601,7 +608,8 @@ regnode(char op) - regc - emit (if appropriate) a byte of code */ static void -regc(char b) +regc(b) +char b; { if (regcode != ®dummy) *regcode++ = b; @@ -615,11 +623,13 @@ regc(char b) * Means relocating the operand. */ static void -reginsert(char op, char *opnd) +reginsert(op, opnd) +char op; +char *opnd; { - char *src; - char *dst; - char *place; + register char *src; + register char *dst; + register char *place; if (regcode == ®dummy) { regsize += 3; @@ -642,11 +652,13 @@ reginsert(char op, char *opnd) - regtail - set the next-pointer at the end of a node chain */ static void -regtail(char *p, char *val) +regtail(p, val) +char *p; +char *val; { - char *scan; - char *temp; - int offset; + register char *scan; + register char *temp; + register int offset; if (p == ®dummy) return; @@ -672,7 +684,9 @@ regtail(char *p, char *val) - regoptail - regtail on operand of first argument; nop if operandless */ static void -regoptail(char *p, char *val) +regoptail(p, val) +char *p; +char *val; { /* "Operandless" and "op != BRANCH" are synonymous in practice. */ if (p == NULL || p == ®dummy || OP(p) != BRANCH) @@ -709,9 +723,12 @@ STATIC char *regprop(); - regexec - match a regexp against a string */ int -regexec2(regexp *prog, char *string, int notbol) +regexec2(prog, string, notbol) +register regexp *prog; +register char *string; +int notbol; { - char *s; + register char *s; /* Be paranoid... */ if (prog == NULL || string == NULL) { @@ -768,7 +785,9 @@ regexec2(regexp *prog, char *string, int notbol) } int -regexec(regexp *prog, char *string) +regexec(prog, string) +register regexp *prog; +register char *string; { return regexec2(prog, string, 0); } @@ -777,11 +796,13 @@ regexec(regexp *prog, char *string) - regtry - try match at specific point */ static int /* 0 failure, 1 success */ -regtry(regexp *prog, char *string) +regtry(prog, string) +regexp *prog; +char *string; { - int i; - char **sp; - char **ep; + register int i; + register char **sp; + register char **ep; reginput = string; regstartp = prog->startp; @@ -812,10 +833,11 @@ regtry(regexp *prog, char *string) * by recursion. */ static int /* 0 failure, 1 success */ -regmatch(char *prog) +regmatch(prog) +char *prog; { - char *scan; /* Current node. */ - char *next; /* Next node. */ + register char *scan; /* Current node. */ + char *next; /* Next node. */ scan = prog; #ifdef DEBUG @@ -844,8 +866,8 @@ regmatch(char *prog) reginput++; break; case EXACTLY: { - int len; - char *opnd; + register int len; + register char *opnd; opnd = OPERAND(scan); /* Inline the first character, for speed. */ @@ -880,8 +902,8 @@ regmatch(char *prog) case OPEN+7: case OPEN+8: case OPEN+9: { - int no; - char *save; + register int no; + register char *save; no = OP(scan) - OPEN; save = reginput; @@ -909,8 +931,8 @@ regmatch(char *prog) case CLOSE+7: case CLOSE+8: case CLOSE+9: { - int no; - char *save; + register int no; + register char *save; no = OP(scan) - CLOSE; save = reginput; @@ -930,7 +952,7 @@ regmatch(char *prog) /* NOTREACHED */ break; case BRANCH: { - char *save; + register char *save; if (OP(next) != BRANCH) /* No choice. */ next = OPERAND(scan); /* Avoid recursion. */ @@ -950,10 +972,10 @@ regmatch(char *prog) break; case STAR: case PLUS: { - char nextch; - int no; - char *save; - int min; + register char nextch; + register int no; + register char *save; + register int min; /* * Lookahead to avoid useless match attempts @@ -1004,11 +1026,12 @@ regmatch(char *prog) - regrepeat - repeatedly match something simple, report how many */ static int -regrepeat(char *p) +regrepeat(p) +char *p; { - int count = 0; - char *scan; - char *opnd; + register int count = 0; + register char *scan; + register char *opnd; scan = reginput; opnd = OPERAND(p); @@ -1049,9 +1072,10 @@ regrepeat(char *p) - regnext - dig the "next" pointer out of a node */ static char * -regnext(char *p) +regnext(p) +register char *p; { - int offset; + register int offset; if (p == ®dummy) return(NULL); @@ -1074,11 +1098,12 @@ STATIC char *regprop(); - regdump - dump a regexp onto stdout in vaguely comprehensible form */ void -regdump(regexp *r) +regdump(r) +regexp *r; { - char *s; - char op = EXACTLY; /* Arbitrary non-END op. */ - char *next; + register char *s; + register char op = EXACTLY; /* Arbitrary non-END op. */ + register char *next; s = r->program + 1; @@ -1116,9 +1141,10 @@ regdump(regexp *r) - regprop - printable representation of opcode */ static char * -regprop(char *op) +regprop(op) +char *op; { - char *p; + register char *p; static char buf[50]; (void) strcpy(buf, ":"); @@ -1207,11 +1233,13 @@ regprop(char *op) */ static int -strcspn(char *s1, char *s2) +strcspn(s1, s2) +char *s1; +char *s2; { - char *scan1; - char *scan2; - int count; + register char *scan1; + register char *scan2; + register int count; count = 0; for (scan1 = s1; *scan1 != '\0'; scan1++) { @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2015 Mark Nudelman + * Copyright (C) 1984-2016 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. @@ -151,6 +151,7 @@ public int bl_fg_color; /* Color of blinking text */ public int bl_bg_color; static int sy_fg_color; /* Color of system text (before less) */ static int sy_bg_color; +public int sgr_mode; /* Honor ANSI sequences rather than using above */ #else @@ -205,9 +206,8 @@ static int attrmode = AT_NORMAL; extern int binattr; #if !MSDOS_COMPILER -static char *cheaper(char *t1, char *t2, char *def); -static void tmodes(char *incap, char *outcap, char **instr, char **outstr, - char *def_instr, char *def_outstr, char **spp); +static char *cheaper(); +static void tmodes(); #endif /* @@ -254,7 +254,8 @@ extern char *tgoto(); * It doesn't matter whether an input \n is mapped to \r, or vice versa. */ public void -raw_mode(int on) +raw_mode(on) + int on; { static int curr_on = 0; @@ -618,7 +619,8 @@ raw_mode(int on) static int hardcopy; static char * -ltget_env(char *capname) +ltget_env(capname) + char *capname; { char name[16]; char *s; @@ -646,7 +648,8 @@ ltget_env(char *capname) } static int -ltgetflag(char *capname) +ltgetflag(capname) + char *capname; { char *s; @@ -658,7 +661,8 @@ ltgetflag(char *capname) } static int -ltgetnum(char *capname) +ltgetnum(capname) + char *capname; { char *s; @@ -670,7 +674,9 @@ ltgetnum(char *capname) } static char * -ltgetstr(char *capname, char **pp) +ltgetstr(capname, pp) + char *capname; + char **pp; { char *s; @@ -686,9 +692,9 @@ ltgetstr(char *capname, char **pp) * Get size of the output screen. */ public void -scrsize(void) +scrsize() { - char *s; + register char *s; int sys_height; int sys_width; #if !MSDOS_COMPILER @@ -816,7 +822,7 @@ scrsize(void) * Figure out how many empty loops it takes to delay a millisecond. */ static void -get_clock(void) +get_clock() { clock_t start; @@ -844,14 +850,15 @@ get_clock(void) * Delay for a specified number of milliseconds. */ static void -dummy_func(void) +dummy_func() { static long delay_dummy = 0; delay_dummy++; } static void -delay(int msec) +delay(msec) + int msec; { long i; @@ -873,7 +880,8 @@ delay(int msec) * Return the characters actually input by a "special" key. */ public char * -special_key_str(int key) +special_key_str(key) + int key; { static char tbuf[40]; char *s; @@ -1045,7 +1053,7 @@ special_key_str(int key) * Get terminal capabilities via termcap. */ public void -get_term(void) +get_term() { #if MSDOS_COMPILER auto_wrap = 1; @@ -1099,6 +1107,7 @@ get_term(void) so_bg_color = 9; bl_fg_color = 15; bl_bg_color = 0; + sgr_mode = 0; /* * Get size of the screen. @@ -1110,7 +1119,7 @@ get_term(void) #else /* !MSDOS_COMPILER */ char *sp; - char *t1, *t2; + register char *t1, *t2; char *term; char termbuf[TERMBUF_SIZE]; @@ -1342,14 +1351,16 @@ static int costcount; /*ARGSUSED*/ static int -inc_costcount(int c) +inc_costcount(c) + int c; { costcount++; return (c); } static int -cost(char *t) +cost(t) + char *t; { costcount = 0; tputs(t, sc_height, inc_costcount); @@ -1362,7 +1373,9 @@ cost(char *t) * cost (see cost() function). */ static char * -cheaper(char *t1, char *t2, char *def) +cheaper(t1, t2, def) + char *t1, *t2; + char *def; { if (*t1 == '\0' && *t2 == '\0') { @@ -1379,8 +1392,14 @@ cheaper(char *t1, char *t2, char *def) } static void -tmodes(char *incap, char *outcap, char **instr, char **outstr, char *def_instr, - char *def_outstr, char **spp) +tmodes(incap, outcap, instr, outstr, def_instr, def_outstr, spp) + char *incap; + char *outcap; + char **instr; + char **outstr; + char *def_instr; + char *def_outstr; + char **spp; { *instr = ltgetstr(incap, spp); if (*instr == NULL) @@ -1429,8 +1448,11 @@ _settextposition(int row, int col) * Initialize the screen to the correct color at startup. */ static void -initcolor(void) +initcolor() { +#if MSDOS_COMPILER==BORLANDC || MSDOS_COMPILER==DJGPPC + intensevideo(); +#endif SETCOLORS(nm_fg_color, nm_bg_color); #if 0 /* @@ -1462,7 +1484,7 @@ initcolor(void) * Termcap-like init with a private win32 console. */ static void -win32_init_term(void) +win32_init_term() { CONSOLE_SCREEN_BUFFER_INFO scr; COORD size; @@ -1513,7 +1535,7 @@ win32_deinit_term() * Initialize terminal */ public void -init(void) +init() { #if !MSDOS_COMPILER if (!no_init) @@ -1549,7 +1571,7 @@ init(void) * Deinitialize terminal */ public void -deinit(void) +deinit() { if (!init_done) return; @@ -1576,7 +1598,7 @@ deinit(void) * Home cursor (move to upper left corner of screen). */ public void -home(void) +home() { #if !MSDOS_COMPILER tputs(sc_home, 1, putchr); @@ -1591,7 +1613,7 @@ home(void) * Should scroll the display down. */ public void -add_line(void) +add_line() { #if !MSDOS_COMPILER tputs(sc_addline, sc_height, putchr); @@ -1649,7 +1671,8 @@ add_line(void) * into the scrollback buffer when we go down-one-line (in WIN32). */ public void -remove_top(int n) +remove_top(n) + int n; { #if MSDOS_COMPILER==WIN32C SMALL_RECT rcSrc, rcClip; @@ -1702,7 +1725,7 @@ remove_top(int n) * Clear the screen. */ static void -win32_clear(void) +win32_clear() { /* * This will clear only the currently visible rows of the NT @@ -1733,7 +1756,8 @@ win32_clear(void) * window upward. */ public void -win32_scroll_up(int n) +win32_scroll_up(n) + int n; { SMALL_RECT rcSrc, rcClip; CHAR_INFO fillchar; @@ -1798,7 +1822,7 @@ win32_scroll_up(int n) * Move cursor to lower left corner of screen. */ public void -lower_left(void) +lower_left() { #if !MSDOS_COMPILER tputs(sc_lower_left, 1, putchr); @@ -1812,7 +1836,7 @@ lower_left(void) * Move cursor to left position of current line. */ public void -line_left(void) +line_left() { #if !MSDOS_COMPILER tputs(sc_return, 1, putchr); @@ -1844,7 +1868,7 @@ line_left(void) * (in lieu of SIGWINCH for WIN32). */ public void -check_winch(void) +check_winch() { #if MSDOS_COMPILER==WIN32C CONSOLE_SCREEN_BUFFER_INFO scr; @@ -1874,7 +1898,8 @@ check_winch(void) * Goto a specific line on the screen. */ public void -goto_line(int slinenum) +goto_line(slinenum) + int slinenum; { #if !MSDOS_COMPILER tputs(tgoto(sc_move, 0, slinenum), 1, putchr); @@ -1892,7 +1917,7 @@ goto_line(int slinenum) * {{ Yuck! There must be a better way to get a visual bell. }} */ static void -create_flash(void) +create_flash() { #if MSDOS_COMPILER==MSOFTC struct videoconfig w; @@ -1921,7 +1946,7 @@ create_flash(void) } #else #if MSDOS_COMPILER==BORLANDC - int n; + register int n; whitescreen = (unsigned short *) malloc(sc_width * sc_height * sizeof(short)); @@ -1931,7 +1956,7 @@ create_flash(void) whitescreen[n] = 0x7020; #else #if MSDOS_COMPILER==WIN32C - int n; + register int n; whitescreen = (WORD *) malloc(sc_height * sc_width * sizeof(WORD)); @@ -1951,7 +1976,7 @@ create_flash(void) * Output the "visual bell", if there is one. */ public void -vbell(void) +vbell() { #if !MSDOS_COMPILER if (*sc_visual_bell == '\0') @@ -2015,7 +2040,7 @@ vbell(void) * Make a noise. */ static void -beep(void) +beep() { #if !MSDOS_COMPILER putchr(CONTROL('G')); @@ -2032,7 +2057,7 @@ beep(void) * Ring the terminal bell. */ public void -bell(void) +bell() { if (quiet == VERY_QUIET) vbell(); @@ -2044,7 +2069,7 @@ bell(void) * Clear the screen. */ public void -clear(void) +clear() { #if !MSDOS_COMPILER tputs(sc_clear, sc_height, putchr); @@ -2063,7 +2088,7 @@ clear(void) * {{ This must not move the cursor. }} */ public void -clear_eol(void) +clear_eol() { #if !MSDOS_COMPILER tputs(sc_eol_clear, 1, putchr); @@ -2122,7 +2147,7 @@ clear_eol(void) * Clear the screen if there's off-screen memory below the display. */ static void -clear_eol_bot(void) +clear_eol_bot() { #if MSDOS_COMPILER clear_eol(); @@ -2139,7 +2164,7 @@ clear_eol_bot(void) * Leave the cursor at the beginning of the bottom line. */ public void -clear_bot(void) +clear_bot() { /* * If we're in a non-normal attribute mode, temporarily exit @@ -2164,7 +2189,8 @@ clear_bot(void) } public void -at_enter(int attr) +at_enter(attr) + int attr; { attr = apply_at_specials(attr); @@ -2202,7 +2228,7 @@ at_enter(int attr) } public void -at_exit(void) +at_exit() { #if !MSDOS_COMPILER /* Undo things in the reverse order we did them. */ @@ -2223,7 +2249,8 @@ at_exit(void) } public void -at_switch(int attr) +at_switch(attr) + int attr; { int new_attrmode = apply_at_specials(attr); int ignore_modes = AT_ANSI; @@ -2236,7 +2263,9 @@ at_switch(int attr) } public int -is_at_equiv(int attr1, int attr2) +is_at_equiv(attr1, attr2) + int attr1; + int attr2; { attr1 = apply_at_specials(attr1); attr2 = apply_at_specials(attr2); @@ -2245,7 +2274,8 @@ is_at_equiv(int attr1, int attr2) } public int -apply_at_specials(int attr) +apply_at_specials(attr) + int attr; { if (attr & AT_BINARY) attr |= binattr; @@ -2262,7 +2292,7 @@ apply_at_specials(int attr) * and move the cursor left. */ public void -backspace(void) +backspace() { #if !MSDOS_COMPILER /* @@ -2311,7 +2341,7 @@ backspace(void) * Output a plain backspace, without erasing the previous char. */ public void -putbs(void) +putbs() { #if !MSDOS_COMPILER tputs(sc_backspace, 1, putchr); @@ -2350,7 +2380,8 @@ putbs(void) * Determine whether an input character is waiting to be read. */ static int -win32_kbhit(HANDLE tty) +win32_kbhit(tty) + HANDLE tty; { INPUT_RECORD ip; DWORD read; @@ -2406,7 +2437,16 @@ win32_kbhit(HANDLE tty) currentKey.scan = PCK_CTL_DELETE; break; } + } else if (ip.Event.KeyEvent.dwControlKeyState & SHIFT_PRESSED) + { + switch (currentKey.scan) + { + case PCK_SHIFT_TAB: /* tab */ + currentKey.ascii = 0; + break; + } } + return (TRUE); } @@ -2414,7 +2454,8 @@ win32_kbhit(HANDLE tty) * Read a character from the keyboard. */ public char -WIN32getch(int tty) +WIN32getch(tty) + int tty; { int ascii; @@ -2447,7 +2488,9 @@ WIN32getch(int tty) /* */ public void -WIN32setcolors(int fg, int bg) +WIN32setcolors(fg, bg) + int fg; + int bg; { SETCOLORS(fg, bg); } @@ -2455,7 +2498,9 @@ WIN32setcolors(int fg, int bg) /* */ public void -WIN32textout(char *text, int len) +WIN32textout(text, len) + char *text; + int len; { #if MSDOS_COMPILER==WIN32C DWORD written; diff --git a/scrsize.c b/scrsize.c index c08d666704b5..c928ebae8f47 100644 --- a/scrsize.c +++ b/scrsize.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2015 Mark Nudelman + * Copyright (C) 1984-2016 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. @@ -45,7 +45,11 @@ #include <stdlib.h> #include <stdio.h> -static int get_winsize(Display *dpy, Window window, int *p_width, int *p_height) +static int get_winsize(dpy, window, p_width, p_height) + Display *dpy; + Window window; + int *p_width; + int *p_height; { XWindowAttributes win_attributes; XSizeHints hints; @@ -75,7 +79,9 @@ static int get_winsize(Display *dpy, Window window, int *p_width, int *p_height) return 0; } -int main(int argc, char *argv[]) +int main(argc, argv) + int argc; + char *argv[]; { char *cp; Display *dpy; @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2015 Mark Nudelman + * Copyright (C) 1984-2016 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,9 +121,10 @@ static struct pattern_info filter_info; * Are there any uppercase letters in this string? */ static int -is_ucase(constant char *str) +is_ucase(str) + char *str; { - constant char *str_end = str + strlen(str); + char *str_end = str + strlen(str); LWCHAR ch; while (str < str_end) @@ -139,13 +140,15 @@ is_ucase(constant char *str) * Compile and save a search pattern. */ static int -set_pattern(struct pattern_info *info, char *pattern, int search_type) +set_pattern(info, pattern, search_type) + struct pattern_info *info; + char *pattern; + int search_type; { #if !NO_REGEX if (pattern == NULL) CLEAR_PATTERN(info->compiled); - else if (compile_pattern(pattern, search_type, - (void **)&info->compiled) < 0) + else if (compile_pattern(pattern, search_type, &info->compiled) < 0) return -1; #endif /* Pattern compiled successfully; save the text too. */ @@ -175,13 +178,14 @@ set_pattern(struct pattern_info *info, char *pattern, int search_type) * Discard a saved pattern. */ static void -clear_pattern(struct pattern_info *info) +clear_pattern(info) + struct pattern_info *info; { if (info->text != NULL) free(info->text); info->text = NULL; #if !NO_REGEX - uncompile_pattern((void **)&info->compiled); + uncompile_pattern(&info->compiled); #endif } @@ -189,7 +193,8 @@ clear_pattern(struct pattern_info *info) * Initialize saved pattern to nothing. */ static void -init_pattern(struct pattern_info *info) +init_pattern(info) + struct pattern_info *info; { CLEAR_PATTERN(info->compiled); info->text = NULL; @@ -200,7 +205,7 @@ init_pattern(struct pattern_info *info) * Initialize search variables. */ public void -init_search(void) +init_search() { init_pattern(&search_info); init_pattern(&filter_info); @@ -210,7 +215,7 @@ init_search(void) * Determine which text conversions to perform before pattern matching. */ static int -get_cvt_ops(void) +get_cvt_ops() { int ops = 0; if (is_caseless || bs_mode == BS_SPECIAL) @@ -234,7 +239,8 @@ get_cvt_ops(void) * Is there a previous (remembered) search pattern? */ static int -prev_pattern(struct pattern_info *info) +prev_pattern(info) + struct pattern_info *info; { #if !NO_REGEX if ((info->search_type & SRCH_NO_REGEX) == 0) @@ -250,7 +256,8 @@ prev_pattern(struct pattern_info *info) * If on==0, force all hilites off. */ public void -repaint_hilite(int on) +repaint_hilite(on) + int on; { int slinenum; POSITION pos; @@ -291,7 +298,7 @@ repaint_hilite(int on) * Clear the attn hilite. */ public void -clear_attn(void) +clear_attn() { int slinenum; POSITION old_start_attnpos; @@ -338,7 +345,7 @@ clear_attn(void) * Hide search string highlighting. */ public void -undo_search(void) +undo_search() { if (!prev_pattern(&search_info)) { @@ -356,7 +363,8 @@ undo_search(void) * Clear the hilite list. */ public void -clr_hlist(struct hilite_tree *anchor) +clr_hlist(anchor) + struct hilite_tree *anchor; { struct hilite_storage *hls; struct hilite_storage *nexthls; @@ -377,13 +385,13 @@ clr_hlist(struct hilite_tree *anchor) } public void -clr_hilite(void) +clr_hilite() { clr_hlist(&hilite_anchor); } public void -clr_filter(void) +clr_filter() { clr_hlist(&filter_anchor); } @@ -512,7 +520,9 @@ hlist_find(anchor, pos) * Should any characters in a specified range be highlighted? */ static int -is_hilited_range(POSITION pos, POSITION epos) +is_hilited_range(pos, epos) + POSITION pos; + POSITION epos; { struct hilite_node *n = hlist_find(&hilite_anchor, pos); return (n != NULL && (epos == NULL_POSITION || epos > n->r.hl_startpos)); @@ -522,7 +532,8 @@ is_hilited_range(POSITION pos, POSITION epos) * Is a line "filtered" -- that is, should it be hidden? */ public int -is_filtered(POSITION pos) +is_filtered(pos) + POSITION pos; { struct hilite_node *n; @@ -538,7 +549,8 @@ is_filtered(POSITION pos) * just return pos. */ public POSITION -next_unfiltered(POSITION pos) +next_unfiltered(pos) + POSITION pos; { struct hilite_node *n; @@ -559,7 +571,8 @@ next_unfiltered(POSITION pos) * we're filtered right to the beginning, otherwise just return pos. */ public POSITION -prev_unfiltered(POSITION pos) +prev_unfiltered(pos) + POSITION pos; { struct hilite_node *n; @@ -584,7 +597,11 @@ prev_unfiltered(POSITION pos) * If nohide is nonzero, don't consider hide_hilite. */ public int -is_hilited(POSITION pos, POSITION epos, int nohide, int *p_matches) +is_hilited(pos, epos, nohide, p_matches) + POSITION pos; + POSITION epos; + int nohide; + int *p_matches; { int match; @@ -630,7 +647,8 @@ is_hilited(POSITION pos, POSITION epos, int nohide, int *p_matches) * capacity, or create a new one if not. */ static struct hilite_storage* -hlist_getstorage(struct hilite_tree *anchor) +hlist_getstorage(anchor) + struct hilite_tree *anchor; { int capacity = 1; struct hilite_storage *s; @@ -660,7 +678,8 @@ hlist_getstorage(struct hilite_tree *anchor) * tree. */ static struct hilite_node* -hlist_getnode(struct hilite_tree *anchor) +hlist_getnode(anchor) + struct hilite_tree *anchor; { struct hilite_storage *s = hlist_getstorage(anchor); return &s->nodes[s->used++]; @@ -670,7 +689,9 @@ hlist_getnode(struct hilite_tree *anchor) * Rotate the tree left around a pivot node. */ static void -hlist_rotate_left(struct hilite_tree *anchor, struct hilite_node *n) +hlist_rotate_left(anchor, n) + struct hilite_tree *anchor; + struct hilite_node *n; { struct hilite_node *np = n->parent; struct hilite_node *nr = n->right; @@ -699,7 +720,9 @@ hlist_rotate_left(struct hilite_tree *anchor, struct hilite_node *n) * Rotate the tree right around a pivot node. */ static void -hlist_rotate_right(struct hilite_tree *anchor, struct hilite_node *n) +hlist_rotate_right(anchor, n) + struct hilite_tree *anchor; + struct hilite_node *n; { struct hilite_node *np = n->parent; struct hilite_node *nl = n->left; @@ -729,7 +752,9 @@ hlist_rotate_right(struct hilite_tree *anchor, struct hilite_node *n) * Add a new hilite to a hilite list. */ static void -add_hilite(struct hilite_tree *anchor, struct hilite *hl) +add_hilite(anchor, hl) + struct hilite_tree *anchor; + struct hilite *hl; { struct hilite_node *p, *n, *u; @@ -906,7 +931,11 @@ add_hilite(struct hilite_tree *anchor, struct hilite *hl) * Hilight every character in a range of displayed characters. */ static void -create_hilites(POSITION linepos, int start_index, int end_index, int *chpos) +create_hilites(linepos, start_index, end_index, chpos) + POSITION linepos; + int start_index; + int end_index; + int *chpos; { struct hilite hl; int i; @@ -943,8 +972,14 @@ create_hilites(POSITION linepos, int start_index, int end_index, int *chpos) * sp,ep delimit the first match already found. */ static void -hilite_line(POSITION linepos, char *line, int line_len, int *chpos, char *sp, - char *ep, int cvt_ops) +hilite_line(linepos, line, line_len, chpos, sp, ep, cvt_ops) + POSITION linepos; + char *line; + int line_len; + int *chpos; + char *sp; + char *ep; + int cvt_ops; { char *searchp; char *line_end = line + line_len; @@ -980,33 +1015,12 @@ hilite_line(POSITION linepos, char *line, int line_len, int *chpos, char *sp, } #endif -/* - * Change the caseless-ness of searches. - * Updates the internal search state to reflect a change in the -i flag. - */ - public void -chg_caseless(void) -{ - if (!is_ucase_pattern) - /* - * Pattern did not have uppercase. - * Just set the search caselessness to the global caselessness. - */ - is_caseless = caseless; - else - /* - * Pattern did have uppercase. - * Discard the pattern; we can't change search caselessness now. - */ - clear_pattern(&search_info); -} - #if HILITE_SEARCH /* * Find matching text which is currently on screen and highlight it. */ static void -hilite_screen(void) +hilite_screen() { struct scrpos scrpos; @@ -1021,7 +1035,7 @@ hilite_screen(void) * Change highlighting parameters. */ public void -chg_hilite(void) +chg_hilite() { /* * Erase any highlights currently on screen. @@ -1041,7 +1055,8 @@ chg_hilite(void) * Figure out where to start a search. */ static POSITION -search_pos(int search_type) +search_pos(search_type) + int search_type; { POSITION pos; int linenum; @@ -1078,18 +1093,18 @@ search_pos(int search_type) * Search does not include current screen. */ if (search_type & SRCH_FORW) - linenum = BOTTOM_PLUS_ONE; + linenum = sc_height-1; /* BOTTOM_PLUS_ONE */ else - linenum = TOP; + linenum = 0; /* TOP */ } else if (how_search == OPT_ONPLUS && !(search_type & SRCH_AFTER_TARGET)) { /* * Search includes all of displayed screen. */ if (search_type & SRCH_FORW) - linenum = TOP; + linenum = 0; /* TOP */ else - linenum = BOTTOM_PLUS_ONE; + linenum = sc_height-1; /* BOTTOM_PLUS_ONE */ } else { /* @@ -1133,8 +1148,14 @@ search_pos(int search_type) * Search a subset of the file, specified by start/end position. */ static int -search_range(POSITION pos, POSITION endpos, int search_type, int matches, - int maxlines, POSITION *plinepos, POSITION *pendpos) +search_range(pos, endpos, search_type, matches, maxlines, plinepos, pendpos) + POSITION pos; + POSITION endpos; + int search_type; + int matches; + int maxlines; + POSITION *plinepos; + POSITION *pendpos; { char *line; char *cline; @@ -1313,7 +1334,8 @@ search_range(POSITION pos, POSITION endpos, int search_type, int matches, * search for a pattern in history. If found, compile that pattern. */ static int -hist_pattern(int search_type) +hist_pattern(search_type) + int search_type; { #if CMD_HISTORY char *pattern; @@ -1338,6 +1360,30 @@ hist_pattern(int search_type) } /* + * Change the caseless-ness of searches. + * Updates the internal search state to reflect a change in the -i flag. + */ + public void +chg_caseless() +{ + if (!is_ucase_pattern) + /* + * Pattern did not have uppercase. + * Just set the search caselessness to the global caselessness. + */ + is_caseless = caseless; + else + { + /* + * Pattern did have uppercase. + * Regenerate the pattern using the new state. + */ + clear_pattern(&search_info); + hist_pattern(search_info.search_type); + } +} + +/* * Search for the n-th occurrence of a specified pattern, * either forward or backward. * Return the number of matches not yet found in this file @@ -1347,7 +1393,10 @@ hist_pattern(int search_type) * if less than n matches are found in this file. */ public int -search(int search_type, char *pattern, int n) +search(search_type, pattern, n) + int search_type; + char *pattern; + int n; { POSITION pos; @@ -1481,7 +1530,10 @@ search(int search_type, char *pattern, int n) * prep_hilite asks that the range (spos,epos) be covered by the prep region. */ public void -prep_hilite(POSITION spos, POSITION epos, int maxlines) +prep_hilite(spos, epos, maxlines) + POSITION spos; + POSITION epos; + int maxlines; { POSITION nprep_startpos = prep_startpos; POSITION nprep_endpos = prep_endpos; @@ -1648,7 +1700,9 @@ prep_hilite(POSITION spos, POSITION epos, int maxlines) * Set the pattern to be used for line filtering. */ public void -set_filter_pattern(char *pattern, int search_type) +set_filter_pattern(pattern, search_type) + char *pattern; + int search_type; { clr_filter(); if (pattern == NULL || *pattern == '\0') @@ -1662,7 +1716,7 @@ set_filter_pattern(char *pattern, int search_type) * Is there a line filter in effect? */ public int -is_filtering(void) +is_filtering() { if (ch_getflags() & CH_HELPFILE) return (0); @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2015 Mark Nudelman + * Copyright (C) 1984-2016 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,7 +40,8 @@ extern long jump_sline_fraction; */ /* ARGSUSED*/ static RETSIGTYPE -u_interrupt(int type) +u_interrupt(type) + int type; { bell(); #if OS2 @@ -67,7 +68,8 @@ u_interrupt(int type) */ /* ARGSUSED*/ static RETSIGTYPE -stop(int type) +stop(type) + int type; { LSIGNAL(SIGTSTP, stop); sigs |= S_STOP; @@ -82,7 +84,8 @@ stop(int type) */ /* ARGSUSED*/ public RETSIGTYPE -winch(int type) +winch(type) + int type; { LSIGNAL(SIGWINCH, winch); sigs |= S_WINCH; @@ -96,7 +99,8 @@ winch(int type) */ /* ARGSUSED*/ public RETSIGTYPE -winch(int type) +winch(type) + int type; { LSIGNAL(SIGWIND, winch); sigs |= S_WINCH; @@ -113,7 +117,8 @@ winch(int type) #include "windows.h" static BOOL WINAPI -wbreak_handler(DWORD dwCtrlType) +wbreak_handler(dwCtrlType) + DWORD dwCtrlType; { switch (dwCtrlType) { @@ -132,7 +137,8 @@ wbreak_handler(DWORD dwCtrlType) * Set up the signal handlers. */ public void -init_signals(int on) +init_signals(on) + int on; { if (on) { @@ -184,9 +190,9 @@ init_signals(int on) * A received signal cause a bit to be set in "sigs". */ public void -psignals(void) +psignals() { - int tsignals; + register int tsignals; if ((tsignals = sigs) == 0) return; @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2015 Mark Nudelman + * Copyright (C) 1984-2016 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. @@ -43,13 +43,13 @@ enum { T_GPATH /* 'GPATH': path name (global) */ }; -static enum tag_result findctag(char *tag); -static enum tag_result findgtag(char *tag, int type); -static char *nextgtag(void); -static char *prevgtag(void); -static POSITION ctagsearch(void); -static POSITION gtagsearch(void); -static int getentry(char *buf, char **tag, char **file, char **line); +static enum tag_result findctag(); +static enum tag_result findgtag(); +static char *nextgtag(); +static char *prevgtag(); +static POSITION ctagsearch(); +static POSITION gtagsearch(); +static int getentry(); /* * The list of tags generated by the last findgtag() call. @@ -88,9 +88,9 @@ static struct tag *curtag; * Delete tag structures. */ public void -cleantags(void) +cleantags() { - struct tag *tp; + register struct tag *tp; /* * Delete any existing tag list. @@ -110,9 +110,14 @@ cleantags(void) * Create a new tag entry. */ static struct tag * -maketagent(char *name, char *file, LINENUM linenum, char *pattern, int endline) +maketagent(name, file, linenum, pattern, endline) + char *name; + char *file; + LINENUM linenum; + char *pattern; + int endline; { - struct tag *tp; + register struct tag *tp; tp = (struct tag *) ecalloc(sizeof(struct tag), 1); tp->tag_file = (char *) ecalloc(strlen(file) + 1, sizeof(char)); @@ -133,7 +138,7 @@ maketagent(char *name, char *file, LINENUM linenum, char *pattern, int endline) * Get tag mode. */ public int -gettagtype(void) +gettagtype() { int f; @@ -164,7 +169,8 @@ gettagtype(void) * to find the tag. */ public void -findtag(char *tag) +findtag(tag) + register char *tag; { int type = gettagtype(); enum tag_result result; @@ -194,7 +200,7 @@ findtag(char *tag) * Search for a tag. */ public POSITION -tagsearch(void) +tagsearch() { if (curtag == NULL) return (NULL_POSITION); /* No gtags loaded! */ @@ -208,7 +214,8 @@ tagsearch(void) * Go to the next tag. */ public char * -nexttag(int n) +nexttag(n) + int n; { char *tagfile = (char *) NULL; @@ -221,7 +228,8 @@ nexttag(int n) * Go to the previous tag. */ public char * -prevtag(int n) +prevtag(n) + int n; { char *tagfile = (char *) NULL; @@ -234,7 +242,7 @@ prevtag(int n) * Return the total number of tags. */ public int -ntags(void) +ntags() { return total; } @@ -243,7 +251,7 @@ ntags(void) * Return the sequence number of current tag. */ public int -curr_tag(void) +curr_tag() { return curseq; } @@ -257,11 +265,12 @@ curr_tag(void) * Sets curtag to the first tag entry. */ static enum tag_result -findctag(char *tag) +findctag(tag) + register char *tag; { char *p; - FILE *f; - int taglen; + register FILE *f; + register int taglen; LINENUM taglinenum; char *tagfile; char *tagpattern; @@ -368,7 +377,7 @@ findctag(char *tag) * Edit current tagged file. */ public int -edit_tagfile(void) +edit_tagfile() { if (curtag == NULL) return (1); @@ -385,7 +394,7 @@ edit_tagfile(void) * parentheses (which are almost always found in a tag). */ static POSITION -ctagsearch(void) +ctagsearch() { POSITION pos, linepos; LINENUM linenum; @@ -461,7 +470,9 @@ ctagsearch(void) * Sets curtag to the first tag entry. */ static enum tag_result -findgtag(char *tag, int type) +findgtag(tag, type) + char *tag; /* tag to load */ + int type; /* tags type */ { char buf[256]; FILE *fp; @@ -594,7 +605,7 @@ static int circular = 0; /* 1: circular tag structure */ * appropriate tag. */ static char * -nextgtag(void) +nextgtag() { struct tag *tp; @@ -624,7 +635,7 @@ nextgtag(void) * at the appropriate tag. */ static char * -prevgtag(void) +prevgtag() { struct tag *tp; @@ -654,7 +665,7 @@ prevgtag(void) * if it was unable to position at the tag, 0 if successful. */ static POSITION -gtagsearch(void) +gtagsearch() { if (curtag == NULL) return (NULL_POSITION); /* No gtags loaded! */ @@ -690,7 +701,11 @@ gtagsearch(void) * into buf. */ static int -getentry(char *buf, char **tag, char **file, char **line) +getentry(buf, tag, file, line) + char *buf; /* standard or extended ctags -x format data */ + char **tag; /* name of the tag we actually found */ + char **file; /* file in which to find this tag */ + char **line; /* line number of file where this tag is found */ { char *p = buf; @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2015 Mark Nudelman + * Copyright (C) 1984-2016 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,7 @@ extern int utf_mode; * Open keyboard for input. */ public void -open_getchr(void) +open_getchr() { #if MSDOS_COMPILER==WIN32C /* Need this to let child processes inherit our console handle */ @@ -85,7 +85,7 @@ open_getchr(void) * Close the keyboard. */ public void -close_getchr(void) +close_getchr() { #if MSDOS_COMPILER==WIN32C SetConsoleMode((HANDLE)tty, console_mode); @@ -97,7 +97,7 @@ close_getchr(void) * Get a character from the keyboard. */ public int -getchr(void) +getchr() { char c; int result; @@ -135,8 +135,8 @@ getchr(void) #if 0 /* allow entering arbitrary hex chars for testing */ /* ctrl-A followed by two hex chars makes a byte */ { - int hex_in = 0; - int hex_value = 0; + static int hex_in = 0; + static int hex_value = 0; if (c == CONTROL('A')) { hex_in = 2; @@ -1,4 +1,4 @@ -/* Generated by "./mkutable -f2 Cc Cf Cs Co Zl Zp -- unicode/UnicodeData.txt" on Mon Jul 14 16:21:22 PDT 2014 */ +/* Generated by "./mkutable -f2 Cc Cf Cs Co Zl Zp -- unicode/UnicodeData.txt" on Tue Sep 20 10:51:43 PDT 2016 */ { 0x0000, 0x001f }, /* Cc */ { 0x007f, 0x009f }, /* Cc */ { 0x00ad, 0x00ad }, /* Cf */ @@ -6,6 +6,7 @@ { 0x061c, 0x061c }, /* Cf */ { 0x06dd, 0x06dd }, /* Cf */ { 0x070f, 0x070f }, /* Cf */ + { 0x08e2, 0x08e2 }, /* Cf */ { 0x180e, 0x180e }, /* Cf */ { 0x200b, 0x200f }, /* Cf */ { 0x2028, 0x2028 }, /* Zl */ diff --git a/version.c b/version.c index 87b0b42bc855..dde1af0dd6e0 100644 --- a/version.c +++ b/version.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2015 Mark Nudelman + * Copyright (C) 1984-2016 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. @@ -789,8 +789,22 @@ v477 5/19/15 Fix off-by-one in jump_forw_buffered; don't add FAKE_* files to cmd history. v478 5/21/15 Fix nonportable pointer usage in hilite tree. v479 7/6/15 Allow %% escapes in LESSOPEN variable. -v480 7/24/15 Fix bug in no-regex searches; support MSVC v1900. -v481 8/20/15 Fix broken -g option. +v480 7/24/15 Fix bug in no-regex searches; support MSVC v1900. +v481 8/20/15 Fix broken -g option. +----------------------------------------------------------------- +v482 2/25/16 Update Unicode database to "2015-06-16, 20:24:00 GMT [KW]". +v483 2/27/16 Regenerate hilite when change search caselessness. + (Thanks to Jason Hood) + Fix bug when terminal has no "cm". (Thanks to Noel Cragg) +v484 9/20/16 Update to Unicode 9.0.0 database. +v485 10/21/16 Fix "nothing to search" bug when top/bottom line is empty; + Display line numbers in bold. (thanks to Jason Hood); + Fix incorrect display when entering double-width chars in + search string. +v486 10/22/16 New commands ESC-{ and ESC-} to shift to start/end of + displayed lines; new option -Da in Windows version to + enable SGR mode (thanks to Jason Hood). +v487 10/23/16 configure --help formatting. */ -char version[] = "481"; +char version[] = "487"; @@ -1,81 +1,108 @@ -/* Generated by "./mkutable -f1 W -- unicode/EastAsianWidth.txt" on Mon Jul 14 16:21:23 PDT 2014 */ - { 0x1100, 0x1100 }, /* W */ +/* Generated by "./mkutable -f1 W F -- unicode/EastAsianWidth.txt" on Tue Sep 20 10:51:43 PDT 2016 */ + { 0x1100, 0x115f }, /* W */ + { 0x231a, 0x231b }, /* W */ { 0x2329, 0x232a }, /* W */ - { 0x2e80, 0x2e80 }, /* W */ - { 0x2e9b, 0x2e9b }, /* W */ - { 0x2f00, 0x2f00 }, /* W */ - { 0x2ff0, 0x2ff0 }, /* W */ - { 0x3001, 0x3001 }, /* W */ - { 0x3004, 0x3012 }, /* W */ - { 0x3014, 0x301e }, /* W */ - { 0x3020, 0x3021 }, /* W */ - { 0x302a, 0x302a }, /* W */ - { 0x302e, 0x302e }, /* W */ - { 0x3030, 0x3031 }, /* W */ - { 0x3036, 0x3036 }, /* W */ - { 0x3038, 0x3038 }, /* W */ - { 0x303b, 0x303e }, /* W */ - { 0x3041, 0x3041 }, /* W */ - { 0x3099, 0x3099 }, /* W */ - { 0x309b, 0x309b }, /* W */ - { 0x309d, 0x309d }, /* W */ - { 0x309f, 0x30a1 }, /* W */ - { 0x30fb, 0x30fc }, /* W */ - { 0x30ff, 0x30ff }, /* W */ - { 0x3105, 0x3105 }, /* W */ - { 0x3131, 0x3131 }, /* W */ - { 0x3190, 0x3190 }, /* W */ - { 0x3192, 0x3192 }, /* W */ - { 0x3196, 0x3196 }, /* W */ - { 0x31a0, 0x31a0 }, /* W */ - { 0x31c0, 0x31c0 }, /* W */ - { 0x31f0, 0x31f0 }, /* W */ - { 0x3200, 0x3200 }, /* W */ - { 0x3220, 0x3220 }, /* W */ - { 0x322a, 0x322a }, /* W */ - { 0x3250, 0x3251 }, /* W */ - { 0x3260, 0x3260 }, /* W */ - { 0x3280, 0x3280 }, /* W */ - { 0x328a, 0x328a }, /* W */ - { 0x32b1, 0x32b1 }, /* W */ - { 0x32c0, 0x32c0 }, /* W */ - { 0x3300, 0x3300 }, /* W */ - { 0x3400, 0x3400 }, /* W */ - { 0x4db6, 0x4db6 }, /* W */ - { 0x4e00, 0x4e00 }, /* W */ - { 0x9fcd, 0x9fcd }, /* W */ - { 0xa000, 0xa000 }, /* W */ - { 0xa015, 0xa016 }, /* W */ - { 0xa490, 0xa490 }, /* W */ - { 0xa960, 0xa960 }, /* W */ - { 0xac00, 0xac00 }, /* W */ - { 0xf900, 0xf900 }, /* W */ - { 0xfa6e, 0xfa6e }, /* W */ - { 0xfa70, 0xfa70 }, /* W */ - { 0xfada, 0xfada }, /* W */ - { 0xfe10, 0xfe10 }, /* W */ - { 0xfe17, 0xfe19 }, /* W */ - { 0xfe30, 0xfe31 }, /* W */ - { 0xfe33, 0xfe33 }, /* W */ - { 0xfe35, 0xfe45 }, /* W */ - { 0xfe47, 0xfe49 }, /* W */ - { 0xfe4d, 0xfe4d }, /* W */ - { 0xfe50, 0xfe50 }, /* W */ - { 0xfe54, 0xfe54 }, /* W */ - { 0xfe58, 0xfe5f }, /* W */ - { 0xfe62, 0xfe64 }, /* W */ - { 0xfe68, 0xfe6a }, /* W */ - { 0x1b000, 0x1b000 }, /* W */ - { 0x1f200, 0x1f200 }, /* W */ - { 0x1f210, 0x1f210 }, /* W */ - { 0x1f240, 0x1f240 }, /* W */ - { 0x1f250, 0x1f250 }, /* W */ - { 0x20000, 0x20000 }, /* W */ - { 0x2a6d7, 0x2a6d7 }, /* W */ - { 0x2a700, 0x2a700 }, /* W */ - { 0x2b735, 0x2b735 }, /* W */ - { 0x2b740, 0x2b740 }, /* W */ - { 0x2b81e, 0x2b81e }, /* W */ - { 0x2f800, 0x2f800 }, /* W */ - { 0x2fa1e, 0x2fa1e }, /* W */ - { 0x30000, 0x30000 }, /* W */ + { 0x23e9, 0x23ec }, /* W */ + { 0x23f0, 0x23f0 }, /* W */ + { 0x23f3, 0x23f3 }, /* W */ + { 0x25fd, 0x25fe }, /* W */ + { 0x2614, 0x2615 }, /* W */ + { 0x2648, 0x2653 }, /* W */ + { 0x267f, 0x267f }, /* W */ + { 0x2693, 0x2693 }, /* W */ + { 0x26a1, 0x26a1 }, /* W */ + { 0x26aa, 0x26ab }, /* W */ + { 0x26bd, 0x26be }, /* W */ + { 0x26c4, 0x26c5 }, /* W */ + { 0x26ce, 0x26ce }, /* W */ + { 0x26d4, 0x26d4 }, /* W */ + { 0x26ea, 0x26ea }, /* W */ + { 0x26f2, 0x26f3 }, /* W */ + { 0x26f5, 0x26f5 }, /* W */ + { 0x26fa, 0x26fa }, /* W */ + { 0x26fd, 0x26fd }, /* W */ + { 0x2705, 0x2705 }, /* W */ + { 0x270a, 0x270b }, /* W */ + { 0x2728, 0x2728 }, /* W */ + { 0x274c, 0x274c }, /* W */ + { 0x274e, 0x274e }, /* W */ + { 0x2753, 0x2755 }, /* W */ + { 0x2757, 0x2757 }, /* W */ + { 0x2795, 0x2797 }, /* W */ + { 0x27b0, 0x27b0 }, /* W */ + { 0x27bf, 0x27bf }, /* W */ + { 0x2b1b, 0x2b1c }, /* W */ + { 0x2b50, 0x2b50 }, /* W */ + { 0x2b55, 0x2b55 }, /* W */ + { 0x2e80, 0x2e99 }, /* W */ + { 0x2e9b, 0x2ef3 }, /* W */ + { 0x2f00, 0x2fd5 }, /* W */ + { 0x2ff0, 0x2ffb }, /* W */ + { 0x3000, 0x3000 }, /* F */ + { 0x3001, 0x303e }, /* W */ + { 0x3041, 0x3096 }, /* W */ + { 0x3099, 0x30ff }, /* W */ + { 0x3105, 0x312d }, /* W */ + { 0x3131, 0x318e }, /* W */ + { 0x3190, 0x31ba }, /* W */ + { 0x31c0, 0x31e3 }, /* W */ + { 0x31f0, 0x321e }, /* W */ + { 0x3220, 0x3247 }, /* W */ + { 0x3250, 0x32fe }, /* W */ + { 0x3300, 0x4dbf }, /* W */ + { 0x4e00, 0xa48c }, /* W */ + { 0xa490, 0xa4c6 }, /* W */ + { 0xa960, 0xa97c }, /* W */ + { 0xac00, 0xd7a3 }, /* W */ + { 0xf900, 0xfaff }, /* W */ + { 0xfe10, 0xfe19 }, /* W */ + { 0xfe30, 0xfe52 }, /* W */ + { 0xfe54, 0xfe66 }, /* W */ + { 0xfe68, 0xfe6b }, /* W */ + { 0xff01, 0xff60 }, /* F */ + { 0xffe0, 0xffe6 }, /* F */ + { 0x16fe0, 0x16fe0 }, /* W */ + { 0x17000, 0x187ec }, /* W */ + { 0x18800, 0x18af2 }, /* W */ + { 0x1b000, 0x1b001 }, /* W */ + { 0x1f004, 0x1f004 }, /* W */ + { 0x1f0cf, 0x1f0cf }, /* W */ + { 0x1f18e, 0x1f18e }, /* W */ + { 0x1f191, 0x1f19a }, /* W */ + { 0x1f200, 0x1f202 }, /* W */ + { 0x1f210, 0x1f23b }, /* W */ + { 0x1f240, 0x1f248 }, /* W */ + { 0x1f250, 0x1f251 }, /* W */ + { 0x1f300, 0x1f320 }, /* W */ + { 0x1f32d, 0x1f335 }, /* W */ + { 0x1f337, 0x1f37c }, /* W */ + { 0x1f37e, 0x1f393 }, /* W */ + { 0x1f3a0, 0x1f3ca }, /* W */ + { 0x1f3cf, 0x1f3d3 }, /* W */ + { 0x1f3e0, 0x1f3f0 }, /* W */ + { 0x1f3f4, 0x1f3f4 }, /* W */ + { 0x1f3f8, 0x1f43e }, /* W */ + { 0x1f440, 0x1f440 }, /* W */ + { 0x1f442, 0x1f4fc }, /* W */ + { 0x1f4ff, 0x1f53d }, /* W */ + { 0x1f54b, 0x1f54e }, /* W */ + { 0x1f550, 0x1f567 }, /* W */ + { 0x1f57a, 0x1f57a }, /* W */ + { 0x1f595, 0x1f596 }, /* W */ + { 0x1f5a4, 0x1f5a4 }, /* W */ + { 0x1f5fb, 0x1f64f }, /* W */ + { 0x1f680, 0x1f6c5 }, /* W */ + { 0x1f6cc, 0x1f6cc }, /* W */ + { 0x1f6d0, 0x1f6d2 }, /* W */ + { 0x1f6eb, 0x1f6ec }, /* W */ + { 0x1f6f4, 0x1f6f6 }, /* W */ + { 0x1f910, 0x1f91e }, /* W */ + { 0x1f920, 0x1f927 }, /* W */ + { 0x1f930, 0x1f930 }, /* W */ + { 0x1f933, 0x1f93e }, /* W */ + { 0x1f940, 0x1f94b }, /* W */ + { 0x1f950, 0x1f95e }, /* W */ + { 0x1f980, 0x1f991 }, /* W */ + { 0x1f9c0, 0x1f9c0 }, /* W */ + { 0x20000, 0x2fffd }, /* W */ + { 0x30000, 0x3fffd }, /* W */ |