diff options
author | Sharif Haason <ssh128@scarletmail.rutgers.edu> | 2022-12-04 21:48:10 -0500 |
---|---|---|
committer | Sharif Haason <ssh128@scarletmail.rutgers.edu> | 2022-12-04 21:48:10 -0500 |
commit | 571312dd6ea6a12ab0e4263d593ba8b9ccf21ef2 (patch) | |
tree | b202f5dbca9567ce91b3eabef53466a27647cdcc | |
parent | fcd09ffface2500572d15ae2983dbe9762d29e06 (diff) |
Replace `libc` with `rustix`
-rw-r--r-- | Cargo.lock | 2 | ||||
-rw-r--r-- | Cargo.toml | 2 | ||||
-rw-r--r-- | src/input.rs | 5 |
3 files changed, 5 insertions, 4 deletions
@@ -194,9 +194,9 @@ dependencies = [ "clap", "const_format", "is-terminal", - "libc", "predicates", "pretty_assertions", + "rustix", "terminal_size", "thiserror", ] @@ -15,7 +15,7 @@ anstyle = "0.2" anyhow = "1.0" const_format = "0.2" is-terminal = "0.4" -libc = "0.2" +rustix = "0.36" thiserror = "1.0" terminal_size = "0.2" diff --git a/src/input.rs b/src/input.rs index 1e6fb06..d6d9f5f 100644 --- a/src/input.rs +++ b/src/input.rs @@ -2,6 +2,8 @@ use std::convert::TryFrom; use std::fs; use std::io::{self, copy, sink, Read, Seek, SeekFrom}; +use rustix::io::Errno; + pub enum Input<'a> { File(fs::File), Stdin(io::StdinLock<'a>), @@ -35,8 +37,7 @@ impl<'a> Seek for Input<'a> { match *self { Input::File(ref mut file) => { let seek_res = file.seek(pos); - if let Err(Some(libc::ESPIPE)) = seek_res.as_ref().map_err(|err| err.raw_os_error()) - { + if let Err(Some(Errno::SPIPE)) = seek_res.as_ref().map_err(Errno::from_io_error) { try_skip( file, pos, |