mirror of
https://github.com/nim-lang/Nim.git
synced 2026-02-18 08:58:39 +00:00
Change type name to be more NEP-1-ish as per Araq request.
This commit is contained in:
@@ -263,9 +263,9 @@ proc tcGetSid*(fd: cint): Pid {.importc: "tcgetsid", header: "<termios.h>".}
|
||||
# Window size ioctl. Should work on on any Unix that xterm has been ported to.
|
||||
var TIOCGWINSZ*{.importc, header: "<sys/ioctl.h>".}: culong
|
||||
|
||||
type ioctl_winsize* {.importc: "struct winsize", header: "<termios.h>",
|
||||
type IOctl_WinSize* {.importc: "struct winsize", header: "<termios.h>",
|
||||
final, pure.} = object
|
||||
ws_row*, ws_col*, ws_xpixel*, ws_ypixel*: cushort
|
||||
|
||||
proc ioctl*(fd: cint, request: culong, reply: ptr ioctl_winsize): int {.
|
||||
proc ioctl*(fd: cint, request: culong, reply: ptr IOctl_WinSize): int {.
|
||||
importc: "ioctl", header: "<stdio.h>", varargs.}
|
||||
|
||||
@@ -156,7 +156,7 @@ else:
|
||||
proc terminalWidthIoctl*(fds: openArray[int]): int =
|
||||
## Returns terminal width from first fd that supports the ioctl.
|
||||
|
||||
var win: ioctl_winsize
|
||||
var win: IOctl_WinSize
|
||||
for fd in fds:
|
||||
if ioctl(cint(fd), TIOCGWINSZ, addr win) != -1:
|
||||
return int(win.ws_col)
|
||||
|
||||
Reference in New Issue
Block a user