diff options
author | Andrey A. Chernov <ache@FreeBSD.org> | 1994-09-09 03:11:15 +0000 |
---|---|---|
committer | Andrey A. Chernov <ache@FreeBSD.org> | 1994-09-09 03:11:15 +0000 |
commit | d2b6c8e0374d0024de7e29bf8672cc683cb71db2 (patch) | |
tree | ea9c411e8be61a61cd041a01c59bf9f047102927 | |
parent | 28fccc17496286693b89a088778b59c0006eb6c1 (diff) | |
download | src-d2b6c8e0374d0024de7e29bf8672cc683cb71db2.tar.gz src-d2b6c8e0374d0024de7e29bf8672cc683cb71db2.zip |
Speed matching code never successful, because ospeed range is [0..17]
but termios speed range is [0..115200]. Of cource ospeed initialized
with wrong value too which cann affects terminals with padding, fixed.
57600,115200 added.
Notes
Notes:
svn path=/head/; revision=2599
-rw-r--r-- | usr.bin/tset/map.c | 25 | ||||
-rw-r--r-- | usr.bin/tset/tset.c | 31 |
2 files changed, 46 insertions, 10 deletions
diff --git a/usr.bin/tset/map.c b/usr.bin/tset/map.c index 56cb725f5139..b20f43d3808f 100644 --- a/usr.bin/tset/map.c +++ b/usr.bin/tset/map.c @@ -42,7 +42,8 @@ static char sccsid[] = "@(#)map.c 8.1 (Berkeley) 6/9/93"; #include <string.h> #include "extern.h" -int baudrate __P((char *)); +extern speed_t Ospeed; +speed_t baudrate __P((char *)); /* Baud rate conditionals for mapping. */ #define GT 0x01 @@ -57,7 +58,7 @@ typedef struct map { char *porttype; /* Port type, or "" for any. */ char *type; /* Terminal type to select. */ int conditional; /* Baud rate conditionals bitmask. */ - int speed; /* Baud rate to compare against. */ + speed_t speed; /* Baud rate to compare against. */ } MAP; MAP *cur, *maplist; @@ -195,19 +196,19 @@ mapped(type) match = 1; break; case EQ: - match = (ospeed == mapp->speed); + match = (Ospeed == mapp->speed); break; case GE: - match = (ospeed >= mapp->speed); + match = (Ospeed >= mapp->speed); break; case GT: - match = (ospeed > mapp->speed); + match = (Ospeed > mapp->speed); break; case LE: - match = (ospeed <= mapp->speed); + match = (Ospeed <= mapp->speed); break; case LT: - match = (ospeed < mapp->speed); + match = (Ospeed < mapp->speed); break; } if (match) @@ -219,7 +220,7 @@ mapped(type) typedef struct speeds { char *string; - int speed; + speed_t speed; } SPEEDS; SPEEDS speeds[] = { @@ -242,10 +243,16 @@ SPEEDS speeds[] = { "38400", B38400, "exta", B19200, "extb", B38400, +#ifdef B57600 + "57600", B57600, +#endif +#ifdef B115200 + "115200", B115200, +#endif NULL }; -int +speed_t baudrate(rate) char *rate; { diff --git a/usr.bin/tset/tset.c b/usr.bin/tset/tset.c index 3cc2a133b8a3..c0156300d410 100644 --- a/usr.bin/tset/tset.c +++ b/usr.bin/tset/tset.c @@ -63,6 +63,7 @@ int intrchar; /* new interrupt character */ int isreset; /* invoked as reset */ int killchar; /* new kill character */ int lines, columns; /* window size */ +speed_t Ospeed; int main(argc, argv) @@ -79,7 +80,35 @@ main(argc, argv) err("standard error: %s", strerror(errno)); oldmode = mode; - ospeed = cfgetospeed(&mode); + Ospeed = cfgetospeed(&mode); + switch(Ospeed) { + case B0: ospeed = 0; break; + case B50: ospeed = 1; break; + case B75: ospeed = 2; break; + case B110: ospeed = 3; break; + case B134: ospeed = 4; break; + case B150: ospeed = 5; break; + case B200: ospeed = 6; break; + case B300: ospeed = 7; break; + case B600: ospeed = 8; break; + case B1200: ospeed = 9; break; + case B1800: ospeed = 10; break; + case B2400: ospeed = 11; break; + case B4800: ospeed = 12; break; + case B9600: ospeed = 13; break; +#ifdef EXTA + case EXTA: ospeed = 14; break; +#endif +#ifdef EXTB + case EXTB: ospeed = 15; break; +#endif +#ifdef B57600 + case B57600: ospeed = 16; break; +#endif +#ifdef B115200 + case B115200: ospeed = 17; break; +#endif + } if (p = strrchr(*argv, '/')) ++p; |