// GetSize will return the terminal window size.
//
// We prefer environ $LINES/$COLUMNS, then fall back to tty-held information.
// We do not support use of termcap/terminfo to derive default size information.
2196
func GetSize() (*Size, error) {
	envSize := GetEnvWindowSize()
	if envSize != nil && envSize.Lines != 0 && envSize.Columns != 0 {
		return envSize, nil
	}

	fh, err := os.Open("/dev/tty")
	if err != nil {
		// no tty, no point continuing; we only let the environ
		// avoid an error in this case because if someone has faked
		// up an environ with LINES/COLUMNS _both_ set, we should let
		// them
		return nil, err
	}

	size, err := GetTerminalWindowSize(fh)
	if err != nil {
		if envSize != nil {
			return envSize, nil
		}
		return nil, err
	}
	if envSize == nil {
		return size, err
	}

	if envSize.Lines == 0 {
		envSize.Lines = size.Lines
	}
	if envSize.Columns == 0 {
		envSize.Columns = size.Columns
	}
	return envSize, nil
}
229052
func (f *Fpdf) GetFontSize() (ptSize, unitSize float64) {
	return f.fontSizePt, f.fontSize
}
188924
func (b *BackupEngineInfo) GetSize(index int) int64 {
	return int64(C.rocksdb_backup_engine_info_size(b.c, C.int(index)))
}
708330
func (window *Window) GetSize() (w, h int32) {
	var _w, _h C.int
	C.SDL_GetWindowSize(window.cptr(), &_w, &_h)
	return int32(_w), int32(_h)
}
1314984
func WindowSize() (w, h int) {
	width, height := Window.GetSize()
	return int(width), int(height)
}
749403
func (self line) size() (w, h int) {
	return AbsInt(self.P2.X - self.P1.X), AbsInt(self.P2.Y - self.P1.Y)
}
490899
func (u *Units) GetSize() (size cunits.Bits) {
	return cunits.ImportInByte(float64(u.SizeBytes))
}
799464
func GetSize(fd int) (width, height int, err error) {
	return 0, 0, fmt.Errorf("terminal: GetSize not implemented on %s/%s", runtime.GOOS, runtime.GOARCH)
}
434313
func (t *Text) Size() (int, int) {
	if len(t.text) != 0 {
		return t.width, t.height
	}
	return 0, 0
}
1084833
func (cfp *ZipPool) GetSize(fileIndex int64) int64 {
	return cfp.container.Files[fileIndex].Size
}
814549
func (c *ZebedeeClient) GetFileSize(uri string) (data.FileSize, error) {
	b, err := c.get("/filesize?uri=" + uri)
	if err != nil {
		return data.FileSize{}, err
	}

	var fs data.FileSize
	if err = json.Unmarshal(b, &fs); err != nil {
		return fs, err
	}

	return fs, nil
}
1126163
func terminalWidth() (int, error) {
	if !istty {
		return 0, errors.New("Not Supported")
	}
	echoLockMutex.Lock()
	defer echoLockMutex.Unlock()

	fd := int(tty.Fd())

	ws, err := unix.IoctlGetWinsize(fd, unix.TIOCGWINSZ)
	if err != nil {
		return 0, err
	}

	return int(ws.Col), nil
}
1205859
func terminalSize(out *os.File) (int, int, error) {
	ws := new(winsize)

	_, _, err := unix.Syscall(unix.SYS_IOCTL, out.Fd(),
		uintptr(unix.TIOCGWINSZ), uintptr(unsafe.Pointer(ws)))
	if err != 0 {
		return 0, 0, err
	}

	return int(ws.cols), int(ws.rows), nil
}
664531
func (t *TreeEntry) GetSize() int {
	if t == nil || t.Size == nil {
		return 0
	}
	return *t.Size
}
562647
func (_class PoolPatchClass) GetSize(sessionID SessionRef, self PoolPatchRef) (_retval int, _err error) {
	_method := "pool_patch.get_size"
	_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
	if _err != nil {
		return
	}
	_selfArg, _err := convertPoolPatchRefToXen(fmt.Sprintf("%s(%s)", _method, "self"), self)
	if _err != nil {
		return
	}
	_result, _err := _class.client.APICall(_method, _sessionIDArg, _selfArg)
	if _err != nil {
		return
	}
	_retval, _err = convertIntToGo(_method + " -> ", _result.Value)
	return
}
1112669
func GetsizeFull(t *os.File) (size *Winsize, err error) {
	var ws Winsize
	err = windowRectCall(&ws, t.Fd(), syscall.TIOCGWINSZ)
	return &ws, err
}
702084
func GetTTYWidth() int {
	var tty *os.File
	var err error
	if tty, err = os.OpenFile("/dev/tty", os.O_RDWR, 0600); err != nil {
		tty = os.Stdout
	} else {
		defer tty.Close()
	}
	if width, _, err := terminal.GetSize(int(tty.Fd())); err != nil {
		return 80
	} else {
		return width
	}
}