elvish/edit/tty/types.go

27 lines
347 B
Go
Raw Normal View History

// +build ignore
package tty
/*
#include <termios.h>
#include <sys/ioctl.h>
*/
import "C"
import (
"unsafe"
)
2013-11-15 19:01:46 +08:00
const (
TCFLSH = C.TCFLSH
TCIFLUSH = C.TCIFLUSH
TIOCGWINSZ = C.TIOCGWINSZ
)
type Winsize C.struct_winsize
func GetWinsize(fd int) Winsize {
var ws Winsize
2013-11-15 19:01:46 +08:00
Ioctl(fd, TIOCGWINSZ, uintptr(unsafe.Pointer(&ws)))
return ws
}