mirror of
https://github.com/freebsd/freebsd-src
synced 2024-09-23 18:25:19 +00:00
gfmt: set 'changed' flags only if something really changed.
This commit is contained in:
parent
d0834e7f9d
commit
18430c2095
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=59715
|
@ -77,15 +77,16 @@ gprint(tp, wp, ldisc, timeout)
|
|||
}
|
||||
|
||||
void
|
||||
gread(tp, top, s)
|
||||
struct termios *tp;
|
||||
int *top;
|
||||
gread(i, s)
|
||||
struct info *i;
|
||||
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;) {
|
||||
|
@ -100,33 +101,40 @@ gread(tp, top, 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);
|
||||
*top = tmp;
|
||||
i->timeout = tmp;
|
||||
i->tset = 1;
|
||||
continue;
|
||||
}
|
||||
for (cp = cchars1; cp->name != NULL; ++cp)
|
||||
|
@ -134,6 +142,7 @@ gread(tp, top, 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)
|
||||
|
|
|
@ -143,9 +143,7 @@ args: argc -= optind;
|
|||
}
|
||||
|
||||
if (!strncmp(*argv, "gfmt1", sizeof("gfmt1") - 1)) {
|
||||
gread(&i.t, &i.timeout, *argv + sizeof("gfmt1") - 1);
|
||||
i.set = 1;
|
||||
i.tset = 1;
|
||||
gread(&i, *argv + sizeof("gfmt1") - 1);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue