diff options
author | ache <ache@FreeBSD.org> | 2000-04-27 21:45:41 +0000 |
---|---|---|
committer | ache <ache@FreeBSD.org> | 2000-04-27 21:45:41 +0000 |
commit | 1ce5b73060cd981653d3ff469469f7800a5bd3cb (patch) | |
tree | 66aefabb376fbe163b05173c555b18cedd220a37 | |
parent | ecbfef142fe07cfdc2340f8798a40ccb16381424 (diff) | |
download | FreeBSD-src-1ce5b73060cd981653d3ff469469f7800a5bd3cb.zip FreeBSD-src-1ce5b73060cd981653d3ff469469f7800a5bd3cb.tar.gz |
gfmt: set 'changed' flags only if something really changed.
-rw-r--r-- | bin/stty/gfmt.c | 17 | ||||
-rw-r--r-- | bin/stty/stty.c | 4 |
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; } |