12 type windowSize struct {
21 func getTermSize() (int, int) {
22 if runtime.GOOS == "openbsd" {
23 out, err = os.OpenFile("/dev/tty", os.O_RDWR, 0)
29 out, err = os.OpenFile("/dev/tty", os.O_WRONLY, 0)
34 _, _, _ = syscall.Syscall(syscall.SYS_IOCTL,
35 out.Fd(), uintptr(syscall.TIOCGWINSZ), uintptr(unsafe.Pointer(&sz)))
36 return int(sz.cols), int(sz.rows)