BDECFLAGS cleanup

This commit is contained in:
Kris Kennaway 2001-05-18 11:04:19 +00:00
parent 2862006272
commit 5e5a566754
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=76810
7 changed files with 32 additions and 23 deletions

View File

@ -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

View File

@ -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);

View File

@ -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;
}

View File

@ -44,8 +44,10 @@ static const char rcsid[] =
#include <string.h>
#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))

View File

@ -50,9 +50,9 @@ static const char rcsid[] =
#include <sys/ioctl_compat.h> /* 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;

View File

@ -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);

View File

@ -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;
};