From 6bd19c072d1bf1ab0b8d472c14df66c8b115d6b1 Mon Sep 17 00:00:00 2001 From: DTB Date: Fri, 28 Jun 2024 17:43:32 -0600 Subject: [PATCH] swab(1): fix some silly mistakes --- src/swab.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/swab.rs b/src/swab.rs index d997ddf..810a6cb 100644 --- a/src/swab.rs +++ b/src/swab.rs @@ -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::() { + if let Some(arg) = opt.arg() { + match opt.arg().parse::() { Ok(w) if w % 2 == 0 => { wordsize = w; () }, _ => { return usage(&argv[0]); }, } - }, + } + }, _ => { return usage(&argv[0]); } } }