sshpiper/vendor/github.com/jessevdk/go-flags/termsize.go
Boshi Lian ea9357ff6c Add more database support (#19)
* mysql
* sqlite
* pg
2018-12-29 06:13:16 +00:00

28 lines
386 B
Go

// +build !windows,!plan9,!solaris,!appengine
package flags
import (
"syscall"
"unsafe"
)
type winsize struct {
row, col uint16
xpixel, 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.col)
}
return 80
}