From a141b952935a8ba07768dd17473564e9604ae0d3 Mon Sep 17 00:00:00 2001 From: DTB Date: Mon, 8 Jul 2024 11:30:21 -0600 Subject: [PATCH] swab(1): remove -f --- docs/swab.1 | 3 --- src/swab.rs | 9 +++------ 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/docs/swab.1 b/docs/swab.1 index 42eef95..7c50b15 100644 --- a/docs/swab.1 +++ b/docs/swab.1 @@ -11,7 +11,6 @@ swab \(en swap bytes .SH SYNOPSIS swab -.RB [ -f ] .RB [ -w\ word_size ] .\" .SH DESCRIPTION @@ -20,8 +19,6 @@ Swap the latter and former halves of a block of bytes. .\" .SH OPTIONS -.IP \fB-f\fP -Ignore SIGINT signal. .IP \fB-w\fP\ \fIword_size\fP Configures the word size; that is, the size in bytes of the block size on which to operate. The default word size is 2. The word size must be cleanly divisible diff --git a/src/swab.rs b/src/swab.rs index 5942c38..3bb40a5 100644 --- a/src/swab.rs +++ b/src/swab.rs @@ -18,7 +18,7 @@ use std::{ env::args, - io::{ stdin, stdout, Error, ErrorKind, Read, Write }, + io::{ stdin, stdout, Error, Read, Write }, process::ExitCode, vec::Vec }; @@ -38,7 +38,7 @@ fn oserr(s: &str, e: Error) -> ExitCode { } fn usage(s: &str) -> ExitCode { - eprintln!("Usage: {} [-f] [-w word_size]", s); + eprintln!("Usage: {} [-w word_size]", s); ExitCode::from(EX_USAGE as u8) } @@ -48,12 +48,10 @@ fn main() -> ExitCode { let mut input = stdin(); let mut output = stdout().lock(); - let mut force = false; let mut wordsize: usize = 2; - while let Some(opt) = argv.getopt("fw:") { + while let Some(opt) = argv.getopt("w:") { match opt.opt() { - Ok("f") => force = true, Ok("w") => { if let Some(arg) = opt.arg() { match arg.parse::() { @@ -83,7 +81,6 @@ fn main() -> ExitCode { break oserr(&argv[0], e) } }, - Err(e) if e.kind() == ErrorKind::Interrupted && force => continue, Err(e) => break oserr(&argv[0], e) } }