svn commit: r317397 - vendor/less/dist
Xin LI
delphij at FreeBSD.org
Tue Apr 25 03:42:19 UTC 2017
Author: delphij
Date: Tue Apr 25 03:42:16 2017
New Revision: 317397
URL: https://svnweb.freebsd.org/changeset/base/317397
Log:
Vendor import of less 487.
Modified:
vendor/less/dist/LICENSE
vendor/less/dist/Makefile.aut
vendor/less/dist/Makefile.wnm
vendor/less/dist/NEWS
vendor/less/dist/README
vendor/less/dist/brac.c
vendor/less/dist/ch.c
vendor/less/dist/charset.c
vendor/less/dist/charset.h
vendor/less/dist/cmd.h
vendor/less/dist/cmdbuf.c
vendor/less/dist/command.c
vendor/less/dist/compose.uni
vendor/less/dist/configure
vendor/less/dist/configure.ac
vendor/less/dist/cvt.c
vendor/less/dist/decode.c
vendor/less/dist/defines.ds
vendor/less/dist/defines.o2
vendor/less/dist/defines.o9
vendor/less/dist/defines.wn
vendor/less/dist/edit.c
vendor/less/dist/filename.c
vendor/less/dist/forwback.c
vendor/less/dist/funcs.h
vendor/less/dist/help.c
vendor/less/dist/ifile.c
vendor/less/dist/input.c
vendor/less/dist/jump.c
vendor/less/dist/less.h
vendor/less/dist/less.hlp
vendor/less/dist/less.man
vendor/less/dist/less.nro
vendor/less/dist/lessecho.c
vendor/less/dist/lessecho.man
vendor/less/dist/lessecho.nro
vendor/less/dist/lesskey.c
vendor/less/dist/lesskey.h
vendor/less/dist/lesskey.man
vendor/less/dist/lesskey.nro
vendor/less/dist/lglob.h
vendor/less/dist/line.c
vendor/less/dist/linenum.c
vendor/less/dist/lsystem.c
vendor/less/dist/main.c
vendor/less/dist/mark.c
vendor/less/dist/mkhelp.c
vendor/less/dist/mkutable
vendor/less/dist/optfunc.c
vendor/less/dist/option.c
vendor/less/dist/option.h
vendor/less/dist/opttbl.c
vendor/less/dist/os.c
vendor/less/dist/output.c
vendor/less/dist/pattern.c
vendor/less/dist/pattern.h
vendor/less/dist/pckeys.h
vendor/less/dist/position.c
vendor/less/dist/position.h
vendor/less/dist/prompt.c
vendor/less/dist/regexp.c
vendor/less/dist/screen.c
vendor/less/dist/scrsize.c
vendor/less/dist/search.c
vendor/less/dist/signal.c
vendor/less/dist/tags.c
vendor/less/dist/ttyin.c
vendor/less/dist/ubin.uni
vendor/less/dist/version.c
vendor/less/dist/wide.uni
Modified: vendor/less/dist/LICENSE
==============================================================================
--- vendor/less/dist/LICENSE Tue Apr 25 03:29:35 2017 (r317396)
+++ vendor/less/dist/LICENSE Tue Apr 25 03:42:16 2017 (r317397)
@@ -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
Modified: vendor/less/dist/Makefile.aut
==============================================================================
--- vendor/less/dist/Makefile.aut Tue Apr 25 03:29:35 2017 (r317396)
+++ vendor/less/dist/Makefile.aut Tue Apr 25 03:42:16 2017 (r317397)
@@ -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}
Modified: vendor/less/dist/Makefile.wnm
==============================================================================
--- vendor/less/dist/Makefile.wnm Tue Apr 25 03:29:35 2017 (r317396)
+++ vendor/less/dist/Makefile.wnm Tue Apr 25 03:42:16 2017 (r317397)
@@ -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:$@
Modified: vendor/less/dist/NEWS
==============================================================================
--- vendor/less/dist/NEWS Tue Apr 25 03:29:35 2017 (r317396)
+++ vendor/less/dist/NEWS Tue Apr 25 03:42:16 2017 (r317397)
@@ -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.
Modified: vendor/less/dist/README
==============================================================================
--- vendor/less/dist/README Tue Apr 25 03:29:35 2017 (r317396)
+++ vendor/less/dist/README Tue Apr 25 03:42:16 2017 (r317397)
@@ -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
Modified: vendor/less/dist/brac.c
==============================================================================
--- vendor/less/dist/brac.c Tue Apr 25 03:29:35 2017 (r317396)
+++ vendor/less/dist/brac.c Tue Apr 25 03:42:16 2017 (r317397)
@@ -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.
Modified: vendor/less/dist/ch.c
==============================================================================
--- vendor/less/dist/ch.c Tue Apr 25 03:29:35 2017 (r317396)
+++ vendor/less/dist/ch.c Tue Apr 25 03:42:16 2017 (r317397)
@@ -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);
Modified: vendor/less/dist/charset.c
==============================================================================
--- vendor/less/dist/charset.c Tue Apr 25 03:29:35 2017 (r317396)
+++ vendor/less/dist/charset.c Tue Apr 25 03:42:16 2017 (r317397)
@@ -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, cha
*
*/
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, in
* 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 l
* 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_rang
* 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;
Modified: vendor/less/dist/charset.h
==============================================================================
--- vendor/less/dist/charset.h Tue Apr 25 03:29:35 2017 (r317396)
+++ vendor/less/dist/charset.h Tue Apr 25 03:42:16 2017 (r317397)
@@ -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.
Modified: vendor/less/dist/cmd.h
==============================================================================
--- vendor/less/dist/cmd.h Tue Apr 25 03:29:35 2017 (r317396)
+++ vendor/less/dist/cmd.h Tue Apr 25 03:42:16 2017 (r317397)
@@ -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
Modified: vendor/less/dist/cmdbuf.c
==============================================================================
--- vendor/less/dist/cmdbuf.c Tue Apr 25 03:29:35 2017 (r317396)
+++ vendor/less/dist/cmdbuf.c Tue Apr 25 03:42:16 2017 (r317397)
@@ -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
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
* 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, i
* 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, in
* 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 == ' ')
{
*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
More information about the svn-src-vendor
mailing list