Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2003-04-16 07:03:45 +0400
committerChristopher Faylor <me@cgf.cx>2003-04-16 07:03:45 +0400
commitc448f78fd56ef8d34474adc2678d6394a4d088ec (patch)
tree8b0177d10bddf05d3648e296b07ab13e218115e8 /winsup/cygwin/termios.cc
parent9eed5df6392240b46c2506dcb37227ee73f5a806 (diff)
* termios.cc (setspeed): New function.
(cfsetospeed): Use setspeed to set speed. (cfsetispeed): Use setspeed to set speed. * autoload.cc: Add load statement for UuidCreate, and UuidCreateSequential. * cpuid.h: New file. * cygwin.din: Export gethostid. * fhandler_proc.cc (cpuid): Move to cpuid.h. (can_set_flag): Move to cpuid.h. * syscalls.cc (gethostid): New function. * version.h: Bump DLL minor version number to 83.
Diffstat (limited to 'winsup/cygwin/termios.cc')
-rw-r--r--winsup/cygwin/termios.cc46
1 files changed, 42 insertions, 4 deletions
diff --git a/winsup/cygwin/termios.cc b/winsup/cygwin/termios.cc
index ac1c89bf0..c7dd20d60 100644
--- a/winsup/cygwin/termios.cc
+++ b/winsup/cygwin/termios.cc
@@ -247,14 +247,52 @@ cfgetispeed (struct termios *tp)
return __tonew_termios (tp)->c_ispeed;
}
+static inline int
+setspeed (speed_t &set_speed, speed_t from_speed)
+{
+ int res;
+ switch (from_speed)
+ {
+ case B0:
+ case B50:
+ case B75:
+ case B110:
+ case B134:
+ case B150:
+ case B200:
+ case B300:
+ case B600:
+ case B1200:
+ case B1800:
+ case B2400:
+ case B4800:
+ case B9600:
+ case B19200:
+ case B38400:
+ case B57600:
+ case B115200:
+ case B128000:
+ case B230400:
+ case B256000:
+ set_speed = from_speed;
+ res = 0;
+ break;
+ default:
+ set_errno (EINVAL);
+ res = -1;
+ break;
+ }
+ return res;
+}
+
/* cfsetospeed: POSIX96 7.1.3.1 */
extern "C" int
cfsetospeed (struct termios *in_tp, speed_t speed)
{
struct termios *tp = __tonew_termios (in_tp);
- tp->c_ospeed = speed;
+ int res = setspeed (tp->c_ospeed, speed);
(void) __toapp_termios (in_tp, tp);
- return 0;
+ return res;
}
/* cfsetispeed: POSIX96 7.1.3.1 */
@@ -262,7 +300,7 @@ extern "C" int
cfsetispeed (struct termios *in_tp, speed_t speed)
{
struct termios *tp = __tonew_termios (in_tp);
- tp->c_ispeed = speed;
+ int res = setspeed (tp->c_ispeed, speed);
(void) __toapp_termios (in_tp, tp);
- return 0;
+ return res;
}