Implement OPOST and ONLCR
This commit is contained in:
@@ -58,6 +58,7 @@ fn main(){
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn post_fevent(socket: &mut File, id: usize, flags: usize, count: usize) {
|
||||
socket.write(&Packet {
|
||||
id: 0,
|
||||
|
||||
+9
-1
@@ -213,12 +213,20 @@ impl Pty {
|
||||
}
|
||||
|
||||
pub fn output(&mut self, buf: &[u8]) {
|
||||
//TODO: Output flags
|
||||
//TODO: more output flags
|
||||
|
||||
let ofl = &self.termios.c_oflag;
|
||||
|
||||
let opost = ofl & OPOST == OPOST;
|
||||
let onlcr = ofl & ONLCR == ONLCR;
|
||||
|
||||
let mut vec = Vec::with_capacity(buf.len() + 1);
|
||||
vec.push(0);
|
||||
|
||||
for &b in buf.iter() {
|
||||
if opost && onlcr && b == b'\n' {
|
||||
vec.push(b'\r');
|
||||
}
|
||||
vec.push(b);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user