Implement getpass()

Also make fields in `termios` public; required for modifying them.

There's an new type of test: `EXPECT_INPUT_BINS`. These require a `.exp`
file to be present along with the `.c` file. The `.exp` file takes the
produced binary as an argument and sends input to the program. This is
useful for testing functions like `getpass()`.
This commit is contained in:
Agoston Szepessy
2024-07-21 14:15:18 +02:00
parent 798d17c5b3
commit a83d4cbced
6 changed files with 138 additions and 20 deletions
+15 -15
View File
@@ -37,28 +37,28 @@ pub const TCSAFLUSH: c_int = 2;
#[cfg(target_os = "linux")]
#[repr(C)]
#[derive(Default)]
#[derive(Default, Clone)]
pub struct termios {
c_iflag: tcflag_t,
c_oflag: tcflag_t,
c_cflag: tcflag_t,
c_lflag: tcflag_t,
c_line: cc_t,
c_cc: [cc_t; NCCS],
__c_ispeed: speed_t,
__c_ospeed: speed_t,
pub c_iflag: tcflag_t,
pub c_oflag: tcflag_t,
pub c_cflag: tcflag_t,
pub c_lflag: tcflag_t,
pub c_line: cc_t,
pub c_cc: [cc_t; NCCS],
pub __c_ispeed: speed_t,
pub __c_ospeed: speed_t,
}
// Must match structure in redox_termios
#[cfg(target_os = "redox")]
#[repr(C)]
#[derive(Default)]
#[derive(Default, Clone)]
pub struct termios {
c_iflag: tcflag_t,
c_oflag: tcflag_t,
c_cflag: tcflag_t,
c_lflag: tcflag_t,
c_cc: [cc_t; NCCS],
pub c_iflag: tcflag_t,
pub c_oflag: tcflag_t,
pub c_cflag: tcflag_t,
pub c_lflag: tcflag_t,
pub c_cc: [cc_t; NCCS],
}
#[no_mangle]