mirror of
https://sourceware.org/git/glibc.git
synced 2024-12-22 19:00:07 +00:00
entered into RCS
This commit is contained in:
parent
7ebb6b1f3c
commit
4f65119178
@ -47,14 +47,14 @@ static CONST speed_t speeds[] =
|
||||
speed_t
|
||||
DEFUN(cfgetospeed, (termios_p), CONST struct termios *termios_p)
|
||||
{
|
||||
return speeds[termios_p->c_cflag & CBAUD];
|
||||
return termios_p->c_cflag & CBAUD;
|
||||
}
|
||||
|
||||
/* Return the input baud rate stored in *TERMIOS_P. */
|
||||
speed_t
|
||||
DEFUN(cfgetispeed, (termios_p), CONST struct termios *termios_p)
|
||||
{
|
||||
return speeds[(termios_p->c_cflag & CIBAUD) >> IBSHIFT];
|
||||
return (termios_p->c_cflag & CIBAUD) >> IBSHIFT;
|
||||
}
|
||||
|
||||
/* Set the output baud rate stored in *TERMIOS_P to SPEED. */
|
||||
@ -70,8 +70,12 @@ DEFUN(cfsetospeed, (termios_p, speed),
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* This allows either B1200 or 1200 to work. XXX
|
||||
Do we really want to try to support this, given that
|
||||
fetching the speed must return one or the other? */
|
||||
|
||||
for (i = 0; i < sizeof (speeds) / sizeof (speeds[0]); ++i)
|
||||
if (speeds[i] == speed)
|
||||
if (i == speed || speeds[i] == speed)
|
||||
{
|
||||
termios_p->c_cflag &= ~CBAUD;
|
||||
termios_p->c_cflag |= i;
|
||||
@ -95,8 +99,9 @@ DEFUN(cfsetispeed, (termios_p, speed),
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* See comment in cfsetospeed (above). */
|
||||
for (i = 0; i < sizeof (speeds) / sizeof (speeds[0]); ++i)
|
||||
if (speeds[i] == speed)
|
||||
if (i == speed || speeds[i] == speed)
|
||||
{
|
||||
termios_p->c_cflag &= ~CIBAUD;
|
||||
termios_p->c_cflag |= i << IBSHIFT;
|
||||
|
@ -107,6 +107,28 @@ struct termios
|
||||
#define CIBAUD 0x000f0000 /* Mask for input speed from c_cflag. */
|
||||
#define CBAUD 0x0000000f /* Mask for output speed from c_cflag. */
|
||||
#define IBSHIFT 16 /* Bits to shift for input speed. */
|
||||
#endif
|
||||
|
||||
/* Input and output baud rates. These are encoded in c_cflag. */
|
||||
#define B0 0
|
||||
#define B50 1
|
||||
#define B75 2
|
||||
#define B110 3
|
||||
#define B134 4
|
||||
#define B150 5
|
||||
#define B200 6
|
||||
#define B300 7
|
||||
#define B600 8
|
||||
#define B1200 9
|
||||
#define B1800 10
|
||||
#define B2400 11
|
||||
#define B4800 12
|
||||
#define B9600 13
|
||||
#define B19200 14
|
||||
#define B38400 15
|
||||
#ifdef __USE_BSD
|
||||
#define EXTA 14
|
||||
#define EXTB 15
|
||||
#endif
|
||||
|
||||
/* Local modes. */
|
||||
|
Loading…
Reference in New Issue
Block a user