Make tset works with non-fixed termios speeds too.
Eliminate ospeed switch using new _set_ospeed function
This commit is contained in:
parent
3631ae6f9f
commit
53823cfb2c
@ -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));
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user