mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
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.
This commit is contained in:
parent
28fccc1749
commit
d2b6c8e037
2 changed files with 46 additions and 10 deletions
|
|
@ -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;
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in a new issue