summaryrefslogtreecommitdiffstats
path: root/usr.bin/tset
diff options
context:
space:
mode:
authorache <ache@FreeBSD.org>1995-08-04 06:44:54 +0000
committerache <ache@FreeBSD.org>1995-08-04 06:44:54 +0000
commit53823cfb2c2c1b11a77f7d0d8ac23f896d19b0ae (patch)
tree8cc5bb9a77228b44f029852032cc3423734669d3 /usr.bin/tset
parent3631ae6f9fa6aab4f69713033cb5e239255f334c (diff)
downloadFreeBSD-src-53823cfb2c2c1b11a77f7d0d8ac23f896d19b0ae.zip
FreeBSD-src-53823cfb2c2c1b11a77f7d0d8ac23f896d19b0ae.tar.gz
Make tset works with non-fixed termios speeds too.
Eliminate ospeed switch using new _set_ospeed function
Diffstat (limited to 'usr.bin/tset')
-rw-r--r--usr.bin/tset/extern.h12
-rw-r--r--usr.bin/tset/map.c28
-rw-r--r--usr.bin/tset/tset.c29
3 files changed, 8 insertions, 61 deletions
diff --git a/usr.bin/tset/extern.h b/usr.bin/tset/extern.h
index 0465a66..29acfac 100644
--- a/usr.bin/tset/extern.h
+++ b/usr.bin/tset/extern.h
@@ -33,15 +33,7 @@
* @(#)extern.h 8.1 (Berkeley) 6/9/93
*/
-/* This should be in <termcap.h> instead. */
-extern char PC;
-extern short ospeed;
-int tgetent __P((char *, char *));
-int tgetflag __P((char *));
-int tgetnum __P((char *));
-char *tgetstr __P((char *, char **));
-char *tgoto __P((char *, int, int));
-int tputs __P((char *, int, void (*) __P((int))));
+#include <termcap.h>
extern struct termios mode, oldmode;
extern int columns, isreset, lines;
@@ -52,7 +44,7 @@ void cat __P((char *));
void err __P((const char *, ...));
char *get_termcap_entry __P((char *, char **));
char *mapped __P((char *));
-void outc __P((int));
+int outc __P((int));
void reset_mode __P((void));
void set_control_chars __P((void));
void set_conversions __P((int));
diff --git a/usr.bin/tset/map.c b/usr.bin/tset/map.c
index b20f43d..2e71d2c 100644
--- a/usr.bin/tset/map.c
+++ b/usr.bin/tset/map.c
@@ -225,30 +225,9 @@ typedef struct speeds {
SPEEDS speeds[] = {
"0", B0,
- "50", B50,
- "75", B75,
- "110", B110,
- "134", B134,
"134.5", B134,
- "150", B150,
- "200", B200,
- "300", B300,
- "600", B600,
- "1200", B1200,
- "1800", B1800,
- "2400", B2400,
- "4800", B4800,
- "9600", B9600,
- "19200", B19200,
- "38400", B38400,
"exta", B19200,
"extb", B38400,
-#ifdef B57600
- "57600", B57600,
-#endif
-#ifdef B115200
- "115200", B115200,
-#endif
NULL
};
@@ -257,6 +236,7 @@ baudrate(rate)
char *rate;
{
SPEEDS *sp;
+ speed_t speed;
/* The baudrate number can be preceded by a 'B', which is ignored. */
if (*rate == 'B')
@@ -265,6 +245,8 @@ baudrate(rate)
for (sp = speeds; sp->string; ++sp)
if (!strcasecmp(rate, sp->string))
return (sp->speed);
- err("unknown baud rate %s", rate);
- /* NOTREACHED */
+ speed = atol(rate);
+ if (speed == 0)
+ err("unknown baud rate %s", rate);
+ return speed;
}
diff --git a/usr.bin/tset/tset.c b/usr.bin/tset/tset.c
index 74e12f3..0e09afc 100644
--- a/usr.bin/tset/tset.c
+++ b/usr.bin/tset/tset.c
@@ -81,34 +81,7 @@ main(argc, argv)
oldmode = 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
- }
+ _set_ospeed(Ospeed);
if (p = strrchr(*argv, '/'))
++p;
OpenPOWER on IntegriCloud