summaryrefslogtreecommitdiffstats
path: root/usr.bin/tset
diff options
context:
space:
mode:
authorache <ache@FreeBSD.org>1994-09-09 03:11:15 +0000
committerache <ache@FreeBSD.org>1994-09-09 03:11:15 +0000
commitb67f029f0280a2f51ca65b4d7967a0a8d3a904bd (patch)
treeea9c411e8be61a61cd041a01c59bf9f047102927 /usr.bin/tset
parentaebfcd0c1d6de92964d9bb3f80cc98c5e66f1d84 (diff)
downloadFreeBSD-src-b67f029f0280a2f51ca65b4d7967a0a8d3a904bd.zip
FreeBSD-src-b67f029f0280a2f51ca65b4d7967a0a8d3a904bd.tar.gz
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.
Diffstat (limited to 'usr.bin/tset')
-rw-r--r--usr.bin/tset/map.c25
-rw-r--r--usr.bin/tset/tset.c31
2 files changed, 46 insertions, 10 deletions
diff --git a/usr.bin/tset/map.c b/usr.bin/tset/map.c
index 56cb725..b20f43d 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 3cc2a13..c015630 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;
OpenPOWER on IntegriCloud