8 "golang.org/x/sys/unix"
16 // Small wrapper to get rid of variadic args of ioctl()
17 int my_ioctl(int fd, int cmd, struct winsize *ws) {
18 return ioctl(fd, cmd, ws);
23 // GetWinsize returns the window size based on the specified file descriptor.
24 func GetWinsize(fd uintptr) (*Winsize, error) {
26 ret, err := C.my_ioctl(C.int(fd), C.int(unix.TIOCGWINSZ), (*C.struct_winsize)(unsafe.Pointer(ws)))
34 // SetWinsize tries to set the specified window size for the specified file descriptor.
35 func SetWinsize(fd uintptr, ws *Winsize) error {
36 ret, err := C.my_ioctl(C.int(fd), C.int(unix.TIOCSWINSZ), (*C.struct_winsize)(unsafe.Pointer(ws)))