summaryrefslogtreecommitdiff
path: root/usr.bin/vi
diff options
context:
space:
mode:
authorRay Lai <ray@cvs.openbsd.org>2006-03-11 06:58:01 +0000
committerRay Lai <ray@cvs.openbsd.org>2006-03-11 06:58:01 +0000
commitd0404b721f4974d730b2175f03bee21d10fdecd1 (patch)
treef5ae7d1e6382cc9050d9960cd03926c1f2747b68 /usr.bin/vi
parent746279f1e389cf221d7b62b73e3a084f593e1e3c (diff)
Silence 39 warnings.
ok miod, otto
Diffstat (limited to 'usr.bin/vi')
-rw-r--r--usr.bin/vi/cl/cl_bsd.c4
-rw-r--r--usr.bin/vi/cl/cl_funcs.c7
-rw-r--r--usr.bin/vi/cl/cl_main.c7
-rw-r--r--usr.bin/vi/common/msg.c23
-rw-r--r--usr.bin/vi/ex/ex_print.c4
-rw-r--r--usr.bin/vi/ex/ex_read.c7
-rw-r--r--usr.bin/vi/ex/ex_tag.c7
-rw-r--r--usr.bin/vi/ex/ex_visual.c6
-rw-r--r--usr.bin/vi/vi/v_txt.c4
-rw-r--r--usr.bin/vi/vi/vs_line.c8
-rw-r--r--usr.bin/vi/vi/vs_refresh.c8
-rw-r--r--usr.bin/vi/vi/vs_split.c6
12 files changed, 56 insertions, 35 deletions
diff --git a/usr.bin/vi/cl/cl_bsd.c b/usr.bin/vi/cl/cl_bsd.c
index cdf22ce1eb0..da525ae939a 100644
--- a/usr.bin/vi/cl/cl_bsd.c
+++ b/usr.bin/vi/cl/cl_bsd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cl_bsd.c,v 1.8 2003/04/17 02:22:56 itojun Exp $ */
+/* $OpenBSD: cl_bsd.c,v 1.9 2006/03/11 06:58:00 ray Exp $ */
/*-
* Copyright (c) 1995, 1996
@@ -31,9 +31,11 @@ static const char sccsid[] = "@(#)cl_bsd.c 8.29 (Berkeley) 7/1/96";
#include "../vi/vi.h"
#include "cl.h"
+#ifndef HAVE_CURSES_SETUPTERM
static char *ke; /* Keypad on. */
static char *ks; /* Keypad off. */
static char *vb; /* Visible bell string. */
+#endif
/*
* HP's support the entire System V curses package except for the tigetstr
diff --git a/usr.bin/vi/cl/cl_funcs.c b/usr.bin/vi/cl/cl_funcs.c
index 2346627fae5..41ba272c384 100644
--- a/usr.bin/vi/cl/cl_funcs.c
+++ b/usr.bin/vi/cl/cl_funcs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cl_funcs.c,v 1.10 2003/07/18 23:11:43 david Exp $ */
+/* $OpenBSD: cl_funcs.c,v 1.11 2006/03/11 06:58:00 ray Exp $ */
/*-
* Copyright (c) 1993, 1994
@@ -281,9 +281,12 @@ int
cl_deleteln(sp)
SCR *sp;
{
+#ifndef mvchgat
CHAR_T ch;
+ size_t col, lno, spcnt;
+#endif
CL_PRIVATE *clp;
- size_t col, lno, spcnt, oldy, oldx;
+ size_t oldy, oldx;
clp = CLP(sp);
diff --git a/usr.bin/vi/cl/cl_main.c b/usr.bin/vi/cl/cl_main.c
index 7d5a32bf160..60bcc550358 100644
--- a/usr.bin/vi/cl/cl_main.c
+++ b/usr.bin/vi/cl/cl_main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cl_main.c,v 1.15 2006/01/08 21:05:39 miod Exp $ */
+/* $OpenBSD: cl_main.c,v 1.16 2006/03/11 06:58:00 ray Exp $ */
/*-
* Copyright (c) 1993, 1994
@@ -62,7 +62,10 @@ main(argc, argv)
GS *gp;
size_t rows, cols;
int rval;
- char *ip_arg, **p_av, **t_av, *ttype;
+ char *ip_arg, *ttype;
+#ifdef RUNNING_IP
+ char **p_av, **t_av;
+#endif
/* If loaded at 0 and jumping through a NULL pointer, stop. */
if (reenter++)
diff --git a/usr.bin/vi/common/msg.c b/usr.bin/vi/common/msg.c
index 61a512a9c7b..a1a9827ad9d 100644
--- a/usr.bin/vi/common/msg.c
+++ b/usr.bin/vi/common/msg.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: msg.c,v 1.15 2006/01/08 21:05:39 miod Exp $ */
+/* $OpenBSD: msg.c,v 1.16 2006/03/11 06:58:00 ray Exp $ */
/*-
* Copyright (c) 1991, 1993, 1994
@@ -55,11 +55,16 @@ msgq(SCR *sp, mtype_t mt, const char *fmt, ...)
} str[__NL_ARGMAX];
#endif
static int reenter; /* STATIC: Re-entrancy check. */
- CHAR_T ch;
GS *gp;
- size_t blen, cnt1, cnt2, len, mlen, nlen, soff;
- const char *p, *t, *u;
- char *bp, *mp, *rbp, *s_rbp;
+ size_t blen, len, mlen, nlen;
+ const char *p;
+ char *bp, *mp;
+#ifndef NL_ARGMAX
+ size_t cnt1, cnt2, soff;
+ CHAR_T ch;
+ const char *t, *u;
+ char *rbp, *s_rbp;
+#endif
va_list ap;
/*
@@ -259,9 +264,10 @@ retry: FREE_SPACE(sp, bp, blen);
}
*s_rbp = '\0';
fmt = rbp;
-#endif
-format: /* Format the arguments into the string. */
+format:
+#endif
+ /* Format the arguments into the string. */
va_start(ap, fmt);
len = vsnprintf(mp, REM, fmt, ap);
va_end(ap);
@@ -457,7 +463,7 @@ mod_rpt(sp)
*p++ = ' ';
tlen += 2;
}
- len = snprintf(p, MAXNUM, "%lu ", sp->rptlines[cnt]);
+ len = snprintf(p, MAXNUM, "%u ", sp->rptlines[cnt]);
p += len;
tlen += len;
t = msg_cat(sp,
@@ -501,7 +507,6 @@ msgq_status(sp, lno, flags)
recno_t lno;
u_int flags;
{
- static int poisoned;
recno_t last;
size_t blen, len;
int cnt, needsep;
diff --git a/usr.bin/vi/ex/ex_print.c b/usr.bin/vi/ex/ex_print.c
index 4ff0bc6af34..22dcbfff592 100644
--- a/usr.bin/vi/ex/ex_print.c
+++ b/usr.bin/vi/ex/ex_print.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ex_print.c,v 1.6 2002/02/19 19:39:39 millert Exp $ */
+/* $OpenBSD: ex_print.c,v 1.7 2006/03/11 06:58:00 ray Exp $ */
/*-
* Copyright (c) 1992, 1993, 1994
@@ -119,7 +119,7 @@ ex_print(sp, cmdp, fp, tp, flags)
*/
if (LF_ISSET(E_C_HASH)) {
if (from <= 999999) {
- snprintf(buf, sizeof(buf), "%6ld ", from);
+ snprintf(buf, sizeof(buf), "%6lu ", (ulong)from);
p = buf;
} else
p = "TOOBIG ";
diff --git a/usr.bin/vi/ex/ex_read.c b/usr.bin/vi/ex/ex_read.c
index 7a104885994..4cbb356060c 100644
--- a/usr.bin/vi/ex/ex_read.c
+++ b/usr.bin/vi/ex/ex_read.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ex_read.c,v 1.7 2002/02/16 21:27:57 millert Exp $ */
+/* $OpenBSD: ex_read.c,v 1.8 2006/03/11 06:58:00 ray Exp $ */
/*-
* Copyright (c) 1992, 1993, 1994
@@ -68,6 +68,8 @@ ex_read(sp, cmdp)
switch (cmdp->argc) {
case 0:
which = R_ARG;
+ arg = NULL; /* unused */
+ arglen = 0; /* unused */
break;
case 1:
arg = cmdp->argv[0]->bp;
@@ -241,6 +243,9 @@ ex_read(sp, cmdp)
}
break;
+ default:
+ abort();
+ /* NOTREACHED */
}
/*
diff --git a/usr.bin/vi/ex/ex_tag.c b/usr.bin/vi/ex/ex_tag.c
index ea4ccc9a1cc..b5d5043b180 100644
--- a/usr.bin/vi/ex/ex_tag.c
+++ b/usr.bin/vi/ex/ex_tag.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ex_tag.c,v 1.12 2006/01/08 21:05:40 miod Exp $ */
+/* $OpenBSD: ex_tag.c,v 1.13 2006/03/11 06:58:00 ray Exp $ */
/*-
* Copyright (c) 1992, 1993, 1994
@@ -406,7 +406,7 @@ ex_tag_pop(sp, cmdp)
EXCMD *cmdp;
{
EX_PRIVATE *exp;
- TAGQ *tqp, *dtqp;
+ TAGQ *tqp, *dtqp = NULL;
size_t arglen;
long off;
char *arg, *p, *t;
@@ -470,6 +470,7 @@ filearg: arglen = strlen(arg);
break;
default:
abort();
+ /* NOTREACHED */
}
return (tag_pop(sp, dtqp, FL_ISSET(cmdp->iflags, E_C_FORCE)));
@@ -571,7 +572,7 @@ ex_tag_display(sp)
TAGQ *tqp;
int cnt;
size_t len;
- char *p, *sep;
+ char *p;
exp = EXP(sp);
if ((tqp = CIRCLEQ_FIRST(&exp->tq)) == CIRCLEQ_END(&exp->tq)) {
diff --git a/usr.bin/vi/ex/ex_visual.c b/usr.bin/vi/ex/ex_visual.c
index be9aeb81d3b..74bc5f8846e 100644
--- a/usr.bin/vi/ex/ex_visual.c
+++ b/usr.bin/vi/ex/ex_visual.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ex_visual.c,v 1.6 2002/02/16 21:27:57 millert Exp $ */
+/* $OpenBSD: ex_visual.c,v 1.7 2006/03/11 06:58:00 ray Exp $ */
/*-
* Copyright (c) 1992, 1993, 1994
@@ -83,9 +83,9 @@ ex_visual(sp, cmdp)
if (FL_ISSET(cmdp->iflags, E_C_COUNT))
len = snprintf(buf, sizeof(buf),
- "%luz%c%lu", sp->lno, pos, cmdp->count);
+ "%luz%c%lu", (ulong)sp->lno, pos, cmdp->count);
else
- len = snprintf(buf, sizeof(buf), "%luz%c", sp->lno, pos);
+ len = snprintf(buf, sizeof(buf), "%luz%c", (ulong)sp->lno, pos);
if (len >= sizeof(buf))
len = sizeof(buf) - 1;
(void)v_event_push(sp, NULL, buf, len, CH_NOMAP | CH_QUOTED);
diff --git a/usr.bin/vi/vi/v_txt.c b/usr.bin/vi/vi/v_txt.c
index 43aee09e0d0..c60b0e39653 100644
--- a/usr.bin/vi/vi/v_txt.c
+++ b/usr.bin/vi/vi/v_txt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: v_txt.c,v 1.18 2006/01/08 21:06:39 miod Exp $ */
+/* $OpenBSD: v_txt.c,v 1.19 2006/03/11 06:58:00 ray Exp $ */
/*-
* Copyright (c) 1993, 1994
@@ -258,7 +258,7 @@ v_txt(sp, vp, tm, lp, len, prompt, ai_line, rcount, flags)
u_long rcount; /* Replay count. */
u_int32_t flags; /* TXT_* flags. */
{
- EVENT ev, *evp; /* Current event. */
+ EVENT ev, *evp = NULL; /* Current event. */
EVENT fc; /* File name completion event. */
GS *gp;
TEXT *ntp, *tp; /* Input text structures. */
diff --git a/usr.bin/vi/vi/vs_line.c b/usr.bin/vi/vi/vs_line.c
index 9628d52a596..5828305358c 100644
--- a/usr.bin/vi/vi/vs_line.c
+++ b/usr.bin/vi/vi/vs_line.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vs_line.c,v 1.9 2006/03/11 06:54:12 ray Exp $ */
+/* $OpenBSD: vs_line.c,v 1.10 2006/03/11 06:58:00 ray Exp $ */
/*-
* Copyright (c) 1993, 1994
@@ -141,8 +141,8 @@ vs_line(sp, smp, yp, xp)
if (O_ISSET(sp, O_NUMBER)) {
cols_per_screen -= O_NUMBER_LENGTH;
if ((!dne || smp->lno == 1) && skip_cols == 0) {
- nlen = snprintf(cbuf,
- sizeof(cbuf), O_NUMBER_FMT, smp->lno);
+ nlen = snprintf(cbuf, sizeof(cbuf),
+ O_NUMBER_FMT, (ulong)smp->lno);
if (nlen >= sizeof(cbuf))
nlen = sizeof(cbuf) - 1;
(void)gp->scr_addstr(sp, cbuf, nlen);
@@ -516,7 +516,7 @@ vs_number(sp)
break;
(void)gp->scr_move(sp, smp - HMAP, 0);
- len = snprintf(nbuf, sizeof(nbuf), O_NUMBER_FMT, smp->lno);
+ len = snprintf(nbuf, sizeof(nbuf), O_NUMBER_FMT, (ulong)smp->lno);
if (len >= sizeof(nbuf))
len = sizeof(nbuf) - 1;
(void)gp->scr_addstr(sp, nbuf, len);
diff --git a/usr.bin/vi/vi/vs_refresh.c b/usr.bin/vi/vi/vs_refresh.c
index 1119072c27f..d54a7b69811 100644
--- a/usr.bin/vi/vi/vs_refresh.c
+++ b/usr.bin/vi/vi/vs_refresh.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vs_refresh.c,v 1.13 2006/03/11 06:55:56 ray Exp $ */
+/* $OpenBSD: vs_refresh.c,v 1.14 2006/03/11 06:58:00 ray Exp $ */
/*-
* Copyright (c) 1992, 1993, 1994
@@ -778,7 +778,7 @@ vs_modeline(sp)
};
GS *gp;
size_t cols, curcol, curlen, endpoint, len, midpoint;
- const char *t;
+ const char *t = NULL;
int ellipsis;
char *p, buf[20];
@@ -856,8 +856,8 @@ vs_modeline(sp)
cols = sp->cols - 1;
if (O_ISSET(sp, O_RULER)) {
vs_column(sp, &curcol);
- len =
- snprintf(buf, sizeof(buf), "%lu,%lu", sp->lno, curcol + 1);
+ len = snprintf(buf, sizeof(buf), "%lu,%zu",
+ (ulong)sp->lno, curcol + 1);
midpoint = (cols - ((len + 1) / 2)) / 2;
if (curlen < midpoint) {
diff --git a/usr.bin/vi/vi/vs_split.c b/usr.bin/vi/vi/vs_split.c
index 0442e79ace3..daf761302e3 100644
--- a/usr.bin/vi/vi/vs_split.c
+++ b/usr.bin/vi/vi/vs_split.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vs_split.c,v 1.8 2005/10/17 19:12:16 otto Exp $ */
+/* $OpenBSD: vs_split.c,v 1.9 2006/03/11 06:58:00 ray Exp $ */
/*-
* Copyright (c) 1993, 1994
@@ -232,8 +232,10 @@ vs_discard(sp, spp)
nsp->rows += sp->rows;
sp = nsp;
dir = BACKWARD;
- } else
+ } else {
sp = NULL;
+ dir = 0; /* unused */
+ }
if (spp != NULL)
*spp = sp;