Compare commits

...

2 Commits

Author SHA1 Message Date
DTB
c554b96722
swab(1): fix type errors 2024-07-29 11:13:58 -06:00
DTB
7b930363bf
npc(1): fix syntax errors 2024-07-29 11:12:02 -06:00
2 changed files with 5 additions and 5 deletions

View File

@ -25,7 +25,7 @@
char *program_name = "npc"; char *program_name = "npc";
static int static int
ioerr(char *argv0, int err) { ioerr(char *argv0) {
perror(argv0); perror(argv0);
return EX_IOERR; return EX_IOERR;
@ -68,7 +68,7 @@ int main(int argc, char *argv[]) {
break; break;
case '\n': case '\n':
if (showend && fputc('$', stdout) == EOF) { if (showend && fputc('$', stdout) == EOF) {
return ioerr(argv[0]); } return ioerr(argv[0]);
} }
default: default:
if (c >= ' ' || c == '\n' || (!showtab && c == '\t')) { if (c >= ' ' || c == '\n' || (!showtab && c == '\t')) {

View File

@ -75,20 +75,20 @@ fn main() -> ExitCode {
if let Err(e) = output.write(&right) if let Err(e) = output.write(&right)
.and_then(|_| output.write(&left)) { .and_then(|_| output.write(&left)) {
err(&argv[0], e); err(&argv[0], e);
break EX_IOERR // write error break ExitCode::from(EX_IOERR as u8) // write error
} }
}, },
Ok(v) => { // partial read; partially write Ok(v) => { // partial read; partially write
if let Err(e) = output.write(&buf[..v]) { if let Err(e) = output.write(&buf[..v]) {
err(&argv[0], e); err(&argv[0], e);
break EX_IOERR // write error break ExitCode::from(EX_IOERR as u8) // write error
} }
}, },
Err(e) if e.kind() == ErrorKind::Interrupted && force => continue, Err(e) if e.kind() == ErrorKind::Interrupted && force => continue,
Err(e) => { Err(e) => {
err(&argv[0], e); err(&argv[0], e);
break EX_IOERR // read error (or signal) break ExitCode::from(EX_IOERR as u8) // read error (or signal)
} }
} }
} }