swab(1): fix some silly mistakes

This commit is contained in:
dtb 2024-06-28 17:43:32 -06:00
parent 50bbee10a9
commit 6bd19c072d
Signed by: trinity
GPG Key ID: 34C0543BBB6AF81B

View File

@ -24,7 +24,7 @@ use std::{
};
extern crate getopt;
use getopt::{ Opt, Parser };
use getopt::GetOpt;
extern crate sysexits;
use sysexits::{ EX_OK, EX_OSERR, EX_USAGE };
@ -45,7 +45,6 @@ fn main() -> ExitCode {
let mut input = stdin();
let mut output = stdout().lock();
let mut opts = Parser::new(&argv, "fw:");
let mut force = false;
let mut wordsize: usize = 2;
@ -53,11 +52,13 @@ fn main() -> ExitCode {
match opt.opt() {
Ok("f") => force = true,
Ok("w") => {
match arg.parse::<usize>() {
if let Some(arg) = opt.arg() {
match opt.arg().parse::<usize>() {
Ok(w) if w % 2 == 0 => { wordsize = w; () },
_ => { return usage(&argv[0]); },
}
},
}
},
_ => { return usage(&argv[0]); }
}
}