mirror of
https://github.com/go-sylixos/elvish.git
synced 2024-12-16 12:58:48 +08:00
27 lines
347 B
Go
27 lines
347 B
Go
// +build ignore
|
|
|
|
package tty
|
|
|
|
/*
|
|
#include <termios.h>
|
|
#include <sys/ioctl.h>
|
|
*/
|
|
import "C"
|
|
import (
|
|
"unsafe"
|
|
)
|
|
|
|
const (
|
|
TCFLSH = C.TCFLSH
|
|
TCIFLUSH = C.TCIFLUSH
|
|
TIOCGWINSZ = C.TIOCGWINSZ
|
|
)
|
|
|
|
type Winsize C.struct_winsize
|
|
|
|
func GetWinsize(fd int) Winsize {
|
|
var ws Winsize
|
|
Ioctl(fd, TIOCGWINSZ, uintptr(unsafe.Pointer(&ws)))
|
|
return ws
|
|
}
|