home *** CD-ROM | disk | FTP | other *** search
/ Serving the Web / ServingTheWeb1995.disc1of1.iso / linux / slacksrce / d / libc / libc-4.6 / libc-4 / libc-linux / posix / cfsetget.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-11-24  |  558 b   |  33 lines

  1. #include <termios.h>
  2.  
  3. speed_t cfgetospeed(struct termios *tp)
  4. {
  5.     return (tp->c_cflag & CBAUD);
  6. }
  7.  
  8. speed_t cfgetispeed(struct termios *tp)
  9. {
  10.     return (tp->c_cflag & CBAUD);
  11. }
  12.  
  13. int cfsetospeed(struct termios *tp, speed_t speed)
  14. {
  15. #ifdef CBAUDEX
  16.     if ((speed & ~CBAUD) || 
  17.     ((speed & CBAUDEX) && (speed < B57600 || speed > B115200)))
  18.     return 0;
  19. #else
  20.     if (speed & ~CBAUD)
  21.     return 0;
  22. #endif
  23.     tp->c_cflag &= ~CBAUD;
  24.     tp->c_cflag |= speed;
  25.  
  26.     return 0;
  27. }
  28.  
  29. int cfsetispeed(struct termios *tp, speed_t speed)
  30. {
  31.     return cfsetospeed(tp, speed);
  32. }
  33.