svn commit: r316339 - head/contrib/less

Robert Watson rwatson at FreeBSD.org
Fri Mar 31 21:29:44 UTC 2017


Author: rwatson
Date: Fri Mar 31 21:29:43 2017
New Revision: 316339
URL: https://svnweb.freebsd.org/changeset/base/316339

Log:
  Currently, less(1) uses K&R prototypes, which both fails to provide useful
  compiler-time type checking, and also causes problems for targets where
  multiple incompatible calling conventions may be selected based on argument
  types.  This change switches less(1) to ANSI prototypes.
  
  While there, we also remove use of "register", and attempt to use "const" a
  bit better now that the compiler can check argument types.
  
  Reviewed by:	cem, emaste
  MFC after:	3 weeks
  Sponsored by:	DARPA, AFRL
  Differential Revision:	https://reviews.freebsd.org/D10152

Modified:
  head/contrib/less/brac.c
  head/contrib/less/ch.c
  head/contrib/less/charset.c
  head/contrib/less/cmdbuf.c
  head/contrib/less/command.c
  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/ifile.c
  head/contrib/less/input.c
  head/contrib/less/jump.c
  head/contrib/less/less.h
  head/contrib/less/lessecho.c
  head/contrib/less/lesskey.c
  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/optfunc.c
  head/contrib/less/option.c
  head/contrib/less/opttbl.c
  head/contrib/less/os.c
  head/contrib/less/output.c
  head/contrib/less/pattern.c
  head/contrib/less/position.c
  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

Modified: head/contrib/less/brac.c
==============================================================================
--- head/contrib/less/brac.c	Fri Mar 31 20:17:30 2017	(r316338)
+++ head/contrib/less/brac.c	Fri Mar 31 21:29:43 2017	(r316339)
@@ -24,18 +24,14 @@
  * "close bracket" are given.
  */
 	public void
-match_brac(obrac, cbrac, forwdir, n)
-	register int obrac;
-	register int cbrac;
-	int forwdir;
-	int n;
+match_brac(int obrac, int cbrac, int forwdir, int n)
 {
-	register int c;
-	register int nest;
+	int c;
+	int nest;
 	POSITION pos;
-	int (*chget)();
+	int (*chget)(void);
 
-	extern int ch_forw_get(), ch_back_get();
+	extern int ch_forw_get(void), ch_back_get(void);
 
 	/*
 	 * Seek to the line containing the open bracket.

Modified: head/contrib/less/ch.c
==============================================================================
--- head/contrib/less/ch.c	Fri Mar 31 20:17:30 2017	(r316338)
+++ head/contrib/less/ch.c	Fri Mar 31 21:29:43 2017	(r316339)
@@ -144,13 +144,13 @@ static int ch_addbuf();
  * Get the character pointed to by the read pointer.
  */
 	int
-ch_get()
+ch_get(void)
 {
-	register struct buf *bp;
-	register struct bufnode *bn;
-	register int n;
-	register int slept;
-	register int h;
+	struct buf *bp;
+	struct bufnode *bn;
+	int n;
+	int slept;
+	int h;
 	POSITION pos;
 	POSITION len;
 
@@ -378,8 +378,7 @@ ch_get()
  * a single char onto an input file descriptor.
  */
 	public void
-ch_ungetchar(c)
-	int c;
+ch_ungetchar(int c)
 {
 	if (c != -1 && ch_ungotchar != -1)
 		error("ch_ungetchar overrun", NULL_PARG);
@@ -392,7 +391,7 @@ ch_ungetchar(c)
  * If we haven't read all of standard input into it, do that now.
  */
 	public void
-end_logfile()
+end_logfile(void)
 {
 	static int tried = FALSE;
 
@@ -417,10 +416,10 @@ end_logfile()
  * Write all the existing buffered data to the log file.
  */
 	public void
-sync_logfile()
+sync_logfile(void)
 {
-	register struct buf *bp;
-	register struct bufnode *bn;
+	struct buf *bp;
+	struct bufnode *bn;
 	int warned = FALSE;
 	BLOCKNUM block;
 	BLOCKNUM nblocks;
@@ -454,12 +453,11 @@ sync_logfile()
  * Determine if a specific block is currently in one of the buffers.
  */
 	static int
-buffered(block)
-	BLOCKNUM block;
+buffered(BLOCKNUM block)
 {
-	register struct buf *bp;
-	register struct bufnode *bn;
-	register int h;
+	struct buf *bp;
+	struct bufnode *bn;
+	int h;
 
 	h = BUFHASH(block);
 	FOR_BUFS_IN_CHAIN(h, bn)
@@ -476,8 +474,7 @@ buffered(block)
  * Return 0 if successful, non-zero if can't seek there.
  */
 	public int
-ch_seek(pos)
-	register POSITION pos;
+ch_seek(POSITION pos)
 {
 	BLOCKNUM new_block;
 	POSITION len;
@@ -515,7 +512,7 @@ ch_seek(pos)
  * Seek to the end of the file.
  */
 	public int
-ch_end_seek()
+ch_end_seek(void)
 {
 	POSITION len;
 
@@ -542,10 +539,10 @@ ch_end_seek()
  * Seek to the last position in the file that is currently buffered.
  */
 	public int
-ch_end_buffer_seek()
+ch_end_buffer_seek(void)
 {
-	register struct buf *bp;
-	register struct bufnode *bn;
+	struct buf *bp;
+	struct bufnode *bn;
 	POSITION buf_pos;
 	POSITION end_pos;
 
@@ -570,10 +567,10 @@ ch_end_buffer_seek()
  * beginning of the pipe is no longer buffered.
  */
 	public int
-ch_beg_seek()
+ch_beg_seek(void)
 {
-	register struct bufnode *bn;
-	register struct bufnode *firstbn;
+	struct bufnode *bn;
+	struct bufnode *firstbn;
 
 	/*
 	 * Try a plain ch_seek first.
@@ -602,7 +599,7 @@ ch_beg_seek()
  * Return the length of the file, if known.
  */
 	public POSITION
-ch_length()
+ch_length(void)
 {
 	if (thisfile == NULL)
 		return (NULL_POSITION);
@@ -619,7 +616,7 @@ ch_length()
  * Return the current position in the file.
  */
 	public POSITION
-ch_tell()
+ch_tell(void)
 {
 	if (thisfile == NULL)
 		return (NULL_POSITION);
@@ -630,9 +627,9 @@ ch_tell()
  * Get the current char and post-increment the read pointer.
  */
 	public int
-ch_forw_get()
+ch_forw_get(void)
 {
-	register int c;
+	int c;
 
 	if (thisfile == NULL)
 		return (EOI);
@@ -653,7 +650,7 @@ ch_forw_get()
  * Pre-decrement the read pointer and get the new current char.
  */
 	public int
-ch_back_get()
+ch_back_get(void)
 {
 	if (thisfile == NULL)
 		return (EOI);
@@ -676,8 +673,7 @@ ch_back_get()
  * bufspace is in units of 1024 bytes.  -1 mean no limit.
  */
 	public void
-ch_setbufspace(bufspace)
-	int bufspace;
+ch_setbufspace(int bufspace)
 {
 	if (bufspace < 0)
 		maxbufs = -1;
@@ -693,9 +689,9 @@ ch_setbufspace(bufspace)
  * Flush (discard) any saved file state, including buffer contents.
  */
 	public void
-ch_flush()
+ch_flush(void)
 {
-	register struct bufnode *bn;
+	struct bufnode *bn;
 
 	if (thisfile == NULL)
 		return;
@@ -760,10 +756,10 @@ ch_flush()
  * The buffer is added to the tail of the buffer chain.
  */
 	static int
-ch_addbuf()
+ch_addbuf(void)
 {
-	register struct buf *bp;
-	register struct bufnode *bn;
+	struct buf *bp;
+	struct bufnode *bn;
 
 	/*
 	 * Allocate and initialize a new buffer and link it 
@@ -785,9 +781,9 @@ ch_addbuf()
  *
  */
 	static void
-init_hashtbl()
+init_hashtbl(void)
 {
-	register int h;
+	int h;
 
 	for (h = 0;  h < BUFHASH_SIZE;  h++)
 	{
@@ -800,9 +796,9 @@ init_hashtbl()
  * Delete all buffers for this file.
  */
 	static void
-ch_delbufs()
+ch_delbufs(void)
 {
-	register struct bufnode *bn;
+	struct bufnode *bn;
 
 	while (ch_bufhead != END_OF_CHAIN)
 	{
@@ -818,8 +814,7 @@ ch_delbufs()
  * Is it possible to seek on a file descriptor?
  */
 	public int
-seekable(f)
-	int f;
+seekable(int f)
 {
 #if MSDOS_COMPILER
 	extern int fd0;
@@ -840,7 +835,7 @@ seekable(f)
  * This is used after an ignore_eof read, during which the EOF may change.
  */
 	public void
-ch_set_eof()
+ch_set_eof(void)
 {
 	ch_fsize = ch_fpos;
 }
@@ -850,9 +845,7 @@ ch_set_eof()
  * Initialize file state for a new file.
  */
 	public void
-ch_init(f, flags)
-	int f;
-	int flags;
+ch_init(int f, int flags)
 {
 	/*
 	 * See if we already have a filestate for this file.
@@ -891,7 +884,7 @@ ch_init(f, flags)
  * Close a filestate.
  */
 	public void
-ch_close()
+ch_close(void)
 {
 	int keepstate = FALSE;
 
@@ -934,7 +927,7 @@ ch_close()
  * Return ch_flags for the current file.
  */
 	public int
-ch_getflags()
+ch_getflags(void)
 {
 	if (thisfile == NULL)
 		return (0);

Modified: head/contrib/less/charset.c
==============================================================================
--- head/contrib/less/charset.c	Fri Mar 31 20:17:30 2017	(r316338)
+++ head/contrib/less/charset.c	Fri Mar 31 21:29:43 2017	(r316339)
@@ -130,12 +130,11 @@ public int binattr = AT_STANDOUT;
  *	c control character
  */
 	static void
-ichardef(s)
-	char *s;
+ichardef(char *s)
 {
-	register char *cp;
-	register int n;
-	register char v;
+	char *cp;
+	int n;
+	char v;
 
 	n = 0;
 	v = 0;
@@ -187,12 +186,10 @@ ichardef(s)
  * The valid charset names are listed in the "charsets" array.
  */
 	static int
-icharset(name, no_error)
-	register char *name;
-	int no_error;
+icharset(char *name, int no_error)
 {
-	register struct charset *p;
-	register struct cs_alias *a;
+	struct charset *p;
+	struct cs_alias *a;
 
 	if (name == NULL || *name == '\0')
 		return (0);
@@ -230,9 +227,9 @@ icharset(name, no_error)
  * Define a charset, given a locale name.
  */
 	static void
-ilocale()
+ilocale(void)
 {
-	register int c;
+	int c;
 
 	for (c = 0;  c < (int) sizeof(chardef);  c++)
 	{
@@ -250,10 +247,7 @@ ilocale()
  * Define the printing format for control (or binary utf) chars.
  */
    	static void
-setbinfmt(s, fmtvarptr, default_fmt)
-	char *s;
-	char **fmtvarptr;
-	char *default_fmt;
+setbinfmt(char *s, char **fmtvarptr, char *default_fmt)
 {
 	if (s && utf_mode)
 	{
@@ -299,7 +293,7 @@ setbinfmt(s, fmtvarptr, default_fmt)
  *
  */
 	static void
-set_charset()
+set_charset(void)
 {
 	char *s;
 
@@ -370,7 +364,7 @@ set_charset()
  * Initialize charset data structures.
  */
 	public void
-init_charset()
+init_charset(void)
 {
 	char *s;
 
@@ -391,8 +385,7 @@ init_charset()
  * Is a given character a "binary" character?
  */
 	public int
-binary_char(c)
-	LWCHAR c;
+binary_char(LWCHAR c)
 {
 	if (utf_mode)
 		return (is_ubin_char(c));
@@ -404,8 +397,7 @@ binary_char(c)
  * Is a given character a "control" character?
  */
 	public int
-control_char(c)
-	LWCHAR c;
+control_char(LWCHAR c)
 {
 	c &= 0377;
 	return (chardef[c] & IS_CONTROL_CHAR);
@@ -416,8 +408,7 @@ control_char(c)
  * For example, in the "ascii" charset '\3' is printed as "^C".
  */
 	public char *
-prchar(c)
-	LWCHAR c;
+prchar(LWCHAR c)
 {
 	/* {{ This buffer can be overrun if LESSBINFMT is a long string. }} */
 	static char buf[32];
@@ -452,8 +443,7 @@ prchar(c)
  * Return the printable form of a UTF-8 character.
  */
 	public char *
-prutfchar(ch)
-	LWCHAR ch;
+prutfchar(LWCHAR ch)
 {
 	static char buf[32];
 
@@ -483,8 +473,7 @@ prutfchar(ch)
  * Get the length of a UTF-8 character in bytes.
  */
 	public int
-utf_len(ch)
-	char ch;
+utf_len(char ch)
 {
 	if ((ch & 0x80) == 0)
 		return 1;
@@ -506,9 +495,7 @@ utf_len(ch)
  * Does the parameter point to the lead byte of a well-formed UTF-8 character?
  */
 	public int
-is_utf8_well_formed(s, slen)
-	unsigned char *s;
-	int slen;
+is_utf8_well_formed(unsigned char *s, int slen)
 {
 	int i;
 	int len;
@@ -543,9 +530,7 @@ is_utf8_well_formed(s, slen)
  * Return number of invalid UTF-8 sequences found in a buffer.
  */
 	public int
-utf_bin_count(data, len)
-	unsigned char *data;
-	int len;
+utf_bin_count(unsigned char *data, int len)
 {
 	int bin_count = 0;
 	while (len > 0)
@@ -572,8 +557,7 @@ utf_bin_count(data, len)
  * Get the value of a UTF-8 character.
  */
 	public LWCHAR
-get_wchar(p)
-	char *p;
+get_wchar(constant char *p)
 {
 	switch (utf_len(p[0]))
 	{
@@ -624,9 +608,7 @@ get_wchar(p)
  * Store a character into a UTF-8 string.
  */
 	public void
-put_wchar(pp, ch)
-	char **pp;
-	LWCHAR ch;
+put_wchar(char **pp, LWCHAR ch)
 {
 	if (!utf_mode || ch < 0x80) 
 	{
@@ -674,14 +656,11 @@ put_wchar(pp, ch)
  * Step forward or backward one character in a string.
  */
 	public LWCHAR
-step_char(pp, dir, limit)
-	char **pp;
-	signed int dir;
-	char *limit;
+step_char(constant char **pp, signed int dir, constant char *limit)
 {
 	LWCHAR ch;
 	int len;
-	char *p = *pp;
+	constant char *p = *pp;
 
 	if (!utf_mode)
 	{
@@ -744,9 +723,7 @@ static struct wchar_range comb_table[] =
 
 
 	static int
-is_in_table(ch, table)
-	LWCHAR ch;
-	struct wchar_range_table *table;
+is_in_table(LWCHAR ch, struct wchar_range_table *table)
 {
 	int hi;
 	int lo;
@@ -774,8 +751,7 @@ is_in_table(ch, table)
  * If a composing character follows any char, the two combine into one glyph.
  */
 	public int
-is_composing_char(ch)
-	LWCHAR ch;
+is_composing_char(LWCHAR ch)
 {
 	return is_in_table(ch, &compose_table);
 }
@@ -784,8 +760,7 @@ is_composing_char(ch)
  * Should this UTF-8 character be treated as binary?
  */
 	public int
-is_ubin_char(ch)
-	LWCHAR ch;
+is_ubin_char(LWCHAR ch)
 {
 	return is_in_table(ch, &ubin_table);
 }
@@ -794,8 +769,7 @@ is_ubin_char(ch)
  * Is this a double width UTF-8 character?
  */
 	public int
-is_wide_char(ch)
-	LWCHAR ch;
+is_wide_char(LWCHAR ch)
 {
 	return is_in_table(ch, &wide_table);
 }
@@ -806,9 +780,7 @@ is_wide_char(ch)
  * a specific char (not any char), the two combine into one glyph.
  */
 	public int
-is_combining_char(ch1, ch2)
-	LWCHAR ch1;
-	LWCHAR ch2;
+is_combining_char(LWCHAR ch1, LWCHAR ch2)
 {
 	/* The table is small; use linear search. */
 	int i;

Modified: head/contrib/less/cmdbuf.c
==============================================================================
--- head/contrib/less/cmdbuf.c	Fri Mar 31 20:17:30 2017	(r316338)
+++ head/contrib/less/cmdbuf.c	Fri Mar 31 21:29:43 2017	(r316339)
@@ -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();
+static int cmd_complete(int action);
 /*
  * 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()
+cmd_reset(void)
 {
 	cp = cmdbuf;
 	*cp = '\0';
@@ -129,7 +129,7 @@ cmd_reset()
  * Clear command line.
  */
 	public void
-clear_cmd()
+clear_cmd(void)
 {
 	cmd_col = prompt_col = 0;
 	cmd_mbc_buf_len = 0;
@@ -140,15 +140,14 @@ clear_cmd()
  * Display a string, usually as a prompt for input into the command buffer.
  */
 	public void
-cmd_putstr(s)
-	char *s;
+cmd_putstr(constant char *s)
 {
 	LWCHAR prev_ch = 0;
 	LWCHAR ch;
-	char *endline = s + strlen(s);
+	constant char *endline = s + strlen(s);
 	while (*s != '\0')
 	{
-		char *ns = s;
+		constant char *ns = s;
 		ch = step_char(&ns, +1, endline);
 		while (s < ns)
 			putchr(*s++);
@@ -171,10 +170,10 @@ cmd_putstr(s)
  * How many characters are in the command buffer?
  */
 	public int
-len_cmdbuf()
+len_cmdbuf(void)
 {
-	char *s = cmdbuf;
-	char *endline = s + strlen(s);
+	constant char *s = cmdbuf;
+	constant char *endline = s + strlen(s);
 	int len = 0;
 
 	while (*s != '\0')
@@ -189,12 +188,7 @@ len_cmdbuf()
  * Common part of cmd_step_right() and cmd_step_left().
  */
 	static char *
-cmd_step_common(p, ch, len, pwidth, bswidth)
-	char *p;
-	LWCHAR ch;
-	int len;
-	int *pwidth;
-	int *bswidth;
+cmd_step_common(constant char *p, LWCHAR ch, int len, int *pwidth, int *bswidth)
 {
 	char *pr;
 
@@ -256,13 +250,10 @@ cmd_step_common(p, ch, len, pwidth, bswi
  * Step a pointer one character right in the command buffer.
  */
 	static char *
-cmd_step_right(pp, pwidth, bswidth)
-	char **pp;
-	int *pwidth;
-	int *bswidth;
+cmd_step_right(char **pp, int *pwidth, int *bswidth)
 {
 	char *p = *pp;
-	LWCHAR ch = step_char(pp, +1, p + strlen(p));
+	LWCHAR ch = step_char((constant char **)pp, +1, p + strlen(p));
 
 	return cmd_step_common(p, ch, *pp - p, pwidth, bswidth);
 }
@@ -271,13 +262,10 @@ cmd_step_right(pp, pwidth, bswidth)
  * Step a pointer one character left in the command buffer.
  */
 	static char *
-cmd_step_left(pp, pwidth, bswidth)
-	char **pp;
-	int *pwidth;
-	int *bswidth;
+cmd_step_left(char **pp, int *pwidth, int *bswidth)
 {
 	char *p = *pp;
-	LWCHAR ch = step_char(pp, -1, cmdbuf);
+	LWCHAR ch = step_char((constant char **)pp, -1, cmdbuf);
 
 	return cmd_step_common(*pp, ch, p - *pp, pwidth, bswidth);
 }
@@ -287,8 +275,7 @@ cmd_step_left(pp, pwidth, bswidth)
  * Then position the cursor just after the char old_cp (a pointer into cmdbuf).
  */
 	static void
-cmd_repaint(old_cp)
-	char *old_cp;
+cmd_repaint(char *old_cp)
 {
 	/*
 	 * Repaint the line from the current position.
@@ -298,7 +285,7 @@ cmd_repaint(old_cp)
 	{
 		char *np = cp;
 		int width;
-		char *pr = cmd_step_right(&np, &width, NULL);
+		constant char *pr = cmd_step_right(&np, &width, NULL);
 		if (cmd_col + width >= sc_width)
 			break;
 		cp = np;
@@ -328,7 +315,7 @@ cmd_repaint(old_cp)
  * and set cp to the corresponding char in cmdbuf.
  */
 	static void
-cmd_home()
+cmd_home(void)
 {
 	while (cmd_col > prompt_col)
 	{
@@ -347,7 +334,7 @@ cmd_home()
  * Shift the cmdbuf display left a half-screen.
  */
 	static void
-cmd_lshift()
+cmd_lshift(void)
 {
 	char *s;
 	char *save_cp;
@@ -385,7 +372,7 @@ cmd_lshift()
  * Shift the cmdbuf display right a half-screen.
  */
 	static void
-cmd_rshift()
+cmd_rshift(void)
 {
 	char *s;
 	char *save_cp;
@@ -415,7 +402,7 @@ cmd_rshift()
  * Move cursor right one character.
  */
 	static int
-cmd_right()
+cmd_right(void)
 {
 	char *pr;
 	char *ncp;
@@ -450,7 +437,7 @@ cmd_right()
  * Move cursor left one character.
  */
 	static int
-cmd_left()
+cmd_left(void)
 {
 	char *ncp;
 	int width, bswidth;
@@ -480,9 +467,7 @@ cmd_left()
  * Insert a char into the command buffer, at the current position.
  */
 	static int
-cmd_ichar(cs, clen)
-	char *cs;
-	int clen;
+cmd_ichar(char *cs, int clen)
 {
 	char *s;
 	
@@ -517,9 +502,9 @@ cmd_ichar(cs, clen)
  * Delete the char to the left of the cursor.
  */
 	static int
-cmd_erase()
+cmd_erase(void)
 {
-	register char *s;
+	char *s;
 	int clen;
 
 	if (cp == cmdbuf)
@@ -566,7 +551,7 @@ cmd_erase()
  * Delete the char under the cursor.
  */
 	static int
-cmd_delete()
+cmd_delete(void)
 {
 	if (*cp == '\0')
 	{
@@ -585,7 +570,7 @@ cmd_delete()
  * Delete the "word" to the left of the cursor.
  */
 	static int
-cmd_werase()
+cmd_werase(void)
 {
 	if (cp > cmdbuf && cp[-1] == ' ')
 	{
@@ -611,7 +596,7 @@ cmd_werase()
  * Delete the "word" under the cursor.
  */
 	static int
-cmd_wdelete()
+cmd_wdelete(void)
 {
 	if (*cp == ' ')
 	{
@@ -637,7 +622,7 @@ cmd_wdelete()
  * Delete all chars in the command buffer.
  */
 	static int
-cmd_kill()
+cmd_kill(void)
 {
 	if (cmdbuf[0] == '\0')
 	{
@@ -663,9 +648,7 @@ cmd_kill()
  * Select an mlist structure to be the current command history.
  */
 	public void
-set_mlist(mlist, cmdflags)
-	void *mlist;
-	int cmdflags;
+set_mlist(constant void *mlist, int cmdflags)
 {
 #if CMD_HISTORY
 	curr_mlist = (struct mlist *) mlist;
@@ -684,8 +667,7 @@ set_mlist(mlist, cmdflags)
  * cmdbuf's corresponding chars.
  */
 	static int
-cmd_updown(action)
-	int action;
+cmd_updown(int action)
 {
 	char *s;
 	struct mlist *ml;
@@ -747,10 +729,7 @@ cmd_updown(action)
  * Add a string to an mlist.
  */
 	public void
-cmd_addhist(mlist, cmd, modified)
-	struct mlist *mlist;
-	char *cmd;
-	int modified;
+cmd_addhist(struct mlist *constant mlist, char *cmd, int modified)
 {
 #if CMD_HISTORY
 	struct mlist *ml;
@@ -793,7 +772,7 @@ cmd_addhist(mlist, cmd, modified)
  * Add it to the currently selected history list.
  */
 	public void
-cmd_accept()
+cmd_accept(void)
 {
 #if CMD_HISTORY
 	/*
@@ -815,8 +794,7 @@ cmd_accept()
  *	CC_QUIT	The char requests the current command to be aborted.
  */
 	static int
-cmd_edit(c)
-	int c;
+cmd_edit(int c)
 {
 	int action;
 	int flags;
@@ -931,8 +909,7 @@ cmd_edit(c)
  * Insert a string into the command buffer, at the current position.
  */
 	static int
-cmd_istr(str)
-	char *str;
+cmd_istr(char *str)
 {
 	char *s;
 	int action;
@@ -941,7 +918,7 @@ cmd_istr(str)
 	for (s = str;  *s != '\0';  )
 	{
 		char *os = s;
-		step_char(&s, +1, endline);
+		step_char((constant char **)&s, +1, endline);
 		action = cmd_ichar(os, s - os);
 		if (action != CC_OK)
 		{
@@ -959,7 +936,7 @@ cmd_istr(str)
  * cursor at the end of the word.
  */
 	static char *
-delimit_word()
+delimit_word(void)
 {
 	char *word;
 #if SPACES_IN_FILENAMES
@@ -1046,7 +1023,7 @@ delimit_word()
  * which start with that word, and set tk_text to that list.
  */
 	static void
-init_compl()
+init_compl(void)
 {
 	char *word;
 	char c;
@@ -1109,9 +1086,7 @@ init_compl()
  * Return the next word in the current completion list.
  */
 	static char *
-next_compl(action, prev)
-	int action;
-	char *prev;
+next_compl(int action, char *prev)
 {
 	switch (action)
 	{
@@ -1131,8 +1106,7 @@ next_compl(action, prev)
  * or a subsequent time (step thru the list).
  */
 	static int
-cmd_complete(action)
-	int action;
+cmd_complete(int action)
 {
 	char *s;
 
@@ -1229,8 +1203,7 @@ fail:
  *	CC_ERROR	The char could not be accepted due to an error.
  */
 	public int
-cmd_char(c)
-	int c;
+cmd_char(int c)
 {
 	int action;
 	int len;
@@ -1319,8 +1292,7 @@ cmd_char(c)
  * Return the number currently in the command buffer.
  */
 	public LINENUM
-cmd_int(frac)
-	long *frac;
+cmd_int(long *frac)
 {
 	char *p;
 	LINENUM n = 0;
@@ -1341,7 +1313,7 @@ cmd_int(frac)
  * Return a pointer to the command buffer.
  */
 	public char *
-get_cmdbuf()
+get_cmdbuf(void)
 {
 	return (cmdbuf);
 }
@@ -1351,7 +1323,7 @@ get_cmdbuf()
  * Return the last (most recent) string in the current command history.
  */
 	public char *
-cmd_lastpattern()
+cmd_lastpattern(void)
 {
 	if (curr_mlist == NULL)
 		return (NULL);
@@ -1363,8 +1335,7 @@ cmd_lastpattern()
 /*
  */
 	static int
-mlist_size(ml)
-	struct mlist *ml;
+mlist_size(struct mlist *ml)
 {
 	int size = 0;
 	for (ml = ml->next;  ml->string != NULL;  ml = ml->next)
@@ -1376,7 +1347,7 @@ mlist_size(ml)
  * Get the name of the history file.
  */
 	static char *
-histfile_name()
+histfile_name(void)
 {
 	char *home;
 	char *name;
@@ -1416,11 +1387,8 @@ histfile_name()
  * Read a .lesshst file and call a callback for each line in the file.
  */
 	static void
-read_cmdhist2(action, uparam, skip_search, skip_shell)
-	void (*action)(void*,struct mlist*,char*);
-	void *uparam;
-	int skip_search;
-	int skip_shell;
+read_cmdhist2(void (*action)(void*,struct mlist*,char*), void *uparam,
+    int skip_search, int skip_shell)
 {
 	struct mlist *ml = NULL;
 	char line[CMDBUF_SIZE];
@@ -1480,11 +1448,8 @@ read_cmdhist2(action, uparam, skip_searc
 }
 
 	static void
-read_cmdhist(action, uparam, skip_search, skip_shell)
-	void (*action)(void*,struct mlist*,char*);
-	void *uparam;
-	int skip_search;
-	int skip_shell;
+read_cmdhist(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 */
@@ -1503,7 +1468,7 @@ addhist_init(void *uparam, struct mlist 
  * Initialize history from a .lesshist file.
  */
 	public void
-init_cmdhist()
+init_cmdhist(void)
 {
 #if CMD_HISTORY
 	read_cmdhist(&addhist_init, NULL, 0, 0);
@@ -1515,9 +1480,7 @@ init_cmdhist()
  */
 #if CMD_HISTORY
 	static void
-write_mlist_header(ml, f)
-	struct mlist *ml;
-	FILE *f;
+write_mlist_header(struct mlist *ml, FILE *f)
 {
 	if (ml == &mlist_search)
 		fprintf(f, "%s\n", HISTFILE_SEARCH_SECTION);
@@ -1531,9 +1494,7 @@ write_mlist_header(ml, f)
  * Write all modified entries in an mlist to the history file.
  */
 	static void
-write_mlist(ml, f)
-	struct mlist *ml;
-	FILE *f;
+write_mlist(struct mlist *ml, FILE *f)
 {
 	for (ml = ml->next;  ml->string != NULL;  ml = ml->next)
 	{
@@ -1549,8 +1510,7 @@ write_mlist(ml, f)
  * Make a temp name in the same directory as filename.
  */
 	static char *
-make_tempname(filename)
-	char *filename;
+make_tempname(char *filename)
 {
 	char lastch;
 	char *tempname = ecalloc(1, strlen(filename)+1);
@@ -1613,8 +1573,7 @@ copy_hist(void *uparam, struct mlist *ml
  * Make a file readable only by its owner.

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***


More information about the svn-src-head mailing list