1 Star 0 Fork 2

who7708/etcd

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
ts_x.go 945 Bytes
一键复制 编辑 原始数据 按行查看 历史
Gyu-Ho Lee 提交于 2015-12-21 22:20 . Godeps: add missing dependencies
// +build !windows
// Copyright 2014 Oleku Konko All rights reserved.
// Use of this source code is governed by a MIT
// license that can be found in the LICENSE file.
// This module is a Terminal API for the Go Programming Language.
// The protocols were written in pure Go and works on windows and unix systems
package ts
import (
"syscall"
"unsafe"
)
// Get Windows Size
func GetSize() (ws Size, err error) {
_, _, ec := syscall.Syscall(syscall.SYS_IOCTL,
uintptr(syscall.Stdout),
uintptr(TIOCGWINSZ),
uintptr(unsafe.Pointer(&ws)))
err = getError(ec)
if TIOCGWINSZ == 0 && err != nil {
ws = Size{80, 25, 0, 0}
}
return ws, err
}
func getError(ec interface{}) (err error) {
switch v := ec.(type) {
case syscall.Errno: // Some implementation return syscall.Errno number
if v != 0 {
err = syscall.Errno(v)
}
case error: // Some implementation return error
err = ec.(error)
default:
err = nil
}
return
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/who7708/etcd.git
git@gitee.com:who7708/etcd.git
who7708
etcd
etcd
v2.3.4

搜索帮助