mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-30 04:27:45 +00:00
Merge pull request #5054 from dezgeg/stty-save
stty: Finish '--save' support
This commit is contained in:
commit
d969bff0df
1 changed files with 23 additions and 5 deletions
|
@ -244,12 +244,30 @@ fn print_terminal_size(termios: &Termios, opts: &Options) -> nix::Result<()> {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn print_in_save_format(termios: &Termios) {
|
||||||
|
print!(
|
||||||
|
"{:x}:{:x}:{:x}:{:x}",
|
||||||
|
termios.input_flags.bits(),
|
||||||
|
termios.output_flags.bits(),
|
||||||
|
termios.control_flags.bits(),
|
||||||
|
termios.local_flags.bits()
|
||||||
|
);
|
||||||
|
for cc in termios.control_chars {
|
||||||
|
print!(":{cc:x}");
|
||||||
|
}
|
||||||
|
println!();
|
||||||
|
}
|
||||||
|
|
||||||
fn print_settings(termios: &Termios, opts: &Options) -> nix::Result<()> {
|
fn print_settings(termios: &Termios, opts: &Options) -> nix::Result<()> {
|
||||||
print_terminal_size(termios, opts)?;
|
if opts.save {
|
||||||
print_flags(termios, opts, CONTROL_FLAGS);
|
print_in_save_format(termios);
|
||||||
print_flags(termios, opts, INPUT_FLAGS);
|
} else {
|
||||||
print_flags(termios, opts, OUTPUT_FLAGS);
|
print_terminal_size(termios, opts)?;
|
||||||
print_flags(termios, opts, LOCAL_FLAGS);
|
print_flags(termios, opts, CONTROL_FLAGS);
|
||||||
|
print_flags(termios, opts, INPUT_FLAGS);
|
||||||
|
print_flags(termios, opts, OUTPUT_FLAGS);
|
||||||
|
print_flags(termios, opts, LOCAL_FLAGS);
|
||||||
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue