swab(1): don't accept positional arguments
This commit is contained in:
parent
35d54d84b0
commit
1fd768057c
|
@ -48,7 +48,8 @@ fn main() -> ExitCode {
|
|||
let mut input = stdin();
|
||||
let mut output = stdout().lock();
|
||||
|
||||
let mut wordsize: usize = 2;
|
||||
let mut optind: usize = 1; // argv[0]
|
||||
let mut wordsize: usize = 2; // Equivalent to dd(1p).
|
||||
|
||||
while let Some(opt) = argv.getopt(":w:") {
|
||||
match opt.opt() {
|
||||
|
@ -59,11 +60,16 @@ fn main() -> ExitCode {
|
|||
_ => { return usage(&argv[0]); },
|
||||
}
|
||||
}
|
||||
optind = opt.ind();
|
||||
},
|
||||
_ => { return usage(&argv[0]); }
|
||||
}
|
||||
}
|
||||
|
||||
if optind < argv.len() {
|
||||
return usage(&argv[0]);
|
||||
}
|
||||
|
||||
buf.resize(wordsize, 0);
|
||||
|
||||
loop {
|
||||
|
|
Loading…
Reference in New Issue
Block a user