Date: Fri, 5 May 2017 14:33:39 +0000 (UTC) From: Xin LI <delphij@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317829 - in head: contrib/less usr.bin/less Message-ID: <201705051433.v45EXdqG096022@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: delphij Date: Fri May 5 14:33:39 2017 New Revision: 317829 URL: https://svnweb.freebsd.org/changeset/base/317829 Log: MFV r317581: less v491. MFC after: 1 month Modified: head/contrib/less/LICENSE head/contrib/less/NEWS head/contrib/less/README head/contrib/less/brac.c head/contrib/less/ch.c head/contrib/less/charset.c head/contrib/less/charset.h head/contrib/less/cmd.h head/contrib/less/cmdbuf.c head/contrib/less/command.c head/contrib/less/compose.uni head/contrib/less/cvt.c head/contrib/less/decode.c head/contrib/less/edit.c head/contrib/less/filename.c head/contrib/less/forwback.c head/contrib/less/funcs.h head/contrib/less/help.c head/contrib/less/ifile.c head/contrib/less/input.c head/contrib/less/jump.c head/contrib/less/less.h head/contrib/less/less.hlp head/contrib/less/less.nro head/contrib/less/lessecho.c head/contrib/less/lessecho.nro head/contrib/less/lesskey.c head/contrib/less/lesskey.h head/contrib/less/lesskey.nro head/contrib/less/lglob.h head/contrib/less/line.c head/contrib/less/linenum.c head/contrib/less/lsystem.c head/contrib/less/main.c head/contrib/less/mark.c head/contrib/less/mkhelp.c head/contrib/less/mkutable head/contrib/less/optfunc.c head/contrib/less/option.c head/contrib/less/option.h head/contrib/less/opttbl.c head/contrib/less/os.c head/contrib/less/output.c head/contrib/less/pattern.c head/contrib/less/pattern.h head/contrib/less/pckeys.h head/contrib/less/position.c head/contrib/less/position.h head/contrib/less/prompt.c head/contrib/less/regexp.c head/contrib/less/screen.c head/contrib/less/scrsize.c head/contrib/less/search.c head/contrib/less/signal.c head/contrib/less/tags.c head/contrib/less/ttyin.c head/contrib/less/ubin.uni head/contrib/less/version.c head/contrib/less/wide.uni head/usr.bin/less/defines.h Directory Properties: head/contrib/less/ (props changed) Modified: head/contrib/less/LICENSE ============================================================================== --- head/contrib/less/LICENSE Fri May 5 14:09:44 2017 (r317828) +++ head/contrib/less/LICENSE Fri May 5 14:33:39 2017 (r317829) @@ -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: head/contrib/less/NEWS ============================================================================== --- head/contrib/less/NEWS Fri May 5 14:09:44 2017 (r317828) +++ head/contrib/less/NEWS Fri May 5 14:33:39 2017 (r317829) @@ -11,6 +11,40 @@ ====================================================================== + Major changes between "less" versions 487 and 491 + +* Don't output terminal init sequence if using -F and file fits on one screen. + +* Use ANSI prototypes in funcs.h declarations. + +* Fix some const mismatches. + +* Remove "register" in variable declarations. + +* Fix some memory leaks. + +====================================================================== + + 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: head/contrib/less/README ============================================================================== --- head/contrib/less/README Fri May 5 14:09:44 2017 (r317828) +++ head/contrib/less/README Fri May 5 14:33:39 2017 (r317829) @@ -7,9 +7,9 @@ ************************************************************************** ************************************************************************** - Less, version 481 + Less, version 491 - This is the distribution of less, version 481, released 31 Aug 2015. + This is the distribution of less, version 491, released 07 Apr 2017. This program is part of the GNU project (http://www.gnu.org). This program is free software. You may redistribute it and/or Modified: head/contrib/less/brac.c ============================================================================== --- head/contrib/less/brac.c Fri May 5 14:09:44 2017 (r317828) +++ head/contrib/less/brac.c Fri May 5 14:33:39 2017 (r317829) @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2015 Mark Nudelman + * Copyright (C) 1984-2017 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) + int obrac; + int cbrac; + int forwdir; + int n; { int c; 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: head/contrib/less/ch.c ============================================================================== --- head/contrib/less/ch.c Fri May 5 14:09:44 2017 (r317828) +++ head/contrib/less/ch.c Fri May 5 14:33:39 2017 (r317829) @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2015 Mark Nudelman + * Copyright (C) 1984-2017 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -144,7 +144,7 @@ static int ch_addbuf(); * Get the character pointed to by the read pointer. */ int -ch_get(void) +ch_get() { struct buf *bp; struct bufnode *bn; @@ -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,7 +417,7 @@ 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; @@ -453,7 +454,8 @@ 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; @@ -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) + 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,7 +542,7 @@ 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; @@ -567,7 +570,7 @@ 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; @@ -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,7 +630,7 @@ ch_tell(void) * Get the current char and post-increment the read pointer. */ public int -ch_forw_get(void) +ch_forw_get() { int c; @@ -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,7 +693,7 @@ ch_setbufspace(int bufspace) * Flush (discard) any saved file state, including buffer contents. */ public void -ch_flush(void) +ch_flush() { struct bufnode *bn; @@ -756,7 +760,7 @@ 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; @@ -781,7 +785,7 @@ ch_addbuf(void) * */ static void -init_hashtbl(void) +init_hashtbl() { int h; @@ -796,7 +800,7 @@ init_hashtbl(void) * Delete all buffers for this file. */ static void -ch_delbufs(void) +ch_delbufs() { struct bufnode *bn; @@ -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: head/contrib/less/charset.c ============================================================================== --- head/contrib/less/charset.c Fri May 5 14:09:44 2017 (r317828) +++ head/contrib/less/charset.c Fri May 5 14:33:39 2017 (r317829) @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2015 Mark Nudelman + * Copyright (C) 1984-2017 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,7 +132,8 @@ public int binattr = AT_STANDOUT; * c control character */ static void -ichardef(char *s) +ichardef(s) + char *s; { char *cp; int n; @@ -186,7 +189,9 @@ 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) + char *name; + int no_error; { struct charset *p; struct cs_alias *a; @@ -227,7 +232,7 @@ icharset(char *name, int no_error) * Define a charset, given a locale name. */ static void -ilocale(void) +ilocale() { int 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) + unsigned char ch; { if ((ch & 0x80) == 0) return 1; @@ -495,15 +508,18 @@ 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(ss, slen) + char *ss; + int slen; { int i; int len; + unsigned char *s = (unsigned char *) ss; if (IS_UTF8_INVALID(s[0])) return (0); - len = utf_len((char) s[0]); + len = utf_len(s[0]); if (len > slen) return (0); if (len == 1) @@ -530,14 +546,16 @@ 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) + char *data; + int len; { int bin_count = 0; while (len > 0) { if (is_utf8_well_formed(data, len)) { - int clen = utf_len(*data); + int clen = utf_len(*data & 0377); data += clen; len -= clen; } else @@ -547,7 +565,7 @@ utf_bin_count(unsigned char *data, int l do { ++data; --len; - } while (len > 0 && !IS_UTF8_LEAD(*data)); + } while (len > 0 && !IS_UTF8_LEAD(*data & 0377)); } } return (bin_count); @@ -557,7 +575,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) + constant char *p; { switch (utf_len(p[0])) { @@ -608,7 +627,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 +677,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; + constant char *limit; { LWCHAR ch; int len; - constant char *p = *pp; + char *p = *pp; if (!utf_mode) { @@ -675,7 +699,7 @@ step_char(constant char **pp, signed int if (p + len > limit) { ch = 0; - p = limit; + p = (char *) limit; } else { ch = get_wchar(p); @@ -723,7 +747,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 +777,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 +787,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 +797,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 +809,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: head/contrib/less/charset.h ============================================================================== --- head/contrib/less/charset.h Fri May 5 14:09:44 2017 (r317828) +++ head/contrib/less/charset.h Fri May 5 14:33:39 2017 (r317829) @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2015 Mark Nudelman + * Copyright (C) 1984-2017 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: head/contrib/less/cmd.h ============================================================================== --- head/contrib/less/cmd.h Fri May 5 14:09:44 2017 (r317828) +++ head/contrib/less/cmd.h Fri May 5 14:33:39 2017 (r317829) @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2015 Mark Nudelman + * Copyright (C) 1984-2017 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: head/contrib/less/cmdbuf.c ============================================================================== --- head/contrib/less/cmdbuf.c Fri May 5 14:09:44 2017 (r317828) +++ head/contrib/less/cmdbuf.c Fri May 5 14:33:39 2017 (r317829) @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2015 Mark Nudelman + * Copyright (C) 1984-2017 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. */ @@ -76,25 +76,25 @@ struct mlist */ struct mlist mlist_search = { &mlist_search, &mlist_search, &mlist_search, NULL, 0 }; -public void * constant ml_search = (void *) &mlist_search; +public void *ml_search = (void *) &mlist_search; struct mlist mlist_examine = { &mlist_examine, &mlist_examine, &mlist_examine, NULL, 0 }; -public void * constant ml_examine = (void *) &mlist_examine; +public void *ml_examine = (void *) &mlist_examine; #if SHELL_ESCAPE || PIPEC struct mlist mlist_shell = { &mlist_shell, &mlist_shell, &mlist_shell, NULL, 0 }; -public void * constant ml_shell = (void *) &mlist_shell; +public void *ml_shell = (void *) &mlist_shell; #endif #else /* CMD_HISTORY */ /* If CMD_HISTORY is off, these are just flags. */ -public void * constant ml_search = (void *)1; -public void * constant ml_examine = (void *)2; +public void *ml_search = (void *)1; +public void *ml_examine = (void *)2; #if SHELL_ESCAPE || PIPEC -public void * constant ml_shell = (void *)3; +public void *ml_shell = (void *)3; #endif #endif /* CMD_HISTORY */ @@ -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) + constant char *s; { LWCHAR prev_ch = 0; LWCHAR ch; constant char *endline = s + strlen(s); while (*s != '\0') { - constant char *ns = s; + char *ns = (char *) 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) + constant 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,7 +491,7 @@ cmd_ichar(char *cs, int clen) * Delete the char to the left of the cursor. */ static int -cmd_erase(void) +cmd_erase() { char *s; int clen; @@ -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,9 +658,10 @@ set_mlist(constant void *mlist, int cmdf * cmdbuf's corresponding chars. *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201705051433.v45EXdqG096022>