mirror of
https://github.com/uutils/coreutils
synced 2024-12-13 14:52:41 +00:00
stty: make compatible with Rust pre 1.61
This commit is contained in:
parent
f861fc0854
commit
420c69aa98
2 changed files with 36 additions and 40 deletions
|
@ -17,10 +17,10 @@ pub const CONTROL_FLAGS: [Flag<C>; 12] = [
|
|||
Flag::new("parenb", C::PARENB),
|
||||
Flag::new("parodd", C::PARODD),
|
||||
Flag::new("cmspar", C::CMSPAR),
|
||||
Flag::new("cs5", C::CS5).group(C::CSIZE),
|
||||
Flag::new("cs6", C::CS6).group(C::CSIZE),
|
||||
Flag::new("cs7", C::CS7).group(C::CSIZE),
|
||||
Flag::new("cs8", C::CS8).group(C::CSIZE).sane(),
|
||||
Flag::new_grouped("cs5", C::CS5, C::CSIZE),
|
||||
Flag::new_grouped("cs6", C::CS6, C::CSIZE),
|
||||
Flag::new_grouped("cs7", C::CS7, C::CSIZE),
|
||||
Flag::new_grouped("cs8", C::CS8, C::CSIZE).sane(),
|
||||
Flag::new("hupcl", C::HUPCL),
|
||||
Flag::new("cstopb", C::CSTOPB),
|
||||
Flag::new("cread", C::CREAD).sane(),
|
||||
|
@ -57,22 +57,22 @@ pub const OUTPUT_FLAGS: [Flag<O>; 24] = [
|
|||
Flag::new("onlret", O::ONLRET),
|
||||
Flag::new("ofill", O::OFILL),
|
||||
Flag::new("ofdel", O::OFDEL),
|
||||
Flag::new("nl0", O::NL0).group(O::NLDLY).sane(),
|
||||
Flag::new("nl1", O::NL1).group(O::NLDLY),
|
||||
Flag::new("cr0", O::CR0).group(O::CRDLY).sane(),
|
||||
Flag::new("cr1", O::CR1).group(O::CRDLY),
|
||||
Flag::new("cr2", O::CR2).group(O::CRDLY),
|
||||
Flag::new("cr3", O::CR3).group(O::CRDLY),
|
||||
Flag::new("tab0", O::TAB0).group(O::TABDLY).sane(),
|
||||
Flag::new("tab1", O::TAB1).group(O::TABDLY),
|
||||
Flag::new("tab2", O::TAB2).group(O::TABDLY),
|
||||
Flag::new("tab3", O::TAB3).group(O::TABDLY),
|
||||
Flag::new("bs0", O::BS0).group(O::BSDLY).sane(),
|
||||
Flag::new("bs1", O::BS1).group(O::BSDLY),
|
||||
Flag::new("vt0", O::VT0).group(O::VTDLY).sane(),
|
||||
Flag::new("vt1", O::VT1).group(O::VTDLY),
|
||||
Flag::new("ff0", O::FF0).group(O::FFDLY).sane(),
|
||||
Flag::new("ff1", O::FF1).group(O::FFDLY),
|
||||
Flag::new_grouped("nl0", O::NL0, O::NLDLY).sane(),
|
||||
Flag::new_grouped("nl1", O::NL1, O::NLDLY),
|
||||
Flag::new_grouped("cr0", O::CR0, O::CRDLY).sane(),
|
||||
Flag::new_grouped("cr1", O::CR1, O::CRDLY),
|
||||
Flag::new_grouped("cr2", O::CR2, O::CRDLY),
|
||||
Flag::new_grouped("cr3", O::CR3, O::CRDLY),
|
||||
Flag::new_grouped("tab0", O::TAB0, O::TABDLY).sane(),
|
||||
Flag::new_grouped("tab1", O::TAB1, O::TABDLY),
|
||||
Flag::new_grouped("tab2", O::TAB2, O::TABDLY),
|
||||
Flag::new_grouped("tab3", O::TAB3, O::TABDLY),
|
||||
Flag::new_grouped("bs0", O::BS0, O::BSDLY).sane(),
|
||||
Flag::new_grouped("bs1", O::BS1, O::BSDLY),
|
||||
Flag::new_grouped("vt0", O::VT0, O::VTDLY).sane(),
|
||||
Flag::new_grouped("vt1", O::VT1, O::VTDLY),
|
||||
Flag::new_grouped("ff0", O::FF0, O::FFDLY).sane(),
|
||||
Flag::new_grouped("ff1", O::FF1, O::FFDLY),
|
||||
];
|
||||
|
||||
pub const LOCAL_FLAGS: [Flag<L>; 18] = [
|
||||
|
|
|
@ -37,10 +37,7 @@ pub struct Flag<T> {
|
|||
group: Option<T>,
|
||||
}
|
||||
|
||||
impl<T> Flag<T>
|
||||
where
|
||||
T: Copy,
|
||||
{
|
||||
impl<T> Flag<T> {
|
||||
pub const fn new(name: &'static str, flag: T) -> Self {
|
||||
Self {
|
||||
name,
|
||||
|
@ -51,26 +48,25 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
pub const fn hidden(&self) -> Self {
|
||||
Self {
|
||||
show: false,
|
||||
..*self
|
||||
}
|
||||
}
|
||||
|
||||
pub const fn sane(&self) -> Self {
|
||||
Self {
|
||||
sane: true,
|
||||
..*self
|
||||
}
|
||||
}
|
||||
|
||||
pub const fn group(&self, group: T) -> Self {
|
||||
pub const fn new_grouped(name: &'static str, flag: T, group: T) -> Self {
|
||||
Self {
|
||||
name,
|
||||
flag,
|
||||
show: true,
|
||||
sane: false,
|
||||
group: Some(group),
|
||||
..*self
|
||||
}
|
||||
}
|
||||
|
||||
pub const fn hidden(mut self) -> Self {
|
||||
self.show = false;
|
||||
self
|
||||
}
|
||||
|
||||
pub const fn sane(mut self) -> Self {
|
||||
self.sane = true;
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
trait TermiosFlag: Copy {
|
||||
|
|
Loading…
Reference in a new issue