summaryrefslogtreecommitdiffstats
path: root/bin/stty
diff options
context:
space:
mode:
Diffstat (limited to 'bin/stty')
-rw-r--r--bin/stty/gfmt.c17
-rw-r--r--bin/stty/stty.c4
2 files changed, 14 insertions, 7 deletions
diff --git a/bin/stty/gfmt.c b/bin/stty/gfmt.c
index 38ee46f..19baf83 100644
--- a/bin/stty/gfmt.c
+++ b/bin/stty/gfmt.c
@@ -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)
diff --git a/bin/stty/stty.c b/bin/stty/stty.c
index b9f0811..355d1cd 100644
--- a/bin/stty/stty.c
+++ b/bin/stty/stty.c
@@ -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;
}
OpenPOWER on IntegriCloud