swab(1): fix some silly mistakes
This commit is contained in:
parent
50bbee10a9
commit
6bd19c072d
@ -24,7 +24,7 @@ use std::{
|
|||||||
};
|
};
|
||||||
|
|
||||||
extern crate getopt;
|
extern crate getopt;
|
||||||
use getopt::{ Opt, Parser };
|
use getopt::GetOpt;
|
||||||
|
|
||||||
extern crate sysexits;
|
extern crate sysexits;
|
||||||
use sysexits::{ EX_OK, EX_OSERR, EX_USAGE };
|
use sysexits::{ EX_OK, EX_OSERR, EX_USAGE };
|
||||||
@ -45,7 +45,6 @@ fn main() -> ExitCode {
|
|||||||
let mut input = stdin();
|
let mut input = stdin();
|
||||||
let mut output = stdout().lock();
|
let mut output = stdout().lock();
|
||||||
|
|
||||||
let mut opts = Parser::new(&argv, "fw:");
|
|
||||||
let mut force = false;
|
let mut force = false;
|
||||||
let mut wordsize: usize = 2;
|
let mut wordsize: usize = 2;
|
||||||
|
|
||||||
@ -53,10 +52,12 @@ fn main() -> ExitCode {
|
|||||||
match opt.opt() {
|
match opt.opt() {
|
||||||
Ok("f") => force = true,
|
Ok("f") => force = true,
|
||||||
Ok("w") => {
|
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; () },
|
Ok(w) if w % 2 == 0 => { wordsize = w; () },
|
||||||
_ => { return usage(&argv[0]); },
|
_ => { return usage(&argv[0]); },
|
||||||
}
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
_ => { return usage(&argv[0]); }
|
_ => { return usage(&argv[0]); }
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user