summary refs log tree commit diff stats
path: root/lib/posix/termios.nim
diff options
context:
space:
mode:
Diffstat (limited to 'lib/posix/termios.nim')
-rw-r--r--lib/posix/termios.nim26
1 files changed, 19 insertions, 7 deletions
diff --git a/lib/posix/termios.nim b/lib/posix/termios.nim
index af62bdb3d..21b21aefb 100644
--- a/lib/posix/termios.nim
+++ b/lib/posix/termios.nim
@@ -18,13 +18,25 @@ type
 const
   NCCS* = when defined(macosx): 20 else: 32
 
-type
-  Termios* {.importc: "struct termios", header: "<termios.h>".} = object
-    c_iflag*: Cflag        # input mode flags
-    c_oflag*: Cflag        # output mode flags
-    c_cflag*: Cflag        # control mode flags
-    c_lflag*: Cflag        # local mode flags
-    c_cc*: array[NCCS, cuchar]  # control characters
+when defined(linux) and defined(amd64):
+  type
+    Termios* {.importc: "struct termios", header: "<termios.h>".} = object
+      c_iflag*: Cflag        # input mode flags
+      c_oflag*: Cflag        # output mode flags
+      c_cflag*: Cflag        # control mode flags
+      c_lflag*: Cflag        # local mode flags
+      c_line*: cuchar
+      c_cc*: array[NCCS, cuchar]  # control characters
+      c_ispeed*: Speed
+      c_ospeed*: Speed
+else:
+  type
+    Termios* {.importc: "struct termios", header: "<termios.h>".} = object
+      c_iflag*: Cflag        # input mode flags
+      c_oflag*: Cflag        # output mode flags
+      c_cflag*: Cflag        # control mode flags
+      c_lflag*: Cflag        # local mode flags
+      c_cc*: array[NCCS, cuchar]  # control characters
 
 # cc characters