home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / gnu / glibc-1.06 / sysdeps / generic / speed.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-01-15  |  1.8 KB  |  73 lines

  1. /* Copyright (C) 1991, 1992 Free Software Foundation, Inc.
  2. This file is part of the GNU C Library.
  3.  
  4. The GNU C Library is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU Library General Public License as
  6. published by the Free Software Foundation; either version 2 of the
  7. License, or (at your option) any later version.
  8.  
  9. The GNU C Library is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  12. Library General Public License for more details.
  13.  
  14. You should have received a copy of the GNU Library General Public
  15. License along with the GNU C Library; see the file COPYING.LIB.  If
  16. not, write to the Free Software Foundation, Inc., 675 Mass Ave,
  17. Cambridge, MA 02139, USA.  */
  18.  
  19. #include <ansidecl.h>
  20. #include <stddef.h>
  21. #include <errno.h>
  22. #include <termios.h>
  23.  
  24.  
  25. #undef    cfgetospeed
  26. #undef    cfgetispeed
  27. #undef    cfsetospeed
  28. #undef    cfsetispeed
  29.  
  30. /* Return the output baud rate stored in *TERMIOS_P.  */
  31. speed_t
  32. DEFUN(cfgetospeed, (termios_p), CONST struct termios *termios_p)
  33. {
  34.   return termios_p->__ospeed;
  35. }
  36.  
  37. /* Return the input baud rate stored in *TERMIOS_P.  */
  38. speed_t
  39. DEFUN(cfgetispeed, (termios_p), CONST struct termios *termios_p)
  40. {
  41.   return termios_p->__ispeed;
  42. }
  43.  
  44. /* Set the output baud rate stored in *TERMIOS_P to SPEED.  */
  45. int
  46. DEFUN(cfsetospeed, (termios_p, speed),
  47.       struct termios *termios_p AND speed_t speed)
  48. {
  49.   if (termios_p == NULL)
  50.     {
  51.       errno = EINVAL;
  52.       return -1;
  53.     }
  54.  
  55.   termios_p->__ospeed = speed;
  56.   return 0;
  57. }
  58.  
  59. /* Set the input baud rate stored in *TERMIOS_P to SPEED.  */
  60. int
  61. DEFUN(cfsetispeed, (termios_p, speed),
  62.       struct termios *termios_p AND speed_t speed)
  63. {
  64.   if (termios_p == NULL)
  65.     {
  66.       errno = EINVAL;
  67.       return -1;
  68.     }
  69.  
  70.   termios_p->__ispeed = speed;
  71.   return 0;
  72. }
  73.