blob: 95c9f91a6d1b3e1dd4ecf9af4b4ae1d19c4d308c [file] [log] [blame]
// +build !windows
package flags
import (
"syscall"
"unsafe"
)
type winsize struct {
ws_row, ws_col uint16
ws_xpixel, ws_ypixel uint16
}
func getTerminalColumns() int {
ws := winsize{}
if TIOCGWINSZ != 0 {
syscall.Syscall(syscall.SYS_IOCTL,
uintptr(0),
uintptr(TIOCGWINSZ),
uintptr(unsafe.Pointer(&ws)))
return int(ws.ws_col)
}
return 80
}