Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
termion
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Michael Bradshaw
termion
Commits
45c75071
Commit
45c75071
authored
May 11, 2019
by
Michael Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use stdout to get and set terminal attriutes
parent
a69af178
Pipeline
#4157
passed with stages
in 3 minutes and 5 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
4 deletions
+4
-4
src/sys/redox/attr.rs
src/sys/redox/attr.rs
+2
-2
src/sys/unix/attr.rs
src/sys/unix/attr.rs
+2
-2
No files found.
src/sys/redox/attr.rs
View file @
45c75071
...
...
@@ -5,7 +5,7 @@ use super::{cvt, syscall, Termios};
pub
fn
get_terminal_attr
()
->
io
::
Result
<
Termios
>
{
let
mut
termios
=
Termios
::
default
();
let
fd
=
cvt
(
syscall
::
dup
(
0
,
b
"termios"
))
?
;
let
fd
=
cvt
(
syscall
::
dup
(
1
,
b
"termios"
))
?
;
let
res
=
cvt
(
syscall
::
read
(
fd
,
&
mut
termios
));
let
_
=
syscall
::
close
(
fd
);
...
...
@@ -17,7 +17,7 @@ pub fn get_terminal_attr() -> io::Result<Termios> {
}
pub
fn
set_terminal_attr
(
termios
:
&
Termios
)
->
io
::
Result
<
()
>
{
let
fd
=
cvt
(
syscall
::
dup
(
0
,
b
"termios"
))
?
;
let
fd
=
cvt
(
syscall
::
dup
(
1
,
b
"termios"
))
?
;
let
res
=
cvt
(
syscall
::
write
(
fd
,
termios
));
let
_
=
syscall
::
close
(
fd
);
...
...
src/sys/unix/attr.rs
View file @
45c75071
...
...
@@ -9,7 +9,7 @@ pub fn get_terminal_attr() -> io::Result<Termios> {
}
unsafe
{
let
mut
termios
=
mem
::
zeroed
();
cvt
(
tcgetattr
(
0
,
&
mut
termios
))
?
;
cvt
(
tcgetattr
(
1
,
&
mut
termios
))
?
;
Ok
(
termios
)
}
}
...
...
@@ -18,7 +18,7 @@ pub fn set_terminal_attr(termios: &Termios) -> io::Result<()> {
extern
"C"
{
pub
fn
tcsetattr
(
fd
:
c_int
,
opt
:
c_int
,
termptr
:
*
const
Termios
)
->
c_int
;
}
cvt
(
unsafe
{
tcsetattr
(
0
,
0
,
termios
)
})
.and
(
Ok
(()))
cvt
(
unsafe
{
tcsetattr
(
1
,
0
,
termios
)
})
.and
(
Ok
(()))
}
pub
fn
raw_terminal_attr
(
termios
:
&
mut
Termios
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment