fn read_file_or_stdin(input: &Path) -> anyhow::Result<NullTerminatedBuf> {
    if input == Path::new("-") {
        let stdin = std::io::stdin();
        let mut handle = stdin.lock();
        Ok(NullTerminatedBuf::from_reader(&mut handle).context("stdin")?)
    } else {
        let mut file = File::open(input).with_context(|| input.display().to_string())?;
        Ok(NullTerminatedBuf::from_file(&mut file).with_context(|| input.display().to_string())?)
    }
}
/// Read the specified file or stdin into a null terminated buffer.
Read the specified file or stdin into a null terminated buffer.
Read the specified file or stdin into a null terminated buffer .
fn read_file_or_stdin(input: &Path) -> anyhow::Result<NullTerminatedBuf> {
    if input == Path::new("-") {
        let stdin = std::io::stdin();
        let mut handle = stdin.lock();
        Ok(NullTerminatedBuf::from_reader(&mut handle).context("stdin")?)
    } else {
        let mut file = File::open(input).with_context(|| input.display().to_string())?;
        Ok(NullTerminatedBuf::from_file(&mut file).with_context(|| input.display().to_string())?)
    }
}
fn read_file_or_stdin ( input : & Path ) -> anyhow :: Result < NullTerminatedBuf > { if input == Path :: new ( " " ) { let stdin = std :: io :: stdin ( ) ; let mut handle = stdin . lock ( ) ; Ok ( NullTerminatedBuf :: from_reader ( & mut handle ) . context ( " " ) ? ) } else { let mut file = File :: open ( input ) . with_context ( | | input . display ( ) . to_string ( ) ) ? ; Ok ( NullTerminatedBuf :: from_file ( & mut file ) . with_context ( | | input . display ( ) . to_string ( ) ) ? ) } }
Read the specified file or stdin into a null terminated buffer.
Read the specified file or stdin into a null terminated buffer .
input
&Path
input
&Path