mm(1): rewritten in Rust #143

Closed
emma wants to merge 12 commits from mm-rs into main
2 changed files with 11 additions and 6 deletions
Showing only changes of commit baf0f2d585 - Show all commits

View File

@ -33,7 +33,9 @@ Opens a path as an input. If one or more of the input files is \(lq-\(rq or if
no inputs are specified, the standard input shall be used.
.IP \fB-o\fP\ \fIoutput\fP
Opens a path as an output. If one or more of the output files is \(lq-\(rq or if
no outputs are specified, the standard output shall be used.
no outputs are specified and the
.B -e
option is not specified, the standard output shall be used.
.\"
.SH DIAGNOSTICS

View File

@ -68,7 +68,7 @@ fn main() -> ExitCode {
if ins.is_empty() { ins.push("-".to_string()); }
/* use stdout if no outputs are specified */
if outs.is_empty() { outs.push("-".to_string()); }
if outs.is_empty() && !e { outs.push("-".to_string()); }
/* map all path strings to files */
let inputs = ins.iter().map(|file| {
@ -142,10 +142,13 @@ fn main() -> ExitCode {
eprintln!("{}: {}", argv[0], e.strerror());
return ExitCode::from(EX_IOERR as u8);
}
/* immediately flush the output for -u */
if let Err(e) = out.flush() {
eprintln!("{}: {}", argv[0], e.strerror());
return ExitCode::from(EX_IOERR as u8);
if u {
/* immediately flush the output for -u */
if let Err(e) = out.flush() {
eprintln!("{}: {}", argv[0], e.strerror());
return ExitCode::from(EX_IOERR as u8);
}
}
}
}