Oops - L_ctermid must be a global var to compile.

This commit is contained in:
Charles Blake 2016-09-01 07:54:17 -04:00
commit 7b73a94afc

View file

@ -162,11 +162,11 @@ else:
return int(win.ws_col) return int(win.ws_col)
return 0 return 0
var L_ctermid{.importc, header: "<stdio.h>".}: cint
proc terminalWidth*(): int = proc terminalWidth*(): int =
## Returns **some** reasonable terminal width from either standard file ## Returns some reasonable terminal width from either standard file
## descriptors, controlling terminal, environment variables or tradition. ## descriptors, controlling terminal, environment variables or tradition.
var L_ctermid{.importc, header: "<stdio.h>".}: cint
var w = terminalWidthIoctl([0, 1, 2]) #Try standard file descriptors var w = terminalWidthIoctl([0, 1, 2]) #Try standard file descriptors
if w > 0: return w if w > 0: return w
var cterm = newString(L_ctermid) #Try controlling tty var cterm = newString(L_ctermid) #Try controlling tty