summaryrefslogtreecommitdiff
path: root/src/termios/cfsetospeed.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/termios/cfsetospeed.c')
-rw-r--r--src/termios/cfsetospeed.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/termios/cfsetospeed.c b/src/termios/cfsetospeed.c
new file mode 100644
index 00000000..9c11b4d8
--- /dev/null
+++ b/src/termios/cfsetospeed.c
@@ -0,0 +1,36 @@
+#include <termios.h>
+#include "nonstd/assert.h"
+
+int cfsetospeed(struct termios *termios_p, speed_t speed)
+{
+ ASSERT_NONNULL(termios_p);
+ switch (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:
+ termios_p->c_oflag = speed; /* FIXME */
+ return 0;
+
+ default:
+ break;
+ }
+
+ errno = EINVAL;
+ return -1;
+}
+/*
+POSIX(1)
+*/