Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
vnotepad
Exa
提交
2594690a
E
Exa
项目概览
vnotepad
/
Exa
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
E
Exa
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
2594690a
编写于
5月 16, 2015
作者:
B
Ben S
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Start using the libc crate from crates.io
上级
00ae7185
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
17 addition
and
22 deletion
+17
-22
Cargo.lock
Cargo.lock
+9
-8
Cargo.toml
Cargo.toml
+1
-0
src/main.rs
src/main.rs
+2
-2
src/term.rs
src/term.rs
+5
-12
未找到文件。
Cargo.lock
浏览文件 @
2594690a
...
...
@@ -6,7 +6,8 @@ dependencies = [
"bitflags 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"datetime 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
"getopts 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)",
"git2 0.2.9 (git+https://github.com/alexcrichton/git2-rs.git)",
"git2 0.2.10 (git+https://github.com/alexcrichton/git2-rs.git)",
"libc 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
"locale 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
"natord 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)",
"num_cpus 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
...
...
@@ -53,13 +54,13 @@ dependencies = [
[[package]]
name = "git2"
version = "0.2.
9
"
source = "git+https://github.com/alexcrichton/git2-rs.git#
3a5f0b5698c5203fa48e33094158990a2c53c979
"
version = "0.2.
10
"
source = "git+https://github.com/alexcrichton/git2-rs.git#
f820ef645e2275c80c3009da770a5b6a9b5ce0f0
"
dependencies = [
"bitflags 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
"libgit2-sys 0.2.1
2
(git+https://github.com/alexcrichton/git2-rs.git)",
"url 0.2.3
3
(registry+https://github.com/rust-lang/crates.io-index)",
"libgit2-sys 0.2.1
3
(git+https://github.com/alexcrichton/git2-rs.git)",
"url 0.2.3
4
(registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
...
...
@@ -69,8 +70,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "libgit2-sys"
version = "0.2.1
2
"
source = "git+https://github.com/alexcrichton/git2-rs.git#
3a5f0b5698c5203fa48e33094158990a2c53c979
"
version = "0.2.1
3
"
source = "git+https://github.com/alexcrichton/git2-rs.git#
f820ef645e2275c80c3009da770a5b6a9b5ce0f0
"
dependencies = [
"libc 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
"libssh2-sys 0.1.22 (registry+https://github.com/rust-lang/crates.io-index)",
...
...
@@ -232,7 +233,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "url"
version = "0.2.3
3
"
version = "0.2.3
4
"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
...
...
Cargo.toml
浏览文件 @
2594690a
...
...
@@ -11,6 +11,7 @@ ansi_term = "0.5.0"
bitflags
=
"0.1"
datetime
=
"0.1.3"
getopts
=
"0.2.1"
libc
=
"*"
locale
=
"0.1.2"
natord
=
"1.0.7"
num_cpus
=
"*"
...
...
src/main.rs
浏览文件 @
2594690a
#![feature(collections,
convert,
core,
exit_status,
file_type,
fs_ext,
fs_mode)]
#![feature(
libc,
metadata_ext,
raw_ext,
scoped,
symlink_metadata)]
#![feature(metadata_ext,
raw_ext,
scoped,
symlink_metadata)]
extern
crate
ansi_term
;
extern
crate
datetime
;
extern
crate
getopts
;
extern
crate
libc
;
extern
crate
locale
;
extern
crate
natord
;
extern
crate
num_cpus
;
...
...
@@ -12,7 +13,6 @@ extern crate pad;
extern
crate
users
;
extern
crate
unicode_width
;
#[cfg(feature=
"git"
)]
extern
crate
git2
;
...
...
src/term.rs
浏览文件 @
2594690a
mod
c
{
#![allow(non_camel_case_types)]
extern
crate
libc
;
pub
use
self
::
libc
::{
c_int
,
c_ushort
,
c_ulong
,
STDOUT_FILENO
,
};
pub
use
libc
::{
c_int
,
c_ushort
,
c_ulong
,
STDOUT_FILENO
};
use
std
::
mem
::
zeroed
;
// Getting the terminal size is done using an ioctl command that
// takes the file handle to the terminal (which in our case is
// stdout), and populates a structure with the values.
pub
struct
w
insize
{
pub
struct
W
insize
{
pub
ws_row
:
c_ushort
,
pub
ws_col
:
c_ushort
,
}
...
...
@@ -30,9 +23,9 @@ mod c {
pub
fn
ioctl
(
fd
:
c_int
,
request
:
c_ulong
,
...
)
->
c_int
;
}
pub
unsafe
fn
dimensions
()
->
w
insize
{
let
mut
window
:
w
insize
=
zeroed
();
ioctl
(
STDOUT_FILENO
,
TIOCGWINSZ
,
&
mut
window
as
*
mut
w
insize
);
pub
unsafe
fn
dimensions
()
->
W
insize
{
let
mut
window
:
W
insize
=
zeroed
();
ioctl
(
STDOUT_FILENO
,
TIOCGWINSZ
,
&
mut
window
as
*
mut
W
insize
);
window
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录