From ceda5a2b23694a75ff632d5de4045d6ceaab9858 Mon Sep 17 00:00:00 2001 From: Mark Nudelman Date: Wed, 5 Apr 2017 18:14:11 +0000 Subject: [PATCH] Use ANSI prototypes in funcs.h declarations. Fix const issues. Remove register declarations. --- Makefile.aut | 4 +- Makefile.dsg | 4 -- brac.c | 8 +-- ch.c | 42 ++++++++-------- charset.c | 28 +++++------ cmdbuf.c | 38 +++++++------- command.c | 22 ++++---- configure.ac | 10 ++++ cvt.c | 2 +- decode.c | 30 +++++------ defines.ds | 5 ++ defines.o2 | 5 ++ defines.o9 | 5 ++ defines.wn | 5 ++ doscreen.c | 8 +-- edit.c | 8 +-- filename.c | 18 +++---- forwback.c | 4 +- ifile.c | 16 +++--- input.c | 2 +- jump.c | 2 +- less.h | 9 ++++ lesskey.c | 28 ++++++----- line.c | 18 +++---- linenum.c | 20 ++++---- lsystem.c | 10 ++-- main.c | 14 +++--- mark.c | 8 +-- optfunc.c | 14 +++--- option.c | 18 +++---- opttbl.c | 10 ++-- os.c | 11 ++-- output.c | 20 ++++---- pattern.c | 138 ++++++++++++++++++++------------------------------- pattern.h | 18 +++---- position.c | 12 ++--- prompt.c | 8 +-- screen.c | 8 +-- search.c | 5 +- signal.c | 2 +- tags.c | 12 ++--- ttyin.c | 6 ++- 42 files changed, 332 insertions(+), 323 deletions(-) diff --git a/Makefile.aut b/Makefile.aut index 9cc04cea..24ee3f20 100644 --- a/Makefile.aut +++ b/Makefile.aut @@ -32,7 +32,7 @@ DISTFILES = \ install.sh defines.h.in mkinstalldirs \ less.nro less.man lesskey.nro lesskey.man lessecho.nro lessecho.man \ less.hlp \ - mkfuncs.awk mkhelp.c \ + mkfuncs.pl mkhelp.c \ mkutable $(UNICODE_FILES) \ ${DISTFILES_W} @@ -61,7 +61,7 @@ ${srcdir}/configure: ${srcdir}/configure.ac \ funcs.h: ${SRC:%=${srcdir}/%} -mv -f ${srcdir}/funcs.h ${srcdir}/funcs.h.old - awk -f ${srcdir}/mkfuncs.awk ${SRC:%=${srcdir}/%} >${srcdir}/funcs.h + perl ${srcdir}/mkfuncs.pl ${SRC:%=${srcdir}/%} >${srcdir}/funcs.h if cmp -s funcs.h funcs.h.old; then mv -f funcs.h.old funcs.h; fi lint: diff --git a/Makefile.dsg b/Makefile.dsg index b921b5de..4c11be0e 100644 --- a/Makefile.dsg +++ b/Makefile.dsg @@ -73,10 +73,6 @@ installcheck: TAGS: etags *.c *.h -newfuncs: - command.com /c if exist funcs.h del funcs.h - ${AWK} -f mkfuncs.awk ${OBJ:.${O}=.c} > funcs.h - clean: command.com /c for %f in (*.${O} less lesskey lessecho *.exe) do if exist %f del %f diff --git a/brac.c b/brac.c index b411d7ca..00a2db3f 100644 --- a/brac.c +++ b/brac.c @@ -18,13 +18,13 @@ */ public void match_brac(obrac, cbrac, forwdir, n) - register int obrac; - register int cbrac; + int obrac; + int cbrac; int forwdir; int n; { - register int c; - register int nest; + int c; + int nest; POSITION pos; int (*chget)(); diff --git a/ch.c b/ch.c index 45fad506..aa903590 100644 --- a/ch.c +++ b/ch.c @@ -139,11 +139,11 @@ static int ch_addbuf(); int ch_get() { - register struct buf *bp; - register struct bufnode *bn; - register int n; - register int slept; - register int h; + struct buf *bp; + struct bufnode *bn; + int n; + int slept; + int h; POSITION pos; POSITION len; @@ -412,8 +412,8 @@ end_logfile() public void sync_logfile() { - register struct buf *bp; - register struct bufnode *bn; + struct buf *bp; + struct bufnode *bn; int warned = FALSE; BLOCKNUM block; BLOCKNUM nblocks; @@ -450,9 +450,9 @@ sync_logfile() buffered(block) BLOCKNUM block; { - register struct buf *bp; - register struct bufnode *bn; - register int h; + struct buf *bp; + struct bufnode *bn; + int h; h = BUFHASH(block); FOR_BUFS_IN_CHAIN(h, bn) @@ -470,7 +470,7 @@ buffered(block) */ public int ch_seek(pos) - register POSITION pos; + POSITION pos; { BLOCKNUM new_block; POSITION len; @@ -537,8 +537,8 @@ ch_end_seek() public int ch_end_buffer_seek() { - register struct buf *bp; - register struct bufnode *bn; + struct buf *bp; + struct bufnode *bn; POSITION buf_pos; POSITION end_pos; @@ -565,8 +565,8 @@ ch_end_buffer_seek() public int ch_beg_seek() { - register struct bufnode *bn; - register struct bufnode *firstbn; + struct bufnode *bn; + struct bufnode *firstbn; /* * Try a plain ch_seek first. @@ -625,7 +625,7 @@ ch_tell() public int ch_forw_get() { - register int c; + int c; if (thisfile == NULL) return (EOI); @@ -688,7 +688,7 @@ ch_setbufspace(bufspace) public void ch_flush() { - register struct bufnode *bn; + struct bufnode *bn; if (thisfile == NULL) return; @@ -755,8 +755,8 @@ ch_flush() static int ch_addbuf() { - register struct buf *bp; - register struct bufnode *bn; + struct buf *bp; + struct bufnode *bn; /* * Allocate and initialize a new buffer and link it @@ -780,7 +780,7 @@ ch_addbuf() static void init_hashtbl() { - register int h; + int h; for (h = 0; h < BUFHASH_SIZE; h++) { @@ -795,7 +795,7 @@ init_hashtbl() static void ch_delbufs() { - register struct bufnode *bn; + struct bufnode *bn; while (ch_bufhead != END_OF_CHAIN) { diff --git a/charset.c b/charset.c index f7695ab0..af3c03d7 100644 --- a/charset.c +++ b/charset.c @@ -128,9 +128,9 @@ public int binattr = AT_STANDOUT; ichardef(s) char *s; { - register char *cp; - register int n; - register char v; + char *cp; + int n; + char v; n = 0; v = 0; @@ -183,11 +183,11 @@ ichardef(s) */ static int icharset(name, no_error) - register char *name; + char *name; int no_error; { - register struct charset *p; - register struct cs_alias *a; + struct charset *p; + struct cs_alias *a; if (name == NULL || *name == '\0') return (0); @@ -227,7 +227,7 @@ icharset(name, no_error) static void ilocale() { - register int c; + int c; for (c = 0; c < (int) sizeof(chardef); c++) { @@ -479,7 +479,7 @@ prutfchar(ch) */ public int utf_len(ch) - char ch; + unsigned char ch; { if ((ch & 0x80) == 0) return 1; @@ -502,7 +502,7 @@ utf_len(ch) */ public int is_utf8_well_formed(s, slen) - unsigned char *s; + char *s; int slen; { int i; @@ -511,7 +511,7 @@ is_utf8_well_formed(s, slen) if (IS_UTF8_INVALID(s[0])) return (0); - len = utf_len((char) s[0]); + len = utf_len(s[0]); if (len > slen) return (0); if (len == 1) @@ -539,7 +539,7 @@ is_utf8_well_formed(s, slen) */ public int utf_bin_count(data, len) - unsigned char *data; + char *data; int len; { int bin_count = 0; @@ -568,7 +568,7 @@ utf_bin_count(data, len) */ public LWCHAR get_wchar(p) - char *p; + constant char *p; { switch (utf_len(p[0])) { @@ -672,7 +672,7 @@ put_wchar(pp, ch) step_char(pp, dir, limit) char **pp; signed int dir; - char *limit; + constant char *limit; { LWCHAR ch; int len; @@ -691,7 +691,7 @@ step_char(pp, dir, limit) if (p + len > limit) { ch = 0; - p = limit; + p = (char *) limit; } else { ch = get_wchar(p); diff --git a/cmdbuf.c b/cmdbuf.c index 288932ae..a1d01d66 100644 --- a/cmdbuf.c +++ b/cmdbuf.c @@ -69,25 +69,25 @@ struct mlist */ struct mlist mlist_search = { &mlist_search, &mlist_search, &mlist_search, NULL, 0 }; -public void * constant ml_search = (void *) &mlist_search; +public void *ml_search = (void *) &mlist_search; struct mlist mlist_examine = { &mlist_examine, &mlist_examine, &mlist_examine, NULL, 0 }; -public void * constant ml_examine = (void *) &mlist_examine; +public void *ml_examine = (void *) &mlist_examine; #if SHELL_ESCAPE || PIPEC struct mlist mlist_shell = { &mlist_shell, &mlist_shell, &mlist_shell, NULL, 0 }; -public void * constant ml_shell = (void *) &mlist_shell; +public void *ml_shell = (void *) &mlist_shell; #endif #else /* CMD_HISTORY */ /* If CMD_HISTORY is off, these are just flags. */ -public void * constant ml_search = (void *)1; -public void * constant ml_examine = (void *)2; +public void *ml_search = (void *)1; +public void *ml_examine = (void *)2; #if SHELL_ESCAPE || PIPEC -public void * constant ml_shell = (void *)3; +public void *ml_shell = (void *)3; #endif #endif /* CMD_HISTORY */ @@ -134,14 +134,14 @@ clear_cmd() */ public void cmd_putstr(s) - char *s; + constant char *s; { LWCHAR prev_ch = 0; LWCHAR ch; - char *endline = s + strlen(s); + constant char *endline = s + strlen(s); while (*s != '\0') { - char *ns = s; + char *ns = (char *) s; int width; ch = step_char(&ns, +1, endline); while (s < ns) @@ -255,7 +255,7 @@ cmd_step_left(pp, pwidth, bswidth) */ static void cmd_repaint(old_cp) - char *old_cp; + constant char *old_cp; { /* * Repaint the line from the current position. @@ -316,8 +316,8 @@ cmd_home() static void cmd_lshift() { - char *s; - char *save_cp; + constant char *s; + constant char *save_cp; int cols; /* @@ -335,7 +335,7 @@ cmd_lshift() while (*s != '\0') { int width; - char *ns = s; + constant char *ns = s; cmd_step_right(&ns, &width, NULL); if (width > 0) break; @@ -354,8 +354,8 @@ cmd_lshift() static void cmd_rshift() { - char *s; - char *save_cp; + constant char *s; + constant char *save_cp; int cols; /* @@ -486,7 +486,7 @@ cmd_ichar(cs, clen) static int cmd_erase() { - register char *s; + char *s; int clen; if (cp == cmdbuf) @@ -654,7 +654,7 @@ set_mlist(mlist, cmdflags) cmd_updown(action) int action; { - char *s; + constant char *s; struct mlist *ml; if (curr_mlist == NULL) @@ -716,7 +716,7 @@ cmd_updown(action) public void cmd_addhist(mlist, cmd, modified) struct mlist *mlist; - char *cmd; + constant char *cmd; int modified; { #if CMD_HISTORY @@ -933,7 +933,7 @@ delimit_word() char *p; int delim_quoted = 0; int meta_quoted = 0; - char *esc = get_meta_escape(); + constant char *esc = get_meta_escape(); int esclen = (int) strlen(esc); #endif diff --git a/command.c b/command.c index c0f8c8d0..5f114ef9 100644 --- a/command.c +++ b/command.c @@ -35,10 +35,10 @@ extern char *curr_altfilename; extern char version[]; extern struct scrpos initial_scrpos; extern IFILE curr_ifile; -extern void constant *ml_search; -extern void constant *ml_examine; +extern void *ml_search; +extern void *ml_examine; #if SHELL_ESCAPE || PIPEC -extern void constant *ml_shell; +extern void *ml_shell; #endif #if EDITOR extern char *editor; @@ -99,7 +99,7 @@ cmd_exec() start_mca(action, prompt, mlist, cmdflags) int action; constant char *prompt; - constant void *mlist; + void *mlist; int cmdflags; { mca = action; @@ -199,7 +199,7 @@ mca_opt_toggle() static void exec_mca() { - register char *cbuf; + char *cbuf; cmd_exec(); cbuf = get_cmdbuf(); @@ -678,7 +678,7 @@ make_display() static void prompt() { - register constant char *p; + constant char *p; if (ungot != NULL && !ungot->ug_end_command) { @@ -842,7 +842,7 @@ ungetcc(c) ungetsc(s) char *s; { - register char *p; + char *p; for (p = s + strlen(s) - 1; p >= s; p--) ungetcc(*p); @@ -859,7 +859,7 @@ multi_search(pattern, n, silent) int n; int silent; { - register int nomore; + int nomore; IFILE save_ifile; int changed_file; @@ -994,9 +994,9 @@ forw_loop(until_hilite) public void commands() { - register int c; - register int action; - register char *cbuf; + int c; + int action; + char *cbuf; int newaction; int save_search_type; char *extra; diff --git a/configure.ac b/configure.ac index 42bdd6b2..383f840c 100644 --- a/configure.ac +++ b/configure.ac @@ -251,6 +251,11 @@ AC_TRY_COMPILE([#include [struct stat s; dev_t dev = s.st_dev; ino_t ino = s.st_ino;], [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_STAT_INO)], [AC_MSG_RESULT(no)]) +# Checks for ANSI function prototypes. +AC_MSG_CHECKING(for ANSI function prototypes) +AC_TRY_COMPILE([], [int f(int a) { return a; }], + [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_ANSI_PROTOS)], [AC_MSG_RESULT(no)]) + # Checks for library functions. AC_TYPE_SIGNAL AC_CHECK_FUNCS([fsync popen _setjmp sigprocmask sigsetmask snprintf stat system fchmod]) @@ -620,6 +625,11 @@ AH_TOP([ */ #define TGETENT_OK 1 +/* + * HAVE_ANSI_PROTOS is 1 if your compiler supports ANSI function prototypes. + */ +#define HAVE_ANSI_PROTOS 1 + /* * HAVE_SYS_TYPES_H is 1 if your system has . */ diff --git a/cvt.c b/cvt.c index 84641752..9ac6826e 100644 --- a/cvt.c +++ b/cvt.c @@ -58,7 +58,7 @@ cvt_text(odst, osrc, chpos, lenp, ops) char *dst; char *edst = odst; char *src; - register char *src_end; + char *src_end; LWCHAR ch; if (lenp != NULL) diff --git a/decode.c b/decode.c index be491664..e0826508 100644 --- a/decode.c +++ b/decode.c @@ -230,9 +230,9 @@ expand_special_keys(table, len) char *table; int len; { - register char *fm; - register char *to; - register int a; + char *fm; + char *to; + int a; char *repl; int klen; @@ -322,7 +322,7 @@ add_cmd_table(tlist, buf, len) char *buf; int len; { - register struct tablelist *t; + struct tablelist *t; if (len == 0) return (0); @@ -390,9 +390,9 @@ cmd_search(cmd, table, endtable, sp) char *endtable; char **sp; { - register char *p; - register char *q; - register int a; + char *p; + char *q; + int a; *sp = NULL; for (p = table, q = cmd; p < endtable; p++, q++) @@ -481,8 +481,8 @@ cmd_decode(tlist, cmd, sp) char *cmd; char **sp; { - register struct tablelist *t; - register int action = A_INVALID; + struct tablelist *t; + int action = A_INVALID; /* * Search thru all the command tables. @@ -592,8 +592,8 @@ new_lesskey(buf, len, sysvar) int sysvar; { char *p; - register int c; - register int n; + int c; + int n; /* * New-style lesskey file. @@ -644,10 +644,10 @@ lesskey(filename, sysvar) char *filename; int sysvar; { - register char *buf; - register POSITION len; - register long n; - register int f; + char *buf; + POSITION len; + long n; + int f; if (secure) return (1); diff --git a/defines.ds b/defines.ds index f224c170..77c0d458 100644 --- a/defines.ds +++ b/defines.ds @@ -138,6 +138,11 @@ */ #define PATHNAME_SEP "\\" +/* + * HAVE_ANSI_PROTOS is 1 if your compiler supports ANSI function prototypes. + */ +#define HAVE_ANSI_PROTOS 1 + /* * HAVE_SYS_TYPES_H is 1 if your system has . */ diff --git a/defines.o2 b/defines.o2 index 34feaab3..08c4f15e 100644 --- a/defines.o2 +++ b/defines.o2 @@ -119,6 +119,11 @@ */ #define PATHNAME_SEP "\\" +/* + * HAVE_ANSI_PROTOS is 1 if your compiler supports ANSI function prototypes. + */ +#define HAVE_ANSI_PROTOS 1 + /* * HAVE_SYS_TYPES_H is 1 if your system has . */ diff --git a/defines.o9 b/defines.o9 index e0d15a49..7da92563 100644 --- a/defines.o9 +++ b/defines.o9 @@ -122,6 +122,11 @@ */ #define PATHNAME_SEP "/" +/* + * HAVE_ANSI_PROTOS is 1 if your compiler supports ANSI function prototypes. + */ +#define HAVE_ANSI_PROTOS 1 + /* * HAVE_SYS_TYPES_H is 1 if your system has . */ diff --git a/defines.wn b/defines.wn index 290d6bc7..3f6d9765 100644 --- a/defines.wn +++ b/defines.wn @@ -120,6 +120,11 @@ */ #define PATHNAME_SEP "\\" +/* + * HAVE_ANSI_PROTOS is 1 if your compiler supports ANSI function prototypes. + */ +#define HAVE_ANSI_PROTOS 1 + /* * HAVE_SYS_TYPES_H is 1 if your system has . */ diff --git a/doscreen.c b/doscreen.c index c9091c33..fb1b39d1 100644 --- a/doscreen.c +++ b/doscreen.c @@ -93,9 +93,9 @@ scrsize(p_height, p_width) int *p_height; int *p_width; { - register int height; - register int width; - register char *s; + int height; + int width; + char *s; #if MSDOS_COMPILER==MSOFTC struct videoconfig w; @@ -308,7 +308,7 @@ create_flash() } #else #if MSDOS_COMPILER==BORLANDC - register int n; + int n; whitescreen = (unsigned short *) malloc(sc_width * sc_height * sizeof(short)); diff --git a/edit.c b/edit.c index b32189bc..39897116 100644 --- a/edit.c +++ b/edit.c @@ -19,7 +19,7 @@ extern int sigs; extern IFILE curr_ifile; extern IFILE old_ifile; extern struct scrpos initial_scrpos; -extern void constant *ml_examine; +extern void *ml_examine; #if SPACES_IN_FILENAMES extern char openquote; extern char closequote; @@ -709,7 +709,7 @@ edit_stdin() public void cat_file() { - register int c; + int c; while ((c = ch_forw_get()) != EOI) putchr(c); @@ -727,8 +727,8 @@ cat_file() use_logfile(filename) char *filename; { - register int exists; - register int answer; + int exists; + int answer; PARG parg; if (ch_getflags() & CH_CANSEEK) diff --git a/filename.c b/filename.c index 3790a20e..071c220f 100644 --- a/filename.c +++ b/filename.c @@ -257,7 +257,7 @@ dirfile(dirname, filename) homefile(filename) char *filename; { - register char *pathname; + char *pathname; /* * Try $HOME/filename. @@ -307,9 +307,9 @@ homefile(filename) fexpand(s) char *s; { - register char *fr, *to; - register int n; - register char *e; + char *fr, *to; + int n; + char *e; IFILE ifile; #define fchar_ifile(c) \ @@ -683,9 +683,9 @@ lglob(filename) * The globbing function returns a single name, and * is called multiple times to walk thru all names. */ - register char *p; - register int len; - register int n; + char *p; + int len; + int n; char *pathname; char *qpathname; DECL_GLOB_NAME(fnd,drive,dir,fname,ext,handle) @@ -1011,7 +1011,7 @@ is_dir(filename) #else #ifdef _OSK { - register int f; + int f; f = open(filename, S_IREAD | S_IFDIR); if (f >= 0) @@ -1033,7 +1033,7 @@ is_dir(filename) bad_file(filename) char *filename; { - register char *m = NULL; + char *m = NULL; filename = shell_unquote(filename); if (!force_open && is_dir(filename)) diff --git a/forwback.c b/forwback.c index 10c21662..218385f5 100644 --- a/forwback.c +++ b/forwback.c @@ -117,7 +117,7 @@ squish_check() */ public void forw(n, pos, force, only_last, nblank) - register int n; + int n; POSITION pos; int force; int only_last; @@ -291,7 +291,7 @@ forw(n, pos, force, only_last, nblank) */ public void back(n, pos, force, only_last) - register int n; + int n; POSITION pos; int force; int only_last; diff --git a/ifile.c b/ifile.c index af7ac878..38809ed3 100644 --- a/ifile.c +++ b/ifile.c @@ -43,7 +43,7 @@ static int ifiles = 0; static void incr_index(p, incr) - register struct ifile *p; + struct ifile *p; int incr; { for (; p != &anchor; p = p->h_next) @@ -100,7 +100,7 @@ new_ifile(filename, prev) char *filename; struct ifile *prev; { - register struct ifile *p; + struct ifile *p; /* * Allocate and initialize structure. @@ -122,7 +122,7 @@ new_ifile(filename, prev) del_ifile(h) IFILE h; { - register struct ifile *p; + struct ifile *p; if (h == NULL_IFILE) return; @@ -146,7 +146,7 @@ del_ifile(h) next_ifile(h) IFILE h; { - register struct ifile *p; + struct ifile *p; p = (h == NULL_IFILE) ? &anchor : int_ifile(h); if (p->h_next == &anchor) @@ -161,7 +161,7 @@ next_ifile(h) prev_ifile(h) IFILE h; { - register struct ifile *p; + struct ifile *p; p = (h == NULL_IFILE) ? &anchor : int_ifile(h); if (p->h_prev == &anchor) @@ -201,7 +201,7 @@ nifile() find_ifile(filename) char *filename; { - register struct ifile *p; + struct ifile *p; for (p = anchor.h_next; p != &anchor; p = p->h_next) if (strcmp(filename, p->h_filename) == 0) @@ -219,7 +219,7 @@ get_ifile(filename, prev) char *filename; IFILE prev; { - register struct ifile *p; + struct ifile *p; if ((p = find_ifile(filename)) == NULL) p = new_ifile(filename, int_ifile(prev)); @@ -325,7 +325,7 @@ set_filestate(ifile, filestate) public void if_dump() { - register struct ifile *p; + struct ifile *p; for (p = anchor.h_next; p != &anchor; p = p->h_next) { diff --git a/input.c b/input.c index 04d0ae61..f513171f 100644 --- a/input.c +++ b/input.c @@ -40,7 +40,7 @@ forw_line(curr_pos) { POSITION base_pos; POSITION new_pos; - register int c; + int c; int blankline; int endline; int backchars; diff --git a/jump.c b/jump.c index 98719b15..e80c4c74 100644 --- a/jump.c +++ b/jump.c @@ -193,7 +193,7 @@ jump_loc(pos, sline) POSITION pos; int sline; { - register int nline; + int nline; POSITION tpos; POSITION bpos; diff --git a/less.h b/less.h index beeeb82d..9d24610c 100644 --- a/less.h +++ b/less.h @@ -32,6 +32,11 @@ /* * Language details. */ +#if HAVE_ANSI_PROTOS +#define LPARAM(a) a +#else +#define LPARAM(a) () +#endif #if HAVE_VOID #define VOID_POINTER void * #else @@ -518,6 +523,10 @@ struct wchar_range_table #define time_type long #endif +struct mlist; +struct loption; +struct hilite_tree; +#include "pattern.h" #include "funcs.h" /* Functions not included in funcs.h */ diff --git a/lesskey.c b/lesskey.c index c6ff4eb3..f7bd6bc1 100644 --- a/lesskey.c +++ b/lesskey.c @@ -354,9 +354,9 @@ tstr(pp, xlate) char **pp; int xlate; { - register char *p; - register char ch; - register int i; + char *p; + char ch; + int i; static char buf[10]; static char tstr_control_k[] = { SK_SPECIAL_KEY, SK_CONTROL_K, 6, 1, 1, 1, '\0' }; @@ -416,7 +416,7 @@ tstr(pp, xlate) case 'e': ch = SK_END; break; case 'x': ch = SK_DELETE; break; default: - error("illegal char after \\k"); + error("illegal char after \\k", NULL_PARG); *pp = p+1; return (""); } @@ -467,7 +467,7 @@ tstr(pp, xlate) */ public char * skipsp(s) - register char *s; + char *s; { while (*s == ' ' || *s == '\t') s++; @@ -479,7 +479,7 @@ skipsp(s) */ public char * skipnsp(s) - register char *s; + char *s; { while (*s != '\0' && *s != ' ' && *s != '\t') s++; @@ -494,7 +494,7 @@ skipnsp(s) clean_line(s) char *s; { - register int i; + int i; s = skipsp(s); for (i = 0; s[i] != '\n' && s[i] != '\r' && s[i] != '\0'; i++) @@ -513,7 +513,7 @@ add_cmd_char(c) { if (currtable->pbuffer >= currtable->buffer + MAX_USERCMD) { - error("too many commands"); + error("too many commands", NULL_PARG); exit(1); } *(currtable->pbuffer)++ = c; @@ -613,16 +613,18 @@ findaction(actname) for (i = 0; currtable->names[i].cn_name != NULL; i++) if (strcmp(currtable->names[i].cn_name, actname) == 0) return (currtable->names[i].cn_action); - error("unknown action"); + error("unknown action", NULL_PARG); return (A_INVALID); } void -error(s) +error(s, parg) char *s; + PARG *parg; { fprintf(stderr, "line %d: %s\n", linenum, s); errors++; + (void) parg; } @@ -645,7 +647,7 @@ parse_cmdline(p) s = tstr(&p, 1); cmdlen += (int) strlen(s); if (cmdlen > MAX_CMDLEN) - error("command too long"); + error("command too long", NULL_PARG); else add_cmd_str(s); } while (*p != ' ' && *p != '\t' && *p != '\0'); @@ -662,7 +664,7 @@ parse_cmdline(p) p = skipsp(p); if (*p == '\0') { - error("missing action"); + error("missing action", NULL_PARG); return; } actname = p; @@ -715,7 +717,7 @@ parse_varline(p) p = skipsp(p); if (*p++ != '=') { - error("missing ="); + error("missing =", NULL_PARG); return; } diff --git a/line.c b/line.c index 25a7547d..8bf11915 100644 --- a/line.c +++ b/line.c @@ -163,8 +163,8 @@ prewind() plinenum(pos) POSITION pos; { - register LINENUM linenum = 0; - register int i; + LINENUM linenum = 0; + int i; if (linenums == OPT_ONPLUS) { @@ -844,7 +844,7 @@ do_append(ch, rep, pos) char *rep; POSITION pos; { - register int a; + int a; LWCHAR prev_ch; a = AT_NORMAL; @@ -1089,8 +1089,8 @@ set_status_col(c) */ public int gline(i, ap) - register int i; - register int *ap; + int i; + int *ap; { if (is_null_line) { @@ -1137,8 +1137,8 @@ forw_raw_line(curr_pos, linep, line_lenp) char **linep; int *line_lenp; { - register int n; - register int c; + int n; + int c; POSITION new_pos; if (curr_pos == NULL_POSITION || ch_seek(curr_pos) || @@ -1186,8 +1186,8 @@ back_raw_line(curr_pos, linep, line_lenp) char **linep; int *line_lenp; { - register int n; - register int c; + int n; + int c; POSITION new_pos; if (curr_pos == NULL_POSITION || curr_pos <= ch_zero() || diff --git a/linenum.c b/linenum.c index f2cbbee2..9925d377 100644 --- a/linenum.c +++ b/linenum.c @@ -68,7 +68,7 @@ extern int screen_trashed; public void clr_linenum() { - register struct linenum_info *p; + struct linenum_info *p; /* * Put all the entries on the free list. @@ -95,7 +95,7 @@ clr_linenum() */ static void calcgap(p) - register struct linenum_info *p; + struct linenum_info *p; { /* * Don't bother to compute a gap for the anchor. @@ -118,11 +118,11 @@ add_lnum(linenum, pos) LINENUM linenum; POSITION pos; { - register struct linenum_info *p; - register struct linenum_info *new; - register struct linenum_info *nextp; - register struct linenum_info *prevp; - register POSITION mingap; + struct linenum_info *p; + struct linenum_info *new; + struct linenum_info *nextp; + struct linenum_info *prevp; + POSITION mingap; /* * Find the proper place in the list for the new one. @@ -258,8 +258,8 @@ abort_long() find_linenum(pos) POSITION pos; { - register struct linenum_info *p; - register LINENUM linenum; + struct linenum_info *p; + LINENUM linenum; POSITION cpos; if (!linenums) @@ -373,7 +373,7 @@ find_linenum(pos) find_pos(linenum) LINENUM linenum; { - register struct linenum_info *p; + struct linenum_info *p; POSITION cpos; LINENUM clinenum; diff --git a/lsystem.c b/lsystem.c index 77330282..4d138580 100644 --- a/lsystem.c +++ b/lsystem.c @@ -35,10 +35,10 @@ lsystem(cmd, donemsg) char *cmd; char *donemsg; { - register int inp; + int inp; #if HAVE_SHELL - register char *shell; - register char *p; + char *shell; + char *p; #endif IFILE save_ifile; #if MSDOS_COMPILER && MSDOS_COMPILER!=WIN32C @@ -282,8 +282,8 @@ pipe_data(cmd, spos, epos) POSITION spos; POSITION epos; { - register FILE *f; - register int c; + FILE *f; + int c; extern FILE *popen(); /* diff --git a/main.c b/main.c index ef31781e..6b9b98ba 100644 --- a/main.c +++ b/main.c @@ -302,9 +302,9 @@ main(argc, argv) */ public char * save(s) - char *s; + constant char *s; { - register char *p; + char *p; p = (char *) ecalloc(strlen(s)+1, sizeof(char)); strcpy(p, s); @@ -320,7 +320,7 @@ ecalloc(count, size) int count; unsigned int size; { - register VOID_POINTER p; + VOID_POINTER p; p = (VOID_POINTER) calloc(count, size); if (p != NULL) @@ -336,7 +336,7 @@ ecalloc(count, size) */ public char * skipsp(s) - register char *s; + char *s; { while (*s == ' ' || *s == '\t') s++; @@ -354,9 +354,9 @@ sprefix(ps, s, uppercase) char *s; int uppercase; { - register int c; - register int sc; - register int len = 0; + int c; + int sc; + int len = 0; for ( ; *s != '\0'; s++, ps++) { diff --git a/mark.c b/mark.c index bd1d77a7..d3d49571 100644 --- a/mark.c +++ b/mark.c @@ -54,7 +54,7 @@ getumark(c) getmark(c) int c; { - register struct mark *m; + struct mark *m; static struct mark sm; switch (c) @@ -130,7 +130,7 @@ badmark(c) setmark(c) int c; { - register struct mark *m; + struct mark *m; struct scrpos scrpos; m = getumark(c); @@ -165,7 +165,7 @@ lastmark() gomark(c) int c; { - register struct mark *m; + struct mark *m; struct scrpos scrpos; m = getmark(c); @@ -213,7 +213,7 @@ gomark(c) markpos(c) int c; { - register struct mark *m; + struct mark *m; m = getmark(c); if (m == NULL) diff --git a/optfunc.c b/optfunc.c index 61b4b4eb..bc1bf7db 100644 --- a/optfunc.c +++ b/optfunc.c @@ -173,7 +173,7 @@ opt_j(type, s) } else { - sprintf(buf, ".%06d", jump_sline_fraction); + sprintf(buf, ".%06ld", jump_sline_fraction); len = (int) strlen(buf); while (len > 2 && buf[len-1] == '0') len--; @@ -238,7 +238,7 @@ opt_shift(type, s) } else { - sprintf(buf, ".%06d", shift_count_fraction); + sprintf(buf, ".%06ld", shift_count_fraction); len = (int) strlen(buf); while (len > 2 && buf[len-1] == '0') len--; @@ -355,7 +355,7 @@ opt__T(type, s) public void opt_p(type, s) int type; - register char *s; + char *s; { switch (type) { @@ -391,9 +391,9 @@ opt_p(type, s) public void opt__P(type, s) int type; - register char *s; + char *s; { - register char **proto; + char **proto; PARG parg; switch (type) @@ -617,7 +617,7 @@ opt_D(type, s) public void opt_x(type, s) int type; - register char *s; + char *s; { extern int tabstops[]; extern int ntabstops; @@ -675,7 +675,7 @@ opt_x(type, s) public void opt_quote(type, s) int type; - register char *s; + char *s; { char buf[3]; PARG parg; diff --git a/option.c b/option.c index e1094491..a386a10d 100644 --- a/option.c +++ b/option.c @@ -62,8 +62,8 @@ propt(c) scan_option(s) char *s; { - register struct loption *o; - register int optc; + struct loption *o; + int optc; char *optname; char *printopt; char *str; @@ -298,7 +298,7 @@ toggle_option(o, lower, s, how_toggle) char *s; int how_toggle; { - register int num; + int num; int no_prompt; int err; PARG parg; @@ -561,8 +561,8 @@ optstring(s, p_str, printopt, validchars) char *printopt; char *validchars; { - register char *p; - register char *out; + char *p; + char *out; if (*s == '\0') { @@ -625,9 +625,9 @@ getnum(sp, printopt, errp) char *printopt; int *errp; { - register char *s; - register int n; - register int neg; + char *s; + int n; + int neg; s = skipsp(*sp); neg = FALSE; @@ -662,7 +662,7 @@ getfraction(sp, printopt, errp) char *printopt; int *errp; { - register char *s; + char *s; long frac = 0; int fraclen = 0; diff --git a/opttbl.c b/opttbl.c index a9ca0c57..859d68a5 100644 --- a/opttbl.c +++ b/opttbl.c @@ -459,7 +459,7 @@ static struct loption option[] = public void init_option() { - register struct loption *o; + struct loption *o; char *p; p = lgetenv("LESS_IS_MORE"); @@ -485,7 +485,7 @@ init_option() findopt(c) int c; { - register struct loption *o; + struct loption *o; for (o = option; o->oletter != '\0'; o++) { @@ -526,9 +526,9 @@ findopt_name(p_optname, p_oname, p_err) int *p_err; { char *optname = *p_optname; - register struct loption *o; - register struct optname *oname; - register int len; + struct loption *o; + struct optname *oname; + int len; int uppercase; struct loption *maxo = NULL; struct optname *maxoname = NULL; diff --git a/os.c b/os.c index ceadf12e..cc6b1ca1 100644 --- a/os.c +++ b/os.c @@ -55,10 +55,10 @@ extern int sigs; public int iread(fd, buf, len) int fd; - char *buf; + unsigned char *buf; unsigned int len; { - register int n; + int n; start: #if MSDOS_COMPILER==WIN32C @@ -219,8 +219,8 @@ strerror(err) errno_message(filename) char *filename; { - register char *p; - register char *m; + char *p; + char *m; int len; #if HAVE_ERRNO #if MUST_DEFINE_ERRNO @@ -264,7 +264,8 @@ muldiv(val, num, den) */ public int percentage(num, den) - POSITION num, den; + POSITION num; + POSITION den; { return (int) muldiv(num, (POSITION) 100, den); } diff --git a/output.c b/output.c index c2aa54c0..964ae4b5 100644 --- a/output.c +++ b/output.c @@ -39,8 +39,8 @@ extern int sgr_mode; public void put_line() { - register int c; - register int i; + int c; + int i; int a; if (ABORT_SIGS()) @@ -89,8 +89,8 @@ static char *ob = obuf; public void flush() { - register int n; - register int fd; + int n; + int fd; n = (int) (ob - obuf); if (n == 0) @@ -429,7 +429,7 @@ putchr(c) */ public void putstr(s) - register char *s; + constant char *s; { while (*s != '\0') putchr(*s++); @@ -446,7 +446,7 @@ void funcname(num, buf) \ { \ int neg = (num < 0); \ char tbuf[INT_STRLEN_BOUND(num)+2]; \ - register char *s = tbuf + sizeof(tbuf); \ + char *s = tbuf + sizeof(tbuf); \ if (neg) num = -num; \ *--s = '\0'; \ do { \ @@ -494,11 +494,11 @@ iprint_linenum(num) */ static int less_printf(fmt, parg) - register char *fmt; + char *fmt; PARG *parg; { - register char *s; - register int col; + char *s; + int col; col = 0; while (*fmt != '\0') @@ -638,7 +638,7 @@ query(fmt, parg) char *fmt; PARG *parg; { - register int c; + int c; int col = 0; if (any_display && is_tty) diff --git a/pattern.c b/pattern.c index ab805a29..2461fd80 100644 --- a/pattern.c +++ b/pattern.c @@ -5,7 +5,6 @@ */ #include "less.h" -#include "pattern.h" extern int caseless; @@ -16,7 +15,7 @@ extern int caseless; compile_pattern2(pattern, search_type, comp_pattern, show_error) char *pattern; int search_type; - void **comp_pattern; + PATTERN_TYPE *comp_pattern; int show_error; { if (search_type & SRCH_NO_REGEX) @@ -25,8 +24,6 @@ compile_pattern2(pattern, search_type, comp_pattern, show_error) #if HAVE_GNU_REGEX struct re_pattern_buffer *comp = (struct re_pattern_buffer *) ecalloc(1, sizeof(struct re_pattern_buffer)); - struct re_pattern_buffer **pcomp = - (struct re_pattern_buffer **) comp_pattern; re_set_syntax(RE_SYNTAX_POSIX_EXTENDED); if (re_compile_pattern(pattern, strlen(pattern), comp)) { @@ -35,16 +32,15 @@ compile_pattern2(pattern, search_type, comp_pattern, show_error) error("Invalid pattern", NULL_PARG); return (-1); } - if (*pcomp != NULL) + if (*comp_pattern != NULL) { - regfree(*pcomp); - free(*pcomp); + regfree(*comp_pattern); + free(*comp_pattern); } - *pcomp = comp; + *comp_pattern = comp; #endif #if HAVE_POSIX_REGCOMP regex_t *comp = (regex_t *) ecalloc(1, sizeof(regex_t)); - regex_t **pcomp = (regex_t **) comp_pattern; if (regcomp(comp, pattern, REGCOMP_FLAG)) { free(comp); @@ -52,16 +48,15 @@ compile_pattern2(pattern, search_type, comp_pattern, show_error) error("Invalid pattern", NULL_PARG); return (-1); } - if (*pcomp != NULL) + if (*comp_pattern != NULL) { - regfree(*pcomp); - free(*pcomp); + regfree(*comp_pattern); + free(*comp_pattern); } - *pcomp = comp; + *comp_pattern = comp; #endif #if HAVE_PCRE pcre *comp; - pcre **pcomp = (pcre **) comp_pattern; constant char *errstring; int erroffset; PARG parg; @@ -74,35 +69,32 @@ compile_pattern2(pattern, search_type, comp_pattern, show_error) error("%s", &parg); return (-1); } - *pcomp = comp; + *comp_pattern = comp; #endif #if HAVE_RE_COMP PARG parg; - int *pcomp = (int *) comp_pattern; if ((parg.p_string = re_comp(pattern)) != NULL) { if (show_error) error("%s", &parg); return (-1); } - *pcomp = 1; + *comp_pattern = 1; #endif #if HAVE_REGCMP char *comp; - char **pcomp = (char **) comp_pattern; if ((comp = regcmp(pattern, 0)) == NULL) { if (show_error) error("Invalid pattern", NULL_PARG); return (-1); } - if (pcomp != NULL) - free(*pcomp); - *pcomp = comp; + if (comp_pattern != NULL) + free(*comp_pattern); + *comp_pattern = comp; #endif #if HAVE_V8_REGCOMP struct regexp *comp; - struct regexp **pcomp = (struct regexp **) comp_pattern; reg_show_error = show_error; comp = regcomp(pattern); reg_show_error = 1; @@ -114,9 +106,9 @@ compile_pattern2(pattern, search_type, comp_pattern, show_error) */ return (-1); } - if (*pcomp != NULL) - free(*pcomp); - *pcomp = comp; + if (*comp_pattern != NULL) + free(*comp_pattern); + *comp_pattern = comp; #endif } return (0); @@ -129,7 +121,7 @@ compile_pattern2(pattern, search_type, comp_pattern, show_error) compile_pattern(pattern, search_type, comp_pattern) char *pattern; int search_type; - void **comp_pattern; + PATTERN_TYPE *comp_pattern; { char *cvt_pattern; int result; @@ -152,47 +144,41 @@ compile_pattern(pattern, search_type, comp_pattern) */ public void uncompile_pattern(pattern) - void **pattern; + PATTERN_TYPE *pattern; { #if HAVE_GNU_REGEX - struct re_pattern_buffer **pcomp = (struct re_pattern_buffer **) pattern; - if (*pcomp != NULL) + if (*pattern != NULL) { - regfree(*pcomp); - free(*pcomp); + regfree(*pattern); + free(*pattern); } - *pcomp = NULL; + *pattern = NULL; #endif #if HAVE_POSIX_REGCOMP - regex_t **pcomp = (regex_t **) pattern; - if (*pcomp != NULL) + if (*pattern != NULL) { - regfree(*pcomp); - free(*pcomp); + regfree(*pattern); + free(*pattern); } - *pcomp = NULL; + *pattern = NULL; #endif #if HAVE_PCRE - pcre **pcomp = (pcre **) pattern; - if (*pcomp != NULL) - pcre_free(*pcomp); - *pcomp = NULL; + if (*pattern != NULL) + pcre_free(*pattern); + *pattern = NULL; #endif #if HAVE_RE_COMP - int *pcomp = (int *) pattern; - *pcomp = 0; + *pattern = 0; #endif #if HAVE_REGCMP - char **pcomp = (char **) pattern; - if (*pcomp != NULL) - free(*pcomp); - *pcomp = NULL; + if (*pattern != NULL) + free(*pattern); + *pattern = NULL; #endif #if HAVE_V8_REGCOMP - struct regexp **pcomp = (struct regexp **) pattern; - if (*pcomp != NULL) - free(*pcomp); - *pcomp = NULL; + if (*pattern != NULL) + free(*pattern); + *pattern = NULL; #endif } @@ -203,7 +189,7 @@ uncompile_pattern(pattern) valid_pattern(pattern) char *pattern; { - void *comp_pattern; + PATTERN_TYPE comp_pattern; int result; CLEAR_PATTERN(comp_pattern); @@ -219,7 +205,7 @@ valid_pattern(pattern) */ public int is_null_pattern(pattern) - void *pattern; + PATTERN_TYPE pattern; { #if HAVE_GNU_REGEX return (pattern == NULL); @@ -256,9 +242,9 @@ match(pattern, pattern_len, buf, buf_len, pfound, pend) int buf_len; char **pfound, **pend; { - register char *pp, *lp; - register char *pattern_end = pattern + pattern_len; - register char *buf_end = buf + buf_len; + char *pp, *lp; + char *pattern_end = pattern + pattern_len; + char *buf_end = buf + buf_len; for ( ; buf < buf_end; buf++) { @@ -291,7 +277,7 @@ match(pattern, pattern_len, buf, buf_len, pfound, pend) */ public int match_pattern(pattern, tpattern, line, line_len, sp, ep, notbol, search_type) - void *pattern; + PATTERN_TYPE pattern; char *tpattern; char *line; int line_len; @@ -301,24 +287,6 @@ match_pattern(pattern, tpattern, line, line_len, sp, ep, notbol, search_type) int search_type; { int matched; -#if HAVE_GNU_REGEX - struct re_pattern_buffer *spattern = (struct re_pattern_buffer *) pattern; -#endif -#if HAVE_POSIX_REGCOMP - regex_t *spattern = (regex_t *) pattern; -#endif -#if HAVE_PCRE - pcre *spattern = (pcre *) pattern; -#endif -#if HAVE_RE_COMP - int spattern = (int) pattern; -#endif -#if HAVE_REGCMP - char *spattern = (char *) pattern; -#endif -#if HAVE_V8_REGCOMP - struct regexp *spattern = (struct regexp *) pattern; -#endif *sp = *ep = NULL; #if NO_REGEX @@ -331,9 +299,9 @@ match_pattern(pattern, tpattern, line, line_len, sp, ep, notbol, search_type) #if HAVE_GNU_REGEX { struct re_registers search_regs; - spattern->not_bol = notbol; - spattern->regs_allocated = REGS_UNALLOCATED; - matched = re_search(spattern, line, line_len, 0, line_len, &search_regs) >= 0; + pattern->not_bol = notbol; + pattern->regs_allocated = REGS_UNALLOCATED; + matched = re_search(pattern, line, line_len, 0, line_len, &search_regs) >= 0; if (matched) { *sp = line + search_regs.start[0]; @@ -350,7 +318,7 @@ match_pattern(pattern, tpattern, line, line_len, sp, ep, notbol, search_type) rm.rm_so = 0; rm.rm_eo = line_len; #endif - matched = !regexec(spattern, line, 1, &rm, flags); + matched = !regexec(pattern, line, 1, &rm, flags); if (matched) { #ifndef __WATCOMC__ @@ -367,7 +335,7 @@ match_pattern(pattern, tpattern, line, line_len, sp, ep, notbol, search_type) { int flags = (notbol) ? PCRE_NOTBOL : 0; int ovector[3]; - matched = pcre_exec(spattern, NULL, line, line_len, + matched = pcre_exec(pattern, NULL, line, line_len, 0, flags, ovector, 3) >= 0; if (matched) { @@ -384,21 +352,21 @@ match_pattern(pattern, tpattern, line, line_len, sp, ep, notbol, search_type) *sp = *ep = NULL; #endif #if HAVE_REGCMP - *ep = regex(spattern, line); + *ep = regex(pattern, line); matched = (*ep != NULL); if (matched) *sp = __loc1; #endif #if HAVE_V8_REGCOMP #if HAVE_REGEXEC2 - matched = regexec2(spattern, line, notbol); + matched = regexec2(pattern, line, notbol); #else - matched = regexec(spattern, line); + matched = regexec(pattern, line); #endif if (matched) { - *sp = spattern->startp[0]; - *ep = spattern->endp[0]; + *sp = pattern->startp[0]; + *ep = pattern->endp[0]; } #endif } diff --git a/pattern.h b/pattern.h index 6704ab22..37b87fc0 100644 --- a/pattern.h +++ b/pattern.h @@ -3,31 +3,31 @@ #if HAVE_GNU_REGEX #define __USE_GNU 1 #include -#define DEFINE_PATTERN(name) struct re_pattern_buffer *name +#define PATTERN_TYPE struct re_pattern_buffer * #define CLEAR_PATTERN(name) name = NULL #endif #if HAVE_POSIX_REGCOMP #include #ifdef REG_EXTENDED -#define REGCOMP_FLAG REG_EXTENDED +#define REGCOMP_FLAG REG_EXTENDED #else -#define REGCOMP_FLAG 0 +#define REGCOMP_FLAG 0 #endif -#define DEFINE_PATTERN(name) regex_t *name +#define PATTERN_TYPE regex_t * #define CLEAR_PATTERN(name) name = NULL #endif #if HAVE_PCRE #include -#define DEFINE_PATTERN(name) pcre *name +#define PATTERN_TYPE pcre * #define CLEAR_PATTERN(name) name = NULL #endif #if HAVE_RE_COMP char *re_comp(); int re_exec(); -#define DEFINE_PATTERN(name) int name +#define PATTERN_TYPE int #define CLEAR_PATTERN(name) name = 0 #endif @@ -35,18 +35,18 @@ int re_exec(); char *regcmp(); char *regex(); extern char *__loc1; -#define DEFINE_PATTERN(name) char *name +#define PATTERN_TYPE char ** #define CLEAR_PATTERN(name) name = NULL #endif #if HAVE_V8_REGCOMP #include "regexp.h" extern int reg_show_error; -#define DEFINE_PATTERN(name) struct regexp *name +#define PATTERN_TYPE struct regexp * #define CLEAR_PATTERN(name) name = NULL #endif #if NO_REGEX -#define DEFINE_PATTERN(name) +#define PATTERN_TYPE void * #define CLEAR_PATTERN(name) #endif diff --git a/position.c b/position.c index 72ce70ec..7ae1e703 100644 --- a/position.c +++ b/position.c @@ -53,7 +53,7 @@ position(where) add_forw_pos(pos) POSITION pos; { - register int i; + int i; /* * Scroll the position table up. @@ -70,7 +70,7 @@ add_forw_pos(pos) add_back_pos(pos) POSITION pos; { - register int i; + int i; /* * Scroll the position table down. @@ -86,7 +86,7 @@ add_back_pos(pos) public void pos_clear() { - register int i; + int i; for (i = 0; i < sc_height; i++) table[i] = NULL_POSITION; @@ -128,7 +128,7 @@ pos_init() onscreen(pos) POSITION pos; { - register int i; + int i; if (pos < table[0]) return (-1); @@ -152,7 +152,7 @@ empty_lines(s, e) int s; int e; { - register int i; + int i; for (i = s; i <= e; i++) if (table[i] != NULL_POSITION && table[i] != 0) @@ -172,7 +172,7 @@ empty_lines(s, e) get_scrpos(scrpos) struct scrpos *scrpos; { - register int i; + int i; /* * Find the first line on the screen which has something on it, diff --git a/prompt.c b/prompt.c index 0b438e55..a4a6f424 100644 --- a/prompt.c +++ b/prompt.c @@ -387,9 +387,9 @@ protochar(c, where, iseditproto) */ static constant char * skipcond(p) - register constant char *p; + constant char *p; { - register int iflevel; + int iflevel; /* * We came in here after processing a ? or :, @@ -472,8 +472,8 @@ pr_expand(proto, maxwidth) constant char *proto; int maxwidth; { - register constant char *p; - register int c; + constant char *p; + int c; int where; mp = message; diff --git a/screen.c b/screen.c index 4031348d..c329c7a1 100644 --- a/screen.c +++ b/screen.c @@ -689,7 +689,7 @@ ltgetstr(capname, pp) public void scrsize() { - register char *s; + char *s; int sys_height; int sys_width; #if !MSDOS_COMPILER @@ -1114,7 +1114,7 @@ get_term() #else /* !MSDOS_COMPILER */ char *sp; - register char *t1, *t2; + char *t1, *t2; char *term; char termbuf[TERMBUF_SIZE]; @@ -1943,7 +1943,7 @@ create_flash() } #else #if MSDOS_COMPILER==BORLANDC - register int n; + int n; whitescreen = (unsigned short *) malloc(sc_width * sc_height * sizeof(short)); @@ -1953,7 +1953,7 @@ create_flash() whitescreen[n] = 0x7020; #else #if MSDOS_COMPILER==WIN32C - register int n; + int n; whitescreen = (WORD *) malloc(sc_height * sc_width * sizeof(WORD)); diff --git a/search.c b/search.c index 925e42bb..7b69ae46 100644 --- a/search.c +++ b/search.c @@ -6,7 +6,6 @@ */ #include "less.h" -#include "pattern.h" #include "position.h" #include "charset.h" @@ -22,7 +21,7 @@ extern int jump_sline; extern int bs_mode; extern int ctldisp; extern int status_col; -extern void * constant ml_search; +extern void *ml_search; extern POSITION start_attnpos; extern POSITION end_attnpos; extern int utf_mode; @@ -96,7 +95,7 @@ static struct hilite_tree filter_anchor = HILITE_INITIALIZER(); * search pattern and filter pattern. */ struct pattern_info { - DEFINE_PATTERN(compiled); + PATTERN_TYPE compiled; char* text; int search_type; }; diff --git a/signal.c b/signal.c index 60fcff09..cb527b9f 100644 --- a/signal.c +++ b/signal.c @@ -185,7 +185,7 @@ init_signals(on) public void psignals() { - register int tsignals; + int tsignals; if ((tsignals = sigs) == 0) return; diff --git a/tags.c b/tags.c index aa456bbf..787e4fe2 100644 --- a/tags.c +++ b/tags.c @@ -83,7 +83,7 @@ static struct tag *curtag; public void cleantags() { - register struct tag *tp; + struct tag *tp; /* * Delete any existing tag list. @@ -110,7 +110,7 @@ maketagent(name, file, linenum, pattern, endline) char *pattern; int endline; { - register struct tag *tp; + struct tag *tp; tp = (struct tag *) ecalloc(sizeof(struct tag), 1); tp->tag_file = (char *) ecalloc(strlen(file) + 1, sizeof(char)); @@ -163,7 +163,7 @@ gettagtype() */ public void findtag(tag) - register char *tag; + char *tag; { int type = gettagtype(); enum tag_result result; @@ -259,11 +259,11 @@ curr_tag() */ static enum tag_result findctag(tag) - register char *tag; + char *tag; { char *p; - register FILE *f; - register int taglen; + FILE *f; + int taglen; LINENUM taglinenum; char *tagfile; char *tagpattern; diff --git a/ttyin.c b/ttyin.c index a013c326..1ecf8678 100644 --- a/ttyin.c +++ b/ttyin.c @@ -113,7 +113,11 @@ getchr() if (c == '\003') return (READ_INTR); #else - result = iread(tty, &c, sizeof(char)); + { + unsigned char uc; + result = iread(tty, &uc, sizeof(char)); + c = (char) uc; + } if (result == READ_INTR) return (READ_INTR); if (result < 0)