Debian Codegraph @

termsize.go

raw symbols SCIP
1 // +build !windows
2
3 package flags
4
5 import (
6 "syscall"
7 "unsafe"
8 )
9
10 type winsize struct {
11 ws_row, ws_col uint16
12 ws_xpixel, ws_ypixel uint16
13 }
14
15 func getTerminalColumns() int {
16 ws := winsize{}
17
18 if TIOCGWINSZ != 0 {
19 syscall.Syscall(syscall.SYS_IOCTL,
20 uintptr(0),
21 uintptr(TIOCGWINSZ),
22 uintptr(unsafe.Pointer(&ws)))
23
24 return int(ws.ws_col)
25 }
26
27 return 80
28 }