diff options
author | Philipp Gesang <phg@phi-gamma.net> | 2021-11-10 00:43:28 +0100 |
---|---|---|
committer | Philipp Gesang <phg@phi-gamma.net> | 2021-11-10 01:20:12 +0100 |
commit | 418d1e6fe927949503872db2062e092226ca2b58 (patch) | |
tree | 139b4da4163638cea242a04f97abeef477bf24dd | |
parent | fece719438908c58c9cff454d428279a8240c8af (diff) | |
download | vtcol-418d1e6fe927949503872db2062e092226ca2b58.tar.gz |
drop unused code from get_console_fd()
-rw-r--r-- | src/vtcol.rs | 33 |
1 files changed, 11 insertions, 22 deletions
diff --git a/src/vtcol.rs b/src/vtcol.rs index 31ea9d9..e9af6e2 100644 --- a/src/vtcol.rs +++ b/src/vtcol.rs @@ -526,29 +526,18 @@ fn fd_of_path(path: &std::path::Path) -> Option<Fd> } } -fn get_console_fd(path: Option<&str>) -> Option<Fd> +fn get_console_fd() -> Option<Fd> { - match path { - Some(path) => { - let path = std::path::Path::new(path); - match fd_of_path(path) { - Some(fd) => Some(fd), - None => panic!("cannot open {:?} as a tty", path), - } - }, - None => { - for path in CONSOLE_PATHS.iter() { - vrb!("trying path: {:?}", path); - let path = std::path::Path::new(path); - if let Some(fd) = fd_of_path(path) { - vrb!(" * Success!"); - return Some(fd); - } - } - vrb!("could not retrieve fd for any of the search paths"); - None - }, + for path in CONSOLE_PATHS.iter() { + vrb!("trying path: {:?}", path); + let path = std::path::Path::new(path); + if let Some(fd) = fd_of_path(path) { + vrb!(" * Success!"); + return Some(fd); + } } + vrb!("could not retrieve fd for any of the search paths"); + None } fn write_to_term(fd: Fd, buf: &str) @@ -579,7 +568,7 @@ fn main() }; vrb!("Using palette:"); vrb!("{}", pal); - let fd = get_console_fd(None).unwrap(); + let fd = get_console_fd().unwrap(); vrb!("fd: {}", fd); if unsafe { ioctl(fd, PIO_CMAP, std::mem::transmute(&mut pal)) } < 0 { |