mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-30 12:37:49 +00:00
Added support to read a filename redirected to stdin
- Canonicalization of `/dev/stdin` which points to stdin file
This commit is contained in:
parent
ad237f8fff
commit
71a6ae1443
1 changed files with 9 additions and 2 deletions
|
@ -471,11 +471,18 @@ impl Stater {
|
|||
}
|
||||
|
||||
fn new(matches: &ArgMatches) -> UResult<Self> {
|
||||
let files: Vec<String> = matches
|
||||
let mut files: Vec<String> = matches
|
||||
.values_of(ARG_FILES)
|
||||
.map(|v| v.map(ToString::to_string).collect())
|
||||
.unwrap_or_default();
|
||||
|
||||
#[cfg(unix)]
|
||||
if files.contains(&String::from("-")) {
|
||||
files = Vec::from([Path::new("/dev/stdin")
|
||||
.canonicalize()?
|
||||
.into_os_string()
|
||||
.into_string()
|
||||
.unwrap()]);
|
||||
}
|
||||
let format_str = if matches.is_present(options::PRINTF) {
|
||||
matches
|
||||
.value_of(options::PRINTF)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue