From 5dcd334a54de067ae4fd30cf8a272065ecd82f4e Mon Sep 17 00:00:00 2001 From: kris Date: Fri, 18 May 2001 11:04:19 +0000 Subject: BDECFLAGS cleanup --- bin/stty/cchar.c | 8 +++++--- bin/stty/gfmt.c | 4 +++- bin/stty/key.c | 9 +++++---- bin/stty/modes.c | 12 +++++++----- bin/stty/print.c | 14 +++++++------- bin/stty/stty.c | 4 +++- bin/stty/stty.h | 4 ++-- 7 files changed, 32 insertions(+), 23 deletions(-) diff --git a/bin/stty/cchar.c b/bin/stty/cchar.c index b7a2128..8552160 100644 --- a/bin/stty/cchar.c +++ b/bin/stty/cchar.c @@ -50,6 +50,8 @@ static const char rcsid[] = #include "stty.h" #include "extern.h" +static int c_cchar __P((const void *, const void *)); + /* * Special control characters. * @@ -77,14 +79,14 @@ struct cchar cchars1[] = { { "susp", VSUSP, CSUSP }, { "time", VTIME, CTIME }, { "werase", VWERASE, CWERASE }, - { NULL }, + { NULL, 0, 0}, }; struct cchar cchars2[] = { { "brk", VEOL, CEOL }, { "flush", VDISCARD, CDISCARD }, { "rprnt", VREPRINT, CREPRINT }, - { NULL }, + { NULL, 0, 0 }, }; static int @@ -92,7 +94,7 @@ c_cchar(a, b) const void *a, *b; { - return (strcmp(((struct cchar *)a)->name, ((struct cchar *)b)->name)); + return (strcmp(((const struct cchar *)a)->name, ((const struct cchar *)b)->name)); } int diff --git a/bin/stty/gfmt.c b/bin/stty/gfmt.c index b34a117..2422a46 100644 --- a/bin/stty/gfmt.c +++ b/bin/stty/gfmt.c @@ -48,9 +48,11 @@ static const char rcsid[] = #include "stty.h" #include "extern.h" +static void gerr __P((const char *s)); + static void gerr(s) - char *s; + const char *s; { if (s) errx(1, "illegal gfmt1 option -- %s", s); diff --git a/bin/stty/key.c b/bin/stty/key.c index ba33a81..e4caf6f 100644 --- a/bin/stty/key.c +++ b/bin/stty/key.c @@ -52,6 +52,7 @@ static const char rcsid[] = #include "extern.h" __BEGIN_DECLS +static int c_key __P((const void *, const void *)); void f_all __P((struct info *)); void f_cbreak __P((struct info *)); void f_columns __P((struct info *)); @@ -70,7 +71,7 @@ void f_tty __P((struct info *)); __END_DECLS static struct key { - char *name; /* name */ + const char *name; /* name */ void (*f) __P((struct info *)); /* function */ #define F_NEEDARG 0x01 /* needs an argument */ #define F_OFFOK 0x02 /* can turn off */ @@ -102,7 +103,7 @@ c_key(a, b) const void *a, *b; { - return (strcmp(((struct key *)a)->name, ((struct key *)b)->name)); + return (strcmp(((const struct key *)a)->name, ((const struct key *)b)->name)); } int @@ -209,7 +210,7 @@ f_ispeed(ip) struct info *ip; { - cfsetispeed(&ip->t, atoi(ip->arg)); + cfsetispeed(&ip->t, (speed_t)atoi(ip->arg)); ip->set = 1; } @@ -233,7 +234,7 @@ f_ospeed(ip) struct info *ip; { - cfsetospeed(&ip->t, atoi(ip->arg)); + cfsetospeed(&ip->t, (speed_t)atoi(ip->arg)); ip->set = 1; } diff --git a/bin/stty/modes.c b/bin/stty/modes.c index f724a537..926dc7d 100644 --- a/bin/stty/modes.c +++ b/bin/stty/modes.c @@ -44,8 +44,10 @@ static const char rcsid[] = #include #include "stty.h" +int msearch __P((char ***, struct info *)); + struct modes { - char *name; + const char *name; long set; long unset; }; @@ -93,7 +95,7 @@ struct modes cmodes[] = { { "-rtsflow", 0, CRTS_IFLOW }, { "mdmbuf", MDMBUF, 0 }, { "-mdmbuf", 0, MDMBUF }, - { NULL }, + { NULL, 0, 0 }, }; struct modes imodes[] = { @@ -129,7 +131,7 @@ struct modes imodes[] = { { "-decctlq", IXANY, 0 }, { "imaxbel", IMAXBEL, 0 }, { "-imaxbel", 0, IMAXBEL }, - { NULL }, + { NULL, 0, 0 }, }; struct modes lmodes[] = { @@ -181,7 +183,7 @@ struct modes lmodes[] = { { "-nokerninfo",0, NOKERNINFO }, { "kerninfo", 0, NOKERNINFO }, { "-kerninfo", NOKERNINFO, 0 }, - { NULL }, + { NULL, 0, 0 }, }; struct modes omodes[] = { @@ -201,7 +203,7 @@ struct modes omodes[] = { { "-onocr", 0, ONOCR }, { "onlret", ONLRET, 0 }, { "-onlret", 0, ONLRET }, - { NULL }, + { NULL, 0, 0 }, }; #define CHK(s) (*name == s[0] && !strcmp(name, s)) diff --git a/bin/stty/print.c b/bin/stty/print.c index 364b95b..6aff06a 100644 --- a/bin/stty/print.c +++ b/bin/stty/print.c @@ -50,9 +50,9 @@ static const char rcsid[] = #include /* XXX NTTYDISC is too well hidden */ -static void binit __P((char *)); -static void bput __P((char *)); -static char *ccval __P((struct cchar *, int)); +static void binit __P((const char *)); +static void bput __P((const char *)); +static const char *ccval __P((struct cchar *, int)); void print(tp, wp, ldisc, fmt) @@ -225,11 +225,11 @@ print(tp, wp, ldisc, fmt) } static int col; -static char *label; +static const char *label; static void binit(lb) - char *lb; + const char *lb; { if (col) { @@ -241,7 +241,7 @@ binit(lb) static void bput(s) - char *s; + const char *s; { if (col == 0) { @@ -256,7 +256,7 @@ bput(s) col += printf(" %s", s); } -static char * +static const char * ccval(p, c) struct cchar *p; int c; diff --git a/bin/stty/stty.c b/bin/stty/stty.c index 7a83c4f..d794544 100644 --- a/bin/stty/stty.c +++ b/bin/stty/stty.c @@ -59,6 +59,8 @@ static const char rcsid[] = #include "stty.h" #include "extern.h" +int main __P((int, char *[])); + int main(argc, argv) int argc; @@ -131,7 +133,7 @@ args: argc -= optind; continue; if (isdigit(**argv)) { - int speed; + speed_t speed; speed = atoi(*argv); cfsetospeed(&i.t, speed); diff --git a/bin/stty/stty.h b/bin/stty/stty.h index e122979..d20f0c6 100644 --- a/bin/stty/stty.h +++ b/bin/stty/stty.h @@ -43,13 +43,13 @@ struct info { int off; /* turn off */ int set; /* need set */ int wset; /* need window set */ - char *arg; /* argument */ + const char *arg; /* argument */ struct termios t; /* terminal info */ struct winsize win; /* window info */ }; struct cchar { - char *name; + const char *name; int sub; u_char def; }; -- cgit v1.1