Skip to content

Commit

Permalink
Added comments in winsize.go
Browse files Browse the repository at this point in the history
Signed-off-by: xchenan <xchenan@gmail.com>
  • Loading branch information
xchenan committed May 22, 2017
1 parent 456db58 commit 6835461
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions sys/winsize.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,19 @@ import (
"unsafe"
)

// GetWinsize queries the size of the terminal referenced by the given file
// descriptor.
//
// winSize mirrors struct winsize in the C header.
// The following declaration matches struct winsize in the headers of
// Linux and FreeBSD.
type winSize struct {
row uint16
col uint16
Xpixel uint16
Ypixel uint16
}

// GetWinsize queries the size of the terminal referenced by
// the given file descriptor.

func GetWinsize(fd int) (row, col int) {
ws := winSize{}
if err := ioctl(uintptr(fd), unix.TIOCGWINSZ, unsafe.Pointer(&ws)); err != nil {
Expand Down

0 comments on commit 6835461

Please sign in to comment.