diff options
author | dholland <dholland@pkgsrc.org> | 2012-12-27 06:13:20 +0000 |
---|---|---|
committer | dholland <dholland@pkgsrc.org> | 2012-12-27 06:13:20 +0000 |
commit | 1f1880761847a78db00fc45dc1e09c0babd5e5b6 (patch) | |
tree | 40b96b63a4ac53300473c7f80bef837dd96de03c /editors | |
parent | bab407c6651b3e14c658c715938e4b81cab4c9e4 (diff) | |
download | pkgsrc-1f1880761847a78db00fc45dc1e09c0babd5e5b6.tar.gz |
Clean up legacy C.
Now passes gcc -Wall -Wextra -Wmissing-declarations -Wwrite-strings on gcc45.
May build with clang now too.
Changes:
- use standard headers
- don't declare own errno, fopen(), getenv(), or malloc()
- declare own functions
- declare void functions void
- avoid implicit int
- use C89
- use some const
- use some static
- fix signed/unsigned mismatches
- call execl() properly
- don't cast return value of malloc
- initialize struct sigaction correctly
- use <ctype.h> functions correctly
- don't index arrays with (signed) char
- don't put function declarations inside function bodies
- patch up two uninitialized variables
- silence some compiler warnings that are not bugs
- remove some unused objects
and:
- add patch comments for preexisting patches
- correct some minor pkglint
As a couple of these things fixed bugs (e.g. the execl calls), bump
PKGREVISION.
Diffstat (limited to 'editors')
-rw-r--r-- | editors/mflteco/Makefile | 5 | ||||
-rw-r--r-- | editors/mflteco/distinfo | 21 | ||||
-rw-r--r-- | editors/mflteco/patches/patch-aa | 4 | ||||
-rw-r--r-- | editors/mflteco/patches/patch-ab | 201 | ||||
-rw-r--r-- | editors/mflteco/patches/patch-ac | 73 | ||||
-rw-r--r-- | editors/mflteco/patches/patch-ad | 129 | ||||
-rw-r--r-- | editors/mflteco/patches/patch-ae | 301 | ||||
-rw-r--r-- | editors/mflteco/patches/patch-te__data.c | 27 | ||||
-rw-r--r-- | editors/mflteco/patches/patch-te__exec0.c | 38 | ||||
-rw-r--r-- | editors/mflteco/patches/patch-te__exec1.c | 72 | ||||
-rw-r--r-- | editors/mflteco/patches/patch-te__fxstub.c | 16 | ||||
-rw-r--r-- | editors/mflteco/patches/patch-te__main.c | 127 | ||||
-rw-r--r-- | editors/mflteco/patches/patch-te__srch.c | 149 | ||||
-rw-r--r-- | editors/mflteco/patches/patch-te__subs.c | 153 | ||||
-rw-r--r-- | editors/mflteco/patches/patch-te__utils.c | 115 | ||||
-rw-r--r-- | editors/mflteco/patches/patch-te__window.c | 399 |
16 files changed, 1804 insertions, 26 deletions
diff --git a/editors/mflteco/Makefile b/editors/mflteco/Makefile index dc82654c736..78ea59ff12a 100644 --- a/editors/mflteco/Makefile +++ b/editors/mflteco/Makefile @@ -1,8 +1,9 @@ -# $NetBSD: Makefile,v 1.6 2012/10/03 11:43:37 asau Exp $ +# $NetBSD: Makefile,v 1.7 2012/12/27 06:13:20 dholland Exp $ # -PKGNAME= mflteco-19920331 DISTNAME= mflteco +PKGNAME= mflteco-19920331 +PKGREVISION= 1 CATEGORIES= editors MASTER_SITES= http://www.catb.org/~esr/retro/ diff --git a/editors/mflteco/distinfo b/editors/mflteco/distinfo index 05de919d329..24175dfa463 100644 --- a/editors/mflteco/distinfo +++ b/editors/mflteco/distinfo @@ -1,10 +1,19 @@ -$NetBSD: distinfo,v 1.2 2006/01/05 19:27:50 joerg Exp $ +$NetBSD: distinfo,v 1.3 2012/12/27 06:13:20 dholland Exp $ SHA1 (mflteco.tar.gz) = d32206d961fa7068afa5a36cf9e688a018622c11 RMD160 (mflteco.tar.gz) = 993ea515f87c17bafc763e3d7dcd55130cf7e83e Size (mflteco.tar.gz) = 80566 bytes -SHA1 (patch-aa) = 3ee2c99f1a14c8f155faf866d29d070face206ab -SHA1 (patch-ab) = bdeaa25511e11a8e39516eb2aa4c2dbea9f1cf9e -SHA1 (patch-ac) = 052cf6f4ec6d03948543248f7bb9a872b00fb9f8 -SHA1 (patch-ad) = cc4a7ce57a28623427163a7607952149c015d8a7 -SHA1 (patch-ae) = 94cc73f43245b997d8504564f3efe0b74e5e9fc0 +SHA1 (patch-aa) = 5dc29c16e9359a13869eb77d5a22bad70d1758ce +SHA1 (patch-ab) = 2cbe2704775cdadbffadd24d9473a8707fd004e9 +SHA1 (patch-ac) = 756afc8dc0cd82112f5b23731158fe64ae6b328c +SHA1 (patch-ad) = 48abfc5681209efedac5a1bda9c03371a0f85760 +SHA1 (patch-ae) = b8c2d78b6c04a9c819635c7ee3bc1e0b26130e5c +SHA1 (patch-te__data.c) = 86e1a8cb4a42c4d679df8931173b5651df30b35e +SHA1 (patch-te__exec0.c) = 91598104b0088a4cd16b2296a3ac9e97ace500c2 +SHA1 (patch-te__exec1.c) = bda2147de4d814fc57d31bc24f7406542478d162 +SHA1 (patch-te__fxstub.c) = 5821a4b9d97b1385efe351e9588938b662329239 +SHA1 (patch-te__main.c) = 7539eb9840b6611b4d283d5f49d4f107bc0f1999 +SHA1 (patch-te__srch.c) = f16a8c589b53ab639466fd3cfd9909685dff9d1b +SHA1 (patch-te__subs.c) = 311416b3984b796b49abd74f44311dcbd90af075 +SHA1 (patch-te__utils.c) = 99cddefd89fa40f0f60a1b197a57477d69799cff +SHA1 (patch-te__window.c) = 01a159d93d812fa3d40c6bc09b5575b050dac918 diff --git a/editors/mflteco/patches/patch-aa b/editors/mflteco/patches/patch-aa index ea0369dc445..aa8113e0061 100644 --- a/editors/mflteco/patches/patch-aa +++ b/editors/mflteco/patches/patch-aa @@ -1,4 +1,6 @@ -$NetBSD: patch-aa,v 1.1.1.1 2005/12/28 22:29:17 is Exp $ +$NetBSD: patch-aa,v 1.2 2012/12/27 06:13:20 dholland Exp $ + +- add defines to enable standard things --- Makefile.orig 2005-12-28 22:07:58.000000000 +0100 +++ Makefile diff --git a/editors/mflteco/patches/patch-ab b/editors/mflteco/patches/patch-ab index 1506f45e488..be2306685b5 100644 --- a/editors/mflteco/patches/patch-ab +++ b/editors/mflteco/patches/patch-ab @@ -1,17 +1,94 @@ -$NetBSD: patch-ab,v 1.1.1.1 2005/12/28 22:29:17 is Exp $ +$NetBSD: patch-ab,v 1.2 2012/12/27 06:13:20 dholland Exp $ ---- te_exec2.c.orig 1993-08-06 00:29:34.000000000 +0200 +- use standard headers +- handle EOF from getc() correctly +- move function declarations to the header file +- use some static +- declare void functions void +- use some c89 +- don't index arrays with (signed) char +- call execl() properly + +--- te_exec2.c.orig 1993-08-05 22:29:34.000000000 +0000 +++ te_exec2.c -@@ -42,7 +42,7 @@ VOID update_header(); +@@ -19,6 +19,7 @@ + /* add directory command, header file display 03/26/92 14.59 */ + + #include "te_defs.h" ++#include <stdlib.h> + #include <sys/wait.h> + #include <sys/types.h> + #include <sys/stat.h> +@@ -35,21 +36,26 @@ struct outfiledata po_file, so_file; /* + struct outfiledata *outfile = &po_file; /* pointer to currently active output file structure */ + FILE *eisw; /* indirect command file pointer */ + int second_buff = 0; /* variable for which buffer is selected */ +-VOID init_wd(); +-VOID update_header(); ++ ++static int do_e_slash(void); /* routine to handle "change directory" command */ ++static int read_stream(FILE *file, int *ff_found, struct qp *rbuff, ++ int *nchars, int endsw, int crlf_sw, int ff_sw); ++static VOID write_stream(FILE *file, struct qp *wbuff, int nchars, ++ int crlf_sw); ++ ++ + + /* process E commands */ - do_e() +-do_e() ++VOID do_e(void) { - char c; /* temps */ + int c; /* temps */ int old_var; FILE *t_eisw; struct stat statbuff; /* buffer to fetch file stat (mode) of open file for EB */ -@@ -609,7 +609,7 @@ int do_glob(gbuff, sbuff) + int t_access; /* result from provisional "open" */ +- int do_e_slash(); /* routine to handle "change directory" command */ + +- switch (mapch_l[getcmdc(trace_sw)]) /* read next character and dispatch */ ++ switch (mapch_l[(unsigned char)getcmdc(trace_sw)]) /* read next character and dispatch */ + { + + /* numeric values */ +@@ -386,7 +392,7 @@ int do_eq() + t = vfork(); /* fork a new process */ + if (t == 0) /* if this is the child */ + { +- execl(pname, pname, SHELL_OPT, &sysbuf.f->ch[0], 0); /* call the named Unix routine */ ++ execl(pname, pname, SHELL_OPT, &sysbuf.f->ch[0], (void *)NULL); /* call the named Unix routine */ + printf("Error in 'execl'\n"); /* normally shouldn't get here */ + exit(1); + } +@@ -493,7 +499,7 @@ int do_eq1(shell) + if (ll == 0) /* if there are no characters to send */ + { + close(pipe_in[1]); /* close exec'd process' new "stdin" so "read" will find eof */ +- execl(shell, shell, SHELL_OPT, &sysbuf.f->ch[0], 0); /* execute specified routine */ ++ execl(shell, shell, SHELL_OPT, &sysbuf.f->ch[0], (void *)NULL); /* execute specified routine */ + fputs("execl failed\n", stderr); + exit(1); + } /* end "orig m,nEQ command had zero range" */ +@@ -520,7 +526,7 @@ int do_eq1(shell) + else /* this process is the grandchild */ + { + close(pipe_in[1]); /* close "input" for writing */ +- execl(shell, shell, SHELL_OPT, &sysbuf.f->ch[0], 0); /* execute specified routine */ ++ execl(shell, shell, SHELL_OPT, &sysbuf.f->ch[0], (void *)NULL); /* execute specified routine */ + fputs("execl failed\n", stderr); + exit(1); + } /* end "this is the grandchild" */ +@@ -559,7 +565,7 @@ int do_en() + } + /* routine to handle "change directory" command */ + +-int do_e_slash() ++static int do_e_slash(void) + { + int rv = -1; /* return value */ + int err_code = E_DIR; +@@ -609,7 +615,7 @@ int do_glob(gbuff, sbuff) { char glob_cmd[CELLSIZE+5]; /* "glob filespec" command string */ int t; @@ -20,7 +97,40 @@ $NetBSD: patch-ab,v 1.1.1.1 2005/12/28 22:29:17 is Exp $ int glob_pipe[2]; /* pipe to forked shell for expanding filenames */ struct qp glob_ptr; /* pointer for loading result buffer */ FILE *xx_out; /* stream for reading chars from pipe */ -@@ -825,7 +825,7 @@ int read_stream(file, ff_found, rbuff, n +@@ -668,7 +674,7 @@ int do_glob(gbuff, sbuff) + close(glob_pipe[0]); /* child won't read */ + dup2(glob_pipe[1], fileno(stdout)); /* substitute pipe for standard out */ + close(glob_pipe[1]); /* don't need that anymore */ +- execl("/bin/csh", "csh", "-fc", glob_cmd, 0); /* execute the "glob" */ ++ execl("/bin/csh", "csh", "-fc", glob_cmd, (void *)NULL); /* execute the "glob" */ + fputs("execl failed\n", stderr); + exit(1); + } +@@ -676,7 +682,7 @@ int do_glob(gbuff, sbuff) + + /* routine to get next file spec from "EN" list into filespec buffer */ + +-do_en_next() ++VOID do_en_next(void) + { + char c; + +@@ -778,7 +784,7 @@ int read_filename(flag, func) + + /* fetch or set variable */ + +-set_var(extend, arg) ++VOID set_var(extend, arg) + int extend; /* nonzero if arg is 16 bits to be sign extended */ + int *arg; /* argument is pointer to variable */ + { +@@ -820,12 +826,12 @@ int read_file(rbuff, nchars, endsw) + /* address of a switch to set if read ended with a FF, crlf_sw is lf->crlf */ + /* conversion, ff_sw indicates whether to stop on a form feed. */ + +-int read_stream(file, ff_found, rbuff, nchars, endsw, crlf_sw, ff_sw) ++static int read_stream(file, ff_found, rbuff, nchars, endsw, crlf_sw, ff_sw) + FILE *file; struct qp *rbuff; int *ff_found, *nchars, endsw, crlf_sw, ff_sw; { @@ -29,3 +139,82 @@ $NetBSD: patch-ab,v 1.1.1.1 2005/12/28 22:29:17 is Exp $ int crflag; register struct buffcell *p; register int c; +@@ -874,7 +880,7 @@ int read_stream(file, ff_found, rbuff, n + /* arguments are qp to start of text, number of characters, */ + /* and an "append FF" switch */ + +-write_file(wbuff, nchars, ffsw) ++VOID write_file(wbuff, nchars, ffsw) + struct qp *wbuff; + int nchars, ffsw; + { +@@ -889,7 +895,7 @@ write_file(wbuff, nchars, ffsw) + /* Unix processes. Arguments wbuff, nchars as above; file */ + /* is stream pointer, crlf_sw zero converts CRLF to LF */ + +-write_stream(file, wbuff, nchars, crlf_sw) ++static VOID write_stream(file, wbuff, nchars, crlf_sw) + FILE *file; + struct qp *wbuff; + int nchars, crlf_sw; +@@ -919,7 +925,7 @@ write_stream(file, wbuff, nchars, crlf_s + + /* routine to kill output file: argument is pointer to an output file structure */ + +-kill_output(outptr) ++VOID kill_output(outptr) + struct outfiledata *outptr; + { + if (outptr->fd) +@@ -934,7 +940,7 @@ kill_output(outptr) + + static char panic_name[16] = "TECO_SAVED.tmp"; /* name of file created to save buffer */ + +-panic() ++VOID panic(void) + { + int i; /* counter of buffers to save */ + int t_access; /* file descriptor returned by open() */ +@@ -959,13 +965,13 @@ panic() + } + /* do "F" commands */ + +-do_f() ++VOID do_f(void) + { + struct buffcell *delete_p; + int temp_dot; + VOID do_fm(); + +- switch (mapch_l[getcmdc(trace_sw)]) /* read next character and dispatch */ ++ switch (mapch_l[(unsigned char)getcmdc(trace_sw)]) /* read next character and dispatch */ + { + case '<': /* back to beginning of current iteration */ + if (cptr.flag & F_ITER) /* if in iteration */ +@@ -1138,7 +1144,7 @@ do_f() + /* pop iteration: if arg nonzero, exit unconditionally */ + /* else check exit conditions and exit or reiterate */ + +-pop_iteration(arg) ++VOID pop_iteration(arg) + int arg; + { + if (!arg && (!cptr.il->dflag || (--(cptr.il->count) > 0)) ) /* if reiteration */ +@@ -1157,7 +1163,7 @@ pop_iteration(arg) + + /* find end of iteration - read over arbitrary <> and one > */ + +-find_enditer() ++VOID find_enditer(void) + { + register int icnt; + +@@ -1172,7 +1178,7 @@ find_enditer() + + + /* find end of conditional */ +-char find_endcond(arg) ++VOID find_endcond(arg) + char arg; + { + register int icnt; diff --git a/editors/mflteco/patches/patch-ac b/editors/mflteco/patches/patch-ac index 2425ba5d9dc..36d5164f8aa 100644 --- a/editors/mflteco/patches/patch-ac +++ b/editors/mflteco/patches/patch-ac @@ -1,12 +1,22 @@ -$NetBSD: patch-ac,v 1.1.1.1 2005/12/28 22:29:17 is Exp $ +$NetBSD: patch-ac,v 1.2 2012/12/27 06:13:20 dholland Exp $ ---- te_rdcmd.c.orig 1993-08-06 00:29:35.000000000 +0200 +- use some static +- don't put function declarations inside function bodies +- remove unused goto-label +- call ctype.h functions correctly +- don't index arrays with (signed) char +- remove silly code that provokes a pointer width warning +- declare void functions void +- remove unused variable + +--- te_rdcmd.c.orig 1993-08-05 22:29:35.000000000 +0000 +++ te_rdcmd.c -@@ -9,13 +9,14 @@ +@@ -9,13 +9,15 @@ #include "te_defs.h" -+static unsigned short do_func_keys(); ++static unsigned short do_func_keys(unsigned short c); ++static int find_lasteol(void); + int ccount; /* count of chars read in */ @@ -18,3 +28,58 @@ $NetBSD: patch-ac,v 1.1.1.1 2005/12/28 22:29:17 is Exp $ goto prompt; +@@ -30,7 +32,7 @@ int read_cmdstr() + ccount = 0; + lastc = ' '; + +-reline: /* continue reading */ ++/*reline:*/ /* continue reading */ + for (;;) /* loop to read command string chars */ + { + if (!eisw && !inp_noterm) /* if terminal input */ +@@ -106,7 +108,7 @@ reline: /* continue reading */ + i = (c == '~') ? NEXTQREGS/2 : 0; + type_char(c = gettty()); /* read & echo one more */ + if (isdigit(c)) i += EXTQREGS + c - '0'; +- else if (isalpha(mapch_l[c])) i += EXTQREGS + 10 + c - 'a'; ++ else if (isalpha((unsigned char)mapch_l[c])) i += EXTQREGS + 10 + c - 'a'; + else ERROR(E_IQN); + } + else i = getqspec(0, c); +@@ -119,7 +121,8 @@ reline: /* continue reading */ + qreg[i].f->usecount = 1; + } + qreg[i].z = cbuf.z; +- cbuf.f = (struct buffcell *) (cbuf.z = 0); /* no old command string */ ++ cbuf.z = 0; ++ cbuf.f = NULL; /* no old command string */ + err = 0; /* no previous error */ + goto restart; + } +@@ -238,7 +241,7 @@ reline: /* continue reading */ + /* back up to find most recent CR or LF in entered command string */ + /* return number of chars backed up */ + +-int find_lasteol() ++static int find_lasteol(void) + { + int i; + +@@ -258,7 +261,7 @@ int find_lasteol() + + /* retype command string: entirely (arg = '*') or most recent line (arg = ' ') */ + +-retype_cmdstr(c) ++VOID retype_cmdstr(c) + char c; + { + int i; +@@ -294,7 +297,7 @@ static struct qp saved_cmd_ptr; + static unsigned short do_func_keys(c) + unsigned short c; + { +- unsigned short i, n; /* temporaries */ ++ unsigned short n; /* temporaries */ + struct qh *header_p; /* pointer to register's header */ + struct qp pointer; /* q-pointer to register being copied */ + unsigned char last_c = ' ', this_c; /* char's used in copying command string */ diff --git a/editors/mflteco/patches/patch-ad b/editors/mflteco/patches/patch-ad index 793baa87b4d..28577dd393d 100644 --- a/editors/mflteco/patches/patch-ad +++ b/editors/mflteco/patches/patch-ad @@ -1,6 +1,12 @@ -$NetBSD: patch-ad,v 1.1 2006/01/05 19:27:50 joerg Exp $ +$NetBSD: patch-ad,v 1.2 2012/12/27 06:13:20 dholland Exp $ ---- te_defs.h.orig 2006-01-04 20:59:21.000000000 +0000 +- don't declare own errno +- use some const +- don't declare own fopen() +- do declare own functions +- use C89 + +--- te_defs.h.orig 1993-08-05 22:29:33.000000000 +0000 +++ te_defs.h @@ -387,7 +387,6 @@ extern struct outfiledata po_file, so_fi extern int char_count; /* char count for tab typer */ @@ -10,3 +16,122 @@ $NetBSD: patch-ad,v 1.1 2006/01/05 19:27:50 joerg Exp $ #ifdef POSIX_TECO extern struct termios ttybuf; /* local copy of tty control data */ #else +@@ -429,20 +428,16 @@ extern struct buffcell *insert_p; /* po + extern int buff_mod; /* set to earliest buffer change */ + extern int search_flag; /* set nonzero by search */ + +-extern char *errors[]; /* error text */ ++extern const char *errors[]; /* error text */ + extern char mapch[], mapch_l[]; /* char mapping tables */ + extern char spec_chars[]; /* special character table */ + +-extern char skipto(), find_endcond(), getcmdc(), getcmdc0(); /* routines that return chars */ + + extern FILE *eisw; /* indirect command file pointer */ +-extern FILE *fopen(); + + extern struct buffcell *freebuff; /* buffcell free-list pointer */ + extern struct buffcell *dly_freebuff; /* delayed free-list pointer */ + extern struct is *freedcell; /* cell free-list pointer */ +-extern struct buffcell *get_bcell(); /* get buffcell routine */ +-extern struct is *get_dcell(); /* get data cell routine */ + + /* the text buffer header */ + extern struct qh buff; +@@ -466,3 +461,96 @@ extern struct exp_entry *esp; /* expres + + /* the directory string buffer */ + extern struct qh dir_name; ++ ++/* te_utils.c */ ++struct buffcell *get_bcell(void); /* get buffcell routine */ ++VOID free_blist(struct buffcell *p); ++VOID dly_free_blist(struct buffcell *p); ++VOID free_dlyd_blist(struct buffcell *p); ++VOID reset_q_usecounts(void); ++extern struct is *get_dcell(void); /* get data cell routine */ ++VOID make_buffer(struct qh *p); ++int fwdc(struct qp *arg); ++int fwdcx(struct qp *arg); ++int backc(struct qp *arg); ++VOID set_pointer(int pos, struct qp *ptr); ++char getcmdc0(int trace); ++char getcmdc(int trace); ++int peekcmdc(char arg); ++ ++/* te_subs.c */ ++VOID movenchars(struct qp *from, struct qp *to, register int n); ++VOID moveuntil(struct qp *form, struct qp *to, register char c, ++ int *n, int max, int trace); ++int get_value(int d); ++int lines(register int arg); ++int line_args(int d, struct qp *p); ++int getqspec(int fors, char c); ++VOID insert1(void); ++VOID insert2(int count); ++VOID delete1(int nchars); ++char skipto(int arg); ++VOID do_ctlp(void); ++ ++/* te_main.c */ ++VOID cleanup(void); ++VOID update_header(void); ++VOID init_wd(void); ++VOID get_term_par(void); ++VOID do_o(void); ++ ++/* te_rdcmd.c */ ++int read_cmdstr(void); ++VOID retype_cmdstr(char c); ++ ++/* te_exec0.c */ ++VOID exec_cmdstr(void); ++ ++/* te_exec1.c */ ++VOID exec_cmds1(void); ++ ++/* te_exec2.c */ ++VOID do_e(void); ++int do_eq(void); ++int do_eq1(char *shell); ++int do_en(void); ++int do_glob(struct qh *gbuff, struct qh *sbuff); ++VOID do_en_next(void); ++int read_filename(int flag, char func); ++VOID set_var(int extend, int *arg); ++int read_file(struct qp *rbuff, int *nchars, int endsw); ++VOID write_file(struct qp *wbuff, int nchars, int ffsw); ++VOID kill_output(struct outfiledata *outptr); ++VOID panic(void); ++VOID do_f(void); ++VOID pop_iteration(int arg); ++VOID find_enditer(void); ++VOID find_endcond(char arg); ++ ++/* te_srch.c */ ++int build_string(struct qh *sbuff); ++int end_search(int result); ++int setup_search(void); ++int do_nsearch(char arg); ++int do_fb(void); ++int do_search(int count); ++ ++/* te_chario.c */ ++VOID setup_tty(int arg); ++int gettty_nowait(void); ++int gettty(void); ++void block_inter(int func); ++VOID crlf(void); ++VOID reset_ctlo(void); ++VOID type_char(char c); ++ ++/* te_window.c */ ++VOID vt(int func); ++VOID do_window(int ref_flag); ++VOID set_term_par(int lines, int cols); ++VOID window(int arg); ++VOID scroll_dly(void); ++VOID display_lines(void); ++ ++/* te_fxstub.c */ ++void te_fx(void); diff --git a/editors/mflteco/patches/patch-ae b/editors/mflteco/patches/patch-ae index 6d30838ad08..323963c5752 100644 --- a/editors/mflteco/patches/patch-ae +++ b/editors/mflteco/patches/patch-ae @@ -1,8 +1,66 @@ -$NetBSD: patch-ae,v 1.1 2006/01/05 19:27:50 joerg Exp $ +$NetBSD: patch-ae,v 1.2 2012/12/27 06:13:20 dholland Exp $ ---- te_chario.c.orig 2006-01-04 21:01:15.000000000 +0000 +- use standard headers +- use some static +- initialize struct sigaction correctly +- declare own functions +- don't declare own errno +- restore missing close-comments +- declare void functions void +- use some c89 +- don't index arrays with (signed) char + +--- te_chario.c.orig 1993-08-05 22:29:33.000000000 +0000 +++ te_chario.c -@@ -101,7 +101,6 @@ char ldbuf[TTNAMEMAX]; +@@ -28,6 +28,8 @@ + #endif + + #include <unistd.h> ++#include <stdlib.h> ++#include <string.h> + + #if defined(USE_SELECT) && defined(_AIX) + #include <sys/select.h> +@@ -41,10 +43,10 @@ + #include <fcntl.h> + #ifndef DEBUG + #include <signal.h> +-extern SHRET int_handler(); +-extern SHRET stp_handler(); +-extern SHRET hup_handler(); +-extern SHRET winch_handler(); ++static SHRET int_handler(); ++static SHRET stp_handler(); ++static SHRET hup_handler(); ++static SHRET winch_handler(); + #define SIGINTMASK 2 + #endif + +@@ -72,11 +74,11 @@ int bsdld; + /* this is really for linux */ + #define SA_INTERRUPT 0 + #endif +-struct sigaction intsigstruc = { int_handler, 0, SA_INTERRUPT } ; /* info structure for ^C interrupt */ +-struct sigaction stpsigstruc = { stp_handler, 0, SA_INTERRUPT } ; /* info structure for "stop" signal */ +-struct sigaction hupsigstruc = { hup_handler, 0, SA_INTERRUPT } ; /* info structure for "hangup" signal */ +-struct sigaction nosigstr = { SIG_DFL, 0, 0 }; /* default structure for signal */ +-struct sigaction sigwinchstruc = { winch_handler, 0, SA_INTERRUPT} ; ++struct sigaction intsigstruc; /* info structure for ^C interrupt */ ++struct sigaction stpsigstruc; /* info structure for "stop" signal */ ++struct sigaction hupsigstruc; /* info structure for "hangup" signal */ ++struct sigaction nosigstr; /* default structure for signal */ ++struct sigaction sigwinchstruc; + #else + struct sigvec intsigstruc = { int_handler, 0, 0 } ; /* info structure for ^C interrupt */ + struct sigvec stpsigstruc = { stp_handler, 0, 0 } ; /* info structure for "stop" signal */ +@@ -96,12 +98,13 @@ int out_noterm; /* nonzero if standar + char ldbuf[TTNAMEMAX]; + #endif + ++static void qio_char(char c); ++ + #ifndef POSIX_TECO + setup_tty(arg) int arg; { @@ -10,11 +68,244 @@ $NetBSD: patch-ae,v 1.1 2006/01/05 19:27:50 joerg Exp $ int ioerr; struct sgttyb tmpbuf; -@@ -186,7 +185,6 @@ setup_tty(arg) - setup_tty(arg) +@@ -177,16 +180,15 @@ setup_tty(arg) + } + } + } +-#else /* POSIX_TECO ++#else /* POSIX_TECO */ + /* + * set tty (stdin) mode. TECO mode is CBREAK, no ECHO, sep CR & LF + * operation; normal mode is none of the above. TTY_OFF and TTY_ON do this + * absolutely; TTY_SUSP and TTY_RESUME use saved signal status. + */ +-setup_tty(arg) ++VOID setup_tty(arg) int arg; { - extern int errno; int ioerr; struct termios tmpbuf; +@@ -227,6 +229,22 @@ int arg; + tcdrain(fileno(stdin)); + tcdrain(fileno(stdin)); tcsetattr(fileno(stdin), TCSANOW, &tty_new); + #ifndef DEBUG ++ intsigstruc.sa_sigaction = int_handler; ++ sigemptyset(&intsigstruc.sa_mask); ++ intsigstruc.sa_flags = SA_INTERRUPT; ++ ++ stpsigstruc.sa_handler = stp_handler; ++ sigemptyset(&stpsigstruc.sa_mask); ++ stpsigstruc.sa_flags = SA_INTERRUPT; ++ ++ hupsigstruc.sa_handler = hup_handler; ++ sigemptyset(&hupsigstruc.sa_mask); ++ hupsigstruc.sa_flags = SA_INTERRUPT; ++ ++ sigwinchstruc.sa_handler = winch_handler; ++ sigemptyset(&sigwinchstruc.sa_mask); ++ sigwinchstruc.sa_flags = SA_INTERRUPT; ++ + /* Handle signals */ + if (sigaction(SIGTSTP, &stpsigstruc, NULL) < 0) { + fprintf(stderr, "could not install signal handler for SIGTSTP\n"); +@@ -249,6 +267,10 @@ int arg; + /* Restore to original state */ + tcdrain(fileno(stdin)); tcsetattr(fileno(stdin), TCSANOW, &tty_orig); + #ifndef DEBUG ++ nosigstr.sa_handler = SIG_DFL; ++ sigemptyset(&nosigstr.sa_mask); ++ nosigstr.sa_flags = 0; ++ + sigaction(SIGTSTP, &nosigstr, 0); + sigaction(SIGINT, &nosigstr, 0); + sigaction(SIGHUP, &nosigstr, 0); +@@ -263,10 +285,10 @@ int arg; + /* if lf_sw is nonzero, return the LF; else use the FNDELAY fcntl to inquire of the input */ + /* if input is not a terminal don't switch modes */ + +-unsigned short get_kbd_enh(); ++static unsigned short get_kbd_enh(void); + #ifndef POSIX_TECO + +-int gettty_nowait() ++int gettty_nowait(void) + { + int c; + +@@ -289,7 +311,7 @@ int gettty_nowait() + * set if lf_sw is nonzero, return the LF; else use the FNDELAY fcntl to + * inquire of the input + */ +-gettty_nowait() ++int gettty_nowait(void) + { + char c; + int err, cnt; +@@ -424,7 +446,7 @@ static unsigned char ca[3] = {0,0,0}; + #define c2 ca[1] + #define c3 ca[2] + +-int zread(fd,c) ++static int zread(fd,c) + int fd; + char *c; + { +@@ -435,7 +457,7 @@ char *c; + } + + #if defined(USE_SELECT) +-int timed_read(fd,c) ++static int timed_read(fd,c) + int fd; + char *c; + { +@@ -459,7 +481,7 @@ char *c; + #endif + + #if defined(USE_POLL) +-int timed_read(fd,c) ++static int timed_read(fd,c) + int fd; + char *c; + { +@@ -479,7 +501,7 @@ char *c; + #endif + + #if defined(USE_POSIX_C_CC) +-int timed_read(fd,c) ++static int timed_read(fd,c) + int fd; + char *c; + { +@@ -503,7 +525,7 @@ char *c; + } + #endif + +-unsigned short get_kbd_enh() ++static unsigned short get_kbd_enh() + { + unsigned short retval; + struct trans_entry *pt; +@@ -555,7 +577,7 @@ unsigned short get_kbd_enh() + + #ifndef DEBUG + +-SHRET winch_handler() ++static SHRET winch_handler() + { + get_term_par(); + window(WIN_INIT); +@@ -566,7 +588,7 @@ SHRET winch_handler() + } + } + +-SHRET int_handler() ++static SHRET int_handler() + { + + if (exitflag <= 0) /* if executing commands */ +@@ -594,7 +616,7 @@ SHRET int_handler() + /* routine to disable (1), enable (0) ^C interrupt, used to block interrupts during display update */ + + #ifdef POSIX_TECO +-block_inter(func) ++VOID block_inter(func) + int func; + { + sigset_t ss; +@@ -608,7 +630,7 @@ int func; + #else + int old_mask; /* storage for previous signal mask */ + #define INT_MASK 2 +-block_inter(func) ++VOID block_inter(func) + int func; + { + #ifndef DEBUG +@@ -624,7 +646,7 @@ block_inter(func) + /* routine to handle "stop" signal (^Y) */ + #ifdef POSIX_TECO + +-SHRET stp_handler() ++static SHRET stp_handler() + { + sigset_t ss; + sigemptyset(&ss); +@@ -652,7 +674,7 @@ SHRET stp_handler() + + #else /* BSD style signals */ + +-SHRET stp_handler() ++static SHRET stp_handler() + { + crlf(); + window(WIN_SUSP); /* restore screen */ +@@ -682,7 +704,7 @@ SHRET stp_handler() + + /* simulate a character's having been typed on the keyboard */ + +-qio_char(c) ++static void qio_char(c) + char c; + { + #ifdef POSIX_TECO +@@ -694,7 +716,7 @@ qio_char(c) + /* routine to handle "hangup" signal */ + #ifndef DEBUG + +-SHRET hup_handler() ++static SHRET hup_handler() + { + if (!exitflag) exitflag = -3; /* if executing, set flag to terminate */ + else +@@ -709,7 +731,7 @@ SHRET hup_handler() + + /* type a crlf */ + +-crlf() ++void crlf(void) + { + type_char(CR); + type_char(LF); +@@ -721,7 +743,7 @@ crlf() + int lflusho = LFLUSHO; + int lfo; + +-reset_ctlo() ++void reset_ctlo(void) + { + ioctl(fileno(stdin), TIOCLGET, &lfo); /* read flags */ + if (lfo & LFLUSHO) /* if ^O was set */ +@@ -731,18 +753,18 @@ reset_ctlo() + } + } + #else +-reset_ctlo() ++void reset_ctlo(void) + { + } + + #endif + /* routine to type one character */ + +-type_char(c) ++VOID type_char(c) + char c; + { + +- if ((char_count >= WN_width) && (c != CR) && !(spec_chars[c] & A_L)) /* spacing char beyond end of line */ ++ if ((char_count >= WN_width) && (c != CR) && !(spec_chars[(unsigned char)c] & A_L)) /* spacing char beyond end of line */ + { + if (et_val & ET_TRUNC) return; /* truncate output to line width */ + else crlf(); /* otherwise do automatic new line (note recursive call to type_char) */ +@@ -759,7 +781,7 @@ type_char(c) + + case LF: + putchar(c); +-/* scroll_dly(); /* filler chars in case VT-100 scrolls */ ++/* scroll_dly(); */ /* filler chars in case VT-100 scrolls */ + break; + + case ESC: diff --git a/editors/mflteco/patches/patch-te__data.c b/editors/mflteco/patches/patch-te__data.c new file mode 100644 index 00000000000..5cf3b06ecba --- /dev/null +++ b/editors/mflteco/patches/patch-te__data.c @@ -0,0 +1,27 @@ +$NetBSD: patch-te__data.c,v 1.1 2012/12/27 06:13:20 dholland Exp $ + +- use const for string constants +- silence warning about initializer + +--- te_data.c.orig 1993-08-05 22:29:33.000000000 +0000 ++++ te_data.c +@@ -12,7 +12,7 @@ + #include "te_defs.h" + + /* error message text */ +-char *errors[] = ++const char *errors[] = + { + "> not in iteration", + "Can't pop Q register", +@@ -77,8 +77,8 @@ char *errors[] = + /* the text buffer headers */ + struct bh buffs[2] = + { +- { NULL, NULL, 0, 0, 0 }, +- { NULL, NULL, 0, 0, 0 } ++ { NULL, NULL, 0, 0, 0, 0 }, ++ { NULL, NULL, 0, 0, 0, 0 } + } ; + struct bh *pbuff = buffs; + diff --git a/editors/mflteco/patches/patch-te__exec0.c b/editors/mflteco/patches/patch-te__exec0.c new file mode 100644 index 00000000000..79531036010 --- /dev/null +++ b/editors/mflteco/patches/patch-te__exec0.c @@ -0,0 +1,38 @@ +$NetBSD: patch-te__exec0.c,v 1.1 2012/12/27 06:13:20 dholland Exp $ + +- declare void functions void +- remove unused variables +- use <ctype.h> functions correctly +- don't index arrays with (signed) char + +--- te_exec0.c~ 1993-08-05 22:29:34.000000000 +0000 ++++ te_exec0.c +@@ -13,9 +13,8 @@ + #include <time.h> + #endif + +-exec_cmdstr() ++VOID exec_cmdstr(void) + { +- char c; + int digit_sw; + struct tm *timeptr; + char *timestring, *asctime(); +@@ -42,7 +41,7 @@ exec_cmdstr() + if (getcmdc0(trace_sw) == '^') /* interpret next char as corresp. control char */ + cmdc = getcmdc(trace_sw) & 0x1f; + +- if (isdigit(cmdc)) /* process number */ ++ if (isdigit((unsigned char)cmdc)) /* process number */ + { /* this works lousy for hex but so does TECO-11 */ + if (cmdc - '0' >= ctrl_r) ERROR(E_ILN); /* invalid digit */ + if (!(digit_sw++)) esp->val1 = cmdc - '0'; /* first digit */ +@@ -55,7 +54,7 @@ exec_cmdstr() + else + { + digit_sw = 0; +- switch (mapch_l[cmdc]) ++ switch (mapch_l[(unsigned char)cmdc]) + { + + /* characters ignored */ diff --git a/editors/mflteco/patches/patch-te__exec1.c b/editors/mflteco/patches/patch-te__exec1.c new file mode 100644 index 00000000000..25dfeeb37a2 --- /dev/null +++ b/editors/mflteco/patches/patch-te__exec1.c @@ -0,0 +1,72 @@ +$NetBSD: patch-te__exec1.c,v 1.1 2012/12/27 06:13:20 dholland Exp $ + +- declare void functions void +- don't index arrays with (signed) char +- silence warnings about assignments in conditionals +- use <ctype.h> functions correctly + +--- te_exec1.c~ 1993-08-05 22:29:34.000000000 +0000 ++++ te_exec1.c +@@ -12,13 +12,14 @@ + + #include "te_defs.h" + +-exec_cmds1() ++VOID exec_cmds1(void) + { + char command; /* command character */ + int cond; /* conditional in progress */ + int tempz; /* temp copy of Z */ + +- switch (command = mapch_l[cmdc]) ++ command = mapch_l[(unsigned char)cmdc]; ++ switch (command) + { + /* operators */ + +@@ -166,7 +167,7 @@ exec_cmds1() + cptr.il->p = cptr.p; /* save start of iteration */ + cptr.il->c = cptr.c; + cptr.il->dot = cptr.dot; +- if (cptr.il->dflag = esp->flag1) /* if there is an argument, set the "def iter" flag */ ++ if ((cptr.il->dflag = esp->flag1) != 0) /* if there is an argument, set the "def iter" flag */ + cptr.il->count = esp->val1; /* save the count */ + } + esp->flag1 = 0; /* consume the argument, if any */ +@@ -195,7 +196,7 @@ exec_cmds1() + if (!esp->flag1) ERROR(E_NAQ); /* must be an argument */ + esp->flag1 = 0; /* consume argument */ + esp->op = OP_START; +- switch (mapch_l[getcmdc(trace_sw)]) ++ switch (mapch_l[(unsigned char)getcmdc(trace_sw)]) + { + case 'a': + cond = isalpha(esp->val1); +@@ -500,7 +501,7 @@ exec_cmds1() + qreg[mm].z = 0; + } + +- if (ll = line_args(0, &aa)) /* read args and move chars, if any */ ++ if ((ll = line_args(0, &aa)) != 0) /* read args and move chars, if any */ + { + make_buffer(&qreg[mm]); /* attach a text buffer to the q register */ + for (bb.p = qreg[mm].f; bb.p->f != NULL; bb.p = bb.p->f); /* find end of reg */ +@@ -603,14 +604,14 @@ exec_cmds1() + { + if (ctrl_r != 16) /* octal or decimal */ + { /* stop if not a valid digit */ +- if ((!isdigit(aa.p->ch[aa.c])) || (aa.p->ch[aa.c] - '0' >= ctrl_r)) break; ++ if ((!isdigit((unsigned char)aa.p->ch[aa.c])) || (aa.p->ch[aa.c] - '0' >= ctrl_r)) break; + esp->val1 = esp->val1 * ctrl_r + (aa.p->ch[aa.c] - '0'); + } + else + { +- if (!isxdigit(aa.p->ch[aa.c])) break; +- esp->val1 = esp->val1 * 16 + ( (isdigit(aa.p->ch[aa.c])) ? +- aa.p->ch[aa.c] - '0' : mapch_l[aa.p->ch[aa.c]] - 'a' + 10); ++ if (!isxdigit((unsigned char)aa.p->ch[aa.c])) break; ++ esp->val1 = esp->val1 * 16 + ( (isdigit((unsigned char)aa.p->ch[aa.c])) ? ++ aa.p->ch[aa.c] - '0' : mapch_l[(unsigned char)aa.p->ch[aa.c]] - 'a' + 10); + } /* end of hex */ + } /* end of digit processing */ + } /* end of "for each char" */ diff --git a/editors/mflteco/patches/patch-te__fxstub.c b/editors/mflteco/patches/patch-te__fxstub.c new file mode 100644 index 00000000000..6c6045812fe --- /dev/null +++ b/editors/mflteco/patches/patch-te__fxstub.c @@ -0,0 +1,16 @@ +$NetBSD: patch-te__fxstub.c,v 1.1 2012/12/27 06:13:20 dholland Exp $ + +- declare void functions void +- use c89 + +--- te_fxstub.c~ 1993-08-05 22:29:34.000000000 +0000 ++++ te_fxstub.c +@@ -10,7 +10,7 @@ + + #include "te_defs.h" + +-te_fx() ++VOID te_fx(void) + { + ERROR(E_IFC); + } diff --git a/editors/mflteco/patches/patch-te__main.c b/editors/mflteco/patches/patch-te__main.c new file mode 100644 index 00000000000..7f8d057016c --- /dev/null +++ b/editors/mflteco/patches/patch-te__main.c @@ -0,0 +1,127 @@ +$NetBSD: patch-te__main.c,v 1.1 2012/12/27 06:13:20 dholland Exp $ + +- use standard headers +- move external function declarations to header file +- avoid implicit int +- declare void functions void +- use C89 some +- apply static to a couple local functions +- silence warnings about assignments in conditionals +- remove unused variables +- don't declare own getenv() + +--- te_main.c.orig 1993-08-05 22:29:34.000000000 +0000 ++++ te_main.c +@@ -49,20 +49,18 @@ + */ + + #include "te_defs.h" ++#include <stdlib.h> + #include <signal.h> +-#ifdef _AIX + #include <sys/ioctl.h> +-#endif + +-int cleanup(); ++static VOID save_args(int argc, char *argv[], struct qh *q); ++static VOID read_startup(void); ++static VOID print_string(int arg); + +-main(argc, argv) ++int main(argc, argv) + int argc; /* arg count */ + char *argv[]; /* array of string pointers */ + { +- int i; +- VOID init_wd(); +- + init_wd(); /* set working directory */ + save_args(argc, argv, &qreg[36]); /* copy command line to Qz */ + read_startup(); /* read startup file */ +@@ -74,7 +72,7 @@ main(argc, argv) + qsp = &qstack[-1]; /* initialize q-reg stack pointer */ + + /* set up error restart */ +- if (err = setjmp(xxx)) ++ if ((err = setjmp(xxx)) != 0) + { + if (err == E_EFI) goto quit; /* EOF from standard input - clean up and exit */ + crlf(); +@@ -125,7 +123,7 @@ main(argc, argv) + + /* reset screen state, keyboard state; remove open output files */ + +-cleanup() ++VOID cleanup(void) + { + window(WIN_OFF); /* restore screen */ + setup_tty(TTY_OFF); /* restore terminal */ +@@ -137,7 +135,7 @@ cleanup() + /* print string for error message */ + /* argument is subscript of a qreg qh, prints text from that buffer */ + +-print_string(arg) ++static VOID print_string(arg) + int arg; + { + int i, c; +@@ -158,7 +156,7 @@ print_string(arg) + } + /* copy invocation command line to a text buffer */ + +-save_args(argc, argv, q) ++static VOID save_args(argc, argv, q) + int argc; + char *argv[]; + struct qh *q; +@@ -196,7 +194,7 @@ save_args(argc, argv, q) + + char startup_name[] = "/.tecorc"; /* name of startup file */ + +-read_startup() ++static VOID read_startup(void) + { + char *hp, *getenv(); + char fn[CELLSIZE]; /* filename storage */ +@@ -206,7 +204,7 @@ read_startup() + + if (!(eisw = fopen(&startup_name[1], "r"))) + { +- if (hp = getenv("HOME")) /* if not found, look in home directory */ ++ if ((hp = getenv("HOME")) != NULL) /* if not found, look in home directory */ + { + for (i = 0; i < CELLSIZE; i++) if (!(fn[i] = *(hp++))) break; /* copy until trailing null */ + for (hp = &startup_name[0]; i < CELLSIZE; i++) if (!(fn[i] = *(hp++))) break; +@@ -242,7 +240,6 @@ VOID update_header() + char header_text[HEADER_SIZE+3]; + char *ps, *pd; + char *pdir; +- int i; + + if (toolsw != 0) /* if running under SunWindows */ + { +@@ -281,21 +278,20 @@ VOID update_header() + /* routine to get terminal height and width from termcap */ + + #ifdef NO_TERMCAP +-get_term_par() ++VOID get_term_par(void) + { + char *pname; +- char *getenv(); + struct winsize ws; + if (ioctl(fileno(stdin), TIOCGWINSZ, &ws) == 0) + set_term_par(ws.ws_row, ws.ws_col); +- if (pname=getenv("TERM")) { ++ if ((pname=getenv("TERM")) != NULL) { + make_buffer(&timbuf); /* put terminal name in q# */ + for (timbuf.z = 0; *pname != '\0'; ) + timbuf.f->ch[timbuf.z++] = *pname++; + } + } + #else /* USE_TERMCAP */ +-get_term_par() ++VOID get_term_par(void) + { + char tbuff[1024]; /* termcap buffer */ + char *pname; /* pointer to name of terminal */ diff --git a/editors/mflteco/patches/patch-te__srch.c b/editors/mflteco/patches/patch-te__srch.c new file mode 100644 index 00000000000..410490a244b --- /dev/null +++ b/editors/mflteco/patches/patch-te__srch.c @@ -0,0 +1,149 @@ +$NetBSD: patch-te__srch.c,v 1.1 2012/12/27 06:13:20 dholland Exp $ + +- use static for local functions +- don't index arrays with (signed) char +- use <ctype.h> functions correctly +- avoid implicit int +- remove unused variable + +--- te_srch.c~ 1993-08-05 22:29:35.000000000 +0000 ++++ te_srch.c +@@ -9,6 +9,8 @@ + + #include "te_defs.h" + ++static int srch_cmp(void); ++ + /* routine to read in a string with string-build characters */ + /* used for search, tag, file name operations */ + /* returns 0 if empty string entered, nonzero otherwise */ +@@ -44,17 +46,17 @@ int build_string(sbuff) + + case CTL('V'): /* take next char as lower case */ + if (getcmdc(trace_sw) == term_char) ERROR((msp <= &mstack[0]) ? E_UTC : E_UTM); +- c = mapch_l[cmdc]; ++ c = mapch_l[(unsigned char)cmdc]; + break; + + case CTL('W'): /* take next char as upper case */ + if ((c = getcmdc(trace_sw)) == term_char) ERROR((msp <= &mstack[0]) ? E_UTC : E_UTM); +- if (islower(c)) c = toupper(c); ++ if (islower((unsigned char)c)) c = toupper((unsigned char)c); + break; + + case CTL('E'): /* expanded constructs */ + if (getcmdc(trace_sw) == term_char) ERROR((msp <= &mstack[0]) ? E_UTC : E_UTM); +- switch (mapch_l[cmdc]) ++ switch (mapch_l[(unsigned char)cmdc]) + { + case 'u': /* use char in q-reg */ + if (getcmdc(trace_sw) == term_char) ERROR((msp <= &mstack[0]) ? E_UTC : E_UTM); +@@ -157,7 +159,7 @@ int setup_search() + /* routine to do N, _, E_ searches: search, if search fails, then get */ + /* next page and continue */ + +-do_nsearch(arg) ++int do_nsearch(arg) + char arg; /* arg is 'n', '_', or 'e' to define which search */ + { + int scount; /* search count */ +@@ -233,7 +235,7 @@ int do_search(count) + for (sb.p = aa.p, sb.c = aa.c, sb.dot = aa.dot, sm.p = sbuf.f, sm.dot = sm.c = 0; + (sb.dot < pbuff->z) && (sm.dot < sm.z); sm.dot++, sb.dot++) + { /* for each char in search string */ +- if (spec_chars[ sm.p->ch[sm.c] ] & A_A) /* if search string char is "special" */ ++ if (spec_chars[ (unsigned char)sm.p->ch[sm.c] ] & A_A) /* if search string char is "special" */ + { + if (!srch_cmp()) break; /* then use expanded comparison routine */ + } +@@ -290,7 +292,7 @@ int do_search(count) + for (sb.p = aa.p, sb.c = aa.c, sb.dot = aa.dot, sm.p = sbuf.f, sm.dot = sm.c = 0; + (sb.dot < last_z) && (sm.dot < sm.z); sm.dot++, sb.dot++) + { /* loop to compare string */ +- if (spec_chars[ sm.p->ch[sm.c] ] & A_A) /* if search string char is "special" */ ++ if (spec_chars[ (unsigned char)sm.p->ch[sm.c] ] & A_A) /* if search string char is "special" */ + { + if (!srch_cmp()) break; /* then use expanded comparison routine */ + } +@@ -345,13 +347,13 @@ int do_search(count) + /* expanded search comparison */ + /* returns 1 if match, 0 if not */ + +-int srch_cmp() ++static int srch_cmp(void) + { + int tq; /* q-reg name for ^EGq */ + struct qp tqp; /* pointer to read q reg */ +- int qq,oqq,i; ++ int qq,oqq; + +- switch (mapch_l[sm.p->ch[sm.c]]) /* what is search character */ ++ switch (mapch_l[(unsigned char)sm.p->ch[sm.c]]) /* what is search character */ + { + case CTL('N'): /* match anything but following construct */ + if (sm.dot >= sm.z) ERROR(E_ISS); /* don't read past end of string */ +@@ -368,36 +370,36 @@ int srch_cmp() + return(*(pmap + sb.p->ch[sb.c]) == *(pmap + sm.p->ch[sm.c])); + + case CTL('S'): /* match any nonalphanumeric */ +- return(!isalnum(sb.p->ch[sb.c])); ++ return(!isalnum((unsigned char)sb.p->ch[sb.c])); + + case CTL('E'): + if (sm.dot >= sm.z) ERROR(E_ISS); /* don't read past end of string */ + fwdc(&sm); /* skip the ^E */ +- switch (mapch_l[sm.p->ch[sm.c]]) ++ switch (mapch_l[(unsigned char)sm.p->ch[sm.c]]) + { + case 'a': /* match any alpha */ +- return(isalpha(sb.p->ch[sb.c])); ++ return(isalpha((unsigned char)sb.p->ch[sb.c])); + + case 'b': /* match any nonalpha */ +- return(!isalnum(sb.p->ch[sb.c])); ++ return(!isalnum((unsigned char)sb.p->ch[sb.c])); + + case 'c': /* rad50 symbol constituent */ +- return(isalnum(sb.p->ch[sb.c]) || (sb.p->ch[sb.c] == '$') || (sb.p->ch[sb.c] == '.')); ++ return(isalnum((unsigned char)sb.p->ch[sb.c]) || (sb.p->ch[sb.c] == '$') || (sb.p->ch[sb.c] == '.')); + + case 'd': /* digit */ +- return(isdigit(sb.p->ch[sb.c])); ++ return(isdigit((unsigned char)sb.p->ch[sb.c])); + + case 'l': /* line terminator LF, VT, FF */ + return((sb.p->ch[sb.c] == LF) || (sb.p->ch[sb.c] == FF) || (sb.p->ch[sb.c] == VT)); + + case 'r': /* alphanumeric */ +- return(isalnum(sb.p->ch[sb.c])); ++ return(isalnum((unsigned char)sb.p->ch[sb.c])); + + case 'v': /* lower case */ +- return(islower(sb.p->ch[sb.c])); ++ return(islower((unsigned char)sb.p->ch[sb.c])); + + case 'w': /* upper case */ +- return(isupper(sb.p->ch[sb.c])); ++ return(isupper((unsigned char)sb.p->ch[sb.c])); + case 's': /* any non-null string of spaces or tabs */ + if (((sb.p->ch[sb.c]&0177) != ' ') && ((sb.p->ch[sb.c]&0177) != TAB)) return(0); /* failure */ + /* skip remaining spaces or tabs */ +@@ -431,15 +433,15 @@ int srch_cmp() + for (qq=64; qq>0 ; qq/=8) { + if (sm.dot >= sm.z) ERROR(E_ISS); + fwdc(&sm); +- if (mapch_l[sm.p->ch[sm.c]] < '0' || mapch_l[sm.p->ch[sm.c]] > '7') ++ if (mapch_l[(unsigned char)sm.p->ch[sm.c]] < '0' || mapch_l[(unsigned char)sm.p->ch[sm.c]] > '7') + ERROR(E_ISS); +- oqq+=qq*(mapch_l[sm.p->ch[sm.c]] - '0'); ++ oqq+=qq*(mapch_l[(unsigned char)sm.p->ch[sm.c]] - '0'); + } + if (oqq > 255) + ERROR(E_ISS); + if (sm.dot >= sm.z) ERROR(E_ISS); + fwdc(&sm); +- if (mapch_l[sm.p->ch[sm.c]] != '>') ++ if (mapch_l[(unsigned char)sm.p->ch[sm.c]] != '>') + ERROR(E_ISS); + return((int)(sb.p->ch[sb.c]) == oqq); + diff --git a/editors/mflteco/patches/patch-te__subs.c b/editors/mflteco/patches/patch-te__subs.c new file mode 100644 index 00000000000..0321746dcf6 --- /dev/null +++ b/editors/mflteco/patches/patch-te__subs.c @@ -0,0 +1,153 @@ +$NetBSD: patch-te__subs.c,v 1.1 2012/12/27 06:13:20 dholland Exp $ + +- declare void functions void +- don't index arrays with (signed) char +- use <ctype.h> functions correctly + +--- te_subs.c.orig 1995-04-25 15:02:59.000000000 +0000 ++++ te_subs.c +@@ -21,7 +21,7 @@ + /* n is the returned number of chars moved */ + /* max is the maximum number of chars to move */ + +-movenchars(from, to, n) ++VOID movenchars(from, to, n) + struct qp *from, *to; /* address of buffer pointers */ + register int n; /* number of characters */ + { +@@ -80,7 +80,8 @@ movenchars(from, to, n) + to->c = tc; + } + } +-moveuntil(from, to, c, n, max, trace) ++ ++VOID moveuntil(from, to, c, n, max, trace) + struct qp *from, *to; /* address of buffer pointers */ + register char c; /* match char that ends move */ + int *n; /* pointer to returned value */ +@@ -166,7 +167,7 @@ int lines(arg) + if (!(p = p->b)) break; + c = CELLSIZE - 1; + } +- if ( (ez_val & EZ_NOVTFF) ? (p->ch[c] == LF) : (spec_chars[p->ch[c]] & A_L) ) ++arg; /* if line sep found */ ++ if ( (ez_val & EZ_NOVTFF) ? (p->ch[c] == LF) : (spec_chars[(unsigned char)p->ch[c]] & A_L) ) ++arg; /* if line sep found */ + } + if (arg > 0) ++i; /* if terminated on a line separator, advance over the separator */ + } +@@ -175,7 +176,7 @@ int lines(arg) + { + for (i = pbuff->dot; (arg > 0) && (i < pbuff->z); i++) + { +- if ( (ez_val & EZ_NOVTFF) ? (p->ch[c] == LF) : (spec_chars[p->ch[c]] & A_L) ) --arg; ++ if ( (ez_val & EZ_NOVTFF) ? (p->ch[c] == LF) : (spec_chars[(unsigned char)p->ch[c]] & A_L) ) --arg; + if (++c > CELLSIZE-1) + { + if (!(p = p->f)) break; +@@ -241,19 +242,19 @@ int getqspec(fors, c) /* fors ("file or + int fors; + char c; + { +- if (isdigit(c)) ++ if (isdigit((unsigned char)c)) + return(c - '0' + 1); +- else if (isalpha(c)) return(mapch_l[c] - 'a' + 11); ++ else if (isalpha((unsigned char)c)) return(mapch_l[(unsigned char)c] - 'a' + 11); + else if (c == '`') + { +- if (isdigit(c = getcmdc(trace_sw))) return (EXTQREGS + c - '0'); +- else if (isalpha(c)) return (EXTQREGS + 10 + mapch_l[c] - 'a'); ++ if (isdigit((unsigned char)(c = getcmdc(trace_sw)))) return (EXTQREGS + c - '0'); ++ else if (isalpha((unsigned char)c)) return (EXTQREGS + 10 + mapch_l[(unsigned char)c] - 'a'); + else ERROR(E_IQN); + } + else if (c == '~') + { +- if (isdigit(c = getcmdc(trace_sw))) return (EXTQREGS + NEXTQREGS/2 + c - '0'); +- else if (isalpha(c)) return (EXTQREGS + NEXTQREGS/2 + 10 + mapch_l[c] - 'a'); ++ if (isdigit((unsigned char)(c = getcmdc(trace_sw)))) return (EXTQREGS + NEXTQREGS/2 + c - '0'); ++ else if (isalpha((unsigned char)c)) return (EXTQREGS + NEXTQREGS/2 + 10 + mapch_l[(unsigned char)c] - 'a'); + else ERROR(E_IQN); + } + else if (fors) +@@ -276,7 +277,7 @@ int getqspec(fors, c) /* fors ("file or + + struct buffcell *insert_p; + +-insert1() ++VOID insert1(void) + { + int nchars; /* number of chars in cell */ + +@@ -293,7 +294,8 @@ insert1() + + movenchars(&aa, &bb, nchars); /* copy cell up to dot */ + } +-insert2(count) /* count is the number of chars added */ ++ ++VOID insert2(count) /* count is the number of chars added */ + int count; + { + aa.p->b->f = insert_p; /* put the new cell where the old one was */ +@@ -314,7 +316,7 @@ insert1() + /* subroutine to delete n characters starting at dot */ + /* argument is number of characters */ + +-delete1(nchars) ++VOID delete1(nchars) + int nchars; + { + if (!nchars) return; /* 0 chars is a nop */ +@@ -339,7 +341,7 @@ delete1(nchars) + + struct qh obuff; /* tag string buffer */ + +-do_o() ++VOID do_o(void) + { + int i, j; /* i used as start of tag, j as end */ + int p, level; /* p is pointer to tag string, level is iteration lvl */ +@@ -400,7 +402,7 @@ do_o() + for (p = i; p < j; p++) + { + if (getcmdc(0) == '!') epfound = 1; /* mark "trailing ! found */ +- if (mapch_l[cmdc] != mapch_l[obuff.f->ch[p]]) break; /* compare */ ++ if (mapch_l[(unsigned char)cmdc] != mapch_l[(unsigned char)obuff.f->ch[p]]) break; /* compare */ + } + if (p >= j) /* if all comparison chars matched */ + { +@@ -426,7 +428,7 @@ char skipto(arg) + + for (atsw = 0; ;) /* forever */ + { +- while (!(ta = spec_chars[skipc = getcmdc(0)] & (A_X | A_S | A_T | A_Q))); /* read until something interesting found */ ++ while (!(ta = spec_chars[(unsigned char)(skipc = getcmdc(0))] & (A_X | A_S | A_T | A_Q))); /* read until something interesting found */ + + again: + if (ta & A_Q) if((tb = getcmdc(0)) == '`' || tb == '~') getcmdc(0); /* if command takes a Q spec, skip the spec */ +@@ -440,7 +442,7 @@ char skipto(arg) + switch (skipc) + { + case '^': /* treat next char as CTL */ +- if (ta = spec_chars[skipc = getcmdc(0) & 0x1f]) goto again; ++ if ((ta = spec_chars[(unsigned char)(skipc = getcmdc(0) & 0x1f)]) != 0) goto again; + break; + + case '@': /* use alternative text terminator */ +@@ -464,7 +466,7 @@ char skipto(arg) + + case 'e': /* first char of two-letter E or F command */ + case 'f': +- if (spec_chars[getcmdc(0)] & ((skipc == 'e') ? A_E : A_F)) /* if one with a text arg */ ++ if (spec_chars[(unsigned char)getcmdc(0)] & ((skipc == 'e') ? A_E : A_F)) /* if one with a text arg */ + { + term = (atsw) ? getcmdc(0) : ESC; + atsw = 0; +@@ -485,7 +487,7 @@ char skipto(arg) + + /* find number of characters to next matching (, [, or { (like '%' in vi) */ + +-do_ctlp() ++VOID do_ctlp(void) + { + int i, l; + char c, c1; diff --git a/editors/mflteco/patches/patch-te__utils.c b/editors/mflteco/patches/patch-te__utils.c new file mode 100644 index 00000000000..f2f44c3793e --- /dev/null +++ b/editors/mflteco/patches/patch-te__utils.c @@ -0,0 +1,115 @@ +$NetBSD: patch-te__utils.c,v 1.1 2012/12/27 06:13:20 dholland Exp $ + +- use standard headers +- don't declare own malloc +- fix signed/unsigned mismatches +- remove useless/dangerous cast +- declare void functions void +- avoid implicit int +- don't index arrays with signed char + +--- te_utils.c.orig 1993-08-05 22:29:35.000000000 +0000 ++++ te_utils.c +@@ -7,6 +7,7 @@ + /* improved dly_freebuf 03/30/92 11.23 */ + + #include "te_defs.h" ++#include <stdlib.h> + + /* routines to handle storage */ + /* get a buffcell */ +@@ -14,13 +15,12 @@ + + struct buffcell *get_bcell() + { +- char *malloc(); + struct buffcell *p; +- int i; ++ unsigned i; + + if (freebuff == NULL) + { +- p = (struct buffcell *) malloc(BLOCKSIZE); ++ p = malloc(BLOCKSIZE); + if (!p) ERROR(E_MEM); + else + { +@@ -40,7 +40,7 @@ struct buffcell *get_bcell() + + + /* free a list of buffcells */ +-free_blist(p) ++VOID free_blist(p) + struct buffcell *p; + { + struct buffcell *t; +@@ -53,7 +53,7 @@ free_blist(p) + } + } + /* free a list of buffcells to the "delayed free" list */ +-dly_free_blist(p) ++VOID dly_free_blist(p) + struct buffcell *p; + { + struct buffcell *t; +@@ -110,7 +110,7 @@ VOID reset_q_usecounts() + struct is *get_dcell() + { + struct is *t; +- int i; ++ unsigned i; + + if (freedcell == NULL) + { +@@ -129,7 +129,7 @@ struct is *get_dcell() + } + /* build a buffer: called with address of a qh */ + /* if no buffer there, get a cell and link it in */ +-make_buffer(p) ++VOID make_buffer(p) + struct qh *p; + { + if (!(p->f)) +@@ -163,7 +163,7 @@ int fwdc(arg) + return(1); + } + +-fwdcx(arg) ++int fwdcx(arg) + struct qp *arg; + { + if ((*arg).c >= CELLSIZE-1) /* test char count for max */ +@@ -200,7 +200,7 @@ fwdcx(arg) + + /* set up a pointer to a particular text buffer position */ + +-set_pointer(pos, ptr) /* first arg is position, 2nd is addr of pointer */ ++VOID set_pointer(pos, ptr) /* first arg is position, 2nd is addr of pointer */ + int pos; + struct qp *ptr; + { +@@ -225,7 +225,7 @@ set_pointer(pos, ptr) /* first arg is po + /* if pushcmdc() has returned any chars, read them first */ + /* routines type characters as read, if argument != 0 */ + +-char getcmdc0(trace) ++char getcmdc0(int trace) + { + while (cptr.dot >= cptr.z) /* if at end of this level, pop macro stack */ + { +@@ -252,7 +252,7 @@ char getcmdc0(trace) + } + + +-char getcmdc(trace) ++char getcmdc(int trace) + { + if (cptr.dot++ >= cptr.z) ERROR((msp <= &mstack[0]) ? E_UTC : E_UTM); + else +@@ -273,5 +273,5 @@ char getcmdc(trace) + int peekcmdc(arg) + char arg; + { +- return(((cptr.dot < cptr.z) && (mapch_l[cptr.p->ch[cptr.c]] == mapch_l[arg])) ? 1 : 0); ++ return(((cptr.dot < cptr.z) && (mapch_l[(unsigned char)cptr.p->ch[cptr.c]] == mapch_l[(unsigned char)arg])) ? 1 : 0); + } diff --git a/editors/mflteco/patches/patch-te__window.c b/editors/mflteco/patches/patch-te__window.c new file mode 100644 index 00000000000..b204def8a54 --- /dev/null +++ b/editors/mflteco/patches/patch-te__window.c @@ -0,0 +1,399 @@ +$NetBSD: patch-te__window.c,v 1.1 2012/12/27 06:13:20 dholland Exp $ + +- remove unused variables +- fix signed/unsigned issues +- use static for local functions +- declare own functions +- declare void functions void +- use c89 +- don't index arrays with (signed) char +- patch up two uninitialized variables +- silence warnings about assignments in conditionals +- #if out unused function putchar_d() +- silence unnecessary pointer width warning + +--- te_window.c.orig 1995-04-25 15:02:41.000000000 +0000 ++++ te_window.c +@@ -78,16 +78,37 @@ char win_dlyc[] = { 0, 2, 1, 0, 0, 0, + int rate[] = { 0, 0, 9600, 4800, 2400, 1800, 1200, 600, 300, 200, 150, 134, 110 }; + #define NSPEEDS (sizeof(win_speeds) / sizeof(char)) + #endif +-int real_win_speed = 0; ++static unsigned real_win_speed = 0; + #define win_speed ((ez_val & EZ_NOFILL) ? 0: real_win_speed) +-static int brate = 0; ++ ++static VOID window0(int num); ++static VOID window1_both(void); ++static VOID window1(void); ++static VOID window1_abs(void); ++static VOID window1_inc(int wd); ++static VOID window1_after(void); ++static VOID w_rmcurs(void); ++static VOID window2(int arg); ++static VOID vtm(int arg); ++static VOID w_makecurs(char wc, short crflag); ++static int w_overflow(int wd); ++static VOID w_type(char c, int m); ++static VOID w_init(void); ++static VOID w_separators(void); ++static VOID w_move(short y, short x); ++static VOID w_scroll(int count); ++static VOID w_ebol(void); ++static int w_setptr(struct bh *pbuff, register int loc, ++ register struct qp *pp); ++static int w_lines(int n, register struct qp *ps, register struct qp *pd); ++ + /* routine to perform simple scope operations */ + /* (an attempt to concentrate VT-100 specific things in one place) */ + +-vt(func) ++VOID vt(func) + int func; + { +- short t; ++ unsigned t; + switch (func) + { + case VT_CLEAR: /* clear screen */ +@@ -141,7 +162,7 @@ int win_min[] = { 4, 20, 4, 0, 0, + int win_max[] = { 4, W_MAX_H, W_MAX_V, 3, MAX, 12, -1, 20, 20, -1, -1 } ; /* max values */ + int win_data[] = { 4, 132, 24, 0, 0, 0, 0, 0, 0, 0, 0 } ; /* window parameters */ + +-do_window(ref_flag) ++VOID do_window(ref_flag) + int ref_flag; /* nonzero forces "refresh" operation */ + { + int i; +@@ -149,7 +170,7 @@ do_window(ref_flag) + if (colonflag && !ref_flag) + { + i = get_value(0); /* get sub-function */ +- if ((i < 0) || (i > (sizeof(win_data)/sizeof(int)))) ERROR(E_IWA); ++ if ((i < 0) || (i > (int)(sizeof(win_data)/sizeof(int)))) ERROR(E_IWA); + if (!esp->flag2) /* it's a "get" */ + { + esp->val1 = win_data[i]; +@@ -205,7 +226,7 @@ do_window(ref_flag) + /* routine to update screen size with numbers obtained from environment */ + /* (called by main program's initialization) */ + +-set_term_par(lines, cols) ++VOID set_term_par(lines, cols) + int lines, cols; + { + if ((lines >= win_min[2]) && (lines <= win_max[2])) win_1.size = win_data[2] = lines, win_1.end = lines - 1; +@@ -223,7 +244,7 @@ set_term_par(lines, cols) + /* WIN_LINE: does WIN_REFR unless that wouldn't do anything, in which case */ + /* it does effective 1EV output */ + +-window(arg) ++VOID window(arg) + int arg; + { + int i; +@@ -308,8 +329,7 @@ window(arg) + /* used for ev, es, and <BS> or <LF> as immediate commands */ + /* starting char position is in w_p1; argument is number of lines */ + +-window0(num) +-int num; ++static VOID window0(int num) + { + int wi; + char wc; /* temp char */ +@@ -319,7 +339,7 @@ int num; + { + wc = w_p1.p->ch[w_p1.c]; /* get character */ + +- if ((char_count >= WN_width) && (wc != CR) && !(spec_chars[wc] & A_L)) /* if about to exceed width */ ++ if ((char_count >= WN_width) && (wc != CR) && !(spec_chars[(unsigned char)wc] & A_L)) /* if about to exceed width */ + { + if (et_val & ET_TRUNC) goto w0_noprint; /* truncate: don't print this */ + else +@@ -383,7 +403,7 @@ int num; + + struct bh *old_pbuff; + +-window1_both() ++static VOID window1_both(void) + { + pw0 = &win_1; + pb0 = &buffs[0]; +@@ -414,12 +434,14 @@ window1_both() + /* if scroll mode is enabled, the VT100 screen is split and only the upper part */ + /* is used by this routine; else the whole screen is used. */ + +-window1() ++static VOID window1(void) + { + int i, j, m, lflag; + register struct bh *pb = pb0; + register struct w_data *pw = pw0; + ++ lflag = 0; /* XXX is this right? */ ++ + /* return if nothing has changed */ + if (!redraw_sw && (pbuff == old_pbuff) && (pb->dot == pw->last_dot) && (pb->buff_mod == MAX)) return; + +@@ -514,7 +536,7 @@ window1() + } + /* routine to redraw screen absolutely */ + +-window1_abs() ++static VOID window1_abs(void) + { + int i, j; + struct bh *save_pbuff; /* save old pbuff during set_pointer call */ +@@ -545,8 +567,8 @@ window1_abs() + + /* redraw screen incrementally */ + +-window1_inc(wd) +- int wd; /* argument is earliest change */ ++static VOID window1_inc(int wd) ++ /* argument is earliest change */ + { + short temp_y; + register struct bh *pb = pb0; +@@ -572,12 +594,14 @@ window1_inc(wd) + } + /* routine to move window downwards: scroll up or redraw as appropriate */ + +-window1_after() ++static VOID window1_after(void) + { + int i, lflag; + register struct bh *pb = pb0; + register struct w_data *pw = pw0; + ++ lflag = 0; /* XXX: is this right? */ ++ + w_rmcurs(); /* remove old cursor */ + w_setptr(pb, wlp[pw->end]->start, &w_p1); /* set pointer to start of last line on screen */ + +@@ -604,7 +628,7 @@ window1_after() + + /* routine to remove the existing cursor */ + +-w_rmcurs() ++static VOID w_rmcurs(void) + { + register struct w_data *pw = pw0; + +@@ -621,8 +645,7 @@ w_rmcurs() + /* called with w_p1 at starting char, curr_y, curr_x at starting coordinate */ + /* rewrites to end of screen if arg = 0, or only until line with cursor if arg = 1 */ + +-window2(arg) +- int arg; ++static VOID window2(int arg) + { + register struct bh *pb = pb0; + register struct w_data *pw = pw0; +@@ -635,7 +658,7 @@ window2(arg) + for (wdot = w_p1.dot; (curr_y <= pw->end) && (wdot < pb->z); wdot++) /* for each character */ + { + wc = w_p1.p->ch[w_p1.c] & 0177; /* get character */ +- if (dflag = (wdot == pb->dot)) if (arg) arg = -1; /* save "this is char at dot", "on line with dot" */ ++ if ((dflag = (wdot == pb->dot)) != 0) if (arg) arg = -1; /* save "this is char at dot", "on line with dot" */ + + if (wc < ' ') switch (wc) /* dispatch control characters */ + { +@@ -821,7 +844,7 @@ window2(arg) + wc = 'c'; /* get character */ + else + wc = '`'; /* get character */ +- if (dflag = (wdot == pb->dot)) if (arg) arg = -1; /* save "this is char at dot", "on line with dot" */ ++ if ((dflag = (wdot == pb->dot)) != 0) if (arg) arg = -1; /* save "this is char at dot", "on line with dot" */ + if (curr_x >= WN_width) + { + if (et_val & ET_TRUNC) goto noprint; +@@ -856,8 +879,7 @@ window2(arg) + } + /* routine to move cursor to current location and then call vt */ + +-vtm(arg) +- int arg; ++static VOID vtm(int arg) + { + w_move(curr_y, curr_x); + vt(arg); +@@ -869,9 +891,7 @@ vtm(arg) + /* routine to set reverse video and save cursor location */ + /* first argument is char at cursor, 2nd is value for curs_crflag */ + +-w_makecurs(wc, crflag) +- char wc; +- short crflag; ++static VOID w_makecurs(char wc, short crflag) + { + register struct w_data *pw = pw0; + +@@ -888,7 +908,7 @@ w_makecurs(wc, crflag) + /* returns nonzero if at end of screen, zero otherwise */ + /* arg is current character position */ + +-int w_overflow(wd) ++static int w_overflow(int wd) + { + register struct w_data *pw = pw0; + +@@ -912,12 +932,11 @@ int w_overflow(wd) + /* routine to type one character: arguments are char and a */ + /* "mark" bit. If mark is set, the char is always retyped */ + +-w_type(c, m) ++static VOID w_type(c, m) + char c; + int m; + { + register char *p; +- register struct w_data *pw = pw0; + + p = &wlp[curr_y]->ch[curr_x]; /* pointer to char image */ + if ((c != *p) || (m) || (redraw_sw) || (curr_x >= wlp[curr_y]->n)) +@@ -936,7 +955,7 @@ w_type(c, m) + + /* initialize display image */ + +-w_init() ++static VOID w_init(void) + { + short i, j; + +@@ -968,7 +987,7 @@ w_init() + + /* write separator lines between windows on screen */ + +-w_separators() ++static VOID w_separators(void) + { + int i; + +@@ -990,29 +1009,30 @@ w_separators() + /* put character followed by appropriate number of nulls for "other control function" */ + /* if argument is 0, output filler chars only */ + +-putchar_d(c) +- char c; ++#if 0 /* not used */ ++static VOID putchar_d(char c) + { +- int i; ++ unsigned i; + + if (c) putchar(c); /* output character */ + for (i = 0; i < win_dlyc[win_speed]; i++) putchar('\0'); /* output filler */ + } ++#endif + + + + /* put out appropriate number of filler chars for display function that scrolls (LF, etc.) */ + +-scroll_dly() ++VOID scroll_dly(void) + { +- int i; ++ unsigned i; + + for (i = 0; i < win_dlys[win_speed]; i++) putchar('\0'); /* output filler */ + } + /* move terminal cursor to stated y, x position */ + /* uses incremental moves or absolute cursor position, whichever is shorter */ + +-w_move(y, x) ++static VOID w_move(y, x) + short y, x; + { + register short i; +@@ -1052,10 +1072,9 @@ w_move(y, x) + } + /* scroll screen: argument is count: + up, - down */ + +-w_scroll(count) +- int count; ++static VOID w_scroll(int count) + { +- register int i, ic; ++ register int i; + struct w_line *p[W_MAX_V]; /* temp copy of pointer array */ + register struct w_data *pw = pw0; + +@@ -1084,10 +1103,9 @@ w_scroll(count) + /* clear line to left of curr_x */ + /* if some chars nonblank, does erase from start of line */ + +-w_ebol() ++static VOID w_ebol(void) + { + short i, j; +- register struct w_data *pw = pw0; + + for (j = i = 0; i < curr_x; i++) if (wlp[curr_y]->ch[i] != ' ') wlp[curr_y]->ch[i] = ' ', j++; + if (j || redraw_sw) w_move(curr_y, curr_x-1), vt(VT_EBOL); +@@ -1098,7 +1116,7 @@ w_ebol() + /* routine to set a pointer to a given location (like set_pointer) */ + /* returns nonzero if a text buffer exists, otherwise 0 */ + +-int w_setptr(pbuff, loc, pp) ++static int w_setptr(pbuff, loc, pp) + struct bh *pbuff; /* current buffer header */ + register int loc; /* location */ + register struct qp *pp; /* address of pointer */ +@@ -1111,7 +1129,7 @@ int w_setptr(pbuff, loc, pp) + pp->c = loc % CELLSIZE; + pp->dot = loc; + } +- return( (int) pbuff->f); ++ return( pbuff->f != NULL ); + } + /* routine to move N lines (back, forward, or 0) */ + /* w_lines(n, &source, &dest) where n is the line count, source */ +@@ -1121,7 +1139,7 @@ int w_setptr(pbuff, loc, pp) + + struct qp w_lines_p; /* to compute # of display lines in -N lines */ + +-int w_lines(n, ps, pd) ++static int w_lines(n, ps, pd) + int n; /* number of lines */ + register struct qp *ps, *pd; /* source, destination qp's */ + { +@@ -1138,7 +1156,7 @@ int w_lines(n, ps, pd) + { + for (tcnt = tl = tn = 0; (tn < n) && (tdot < pb0->z); tdot++) /* forward over N line separators */ + { +- if (spec_chars[ tch = tp->ch[tc] ] & A_L) ++tl, ++tn; /* count separators */ ++ if (spec_chars[ (unsigned char)(tch = tp->ch[tc]) ] & A_L) ++tl, ++tn; /* count separators */ + else if (!(et_val & ET_TRUNC)) /* if text lines can overflow screen lines */ + { + if (!(tch & 0140)) /* if character is a control char */ +@@ -1166,7 +1184,7 @@ int w_lines(n, ps, pd) + { + --tdot; + if (--tc < 0) tp = tp->b, tc = CELLSIZE -1; +- if (spec_chars[tp->ch[tc]] & A_L) --tn; ++ if (spec_chars[(unsigned char)tp->ch[tc]] & A_L) --tn; + } + if (tn < n) /* if stopped on a line sep, fwd over it */ + { +@@ -1187,8 +1205,7 @@ int w_lines(n, ps, pd) + } + /* routine to move n chars on line */ + /* call with # of columns, return new dot value */ +-int x_to_dot(x) +- int x; ++static int x_to_dot(int x) + { + struct qp m_dot; + int m_count; +@@ -1227,7 +1244,7 @@ int last_dis_buff; + int last_dis_x; + int last_dis_wrap; + +-VOID display_lines() ++VOID display_lines(void) + { + int dis_buff = (pbuff == &buffs[0]) ? 0 : 1 ; /* current buffer */ + struct w_data *pw = dis_buff ? &win_2 : &win_1 ; |