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