forked from bonsai/harakit
		
	swab(1): updates getopt usage
This commit is contained in:
		
							parent
							
								
									1fd768057c
								
							
						
					
					
						commit
						ca6865688a
					
				@ -1,5 +1,6 @@
 | 
			
		||||
/*
 | 
			
		||||
 * Copyright (c) 2024 DTB <trinity@trinity.moe>
 | 
			
		||||
 * Copyright (c) 2024 Emma Tebibyte <emma@tebibyte.media>
 | 
			
		||||
 * SPDX-License-Identifier: AGPL-3.0-or-later
 | 
			
		||||
 *
 | 
			
		||||
 * This program is free software: you can redistribute it and/or modify it under
 | 
			
		||||
@ -54,12 +55,10 @@ fn main() -> ExitCode {
 | 
			
		||||
	while let Some(opt) = argv.getopt(":w:") {
 | 
			
		||||
		match opt.opt() {
 | 
			
		||||
			Ok("w") => {
 | 
			
		||||
				if let Some(arg) = opt.arg() {
 | 
			
		||||
					match arg.parse::<usize>() {
 | 
			
		||||
						Ok(w) if w % 2 == 0 => { wordsize = w; () },
 | 
			
		||||
					match opt.arg().unwrap().parse::<usize>() {
 | 
			
		||||
						Ok(w) if w % 2 == 0 => { wordsize = w; },
 | 
			
		||||
						_ => { return usage(&argv[0]); },
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
				optind = opt.ind();
 | 
			
		||||
			},
 | 
			
		||||
			_ => { return usage(&argv[0]); }
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user