From 76a7805e1f0d794946ab7d8c6d60454bd3f244a5 Mon Sep 17 00:00:00 2001 From: Mark Nudelman Date: Thu, 29 Dec 2022 11:59:58 -0800 Subject: [PATCH] Convert function definitions from K&R to C89. --- Makefile.aut | 8 +- NEWS | 2 + brac.c | 7 +- ch.c | 79 +++++--------- charset.c | 110 +++++--------------- cmdbuf.c | 205 +++++++++--------------------------- command.c | 122 ++++++---------------- cvt.c | 17 +-- decode.c | 132 +++++------------------ edit.c | 99 +++++------------- filename.c | 101 +++++------------- forwback.c | 58 +++-------- ifile.c | 116 +++++---------------- input.c | 26 +---- jump.c | 28 ++--- less.h | 31 ++---- lessecho.c | 34 ++---- lesskey.c | 48 ++------- lesskey_parse.c | 94 ++++------------- line.c | 242 ++++++++++--------------------------------- linenum.c | 40 ++----- lsystem.c | 16 +-- main.c | 32 ++---- mark.c | 72 +++---------- mkfuncs.pl | 23 ++++- optfunc.c | 152 ++++++--------------------- option.c | 77 ++++---------- option.h | 2 +- opttbl.c | 17 +-- os.c | 70 +++---------- output.c | 75 ++++---------- pattern.c | 48 ++------- pattern.h | 8 +- position.c | 39 ++----- prompt.c | 63 +++-------- screen.c | 270 +++++++++++++----------------------------------- search.c | 217 +++++++------------------------------- signal.c | 27 ++--- tags.c | 85 +++++---------- ttyin.c | 23 ++--- version.c | 2 +- xbuf.c | 36 ++----- 42 files changed, 717 insertions(+), 2236 deletions(-) diff --git a/Makefile.aut b/Makefile.aut index 8f077f22..3300b240 100644 --- a/Makefile.aut +++ b/Makefile.aut @@ -11,10 +11,8 @@ REL := $(shell sed -e '/char version/!d' -e 's/[^0-9.]*\([0-9.]*\).*/\1/' -e q $ ifeq ($(USE_PYTHON),1) MKHELP = mkhelp.py - MKFUNCS = mkfuncs.py else MKHELP = mkhelp.pl - MKFUNCS = mkfuncs.pl endif SRC = \ @@ -41,8 +39,8 @@ DISTFILES = \ install.sh defines.h.in mkinstalldirs \ less.nro less.man lesskey.nro lesskey.man lessecho.nro lessecho.man \ less.hlp \ - mkfuncs.pl mkhelp.pl \ - mkfuncs.py mkhelp.py \ + mkhelp.pl \ + mkhelp.py \ mkutable $(UNICODE_FILES) \ ${DISTFILES_W} @@ -68,7 +66,7 @@ ${srcdir}/configure ${srcdir}/defines.h.in: ${srcdir}/configure.ac ${srcdir}/Mak funcs.h: ${SRC:%=${srcdir}/%} -mv -f ${srcdir}/funcs.h ${srcdir}/funcs.h.old - ${srcdir}/${MKFUNCS} ${SRC:%=${srcdir}/%} >${srcdir}/funcs.h + grep -h '^public [^;]*$$' ${SRC:%=${srcdir}/%} | sed 's/$$/;/' >${srcdir}/funcs.h lint: lint -I. ${CPPFLAGS} ${SRC} diff --git a/NEWS b/NEWS index f6b858a7..85261a2c 100644 --- a/NEWS +++ b/NEWS @@ -49,6 +49,8 @@ * Implement lesstest test suite. +* Convert function parameter definitions from K&R to C89 (github #316). + ====================================================================== Major changes between "less" versions 590 and 608 diff --git a/brac.c b/brac.c index 58ecf172..5f5c3e0a 100644 --- a/brac.c +++ b/brac.c @@ -23,12 +23,7 @@ * The characters which serve as "open bracket" and * "close bracket" are given. */ - public void -match_brac(obrac, cbrac, forwdir, n) - int obrac; - int cbrac; - int forwdir; - int n; +public void match_brac(int obrac, int cbrac, int forwdir, int n) { int c; int nest; diff --git a/ch.c b/ch.c index 38c947e4..233aed5b 100644 --- a/ch.c +++ b/ch.c @@ -145,8 +145,7 @@ static int ch_addbuf(); /* * Get the character pointed to by the read pointer. */ - static int -ch_get(VOID_PARAM) +static int ch_get(void) { struct buf *bp; struct bufnode *bn; @@ -362,9 +361,7 @@ ch_get(VOID_PARAM) * ch_ungetchar is a rather kludgy and limited way to push * a single char onto an input file descriptor. */ - public void -ch_ungetchar(c) - int c; +public void ch_ungetchar(int c) { if (c != -1 && ch_ungotchar != -1) error("ch_ungetchar overrun", NULL_PARG); @@ -376,8 +373,7 @@ ch_ungetchar(c) * Close the logfile. * If we haven't read all of standard input into it, do that now. */ - public void -end_logfile(VOID_PARAM) +public void end_logfile(void) { static int tried = FALSE; @@ -402,8 +398,7 @@ end_logfile(VOID_PARAM) * Invoked from the - command; see toggle_option(). * Write all the existing buffered data to the log file. */ - public void -sync_logfile(VOID_PARAM) +public void sync_logfile(void) { struct buf *bp; struct bufnode *bn; @@ -439,9 +434,7 @@ sync_logfile(VOID_PARAM) /* * Determine if a specific block is currently in one of the buffers. */ - static int -buffered(block) - BLOCKNUM block; +static int buffered(BLOCKNUM block) { struct buf *bp; struct bufnode *bn; @@ -461,9 +454,7 @@ buffered(block) * Seek to a specified position in the file. * Return 0 if successful, non-zero if can't seek there. */ - public int -ch_seek(pos) - POSITION pos; +public int ch_seek(POSITION pos) { BLOCKNUM new_block; POSITION len; @@ -500,8 +491,7 @@ ch_seek(pos) /* * Seek to the end of the file. */ - public int -ch_end_seek(VOID_PARAM) +public int ch_end_seek(void) { POSITION len; @@ -527,8 +517,7 @@ ch_end_seek(VOID_PARAM) /* * Seek to the last position in the file that is currently buffered. */ - public int -ch_end_buffer_seek(VOID_PARAM) +public int ch_end_buffer_seek(void) { struct buf *bp; struct bufnode *bn; @@ -555,8 +544,7 @@ ch_end_buffer_seek(VOID_PARAM) * We may not be able to seek there if input is a pipe and the * beginning of the pipe is no longer buffered. */ - public int -ch_beg_seek(VOID_PARAM) +public int ch_beg_seek(void) { struct bufnode *bn; struct bufnode *firstbn; @@ -587,8 +575,7 @@ ch_beg_seek(VOID_PARAM) /* * Return the length of the file, if known. */ - public POSITION -ch_length(VOID_PARAM) +public POSITION ch_length(void) { if (thisfile == NULL) return (NULL_POSITION); @@ -604,8 +591,7 @@ ch_length(VOID_PARAM) /* * Return the current position in the file. */ - public POSITION -ch_tell(VOID_PARAM) +public POSITION ch_tell(void) { if (thisfile == NULL) return (NULL_POSITION); @@ -615,8 +601,7 @@ ch_tell(VOID_PARAM) /* * Get the current char and post-increment the read pointer. */ - public int -ch_forw_get(VOID_PARAM) +public int ch_forw_get(void) { int c; @@ -638,8 +623,7 @@ ch_forw_get(VOID_PARAM) /* * Pre-decrement the read pointer and get the new current char. */ - public int -ch_back_get(VOID_PARAM) +public int ch_back_get(void) { if (thisfile == NULL) return (EOI); @@ -661,9 +645,7 @@ ch_back_get(VOID_PARAM) * Set max amount of buffer space. * bufspace is in units of 1024 bytes. -1 mean no limit. */ - public void -ch_setbufspace(bufspace) - int bufspace; +public void ch_setbufspace(int bufspace) { if (bufspace < 0) maxbufs = -1; @@ -678,8 +660,7 @@ ch_setbufspace(bufspace) /* * Flush (discard) any saved file state, including buffer contents. */ - public void -ch_flush(VOID_PARAM) +public void ch_flush(void) { struct bufnode *bn; @@ -752,8 +733,7 @@ ch_flush(VOID_PARAM) * Allocate a new buffer. * The buffer is added to the tail of the buffer chain. */ - static int -ch_addbuf(VOID_PARAM) +static int ch_addbuf(void) { struct buf *bp; struct bufnode *bn; @@ -777,8 +757,7 @@ ch_addbuf(VOID_PARAM) /* * */ - static void -init_hashtbl(VOID_PARAM) +static void init_hashtbl(void) { int h; @@ -792,8 +771,7 @@ init_hashtbl(VOID_PARAM) /* * Delete all buffers for this file. */ - static void -ch_delbufs(VOID_PARAM) +static void ch_delbufs(void) { struct bufnode *bn; @@ -810,9 +788,7 @@ ch_delbufs(VOID_PARAM) /* * Is it possible to seek on a file descriptor? */ - public int -seekable(f) - int f; +public int seekable(int f) { #if MSDOS_COMPILER extern int fd0; @@ -832,8 +808,7 @@ seekable(f) * Force EOF to be at the current read position. * This is used after an ignore_eof read, during which the EOF may change. */ - public void -ch_set_eof(VOID_PARAM) +public void ch_set_eof(void) { if (ch_fsize != NULL_POSITION && ch_fsize < ch_fpos) ch_fsize = ch_fpos; @@ -843,10 +818,7 @@ ch_set_eof(VOID_PARAM) /* * Initialize file state for a new file. */ - public void -ch_init(f, flags) - int f; - int flags; +public void ch_init(int f, int flags) { /* * See if we already have a filestate for this file. @@ -883,8 +855,7 @@ ch_init(f, flags) /* * Close a filestate. */ - public void -ch_close(VOID_PARAM) +public void ch_close(void) { int keepstate = FALSE; @@ -926,8 +897,7 @@ ch_close(VOID_PARAM) /* * Return ch_flags for the current file. */ - public int -ch_getflags(VOID_PARAM) +public int ch_getflags(void) { if (thisfile == NULL) return (0); @@ -935,8 +905,7 @@ ch_getflags(VOID_PARAM) } #if 0 - public void -ch_dump(struct filestate *fs) +static void ch_dump(struct filestate *fs) { struct buf *bp; struct bufnode *bn; diff --git a/charset.c b/charset.c index b3e033e3..191f4dff 100644 --- a/charset.c +++ b/charset.c @@ -136,10 +136,7 @@ static struct wchar_range_table user_prt_table; /* * Set a wchar_range_table to the table in an xbuffer. */ - static void -wchar_range_table_set(tbl, arr) - struct wchar_range_table *tbl; - struct xbuffer *arr; +static void wchar_range_table_set(struct wchar_range_table *tbl, struct xbuffer *arr) { tbl->table = (struct wchar_range *) arr->data; tbl->count = arr->end / sizeof(struct wchar_range); @@ -148,9 +145,7 @@ wchar_range_table_set(tbl, arr) /* * Skip over a "U" or "U+" prefix before a hex codepoint. */ - static char * -skip_uprefix(s) - char *s; +static char * skip_uprefix(char *s) { if (*s == 'U' || *s == 'u') if (*++s == '+') ++s; @@ -160,10 +155,7 @@ skip_uprefix(s) /* * Parse a dash-separated range of hex values. */ - static void -wchar_range_get(ss, range) - char **ss; - struct wchar_range *range; +static void wchar_range_get(char **ss, struct wchar_range *range) { char *s = skip_uprefix(*ss); range->first = lstrtoul(s, &s, 16); @@ -181,9 +173,7 @@ wchar_range_get(ss, range) /* * Parse the LESSUTFCHARDEF variable. */ - static void -ichardef_utf(s) - char *s; +static void ichardef_utf(char *s) { xbuf_init(&user_wide_array); xbuf_init(&user_ubin_array); @@ -251,9 +241,7 @@ ichardef_utf(s) * b binary character * c control character */ - static void -ichardef(s) - char *s; +static void ichardef(char *s) { char *cp; int n; @@ -308,10 +296,7 @@ ichardef(s) * Define a charset, given a charset name. * The valid charset names are listed in the "charsets" array. */ - static int -icharset(name, no_error) - char *name; - int no_error; +static int icharset(char *name, int no_error) { struct charset *p; struct cs_alias *a; @@ -357,8 +342,7 @@ icharset(name, no_error) /* * Define a charset, given a locale name. */ - static void -ilocale(VOID_PARAM) +static void ilocale(void) { int c; @@ -377,12 +361,7 @@ ilocale(VOID_PARAM) /* * Define the printing format for control (or binary utf) chars. */ - public void -setfmt(s, fmtvarptr, attrptr, default_fmt) - char *s; - char **fmtvarptr; - int *attrptr; - char *default_fmt; +public void setfmt(char *s, char **fmtvarptr, int *attrptr, char *default_fmt) { if (s && utf_mode) { @@ -427,8 +406,7 @@ setfmt(s, fmtvarptr, attrptr, default_fmt) /* * */ - static void -set_charset(VOID_PARAM) +static void set_charset(void) { char *s; @@ -510,8 +488,7 @@ set_charset(VOID_PARAM) /* * Initialize charset data structures. */ - public void -init_charset(VOID_PARAM) +public void init_charset(void) { char *s; @@ -531,9 +508,7 @@ init_charset(VOID_PARAM) /* * Is a given character a "binary" character? */ - public int -binary_char(c) - LWCHAR c; +public int binary_char(LWCHAR c) { if (utf_mode) return (is_ubin_char(c)); @@ -544,9 +519,7 @@ binary_char(c) /* * Is a given character a "control" character? */ - public int -control_char(c) - LWCHAR c; +public int control_char(LWCHAR c) { c &= 0377; return (chardef[c] & IS_CONTROL_CHAR); @@ -556,9 +529,7 @@ control_char(c) * Return the printable form of a character. * For example, in the "ascii" charset '\3' is printed as "^C". */ - public char * -prchar(c) - LWCHAR c; +public char * prchar(LWCHAR c) { /* {{ This buffer can be overrun if LESSBINFMT is a long string. }} */ static char buf[MAX_PRCHAR_LEN+1]; @@ -592,9 +563,7 @@ prchar(c) /* * Return the printable form of a UTF-8 character. */ - public char * -prutfchar(ch) - LWCHAR ch; +public char * prutfchar(LWCHAR ch) { static char buf[MAX_PRCHAR_LEN+1]; @@ -623,9 +592,7 @@ prutfchar(ch) /* * Get the length of a UTF-8 character in bytes. */ - public int -utf_len(ch) - int ch; +public int utf_len(int ch) { if ((ch & 0x80) == 0) return 1; @@ -646,10 +613,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(ss, slen) - char *ss; - int slen; +public int is_utf8_well_formed(char *ss, int slen) { int i; int len; @@ -684,10 +648,7 @@ is_utf8_well_formed(ss, slen) /* * Skip bytes until a UTF-8 lead byte (11xxxxxx) or ASCII byte (0xxxxxxx) is found. */ - public void -utf_skip_to_lead(pp, limit) - char **pp; - char *limit; +public void utf_skip_to_lead(char **pp, char *limit) { do { ++(*pp); @@ -698,9 +659,7 @@ utf_skip_to_lead(pp, limit) /* * Get the value of a UTF-8 character. */ - public LWCHAR -get_wchar(p) - constant char *p; +public LWCHAR get_wchar(constant char *p) { switch (utf_len(p[0])) { @@ -750,10 +709,7 @@ get_wchar(p) /* * Store a character into a UTF-8 string. */ - public void -put_wchar(pp, ch) - char **pp; - LWCHAR ch; +public void put_wchar(char **pp, LWCHAR ch) { if (!utf_mode || ch < 0x80) { @@ -800,11 +756,7 @@ 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; - constant char *limit; +public LWCHAR step_char(char **pp, signed int dir, constant char *limit) { LWCHAR ch; int len; @@ -874,10 +826,7 @@ static struct wchar_range comb_table[] = { }; - static int -is_in_table(ch, table) - LWCHAR ch; - struct wchar_range_table *table; +static int is_in_table(LWCHAR ch, struct wchar_range_table *table) { int hi; int lo; @@ -904,9 +853,7 @@ is_in_table(ch, table) * Is a character a UTF-8 composing character? * If a composing character follows any char, the two combine into one glyph. */ - public int -is_composing_char(ch) - LWCHAR ch; +public int is_composing_char(LWCHAR ch) { if (is_in_table(ch, &user_prt_table)) return 0; return is_in_table(ch, &user_compose_table) || @@ -917,9 +864,7 @@ is_composing_char(ch) /* * Should this UTF-8 character be treated as binary? */ - public int -is_ubin_char(ch) - LWCHAR ch; +public int is_ubin_char(LWCHAR ch) { if (is_in_table(ch, &user_prt_table)) return 0; return is_in_table(ch, &user_ubin_table) || @@ -930,9 +875,7 @@ is_ubin_char(ch) /* * Is this a double width UTF-8 character? */ - public int -is_wide_char(ch) - LWCHAR ch; +public int is_wide_char(LWCHAR ch) { return is_in_table(ch, &user_wide_table) || is_in_table(ch, &wide_table); @@ -943,10 +886,7 @@ is_wide_char(ch) * A combining char acts like an ordinary char, but if it follows * a specific char (not any char), the two combine into one glyph. */ - public int -is_combining_char(ch1, ch2) - LWCHAR ch1; - LWCHAR ch2; +public int is_combining_char(LWCHAR ch1, LWCHAR ch2) { /* The table is small; use linear search. */ int i; diff --git a/cmdbuf.c b/cmdbuf.c index f3bc201e..4985d285 100644 --- a/cmdbuf.c +++ b/cmdbuf.c @@ -35,7 +35,7 @@ static int literal; /* Next input char should not be interpreted */ public int updown_match = -1; /* Prefix length in up/down movement */ #if TAB_COMPLETE_FILENAME -static int cmd_complete LESSPARAMS((int action)); +static int cmd_complete(int action); /* * These variables are statics used by cmd_complete. */ @@ -117,8 +117,7 @@ static int cmd_mbc_buf_index; /* * Reset command buffer (to empty). */ - public void -cmd_reset(VOID_PARAM) +public void cmd_reset(void) { cp = cmdbuf; *cp = '\0'; @@ -132,8 +131,7 @@ cmd_reset(VOID_PARAM) /* * Clear command line. */ - public void -clear_cmd(VOID_PARAM) +public void clear_cmd(void) { cmd_col = prompt_col = 0; cmd_mbc_buf_len = 0; @@ -143,9 +141,7 @@ clear_cmd(VOID_PARAM) /* * Display a string, usually as a prompt for input into the command buffer. */ - public void -cmd_putstr(s) - constant char *s; +public void cmd_putstr(constant char *s) { LWCHAR prev_ch = 0; LWCHAR ch; @@ -172,8 +168,7 @@ cmd_putstr(s) /* * How many characters are in the command buffer? */ - public int -len_cmdbuf(VOID_PARAM) +public int len_cmdbuf(void) { char *s = cmdbuf; char *endline = s + strlen(s); @@ -192,13 +187,7 @@ len_cmdbuf(VOID_PARAM) * {{ 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(p, ch, len, pwidth, bswidth) - char *p; - LWCHAR ch; - int len; - int *pwidth; - int *bswidth; +static char * cmd_step_common(char *p, LWCHAR ch, int len, int *pwidth, int *bswidth) { char *pr; int width; @@ -233,11 +222,7 @@ cmd_step_common(p, ch, len, pwidth, bswidth) /* * Step a pointer one character right in the command buffer. */ - static char * -cmd_step_right(pp, pwidth, bswidth) - char **pp; - int *pwidth; - int *bswidth; +static char * cmd_step_right(char **pp, int *pwidth, int *bswidth) { char *p = *pp; LWCHAR ch = step_char(pp, +1, p + strlen(p)); @@ -248,11 +233,7 @@ 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; +static char * cmd_step_left(char **pp, int *pwidth, int *bswidth) { char *p = *pp; LWCHAR ch = step_char(pp, -1, cmdbuf); @@ -264,8 +245,7 @@ cmd_step_left(pp, pwidth, bswidth) * Put the cursor at "home" (just after the prompt), * and set cp to the corresponding char in cmdbuf. */ - static void -cmd_home(VOID_PARAM) +static void cmd_home(void) { while (cmd_col > prompt_col) { @@ -284,9 +264,7 @@ cmd_home(VOID_PARAM) * Repaint the line from cp onwards. * Then position the cursor just after the char old_cp (a pointer into cmdbuf). */ - public void -cmd_repaint(old_cp) - constant char *old_cp; +public void cmd_repaint(constant char *old_cp) { /* * Repaint the line from the current position. @@ -329,8 +307,7 @@ cmd_repaint(old_cp) /* * Shift the cmdbuf display left a half-screen. */ - static void -cmd_lshift(VOID_PARAM) +static void cmd_lshift(void) { char *s; char *save_cp; @@ -367,8 +344,7 @@ cmd_lshift(VOID_PARAM) /* * Shift the cmdbuf display right a half-screen. */ - static void -cmd_rshift(VOID_PARAM) +static void cmd_rshift(void) { char *s; char *save_cp; @@ -397,8 +373,7 @@ cmd_rshift(VOID_PARAM) /* * Move cursor right one character. */ - static int -cmd_right(VOID_PARAM) +static int cmd_right(void) { char *pr; char *ncp; @@ -432,8 +407,7 @@ cmd_right(VOID_PARAM) /* * Move cursor left one character. */ - static int -cmd_left(VOID_PARAM) +static int cmd_left(void) { char *ncp; int width = 0; @@ -463,10 +437,7 @@ cmd_left(VOID_PARAM) /* * Insert a char into the command buffer, at the current position. */ - static int -cmd_ichar(cs, clen) - char *cs; - int clen; +static int cmd_ichar(char *cs, int clen) { char *s; @@ -500,8 +471,7 @@ cmd_ichar(cs, clen) * Backspace in the command buffer. * Delete the char to the left of the cursor. */ - static int -cmd_erase(VOID_PARAM) +static int cmd_erase(void) { char *s; int clen; @@ -549,8 +519,7 @@ cmd_erase(VOID_PARAM) /* * Delete the char under the cursor. */ - static int -cmd_delete(VOID_PARAM) +static int cmd_delete(void) { if (*cp == '\0') { @@ -568,8 +537,7 @@ cmd_delete(VOID_PARAM) /* * Delete the "word" to the left of the cursor. */ - static int -cmd_werase(VOID_PARAM) +static int cmd_werase(void) { if (cp > cmdbuf && cp[-1] == ' ') { @@ -594,8 +562,7 @@ cmd_werase(VOID_PARAM) /* * Delete the "word" under the cursor. */ - static int -cmd_wdelete(VOID_PARAM) +static int cmd_wdelete(void) { if (*cp == ' ') { @@ -620,8 +587,7 @@ cmd_wdelete(VOID_PARAM) /* * Delete all chars in the command buffer. */ - static int -cmd_kill(VOID_PARAM) +static int cmd_kill(void) { if (cmdbuf[0] == '\0') { @@ -646,10 +612,7 @@ cmd_kill(VOID_PARAM) /* * Select an mlist structure to be the current command history. */ - public void -set_mlist(mlist, cmdflags) - void *mlist; - int cmdflags; +public void set_mlist(void *mlist, int cmdflags) { #if CMD_HISTORY curr_mlist = (struct mlist *) mlist; @@ -667,9 +630,7 @@ set_mlist(mlist, cmdflags) * Only consider entries whose first updown_match chars are equal to * cmdbuf's corresponding chars. */ - static int -cmd_updown(action) - int action; +static int cmd_updown(int action) { constant char *s; struct mlist *ml; @@ -731,10 +692,7 @@ cmd_updown(action) /* * */ - static void -ml_link(mlist, ml) - struct mlist *mlist; - struct mlist *ml; +static void ml_link(struct mlist *mlist, struct mlist *ml) { ml->next = mlist; ml->prev = mlist->prev; @@ -745,9 +703,7 @@ ml_link(mlist, ml) /* * */ - static void -ml_unlink(ml) - struct mlist *ml; +static void ml_unlink(struct mlist *ml) { ml->prev->next = ml->next; ml->next->prev = ml->prev; @@ -756,11 +712,7 @@ ml_unlink(ml) /* * Add a string to an mlist. */ - public void -cmd_addhist(mlist, cmd, modified) - struct mlist *mlist; - constant char *cmd; - int modified; +public void cmd_addhist(struct mlist *mlist, constant char *cmd, int modified) { #if CMD_HISTORY struct mlist *ml; @@ -814,8 +766,7 @@ cmd_addhist(mlist, cmd, modified) * Accept the command in the command buffer. * Add it to the currently selected history list. */ - public void -cmd_accept(VOID_PARAM) +public void cmd_accept(void) { #if CMD_HISTORY /* @@ -836,9 +787,7 @@ cmd_accept(VOID_PARAM) * CC_OK Line edit function done. * CC_QUIT The char requests the current command to be aborted. */ - static int -cmd_edit(c) - int c; +static int cmd_edit(int c) { int action; int flags; @@ -846,7 +795,7 @@ cmd_edit(c) #if TAB_COMPLETE_FILENAME #define not_in_completion() in_completion = 0 #else -#define not_in_completion(VOID_PARAM) +#define not_in_completion(void) #endif /* @@ -953,9 +902,7 @@ cmd_edit(c) /* * Insert a string into the command buffer, at the current position. */ - static int -cmd_istr(str) - char *str; +static int cmd_istr(char *str) { char *s; int action; @@ -978,8 +925,7 @@ cmd_istr(str) * Return pointer to the beginning of the word and put the * cursor at the end of the word. */ - static char * -delimit_word(VOID_PARAM) +static char * delimit_word(void) { char *word; #if SPACES_IN_FILENAMES @@ -1065,8 +1011,7 @@ delimit_word(VOID_PARAM) * Expand the word under the cursor into a list of filenames * which start with that word, and set tk_text to that list. */ - static void -init_compl(VOID_PARAM) +static void init_compl(void) { char *word; char c; @@ -1128,10 +1073,7 @@ init_compl(VOID_PARAM) /* * Return the next word in the current completion list. */ - static char * -next_compl(action, prev) - int action; - char *prev; +static char * next_compl(int action, char *prev) { switch (action) { @@ -1150,9 +1092,7 @@ next_compl(action, prev) * remembers whether this call is the first time (create the list), * or a subsequent time (step thru the list). */ - static int -cmd_complete(action) - int action; +static int cmd_complete(int action) { char *s; @@ -1248,9 +1188,7 @@ cmd_complete(action) * CC_QUIT The char requests the command to be aborted. * CC_ERROR The char could not be accepted due to an error. */ - public int -cmd_char(c) - int c; +public int cmd_char(int c) { int action; int len; @@ -1345,9 +1283,7 @@ cmd_char(c) /* * Return the number currently in the command buffer. */ - public LINENUM -cmd_int(frac) - long *frac; +public LINENUM cmd_int(long *frac) { char *p; LINENUM n = 0; @@ -1375,8 +1311,7 @@ cmd_int(frac) /* * Return a pointer to the command buffer. */ - public char * -get_cmdbuf(VOID_PARAM) +public char * get_cmdbuf(void) { if (cmd_mbc_buf_index < cmd_mbc_buf_len) /* Don't return buffer containing an incomplete multibyte char. */ @@ -1388,8 +1323,7 @@ get_cmdbuf(VOID_PARAM) /* * Return the last (most recent) string in the current command history. */ - public char * -cmd_lastpattern(VOID_PARAM) +public char * cmd_lastpattern(void) { if (curr_mlist == NULL) return (NULL); @@ -1400,9 +1334,7 @@ cmd_lastpattern(VOID_PARAM) #if CMD_HISTORY /* */ - static int -mlist_size(ml) - struct mlist *ml; +static int mlist_size(struct mlist *ml) { int size = 0; for (ml = ml->next; ml->string != NULL; ml = ml->next) @@ -1413,9 +1345,7 @@ mlist_size(ml) /* * Get the name of the history file. */ - static char * -histfile_find(must_exist) - int must_exist; +static char * histfile_find(int must_exist) { char *home = lgetenv("HOME"); char *name = NULL; @@ -1442,9 +1372,7 @@ histfile_find(must_exist) return (name); } - static char * -histfile_name(must_exist) - int must_exist; +static char * histfile_name(int must_exist) { char *name; @@ -1476,12 +1404,7 @@ histfile_name(must_exist) /* * 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; +static void read_cmdhist2(void (*action)(void*,struct mlist*,char*), void *uparam, int skip_search, int skip_shell) { struct mlist *ml = NULL; char line[CMDBUF_SIZE]; @@ -1546,12 +1469,7 @@ read_cmdhist2(action, uparam, skip_search, skip_shell) fclose(f); } - static void -read_cmdhist(action, uparam, skip_search, skip_shell) - void (*action)(void*,struct mlist*,char*); - void *uparam; - int skip_search; - int skip_shell; +static void read_cmdhist(void (*action)(void*,struct mlist*,char*), void *uparam, int skip_search, int skip_shell) { if (secure) return; @@ -1559,11 +1477,7 @@ read_cmdhist(action, uparam, skip_search, skip_shell) (*action)(uparam, NULL, NULL); /* signal end of file */ } - static void -addhist_init(uparam, ml, string) - void *uparam; - struct mlist *ml; - char *string; +static void addhist_init(void *uparam, struct mlist *ml, char *string) { if (ml != NULL) cmd_addhist(ml, string, 0); @@ -1575,8 +1489,7 @@ addhist_init(uparam, ml, string) /* * Initialize history from a .lesshist file. */ - public void -init_cmdhist(VOID_PARAM) +public void init_cmdhist(void) { #if CMD_HISTORY read_cmdhist(&addhist_init, NULL, 0, 0); @@ -1587,10 +1500,7 @@ init_cmdhist(VOID_PARAM) * Write the header for a section of the history file. */ #if CMD_HISTORY - static void -write_mlist_header(ml, f) - struct mlist *ml; - FILE *f; +static void write_mlist_header(struct mlist *ml, FILE *f) { if (ml == &mlist_search) fprintf(f, "%s\n", HISTFILE_SEARCH_SECTION); @@ -1603,10 +1513,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; +static void write_mlist(struct mlist *ml, FILE *f) { for (ml = ml->next; ml->string != NULL; ml = ml->next) { @@ -1621,9 +1528,7 @@ write_mlist(ml, f) /* * Make a temp name in the same directory as filename. */ - static char * -make_tempname(filename) - char *filename; +static char * make_tempname(char *filename) { char lastch; char *tempname = ecalloc(1, strlen(filename)+1); @@ -1644,11 +1549,7 @@ struct save_ctx * At the end of each mlist, append any new entries * created during this session. */ - static void -copy_hist(uparam, ml, string) - void *uparam; - struct mlist *ml; - char *string; +static void copy_hist(void *uparam, struct mlist *ml, char *string) { struct save_ctx *ctx = (struct save_ctx *) uparam; @@ -1689,9 +1590,7 @@ copy_hist(uparam, ml, string) /* * Make a file readable only by its owner. */ - static void -make_file_private(f) - FILE *f; +static void make_file_private(FILE *f) { #if HAVE_FCHMOD int do_chmod = 1; @@ -1711,8 +1610,7 @@ make_file_private(f) * Does the history file need to be updated? */ #if CMD_HISTORY - static int -histfile_modified(VOID_PARAM) +static int histfile_modified(void) { if (mlist_search.modified) return 1; @@ -1729,8 +1627,7 @@ histfile_modified(VOID_PARAM) /* * Update the .lesshst file. */ - public void -save_cmdhist(VOID_PARAM) +public void save_cmdhist(void) { #if CMD_HISTORY char *histname; diff --git a/command.c b/command.c index 8d5ac12a..e50fbca6 100644 --- a/command.c +++ b/command.c @@ -93,15 +93,14 @@ struct ungot { }; static struct ungot* ungot = NULL; -static void multi_search LESSPARAMS((char *pattern, int n, int silent)); +static void multi_search (char *pattern, int n, int silent); /* * Move the cursor to start of prompt line before executing a command. * This looks nicer if the command takes a long time before * updating the screen. */ - static void -cmd_exec(VOID_PARAM) +static void cmd_exec(void) { clear_attn(); clear_bot(); @@ -111,9 +110,7 @@ cmd_exec(VOID_PARAM) /* * Indicate we are reading a multi-character command. */ - static void -set_mca(action) - int action; +static void set_mca(int action) { mca = action; clear_bot(); @@ -123,8 +120,7 @@ set_mca(action) /* * Indicate we are not reading a multi-character command. */ - static void -clear_mca(VOID_PARAM) +static void clear_mca(void) { if (mca == 0) return; @@ -134,20 +130,14 @@ clear_mca(VOID_PARAM) /* * Set up the display to start a new multi-character command. */ - static void -start_mca(action, prompt, mlist, cmdflags) - int action; - constant char *prompt; - void *mlist; - int cmdflags; +static void start_mca(int action, constant char *prompt, void *mlist, int cmdflags) { set_mca(action); cmd_putstr(prompt); set_mlist(mlist, cmdflags); } - public int -in_mca(VOID_PARAM) +public int in_mca(void) { return (mca != 0 && mca != A_PREFIX); } @@ -155,8 +145,7 @@ in_mca(VOID_PARAM) /* * Set up the display to start a new search command. */ - static void -mca_search1(VOID_PARAM) +static void mca_search1(void) { #if HILITE_SEARCH if (search_type & SRCH_FILTER) @@ -193,8 +182,7 @@ mca_search1(VOID_PARAM) forw_prompt = 0; } - static void -mca_search(VOID_PARAM) +static void mca_search(void) { mca_search1(); set_mlist(ml_search, 0); @@ -203,8 +191,7 @@ mca_search(VOID_PARAM) /* * Set up the display to start a new toggle-option command. */ - static void -mca_opt_toggle(VOID_PARAM) +static void mca_opt_toggle(void) { int no_prompt; int flag; @@ -236,8 +223,7 @@ mca_opt_toggle(VOID_PARAM) /* * Execute a multicharacter command. */ - static void -exec_mca(VOID_PARAM) +static void exec_mca(void) { char *cbuf; @@ -328,9 +314,7 @@ exec_mca(VOID_PARAM) /* * Is a character an erase or kill char? */ - static int -is_erase_char(c) - int c; +static int is_erase_char(int c) { return (c == erase_char || c == erase2_char || c == kill_char); } @@ -338,9 +322,7 @@ is_erase_char(c) /* * Is a character a carriage return or newline? */ - static int -is_newline_char(c) - int c; +static int is_newline_char(int c) { return (c == '\n' || c == '\r'); } @@ -348,9 +330,7 @@ is_newline_char(c) /* * Handle the first char of an option (after the initial dash). */ - static int -mca_opt_first_char(c) - int c; +static int mca_opt_first_char(int c) { int no_prompt = (optflag & OPT_NO_PROMPT); int flag = (optflag & ~OPT_NO_PROMPT); @@ -401,9 +381,7 @@ mca_opt_first_char(c) * If so, display the complete name and stop * accepting chars until user hits RETURN. */ - static int -mca_opt_nonfirst_char(c) - int c; +static int mca_opt_nonfirst_char(int c) { char *p; char *oname; @@ -458,9 +436,7 @@ mca_opt_nonfirst_char(c) /* * Handle a char of an option toggle command. */ - static int -mca_opt_char(c) - int c; +static int mca_opt_char(int c) { PARG parg; @@ -527,9 +503,7 @@ mca_opt_char(c) /* * Normalize search type. */ - public int -norm_search_type(st) - int st; +public int norm_search_type(int st) { /* WRAP and PAST_EOF are mutually exclusive. */ if ((st & (SRCH_PAST_EOF|SRCH_WRAP)) == (SRCH_PAST_EOF|SRCH_WRAP)) @@ -540,9 +514,7 @@ norm_search_type(st) /* * Handle a char of a search command. */ - static int -mca_search_char(c) - int c; +static int mca_search_char(int c) { int flag = 0; @@ -597,9 +569,7 @@ mca_search_char(c) /* * Handle a character of a multi-character command. */ - static int -mca_char(c) - int c; +static int mca_char(int c) { int ret; @@ -745,8 +715,7 @@ mca_char(c) /* * Discard any buffered file data. */ - static void -clear_buffers(VOID_PARAM) +static void clear_buffers(void) { if (!(ch_getflags() & CH_CANSEEK)) return; @@ -760,8 +729,7 @@ clear_buffers(VOID_PARAM) /* * Make sure the screen is displayed. */ - static void -make_display(VOID_PARAM) +static void make_display(void) { /* * If nothing is displayed yet, display starting from initial_scrpos. @@ -794,8 +762,7 @@ make_display(VOID_PARAM) /* * Display the appropriate prompt. */ - static void -prompt(VOID_PARAM) +static void prompt(void) { constant char *p; @@ -890,8 +857,7 @@ prompt(VOID_PARAM) /* * Display the less version message. */ - public void -dispversion(VOID_PARAM) +public void dispversion(void) { PARG parg; @@ -902,8 +868,7 @@ dispversion(VOID_PARAM) /* * Return a character to complete a partial command, if possible. */ - static LWCHAR -getcc_end_command(VOID_PARAM) +static LWCHAR getcc_end_command(void) { switch (mca) { @@ -926,8 +891,7 @@ getcc_end_command(VOID_PARAM) * but may come from ungotten characters * (characters previously given to ungetcc or ungetsc). */ - static LWCHAR -getccu(VOID_PARAM) +static LWCHAR getccu(void) { LWCHAR c = 0; while (c == 0) @@ -957,12 +921,7 @@ getccu(VOID_PARAM) * Get a command character, but if we receive the orig sequence, * convert it to the repl sequence. */ - static LWCHAR -getcc_repl(orig, repl, gr_getc, gr_ungetc) - char constant* orig; - char constant* repl; - LWCHAR (*gr_getc)(VOID_PARAM); - void (*gr_ungetc)(LWCHAR); +static LWCHAR getcc_repl(char constant *orig, char constant *repl, LWCHAR (*gr_getc)(void), void (*gr_ungetc)(LWCHAR)) { LWCHAR c; LWCHAR keys[16]; @@ -1001,8 +960,7 @@ getcc_repl(orig, repl, gr_getc, gr_ungetc) /* * Get command character. */ - public int -getcc(VOID_PARAM) +public int getcc(void) { /* Replace kent (keypad Enter) with a newline. */ return getcc_repl(kent, "\n", getccu, ungetcc); @@ -1012,9 +970,7 @@ getcc(VOID_PARAM) * "Unget" a command character. * The next getcc() will return this character. */ - public void -ungetcc(c) - LWCHAR c; +public void ungetcc(LWCHAR c) { struct ungot *ug = (struct ungot *) ecalloc(1, sizeof(struct ungot)); @@ -1027,9 +983,7 @@ ungetcc(c) * "Unget" a command character. * If any other chars are already ungotten, put this one after those. */ - public void -ungetcc_back(c) - LWCHAR c; +public void ungetcc_back(LWCHAR c) { struct ungot *ug = (struct ungot *) ecalloc(1, sizeof(struct ungot)); ug->ug_char = c; @@ -1049,9 +1003,7 @@ ungetcc_back(c) * Unget a whole string of command characters. * The next sequence of getcc()'s will return this string. */ - public void -ungetsc(s) - char *s; +public void ungetsc(char *s) { while (*s != '\0') ungetcc_back(*s++); @@ -1060,8 +1012,7 @@ ungetsc(s) /* * Peek the next command character, without consuming it. */ - public LWCHAR -peekcc(VOID_PARAM) +public LWCHAR peekcc(void) { LWCHAR c = getcc(); ungetcc(c); @@ -1073,11 +1024,7 @@ peekcc(VOID_PARAM) * If SRCH_FIRST_FILE is set, begin searching at the first file. * If SRCH_PAST_EOF is set, continue the search thru multiple files. */ - static void -multi_search(pattern, n, silent) - char *pattern; - int n; - int silent; +static void multi_search(char *pattern, int n, int silent) { int nomore; IFILE save_ifile; @@ -1171,9 +1118,7 @@ multi_search(pattern, n, silent) /* * Forward forever, or until a highlighted line appears. */ - static int -forw_loop(until_hilite) - int until_hilite; +static int forw_loop(int until_hilite) { POSITION curr_len; @@ -1212,8 +1157,7 @@ forw_loop(until_hilite) * Main command processor. * Accept and execute commands until a quit command. */ - public void -commands(VOID_PARAM) +public void commands(void) { int c; int action; diff --git a/cvt.c b/cvt.c index bb464926..cf601b2b 100644 --- a/cvt.c +++ b/cvt.c @@ -19,10 +19,7 @@ extern int utf_mode; /* * Get the length of a buffer needed to convert a string. */ - public int -cvt_length(len, ops) - int len; - int ops; +public int cvt_length(int len, int ops) { if (utf_mode) /* @@ -37,9 +34,7 @@ cvt_length(len, ops) /* * Allocate a chpos array for use by cvt_text. */ - public int * -cvt_alloc_chpos(len) - int len; +public int * cvt_alloc_chpos(int len) { int i; int *chpos = (int *) ecalloc(sizeof(int), len); @@ -54,13 +49,7 @@ cvt_alloc_chpos(len) * Returns converted text in odst. The original offset of each * odst character (when it was in osrc) is returned in the chpos array. */ - public void -cvt_text(odst, osrc, chpos, lenp, ops) - char *odst; - char *osrc; - int *chpos; - int *lenp; - int ops; +public void cvt_text(char *odst, char *osrc, int *chpos, int *lenp, int ops) { char *dst; char *edst = odst; diff --git a/decode.c b/decode.c index eab9da10..8d11dfd4 100644 --- a/decode.c +++ b/decode.c @@ -242,10 +242,7 @@ static struct tablelist *list_sysvar_tables = NULL; /* * Expand special key abbreviations in a command table. */ - static void -expand_special_keys(table, len) - char *table; - int len; +static void expand_special_keys(char *table, int len) { char *fm; char *to; @@ -303,9 +300,7 @@ expand_special_keys(table, len) /* * Expand special key abbreviations in a list of command tables. */ - static void -expand_cmd_table(tlist) - struct tablelist *tlist; +static void expand_cmd_table(struct tablelist *tlist) { struct tablelist *t; for (t = tlist; t != NULL; t = t->t_next) @@ -317,8 +312,7 @@ expand_cmd_table(tlist) /* * Expand special key abbreviations in all command tables. */ - public void -expand_cmd_tables(VOID_PARAM) +public void expand_cmd_tables(void) { expand_cmd_table(list_fcmd_tables); expand_cmd_table(list_ecmd_tables); @@ -330,8 +324,7 @@ expand_cmd_tables(VOID_PARAM) /* * Initialize the command lists. */ - public void -init_cmds(VOID_PARAM) +public void init_cmds(void) { /* * Add the default command tables. @@ -380,11 +373,7 @@ init_cmds(VOID_PARAM) /* * Add a command table. */ - static int -add_cmd_table(tlist, buf, len) - struct tablelist **tlist; - char *buf; - int len; +static int add_cmd_table(struct tablelist **tlist, char *buf, int len) { struct tablelist *t; @@ -409,10 +398,7 @@ add_cmd_table(tlist, buf, len) /* * Add a command table. */ - public void -add_fcmd_table(buf, len) - char *buf; - int len; +public void add_fcmd_table(char *buf, int len) { if (add_cmd_table(&list_fcmd_tables, buf, len) < 0) error("Warning: some commands disabled", NULL_PARG); @@ -421,10 +407,7 @@ add_fcmd_table(buf, len) /* * Add an editing command table. */ - public void -add_ecmd_table(buf, len) - char *buf; - int len; +public void add_ecmd_table(char *buf, int len) { if (add_cmd_table(&list_ecmd_tables, buf, len) < 0) error("Warning: some edit commands disabled", NULL_PARG); @@ -433,11 +416,7 @@ add_ecmd_table(buf, len) /* * Add an environment variable table. */ - static void -add_var_table(tlist, buf, len) - struct tablelist **tlist; - char *buf; - int len; +static void add_var_table(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); @@ -446,8 +425,7 @@ add_var_table(tlist, buf, len) /* * Return action for a mouse wheel down event. */ - static int -mouse_wheel_down(VOID_PARAM) +static int mouse_wheel_down(void) { return ((mousecap == OPT_ONPLUS) ? A_B_MOUSE : A_F_MOUSE); } @@ -455,8 +433,7 @@ mouse_wheel_down(VOID_PARAM) /* * Return action for a mouse wheel up event. */ - static int -mouse_wheel_up(VOID_PARAM) +static int mouse_wheel_up(void) { return ((mousecap == OPT_ONPLUS) ? A_F_MOUSE : A_B_MOUSE); } @@ -464,10 +441,7 @@ mouse_wheel_up(VOID_PARAM) /* * Return action for a mouse button release event. */ - static int -mouse_button_rel(x, y) - int x; - int y; +static int mouse_button_rel(int x, int y) { /* * {{ It would be better to return an action and then do this @@ -484,9 +458,7 @@ mouse_button_rel(x, y) /* * Read a decimal integer. Return the integer and set *pterm to the terminating char. */ - static int -getcc_int(pterm) - char* pterm; +static int getcc_int(char *pterm) { int num = 0; int digits = 0; @@ -509,9 +481,7 @@ getcc_int(pterm) * Read suffix of mouse input and return the action to take. * The prefix ("\e[M") has already been read. */ - static int -x11mouse_action(skip) - int skip; +static int x11mouse_action(int skip) { int b = getcc() - X11MOUSE_OFFSET; int x = getcc() - X11MOUSE_OFFSET-1; @@ -534,9 +504,7 @@ x11mouse_action(skip) * Read suffix of mouse input and return the action to take. * The prefix ("\e[<") has already been read. */ - static int -x116mouse_action(skip) - int skip; +static int x116mouse_action(int skip) { char ch; int x, y; @@ -562,12 +530,7 @@ x116mouse_action(skip) /* * Search a single command table for the command string in cmd. */ - static int -cmd_search(cmd, table, endtable, sp) - char *cmd; - char *table; - char *endtable; - char **sp; +static int cmd_search(char *cmd, char *table, char *endtable, char **sp) { char *p; char *q; @@ -658,11 +621,7 @@ cmd_search(cmd, table, endtable, sp) * Decode a command character and return the associated action. * The "extra" string, if any, is returned in sp. */ - static int -cmd_decode(tlist, cmd, sp) - struct tablelist *tlist; - char *cmd; - char **sp; +static int cmd_decode(struct tablelist *tlist, char *cmd, char **sp) { struct tablelist *t; int action = A_INVALID; @@ -685,10 +644,7 @@ cmd_decode(tlist, cmd, sp) /* * Decode a command from the cmdtables list. */ - public int -fcmd_decode(cmd, sp) - char *cmd; - char **sp; +public int fcmd_decode(char *cmd, char **sp) { return (cmd_decode(list_fcmd_tables, cmd, sp)); } @@ -696,10 +652,7 @@ fcmd_decode(cmd, sp) /* * Decode a command from the edittables list. */ - public int -ecmd_decode(cmd, sp) - char *cmd; - char **sp; +public int ecmd_decode(char *cmd, char **sp) { return (cmd_decode(list_ecmd_tables, cmd, sp)); } @@ -708,9 +661,7 @@ ecmd_decode(cmd, sp) * Get the value of an environment variable. * Looks first in the lesskey file, then in the real environment. */ - public char * -lgetenv(var) - char *var; +public char * lgetenv(char *var) { int a; char *s; @@ -730,9 +681,7 @@ lgetenv(var) /* * Is a string null or empty? */ - public int -isnullenv(s) - char* s; +public int isnullenv(char *s) { return (s == NULL || *s == '\0'); } @@ -743,9 +692,7 @@ isnullenv(s) * Integers are stored in a funny format: * two bytes, low order first, in radix KRADIX. */ - static int -gint(sp) - char **sp; +static int gint(char **sp) { int n; @@ -757,10 +704,7 @@ gint(sp) /* * Process an old (pre-v241) lesskey file. */ - static int -old_lesskey(buf, len) - char *buf; - int len; +static int old_lesskey(char *buf, int len) { /* * Old-style lesskey file. @@ -778,11 +722,7 @@ old_lesskey(buf, len) /* * Process a new (post-v241) lesskey file. */ - static int -new_lesskey(buf, len, sysvar) - char *buf; - int len; - int sysvar; +static int new_lesskey(char *buf, int len, int sysvar) { char *p; char *end; @@ -840,10 +780,7 @@ new_lesskey(buf, len, sysvar) /* * Set up a user command table, based on a "lesskey" file. */ - public int -lesskey(filename, sysvar) - char *filename; - int sysvar; +public int lesskey(char *filename, int sysvar) { char *buf; POSITION len; @@ -907,10 +844,7 @@ lesskey(filename, sysvar) } #if HAVE_LESSKEYSRC - public int -lesskey_src(filename, sysvar) - char *filename; - int sysvar; +public int lesskey_src(char *filename, int sysvar) { static struct lesskey_tables tables; int r = parse_lesskey(filename, &tables); @@ -923,9 +857,7 @@ lesskey_src(filename, sysvar) return (0); } - void -lesskey_parse_error(s) - char *s; +void lesskey_parse_error(char *s) { PARG parg; parg.p_string = s; @@ -936,12 +868,7 @@ lesskey_parse_error(s) /* * Add a lesskey file. */ - public int -add_hometable(call_lesskey, envname, def_filename, sysvar) - int (*call_lesskey)(char *, int); - char *envname; - char *def_filename; - int sysvar; +public int add_hometable(int (*call_lesskey)(char *, int), char *envname, char *def_filename, int sysvar) { char *filename; int r; @@ -980,10 +907,7 @@ add_hometable(call_lesskey, envname, def_filename, sysvar) /* * See if a char is a special line-editing command. */ - public int -editchar(c, flags) - int c; - int flags; +public int editchar(int c, int flags) { int action; int nch; diff --git a/edit.c b/edit.c index a0200775..e1555ae3 100644 --- a/edit.c +++ b/edit.c @@ -55,10 +55,7 @@ public ino_t curr_ino; * words, returning each one as a standard null-terminated string. * back_textlist does the same, but runs thru the list backwards. */ - public void -init_textlist(tlist, str) - struct textlist *tlist; - char *str; +public void init_textlist(struct textlist *tlist, char *str) { char *s; #if SPACES_IN_FILENAMES @@ -99,10 +96,7 @@ init_textlist(tlist, str) } } - public char * -forw_textlist(tlist, prev) - struct textlist *tlist; - char *prev; +public char * forw_textlist(struct textlist *tlist, char *prev) { char *s; @@ -123,10 +117,7 @@ forw_textlist(tlist, prev) return (s); } - public char * -back_textlist(tlist, prev) - struct textlist *tlist; - char *prev; +public char * back_textlist(struct textlist *tlist, char *prev) { char *s; @@ -152,8 +143,7 @@ back_textlist(tlist, prev) /* * Close a pipe opened via popen. */ - static void -close_pipe(FILE *pipefd) +static void close_pipe(FILE *pipefd) { if (pipefd == NULL) return; @@ -170,8 +160,7 @@ close_pipe(FILE *pipefd) /* * Close the current input file. */ - static void -close_file(VOID_PARAM) +static void close_file(void) { struct scrpos scrpos; int chflags; @@ -223,9 +212,7 @@ close_file(VOID_PARAM) * Filename == "-" means standard input. * Filename == NULL means just close the current file. */ - public int -edit(filename) - char *filename; +public int edit(char *filename) { if (filename == NULL) return (edit_ifile(NULL_IFILE)); @@ -235,13 +222,7 @@ edit(filename) /* * Clean up what edit_ifile did before error return. */ - static int -edit_error(filename, alt_filename, altpipe, ifile, was_curr_ifile) - char *filename; - char *alt_filename; - void *altpipe; - IFILE ifile; - IFILE was_curr_ifile; +static int edit_error(char *filename, char *alt_filename, void *altpipe, IFILE ifile, IFILE was_curr_ifile) { if (alt_filename != NULL) { @@ -270,9 +251,7 @@ edit_error(filename, alt_filename, altpipe, ifile, was_curr_ifile) * Edit a new file (given its IFILE). * ifile == NULL means just close the current file. */ - public int -edit_ifile(ifile) - IFILE ifile; +public int edit_ifile(IFILE ifile) { int f; int answer; @@ -522,9 +501,7 @@ edit_ifile(ifile) * For each filename in the list, enter it into the ifile list. * Then edit the first one. */ - public int -edit_list(filelist) - char *filelist; +public int edit_list(char *filelist) { IFILE save_ifile; char *good_filename; @@ -583,8 +560,7 @@ edit_list(filelist) /* * Edit the first file in the command line (ifile) list. */ - public int -edit_first(VOID_PARAM) +public int edit_first(void) { if (nifile() == 0) return (edit_stdin()); @@ -595,8 +571,7 @@ edit_first(VOID_PARAM) /* * Edit the last file in the command line (ifile) list. */ - public int -edit_last(VOID_PARAM) +public int edit_last(void) { curr_ifile = NULL_IFILE; return (edit_prev(1)); @@ -606,11 +581,7 @@ edit_last(VOID_PARAM) /* * Edit the n-th next or previous file in the command line (ifile) list. */ - static int -edit_istep(h, n, dir) - IFILE h; - int n; - int dir; +static int edit_istep(IFILE h, int n, int dir) { IFILE next; @@ -648,32 +619,22 @@ edit_istep(h, n, dir) return (0); } - static int -edit_inext(h, n) - IFILE h; - int n; +static int edit_inext(IFILE h, int n) { return (edit_istep(h, n, +1)); } - public int -edit_next(n) - int n; +public int edit_next(int n) { return edit_istep(curr_ifile, n, +1); } - static int -edit_iprev(h, n) - IFILE h; - int n; +static int edit_iprev(IFILE h, int n) { return (edit_istep(h, n, -1)); } - public int -edit_prev(n) - int n; +public int edit_prev(int n) { return edit_istep(curr_ifile, n, -1); } @@ -681,9 +642,7 @@ edit_prev(n) /* * Edit a specific file in the command line (ifile) list. */ - public int -edit_index(n) - int n; +public int edit_index(int n) { IFILE h; @@ -702,17 +661,14 @@ edit_index(n) return (edit_ifile(h)); } - public IFILE -save_curr_ifile(VOID_PARAM) +public IFILE save_curr_ifile(void) { if (curr_ifile != NULL_IFILE) hold_ifile(curr_ifile, 1); return (curr_ifile); } - public void -unsave_ifile(save_ifile) - IFILE save_ifile; +public void unsave_ifile(IFILE save_ifile) { if (save_ifile != NULL_IFILE) hold_ifile(save_ifile, -1); @@ -721,9 +677,7 @@ unsave_ifile(save_ifile) /* * Reedit the ifile which was previously open. */ - public void -reedit_ifile(save_ifile) - IFILE save_ifile; +public void reedit_ifile(IFILE save_ifile) { IFILE next; IFILE prev; @@ -755,8 +709,7 @@ reedit_ifile(save_ifile) quit(QUIT_ERROR); } - public void -reopen_curr_ifile(VOID_PARAM) +public void reopen_curr_ifile(void) { IFILE save_ifile = save_curr_ifile(); close_file(); @@ -766,8 +719,7 @@ reopen_curr_ifile(VOID_PARAM) /* * Edit standard input. */ - public int -edit_stdin(VOID_PARAM) +public int edit_stdin(void) { if (isatty(fd0)) { @@ -781,8 +733,7 @@ edit_stdin(VOID_PARAM) * Copy a file directly to standard output. * Used if standard output is not a tty. */ - public void -cat_file(VOID_PARAM) +public void cat_file(void) { int c; @@ -800,9 +751,7 @@ cat_file(VOID_PARAM) * is standard input, create the log file. * We take care not to blindly overwrite an existing file. */ - public void -use_logfile(filename) - char *filename; +public void use_logfile(char *filename) { int exists; int answer; diff --git a/filename.c b/filename.c index cbc9c676..694adf4a 100644 --- a/filename.c +++ b/filename.c @@ -62,9 +62,7 @@ extern dev_t curr_dev; /* * Remove quotes around a filename. */ - public char * -shell_unquote(str) - char *str; +public char * shell_unquote(char *str) { char *name; char *p; @@ -101,8 +99,7 @@ shell_unquote(str) /* * Get the shell's escape character. */ - public char * -get_meta_escape(VOID_PARAM) +public char * get_meta_escape(void) { char *s; @@ -115,8 +112,7 @@ get_meta_escape(VOID_PARAM) /* * Get the characters which the shell considers to be "metacharacters". */ - static char * -metachars(VOID_PARAM) +static char * metachars(void) { static char *mchars = NULL; @@ -132,9 +128,7 @@ metachars(VOID_PARAM) /* * Is this a shell metacharacter? */ - static int -metachar(c) - char c; +static int metachar(char c) { return (strchr(metachars(), c) != NULL); } @@ -142,9 +136,7 @@ metachar(c) /* * Insert a backslash before each metacharacter in a string. */ - public char * -shell_quote(s) - char *s; +public char * shell_quote(char *s) { char *p; char *newstr; @@ -220,11 +212,7 @@ shell_quote(s) * Return a pathname that points to a specified file in a specified directory. * Return NULL if the file does not exist in the directory. */ - public char * -dirfile(dirname, filename, must_exist) - char *dirname; - char *filename; - int must_exist; +public char * dirfile(char *dirname, char *filename, int must_exist) { char *pathname; int len; @@ -261,9 +249,7 @@ dirfile(dirname, filename, must_exist) /* * Return the full pathname of the given file in the "home directory". */ - public char * -homefile(filename) - char *filename; +public char * homefile(char *filename) { char *pathname; @@ -305,9 +291,7 @@ homefile(filename) * Likewise for a string of N "#"s. * {{ This is a lot of work just to support % and #. }} */ - public char * -fexpand(s) - char *s; +public char * fexpand(char *s) { char *fr, *to; int n; @@ -401,9 +385,7 @@ fexpand(s) * Return a blank-separated list of filenames which "complete" * the given string. */ - public char * -fcomplete(s) - char *s; +public char * fcomplete(char *s) { char *fpat; char *qs; @@ -461,9 +443,7 @@ fcomplete(s) * Try to determine if a file is "binary". * This is just a guess, and we need not try too hard to make it accurate. */ - public int -bin_file(f) - int f; +public int bin_file(int f) { int n; int bin_count = 0; @@ -507,9 +487,7 @@ bin_file(f) /* * Try to determine the size of a file by seeking to the end. */ - static POSITION -seek_filesize(f) - int f; +static POSITION seek_filesize(int f) { off_t spos; @@ -524,9 +502,7 @@ seek_filesize(f) * Read a string from a file. * Return a pointer to the string in memory. */ - static char * -readfd(fd) - FILE *fd; +static char * readfd(FILE *fd) { int len; int ch; @@ -567,9 +543,7 @@ readfd(fd) * Execute a shell command. * Return a pointer to a pipe connected to the shell command's standard output. */ - static FILE * -shellcmd(cmd) - char *cmd; +static FILE * shellcmd(char *cmd) { FILE *fd; @@ -618,9 +592,7 @@ shellcmd(cmd) /* * Expand a filename, doing any system-specific metacharacter substitutions. */ - public char * -lglob(filename) - char *filename; +public char * lglob(char *filename) { char *gfilename; @@ -800,9 +772,7 @@ lglob(filename) /* * Does path not represent something in the file system? */ - public int -is_fake_pathname(path) - char *path; +public int is_fake_pathname(char *path) { return (strcmp(path, "-") == 0 || strcmp(path, FAKE_HELPFILE) == 0 || strcmp(path, FAKE_EMPTYFILE) == 0); @@ -811,9 +781,7 @@ is_fake_pathname(path) /* * Return canonical pathname. */ - public char * -lrealpath(path) - char *path; +public char * lrealpath(char *path) { if (!is_fake_pathname(path)) { @@ -831,9 +799,7 @@ lrealpath(path) * Return number of %s escapes in a string. * Return a large number if there are any other % escapes besides %s. */ - static int -num_pct_s(lessopen) - char *lessopen; +static int num_pct_s(char *lessopen) { int num = 0; @@ -858,11 +824,7 @@ num_pct_s(lessopen) * See if we should open a "replacement file" * instead of the file we're about to open. */ - public char * -open_altfile(filename, pf, pfd) - char *filename; - int *pf; - void **pfd; +public char * open_altfile(char *filename, int *pf, void **pfd) { #if !HAVE_POPEN return (NULL); @@ -983,10 +945,7 @@ open_altfile(filename, pf, pfd) /* * Close a replacement file. */ - public void -close_altfile(altfilename, filename) - char *altfilename; - char *filename; +public void close_altfile(char *altfilename, char *filename) { #if HAVE_POPEN char *lessclose; @@ -1023,9 +982,7 @@ close_altfile(altfilename, filename) /* * Is the specified file a directory? */ - public int -is_dir(filename) - char *filename; +public int is_dir(char *filename) { int isdir = 0; @@ -1057,9 +1014,7 @@ is_dir(filename) * is an ordinary file, otherwise an error message * (if it cannot be opened or is a directory, etc.) */ - public char * -bad_file(filename) - char *filename; +public char * bad_file(char *filename) { char *m = NULL; @@ -1101,9 +1056,7 @@ bad_file(filename) * Return the size of a file, as cheaply as possible. * In Unix, we can stat the file. */ - public POSITION -filesize(f) - int f; +public POSITION filesize(int f) { #if HAVE_STAT struct stat statbuf; @@ -1121,8 +1074,7 @@ filesize(f) return (seek_filesize(f)); } - public int -curr_ifile_changed(VOID_PARAM) +public int curr_ifile_changed(void) { #if HAVE_STAT_INO /* @@ -1144,8 +1096,7 @@ curr_ifile_changed(VOID_PARAM) /* * */ - public char * -shell_coption(VOID_PARAM) +public char * shell_coption(void) { return ("-c"); } @@ -1153,9 +1104,7 @@ shell_coption(VOID_PARAM) /* * Return last component of a pathname. */ - public char * -last_component(name) - char *name; +public char * last_component(char *name) { char *slash; diff --git a/forwback.c b/forwback.c index 0e72efff..2e3c6656 100644 --- a/forwback.c +++ b/forwback.c @@ -48,8 +48,7 @@ extern char *tagoption; /* * Sound the bell to indicate user is trying to move past end of file. */ - public void -eof_bell(VOID_PARAM) +public void eof_bell(void) { #if HAVE_TIME static time_type last_eof_bell = 0; @@ -67,8 +66,7 @@ eof_bell(VOID_PARAM) /* * Check to see if the end of file is currently displayed. */ - public int -eof_displayed(VOID_PARAM) +public int eof_displayed(void) { POSITION pos; @@ -94,8 +92,7 @@ eof_displayed(VOID_PARAM) /* * Check to see if the entire file is currently displayed. */ - public int -entire_file_displayed(VOID_PARAM) +public int entire_file_displayed(void) { POSITION pos; @@ -114,8 +111,7 @@ entire_file_displayed(VOID_PARAM) * of the screen; this can happen when we display a short file * for the first time. */ - public void -squish_check(VOID_PARAM) +public void squish_check(void) { if (!squished) return; @@ -127,11 +123,7 @@ squish_check(VOID_PARAM) * Read the first pfx columns of the next line. * If skipeol==0 stop there, otherwise read and discard chars to end of line. */ - static POSITION -forw_line_pfx(pos, pfx, skipeol) - POSITION pos; - int pfx; - int skipeol; +static POSITION forw_line_pfx(POSITION pos, int pfx, int skipeol) { int save_sc_width = sc_width; int save_auto_wrap = auto_wrap; @@ -152,9 +144,7 @@ forw_line_pfx(pos, pfx, skipeol) * Underline last line of headers, but not at beginning of file * (where there is no gap between the last header line and the next line). */ - static void -set_attr_header(ln) - int ln; +static void set_attr_header(int ln) { set_attr_line(AT_COLOR_HEADER); if (ln+1 == header_lines && position(0) != ch_zero()) @@ -165,8 +155,7 @@ set_attr_header(ln) * Display file headers, overlaying text already drawn * at top and left of screen. */ - public int -overlay_header(VOID_PARAM) +public int overlay_header(void) { POSITION pos = ch_zero(); /* header lines are at beginning of file */ int ln; @@ -220,13 +209,7 @@ overlay_header(VOID_PARAM) * real line. If nblank > 0, the pos must be NULL_POSITION. * The first real line after the blanks will start at ch_zero(). */ - public void -forw(n, pos, force, only_last, nblank) - int n; - POSITION pos; - int force; - int only_last; - int nblank; +public void forw(int n, POSITION pos, int force, int only_last, int nblank) { int nlines = 0; int do_repaint; @@ -410,12 +393,7 @@ forw(n, pos, force, only_last, nblank) /* * Display n lines, scrolling backward. */ - public void -back(n, pos, force, only_last) - int n; - POSITION pos; - int force; - int only_last; +public void back(int n, POSITION pos, int force, int only_last) { int nlines = 0; int do_repaint; @@ -474,11 +452,7 @@ back(n, pos, force, only_last) * Display n more lines, forward. * Start just after the line currently displayed at the bottom of the screen. */ - public void -forward(n, force, only_last) - int n; - int force; - int only_last; +public void forward(int n, int force, int only_last) { POSITION pos; @@ -526,11 +500,7 @@ forward(n, force, only_last) * Display n more lines, backward. * Start just before the line currently displayed at the top of the screen. */ - public void -backward(n, force, only_last) - int n; - int force; - int only_last; +public void backward(int n, int force, int only_last) { POSITION pos; @@ -549,8 +519,7 @@ backward(n, force, only_last) * back_scroll, because the default case depends on sc_height and * top_scroll, as well as back_scroll. */ - public int -get_back_scroll(VOID_PARAM) +public int get_back_scroll(void) { if (no_back_scroll) return (0); @@ -564,8 +533,7 @@ get_back_scroll(VOID_PARAM) /* * Will the entire file fit on one screen? */ - public int -get_one_screen(VOID_PARAM) +public int get_one_screen(void) { int nlines; POSITION pos = ch_zero(); diff --git a/ifile.c b/ifile.c index 6b3d1ce9..fe4efdeb 100644 --- a/ifile.c +++ b/ifile.c @@ -51,10 +51,7 @@ static struct ifile anchor = { &anchor, &anchor, NULL, NULL, NULL, 0, 0, '\0', { NULL_POSITION, 0 } }; static int ifiles = 0; - static void -incr_index(p, incr) - struct ifile *p; - int incr; +static void incr_index(struct ifile *p, int incr) { for (; p != &anchor; p = p->h_next) p->h_index += incr; @@ -63,10 +60,7 @@ incr_index(p, incr) /* * Link an ifile into the ifile list. */ - static void -link_ifile(p, prev) - struct ifile *p; - struct ifile *prev; +static void link_ifile(struct ifile *p, struct ifile *prev) { /* * Link into list. @@ -89,9 +83,7 @@ link_ifile(p, prev) /* * Unlink an ifile from the ifile list. */ - static void -unlink_ifile(p) - struct ifile *p; +static void unlink_ifile(struct ifile *p) { p->h_next->h_prev = p->h_prev; p->h_prev->h_next = p->h_next; @@ -105,10 +97,7 @@ unlink_ifile(p) * (or at the beginning of the list if "prev" is NULL). * Return a pointer to the new ifile structure. */ - static struct ifile * -new_ifile(filename, prev) - char *filename; - struct ifile *prev; +static struct ifile * new_ifile(char *filename, struct ifile *prev) { struct ifile *p; @@ -137,9 +126,7 @@ new_ifile(filename, prev) /* * Delete an existing ifile structure. */ - public void -del_ifile(h) - IFILE h; +public void del_ifile(IFILE h) { struct ifile *p; @@ -162,9 +149,7 @@ del_ifile(h) /* * Get the ifile after a given one in the list. */ - public IFILE -next_ifile(h) - IFILE h; +public IFILE next_ifile(IFILE h) { struct ifile *p; @@ -177,9 +162,7 @@ next_ifile(h) /* * Get the ifile before a given one in the list. */ - public IFILE -prev_ifile(h) - IFILE h; +public IFILE prev_ifile(IFILE h) { struct ifile *p; @@ -192,9 +175,7 @@ prev_ifile(h) /* * Return a different ifile from the given one. */ - public IFILE -getoff_ifile(ifile) - IFILE ifile; +public IFILE getoff_ifile(IFILE ifile) { IFILE newifile; @@ -208,8 +189,7 @@ getoff_ifile(ifile) /* * Return the number of ifiles. */ - public int -nifile(VOID_PARAM) +public int nifile(void) { return (ifiles); } @@ -217,9 +197,7 @@ nifile(VOID_PARAM) /* * Find an ifile structure, given a filename. */ - static struct ifile * -find_ifile(filename) - char *filename; +static struct ifile * find_ifile(char *filename) { struct ifile *p; char *rfilename = lrealpath(filename); @@ -251,10 +229,7 @@ find_ifile(filename) * If the filename has not been seen before, * insert the new ifile after "prev" in the list. */ - public IFILE -get_ifile(filename, prev) - char *filename; - IFILE prev; +public IFILE get_ifile(char *filename, IFILE prev) { struct ifile *p; @@ -266,9 +241,7 @@ get_ifile(filename, prev) /* * Get the display filename associated with a ifile. */ - public char * -get_filename(ifile) - IFILE ifile; +public char * get_filename(IFILE ifile) { if (ifile == NULL) return (NULL); @@ -278,9 +251,7 @@ get_filename(ifile) /* * Get the canonical filename associated with a ifile. */ - public char * -get_real_filename(ifile) - IFILE ifile; +public char * get_real_filename(IFILE ifile) { if (ifile == NULL) return (NULL); @@ -290,9 +261,7 @@ get_real_filename(ifile) /* * Get the index of the file associated with a ifile. */ - public int -get_index(ifile) - IFILE ifile; +public int get_index(IFILE ifile) { return (int_ifile(ifile)->h_index); } @@ -300,10 +269,7 @@ get_index(ifile) /* * Save the file position to be associated with a given file. */ - public void -store_pos(ifile, scrpos) - IFILE ifile; - struct scrpos *scrpos; +public void store_pos(IFILE ifile, struct scrpos *scrpos) { int_ifile(ifile)->h_scrpos = *scrpos; } @@ -312,10 +278,7 @@ store_pos(ifile, scrpos) * Recall the file position associated with a file. * If no position has been associated with the file, return NULL_POSITION. */ - public void -get_pos(ifile, scrpos) - IFILE ifile; - struct scrpos *scrpos; +public void get_pos(IFILE ifile, struct scrpos *scrpos) { *scrpos = int_ifile(ifile)->h_scrpos; } @@ -323,9 +286,7 @@ get_pos(ifile, scrpos) /* * Mark the ifile as "opened". */ - public void -set_open(ifile) - IFILE ifile; +public void set_open(IFILE ifile) { int_ifile(ifile)->h_opened = 1; } @@ -333,62 +294,42 @@ set_open(ifile) /* * Return whether the ifile has been opened previously. */ - public int -opened(ifile) - IFILE ifile; +public int opened(IFILE ifile) { return (int_ifile(ifile)->h_opened); } - public void -hold_ifile(ifile, incr) - IFILE ifile; - int incr; +public void hold_ifile(IFILE ifile, int incr) { int_ifile(ifile)->h_hold += incr; } - public int -held_ifile(ifile) - IFILE ifile; +public int held_ifile(IFILE ifile) { return (int_ifile(ifile)->h_hold); } - public void * -get_filestate(ifile) - IFILE ifile; +public void * get_filestate(IFILE ifile) { return (int_ifile(ifile)->h_filestate); } - public void -set_filestate(ifile, filestate) - IFILE ifile; - void *filestate; +public void set_filestate(IFILE ifile, void *filestate) { int_ifile(ifile)->h_filestate = filestate; } - public void -set_altpipe(ifile, p) - IFILE ifile; - void *p; +public void set_altpipe(IFILE ifile, void *p) { int_ifile(ifile)->h_altpipe = p; } - public void * -get_altpipe(ifile) - IFILE ifile; +public void * get_altpipe(IFILE ifile) { return (int_ifile(ifile)->h_altpipe); } - public void -set_altfilename(ifile, altfilename) - IFILE ifile; - char *altfilename; +public void set_altfilename(IFILE ifile, char *altfilename) { struct ifile *p = int_ifile(ifile); if (p->h_altfilename != NULL && p->h_altfilename != altfilename) @@ -396,16 +337,13 @@ set_altfilename(ifile, altfilename) p->h_altfilename = altfilename; } - public char * -get_altfilename(ifile) - IFILE ifile; +public char * get_altfilename(IFILE ifile) { return (int_ifile(ifile)->h_altfilename); } #if 0 - public void -if_dump(VOID_PARAM) +public void if_dump(void) { struct ifile *p; diff --git a/input.c b/input.c index 58993fa7..6b9d9746 100644 --- a/input.c +++ b/input.c @@ -42,12 +42,7 @@ extern int show_attn; * eol End of line. Normally the newline. * Different than edisp if line is chopped. */ - static void -init_status_col(base_pos, disp_pos, edisp_pos, eol_pos) - POSITION base_pos; - POSITION disp_pos; - POSITION edisp_pos; - POSITION eol_pos; +static void init_status_col(POSITION base_pos, POSITION disp_pos, POSITION edisp_pos, POSITION eol_pos) { int hl_before = (chop_line() && disp_pos != NULL_POSITION) ? is_hilited_attr(base_pos, disp_pos, TRUE, NULL) : 0; @@ -84,12 +79,7 @@ init_status_col(base_pos, disp_pos, edisp_pos, eol_pos) * a line. The new position is the position of the first character * of the NEXT line. The line obtained is the line starting at curr_pos. */ - public POSITION -forw_line_seg(curr_pos, skipeol, rscroll, nochop) - POSITION curr_pos; - int skipeol; - int rscroll; - int nochop; +public POSITION forw_line_seg(POSITION curr_pos, int skipeol, int rscroll, int nochop) { POSITION base_pos; POSITION new_pos; @@ -300,9 +290,7 @@ forw_line_seg(curr_pos, skipeol, rscroll, nochop) return (new_pos); } - public POSITION -forw_line(curr_pos) - POSITION curr_pos; +public POSITION forw_line(POSITION curr_pos) { return forw_line_seg(curr_pos, (chop_line() || hshift > 0), TRUE, FALSE); @@ -315,9 +303,7 @@ forw_line(curr_pos) * a line. The new position is the position of the first character * of the PREVIOUS line. The line obtained is the one starting at new_pos. */ - public POSITION -back_line(curr_pos) - POSITION curr_pos; +public POSITION back_line(POSITION curr_pos) { POSITION base_pos; POSITION new_pos; @@ -507,9 +493,7 @@ back_line(curr_pos) /* * Set attnpos. */ - public void -set_attnpos(pos) - POSITION pos; +public void set_attnpos(POSITION pos) { int c; diff --git a/jump.c b/jump.c index 8604ffce..a754a325 100644 --- a/jump.c +++ b/jump.c @@ -25,8 +25,7 @@ extern int top_scroll; /* * Jump to the end of the file. */ - public void -jump_forw(VOID_PARAM) +public void jump_forw(void) { POSITION pos; POSITION end_pos; @@ -68,8 +67,7 @@ jump_forw(VOID_PARAM) /* * Jump to the last buffered line in the file. */ - public void -jump_forw_buffered(VOID_PARAM) +public void jump_forw_buffered(void) { POSITION end; @@ -86,9 +84,7 @@ jump_forw_buffered(VOID_PARAM) /* * Jump to line n in the file. */ - public void -jump_back(linenum) - LINENUM linenum; +public void jump_back(LINENUM linenum) { POSITION pos; PARG parg; @@ -119,8 +115,7 @@ jump_back(linenum) /* * Repaint the screen. */ - public void -repaint(VOID_PARAM) +public void repaint(void) { struct scrpos scrpos; /* @@ -139,10 +134,7 @@ repaint(VOID_PARAM) /* * Jump to a specified percentage into the file. */ - public void -jump_percent(percent, fraction) - int percent; - long fraction; +public void jump_percent(int percent, long fraction) { POSITION pos, len; @@ -172,10 +164,7 @@ jump_percent(percent, fraction) * Like jump_loc, but the position need not be * the first character in a line. */ - public void -jump_line_loc(pos, sline) - POSITION pos; - int sline; +public void jump_line_loc(POSITION pos, int sline) { int c; @@ -200,10 +189,7 @@ jump_line_loc(pos, sline) * The position must be the first character in a line. * Place the target line on a specified line on the screen. */ - public void -jump_loc(pos, sline) - POSITION pos; - int sline; +public void jump_loc(POSITION pos, int sline) { int nline; int sindex; diff --git a/less.h b/less.h index d40ff422..ae9e05a3 100644 --- a/less.h +++ b/less.h @@ -39,19 +39,6 @@ /* * Language details. */ -#if HAVE_ANSI_PROTOS -#define LESSPARAMS(a) a -#else -#define LESSPARAMS(a) () -#endif -#if HAVE_VOID -#define VOID_POINTER void * -#define VOID_PARAM void -#else -#define VOID_POINTER char * -#define VOID_PARAM -#define void int -#endif #if HAVE_CONST #define constant const #else @@ -114,7 +101,7 @@ #if !HAVE_STDLIB_H char *getenv(); off_t lseek(); -VOID_POINTER calloc(); +void *calloc(); void free(); #endif @@ -289,7 +276,7 @@ typedef off_t LINENUM; /* * An IFILE represents an input file. */ -#define IFILE VOID_POINTER +#define IFILE void* #define NULL_IFILE ((IFILE)NULL) /* @@ -587,12 +574,12 @@ struct ansi_state; #include "funcs.h" /* Functions not included in funcs.h */ -void postoa LESSPARAMS ((POSITION, char*)); -void linenumtoa LESSPARAMS ((LINENUM, char*)); -void inttoa LESSPARAMS ((int, char*)); -int lstrtoi LESSPARAMS ((char*, char**, int)); -POSITION lstrtopos LESSPARAMS ((char*, char**, int)); -unsigned long lstrtoul LESSPARAMS ((char*, char**, int)); +void postoa(POSITION, char*); +void linenumtoa(LINENUM, char*); +void inttoa(int, char*); +int lstrtoi(char*, char**, int); +POSITION lstrtopos(char*, char**, int); +unsigned long lstrtoul(char*, char**, int); #if MSDOS_COMPILER==WIN32C -int pclose LESSPARAMS ((FILE*)); +int pclose(FILE*); #endif diff --git a/lessecho.c b/lessecho.c index c6fa4c93..bf5c1cf9 100644 --- a/lessecho.c +++ b/lessecho.c @@ -38,15 +38,13 @@ static char* metachars = NULL; static int num_metachars = 0; static int size_metachars = 0; - static void -pr_usage(VOID_PARAM) +static void pr_usage(void) { fprintf(stderr, "usage: lessecho [-ox] [-cx] [-pn] [-dn] [-mx] [-nn] [-ex] [-fn] [-a] file ...\n"); } - static void -pr_version(VOID_PARAM) +static void pr_version(void) { char *p; char buf[10]; @@ -61,19 +59,13 @@ pr_version(VOID_PARAM) printf("%s\n", buf); } - static void -pr_error(s) - char *s; +static void pr_error(char *s) { fprintf(stderr, "%s\n", s); exit(1); } - static long -lstrtol(s, pend, radix) - char *s; - char **pend; - int radix; +static long lstrtol(char *s, char **pend, int radix) { int v; int neg = 0; @@ -141,9 +133,7 @@ lstrtol(s, pend, radix) return (n); } - static void -add_metachar(ch) - int ch; +static void add_metachar(int ch) { if (num_metachars+1 >= size_metachars) { @@ -164,18 +154,13 @@ add_metachar(ch) metachars[num_metachars] = '\0'; } - static int -is_metachar(ch) - int ch; +static int is_metachar(int ch) { return (metachars != NULL && strchr(metachars, ch) != NULL); } #if !HAVE_STRCHR - char * -strchr(s, c) - char *s; - int c; +char * strchr(char *s, char c) { for ( ; *s != '\0'; s++) if (*s == c) @@ -186,10 +171,7 @@ strchr(s, c) } #endif - int -main(argc, argv) - int argc; - char *argv[]; +int main(int argc, char *argv[]) { char *arg; char *s; diff --git a/lesskey.c b/lesskey.c index f8e4a6eb..8c080bb9 100644 --- a/lesskey.c +++ b/lesskey.c @@ -108,33 +108,23 @@ char *outfile = NULL ; extern char version[]; - static void -usage(void) +static void usage(void) { fprintf(stderr, "usage: lesskey [-o output] [input]\n"); exit(1); } - void -lesskey_parse_error(s) - char *s; +void lesskey_parse_error(char *s) { fprintf(stderr, "%s\n", s); } - int -lstrtoi(buf, ebuf, radix) - char *buf; - char **ebuf; - int radix; +int lstrtoi(char *buf, char **ebuf, int radix) { return (int) strtol(buf, ebuf, radix); } - void * -ecalloc(count, size) - int count; - unsigned int size; +void * ecalloc(int count, unsigned int size) { void *p; @@ -145,10 +135,7 @@ ecalloc(count, size) exit(1); } - static char * -mkpathname(dirname, filename) - char *dirname; - char *filename; +static char * mkpathname(char *dirname, char *filename) { char *pathname; @@ -162,9 +149,7 @@ mkpathname(dirname, filename) /* * Figure out the name of a default file (in the user's HOME directory). */ - char * -homefile(filename) - char *filename; +char * homefile(char *filename) { char *p; char *pathname; @@ -186,10 +171,7 @@ homefile(filename) /* * Parse command line arguments. */ - static void -parse_args(argc, argv) - int argc; - char **argv; +static void parse_args(int argc, char **argv) { char *arg; @@ -259,11 +241,7 @@ parse_args(argc, argv) /* * Output some bytes. */ - static void -fputbytes(fd, buf, len) - FILE *fd; - char *buf; - int len; +static void fputbytes(FILE *fd, char *buf, int len) { while (len-- > 0) { @@ -275,10 +253,7 @@ fputbytes(fd, buf, len) /* * Output an integer, in special KRADIX form. */ - static void -fputint(fd, val) - FILE *fd; - unsigned int val; +static void fputint(FILE *fd, unsigned int val) { char c; @@ -294,10 +269,7 @@ fputint(fd, val) fwrite(&c, sizeof(char), 1, fd); } - int -main(argc, argv) - int argc; - char *argv[]; +int main(int argc, char *argv[]) { struct lesskey_tables tables; FILE *out; diff --git a/lesskey_parse.c b/lesskey_parse.c index 0f8318bd..c24dcb5e 100644 --- a/lesskey_parse.c +++ b/lesskey_parse.c @@ -126,10 +126,7 @@ static struct lesskey_cmdname editnames[] = /* * Print a parse error message. */ - static void -parse_error(fmt, arg1) - char *fmt; - char *arg1; +static void parse_error(char *fmt, char *arg1) { char buf[1024]; int n = snprintf(buf, sizeof(buf), "%s: line %d: ", lesskey_file, linenum); @@ -142,9 +139,7 @@ parse_error(fmt, arg1) /* * Initialize lesskey_tables. */ - static void -init_tables(tables) - struct lesskey_tables *tables; +static void init_tables(struct lesskey_tables *tables) { tables->currtable = &tables->cmdtable; @@ -163,11 +158,7 @@ init_tables(tables) #define CHAR_STRING_LEN 8 - static char * -char_string(buf, ch, lit) - char *buf; - int ch; - int lit; +static char * char_string(char *buf, int ch, int lit) { if (lit || (ch >= 0x20 && ch < 0x7f)) { @@ -183,9 +174,7 @@ char_string(buf, ch, lit) /* * Increment char pointer by one up to terminating nul byte. */ - static char * -increment_pointer(p) - char *p; +static char * increment_pointer(char *p) { if (*p == '\0') return p; @@ -195,10 +184,7 @@ increment_pointer(p) /* * Parse one character of a string. */ - static char * -tstr(pp, xlate) - char **pp; - int xlate; +static char * tstr(char **pp, int xlate) { char *p; char ch; @@ -309,9 +295,7 @@ tstr(pp, xlate) return (buf); } - static int -issp(ch) - char ch; +static int issp(char ch) { return (ch == ' ' || ch == '\t'); } @@ -319,9 +303,7 @@ issp(ch) /* * Skip leading spaces in a string. */ - static char * -skipsp(s) - char *s; +static char * skipsp(char *s) { while (issp(*s)) s++; @@ -331,9 +313,7 @@ skipsp(s) /* * Skip non-space characters in a string. */ - static char * -skipnsp(s) - char *s; +static char * skipnsp(char *s) { while (*s != '\0' && !issp(*s)) s++; @@ -344,9 +324,7 @@ skipnsp(s) * Clean up an input line: * strip off the trailing newline & any trailing # comment. */ - static char * -clean_line(s) - char *s; +static char * clean_line(char *s) { int i; @@ -361,17 +339,12 @@ clean_line(s) /* * Add a byte to the output command table. */ - static void -add_cmd_char(c, tables) - char c; - struct lesskey_tables *tables; +static void add_cmd_char(char c, struct lesskey_tables *tables) { xbuf_add_byte(&tables->currtable->buf, (unsigned char) c); } - static void -erase_cmd_char(tables) - struct lesskey_tables *tables; +static void erase_cmd_char(struct lesskey_tables *tables) { xbuf_pop(&tables->currtable->buf); } @@ -379,10 +352,7 @@ erase_cmd_char(tables) /* * Add a string to the output command table. */ - static void -add_cmd_str(s, tables) - char *s; - struct lesskey_tables *tables; +static void add_cmd_str(char *s, struct lesskey_tables *tables) { for ( ; *s != '\0'; s++) add_cmd_char(*s, tables); @@ -392,10 +362,7 @@ add_cmd_str(s, tables) * Does a given version number match the running version? * Operator compares the running version to the given version. */ - static int -match_version(op, ver) - char op; - int ver; +static int match_version(char op, int ver) { switch (op) { @@ -414,10 +381,7 @@ match_version(op, ver) * If the version matches, return the part of the line that should be executed. * Otherwise, return NULL. */ - static char * -version_line(s, tables) - char *s; - struct lesskey_tables *tables; +static char * version_line(char *s, struct lesskey_tables *tables) { char op; int ver; @@ -453,10 +417,7 @@ version_line(s, tables) /* * See if we have a special "control" line. */ - static char * -control_line(s, tables) - char *s; - struct lesskey_tables *tables; +static char * control_line(char *s, struct lesskey_tables *tables) { #define PREFIX(str,pat) (strncmp(str,pat,strlen(pat)) == 0) @@ -491,10 +452,7 @@ control_line(s, tables) /* * Find an action, given the name of the action. */ - static int -findaction(actname, tables) - char *actname; - struct lesskey_tables *tables; +static int findaction(char *actname, struct lesskey_tables *tables) { int i; @@ -512,10 +470,7 @@ findaction(actname, tables) * resulting less action, and EXTRA is an "extra" user * key sequence injected after the action. */ - static void -parse_cmdline(p, tables) - char *p; - struct lesskey_tables *tables; +static void parse_cmdline(char *p, struct lesskey_tables *tables) { char *actname; int action; @@ -581,10 +536,7 @@ parse_cmdline(p, tables) * Parse a variable definition line, of the form * NAME = VALUE */ - static void -parse_varline(line, tables) - char *line; - struct lesskey_tables *tables; +static void parse_varline(char *line, struct lesskey_tables *tables) { char *s; char *p = line; @@ -631,10 +583,7 @@ parse_varline(line, tables) /* * Parse a line from the lesskey file. */ - static void -parse_line(line, tables) - char *line; - struct lesskey_tables *tables; +static void parse_line(char *line, struct lesskey_tables *tables) { char *p; @@ -662,10 +611,7 @@ parse_line(line, tables) /* * Parse a lesskey source file and store result in tables. */ - int -parse_lesskey(infile, tables) - char *infile; - struct lesskey_tables *tables; +int parse_lesskey(char *infile, struct lesskey_tables *tables) { FILE *desc; char line[1024]; diff --git a/line.c b/line.c index db552fe2..1e1e53e2 100644 --- a/line.c +++ b/line.c @@ -75,9 +75,9 @@ static char *end_ansi_chars; static char *mid_ansi_chars; static int in_hilite; -static int attr_swidth LESSPARAMS ((int a)); -static int attr_ewidth LESSPARAMS ((int a)); -static int do_append LESSPARAMS ((LWCHAR ch, char *rep, POSITION pos)); +static int attr_swidth(int a); +static int attr_ewidth(int a); +static int do_append(LWCHAR ch, char *rep, POSITION pos); extern int sigs; extern int bs_mode; @@ -135,8 +135,7 @@ struct ansi_state { /* * Initialize from environment variables. */ - public void -init_line(VOID_PARAM) +public void init_line(void) { int ax; @@ -161,8 +160,7 @@ init_line(VOID_PARAM) /* * Expand the line buffer. */ - static int -expand_linebuf(VOID_PARAM) +static int expand_linebuf(void) { /* Double the size of the line buffer. */ int new_size = size_linebuf * 2; @@ -192,18 +190,14 @@ expand_linebuf(VOID_PARAM) /* * Is a character ASCII? */ - public int -is_ascii_char(ch) - LWCHAR ch; +public int is_ascii_char(LWCHAR ch) { return (ch <= 0x7F); } /* */ - static void -inc_end_column(w) - int w; +static void inc_end_column(int w) { if (end_column > right_column && w > 0) { @@ -213,8 +207,7 @@ inc_end_column(w) end_column += w; } - public POSITION -line_position(VOID_PARAM) +public POSITION line_position(void) { return line_pos; } @@ -222,8 +215,7 @@ line_position(VOID_PARAM) /* * Rewind the line buffer. */ - public void -prewind(VOID_PARAM) +public void prewind(void) { int ax; @@ -259,11 +251,7 @@ prewind(VOID_PARAM) /* * Set a character in the line buffer. */ - static void -set_linebuf(n, ch, attr) - int n; - char ch; - int attr; +static void set_linebuf(int n, char ch, int attr) { linebuf.buf[n] = ch; linebuf.attr[n] = attr; @@ -272,11 +260,7 @@ set_linebuf(n, ch, attr) /* * Append a character to the line buffer. */ - static void -add_linebuf(ch, attr, w) - char ch; - int attr; - int w; +static void add_linebuf(char ch, int attr, int w) { set_linebuf(linebuf.end++, ch, attr); inc_end_column(w); @@ -285,11 +269,7 @@ add_linebuf(ch, attr, w) /* * Append a string to the line buffer. */ - static void -addstr_linebuf(s, attr, cw) - char *s; - int attr; - int cw; +static void addstr_linebuf(char *s, int attr, int cw) { for ( ; *s != '\0'; s++) add_linebuf(*s, attr, cw); @@ -298,11 +278,7 @@ addstr_linebuf(s, attr, cw) /* * Set a character in the line prefix buffer. */ - static void -set_pfx(n, ch, attr) - int n; - char ch; - int attr; +static void set_pfx(int n, char ch, int attr) { linebuf.pfx[n] = ch; linebuf.pfx_attr[n] = attr; @@ -311,10 +287,7 @@ set_pfx(n, ch, attr) /* * Append a character to the line prefix buffer. */ - static void -add_pfx(ch, attr) - char ch; - int attr; +static void add_pfx(char ch, int attr) { set_pfx(linebuf.pfx_end++, ch, attr); } @@ -322,9 +295,7 @@ add_pfx(ch, attr) /* * Insert the status column and line number into the line buffer. */ - public void -plinestart(pos) - POSITION pos; +public void plinestart(POSITION pos) { LINENUM linenum = 0; int i; @@ -391,8 +362,7 @@ plinestart(pos) * Return the width of the line prefix (status column and line number). * {{ Actual line number can be wider than linenum_width. }} */ - public int -line_pfx_width(VOID_PARAM) +public int line_pfx_width(void) { int width = 0; if (status_col) @@ -406,8 +376,7 @@ line_pfx_width(VOID_PARAM) * Shift line left so that the last char is just to the left * of the first visible column. */ - public void -pshift_all(VOID_PARAM) +public void pshift_all(void) { int i; for (i = linebuf.print; i < linebuf.end; i++) @@ -421,9 +390,7 @@ pshift_all(VOID_PARAM) * Return the printing width of the start (enter) sequence * for a given character attribute. */ - static int -attr_swidth(a) - int a; +static int attr_swidth(int a) { int w = 0; @@ -445,9 +412,7 @@ attr_swidth(a) * Return the printing width of the end (exit) sequence * for a given character attribute. */ - static int -attr_ewidth(a) - int a; +static int attr_ewidth(int a) { int w = 0; @@ -471,12 +436,7 @@ attr_ewidth(a) * Adding a character with a given attribute may cause an enter or exit * attribute sequence to be inserted, so this must be taken into account. */ - public int -pwidth(ch, a, prev_ch, prev_a) - LWCHAR ch; - int a; - LWCHAR prev_ch; - int prev_a; +public int pwidth(LWCHAR ch, int a, LWCHAR prev_ch, int prev_a) { int w; @@ -538,8 +498,7 @@ pwidth(ch, a, prev_ch, prev_a) /* * Delete to the previous base character in the line buffer. */ - static int -backc(VOID_PARAM) +static int backc(void) { LWCHAR ch; char *p; @@ -568,9 +527,7 @@ backc(VOID_PARAM) /* * Is a character the end of an ANSI escape sequence? */ - public int -is_ansi_end(ch) - LWCHAR ch; +public int is_ansi_end(LWCHAR ch) { if (!is_ascii_char(ch)) return (0); @@ -580,9 +537,7 @@ is_ansi_end(ch) /* * Can a char appear in an ANSI escape sequence, before the end char? */ - public int -is_ansi_middle(ch) - LWCHAR ch; +public int is_ansi_middle(LWCHAR ch) { if (!is_ascii_char(ch)) return (0); @@ -595,11 +550,7 @@ is_ansi_middle(ch) * Skip past an ANSI escape sequence. * pp is initially positioned just after the CSI_START char. */ - public void -skip_ansi(pansi, pp, limit) - struct ansi_state *pansi; - char **pp; - constant char *limit; +public void skip_ansi(struct ansi_state *pansi, char **pp, constant char *limit) { LWCHAR c; do { @@ -612,9 +563,7 @@ skip_ansi(pansi, pp, limit) * Determine if a character starts an ANSI escape sequence. * If so, return an ansi_state struct; otherwise return NULL. */ - public struct ansi_state * -ansi_start(ch) - LWCHAR ch; +public struct ansi_state * ansi_start(LWCHAR ch) { struct ansi_state *pansi; @@ -631,10 +580,7 @@ ansi_start(ch) * Determine whether the next char in an ANSI escape sequence * ends the sequence. */ - public int -ansi_step(pansi, ch) - struct ansi_state *pansi; - LWCHAR ch; +public int ansi_step(struct ansi_state *pansi, LWCHAR ch) { if (pansi->hlink) { @@ -670,9 +616,7 @@ ansi_step(pansi, ch) /* * Free an ansi_state structure. */ - public void -ansi_done(pansi) - struct ansi_state *pansi; +public void ansi_done(struct ansi_state *pansi) { free(pansi); } @@ -680,10 +624,7 @@ ansi_done(pansi) /* * Will w characters in attribute a fit on the screen? */ - static int -fits_on_screen(w, a) - int w; - int a; +static int fits_on_screen(int w, int a) { if (ctldisp == OPT_ON) /* We're not counting, so say that everything fits. */ @@ -699,12 +640,7 @@ fits_on_screen(w, a) if (store_char((ch),(a),(rep),(pos))) return (1); \ } while (0) - static int -store_char(ch, a, rep, pos) - LWCHAR ch; - int a; - char *rep; - POSITION pos; +static int store_char(LWCHAR ch, int a, char *rep, POSITION pos) { int w; int i; @@ -852,11 +788,7 @@ store_char(ch, a, rep, pos) #define STORE_STRING(s,a,pos) \ do { if (store_string((s),(a),(pos))) return (1); } while (0) - static int -store_string(s, a, pos) - char *s; - int a; - POSITION pos; +static int store_string(char *s, int a, POSITION pos) { if (!fits_on_screen(strlen(s), a)) return 1; @@ -872,10 +804,7 @@ store_string(s, a, pos) #define STORE_TAB(a,pos) \ do { if (store_tab((a),(pos))) return (1); } while (0) - static int -store_tab(attr, pos) - int attr; - POSITION pos; +static int store_tab(int attr, POSITION pos) { int to_tab = end_column - linebuf.pfx_end; @@ -900,10 +829,7 @@ store_tab(attr, pos) #define STORE_PRCHAR(c, pos) \ do { if (store_prchar((c), (pos))) return 1; } while (0) - static int -store_prchar(c, pos) - LWCHAR c; - POSITION pos; +static int store_prchar(LWCHAR c, POSITION pos) { /* * Convert to printable representation. @@ -912,9 +838,7 @@ store_prchar(c, pos) return 0; } - static int -flush_mbc_buf(pos) - POSITION pos; +static int flush_mbc_buf(POSITION pos) { int i; @@ -929,10 +853,7 @@ flush_mbc_buf(pos) * Expand tabs into spaces, handle underlining, boldfacing, etc. * Returns 0 if ok, 1 if couldn't fit in buffer. */ - public int -pappend(c, pos) - int c; - POSITION pos; +public int pappend(int c, POSITION pos) { int r; @@ -1022,11 +943,7 @@ pappend(c, pos) return (r); } - static int -store_control_char(ch, rep, pos) - LWCHAR ch; - char *rep; - POSITION pos; +static int store_control_char(LWCHAR ch, char *rep, POSITION pos) { if (ctldisp == OPT_ON) { @@ -1040,11 +957,7 @@ store_control_char(ch, rep, pos) return (0); } - static int -store_ansi(ch, rep, pos) - LWCHAR ch; - char *rep; - POSITION pos; +static int store_ansi(LWCHAR ch, char *rep, POSITION pos) { switch (ansi_step(line_ansi, ch)) { @@ -1083,11 +996,7 @@ store_ansi(ch, rep, pos) return (0); } - static int -store_bs(ch, rep, pos) - LWCHAR ch; - char *rep; - POSITION pos; +static int store_bs(LWCHAR ch, char *rep, POSITION pos) { if (bs_mode == BS_CONTROL) return store_control_char(ch, rep, pos); @@ -1102,11 +1011,7 @@ store_bs(ch, rep, pos) return 0; } - static int -do_append(ch, rep, pos) - LWCHAR ch; - char *rep; - POSITION pos; +static int do_append(LWCHAR ch, char *rep, POSITION pos) { int a = AT_NORMAL; int in_overstrike = overstrike; @@ -1216,8 +1121,7 @@ do_append(ch, rep, pos) /* * */ - public int -pflushmbc(VOID_PARAM) +public int pflushmbc(void) { int r = 0; @@ -1233,8 +1137,7 @@ pflushmbc(VOID_PARAM) /* * Switch to normal attribute at end of line. */ - static void -add_attr_normal(VOID_PARAM) +static void add_attr_normal(void) { if (ctldisp != OPT_ONPLUS || !is_ansi_end('m')) return; @@ -1246,11 +1149,7 @@ add_attr_normal(VOID_PARAM) /* * Terminate the line in the line buffer. */ - public void -pdone(endline, chopped, forw) - int endline; - int chopped; - int forw; +public void pdone(int endline, int chopped, int forw) { (void) pflushmbc(); @@ -1342,9 +1241,7 @@ pdone(endline, chopped, forw) /* * Set an attribute on each char of the line in the line buffer. */ - public void -set_attr_line(a) - int a; +public void set_attr_line(int a) { int i; @@ -1356,10 +1253,7 @@ set_attr_line(a) /* * Set the char to be displayed in the status column. */ - public void -set_status_col(c, attr) - int c; - int attr; +public void set_status_col(int c, int attr) { set_pfx(0, c, attr); } @@ -1369,10 +1263,7 @@ set_status_col(c, attr) * Return the character as the function return value, * and the character attribute in *ap. */ - public int -gline(i, ap) - int i; - int *ap; +public int gline(int i, int *ap) { if (is_null_line) { @@ -1407,8 +1298,7 @@ gline(i, ap) /* * Indicate that there is no current line. */ - public void -null_line(VOID_PARAM) +public void null_line(void) { is_null_line = 1; cshift = 0; @@ -1419,11 +1309,7 @@ null_line(VOID_PARAM) * lines which are not split for screen width. * {{ This is supposed to be more efficient than forw_line(). }} */ - public POSITION -forw_raw_line(curr_pos, linep, line_lenp) - POSITION curr_pos; - char **linep; - int *line_lenp; +public POSITION forw_raw_line(POSITION curr_pos, char **linep, int *line_lenp) { int n; int c; @@ -1468,11 +1354,7 @@ forw_raw_line(curr_pos, linep, line_lenp) * Analogous to back_line(), but deals with "raw lines". * {{ This is supposed to be more efficient than back_line(). }} */ - public POSITION -back_raw_line(curr_pos, linep, line_lenp) - POSITION curr_pos; - char **linep; - int *line_lenp; +public POSITION back_raw_line(POSITION curr_pos, char **linep, int *line_lenp) { int n; int c; @@ -1542,11 +1424,7 @@ back_raw_line(curr_pos, linep, line_lenp) * Skip cols printable columns at the start of line. * Return number of bytes skipped. */ - public int -skip_columns(cols, linep, line_lenp) - int cols; - char **linep; - int *line_lenp; +public int skip_columns(int cols, char **linep, int *line_lenp) { char *line = *linep; char *eline = line + *line_lenp; @@ -1569,9 +1447,7 @@ skip_columns(cols, linep, line_lenp) /* * Append a string to the line buffer. */ - static int -pappstr(str) - constant char *str; +static int pappstr(constant char *str) { while (*str != '\0') { @@ -1587,9 +1463,7 @@ pappstr(str) * If the string is too long to fit on the screen, * truncate the beginning of the string to fit. */ - public void -load_line(str) - constant char *str; +public void load_line(constant char *str) { int save_hshift = hshift; @@ -1613,8 +1487,7 @@ load_line(str) /* * Find the shift necessary to show the end of the longest displayed line. */ - public int -rrshift(VOID_PARAM) +public int rrshift(void) { POSITION pos; int save_width; @@ -1639,9 +1512,7 @@ rrshift(VOID_PARAM) /* * Get the color_map index associated with a given attribute. */ - static int -color_index(attr) - int attr; +static int color_index(int attr) { if (use_color) { @@ -1673,10 +1544,7 @@ color_index(attr) /* * Set the color string to use for a given attribute. */ - public int -set_color_map(attr, colorstr) - int attr; - char *colorstr; +public int set_color_map(int attr, char *colorstr) { int cx = color_index(attr); if (cx < 0) @@ -1692,9 +1560,7 @@ set_color_map(attr, colorstr) /* * Get the color string to use for a given attribute. */ - public char * -get_color_map(attr) - int attr; +public char * get_color_map(int attr) { int cx = color_index(attr); if (cx < 0) diff --git a/linenum.c b/linenum.c index 1808ea97..b3cf20ba 100644 --- a/linenum.c +++ b/linenum.c @@ -74,8 +74,7 @@ extern int nonum_headers; /* * Initialize the line number structures. */ - public void -clr_linenum(VOID_PARAM) +public void clr_linenum(void) { struct linenum_info *p; @@ -102,9 +101,7 @@ clr_linenum(VOID_PARAM) /* * Calculate the gap for an entry. */ - static void -calcgap(p) - struct linenum_info *p; +static void calcgap(struct linenum_info *p) { /* * Don't bother to compute a gap for the anchor. @@ -122,10 +119,7 @@ calcgap(p) * The specified position (pos) should be the file position of the * FIRST character in the specified line. */ - public void -add_lnum(linenum, pos) - LINENUM linenum; - POSITION pos; +public void add_lnum(LINENUM linenum, POSITION pos) { struct linenum_info *p; struct linenum_info *new; @@ -210,8 +204,7 @@ add_lnum(linenum, pos) * If we get stuck in a long loop trying to figure out the * line number, print a message to tell the user what we're doing. */ - static void -longloopmessage(VOID_PARAM) +static void longloopmessage(void) { ierror("Calculating line numbers", NULL_PARG); } @@ -221,8 +214,7 @@ static int loopcount; static time_type startime; #endif - static void -longish(VOID_PARAM) +static void longish(void) { #if HAVE_TIME if (loopcount >= 0 && ++loopcount > 100) @@ -247,8 +239,7 @@ longish(VOID_PARAM) * Turn off line numbers because the user has interrupted * a lengthy line number calculation. */ - static void -abort_long(VOID_PARAM) +static void abort_long(void) { if (loopcount >= 0) return; @@ -265,9 +256,7 @@ abort_long(VOID_PARAM) * Find the line number associated with a given position. * Return 0 if we can't figure it out. */ - public LINENUM -find_linenum(pos) - POSITION pos; +public LINENUM find_linenum(POSITION pos) { struct linenum_info *p; LINENUM linenum; @@ -379,9 +368,7 @@ find_linenum(pos) * Find the position of a given line number. * Return NULL_POSITION if we can't figure it out. */ - public POSITION -find_pos(linenum) - LINENUM linenum; +public POSITION find_pos(LINENUM linenum) { struct linenum_info *p; POSITION cpos; @@ -452,9 +439,7 @@ find_pos(linenum) * The argument "where" tells which line is to be considered * the "current" line (e.g. TOP, BOTTOM, MIDDLE, etc). */ - public LINENUM -currline(where) - int where; +public LINENUM currline(int where) { POSITION pos; POSITION len; @@ -475,8 +460,7 @@ currline(where) /* * Scan entire file, counting line numbers. */ - public void -scan_eof(VOID_PARAM) +public void scan_eof(void) { POSITION pos = 0; LINENUM linenum = 0; @@ -499,9 +483,7 @@ scan_eof(VOID_PARAM) * Return a line number adjusted for display * (handles the --no-number-headers option). */ - public LINENUM -vlinenum(linenum) - LINENUM linenum; +public LINENUM vlinenum(LINENUM linenum) { if (nonum_headers) linenum = (linenum < header_lines) ? 0 : linenum - header_lines; diff --git a/lsystem.c b/lsystem.c index d817369e..1895740b 100644 --- a/lsystem.c +++ b/lsystem.c @@ -42,10 +42,7 @@ extern IFILE curr_ifile; * Pass the specified command to a shell to be executed. * Like plain "system()", but handles resetting terminal modes, etc. */ - public void -lsystem(cmd, donemsg) - char *cmd; - char *donemsg; +public void lsystem(char *cmd, char *donemsg) { int inp; #if HAVE_SHELL @@ -251,10 +248,7 @@ lsystem(cmd, donemsg) * If the mark is on the current screen, or if the mark is ".", * the whole current screen is piped. */ - public int -pipe_mark(c, cmd) - int c; - char *cmd; +public int pipe_mark(int c, char *cmd) { POSITION mpos, tpos, bpos; @@ -285,11 +279,7 @@ pipe_mark(c, cmd) * Create a pipe to the given shell command. * Feed it the file contents between the positions spos and epos. */ - public int -pipe_data(cmd, spos, epos) - char *cmd; - POSITION spos; - POSITION epos; +public int pipe_data(char *cmd, POSITION spos, POSITION epos) { FILE *f; int c; diff --git a/main.c b/main.c index 24cd0418..2ae43a95 100644 --- a/main.c +++ b/main.c @@ -68,10 +68,7 @@ extern int first_time; /* * Entry point. */ -int -main(argc, argv) - int argc; - char *argv[]; +int main(int argc, char *argv[]) { IFILE ifile; char *s; @@ -313,9 +310,7 @@ main(argc, argv) * Copy a string to a "safe" place * (that is, to a buffer allocated by calloc). */ - public char * -save(s) - constant char *s; +public char * save(constant char *s) { char *p; @@ -328,14 +323,11 @@ save(s) * Allocate memory. * Like calloc(), but never returns an error (NULL). */ - public VOID_POINTER -ecalloc(count, size) - int count; - unsigned int size; +public void * ecalloc(int count, unsigned int size) { - VOID_POINTER p; + void * p; - p = (VOID_POINTER) calloc(count, size); + p = (void *) calloc(count, size); if (p != NULL) return (p); error("Cannot allocate memory", NULL_PARG); @@ -347,9 +339,7 @@ ecalloc(count, size) /* * Skip leading spaces in a string. */ - public char * -skipsp(s) - char *s; +public char * skipsp(char *s) { while (*s == ' ' || *s == '\t') s++; @@ -361,11 +351,7 @@ skipsp(s) * If uppercase is true, the first string must begin with an uppercase * character; the remainder of the first string may be either case. */ - public int -sprefix(ps, s, uppercase) - char *ps; - char *s; - int uppercase; +public int sprefix(char *ps, char *s, int uppercase) { int c; int sc; @@ -394,9 +380,7 @@ sprefix(ps, s, uppercase) /* * Exit the program. */ - public void -quit(status) - int status; +public void quit(int status) { static int save_status; diff --git a/mark.c b/mark.c index 4de1d094..632209af 100644 --- a/mark.c +++ b/mark.c @@ -49,12 +49,7 @@ public int marks_modified = 0; /* * Initialize a mark struct. */ - static void -cmark(m, ifile, pos, ln) - struct mark *m; - IFILE ifile; - POSITION pos; - int ln; +static void cmark(struct mark *m, IFILE ifile, POSITION pos, int ln) { m->m_ifile = ifile; m->m_scrpos.pos = pos; @@ -68,8 +63,7 @@ cmark(m, ifile, pos, ln) /* * Initialize the mark table to show no marks are set. */ - public void -init_mark(VOID_PARAM) +public void init_mark(void) { int i; @@ -89,10 +83,7 @@ init_mark(VOID_PARAM) /* * Set m_ifile and clear m_filename. */ - static void -mark_set_ifile(m, ifile) - struct mark *m; - IFILE ifile; +static void mark_set_ifile(struct mark *m, IFILE ifile) { m->m_ifile = ifile; /* With m_ifile set, m_filename is no longer needed. */ @@ -103,9 +94,7 @@ mark_set_ifile(m, ifile) /* * Populate the m_ifile member of a mark struct from m_filename. */ - static void -mark_get_ifile(m) - struct mark *m; +static void mark_get_ifile(struct mark *m) { if (m->m_ifile != NULL_IFILE) return; /* m_ifile is already set */ @@ -115,9 +104,7 @@ mark_get_ifile(m) /* * Return the user mark struct identified by a character. */ - static struct mark * -getumark(c) - int c; +static struct mark * getumark(int c) { PARG parg; if (c >= 'a' && c <= 'z') @@ -138,9 +125,7 @@ getumark(c) * The mark struct may either be in the mark table (user mark) * or may be constructed on the fly for certain characters like ^, $. */ - static struct mark * -getmark(c) - int c; +static struct mark * getmark(int c) { struct mark *m; static struct mark sm; @@ -200,9 +185,7 @@ getmark(c) /* * Is a mark letter invalid? */ - public int -badmark(c) - int c; +public int badmark(int c) { return (getmark(c) == NULL); } @@ -210,10 +193,7 @@ badmark(c) /* * Set a user-defined mark. */ - public void -setmark(c, where) - int c; - int where; +public void setmark(int c, int where) { struct mark *m; struct scrpos scrpos; @@ -234,9 +214,7 @@ setmark(c, where) /* * Clear a user-defined mark. */ - public void -clrmark(c) - int c; +public void clrmark(int c) { struct mark *m; @@ -255,8 +233,7 @@ clrmark(c) /* * Set lmark (the mark named by the apostrophe). */ - public void -lastmark(VOID_PARAM) +public void lastmark(void) { struct scrpos scrpos; @@ -272,9 +249,7 @@ lastmark(VOID_PARAM) /* * Go to a mark. */ - public void -gomark(c) - int c; +public void gomark(int c) { struct mark *m; struct scrpos scrpos; @@ -315,9 +290,7 @@ gomark(c) * is associated with, but this doesn't matter much, * because it's always the first non-blank line on the screen. */ - public POSITION -markpos(c) - int c; +public POSITION markpos(int c) { struct mark *m; @@ -336,9 +309,7 @@ markpos(c) /* * Return the mark associated with a given position, if any. */ - public char -posmark(pos) - POSITION pos; +public char posmark(POSITION pos) { int i; @@ -358,9 +329,7 @@ posmark(pos) /* * Clear the marks associated with a specified ifile. */ - public void -unmark(ifile) - IFILE ifile; +public void unmark(IFILE ifile) { int i; @@ -373,9 +342,7 @@ unmark(ifile) * Check if any marks refer to a specified ifile vi m_filename * rather than m_ifile. */ - public void -mark_check_ifile(ifile) - IFILE ifile; +public void mark_check_ifile(IFILE ifile) { int i; char *filename = get_real_filename(ifile); @@ -399,10 +366,7 @@ mark_check_ifile(ifile) /* * Save marks to history file. */ - public void -save_marks(fout, hdr) - FILE *fout; - char *hdr; +public void save_marks(FILE *fout, char *hdr) { int i; @@ -430,9 +394,7 @@ save_marks(fout, hdr) /* * Restore one mark from the history file. */ - public void -restore_mark(line) - char *line; +public void restore_mark(char *line) { struct mark *m; int ln; diff --git a/mkfuncs.pl b/mkfuncs.pl index e3149159..f5683b7a 100755 --- a/mkfuncs.pl +++ b/mkfuncs.pl @@ -1,27 +1,40 @@ #! /usr/bin/env perl use strict; +use Getopt::Std; my $state = 0; my $def; my $params; +my %opt; +die "usage: mkfuncs.pl [-p]\n" if not getopts('p', \%opt); +my $passthru = $opt{p}; while (<>) { - if (/^\tpublic\s+(.*)/) { - $def = "public $1"; + my $match = $passthru ? /^\t(public|static)\s+([^;]+)$/ : /^\t(public)\s+([^;]+)$/; + if ($match) { + $def = "$1 $2"; $state = 1; $params = 0; } elsif ($state == 1 and /(\w+)\s*\(/) { - $def .= " $1 LESSPARAMS (("; + $def .= " $1"; + $def .= " LESSPARAMS (" if not $passthru; + $def .= "("; $state = 2; } elsif ($state == 2) { if (/^{/) { - $def .= 'VOID_PARAM' if not $params; - print "$def));\n"; + if (not $params) { + $def .= ($passthru ? 'void' : 'void'); + } + print $def; + print ")" if not $passthru; + print ")\n{\n"; $state = 0; } elsif (/^\s*([^;]*)/) { $def .= ', ' if substr($def,-1) ne '('; $def .= $1; $params = 1; } + } else { + print if $passthru; } } diff --git a/optfunc.c b/optfunc.c index 5c2f9470..9d6a05b6 100644 --- a/optfunc.c +++ b/optfunc.c @@ -95,10 +95,7 @@ extern int sgr_mode; /* * Handler for -o option. */ - public void -opt_o(type, s) - int type; - char *s; +public void opt_o(int type, char *s) { PARG parg; char *filename; @@ -148,10 +145,7 @@ opt_o(type, s) /* * Handler for -O option. */ - public void -opt__O(type, s) - int type; - char *s; +public void opt__O(int type, char *s) { force_logfile = TRUE; opt_o(type, s); @@ -161,10 +155,7 @@ opt__O(type, s) /* * Handlers for -j option. */ - public void -opt_j(type, s) - int type; - char *s; +public void opt_j(int type, char *s) { PARG parg; int len; @@ -214,8 +205,7 @@ opt_j(type, s) } } - public void -calc_jump_sline(VOID_PARAM) +public void calc_jump_sline(void) { if (jump_sline_fraction < 0) return; @@ -225,10 +215,7 @@ calc_jump_sline(VOID_PARAM) /* * Handlers for -# option. */ - public void -opt_shift(type, s) - int type; - char *s; +public void opt_shift(int type, char *s) { PARG parg; int len; @@ -278,8 +265,7 @@ opt_shift(type, s) } } - public void -calc_shift_count(VOID_PARAM) +public void calc_shift_count(void) { if (shift_count_fraction < 0) return; @@ -287,10 +273,7 @@ calc_shift_count(VOID_PARAM) } #if USERFILE - public void -opt_k(type, s) - int type; - char *s; +public void opt_k(int type, char *s) { PARG parg; @@ -307,10 +290,7 @@ opt_k(type, s) } #if HAVE_LESSKEYSRC - public void -opt_ks(type, s) - int type; - char *s; +public void opt_ks(int type, char *s) { PARG parg; @@ -332,10 +312,7 @@ opt_ks(type, s) /* * Handler for -t option. */ - public void -opt_t(type, s) - int type; - char *s; +public void opt_t(int type, char *s) { IFILE save_ifile; POSITION pos; @@ -373,10 +350,7 @@ opt_t(type, s) /* * Handler for -T option. */ - public void -opt__T(type, s) - int type; - char *s; +public void opt__T(int type, char *s) { PARG parg; char *filename; @@ -405,10 +379,7 @@ opt__T(type, s) /* * Handler for -p option. */ - public void -opt_p(type, s) - int type; - char *s; +public void opt_p(int type, char *s) { switch (type) { @@ -441,10 +412,7 @@ opt_p(type, s) /* * Handler for -P option. */ - public void -opt__P(type, s) - int type; - char *s; +public void opt__P(int type, char *s) { char **proto; PARG parg; @@ -480,10 +448,7 @@ opt__P(type, s) * Handler for the -b option. */ /*ARGSUSED*/ - public void -opt_b(type, s) - int type; - char *s; +public void opt_b(int type, char *s) { switch (type) { @@ -503,10 +468,7 @@ opt_b(type, s) * Handler for the -i option. */ /*ARGSUSED*/ - public void -opt_i(type, s) - int type; - char *s; +public void opt_i(int type, char *s) { switch (type) { @@ -523,10 +485,7 @@ opt_i(type, s) * Handler for the -V option. */ /*ARGSUSED*/ - public void -opt__V(type, s) - int type; - char *s; +public void opt__V(int type, char *s) { switch (type) { @@ -568,11 +527,7 @@ opt__V(type, s) /* * Parse an MSDOS color descriptor. */ - static void -colordesc(s, fg_color, bg_color) - char *s; - int *fg_color; - int *bg_color; +static void colordesc(char *s, int *fg_color, int *bg_color) { int fg, bg; #if MSDOS_COMPILER==WIN32C @@ -610,9 +565,7 @@ colordesc(s, fg_color, bg_color) } #endif - static int -color_from_namechar(namechar) - char namechar; +static int color_from_namechar(char namechar) { switch (namechar) { @@ -639,10 +592,7 @@ color_from_namechar(namechar) * Handler for the -D option. */ /*ARGSUSED*/ - public void -opt_D(type, s) - int type; - char *s; +public void opt_D(int type, char *s) { PARG p; int attr; @@ -718,10 +668,7 @@ opt_D(type, s) /* * Handler for the -x option. */ - public void -opt_x(type, s) - int type; - char *s; +public void opt_x(int type, char *s) { extern int tabstops[]; extern int ntabstops; @@ -776,10 +723,7 @@ opt_x(type, s) /* * Handler for the -" option. */ - public void -opt_quote(type, s) - int type; - char *s; +public void opt_quote(int type, char *s) { char buf[3]; PARG parg; @@ -818,10 +762,7 @@ opt_quote(type, s) * Handler for the --rscroll option. */ /*ARGSUSED*/ - public void -opt_rscroll(type, s) - int type; - char *s; +public void opt_rscroll(int type, char *s) { PARG p; @@ -853,10 +794,7 @@ opt_rscroll(type, s) * If from the command line, exit immediately. */ /*ARGSUSED*/ - public void -opt_query(type, s) - int type; - char *s; +public void opt_query(int type, char *s) { switch (type) { @@ -873,10 +811,7 @@ opt_query(type, s) * Handler for the --mouse option. */ /*ARGSUSED*/ - public void -opt_mousecap(type, s) - int type; - char *s; +public void opt_mousecap(int type, char *s) { switch (type) { @@ -896,10 +831,7 @@ opt_mousecap(type, s) * Handler for the --wheel-lines option. */ /*ARGSUSED*/ - public void -opt_wheel_lines(type, s) - int type; - char *s; +public void opt_wheel_lines(int type, char *s) { switch (type) { @@ -917,10 +849,7 @@ opt_wheel_lines(type, s) * Handler for the --line-number-width option. */ /*ARGSUSED*/ - public void -opt_linenum_width(type, s) - int type; - char *s; +public void opt_linenum_width(int type, char *s) { PARG parg; @@ -944,10 +873,7 @@ opt_linenum_width(type, s) * Handler for the --status-column-width option. */ /*ARGSUSED*/ - public void -opt_status_col_width(type, s) - int type; - char *s; +public void opt_status_col_width(int type, char *s) { PARG parg; @@ -971,10 +897,7 @@ opt_status_col_width(type, s) * Handler for the --file-size option. */ /*ARGSUSED*/ - public void -opt_filesize(type, s) - int type; - char *s; +public void opt_filesize(int type, char *s) { switch (type) { @@ -992,10 +915,7 @@ opt_filesize(type, s) * Handler for the --header option. */ /*ARGSUSED*/ - public void -opt_header(type, s) - int type; - char *s; +public void opt_header(int type, char *s) { int err; int n; @@ -1042,10 +962,7 @@ opt_header(type, s) * Handler for the --search-options option. */ /*ARGSUSED*/ - public void -opt_search_type(type, s) - int type; - char *s; +public void opt_search_type(int type, char *s) { int st; PARG parg; @@ -1099,10 +1016,7 @@ opt_search_type(type, s) * Handler for the --tty option. */ /*ARGSUSED*/ - public void -opt_ttyin_name(type, s) - int type; - char *s; +public void opt_ttyin_name(int type, char *s) { switch (type) { @@ -1114,8 +1028,7 @@ opt_ttyin_name(type, s) } #endif /*LESSTEST*/ - public int -chop_line(VOID_PARAM) +public int chop_line(void) { return (chopline || header_cols > 0 || header_lines > 0); } @@ -1123,8 +1036,7 @@ chop_line(VOID_PARAM) /* * Get the "screen window" size. */ - public int -get_swindow(VOID_PARAM) +public int get_swindow(void) { if (swindow > 0) return (swindow); diff --git a/option.c b/option.c index c4a496ed..3f42fdf2 100644 --- a/option.c +++ b/option.c @@ -23,8 +23,8 @@ static struct loption *pendopt; public int plusoption = FALSE; -static char *optstring LESSPARAMS((char *s, char **p_str, char *printopt, char *validchars)); -static int flip_triple LESSPARAMS((int val, int lc)); +static char *optstring(char *s, char **p_str, char *printopt, char *validchars); +static int flip_triple(int val, int lc); extern int screen_trashed; extern int less_is_more; @@ -35,9 +35,7 @@ extern int opt_use_backslash; /* * Return a printable description of an option. */ - static char * -opt_desc(o) - struct loption *o; +static char * opt_desc(struct loption *o) { static char buf[OPTNAME_MAX + 10]; if (o->oletter == OLETTER_NONE) @@ -51,9 +49,7 @@ opt_desc(o) * Return a string suitable for printing as the "name" of an option. * For example, if the option letter is 'x', just return "-x". */ - public char * -propt(c) - int c; +public char * propt(int c) { static char buf[MAX_PRCHAR_LEN+2]; @@ -65,9 +61,7 @@ propt(c) * Scan an argument (either from the command line or from the * LESS environment variable) and process it. */ - public void -scan_option(s) - char *s; +public void scan_option(char *s) { struct loption *o; int optc; @@ -301,12 +295,7 @@ scan_option(s) * OPT_UNSET set to the default value * OPT_SET set to the inverse of the default value */ - public void -toggle_option(o, lower, s, how_toggle) - struct loption *o; - int lower; - char *s; - int how_toggle; +public void toggle_option(struct loption *o, int lower, char *s, int how_toggle) { int num; int no_prompt; @@ -487,10 +476,7 @@ toggle_option(o, lower, s, how_toggle) /* * "Toggle" a triple-valued option. */ - static int -flip_triple(val, lc) - int val; - int lc; +static int flip_triple(int val, int lc) { if (lc) return ((val == OPT_ON) ? OPT_OFF : OPT_ON); @@ -501,9 +487,7 @@ flip_triple(val, lc) /* * Determine if an option takes a parameter. */ - public int -opt_has_param(o) - struct loption *o; +public int opt_has_param(struct loption *o) { if (o == NULL) return (0); @@ -516,9 +500,7 @@ opt_has_param(o) * Return the prompt to be used for a given option letter. * Only string and number valued options have prompts. */ - public char * -opt_prompt(o) - struct loption *o; +public char * opt_prompt(struct loption *o) { if (o == NULL || (o->otype & (STRING|NUMBER)) == 0) return ("?"); @@ -529,9 +511,7 @@ opt_prompt(o) * If the specified option can be toggled, return NULL. * Otherwise return an appropriate error message. */ - public char * -opt_toggle_disallowed(c) - int c; +public char * opt_toggle_disallowed(int c) { switch (c) { @@ -550,8 +530,7 @@ opt_toggle_disallowed(c) * In that case, the current option is taken to be the string for * the previous option. */ - public int -isoptpending(VOID_PARAM) +public int isoptpending(void) { return (pendopt != NULL); } @@ -559,9 +538,7 @@ isoptpending(VOID_PARAM) /* * Print error message about missing string. */ - static void -nostring(printopt) - char *printopt; +static void nostring(char *printopt) { PARG parg; parg.p_string = printopt; @@ -571,8 +548,7 @@ nostring(printopt) /* * Print error message if a STRING type option is not followed by a string. */ - public void -nopendopt(VOID_PARAM) +public void nopendopt(void) { nostring(opt_desc(pendopt)); } @@ -582,12 +558,7 @@ nopendopt(VOID_PARAM) * In the latter case, replace the char with a null char. * Return a pointer to the remainder of the string, if any. */ - static char * -optstring(s, p_str, printopt, validchars) - char *s; - char **p_str; - char *printopt; - char *validchars; +static char * optstring(char *s, char **p_str, char *printopt, char *validchars) { char *p; char *out; @@ -622,10 +593,7 @@ optstring(s, p_str, printopt, validchars) /* */ - static int -num_error(printopt, errp) - char *printopt; - int *errp; +static int num_error(char *printopt, int *errp) { PARG parg; @@ -647,11 +615,7 @@ num_error(printopt, errp) * Like atoi(), but takes a pointer to a char *, and updates * the char * to point after the translated number. */ - public int -getnum(sp, printopt, errp) - char **sp; - char *printopt; - int *errp; +public int getnum(char **sp, char *printopt, int *errp) { char *s; int n; @@ -684,11 +648,7 @@ getnum(sp, printopt, errp) * The value of the fraction is returned as parts per NUM_FRAC_DENOM. * That is, if "n" is returned, the fraction intended is n/NUM_FRAC_DENOM. */ - public long -getfraction(sp, printopt, errp) - char **sp; - char *printopt; - int *errp; +public long getfraction(char **sp, char *printopt, int *errp) { char *s; long frac = 0; @@ -719,8 +679,7 @@ getfraction(sp, printopt, errp) /* * Get the value of the -e flag. */ - public int -get_quit_at_eof(VOID_PARAM) +public int get_quit_at_eof(void) { if (!less_is_more) return quit_at_eof; diff --git a/option.h b/option.h index 2ed23832..291c9c58 100644 --- a/option.h +++ b/option.h @@ -60,7 +60,7 @@ struct loption int otype; /* Type of the option */ int odefault; /* Default value */ int *ovar; /* Pointer to the associated variable */ - void (*ofunc) LESSPARAMS ((int, char*)); /* Pointer to special handling function */ + void (*ofunc)(int, char*); /* Pointer to special handling function */ char *odesc[3]; /* Description of each value */ }; diff --git a/opttbl.c b/opttbl.c index 55e65395..8cacc33d 100644 --- a/opttbl.c +++ b/opttbl.c @@ -659,8 +659,7 @@ static struct loption option[] = /* * Initialize each option to its default value. */ - public void -init_option(VOID_PARAM) +public void init_option(void) { struct loption *o; char *p; @@ -684,9 +683,7 @@ init_option(VOID_PARAM) /* * Find an option in the option table, given its option letter. */ - public struct loption * -findopt(c) - int c; +public struct loption * findopt(int c) { struct loption *o; @@ -703,9 +700,7 @@ findopt(c) /* * */ - static int -is_optchar(c) - char c; +static int is_optchar(char c) { if (ASCII_IS_UPPER(c)) return 1; @@ -722,11 +717,7 @@ is_optchar(c) * is updated to point after the matched name. * p_oname if non-NULL is set to point to the full option name. */ - public struct loption * -findopt_name(p_optname, p_oname, p_err) - char **p_optname; - char **p_oname; - int *p_err; +public struct loption * findopt_name(char **p_optname, char **p_oname, int *p_err) { char *optname = *p_optname; struct loption *o; diff --git a/os.c b/os.c index 6fd0c586..cff8ab1d 100644 --- a/os.c +++ b/os.c @@ -83,8 +83,7 @@ extern char *ttyin_name; #endif /*LESSTEST*/ #if USE_POLL - public void -init_poll(VOID_PARAM) +public void init_poll(void) { #if defined(__APPLE__) /* In old versions of MacOS, poll() does not work with /dev/tty. */ @@ -100,10 +99,7 @@ init_poll(VOID_PARAM) * Return READ_INTR to abort F command (forw_loop). * Return 0 if safe to read from fd. */ - static int -check_poll(fd, tty) - int fd; - int tty; +static int check_poll(int fd, int tty) { struct pollfd poller[2] = { { fd, POLLIN, 0 }, { tty, POLLIN, 0 } }; int timeout = (waiting_for_data && follow_mode != FOLLOW_NAME) ? -1 : 10; @@ -132,8 +128,7 @@ check_poll(fd, tty) } #endif /* USE_POLL */ - public int -supports_ctrl_x(VOID_PARAM) +public int supports_ctrl_x(void) { #if USE_POLL return (use_poll); @@ -147,11 +142,7 @@ supports_ctrl_x(VOID_PARAM) * A call to intread() from a signal handler will interrupt * any pending iread(). */ - public int -iread(fd, buf, len) - int fd; - unsigned char *buf; - unsigned int len; +public int iread(int fd, unsigned char *buf, unsigned int len) { int n; @@ -286,8 +277,7 @@ iread(fd, buf, len) /* * Interrupt a pending iread(). */ - public void -intread(VOID_PARAM) +public void intread(void) { LONG_JUMP(read_label, 1); } @@ -296,8 +286,7 @@ intread(VOID_PARAM) * Return the current time. */ #if HAVE_TIME - public time_type -get_time(VOID_PARAM) +public time_type get_time(void) { time_type t; @@ -311,9 +300,7 @@ get_time(VOID_PARAM) /* * Local version of strerror, if not available from the system. */ - static char * -strerror(err) - int err; +static char * strerror(int err) { static char buf[INT_STRLEN_BOUND(int)+12]; #if HAVE_SYS_ERRLIST @@ -331,9 +318,7 @@ strerror(err) /* * errno_message: Return an error message based on the value of "errno". */ - public char * -errno_message(filename) - char *filename; +public char * errno_message(char *filename) { char *p; char *m; @@ -354,9 +339,7 @@ errno_message(filename) /* #define HAVE_FLOAT 0 */ - static POSITION -muldiv(val, num, den) - POSITION val, num, den; +static POSITION muldiv(POSITION val, POSITION num, POSITION den) { #if HAVE_FLOAT double v = (((double) val) * num) / den; @@ -378,10 +361,7 @@ muldiv(val, num, den) * Return the ratio of two POSITIONS, as a percentage. * {{ Assumes a POSITION is a long int. }} */ - public int -percentage(num, den) - POSITION num; - POSITION den; +public int percentage(POSITION num, POSITION den) { return (int) muldiv(num, (POSITION) 100, den); } @@ -389,11 +369,7 @@ percentage(num, den) /* * Return the specified percentage of a POSITION. */ - public POSITION -percent_pos(pos, percent, fraction) - POSITION pos; - int percent; - long fraction; +public POSITION percent_pos(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); @@ -407,10 +383,7 @@ percent_pos(pos, percent, fraction) /* * strchr is used by regexp.c. */ - char * -strchr(s, c) - char *s; - int c; +char * strchr(char *s, char c) { for ( ; *s != '\0'; s++) if (*s == c) @@ -422,11 +395,7 @@ strchr(s, c) #endif #if !HAVE_MEMCPY - VOID_POINTER -memcpy(dst, src, len) - VOID_POINTER dst; - VOID_POINTER src; - int len; +void * memcpy(void *dst, void *src, int len) { char *dstp = (char *) dst; char *srcp = (char *) src; @@ -443,19 +412,14 @@ memcpy(dst, src, len) /* * This implements an ANSI-style intercept setup for Microware C 3.2 */ - public int -os9_signal(type, handler) - int type; - RETSIGTYPE (*handler)(); +public int os9_signal(int type, RETSIGTYPE (*handler)()) { intercept(handler); } #include - int -isatty(f) - int f; +int isatty(int f) { struct sgbuf sgbuf; @@ -466,9 +430,7 @@ isatty(f) #endif - public void -sleep_ms(ms) - int ms; +public void sleep_ms(int ms) { #if MSDOS_COMPILER==WIN32C Sleep(ms); diff --git a/output.c b/output.c index 57091ba1..d5f6eca8 100644 --- a/output.c +++ b/output.c @@ -48,8 +48,7 @@ extern int vt_enabled; /* * Display the line which is in the line buffer. */ - public void -put_line(VOID_PARAM) +public void put_line(void) { int c; int i; @@ -84,8 +83,7 @@ static char *ob = obuf; static int outfd = 2; /* stderr */ #if MSDOS_COMPILER==WIN32C || MSDOS_COMPILER==BORLANDC || MSDOS_COMPILER==DJGPPC - static void -win_flush(VOID_PARAM) +static void win_flush(void) { if (ctldisp != OPT_ONPLUS || (vt_enabled && sgr_mode)) WIN32textout(obuf, ob - obuf); @@ -361,8 +359,7 @@ win_flush(VOID_PARAM) * sure these messages can be seen before they are * overwritten or scrolled away. */ - public void -flush(VOID_PARAM) +public void flush(void) { int n; @@ -397,9 +394,7 @@ flush(VOID_PARAM) /* * Set the output file descriptor (1=stdout or 2=stderr). */ - public void -set_output(fd) - int fd; +public void set_output(int fd) { flush(); outfd = fd; @@ -408,9 +403,7 @@ set_output(fd) /* * Output a character. */ - public int -putchr(c) - int c; +public int putchr(int c) { #if 0 /* fake UTF-8 output for testing */ extern int utf_mode; @@ -455,8 +448,7 @@ putchr(c) return (c); } - public void -clear_bot_if_needed(VOID_PARAM) +public void clear_bot_if_needed(void) { if (!need_clr) return; @@ -467,9 +459,7 @@ clear_bot_if_needed(VOID_PARAM) /* * Output a string. */ - public void -putstr(s) - constant char *s; +public void putstr(constant char *s) { while (*s != '\0') putchr(*s++); @@ -480,9 +470,7 @@ putstr(s) * Convert an integral type to a string. */ #define TYPE_TO_A_FUNC(funcname, type) \ -void funcname(num, buf) \ - type num; \ - char *buf; \ +void funcname(type num, char *buf) \ { \ int neg = (num < 0); \ char tbuf[INT_STRLEN_BOUND(num)+2]; \ @@ -504,10 +492,7 @@ TYPE_TO_A_FUNC(inttoa, int) * Convert an string to an integral type. */ #define STR_TO_TYPE_FUNC(funcname, type) \ -type funcname(buf, ebuf, radix) \ - char *buf; \ - char **ebuf; \ - int radix; \ +type funcname(char *buf, char **ebuf, int radix) \ { \ type val = 0; \ for (;; buf++) { \ @@ -527,9 +512,7 @@ STR_TO_TYPE_FUNC(lstrtoul, unsigned long) /* * Output an integer in a given radix. */ - static int -iprint_int(num) - int num; +static int iprint_int(int num) { char buf[INT_STRLEN_BOUND(num)]; @@ -541,9 +524,7 @@ iprint_int(num) /* * Output a line number in a given radix. */ - static int -iprint_linenum(num) - LINENUM num; +static int iprint_linenum(LINENUM num) { char buf[INT_STRLEN_BOUND(num)]; @@ -559,10 +540,7 @@ iprint_linenum(num) * {{ This paranoia about the portability of printf dates from experiences * with systems in the 1980s and is of course no longer necessary. }} */ - public int -less_printf(fmt, parg) - char *fmt; - PARG *parg; +public int less_printf(char *fmt, PARG *parg) { char *s; int col; @@ -619,8 +597,7 @@ less_printf(fmt, parg) * If some other non-trivial char is pressed, unget it, so it will * become the next command. */ - public void -get_return(VOID_PARAM) +public void get_return(void) { int c; @@ -638,10 +615,7 @@ get_return(VOID_PARAM) * Output a message in the lower left corner of the screen * and wait for carriage return. */ - public void -error(fmt, parg) - char *fmt; - PARG *parg; +public void error(char *fmt, PARG *parg) { int col = 0; static char return_to_continue[] = " (press RETURN)"; @@ -687,11 +661,7 @@ error(fmt, parg) * Usually used to warn that we are beginning a potentially * time-consuming operation. */ - static void -ierror_suffix(fmt, suffix, parg) - char *fmt; - char *suffix; - PARG *parg; +static void ierror_suffix(char *fmt, char *suffix, PARG *parg) { at_exit(); clear_bot(); @@ -703,19 +673,13 @@ ierror_suffix(fmt, suffix, parg) need_clr = 1; } - public void -ierror(fmt, parg) - char *fmt; - PARG *parg; +public void ierror(char *fmt, PARG *parg) { static char suffix[] = "... (interrupt to abort)"; ierror_suffix(fmt, suffix, parg); } - public void -ixerror(fmt, parg) - char *fmt; - PARG *parg; +public void ixerror(char *fmt, PARG *parg) { if (!supports_ctrl_x()) ierror(fmt, parg); @@ -730,10 +694,7 @@ ixerror(fmt, parg) * Output a message in the lower left corner of the screen * and return a single-character response. */ - public int -query(fmt, parg) - char *fmt; - PARG *parg; +public int query(char *fmt, PARG *parg) { int c; int col = 0; diff --git a/pattern.c b/pattern.c index d6d9ac2b..5285021f 100644 --- a/pattern.c +++ b/pattern.c @@ -20,12 +20,7 @@ extern int utf_mode; /* * Compile a search pattern, for future use by match_pattern. */ - static int -compile_pattern2(pattern, search_type, comp_pattern, show_error) - char *pattern; - int search_type; - PATTERN_TYPE *comp_pattern; - int show_error; +static int compile_pattern2(char *pattern, int search_type, PATTERN_TYPE *comp_pattern, int show_error) { if (search_type & SRCH_NO_REGEX) return (0); @@ -147,12 +142,7 @@ compile_pattern2(pattern, search_type, comp_pattern, show_error) /* * Like compile_pattern2, but convert the pattern to lowercase if necessary. */ - public int -compile_pattern(pattern, search_type, show_error, comp_pattern) - char *pattern; - int search_type; - int show_error; - PATTERN_TYPE *comp_pattern; +public int compile_pattern(char *pattern, int search_type, int show_error, PATTERN_TYPE *comp_pattern) { char *cvt_pattern; int result; @@ -173,9 +163,7 @@ compile_pattern(pattern, search_type, show_error, comp_pattern) /* * Forget that we have a compiled pattern. */ - public void -uncompile_pattern(pattern) - PATTERN_TYPE *pattern; +public void uncompile_pattern(PATTERN_TYPE *pattern) { #if HAVE_GNU_REGEX if (*pattern != NULL) @@ -222,9 +210,7 @@ uncompile_pattern(pattern) /* * Can a pattern be successfully compiled? */ - public int -valid_pattern(pattern) - char *pattern; +public int valid_pattern(char *pattern) { PATTERN_TYPE comp_pattern; int result; @@ -241,9 +227,7 @@ valid_pattern(pattern) /* * Is a compiled pattern null? */ - public int -is_null_pattern(pattern) - PATTERN_TYPE pattern; +public int is_null_pattern(PATTERN_TYPE pattern) { #if HAVE_GNU_REGEX return (pattern == NULL); @@ -275,13 +259,7 @@ is_null_pattern(pattern) * Simple pattern matching function. * It supports no metacharacters like *, etc. */ - static int -match(pattern, pattern_len, buf, buf_len, pfound, pend) - char *pattern; - int pattern_len; - char *buf; - int buf_len; - char **pfound, **pend; +static int match(char *pattern, int pattern_len, char *buf, int buf_len, char **pfound, char **pend) { char *pp, *lp; char *pattern_end = pattern + pattern_len; @@ -316,16 +294,7 @@ match(pattern, pattern_len, buf, buf_len, pfound, pend) * Perform a pattern match with the previously compiled pattern. * Set sp and ep to the start and end of the matched string. */ - public int -match_pattern(pattern, tpattern, line, line_len, sp, ep, notbol, search_type) - PATTERN_TYPE pattern; - char *tpattern; - char *line; - int line_len; - char **sp; - char **ep; - int notbol; - int search_type; +public int match_pattern(PATTERN_TYPE pattern, char *tpattern, char *line, int line_len, char **sp, char **ep, int notbol, int search_type) { int matched; @@ -434,8 +403,7 @@ match_pattern(pattern, tpattern, line, line_len, sp, ep, notbol, search_type) /* * Return the name of the pattern matching library. */ - public char * -pattern_lib_name(VOID_PARAM) +public char * pattern_lib_name(void) { #if HAVE_GNU_REGEX return ("GNU"); diff --git a/pattern.h b/pattern.h index a690b8e9..1c0ca87e 100644 --- a/pattern.h +++ b/pattern.h @@ -46,16 +46,16 @@ /* ---- RE_COMP ---- */ #if HAVE_RE_COMP -char *re_comp LESSPARAMS ((char*)); -int re_exec LESSPARAMS ((char*)); +char *re_comp(char*); +int re_exec(char*); #define PATTERN_TYPE int #define SET_NULL_PATTERN(name) name = 0 #endif /* ---- REGCMP ---- */ #if HAVE_REGCMP -char *regcmp LESSPARAMS ((char*)); -char *regex LESSPARAMS ((char**, char*)); +char *regcmp(char*); +char *regex(char**, char*); extern char *__loc1; #define PATTERN_TYPE char ** #define SET_NULL_PATTERN(name) name = NULL diff --git a/position.c b/position.c index eabaf7e6..92cb0235 100644 --- a/position.c +++ b/position.c @@ -36,9 +36,7 @@ extern int header_lines; * the bottom line on the screen * the line after the bottom line on the screen */ - public POSITION -position(sindex) - int sindex; +public POSITION position(int sindex) { switch (sindex) { @@ -58,9 +56,7 @@ position(sindex) /* * Add a new file position to the bottom of the position table. */ - public void -add_forw_pos(pos) - POSITION pos; +public void add_forw_pos(POSITION pos) { int i; @@ -75,9 +71,7 @@ add_forw_pos(pos) /* * Add a new file position to the top of the position table. */ - public void -add_back_pos(pos) - POSITION pos; +public void add_back_pos(POSITION pos) { int i; @@ -92,8 +86,7 @@ add_back_pos(pos) /* * Initialize the position table, done whenever we clear the screen. */ - public void -pos_clear(VOID_PARAM) +public void pos_clear(void) { int i; @@ -104,8 +97,7 @@ pos_clear(VOID_PARAM) /* * Allocate or reallocate the position table. */ - public void -pos_init(VOID_PARAM) +public void pos_init(void) { struct scrpos scrpos; @@ -133,9 +125,7 @@ pos_init(VOID_PARAM) * Check the position table to see if the position falls within its range. * Return the position table entry if found, -1 if not. */ - public int -onscreen(pos) - POSITION pos; +public int onscreen(POSITION pos) { int i; @@ -150,16 +140,12 @@ onscreen(pos) /* * See if the entire screen is empty. */ - public int -empty_screen(VOID_PARAM) +public int empty_screen(void) { return (empty_lines(0, sc_height-1)); } - public int -empty_lines(s, e) - int s; - int e; +public int empty_lines(int s, int e) { int i; @@ -177,10 +163,7 @@ empty_lines(s, e) * such that the top few lines are empty, we may have to set * the screen line to a number > 0. */ - public void -get_scrpos(scrpos, where) - struct scrpos *scrpos; - int where; +public void get_scrpos(struct scrpos *scrpos, int where) { int i; int dir; @@ -233,9 +216,7 @@ get_scrpos(scrpos, where) * or it may be in { -1 .. -(sc_height-1) } to refer to lines * relative to the bottom of the screen. */ - public int -sindex_from_sline(sline) - int sline; +public int sindex_from_sline(int sline) { /* * Negative screen line number means diff --git a/prompt.c b/prompt.c index 5319c402..0ef7ed2b 100644 --- a/prompt.c +++ b/prompt.c @@ -66,8 +66,7 @@ static char *mp; /* * Initialize the prompt prototype strings. */ - public void -init_prompt(VOID_PARAM) +public void init_prompt(void) { prproto[0] = save(s_proto); prproto[1] = save(less_is_more ? more_proto : m_proto); @@ -80,9 +79,7 @@ init_prompt(VOID_PARAM) /* * Append a string to the end of the message. */ - static void -ap_str(s) - char *s; +static void ap_str(char *s) { int len; @@ -97,9 +94,7 @@ ap_str(s) /* * Append a character to the end of the message. */ - static void -ap_char(c) - char c; +static void ap_char(char c) { char buf[2]; @@ -111,9 +106,7 @@ ap_char(c) /* * Append a POSITION (as a decimal integer) to the end of the message. */ - static void -ap_pos(pos) - POSITION pos; +static void ap_pos(POSITION pos) { char buf[INT_STRLEN_BOUND(pos) + 2]; @@ -124,9 +117,7 @@ ap_pos(pos) /* * Append a line number to the end of the message. */ - static void -ap_linenum(linenum) - LINENUM linenum; +static void ap_linenum(LINENUM linenum) { char buf[INT_STRLEN_BOUND(linenum) + 2]; @@ -137,9 +128,7 @@ ap_linenum(linenum) /* * Append an integer to the end of the message. */ - static void -ap_int(num) - int num; +static void ap_int(int num) { char buf[INT_STRLEN_BOUND(num) + 2]; @@ -150,8 +139,7 @@ ap_int(num) /* * Append a question mark to the end of the message. */ - static void -ap_quest(VOID_PARAM) +static void ap_quest(void) { ap_str("?"); } @@ -159,9 +147,7 @@ ap_quest(VOID_PARAM) /* * Return the "current" byte offset in the file. */ - static POSITION -curr_byte(where) - int where; +static POSITION curr_byte(int where) { POSITION pos; @@ -179,10 +165,7 @@ curr_byte(where) * question mark followed by a single letter. * Here we decode that letter and return the appropriate boolean value. */ - static int -cond(c, where) - char c; - int where; +static int cond(char c, int where) { POSITION len; @@ -246,11 +229,7 @@ cond(c, where) * Here we decode that letter and take the appropriate action, * usually by appending something to the message being built. */ - static void -protochar(c, where, iseditproto) - int c; - int where; - int iseditproto; +static void protochar(int c, int where, int iseditproto) { POSITION pos; POSITION len; @@ -402,9 +381,7 @@ protochar(c, where, iseditproto) * where to resume parsing the string. * We must keep track of nested IFs and skip them properly. */ - static constant char * -skipcond(p) - constant char *p; +static constant char * skipcond(constant char *p) { int iflevel; @@ -460,10 +437,7 @@ skipcond(p) /* * Decode a char that represents a position on the screen. */ - static constant char * -wherechar(p, wp) - char constant *p; - int *wp; +static constant char * wherechar(char constant *p, int *wp) { switch (*p) { @@ -484,9 +458,7 @@ wherechar(p, wp) /* * Construct a message based on a prototype string. */ - public char * -pr_expand(proto) - constant char *proto; +public char * pr_expand(constant char *proto) { constant char *p; int c; @@ -551,8 +523,7 @@ pr_expand(proto) /* * Return a message suitable for printing by the "=" command. */ - public char * -eq_message(VOID_PARAM) +public char * eq_message(void) { return (pr_expand(eqproto)); } @@ -563,8 +534,7 @@ eq_message(VOID_PARAM) * If we can't come up with an appropriate prompt, return NULL * and the caller will prompt with a colon. */ - public char * -pr_string(VOID_PARAM) +public char * pr_string(void) { char *prompt; int type; @@ -579,8 +549,7 @@ pr_string(VOID_PARAM) /* * Return a message suitable for printing while waiting in the F command. */ - public char * -wait_message(VOID_PARAM) +public char * wait_message(void) { return (pr_expand(wproto)); } diff --git a/screen.c b/screen.c index ea4708fe..fe8e5a45 100644 --- a/screen.c +++ b/screen.c @@ -248,9 +248,9 @@ extern char *ttyin_name; #endif /*LESSTEST*/ #if !MSDOS_COMPILER -static char *cheaper LESSPARAMS((char *t1, char *t2, char *def)); -static void tmodes LESSPARAMS((char *incap, char *outcap, char **instr, - char **outstr, char *def_instr, char *def_outstr, char **spp)); +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); #endif /* @@ -302,13 +302,13 @@ extern char *tgoto(); /* * Set termio flags for use by less. */ - static void -set_termio_flags(s) +static void set_termio_flags( #if HAVE_TERMIOS_H && HAVE_TERMIOS_FUNCS - struct termios *s; + struct termios *s #else - struct termio *s; + struct termio *s #endif + ) { s->c_lflag &= ~(0 #ifdef ICANON @@ -376,9 +376,7 @@ set_termio_flags(s) * etc. are NOT disabled. * It doesn't matter whether an input \n is mapped to \r, or vice versa. */ - public void -raw_mode(on) - int on; +public void raw_mode(int on) { static int curr_on = 0; @@ -703,9 +701,7 @@ raw_mode(on) */ static int hardcopy; - static char * -ltget_env(capname) - char *capname; +static char * ltget_env(char *capname) { char name[64]; @@ -729,9 +725,7 @@ ltget_env(capname) return (lgetenv(name)); } - static int -ltgetflag(capname) - char *capname; +static int ltgetflag(char *capname) { char *s; @@ -742,9 +736,7 @@ ltgetflag(capname) return (tgetflag(capname)); } - static int -ltgetnum(capname) - char *capname; +static int ltgetnum(char *capname) { char *s; @@ -755,10 +747,7 @@ ltgetnum(capname) return (tgetnum(capname)); } - static char * -ltgetstr(capname, pp) - char *capname; - char **pp; +static char * ltgetstr(char *capname, char **pp) { char *s; @@ -773,8 +762,7 @@ ltgetstr(capname, pp) /* * Get size of the output screen. */ - public void -scrsize(VOID_PARAM) +public void scrsize(void) { char *s; int sys_height; @@ -908,8 +896,7 @@ scrsize(VOID_PARAM) /* * Figure out how many empty loops it takes to delay a millisecond. */ - static void -get_clock(VOID_PARAM) +static void get_clock(void) { clock_t start; @@ -936,9 +923,7 @@ get_clock(VOID_PARAM) /* * Delay for a specified number of milliseconds. */ - static void -delay(msec) - int msec; +static void delay(int msec) { long i; @@ -953,9 +938,7 @@ delay(msec) /* * Return the characters actually input by a "special" key. */ - public char * -special_key_str(key) - int key; +public char * special_key_str(int key) { static char tbuf[40]; char *s; @@ -1135,8 +1118,7 @@ special_key_str(key) /* * Get terminal capabilities via termcap. */ - public void -get_term(VOID_PARAM) +public void get_term(void) { termcap_debug = !isnullenv(lgetenv("LESS_TERMCAP_DEBUG")); #if MSDOS_COMPILER @@ -1447,17 +1429,13 @@ get_term(VOID_PARAM) static int costcount; /*ARGSUSED*/ - static int -inc_costcount(c) - int c; +static int inc_costcount(int c) { costcount++; return (c); } - static int -cost(t) - char *t; +static int cost(char *t) { costcount = 0; tputs(t, sc_height, inc_costcount); @@ -1469,10 +1447,7 @@ cost(t) * The best, if both exist, is the one with the lower * cost (see cost() function). */ - static char * -cheaper(t1, t2, def) - char *t1, *t2; - char *def; +static char * cheaper(char *t1, char *t2, char *def) { if (*t1 == '\0' && *t2 == '\0') { @@ -1488,15 +1463,7 @@ cheaper(t1, t2, def) return (t2); } - static void -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; +static void tmodes(char *incap, char *outcap, char **instr, char **outstr, char *def_instr, char *def_outstr, char **spp) { *instr = ltgetstr(incap, spp); if (*instr == NULL) @@ -1528,8 +1495,7 @@ tmodes(incap, outcap, instr, outstr, def_instr, def_outstr, spp) #if MSDOS_COMPILER #if MSDOS_COMPILER==WIN32C - static void -_settextposition(int row, int col) +static void _settextposition(int row, int col) { COORD cpos; CONSOLE_SCREEN_BUFFER_INFO csbi; @@ -1544,8 +1510,7 @@ _settextposition(int row, int col) /* * Initialize the screen to the correct color at startup. */ - static void -initcolor(VOID_PARAM) +static void initcolor(void) { #if MSDOS_COMPILER==BORLANDC || MSDOS_COMPILER==DJGPPC intensevideo(); @@ -1580,8 +1545,7 @@ initcolor(VOID_PARAM) /* * Enable virtual terminal processing, if available. */ - static void -win32_init_vt_term(VOID_PARAM) +static void win32_init_vt_term(void) { DWORD output_mode; @@ -1598,8 +1562,7 @@ win32_init_vt_term(VOID_PARAM) } } - static void -win32_deinit_vt_term(VOID_PARAM) +static void win32_deinit_vt_term(void) { if (vt_enabled == 1 && con_out == con_out_save) SetConsoleMode(con_out, init_output_mode); @@ -1608,8 +1571,7 @@ win32_deinit_vt_term(VOID_PARAM) /* * Termcap-like init with a private win32 console. */ - static void -win32_init_term(VOID_PARAM) +static void win32_init_term(void) { CONSOLE_SCREEN_BUFFER_INFO scr; COORD size; @@ -1643,8 +1605,7 @@ win32_init_term(VOID_PARAM) /* * Restore the startup console. */ - static void -win32_deinit_term(VOID_PARAM) +static void win32_deinit_term(void) { if (con_out_save == INVALID_HANDLE_VALUE) return; @@ -1657,11 +1618,7 @@ win32_deinit_term(VOID_PARAM) #endif #if !MSDOS_COMPILER - static void -do_tputs(str, affcnt, f_putc) - char *str; - int affcnt; - int (*f_putc)(int); +static void do_tputs(char *str, int affcnt, int (*f_putc)(int)) { #if LESSTEST if (ttyin_name != NULL && f_putc == putchr) @@ -1675,11 +1632,7 @@ do_tputs(str, affcnt, f_putc) * Like tputs but we handle $<...> delay strings here because * some implementations of tputs don't perform delays correctly. */ - static void -ltputs(str, affcnt, f_putc) - char *str; - int affcnt; - int (*f_putc)(int); +static void ltputs(char *str, int affcnt, int (*f_putc)(int)) { while (str != NULL && *str != '\0') { @@ -1722,8 +1675,7 @@ ltputs(str, affcnt, f_putc) * Configure the termimal so mouse clicks and wheel moves * produce input to less. */ - public void -init_mouse(VOID_PARAM) +public void init_mouse(void) { #if !MSDOS_COMPILER ltputs(sc_s_mousecap, sc_height, putchr); @@ -1740,8 +1692,7 @@ init_mouse(VOID_PARAM) * Configure the terminal so mouse clicks and wheel moves * are handled by the system (so text can be selected, etc). */ - public void -deinit_mouse(VOID_PARAM) +public void deinit_mouse(void) { #if !MSDOS_COMPILER ltputs(sc_e_mousecap, sc_height, putchr); @@ -1756,8 +1707,7 @@ deinit_mouse(VOID_PARAM) /* * Initialize terminal */ - public void -init(VOID_PARAM) +public void init(void) { clear_bot_if_needed(); #if !MSDOS_COMPILER @@ -1820,8 +1770,7 @@ init(VOID_PARAM) /* * Deinitialize terminal */ - public void -deinit(VOID_PARAM) +public void deinit(void) { if (!init_done) return; @@ -1858,14 +1807,12 @@ deinit(VOID_PARAM) /* * Are we interactive (ie. writing to an initialized tty)? */ - public int -interactive(VOID_PARAM) +public int interactive(void) { return (is_tty && init_done); } - static void -assert_interactive(VOID_PARAM) +static void assert_interactive(void) { if (interactive()) return; /* abort(); */ @@ -1874,8 +1821,7 @@ assert_interactive(VOID_PARAM) /* * Home cursor (move to upper left corner of screen). */ - public void -home(VOID_PARAM) +public void home(void) { assert_interactive(); #if !MSDOS_COMPILER @@ -1887,8 +1833,7 @@ home(VOID_PARAM) } #if LESSTEST - public void -dump_screen(VOID_PARAM) +public void dump_screen(void) { char dump_cmd[32]; SNPRINTF1(dump_cmd, sizeof(dump_cmd), ESCS"0;0;%dR", sc_width * sc_height); @@ -1901,8 +1846,7 @@ dump_screen(VOID_PARAM) * Add a blank line (called with cursor at home). * Should scroll the display down. */ - public void -add_line(VOID_PARAM) +public void add_line(void) { assert_interactive(); #if !MSDOS_COMPILER @@ -1960,9 +1904,7 @@ add_line(VOID_PARAM) * window upward. This is needed to stop leaking the topmost line * into the scrollback buffer when we go down-one-line (in WIN32). */ - public void -remove_top(n) - int n; +public void remove_top(int n) { #if MSDOS_COMPILER==WIN32C SMALL_RECT rcSrc, rcClip; @@ -2014,8 +1956,7 @@ remove_top(n) /* * Clear the screen. */ - static void -win32_clear(VOID_PARAM) +static void win32_clear(void) { /* * This will clear only the currently visible rows of the NT @@ -2045,9 +1986,7 @@ win32_clear(VOID_PARAM) * Remove the n topmost lines and scroll everything below it in the * window upward. */ - public void -win32_scroll_up(n) - int n; +public void win32_scroll_up(int n) { SMALL_RECT rcSrc, rcClip; CHAR_INFO fillchar; @@ -2111,8 +2050,7 @@ win32_scroll_up(n) /* * Move cursor to lower left corner of screen. */ - public void -lower_left(VOID_PARAM) +public void lower_left(void) { assert_interactive(); #if !MSDOS_COMPILER @@ -2126,8 +2064,7 @@ lower_left(VOID_PARAM) /* * Move cursor to left position of current line. */ - public void -line_left(VOID_PARAM) +public void line_left(void) { assert_interactive(); #if !MSDOS_COMPILER @@ -2161,8 +2098,7 @@ line_left(VOID_PARAM) * Check if the console size has changed and reset internals * (in lieu of SIGWINCH for WIN32). */ - public void -check_winch(VOID_PARAM) +public void check_winch(void) { #if MSDOS_COMPILER==WIN32C CONSOLE_SCREEN_BUFFER_INFO scr; @@ -2191,9 +2127,7 @@ check_winch(VOID_PARAM) /* * Goto a specific line on the screen. */ - public void -goto_line(sindex) - int sindex; +public void goto_line(int sindex) { assert_interactive(); #if !MSDOS_COMPILER @@ -2211,8 +2145,7 @@ goto_line(sindex) * briefly and then switching back to the normal screen. * {{ Yuck! There must be a better way to get a visual bell. }} */ - static void -create_flash(VOID_PARAM) +static void create_flash(void) { #if MSDOS_COMPILER==MSOFTC struct videoconfig w; @@ -2258,8 +2191,7 @@ create_flash(VOID_PARAM) /* * Output the "visual bell", if there is one. */ - public void -vbell(VOID_PARAM) +public void vbell(void) { if (no_vbell) return; @@ -2324,8 +2256,7 @@ vbell(VOID_PARAM) /* * Make a noise. */ - static void -beep(VOID_PARAM) +static void beep(void) { #if !MSDOS_COMPILER putchr(CONTROL('G')); @@ -2341,8 +2272,7 @@ beep(VOID_PARAM) /* * Ring the terminal bell. */ - public void -bell(VOID_PARAM) +public void bell(void) { if (quiet == VERY_QUIET) vbell(); @@ -2353,8 +2283,7 @@ bell(VOID_PARAM) /* * Clear the screen. */ - public void -clear(VOID_PARAM) +public void clear(void) { assert_interactive(); #if !MSDOS_COMPILER @@ -2373,8 +2302,7 @@ clear(VOID_PARAM) * Clear from the cursor to the end of the cursor's line. * {{ This must not move the cursor. }} */ - public void -clear_eol(VOID_PARAM) +public void clear_eol(void) { /* assert_interactive();*/ #if !MSDOS_COMPILER @@ -2433,8 +2361,7 @@ clear_eol(VOID_PARAM) * Clear the current line. * Clear the screen if there's off-screen memory below the display. */ - static void -clear_eol_bot(VOID_PARAM) +static void clear_eol_bot(void) { assert_interactive(); #if MSDOS_COMPILER @@ -2451,8 +2378,7 @@ clear_eol_bot(VOID_PARAM) * Clear the bottom line of the display. * Leave the cursor at the beginning of the bottom line. */ - public void -clear_bot(VOID_PARAM) +public void clear_bot(void) { /* * If we're in a non-normal attribute mode, temporarily exit @@ -2485,9 +2411,7 @@ clear_bot(VOID_PARAM) /* * Parse a 4-bit color char. */ - static int -parse_color4(ch) - char ch; +static int parse_color4(char ch) { switch (ch) { @@ -2515,9 +2439,7 @@ parse_color4(ch) /* * Parse a color as a decimal integer. */ - static int -parse_color6(ps) - char **ps; +static int parse_color6(char **ps) { if (**ps == '-') { @@ -2539,11 +2461,7 @@ parse_color6(ps) * CV_4BIT: fg/bg values are OR of CV_{RGB} bits. * CV_6BIT: fg/bg values are integers entered by user. */ - public COLOR_TYPE -parse_color(str, p_fg, p_bg) - char *str; - int *p_fg; - int *p_bg; +public COLOR_TYPE parse_color(char *str, int *p_fg, int *p_bg) { int fg; int bg; @@ -2572,9 +2490,7 @@ parse_color(str, p_fg, p_bg) #if !MSDOS_COMPILER - static int -sgr_color(color) - int color; +static int sgr_color(int color) { switch (color) { @@ -2600,11 +2516,7 @@ sgr_color(color) } } - static void -tput_fmt(fmt, color, f_putc) - char *fmt; - int color; - int (*f_putc)(int); +static void tput_fmt(char *fmt, int color, int (*f_putc)(int)) { char buf[INT_STRLEN_BOUND(int)+16]; if (color == attrcolor) @@ -2614,10 +2526,7 @@ tput_fmt(fmt, color, f_putc) attrcolor = color; } - static void -tput_color(str, f_putc) - char *str; - int (*f_putc)(int); +static void tput_color(char *str, int (*f_putc)(int)) { int fg; int bg; @@ -2647,12 +2556,7 @@ tput_color(str, f_putc) } } - static void -tput_inmode(mode_str, attr, attr_bit, f_putc) - char *mode_str; - int attr; - int attr_bit; - int (*f_putc)(int); +static void tput_inmode(char *mode_str, int attr, int attr_bit, int (*f_putc)(int)) { char *color_str; if ((attr & attr_bit) == 0) @@ -2668,11 +2572,7 @@ tput_inmode(mode_str, attr, attr_bit, f_putc) tput_color(color_str, f_putc); } - static void -tput_outmode(mode_str, attr_bit, f_putc) - char *mode_str; - int attr_bit; - int (*f_putc)(int); +static void tput_outmode(char *mode_str, int attr_bit, int (*f_putc)(int)) { if ((attrmode & attr_bit) == 0) return; @@ -2682,10 +2582,7 @@ tput_outmode(mode_str, attr_bit, f_putc) #else /* MSDOS_COMPILER */ #if MSDOS_COMPILER==WIN32C - static int -WIN32put_fmt(fmt, color) - char *fmt; - int color; +static int WIN32put_fmt(char *fmt, int color) { char buf[INT_STRLEN_BOUND(int)+16]; int len = SNPRINTF1(buf, sizeof(buf), fmt, color); @@ -2694,9 +2591,7 @@ WIN32put_fmt(fmt, color) } #endif - static int -win_set_color(attr) - int attr; +static int win_set_color(int attr) { int fg; int bg; @@ -2740,9 +2635,7 @@ win_set_color(attr) #endif /* MSDOS_COMPILER */ - public void -at_enter(attr) - int attr; +public void at_enter(int attr) { attr = apply_at_specials(attr); #if !MSDOS_COMPILER @@ -2778,8 +2671,7 @@ at_enter(attr) attrmode = attr; } - public void -at_exit(VOID_PARAM) +public void at_exit(void) { #if !MSDOS_COMPILER /* Undo things in the reverse order we did them. */ @@ -2795,9 +2687,7 @@ at_exit(VOID_PARAM) attrmode = AT_NORMAL; } - public void -at_switch(attr) - int attr; +public void at_switch(int attr) { int new_attrmode = apply_at_specials(attr); int ignore_modes = AT_ANSI; @@ -2809,10 +2699,7 @@ at_switch(attr) } } - public int -is_at_equiv(attr1, attr2) - int attr1; - int attr2; +public int is_at_equiv(int attr1, int attr2) { attr1 = apply_at_specials(attr1); attr2 = apply_at_specials(attr2); @@ -2820,9 +2707,7 @@ is_at_equiv(attr1, attr2) return (attr1 == attr2); } - public int -apply_at_specials(attr) - int attr; +public int apply_at_specials(int attr) { if (attr & AT_BINARY) attr |= binattr; @@ -2836,8 +2721,7 @@ apply_at_specials(attr) /* * Output a plain backspace, without erasing the previous char. */ - public void -putbs(VOID_PARAM) +public void putbs(void) { if (termcap_debug) putstr(""); @@ -2880,8 +2764,7 @@ putbs(VOID_PARAM) /* * Determine whether an input character is waiting to be read. */ - public int -win32_kbhit(VOID_PARAM) +public int win32_kbhit(void) { INPUT_RECORD ip; DWORD read; @@ -2991,8 +2874,7 @@ win32_kbhit(VOID_PARAM) /* * Read a character from the keyboard. */ - public char -WIN32getch(VOID_PARAM) +public char WIN32getch(void) { char ascii; static unsigned char utf8[UTF8_MAX_LENGTH]; @@ -3048,20 +2930,14 @@ WIN32getch(VOID_PARAM) #if MSDOS_COMPILER /* */ - public void -WIN32setcolors(fg, bg) - int fg; - int bg; +public void WIN32setcolors(int fg, int bg) { SETCOLORS(fg, bg); } /* */ - public void -WIN32textout(text, len) - char *text; - int len; +public void WIN32textout(char *text, int len) { #if MSDOS_COMPILER==WIN32C DWORD written; diff --git a/search.c b/search.c index fb4c2b30..bdf10bfc 100644 --- a/search.c +++ b/search.c @@ -127,9 +127,7 @@ public int is_caseless; /* * Are there any uppercase letters in this string? */ - static int -is_ucase(str) - char *str; +static int is_ucase(char *str) { char *str_end = str + strlen(str); LWCHAR ch; @@ -146,9 +144,7 @@ is_ucase(str) /* * Discard a saved pattern. */ - static void -clear_pattern(info) - struct pattern_info *info; +static void clear_pattern(struct pattern_info *info) { if (info->text != NULL) free(info->text); @@ -161,12 +157,7 @@ clear_pattern(info) /* * Compile and save a search pattern. */ - static int -set_pattern(info, pattern, search_type, show_error) - struct pattern_info *info; - char *pattern; - int search_type; - int show_error; +static int set_pattern(struct pattern_info *info, char *pattern, int search_type, int show_error) { /* * Ignore case if -I is set OR @@ -196,9 +187,7 @@ set_pattern(info, pattern, search_type, show_error) /* * Initialize saved pattern to nothing. */ - static void -init_pattern(info) - struct pattern_info *info; +static void init_pattern(struct pattern_info *info) { SET_NULL_PATTERN(info->compiled); info->text = NULL; @@ -209,8 +198,7 @@ init_pattern(info) /* * Initialize search variables. */ - public void -init_search(VOID_PARAM) +public void init_search(void) { init_pattern(&search_info); } @@ -218,9 +206,7 @@ init_search(VOID_PARAM) /* * Determine which text conversions to perform before pattern matching. */ - static int -get_cvt_ops(search_type) - int search_type; +static int get_cvt_ops(int search_type) { int ops = 0; @@ -238,9 +224,7 @@ get_cvt_ops(search_type) /* * Is there a previous (remembered) search pattern? */ - static int -prev_pattern(info) - struct pattern_info *info; +static int prev_pattern(struct pattern_info *info) { #if !NO_REGEX if ((info->search_type & SRCH_NO_REGEX) == 0) @@ -255,9 +239,7 @@ prev_pattern(info) * Repaint each line which contains highlighted text. * If on==0, force all hilites off. */ - public void -repaint_hilite(on) - int on; +public void repaint_hilite(int on) { int sindex; POSITION pos; @@ -299,8 +281,7 @@ repaint_hilite(on) /* * Clear the attn hilite. */ - public void -clear_attn(VOID_PARAM) +public void clear_attn(void) { #if HILITE_SEARCH int sindex; @@ -349,9 +330,7 @@ clear_attn(VOID_PARAM) /* * Toggle or clear search string highlighting. */ - public void -undo_search(clear) - int clear; +public void undo_search(int clear) { clear_pattern(&search_info); #if HILITE_SEARCH @@ -375,9 +354,7 @@ undo_search(clear) /* * Clear the hilite list. */ - public void -clr_hlist(anchor) - struct hilite_tree *anchor; +public void clr_hlist(struct hilite_tree *anchor) { struct hilite_storage *hls; struct hilite_storage *nexthls; @@ -397,52 +374,23 @@ clr_hlist(anchor) prep_startpos = prep_endpos = NULL_POSITION; } - public void -clr_hilite(VOID_PARAM) +public void clr_hilite(void) { clr_hlist(&hilite_anchor); } - public void -clr_filter(VOID_PARAM) +public void clr_filter(void) { clr_hlist(&filter_anchor); } - struct hilite_node* -hlist_last(anchor) - struct hilite_tree *anchor; -{ - struct hilite_node *n = anchor->root; - while (n != NULL && n->right != NULL) - n = n->right; - return n; -} - - struct hilite_node* -hlist_next(n) - struct hilite_node *n; -{ - return n->next; -} - - struct hilite_node* -hlist_prev(n) - struct hilite_node *n; -{ - return n->prev; -} - /* * Find the node covering pos, or the node after it if no node covers it, * or return NULL if pos is after the last range. Remember the found node, * to speed up subsequent searches for the same or similar positions (if * we return NULL, remember the last node.) */ - struct hilite_node* -hlist_find(anchor, pos) - struct hilite_tree *anchor; - POSITION pos; +static struct hilite_node* hlist_find(struct hilite_tree *anchor, POSITION pos) { struct hilite_node *n, *m; @@ -532,10 +480,7 @@ hlist_find(anchor, pos) /* * Should any characters in a specified range be highlighted? */ - static int -is_hilited_range(pos, epos) - POSITION pos; - POSITION epos; +static int is_hilited_range(POSITION pos, POSITION epos) { struct hilite_node *n = hlist_find(&hilite_anchor, pos); return (n != NULL && (epos == NULL_POSITION || epos > n->r.hl_startpos)); @@ -544,9 +489,7 @@ is_hilited_range(pos, epos) /* * Is a line "filtered" -- that is, should it be hidden? */ - public int -is_filtered(pos) - POSITION pos; +public int is_filtered(POSITION pos) { struct hilite_node *n; @@ -561,9 +504,7 @@ is_filtered(pos) * If pos is hidden, return the next position which isn't, otherwise * just return pos. */ - public POSITION -next_unfiltered(pos) - POSITION pos; +public POSITION next_unfiltered(POSITION pos) { struct hilite_node *n; @@ -583,9 +524,7 @@ next_unfiltered(pos) * If pos is hidden, return the previous position which isn't or 0 if * we're filtered right to the beginning, otherwise just return pos. */ - public POSITION -prev_unfiltered(pos) - POSITION pos; +public POSITION prev_unfiltered(POSITION pos) { struct hilite_node *n; @@ -609,12 +548,7 @@ prev_unfiltered(pos) * Should any characters in a specified range be highlighted? * If nohide is nonzero, don't consider hide_hilite. */ - public int -is_hilited_attr(pos, epos, nohide, p_matches) - POSITION pos; - POSITION epos; - int nohide; - int *p_matches; +public int is_hilited_attr(POSITION pos, POSITION epos, int nohide, int *p_matches) { int match; @@ -666,9 +600,7 @@ is_hilited_attr(pos, epos, nohide, p_matches) * Tree node storage: get the current block of nodes if it has spare * capacity, or create a new one if not. */ - static struct hilite_storage* -hlist_getstorage(anchor) - struct hilite_tree *anchor; +static struct hilite_storage * hlist_getstorage(struct hilite_tree *anchor) { int capacity = 1; struct hilite_storage *s; @@ -697,9 +629,7 @@ hlist_getstorage(anchor) * Tree node storage: retrieve a new empty node to be inserted into the * tree. */ - static struct hilite_node* -hlist_getnode(anchor) - struct hilite_tree *anchor; +static struct hilite_node * hlist_getnode(struct hilite_tree *anchor) { struct hilite_storage *s = hlist_getstorage(anchor); return &s->nodes[s->used++]; @@ -708,10 +638,7 @@ hlist_getnode(anchor) /* * Rotate the tree left around a pivot node. */ - static void -hlist_rotate_left(anchor, n) - struct hilite_tree *anchor; - struct hilite_node *n; +static void hlist_rotate_left(struct hilite_tree *anchor, struct hilite_node *n) { struct hilite_node *np = n->parent; struct hilite_node *nr = n->right; @@ -739,10 +666,7 @@ hlist_rotate_left(anchor, n) /* * Rotate the tree right around a pivot node. */ - static void -hlist_rotate_right(anchor, n) - struct hilite_tree *anchor; - struct hilite_node *n; +static void hlist_rotate_right(struct hilite_tree *anchor, struct hilite_node *n) { struct hilite_node *np = n->parent; struct hilite_node *nl = n->left; @@ -771,10 +695,7 @@ hlist_rotate_right(anchor, n) /* * Add a new hilite to a hilite list. */ - static void -add_hilite(anchor, hl) - struct hilite_tree *anchor; - struct hilite *hl; +static void add_hilite(struct hilite_tree *anchor, struct hilite *hl) { struct hilite_node *p, *n, *u; @@ -950,12 +871,7 @@ add_hilite(anchor, hl) /* * Highlight every character in a range of displayed characters. */ - static void -create_hilites(linepos, start_index, end_index, chpos) - POSITION linepos; - int start_index; - int end_index; - int *chpos; +static void create_hilites(POSITION linepos, int start_index, int end_index, int *chpos) { struct hilite hl; int i; @@ -991,15 +907,7 @@ create_hilites(linepos, start_index, end_index, chpos) * the current pattern. * sp,ep delimit the first match already found. */ - static void -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; +static void hilite_line(POSITION linepos, char *line, int line_len, int *chpos, char *sp, char *ep, int cvt_ops) { char *searchp; char *line_end = line + line_len; @@ -1039,8 +947,7 @@ hilite_line(linepos, line, line_len, chpos, sp, ep, cvt_ops) /* * Find matching text which is currently on screen and highlight it. */ - static void -hilite_screen(VOID_PARAM) +static void hilite_screen(void) { struct scrpos scrpos; @@ -1054,8 +961,7 @@ hilite_screen(VOID_PARAM) /* * Change highlighting parameters. */ - public void -chg_hilite(VOID_PARAM) +public void chg_hilite(void) { /* * Erase any highlights currently on screen. @@ -1074,9 +980,7 @@ chg_hilite(VOID_PARAM) /* * Figure out where to start a search. */ - static POSITION -search_pos(search_type) - int search_type; +static POSITION search_pos(int search_type) { POSITION pos; int sindex; @@ -1169,15 +1073,7 @@ search_pos(search_type) * If so, add an entry to the filter list. */ #if HILITE_SEARCH - static int -matches_filters(pos, cline, line_len, chpos, linepos, sp, ep) - POSITION pos; - char *cline; - int line_len; - int *chpos; - POSITION linepos; - char **sp; - char **ep; +static int matches_filters(POSITION pos, char *cline, int line_len, int *chpos, POSITION linepos, char **sp, char **ep) { struct pattern_info *filter; @@ -1204,11 +1100,7 @@ matches_filters(pos, cline, line_len, chpos, linepos, sp, ep) * Get the position of the first char in the screen line which * puts tpos on screen. */ - static POSITION -get_lastlinepos(pos, tpos, sheight) - POSITION pos; - POSITION tpos; - int sheight; +static POSITION get_lastlinepos(POSITION pos, POSITION tpos, int sheight) { int nlines; @@ -1229,10 +1121,7 @@ get_lastlinepos(pos, tpos, sheight) * Get the segment index of tpos in the line starting at pos. * A segment is a string of printable chars that fills the screen width. */ - static int -get_seg(pos, tpos) - POSITION pos; - POSITION tpos; +static int get_seg(POSITION pos, POSITION tpos) { int seg; @@ -1248,16 +1137,7 @@ get_seg(pos, tpos) /* * Search a subset of the file, specified by start/end position. */ - static int -search_range(pos, endpos, search_type, matches, maxlines, plinepos, pendpos, plastlinepos) - POSITION pos; - POSITION endpos; - int search_type; - int matches; - int maxlines; - POSITION *plinepos; - POSITION *pendpos; - POSITION *plastlinepos; +static int search_range(POSITION pos, POSITION endpos, int search_type, int matches, int maxlines, POSITION *plinepos, POSITION *pendpos, POSITION *plastlinepos) { char *line; char *cline; @@ -1516,9 +1396,7 @@ search_range(pos, endpos, search_type, matches, maxlines, plinepos, pendpos, pla /* * search for a pattern in history. If found, compile that pattern. */ - static int -hist_pattern(search_type) - int search_type; +static int hist_pattern(int search_type) { #if CMD_HISTORY char *pattern; @@ -1546,8 +1424,7 @@ hist_pattern(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(VOID_PARAM) +public void chg_caseless(void) { if (!search_info.is_ucase_pattern) { @@ -1580,11 +1457,7 @@ chg_caseless(VOID_PARAM) * Caller may continue the search in another file * if less than n matches are found in this file. */ - public int -search(search_type, pattern, n) - int search_type; - char *pattern; - int n; +public int search(int search_type, char *pattern, int n) { POSITION pos; POSITION opos; @@ -1729,11 +1602,7 @@ search(search_type, pattern, n) * If prep_endpos == NULL_POSITION, the prep region extends to EOF. * prep_hilite asks that the range (spos,epos) be covered by the prep region. */ - public void -prep_hilite(spos, epos, maxlines) - POSITION spos; - POSITION epos; - int maxlines; +public void prep_hilite(POSITION spos, POSITION epos, int maxlines) { POSITION nprep_startpos = prep_startpos; POSITION nprep_endpos = prep_endpos; @@ -1899,10 +1768,7 @@ prep_hilite(spos, epos, maxlines) /* * Set the pattern to be used for line filtering. */ - public void -set_filter_pattern(pattern, search_type) - char *pattern; - int search_type; +public void set_filter_pattern(char *pattern, int search_type) { struct pattern_info *filter; @@ -1937,8 +1803,7 @@ set_filter_pattern(pattern, search_type) /* * Is there a line filter in effect? */ - public int -is_filtering(VOID_PARAM) +public int is_filtering(void) { if (ch_getflags() & CH_HELPFILE) return (0); @@ -1953,9 +1818,7 @@ is_filtering(VOID_PARAM) */ public int reg_show_error = 1; - void -regerror(s) - char *s; +void regerror(char *s) { PARG parg; diff --git a/signal.c b/signal.c index 294fa6a7..f50b8401 100644 --- a/signal.c +++ b/signal.c @@ -41,9 +41,7 @@ extern long jump_sline_fraction; */ #if MSDOS_COMPILER!=WIN32C /* ARGSUSED*/ - static RETSIGTYPE -u_interrupt(type) - int type; +static RETSIGTYPE u_interrupt(int type) { bell(); #if OS2 @@ -73,9 +71,7 @@ u_interrupt(type) * "Stop" (^Z) signal handler. */ /* ARGSUSED*/ - static RETSIGTYPE -stop(type) - int type; +static RETSIGTYPE stop(int type) { LSIGNAL(SIGTSTP, stop); sigs |= S_STOP; @@ -98,9 +94,7 @@ stop(type) * "Window" change handler */ /* ARGSUSED*/ - public RETSIGTYPE -winch(type) - int type; +public RETSIGTYPE winch(int type) { LSIGNAL(SIG_LESSWINDOW, winch); sigs |= S_WINCH; @@ -116,9 +110,7 @@ winch(type) #define WIN32_LEAN_AND_MEAN #include - static BOOL WINAPI -wbreak_handler(dwCtrlType) - DWORD dwCtrlType; +static BOOL WINAPI wbreak_handler(DWORD dwCtrlType) { switch (dwCtrlType) { @@ -136,9 +128,7 @@ wbreak_handler(dwCtrlType) } #endif - static RETSIGTYPE -terminate(type) - int type; +static RETSIGTYPE terminate(int type) { quit(15); } @@ -146,9 +136,7 @@ terminate(type) /* * Set up the signal handlers. */ - public void -init_signals(on) - int on; +public void init_signals(int on) { if (on) { @@ -207,8 +195,7 @@ init_signals(on) * Process any signals we have received. * A received signal cause a bit to be set in "sigs". */ - public void -psignals(VOID_PARAM) +public void psignals(void) { int tsignals; diff --git a/tags.c b/tags.c index 03e29736..0d5bccd8 100644 --- a/tags.c +++ b/tags.c @@ -44,13 +44,13 @@ enum { T_GPATH /* 'GPATH': path name (global) */ }; -static enum tag_result findctag LESSPARAMS((char *tag)); -static enum tag_result findgtag LESSPARAMS((char *tag, int type)); -static char *nextgtag(VOID_PARAM); -static char *prevgtag(VOID_PARAM); -static POSITION ctagsearch(VOID_PARAM); -static POSITION gtagsearch(VOID_PARAM); -static int getentry LESSPARAMS((char *buf, char **tag, char **file, char **line)); +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); /* * The list of tags generated by the last findgtag() call. @@ -88,8 +88,7 @@ static struct tag *curtag; /* * Delete tag structures. */ - public void -cleantags(VOID_PARAM) +public void cleantags(void) { struct tag *tp; @@ -112,13 +111,7 @@ cleantags(VOID_PARAM) /* * Create a new tag entry. */ - static struct tag * -maketagent(name, file, linenum, pattern, endline) - char *name; - char *file; - LINENUM linenum; - char *pattern; - int endline; +static struct tag * maketagent(char *name, char *file, LINENUM linenum, char *pattern, int endline) { struct tag *tp; @@ -140,8 +133,7 @@ maketagent(name, file, linenum, pattern, endline) /* * Get tag mode. */ - public int -gettagtype(VOID_PARAM) +public int gettagtype(void) { int f; @@ -171,9 +163,7 @@ gettagtype(VOID_PARAM) * and "tagpattern" to the search pattern which should be used * to find the tag. */ - public void -findtag(tag) - char *tag; +public void findtag(char *tag) { int type = gettagtype(); enum tag_result result; @@ -202,8 +192,7 @@ findtag(tag) /* * Search for a tag. */ - public POSITION -tagsearch(VOID_PARAM) +public POSITION tagsearch(void) { if (curtag == NULL) return (NULL_POSITION); /* No gtags loaded! */ @@ -216,9 +205,7 @@ tagsearch(VOID_PARAM) /* * Go to the next tag. */ - public char * -nexttag(n) - int n; +public char * nexttag(int n) { char *tagfile = (char *) NULL; @@ -230,9 +217,7 @@ nexttag(n) /* * Go to the previous tag. */ - public char * -prevtag(n) - int n; +public char * prevtag(int n) { char *tagfile = (char *) NULL; @@ -244,8 +229,7 @@ prevtag(n) /* * Return the total number of tags. */ - public int -ntags(VOID_PARAM) +public int ntags(void) { return total; } @@ -253,8 +237,7 @@ ntags(VOID_PARAM) /* * Return the sequence number of current tag. */ - public int -curr_tag(VOID_PARAM) +public int curr_tag(void) { return curseq; } @@ -267,9 +250,7 @@ curr_tag(VOID_PARAM) * Find tags in the "tags" file. * Sets curtag to the first tag entry. */ - static enum tag_result -findctag(tag) - char *tag; +static enum tag_result findctag(char *tag) { char *p; char *q; @@ -387,18 +368,14 @@ findctag(tag) /* * Edit current tagged file. */ - public int -edit_tagfile(VOID_PARAM) +public int edit_tagfile(void) { if (curtag == NULL) return (1); return (edit(curtag->tag_file)); } - static int -curtag_match(line, linepos) - char constant *line; - POSITION linepos; +static int curtag_match(char constant *line, POSITION linepos) { /* * Test the line to see if we have a match. @@ -426,8 +403,7 @@ curtag_match(line, linepos) * regcmp vs. re_comp) behave differently in the presence of * parentheses (which are almost always found in a tag). */ - static POSITION -ctagsearch(VOID_PARAM) +static POSITION ctagsearch(void) { POSITION pos, linepos; LINENUM linenum; @@ -505,10 +481,7 @@ ctagsearch(VOID_PARAM) * for future use by gtagsearch(). * Sets curtag to the first tag entry. */ - static enum tag_result -findgtag(tag, type) - char *tag; /* tag to load */ - int type; /* tags type */ +static enum tag_result findgtag(char *tag, int type) { char buf[1024]; FILE *fp; @@ -640,8 +613,7 @@ static int circular = 0; /* 1: circular tag structure */ * by findgtag(). The next call to gtagsearch() will try to position at the * appropriate tag. */ - static char * -nextgtag(VOID_PARAM) +static char * nextgtag(void) { struct tag *tp; @@ -670,8 +642,7 @@ nextgtag(VOID_PARAM) * setup by findgtat(). The next call to gtagsearch() will try to position * at the appropriate tag. */ - static char * -prevgtag(VOID_PARAM) +static char * prevgtag(void) { struct tag *tp; @@ -700,8 +671,7 @@ prevgtag(VOID_PARAM) * using either findtag() or one of nextgtag() and prevgtag(). Returns -1 * if it was unable to position at the tag, 0 if successful. */ - static POSITION -gtagsearch(VOID_PARAM) +static POSITION gtagsearch(void) { if (curtag == NULL) return (NULL_POSITION); /* No gtags loaded! */ @@ -736,12 +706,7 @@ gtagsearch(VOID_PARAM) * The tag, file, and line will each be NUL-terminated pointers * into buf. */ - static int -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 */ +static int getentry(char *buf, char **tag, char **file, char **line) { char *p = buf; diff --git a/ttyin.c b/ttyin.c index fad56b5f..cfaa25188 100644 --- a/ttyin.c +++ b/ttyin.c @@ -36,9 +36,7 @@ extern int utf_mode; extern int wheel_lines; #if !MSDOS_COMPILER - static int -open_tty_device(dev) - constant char* dev; +static int open_tty_device(constant char* dev) { #if OS2 /* The __open() system call translates "/dev/tty" to "con". */ @@ -54,8 +52,7 @@ open_tty_device(dev) * In Unix, file descriptor 2 is usually attached to the screen, * but also usually lets you read from the keyboard. */ - public int -open_tty(VOID_PARAM) +public int open_tty(void) { int fd = -1; #if LESSTEST @@ -81,8 +78,7 @@ open_tty(VOID_PARAM) /* * Open keyboard for input. */ - public void -open_getchr(VOID_PARAM) +public void open_getchr(void) { #if MSDOS_COMPILER==WIN32C /* Need this to let child processes inherit our console handle */ @@ -122,8 +118,7 @@ open_getchr(VOID_PARAM) /* * Close the keyboard. */ - public void -close_getchr(VOID_PARAM) +public void close_getchr(void) { #if MSDOS_COMPILER==WIN32C SetConsoleMode(tty, console_mode); @@ -135,9 +130,7 @@ close_getchr(VOID_PARAM) /* * Close the pipe, restoring the keyboard (CMD resets it, losing the mouse). */ - int -pclose(f) - FILE *f; +public int pclose(FILE *f) { int result; @@ -150,8 +143,7 @@ pclose(f) /* * Get the number of lines to scroll when mouse wheel is moved. */ - public int -default_wheel_lines(VOID_PARAM) +public int default_wheel_lines(void) { int lines = 1; #if MSDOS_COMPILER==WIN32C @@ -167,8 +159,7 @@ default_wheel_lines(VOID_PARAM) /* * Get a character from the keyboard. */ - public int -getchr(VOID_PARAM) +public int getchr(void) { char c; int result; diff --git a/version.c b/version.c index 73bb0236..cb0c74d5 100644 --- a/version.c +++ b/version.c @@ -965,7 +965,7 @@ v614 11/28/22 Add ^X to wait message. v615 11/30/22 Add --no-vbell option. v616 12/9/22 Don't open tty as input file without -f. v617 12/10/22 Support poll on newer versions of MacOS. -v618 +v618 Add --no-search-headers option. */ char version[] = "618x"; diff --git a/xbuf.c b/xbuf.c index da8d1d93..ee24da16 100644 --- a/xbuf.c +++ b/xbuf.c @@ -4,26 +4,20 @@ /* * Initialize an expandable text buffer. */ - public void -xbuf_init(xbuf) - struct xbuffer *xbuf; +public void xbuf_init(struct xbuffer *xbuf) { xbuf->data = NULL; xbuf->size = xbuf->end = 0; } - public void -xbuf_deinit(xbuf) - struct xbuffer *xbuf; +public void xbuf_deinit(struct xbuffer *xbuf) { if (xbuf->data != NULL) free(xbuf->data); xbuf_init(xbuf); } - public void -xbuf_reset(xbuf) - struct xbuffer *xbuf; +public void xbuf_reset(struct xbuffer *xbuf) { xbuf->end = 0; } @@ -31,10 +25,7 @@ xbuf_reset(xbuf) /* * Add a byte to an expandable text buffer. */ - public void -xbuf_add_byte(xbuf, b) - struct xbuffer *xbuf; - unsigned int b; +public void xbuf_add_byte(struct xbuffer *xbuf, unsigned int b) { if (xbuf->end >= xbuf->size) { @@ -51,38 +42,27 @@ xbuf_add_byte(xbuf, b) xbuf->data[xbuf->end++] = (unsigned char) b; } - public void -xbuf_add_data(xbuf, data, len) - struct xbuffer *xbuf; - unsigned char *data; - int len; +public void xbuf_add_data(struct xbuffer *xbuf, unsigned char *data, int len) { int i; for (i = 0; i < len; i++) xbuf_add_byte(xbuf, data[i]); } - public int -xbuf_pop(buf) - struct xbuffer *buf; +public int xbuf_pop(struct xbuffer *buf) { if (buf->end == 0) return -1; return (int) buf->data[--(buf->end)]; } - public void -xbuf_set(dst, src) - struct xbuffer *dst; - struct xbuffer *src; +public void xbuf_set(struct xbuffer *dst, struct xbuffer *src) { xbuf_reset(dst); xbuf_add_data(dst, src->data, src->end); } - public char * -xbuf_char_data(xbuf) - struct xbuffer *xbuf; +public char * xbuf_char_data(struct xbuffer *xbuf) { return (char *)(xbuf->data); }