diff options
Diffstat (limited to 'lib/posix/termios.nim')
-rw-r--r-- | lib/posix/termios.nim | 32 |
1 files changed, 27 insertions, 5 deletions
diff --git a/lib/posix/termios.nim b/lib/posix/termios.nim index 60d540107..7fb6bb81c 100644 --- a/lib/posix/termios.nim +++ b/lib/posix/termios.nim @@ -7,13 +7,11 @@ # distribution, for details about the copyright. # -{.deadCodeElim: on.} # dce option deprecated -import posix +import std/posix type Speed* = cuint Cflag* = cuint -{.deprecated: [Tcflag: Cflag].} const NCCS* = when defined(macosx): 20 else: 32 @@ -122,6 +120,21 @@ var B9600* {.importc, header: "<termios.h>".}: Speed B19200* {.importc, header: "<termios.h>".}: Speed B38400* {.importc, header: "<termios.h>".}: Speed + B57600* {.importc, header: "<termios.h>".}: Speed + B115200* {.importc, header: "<termios.h>".}: Speed + B230400* {.importc, header: "<termios.h>".}: Speed + B460800* {.importc, header: "<termios.h>".}: Speed + B500000* {.importc, header: "<termios.h>".}: Speed + B576000* {.importc, header: "<termios.h>".}: Speed + B921600* {.importc, header: "<termios.h>".}: Speed + B1000000* {.importc, header: "<termios.h>".}: Speed + B1152000* {.importc, header: "<termios.h>".}: Speed + B1500000* {.importc, header: "<termios.h>".}: Speed + B2000000* {.importc, header: "<termios.h>".}: Speed + B2500000* {.importc, header: "<termios.h>".}: Speed + B3000000* {.importc, header: "<termios.h>".}: Speed + B3500000* {.importc, header: "<termios.h>".}: Speed + B4000000* {.importc, header: "<termios.h>".}: Speed EXTA* {.importc, header: "<termios.h>".}: Speed EXTB* {.importc, header: "<termios.h>".}: Speed CSIZE* {.importc, header: "<termios.h>".}: Cflag @@ -224,11 +237,20 @@ proc tcFlow*(fd: cint; action: cint): cint {.importc: "tcflow", header: "<termios.h>".} # Get process group ID for session leader for controlling terminal FD. -# Window size ioctl. Should work on on any Unix that xterm has been ported to. -var TIOCGWINSZ*{.importc, header: "<sys/ioctl.h>".}: culong +# Window size ioctl. Solaris based systems have an uncommen place for this. +when defined(solaris) or defined(sunos): + var TIOCGWINSZ*{.importc, header: "<sys/termios.h>".}: culong +else: + var TIOCGWINSZ*{.importc, header: "<sys/ioctl.h>".}: culong + +when defined(nimHasStyleChecks): + {.push styleChecks: off.} type IOctl_WinSize* = object ws_row*, ws_col*, ws_xpixel*, ws_ypixel*: cushort +when defined(nimHasStyleChecks): + {.pop.} + proc ioctl*(fd: cint, request: culong, reply: ptr IOctl_WinSize): int {. importc: "ioctl", header: "<stdio.h>", varargs.} |