Module Name: src
Committed By: lukem
Date: Tue Apr 14 08:50:06 UTC 2009
Modified Files:
src/usr.bin/window: char.c char.h cmd2.c cmd3.c cmd6.c compress.c
defs.h lcmd.c lcmd.h main.c parser.h parser2.c parser4.c parser5.c
startup.c string.c tt.h ttgeneric.c tth19.c ttoutput.c tttermcap.c
ttzapple.c var.c var.h win.c window_string.h ww.h wwinit.c
wwiomux.c wwlabel.c wwputs.c wwwrite.c
Log Message:
Fix WARNS=4 issues (-Wcast-qual -Wshadow -Wsign-compare)
To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/usr.bin/window/char.c
cvs rdiff -u -r1.4 -r1.5 src/usr.bin/window/char.h
cvs rdiff -u -r1.6 -r1.7 src/usr.bin/window/cmd2.c \
src/usr.bin/window/compress.c src/usr.bin/window/lcmd.h \
src/usr.bin/window/parser5.c src/usr.bin/window/tth19.c \
src/usr.bin/window/wwputs.c
cvs rdiff -u -r1.7 -r1.8 src/usr.bin/window/cmd3.c src/usr.bin/window/cmd6.c \
src/usr.bin/window/defs.h src/usr.bin/window/parser.h \
src/usr.bin/window/startup.c src/usr.bin/window/var.h \
src/usr.bin/window/window_string.h src/usr.bin/window/wwlabel.c
cvs rdiff -u -r1.8 -r1.9 src/usr.bin/window/lcmd.c \
src/usr.bin/window/parser4.c src/usr.bin/window/tt.h \
src/usr.bin/window/ttoutput.c src/usr.bin/window/tttermcap.c \
src/usr.bin/window/ttzapple.c src/usr.bin/window/wwwrite.c
cvs rdiff -u -r1.14 -r1.15 src/usr.bin/window/main.c
cvs rdiff -u -r1.10 -r1.11 src/usr.bin/window/parser2.c
cvs rdiff -u -r1.9 -r1.10 src/usr.bin/window/string.c \
src/usr.bin/window/ttgeneric.c src/usr.bin/window/var.c
cvs rdiff -u -r1.13 -r1.14 src/usr.bin/window/win.c \
src/usr.bin/window/wwiomux.c
cvs rdiff -u -r1.17 -r1.18 src/usr.bin/window/ww.h
cvs rdiff -u -r1.18 -r1.19 src/usr.bin/window/wwinit.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.bin/window/char.c
diff -u src/usr.bin/window/char.c:1.5 src/usr.bin/window/char.c:1.6
--- src/usr.bin/window/char.c:1.5 Thu Aug 7 11:17:21 2003
+++ src/usr.bin/window/char.c Tue Apr 14 08:50:06 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: char.c,v 1.5 2003/08/07 11:17:21 agc Exp $ */
+/* $NetBSD: char.c,v 1.6 2009/04/14 08:50:06 lukem Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)char.c 8.1 (Berkeley) 6/6/93";
#else
-__RCSID("$NetBSD: char.c,v 1.5 2003/08/07 11:17:21 agc Exp $");
+__RCSID("$NetBSD: char.c,v 1.6 2009/04/14 08:50:06 lukem Exp $");
#endif
#endif /* not lint */
@@ -117,7 +117,7 @@
_C|_U, _C|_U, _C|_U, _C|_U
};
-char *_unctrl[] = {
+const char *_unctrl[] = {
"^@", "^A", "^B", "^C", "^D", "^E", "^F", "^G",
"^H", "^I", "^J", "^K", "^L", "^M", "^N", "^O",
"^P", "^Q", "^R", "^S", "^T", "^U", "^V", "^W",
Index: src/usr.bin/window/char.h
diff -u src/usr.bin/window/char.h:1.4 src/usr.bin/window/char.h:1.5
--- src/usr.bin/window/char.h:1.4 Thu Aug 7 11:17:21 2003
+++ src/usr.bin/window/char.h Tue Apr 14 08:50:06 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: char.h,v 1.4 2003/08/07 11:17:21 agc Exp $ */
+/* $NetBSD: char.h,v 1.5 2009/04/14 08:50:06 lukem Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -47,7 +47,7 @@
* using unctrl() by wwwrite() if ww_unctrl is set.
*/
-extern char *_unctrl[];
+extern const char *_unctrl[];
extern char _cmap[];
#define ctrl(c) (c & 0x1f)
#define unctrl(c) (_unctrl[(unsigned char) (c)])
Index: src/usr.bin/window/cmd2.c
diff -u src/usr.bin/window/cmd2.c:1.6 src/usr.bin/window/cmd2.c:1.7
--- src/usr.bin/window/cmd2.c:1.6 Thu Aug 7 11:17:22 2003
+++ src/usr.bin/window/cmd2.c Tue Apr 14 08:50:06 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: cmd2.c,v 1.6 2003/08/07 11:17:22 agc Exp $ */
+/* $NetBSD: cmd2.c,v 1.7 2009/04/14 08:50:06 lukem Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -37,13 +37,13 @@
#if 0
static char sccsid[] = "@(#)cmd2.c 8.1 (Berkeley) 6/6/93";
#else
-__RCSID("$NetBSD: cmd2.c,v 1.6 2003/08/07 11:17:22 agc Exp $");
+__RCSID("$NetBSD: cmd2.c,v 1.7 2009/04/14 08:50:06 lukem Exp $");
#endif
#endif /* not lint */
#include "defs.h"
-char *help_shortcmd[] = {
+const char *help_shortcmd[] = {
"# Select window # and return to conversation mode",
"%# Select window # but stay in command mode",
"escape Return to conversation mode without changing window",
@@ -75,7 +75,7 @@
0
};
-char *help_longcmd[] = {
+const char *help_longcmd[] = {
":alias name string ... Make `name' an alias for `string ...'",
":alias Show all aliases",
":close # ... Close windows",
@@ -104,7 +104,7 @@
0
};
-int help_print(struct ww *, char *, char **);
+int help_print(struct ww *, const char *, const char **);
void
c_help(void)
@@ -123,7 +123,7 @@
}
int
-help_print(struct ww *w, char *name, char **list)
+help_print(struct ww *w, const char *name, const char **list)
{
wwprintf(w, "%s:\n\n", name);
while (*list)
Index: src/usr.bin/window/compress.c
diff -u src/usr.bin/window/compress.c:1.6 src/usr.bin/window/compress.c:1.7
--- src/usr.bin/window/compress.c:1.6 Thu Aug 7 11:17:24 2003
+++ src/usr.bin/window/compress.c Tue Apr 14 08:50:06 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: compress.c,v 1.6 2003/08/07 11:17:24 agc Exp $ */
+/* $NetBSD: compress.c,v 1.7 2009/04/14 08:50:06 lukem Exp $ */
/*
* Copyright (c) 1989, 1993
@@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)compress.c 8.1 (Berkeley) 6/6/93";
#else
-__RCSID("$NetBSD: compress.c,v 1.6 2003/08/07 11:17:24 agc Exp $");
+__RCSID("$NetBSD: compress.c,v 1.7 2009/04/14 08:50:06 lukem Exp $");
#endif
#endif /* not lint */
@@ -113,13 +113,13 @@
int cc_score_adjustments[TOKEN_MAX + 1][8]; /* XXX, 8 > max of cc_thresholds */
#define score_adjust(score, p) \
do { \
- int length = (p)->length; \
- int ccount = (p)->ccount; \
- if (threshp((p)->code, ccount, length) || \
- wthreshp((p)->weight, length)) /* XXX */ \
- (score) -= length - tt.tt_put_token_cost; \
+ int _length = (p)->length; \
+ int _ccount = (p)->ccount; \
+ if (threshp((p)->code, _ccount, _length) || \
+ wthreshp((p)->weight, _length)) /* XXX */ \
+ (score) -= _length - tt.tt_put_token_cost; \
else \
- (score) += cc_score_adjustments[length][ccount]; \
+ (score) += cc_score_adjustments[_length][_ccount]; \
} while (0)
int cc_initial_scores[TOKEN_MAX + 1][8]; /* XXX, 8 > max of cc_thresholds */
@@ -195,7 +195,7 @@
if (tt.tt_ntoken > cc_ntoken / 2) /* not likely */
tt.tt_ntoken = cc_ntoken / 2;
#define C(x) (sizeof (x) / sizeof *(x))
- for (i = 0; i < C(cc_thresholds); i++) {
+ for (i = 0; i < (int)C(cc_thresholds); i++) {
int h = i - tt.tt_put_token_cost;
if (h > 0)
cc_thresholds[i] =
@@ -203,9 +203,9 @@
else
cc_thresholds[i] = 0;
}
- for (i = 0; i < C(cc_score_adjustments); i++) {
+ for (i = 0; i < (int)C(cc_score_adjustments); i++) {
int t = cc_thresholds[i];
- for (j = 0; j < C(*cc_score_adjustments); j++) {
+ for (j = 0; j < (int)C(*cc_score_adjustments); j++) {
if (j >= t)
cc_score_adjustments[i][j] =
- (i - tt.tt_put_token_cost);
@@ -475,15 +475,15 @@
short wthreshold = wthresh(length);
short limit = wlimit(length);
#endif
- int time;
+ int time0;
short pc = tt.tt_padc;
i = length - 1;
bufsize -= i;
cp = buffer + i;
hc = cc_hashcodes;
- time = cc_time0;
- for (i = 0; i < bufsize; i++, time++) {
+ time0 = cc_time0;
+ for (i = 0; i < bufsize; i++, time0++) {
struct cc **h;
{
@@ -530,7 +530,7 @@
#ifndef cc_weight
p->weight = cc_weight;
#endif
- p->time = time;
+ p->time = time0;
p->bcount = 1;
p->ccount = 0;
p->flag = 0;
@@ -546,12 +546,12 @@
#endif
} else if (p->time < cc_time0) {
#ifndef cc_weight
- if ((p->weight += p->time - time) < 0)
+ if ((p->weight += p->time - time0) < 0)
p->weight = cc_weight;
else if ((p->weight += cc_weight) > limit)
p->weight = limit;
#endif
- p->time = time;
+ p->time = time0;
p->bcount = 1;
p->ccount = 0;
if (p->code >= 0) {
@@ -574,15 +574,15 @@
#ifdef STATS
ntoken_stat++;
#endif
- } else if (p->time + length > time) {
+ } else if (p->time + length > time0) {
/*
* overlapping token, don't count as two and
- * don't update time, but do adjust weight to offset
+ * don't update time0, but do adjust weight to offset
* the difference
*/
#ifndef cc_weight
if (cc_weight != 0) { /* XXX */
- p->weight += time - p->time;
+ p->weight += time0 - p->time;
if (!p->flag && p->weight >= wthreshold) {
p->flag = 1;
*pp++ = p;
@@ -594,12 +594,12 @@
p->places = i;
} else {
#ifndef cc_weight
- if ((p->weight += p->time - time) < 0)
+ if ((p->weight += p->time - time0) < 0)
p->weight = cc_weight;
else if ((p->weight += cc_weight) > limit)
p->weight = limit;
#endif
- p->time = time;
+ p->time = time0;
p->bcount++;
if (!p->flag &&
/* code must be < 0 if flag false here */
@@ -638,17 +638,17 @@
cc_sweep_reverse(struct cc **pp, short int *places)
{
struct cc *p;
- short front, back, t;
+ short frnt, back, t;
while ((p = *pp++) != 0) {
back = -1;
t = p->places;
/* the list is never empty */
do {
- front = places[t];
+ frnt = places[t];
places[t] = back;
back = t;
- } while ((t = front) >= 0);
+ } while ((t = frnt) >= 0);
p->places = back;
}
}
@@ -903,7 +903,7 @@
int
cc_token_compare(const void *p1, const void *p2)
{
- const struct cc **vp1 = (void *)p1;
- const struct cc **vp2 = (void *)p2;
+ const struct cc * const * vp1 = p1;
+ const struct cc * const * vp2 = p2;
return (*vp2)->bcount - (*vp1)->bcount;
}
Index: src/usr.bin/window/lcmd.h
diff -u src/usr.bin/window/lcmd.h:1.6 src/usr.bin/window/lcmd.h:1.7
--- src/usr.bin/window/lcmd.h:1.6 Thu Aug 7 11:17:25 2003
+++ src/usr.bin/window/lcmd.h Tue Apr 14 08:50:06 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: lcmd.h,v 1.6 2003/08/07 11:17:25 agc Exp $ */
+/* $NetBSD: lcmd.h,v 1.7 2009/04/14 08:50:06 lukem Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -37,14 +37,14 @@
#define LCMD_NARG 20 /* maximum number of arguments */
struct lcmd_tab {
- char *lc_name;
+ const char *lc_name;
int lc_minlen;
void (*lc_func)(struct value *, struct value *);
struct lcmd_arg *lc_arg;
};
struct lcmd_arg {
- char *arg_name;
+ const char *arg_name;
int arg_minlen;
int arg_flags;
};
@@ -56,7 +56,7 @@
#define ARG_STR 0x02 /* must be a string */
#define ARG_LIST 0x10 /* this arg can be a list */
-struct lcmd_tab *lcmd_lookup(char *);
+struct lcmd_tab *lcmd_lookup(const char *);
void l_alias(struct value *, struct value *);
void l_close(struct value *, struct value *);
void l_cursormodes(struct value *, struct value *);
Index: src/usr.bin/window/parser5.c
diff -u src/usr.bin/window/parser5.c:1.6 src/usr.bin/window/parser5.c:1.7
--- src/usr.bin/window/parser5.c:1.6 Thu Aug 7 11:17:29 2003
+++ src/usr.bin/window/parser5.c Tue Apr 14 08:50:06 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: parser5.c,v 1.6 2003/08/07 11:17:29 agc Exp $ */
+/* $NetBSD: parser5.c,v 1.7 2009/04/14 08:50:06 lukem Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)parser5.c 8.1 (Berkeley) 6/6/93";
#else
-__RCSID("$NetBSD: parser5.c,v 1.6 2003/08/07 11:17:29 agc Exp $");
+__RCSID("$NetBSD: parser5.c,v 1.7 2009/04/14 08:50:06 lukem Exp $");
#endif
#endif /* not lint */
@@ -52,7 +52,7 @@
p_expr11(struct value *v, char flag)
{
int op;
- char *opname;
+ const char *opname;
switch (token) {
case T_DOLLAR:
Index: src/usr.bin/window/tth19.c
diff -u src/usr.bin/window/tth19.c:1.6 src/usr.bin/window/tth19.c:1.7
--- src/usr.bin/window/tth19.c:1.6 Thu Aug 7 11:17:31 2003
+++ src/usr.bin/window/tth19.c Tue Apr 14 08:50:06 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: tth19.c,v 1.6 2003/08/07 11:17:31 agc Exp $ */
+/* $NetBSD: tth19.c,v 1.7 2009/04/14 08:50:06 lukem Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)tth19.c 8.1 (Berkeley) 6/6/93";
#else
-__RCSID("$NetBSD: tth19.c,v 1.6 2003/08/07 11:17:31 agc Exp $");
+__RCSID("$NetBSD: tth19.c,v 1.7 2009/04/14 08:50:06 lukem Exp $");
#endif
#endif /* not lint */
@@ -97,7 +97,7 @@
void h19_scroll_down(int);
void h19_setmodes(int);
void h19_start(void);
-void h19_write(char *, int);
+void h19_write(const char *, int);
void
h19_setmodes(int new)
@@ -143,7 +143,7 @@
}
void
-h19_write(char *p, int n)
+h19_write(const char *p, int n)
{
if (tt.tt_nmodes != tt.tt_modes)
(*tt.tt_setmodes)(tt.tt_nmodes);
Index: src/usr.bin/window/wwputs.c
diff -u src/usr.bin/window/wwputs.c:1.6 src/usr.bin/window/wwputs.c:1.7
--- src/usr.bin/window/wwputs.c:1.6 Thu Aug 7 11:17:43 2003
+++ src/usr.bin/window/wwputs.c Tue Apr 14 08:50:06 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: wwputs.c,v 1.6 2003/08/07 11:17:43 agc Exp $ */
+/* $NetBSD: wwputs.c,v 1.7 2009/04/14 08:50:06 lukem Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -37,16 +37,16 @@
#if 0
static char sccsid[] = "@(#)wwputs.c 8.1 (Berkeley) 6/6/93";
#else
-__RCSID("$NetBSD: wwputs.c,v 1.6 2003/08/07 11:17:43 agc Exp $");
+__RCSID("$NetBSD: wwputs.c,v 1.7 2009/04/14 08:50:06 lukem Exp $");
#endif
#endif /* not lint */
#include "ww.h"
void
-wwputs(char *s, struct ww *w)
+wwputs(const char *s, struct ww *w)
{
- char *p = s;
+ const char *p = s;
while (*p++)
;
Index: src/usr.bin/window/cmd3.c
diff -u src/usr.bin/window/cmd3.c:1.7 src/usr.bin/window/cmd3.c:1.8
--- src/usr.bin/window/cmd3.c:1.7 Thu Aug 7 11:17:22 2003
+++ src/usr.bin/window/cmd3.c Tue Apr 14 08:50:06 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: cmd3.c,v 1.7 2003/08/07 11:17:22 agc Exp $ */
+/* $NetBSD: cmd3.c,v 1.8 2009/04/14 08:50:06 lukem Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)cmd3.c 8.1 (Berkeley) 6/6/93";
#else
-__RCSID("$NetBSD: cmd3.c,v 1.7 2003/08/07 11:17:22 agc Exp $");
+__RCSID("$NetBSD: cmd3.c,v 1.8 2009/04/14 08:50:06 lukem Exp $");
#endif
#endif /* not lint */
@@ -45,7 +45,7 @@
#include "window_string.h"
void
-setescape(char *esc)
+setescape(const char *esc)
{
if (*esc == '^') {
if (esc[1] != 0)
@@ -57,7 +57,7 @@
}
int
-setlabel(struct ww *w, char *label)
+setlabel(struct ww *w, const char *label)
{
if (w->ww_label != 0)
str_free(w->ww_label);
Index: src/usr.bin/window/cmd6.c
diff -u src/usr.bin/window/cmd6.c:1.7 src/usr.bin/window/cmd6.c:1.8
--- src/usr.bin/window/cmd6.c:1.7 Thu Aug 7 11:17:23 2003
+++ src/usr.bin/window/cmd6.c Tue Apr 14 08:50:06 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: cmd6.c,v 1.7 2003/08/07 11:17:23 agc Exp $ */
+/* $NetBSD: cmd6.c,v 1.8 2009/04/14 08:50:06 lukem Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)cmd6.c 8.1 (Berkeley) 6/6/93";
#else
-__RCSID("$NetBSD: cmd6.c,v 1.7 2003/08/07 11:17:23 agc Exp $");
+__RCSID("$NetBSD: cmd6.c,v 1.8 2009/04/14 08:50:06 lukem Exp $");
#endif
#endif /* not lint */
@@ -104,7 +104,7 @@
for (s = str_head.s_forw; s != &str_head; s = s->s_forw) {
if (more(w, 0) == 2)
goto out;
- wwprintf(w, "(0x%x)\t\"%s\"\n", s->s_data, s->s_data);
+ wwprintf(w, "(%p)\t\"%s\"\n", s->s_data, s->s_data);
}
waitnl(w);
out:
Index: src/usr.bin/window/defs.h
diff -u src/usr.bin/window/defs.h:1.7 src/usr.bin/window/defs.h:1.8
--- src/usr.bin/window/defs.h:1.7 Thu Aug 7 11:17:25 2003
+++ src/usr.bin/window/defs.h Tue Apr 14 08:50:06 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: defs.h,v 1.7 2003/08/07 11:17:25 agc Exp $ */
+/* $NetBSD: defs.h,v 1.8 2009/04/14 08:50:06 lukem Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -95,7 +95,8 @@
void dodefault(void);
int dolongcmd(char *, struct value *, int);
int dosource(char *);
-void error(const char *, ...);
+void error(const char *, ...)
+ __attribute__((__format__(__printf__, 1, 2)));
void err_end(void);
int findid(void);
struct ww *findselwin(void);
@@ -108,13 +109,13 @@
void movewin(struct ww *, int, int);
struct ww *openwin(int, int, int, int, int, int, char *, int, int,
char *, char **);
-struct ww *openiwin(int, char *);
+struct ww *openiwin(int, const char *);
void p_memerror(void);
void p_start(void);
void reframe(void);
void setcmd(char);
-void setescape(char *);
-int setlabel(struct ww *, char *);
+void setescape(const char *);
+int setlabel(struct ww *, const char *);
void setselwin(struct ww *);
void setterse(char);
void setvars(void);
@@ -124,4 +125,4 @@
int s_gettok(void);
void verror(const char *, va_list);
void waitnl(struct ww *);
-int waitnl1(struct ww *, char *);
+int waitnl1(struct ww *, const char *);
Index: src/usr.bin/window/parser.h
diff -u src/usr.bin/window/parser.h:1.7 src/usr.bin/window/parser.h:1.8
--- src/usr.bin/window/parser.h:1.7 Thu Aug 7 11:17:27 2003
+++ src/usr.bin/window/parser.h Tue Apr 14 08:50:06 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: parser.h,v 1.7 2003/08/07 11:17:27 agc Exp $ */
+/* $NetBSD: parser.h,v 1.8 2009/04/14 08:50:06 lukem Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -43,9 +43,10 @@
#define p_clearerr() (cx.x_erred = cx.x_synerred = 0)
#define p_abort() (cx.x_abort)
-int p_assign(char *, struct value *, int);
+int p_assign(const char *, struct value *, int);
int p_convstr(struct value *v);
-void p_error(const char *msg, ...);
+void p_error(const char *msg, ...)
+ __attribute__((__format__(__printf__, 1, 2)));
int p_expr(struct value *, char);
int p_expr0(struct value *, char);
int p_expr1(struct value *, char);
@@ -54,7 +55,7 @@
int p_expr2(struct value *, char);
int p_expr3_10(int, struct value *, char);
int p_expression(char);
-int p_function(char *, struct value *, int);
+int p_function(const char *, struct value *, int);
int p_if(char);
int p_statement(char);
void p_statementlist(char);
Index: src/usr.bin/window/startup.c
diff -u src/usr.bin/window/startup.c:1.7 src/usr.bin/window/startup.c:1.8
--- src/usr.bin/window/startup.c:1.7 Thu Aug 7 11:17:29 2003
+++ src/usr.bin/window/startup.c Tue Apr 14 08:50:06 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: startup.c,v 1.7 2003/08/07 11:17:29 agc Exp $ */
+/* $NetBSD: startup.c,v 1.8 2009/04/14 08:50:06 lukem Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)startup.c 8.1 (Berkeley) 6/6/93";
#else
-__RCSID("$NetBSD: startup.c,v 1.7 2003/08/07 11:17:29 agc Exp $");
+__RCSID("$NetBSD: startup.c,v 1.8 2009/04/14 08:50:06 lukem Exp $");
#endif
#endif /* not lint */
@@ -51,7 +51,7 @@
doconfig(void)
{
char buf[100];
- char *home;
+ const char *home;
static char runcom[] = RUNCOM;
if ((home = getenv("HOME")) == 0)
Index: src/usr.bin/window/var.h
diff -u src/usr.bin/window/var.h:1.7 src/usr.bin/window/var.h:1.8
--- src/usr.bin/window/var.h:1.7 Thu Aug 7 11:17:34 2003
+++ src/usr.bin/window/var.h Tue Apr 14 08:50:06 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: var.h,v 1.7 2003/08/07 11:17:34 agc Exp $ */
+/* $NetBSD: var.h,v 1.8 2009/04/14 08:50:06 lukem Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -45,11 +45,11 @@
struct value r_val;
};
-struct var **var_lookup1(struct var **, char *);
-struct var *var_set1(struct var **, char *, struct value *);
-struct var *var_setnum1(struct var **, char *, int);
-struct var *var_setstr1(struct var **, char *, char *);
-int var_unset1(struct var **, char *);
+struct var **var_lookup1(struct var **, const char *);
+struct var *var_set1(struct var **, const char *, struct value *);
+struct var *var_setnum1(struct var **, const char *, int);
+struct var *var_setstr1(struct var **, const char *, char *);
+int var_unset1(struct var **, const char *);
int var_walk1(struct var *, int (*func)(void *, struct var *),
void *);
Index: src/usr.bin/window/window_string.h
diff -u src/usr.bin/window/window_string.h:1.7 src/usr.bin/window/window_string.h:1.8
--- src/usr.bin/window/window_string.h:1.7 Thu Aug 7 11:17:35 2003
+++ src/usr.bin/window/window_string.h Tue Apr 14 08:50:06 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: window_string.h,v 1.7 2003/08/07 11:17:35 agc Exp $ */
+/* $NetBSD: window_string.h,v 1.8 2009/04/14 08:50:06 lukem Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -45,11 +45,11 @@
#define STR_DEBUG
-char *str_cat(char *, char *);
-char *str_cpy(char *);
+char *str_cat(const char *, const char *);
+char *str_cpy(const char *);
char *str_itoa(int);
-int str_match(char *, char *, int);
-char *str_ncpy(char *, int);
+int str_match(const char *, const char *, int);
+char *str_ncpy(const char *, int);
#define str_cmp(a, b) strcmp(a, b)
Index: src/usr.bin/window/wwlabel.c
diff -u src/usr.bin/window/wwlabel.c:1.7 src/usr.bin/window/wwlabel.c:1.8
--- src/usr.bin/window/wwlabel.c:1.7 Thu Aug 7 11:17:41 2003
+++ src/usr.bin/window/wwlabel.c Tue Apr 14 08:50:06 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: wwlabel.c,v 1.7 2003/08/07 11:17:41 agc Exp $ */
+/* $NetBSD: wwlabel.c,v 1.8 2009/04/14 08:50:06 lukem Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)wwlabel.c 8.1 (Berkeley) 6/6/93";
#else
-__RCSID("$NetBSD: wwlabel.c,v 1.7 2003/08/07 11:17:41 agc Exp $");
+__RCSID("$NetBSD: wwlabel.c,v 1.8 2009/04/14 08:50:06 lukem Exp $");
#endif
#endif /* not lint */
@@ -61,7 +61,7 @@
char *fmap;
unsigned char *smap;
char touched;
- char *p;
+ const char *p;
if (f->ww_fmap == 0)
return;
Index: src/usr.bin/window/lcmd.c
diff -u src/usr.bin/window/lcmd.c:1.8 src/usr.bin/window/lcmd.c:1.9
--- src/usr.bin/window/lcmd.c:1.8 Mon Dec 18 20:04:55 2006
+++ src/usr.bin/window/lcmd.c Tue Apr 14 08:50:06 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: lcmd.c,v 1.8 2006/12/18 20:04:55 christos Exp $ */
+/* $NetBSD: lcmd.c,v 1.9 2009/04/14 08:50:06 lukem Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)lcmd.c 8.1 (Berkeley) 6/6/93";
#else
-__RCSID("$NetBSD: lcmd.c,v 1.8 2006/12/18 20:04:55 christos Exp $");
+__RCSID("$NetBSD: lcmd.c,v 1.9 2009/04/14 08:50:06 lukem Exp $");
#endif
#endif /* not lint */
@@ -97,7 +97,7 @@
};
struct lcmd_tab *
-lcmd_lookup(char *name)
+lcmd_lookup(const char *name)
{
struct lcmd_tab *p;
Index: src/usr.bin/window/parser4.c
diff -u src/usr.bin/window/parser4.c:1.8 src/usr.bin/window/parser4.c:1.9
--- src/usr.bin/window/parser4.c:1.8 Thu Aug 7 11:17:28 2003
+++ src/usr.bin/window/parser4.c Tue Apr 14 08:50:06 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: parser4.c,v 1.8 2003/08/07 11:17:28 agc Exp $ */
+/* $NetBSD: parser4.c,v 1.9 2009/04/14 08:50:06 lukem Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)parser4.c 8.1 (Berkeley) 6/6/93";
#else
-__RCSID("$NetBSD: parser4.c,v 1.8 2003/08/07 11:17:28 agc Exp $");
+__RCSID("$NetBSD: parser4.c,v 1.9 2009/04/14 08:50:06 lukem Exp $");
#endif
#endif /* not lint */
@@ -60,7 +60,7 @@
{
struct value l, r;
int op;
- char *opname = 0;
+ const char *opname = 0;
if ((level == 10 ? p_expr11(v, flag)
: p_expr3_10(level + 1, v, flag)) < 0)
Index: src/usr.bin/window/tt.h
diff -u src/usr.bin/window/tt.h:1.8 src/usr.bin/window/tt.h:1.9
--- src/usr.bin/window/tt.h:1.8 Thu Aug 7 11:17:30 2003
+++ src/usr.bin/window/tt.h Tue Apr 14 08:50:06 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: tt.h,v 1.8 2003/08/07 11:17:30 agc Exp $ */
+/* $NetBSD: tt.h,v 1.9 2009/04/14 08:50:06 lukem Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -56,7 +56,7 @@
void (*tt_inschar)(char);
void (*tt_insspace)(int);
void (*tt_delchar)(int);
- void (*tt_write)(char *, int); /* write a whole block */
+ void (*tt_write)(const char *, int); /* write a whole block */
void (*tt_putc)(char); /* write one character */
void (*tt_clreol)(void);
void (*tt_clreos)(void);
@@ -67,7 +67,7 @@
void (*tt_setmodes)(int); /* set display modes */
void (*tt_set_token)(int, char *, int);
/* define a token */
- void (*tt_put_token)(int, char *, int);
+ void (*tt_put_token)(int, const char *, int);
/* refer to a defined token */
void (*tt_compress)(int); /* begin, end compression */
void (*tt_checksum)(char *, int);
@@ -116,7 +116,7 @@
* List of terminal drivers.
*/
struct tt_tab {
- char *tt_name;
+ const char *tt_name;
int tt_len;
int (*tt_func)(void);
};
@@ -130,12 +130,12 @@
EXTERN char *tt_strp; /* pointer for it */
struct tt_str {
- char *ts_str;
+ const char *ts_str;
int ts_n;
};
-struct tt_str *tttgetstr(char *);
-struct tt_str *ttxgetstr(char *); /* tgetstr() and expand delays */
+struct tt_str *tttgetstr(const char *);
+struct tt_str *ttxgetstr(const char *); /* tgetstr() and expand delays */
int tt_f100(void);
int tt_generic(void);
@@ -147,14 +147,14 @@
int tt_zapple(void);
int tt_zentec(void);
void ttflush(void);
-struct tt_str *tttgetstr(char *);
+struct tt_str *tttgetstr(const char *);
int ttinit(void);
void ttpgoto(struct tt_str *, int, int, int);
-void ttputs(char *);
+void ttputs(const char *);
int ttstrcmp(struct tt_str *, struct tt_str *);
void tttgoto(struct tt_str *, int, int);
int tttputc(int);
-void ttwrite(char *, int);
+void ttwrite(const char *, int);
int ttxputc(int);
#define tttputs(s, n) tputs((s)->ts_str, (n), tttputc)
Index: src/usr.bin/window/ttoutput.c
diff -u src/usr.bin/window/ttoutput.c:1.8 src/usr.bin/window/ttoutput.c:1.9
--- src/usr.bin/window/ttoutput.c:1.8 Wed Aug 13 15:14:55 2003
+++ src/usr.bin/window/ttoutput.c Tue Apr 14 08:50:06 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: ttoutput.c,v 1.8 2003/08/13 15:14:55 itojun Exp $ */
+/* $NetBSD: ttoutput.c,v 1.9 2009/04/14 08:50:06 lukem Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)ttoutput.c 8.1 (Berkeley) 6/6/93";
#else
-__RCSID("$NetBSD: ttoutput.c,v 1.8 2003/08/13 15:14:55 itojun Exp $");
+__RCSID("$NetBSD: ttoutput.c,v 1.9 2009/04/14 08:50:06 lukem Exp $");
#endif
#endif /* not lint */
@@ -88,14 +88,14 @@
}
void
-ttputs(char *s)
+ttputs(const char *s)
{
while (*s)
ttputc(*s++);
}
void
-ttwrite(char *s, int n)
+ttwrite(const char *s, int n)
{
switch (n) {
case 0:
Index: src/usr.bin/window/tttermcap.c
diff -u src/usr.bin/window/tttermcap.c:1.8 src/usr.bin/window/tttermcap.c:1.9
--- src/usr.bin/window/tttermcap.c:1.8 Thu Aug 7 11:17:32 2003
+++ src/usr.bin/window/tttermcap.c Tue Apr 14 08:50:06 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: tttermcap.c,v 1.8 2003/08/07 11:17:32 agc Exp $ */
+/* $NetBSD: tttermcap.c,v 1.9 2009/04/14 08:50:06 lukem Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)tttermcap.c 8.1 (Berkeley) 6/6/93";
#else
-__RCSID("$NetBSD: tttermcap.c,v 1.8 2003/08/07 11:17:32 agc Exp $");
+__RCSID("$NetBSD: tttermcap.c,v 1.9 2009/04/14 08:50:06 lukem Exp $");
#endif
#endif /* not lint */
@@ -61,7 +61,7 @@
}
struct tt_str *
-tttgetstr(char *str)
+tttgetstr(const char *str)
{
struct tt_str *s;
@@ -75,7 +75,7 @@
}
struct tt_str *
-ttxgetstr(char *str)
+ttxgetstr(const char *str)
{
struct tt_str *s;
char buf[100];
@@ -95,7 +95,7 @@
void
tttgoto(struct tt_str *s, int col, int row)
{
- char *p = s->ts_str;
+ const char *p = s->ts_str;
ttputs(tgoto(p, col, row));
for (p += s->ts_n; *--p == 0;)
Index: src/usr.bin/window/ttzapple.c
diff -u src/usr.bin/window/ttzapple.c:1.8 src/usr.bin/window/ttzapple.c:1.9
--- src/usr.bin/window/ttzapple.c:1.8 Mon Dec 18 20:04:55 2006
+++ src/usr.bin/window/ttzapple.c Tue Apr 14 08:50:06 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: ttzapple.c,v 1.8 2006/12/18 20:04:55 christos Exp $ */
+/* $NetBSD: ttzapple.c,v 1.9 2009/04/14 08:50:06 lukem Exp $ */
/*
* Copyright (c) 1989, 1993
@@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)ttzapple.c 8.1 (Berkeley) 6/6/93";
#else
-__RCSID("$NetBSD: ttzapple.c,v 1.8 2006/12/18 20:04:55 christos Exp $");
+__RCSID("$NetBSD: ttzapple.c,v 1.9 2009/04/14 08:50:06 lukem Exp $");
#endif
#endif /* not lint */
@@ -83,7 +83,7 @@
void zz_insline(int);
void zz_insspace(int);
void zz_move(int, int);
-void zz_put_token(int, char *, int);
+void zz_put_token(int, const char *, int);
void zz_putc(char);
void zz_reset(void);
int zz_rint(char *, int);
@@ -93,7 +93,7 @@
void zz_setscroll(int, int);
void zz_set_token(int, char *, int);
void zz_start(void);
-void zz_write(char *, int);
+void zz_write(const char *, int);
void
zz_setmodes(int new)
@@ -140,7 +140,7 @@
}
void
-zz_write(char *p, int n)
+zz_write(const char *p, int n)
{
if (tt.tt_nmodes != tt.tt_modes)
zz_setmodes(tt.tt_nmodes);
@@ -380,7 +380,7 @@
}
void
-zz_put_token(int t, char *s __unused, int n __unused)
+zz_put_token(int t, const char *s __unused, int n __unused)
{
if (tt.tt_nmodes != tt.tt_modes)
zz_setmodes(tt.tt_nmodes);
Index: src/usr.bin/window/wwwrite.c
diff -u src/usr.bin/window/wwwrite.c:1.8 src/usr.bin/window/wwwrite.c:1.9
--- src/usr.bin/window/wwwrite.c:1.8 Thu Aug 7 11:17:46 2003
+++ src/usr.bin/window/wwwrite.c Tue Apr 14 08:50:06 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: wwwrite.c,v 1.8 2003/08/07 11:17:46 agc Exp $ */
+/* $NetBSD: wwwrite.c,v 1.9 2009/04/14 08:50:06 lukem Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)wwwrite.c 8.1 (Berkeley) 6/6/93";
#else
-__RCSID("$NetBSD: wwwrite.c,v 1.8 2003/08/07 11:17:46 agc Exp $");
+__RCSID("$NetBSD: wwwrite.c,v 1.9 2009/04/14 08:50:06 lukem Exp $");
#endif
#endif /* not lint */
@@ -61,13 +61,13 @@
* to avoid recursion, which might be a better idea.
*/
int
-wwwrite(struct ww *w, char *p, int n)
+wwwrite(struct ww *w, const char *p, int n)
{
int hascursor;
- char *savep = p;
- char *q = p + n;
- char *r = 0;
- char *s = 0;
+ const char *savep = p;
+ const char *q = p + n;
+ const char *r = 0;
+ const char *s = 0;
#ifdef lint
s = 0; /* define it before possible use */
Index: src/usr.bin/window/main.c
diff -u src/usr.bin/window/main.c:1.14 src/usr.bin/window/main.c:1.15
--- src/usr.bin/window/main.c:1.14 Mon Jul 21 14:19:28 2008
+++ src/usr.bin/window/main.c Tue Apr 14 08:50:06 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.14 2008/07/21 14:19:28 lukem Exp $ */
+/* $NetBSD: main.c,v 1.15 2009/04/14 08:50:06 lukem Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -42,7 +42,7 @@
#if 0
static char sccsid[] = "@(#)main.c 8.2 (Berkeley) 4/2/94";
#else
-__RCSID("$NetBSD: main.c,v 1.14 2008/07/21 14:19:28 lukem Exp $");
+__RCSID("$NetBSD: main.c,v 1.15 2009/04/14 08:50:06 lukem Exp $");
#endif
#endif /* not lint */
@@ -65,6 +65,7 @@
main(int argc, char **argv)
{
char *p;
+ const char *kp;
char fflag = 0;
char dflag = 0;
char xflag = 0;
@@ -105,9 +106,9 @@
usage();
}
}
- if ((p = getenv("SHELL")) == 0)
- p = _PATH_BSHELL;
- if ((default_shellfile = str_cpy(p)) == 0)
+ if ((kp = getenv("SHELL")) == 0)
+ kp = _PATH_BSHELL;
+ if ((default_shellfile = str_cpy(kp)) == 0)
errx(1, "Out of memory.");
if ((p = strrchr(default_shellfile, '/')))
p++;
Index: src/usr.bin/window/parser2.c
diff -u src/usr.bin/window/parser2.c:1.10 src/usr.bin/window/parser2.c:1.11
--- src/usr.bin/window/parser2.c:1.10 Tue May 2 22:35:07 2006
+++ src/usr.bin/window/parser2.c Tue Apr 14 08:50:06 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: parser2.c,v 1.10 2006/05/02 22:35:07 christos Exp $ */
+/* $NetBSD: parser2.c,v 1.11 2009/04/14 08:50:06 lukem Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)parser2.c 8.1 (Berkeley) 6/6/93";
#else
-__RCSID("$NetBSD: parser2.c,v 1.10 2006/05/02 22:35:07 christos Exp $");
+__RCSID("$NetBSD: parser2.c,v 1.11 2009/04/14 08:50:06 lukem Exp $");
#endif
#endif /* not lint */
@@ -55,7 +55,7 @@
* want to parse the arguments anyway. flag == 0 in this case.
*/
int
-p_function(char *name, struct value *v, int flag)
+p_function(const char *name, struct value *v, int flag)
{
struct value t;
struct lcmd_tab *c = 0;
@@ -147,11 +147,11 @@
if (vp && vp->v_type != V_ERR) {
if (*ap->arg_name)
p_error("%s: Argument %d (%s) duplicated.",
- name, vp - av + 1,
+ name, (int)(vp - av + 1),
ap->arg_name);
else
p_error("%s: Argument %d duplicated.",
- name, vp - av + 1);
+ name, (int)(vp - av + 1));
flag = 0;
vp = 0;
} else if (t.v_type == V_ERR) {
@@ -162,11 +162,11 @@
t.v_type != V_STR)) {
if (*ap->arg_name)
p_error("%s: Argument %d (%s) type mismatch.",
- name, vp - av + 1,
+ name, (int)(vp - av + 1),
ap->arg_name);
else
p_error("%s: Argument %d type mismatch.",
- name, vp - av + 1);
+ name, (int)(vp - av + 1));
flag = 0;
vp = 0;
}
@@ -215,7 +215,7 @@
}
int
-p_assign(char *name, struct value *v, int flag)
+p_assign(const char *name, struct value *v, int flag)
{
(void) s_gettok();
Index: src/usr.bin/window/string.c
diff -u src/usr.bin/window/string.c:1.9 src/usr.bin/window/string.c:1.10
--- src/usr.bin/window/string.c:1.9 Thu Aug 7 11:17:29 2003
+++ src/usr.bin/window/string.c Tue Apr 14 08:50:06 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: string.c,v 1.9 2003/08/07 11:17:29 agc Exp $ */
+/* $NetBSD: string.c,v 1.10 2009/04/14 08:50:06 lukem Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)string.c 8.1 (Berkeley) 6/6/93";
#else
-__RCSID("$NetBSD: string.c,v 1.9 2003/08/07 11:17:29 agc Exp $");
+__RCSID("$NetBSD: string.c,v 1.10 2009/04/14 08:50:06 lukem Exp $");
#endif
#endif /* not lint */
@@ -49,7 +49,7 @@
#undef EXTERN
char *
-str_cpy(char *s)
+str_cpy(const char *s)
{
char *str;
char *p;
@@ -63,7 +63,7 @@
}
char *
-str_ncpy(char *s, int n)
+str_ncpy(const char *s, int n)
{
int l = strlen(s);
char *str;
@@ -90,10 +90,11 @@
}
char *
-str_cat(char *s1, char *s2)
+str_cat(const char *s1, const char *s2)
{
char *str;
- char *p, *q;
+ char *p;
+ const char *q;
str = p = str_alloc(strlen(s1) + strlen(s2) + 1);
if (p == 0)
@@ -110,7 +111,7 @@
* s can be a prefix of p with at least min characters.
*/
int
-str_match(char *s, char *p, int min)
+str_match(const char *s, const char *p, int min)
{
for (; *s && *p && *s == *p; s++, p++, min--)
;
Index: src/usr.bin/window/ttgeneric.c
diff -u src/usr.bin/window/ttgeneric.c:1.9 src/usr.bin/window/ttgeneric.c:1.10
--- src/usr.bin/window/ttgeneric.c:1.9 Thu Aug 7 11:17:30 2003
+++ src/usr.bin/window/ttgeneric.c Tue Apr 14 08:50:06 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: ttgeneric.c,v 1.9 2003/08/07 11:17:30 agc Exp $ */
+/* $NetBSD: ttgeneric.c,v 1.10 2009/04/14 08:50:06 lukem Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)ttgeneric.c 8.1 (Berkeley) 6/6/93";
#else
-__RCSID("$NetBSD: ttgeneric.c,v 1.9 2003/08/07 11:17:30 agc Exp $");
+__RCSID("$NetBSD: ttgeneric.c,v 1.10 2009/04/14 08:50:06 lukem Exp $");
#endif
#endif /* not lint */
@@ -142,7 +142,7 @@
void gen_setmodes(int);
void gen_setscroll(int, int);
void gen_start(void);
-void gen_write(char *, int);
+void gen_write(const char *, int);
void
gen_setinsert(char new)
@@ -248,7 +248,7 @@
}
void
-gen_write(char *p, int n)
+gen_write(const char *p, int n)
{
if (tt.tt_insert)
gen_setinsert(0);
@@ -526,8 +526,8 @@
*/
if (gen_SF == 0 && !gen_NS)
gen_SF = gen_NL;
- BC = gen_LE ? gen_LE->ts_str : 0;
- UP = gen_UP ? gen_UP->ts_str : 0;
+ BC = gen_LE ? __UNCONST(gen_LE->ts_str) : 0;
+ UP = gen_UP ? __UNCONST(gen_UP->ts_str) : 0;
/*
* Fix up display attributes that we can't handle, or don't
* really exist.
Index: src/usr.bin/window/var.c
diff -u src/usr.bin/window/var.c:1.9 src/usr.bin/window/var.c:1.10
--- src/usr.bin/window/var.c:1.9 Thu Aug 7 11:17:33 2003
+++ src/usr.bin/window/var.c Tue Apr 14 08:50:06 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: var.c,v 1.9 2003/08/07 11:17:33 agc Exp $ */
+/* $NetBSD: var.c,v 1.10 2009/04/14 08:50:06 lukem Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)var.c 8.1 (Berkeley) 6/6/93";
#else
-__RCSID("$NetBSD: var.c,v 1.9 2003/08/07 11:17:33 agc Exp $");
+__RCSID("$NetBSD: var.c,v 1.10 2009/04/14 08:50:06 lukem Exp $");
#endif
#endif /* not lint */
@@ -50,7 +50,7 @@
#include "window_string.h"
struct var *
-var_set1(struct var **head, char *name, struct value *v)
+var_set1(struct var **head, const char *name, struct value *v)
{
struct var **p;
struct var *r;
@@ -83,7 +83,7 @@
}
struct var *
-var_setstr1(struct var **head, char *name, char *str)
+var_setstr1(struct var **head, const char *name, char *str)
{
struct value v;
@@ -93,7 +93,7 @@
}
struct var *
-var_setnum1(struct var **head, char *name, int num)
+var_setnum1(struct var **head, const char *name, int num)
{
struct value v;
@@ -103,7 +103,7 @@
}
int
-var_unset1(struct var **head, char *name)
+var_unset1(struct var **head, const char *name)
{
struct var **p;
struct var *r;
@@ -122,7 +122,7 @@
}
struct var **
-var_lookup1(struct var **p, char *name)
+var_lookup1(struct var **p, const char *name)
{
int cmp;
Index: src/usr.bin/window/win.c
diff -u src/usr.bin/window/win.c:1.13 src/usr.bin/window/win.c:1.14
--- src/usr.bin/window/win.c:1.13 Thu Aug 7 11:17:34 2003
+++ src/usr.bin/window/win.c Tue Apr 14 08:50:06 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: win.c,v 1.13 2003/08/07 11:17:34 agc Exp $ */
+/* $NetBSD: win.c,v 1.14 2009/04/14 08:50:06 lukem Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)win.c 8.1 (Berkeley) 6/6/93";
#else
-__RCSID("$NetBSD: win.c,v 1.13 2003/08/07 11:17:34 agc Exp $");
+__RCSID("$NetBSD: win.c,v 1.14 2009/04/14 08:50:06 lukem Exp $");
#endif
#endif /* not lint */
@@ -172,7 +172,7 @@
* Open an information (display) window.
*/
struct ww *
-openiwin(int nrow, char *label)
+openiwin(int nrow, const char *label)
{
struct ww *w;
@@ -352,7 +352,7 @@
}
int
-waitnl1(struct ww *w, char *prompt)
+waitnl1(struct ww *w, const char *prompt)
{
int uc = ISSET(w->ww_wflags, WWW_UNCTRL);
Index: src/usr.bin/window/wwiomux.c
diff -u src/usr.bin/window/wwiomux.c:1.13 src/usr.bin/window/wwiomux.c:1.14
--- src/usr.bin/window/wwiomux.c:1.13 Mon Dec 18 20:04:55 2006
+++ src/usr.bin/window/wwiomux.c Tue Apr 14 08:50:06 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: wwiomux.c,v 1.13 2006/12/18 20:04:55 christos Exp $ */
+/* $NetBSD: wwiomux.c,v 1.14 2009/04/14 08:50:06 lukem Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)wwiomux.c 8.1 (Berkeley) 6/6/93";
#else
-__RCSID("$NetBSD: wwiomux.c,v 1.13 2006/12/18 20:04:55 christos Exp $");
+__RCSID("$NetBSD: wwiomux.c,v 1.14 2009/04/14 08:50:06 lukem Exp $");
#endif
#endif /* not lint */
@@ -67,14 +67,15 @@
wwiomux(void)
{
struct ww *w;
- int nfd;
+ nfds_t nfd;
+ int i;
int volatile dostdin; /* avoid longjmp clobbering */
char volatile c; /* avoid longjmp clobbering */
char *p;
int millis;
char noblock = 0;
static struct pollfd *pfd = NULL;
- static size_t maxfds = 0;
+ static nfds_t maxfds = 0;
c = 0; /* XXXGCC -Wuninitialized */
@@ -145,13 +146,13 @@
millis = 10;
}
wwnselect++;
- nfd = poll(pfd, nfd, millis);
+ i = poll(pfd, nfd, millis);
wwsetjmp = 0;
noblock = 0;
- if (nfd < 0)
+ if (i < 0)
wwnselecte++;
- else if (nfd == 0)
+ else if (i == 0)
wwnselectz++;
else {
if (dostdin != -1 && (pfd[dostdin].revents & POLLIN) != 0)
Index: src/usr.bin/window/ww.h
diff -u src/usr.bin/window/ww.h:1.17 src/usr.bin/window/ww.h:1.18
--- src/usr.bin/window/ww.h:1.17 Thu Aug 7 11:17:35 2003
+++ src/usr.bin/window/ww.h Tue Apr 14 08:50:06 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: ww.h,v 1.17 2003/08/07 11:17:35 agc Exp $ */
+/* $NetBSD: ww.h,v 1.18 2009/04/14 08:50:06 lukem Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -313,8 +313,8 @@
struct ww *wwopen(int, int, int, int, int, int, int);
void wwadd(struct ww *, struct ww *);
-void wwaddcap(char *, char **);
-void wwaddcap1(char *, char **);
+void wwaddcap(const char *, char **);
+void wwaddcap1(const char *, char **);
void wwalarm(int);
char **wwalloc(int, int, int, int, int);
void wwbell(void);
@@ -353,9 +353,10 @@
void wwiomux(void);
void wwlabel(struct ww *, struct ww *, int, char *, int);
void wwmove(struct ww *, int, int);
-void wwprintf(struct ww *, const char *, ...);
+void wwprintf(struct ww *, const char *, ...)
+ __attribute__((__format__(__printf__, 2, 3)));
void wwputc(char, struct ww *);
-void wwputs(char *, struct ww *);
+void wwputs(const char *, struct ww *);
void wwredraw(void);
void wwredrawwin1(struct ww *,int, int, int);
void wwquit(int);
@@ -377,7 +378,7 @@
void wwupdate1(int, int);
int wwvisible(struct ww *);
void wwvprintf(struct ww *, const char *, va_list);
-int wwwrite(struct ww *, char *, int);
+int wwwrite(struct ww *, const char *, int);
#ifdef TERMINFO
int wwterminfoinit(void);
int wwterminfoend(void);
Index: src/usr.bin/window/wwinit.c
diff -u src/usr.bin/window/wwinit.c:1.18 src/usr.bin/window/wwinit.c:1.19
--- src/usr.bin/window/wwinit.c:1.18 Wed Aug 13 15:21:07 2003
+++ src/usr.bin/window/wwinit.c Tue Apr 14 08:50:06 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: wwinit.c,v 1.18 2003/08/13 15:21:07 itojun Exp $ */
+/* $NetBSD: wwinit.c,v 1.19 2009/04/14 08:50:06 lukem Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)wwinit.c 8.2 (Berkeley) 4/28/95";
#else
-__RCSID("$NetBSD: wwinit.c,v 1.18 2003/08/13 15:21:07 itojun Exp $");
+__RCSID("$NetBSD: wwinit.c,v 1.19 2009/04/14 08:50:06 lukem Exp $");
#endif
#endif /* not lint */
@@ -345,11 +345,12 @@
}
void
-wwaddcap(char *cap, char **kp)
+wwaddcap(const char *cap, char **kp)
{
char tbuf[512];
char *tp = tbuf;
- char *str, *p;
+ char *str;
+ const char *p;
if ((str = tgetstr(cap, &tp)) != 0) {
while ((*(*kp)++ = *cap++))
@@ -366,7 +367,7 @@
}
void
-wwaddcap1(char *cap, char **kp)
+wwaddcap1(const char *cap, char **kp)
{
while ((*(*kp)++ = *cap++))
;