mm(1): makes -e block inferring stdout as an output, mm.1: reflects changes to -e

This commit is contained in:
Emma Tebibyte 2024-07-14 14:15:55 -06:00
parent 8d693b6664
commit 20692d581a
Signed by untrusted user: emma
GPG Key ID: 06FA419A1698C270
2 changed files with 11 additions and 6 deletions

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. no inputs are specified, the standard input shall be used.
.IP \fB-o\fP\ \fIoutput\fP .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 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 .SH DIAGNOSTICS

View File

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