mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2024-11-15 23:05:49 +01:00
Back out all drainwait changes. It is enough controllable via sysctl or
comcontrol, having it in stty cause too many problems with existing drivers and tty access permissings of non-superuser. Asked-by: bde
This commit is contained in:
parent
3363a08f8c
commit
df41cfee75
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=59788
@ -38,12 +38,12 @@ int c_cchars __P((const void *, const void *));
|
||||
int c_modes __P((const void *, const void *));
|
||||
int csearch __P((char ***, struct info *));
|
||||
void checkredirect __P((void));
|
||||
void gprint __P((struct termios *, struct winsize *, int, int));
|
||||
void gread __P((struct info *, char *));
|
||||
void gprint __P((struct termios *, struct winsize *, int));
|
||||
void gread __P((struct termios *, char *));
|
||||
int ksearch __P((char ***, struct info *));
|
||||
int msearch __P((char ***, struct info *));
|
||||
void optlist __P((void));
|
||||
void print __P((struct termios *, struct winsize *, int, int, enum FMT));
|
||||
void print __P((struct termios *, struct winsize *, int, enum FMT));
|
||||
void usage __P((void));
|
||||
|
||||
extern struct cchar cchars1[], cchars2[];
|
||||
|
@ -59,11 +59,10 @@ gerr(s)
|
||||
}
|
||||
|
||||
void
|
||||
gprint(tp, wp, ldisc, timeout)
|
||||
gprint(tp, wp, ldisc)
|
||||
struct termios *tp;
|
||||
struct winsize *wp;
|
||||
int ldisc;
|
||||
int timeout;
|
||||
{
|
||||
struct cchar *cp;
|
||||
|
||||
@ -72,21 +71,19 @@ gprint(tp, wp, ldisc, timeout)
|
||||
(u_long)tp->c_oflag);
|
||||
for (cp = cchars1; cp->name; ++cp)
|
||||
(void)printf("%s=%x:", cp->name, tp->c_cc[cp->sub]);
|
||||
(void)printf("ispeed=%lu:ospeed=%lu:drainwait=%d\n",
|
||||
(u_long)cfgetispeed(tp), (u_long)cfgetospeed(tp), timeout);
|
||||
(void)printf("ispeed=%lu:ospeed=%lu\n",
|
||||
(u_long)cfgetispeed(tp), (u_long)cfgetospeed(tp));
|
||||
}
|
||||
|
||||
void
|
||||
gread(i, s)
|
||||
struct info *i;
|
||||
gread(tp, s)
|
||||
struct termios *tp;
|
||||
char *s;
|
||||
{
|
||||
struct cchar *cp;
|
||||
struct termios *tp;
|
||||
char *ep, *p;
|
||||
long tmp;
|
||||
|
||||
tp = &(i->t);
|
||||
if ((s = strchr(s, ':')) == NULL)
|
||||
gerr(NULL);
|
||||
for (++s; s != NULL;) {
|
||||
@ -101,42 +98,28 @@ gread(i, s)
|
||||
#define CHK(s) (*p == s[0] && !strcmp(p, s))
|
||||
if (CHK("cflag")) {
|
||||
tp->c_cflag = tmp;
|
||||
i->set = 1;
|
||||
continue;
|
||||
}
|
||||
if (CHK("iflag")) {
|
||||
tp->c_iflag = tmp;
|
||||
i->set = 1;
|
||||
continue;
|
||||
}
|
||||
if (CHK("ispeed")) {
|
||||
(void)sscanf(ep, "%ld", &tmp);
|
||||
tp->c_ispeed = tmp;
|
||||
i->set = 1;
|
||||
continue;
|
||||
}
|
||||
if (CHK("lflag")) {
|
||||
tp->c_lflag = tmp;
|
||||
i->set = 1;
|
||||
continue;
|
||||
}
|
||||
if (CHK("oflag")) {
|
||||
tp->c_oflag = tmp;
|
||||
i->set = 1;
|
||||
continue;
|
||||
}
|
||||
if (CHK("ospeed")) {
|
||||
(void)sscanf(ep, "%ld", &tmp);
|
||||
tp->c_ospeed = tmp;
|
||||
i->set = 1;
|
||||
continue;
|
||||
}
|
||||
if (CHK("drainwait")) {
|
||||
(void)sscanf(ep, "%ld", &tmp);
|
||||
if (i->timeout != tmp) {
|
||||
i->timeout = tmp;
|
||||
i->tset = 1;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
for (cp = cchars1; cp->name != NULL; ++cp)
|
||||
@ -144,7 +127,6 @@ gread(i, s)
|
||||
if (cp->sub == VMIN || cp->sub == VTIME)
|
||||
(void)sscanf(ep, "%ld", &tmp);
|
||||
tp->c_cc[cp->sub] = tmp;
|
||||
i->set = 1;
|
||||
break;
|
||||
}
|
||||
if (cp->name == NULL)
|
||||
|
@ -56,7 +56,6 @@ void f_all __P((struct info *));
|
||||
void f_cbreak __P((struct info *));
|
||||
void f_columns __P((struct info *));
|
||||
void f_dec __P((struct info *));
|
||||
void f_drainwait __P((struct info *));
|
||||
void f_everything __P((struct info *));
|
||||
void f_extproc __P((struct info *));
|
||||
void f_ispeed __P((struct info *));
|
||||
@ -83,7 +82,6 @@ static struct key {
|
||||
{ "columns", f_columns, F_NEEDARG },
|
||||
{ "cooked", f_sane, 0 },
|
||||
{ "dec", f_dec, 0 },
|
||||
{ "drainwait", f_drainwait, F_NEEDARG },
|
||||
{ "everything", f_everything, 0 },
|
||||
{ "extproc", f_extproc, F_OFFOK },
|
||||
{ "ispeed", f_ispeed, F_NEEDARG },
|
||||
@ -142,7 +140,7 @@ void
|
||||
f_all(ip)
|
||||
struct info *ip;
|
||||
{
|
||||
print(&ip->t, &ip->win, ip->ldisc, ip->timeout, BSD);
|
||||
print(&ip->t, &ip->win, ip->ldisc, BSD);
|
||||
}
|
||||
|
||||
void
|
||||
@ -184,21 +182,12 @@ f_dec(ip)
|
||||
ip->set = 1;
|
||||
}
|
||||
|
||||
void
|
||||
f_drainwait(ip)
|
||||
struct info *ip;
|
||||
{
|
||||
|
||||
ip->timeout = atoi(ip->arg);
|
||||
ip->tset = 1;
|
||||
}
|
||||
|
||||
void
|
||||
f_everything(ip)
|
||||
struct info *ip;
|
||||
{
|
||||
|
||||
print(&ip->t, &ip->win, ip->ldisc, ip->timeout, BSD);
|
||||
print(&ip->t, &ip->win, ip->ldisc, BSD);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -55,11 +55,10 @@ static void bput __P((char *));
|
||||
static char *ccval __P((struct cchar *, int));
|
||||
|
||||
void
|
||||
print(tp, wp, ldisc, timeout, fmt)
|
||||
print(tp, wp, ldisc, fmt)
|
||||
struct termios *tp;
|
||||
struct winsize *wp;
|
||||
int ldisc;
|
||||
int timeout;
|
||||
enum FMT fmt;
|
||||
{
|
||||
struct cchar *p;
|
||||
@ -97,8 +96,7 @@ print(tp, wp, ldisc, timeout, fmt)
|
||||
else
|
||||
cnt += printf("speed %d baud;", ispeed);
|
||||
if (fmt >= BSD)
|
||||
cnt += printf(" %d rows; %d columns; drainwait %d seconds;",
|
||||
wp->ws_row, wp->ws_col, timeout);
|
||||
cnt += printf(" %d rows; %d columns;", wp->ws_row, wp->ws_col);
|
||||
if (cnt)
|
||||
(void)printf("\n");
|
||||
|
||||
|
@ -462,8 +462,6 @@ characters are set to ^?, ^U, and ^C;
|
||||
is disabled, and
|
||||
.Dv crt
|
||||
is enabled.)
|
||||
.It Cm drainwait Ar number
|
||||
Set output drain timeout in seconds.
|
||||
.It Cm extproc Pq Fl extproc
|
||||
If set, this flag indicates that some amount of terminal processing is being
|
||||
performed by either the terminal hardware or by the remote side connected
|
||||
|
@ -103,8 +103,6 @@ args: argc -= optind;
|
||||
err(1, "TIOCGETD");
|
||||
if (ioctl(i.fd, TIOCGWINSZ, &i.win) < 0)
|
||||
warn("TIOCGWINSZ: %s\n", strerror(errno));
|
||||
if (ioctl(i.fd, TIOCGDRAINWAIT, &i.timeout) < 0)
|
||||
warn("TIOCGDRAINWAIT: %s\n", strerror(errno));
|
||||
|
||||
checkredirect(); /* conversion aid */
|
||||
|
||||
@ -115,14 +113,14 @@ args: argc -= optind;
|
||||
/* FALLTHROUGH */
|
||||
case BSD:
|
||||
case POSIX:
|
||||
print(&i.t, &i.win, i.ldisc, i.timeout, fmt);
|
||||
print(&i.t, &i.win, i.ldisc, fmt);
|
||||
break;
|
||||
case GFLAG:
|
||||
gprint(&i.t, &i.win, i.ldisc, i.timeout);
|
||||
gprint(&i.t, &i.win, i.ldisc);
|
||||
break;
|
||||
}
|
||||
|
||||
for (i.set = i.wset = i.tset = 0; *argv; ++argv) {
|
||||
for (i.set = i.wset = 0; *argv; ++argv) {
|
||||
if (ksearch(&argv, &i))
|
||||
continue;
|
||||
|
||||
@ -143,7 +141,8 @@ args: argc -= optind;
|
||||
}
|
||||
|
||||
if (!strncmp(*argv, "gfmt1", sizeof("gfmt1") - 1)) {
|
||||
gread(&i, *argv + sizeof("gfmt1") - 1);
|
||||
gread(&i.t, *argv + sizeof("gfmt1") - 1);
|
||||
i.set = 1;
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -155,8 +154,6 @@ args: argc -= optind;
|
||||
err(1, "tcsetattr");
|
||||
if (i.wset && ioctl(i.fd, TIOCSWINSZ, &i.win) < 0)
|
||||
warn("TIOCSWINSZ");
|
||||
if (i.tset && ioctl(i.fd, TIOCSDRAINWAIT, &i.timeout) < 0)
|
||||
warn("TIOCSDRAINWAIT");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
@ -43,11 +43,9 @@ struct info {
|
||||
int off; /* turn off */
|
||||
int set; /* need set */
|
||||
int wset; /* need window set */
|
||||
int tset; /* need timeout set */
|
||||
char *arg; /* argument */
|
||||
struct termios t; /* terminal info */
|
||||
struct winsize win; /* window info */
|
||||
int timeout; /* drain wait time */
|
||||
};
|
||||
|
||||
struct cchar {
|
||||
|
Loading…
Reference in New Issue
Block a user