ash: allow "trap NUM [SIG]..." syntax
While at it, make get_signum() return -1 for numeric strings >= NSIG. function old new delta trapcmd 292 306 +14 get_signum 295 300 +5 builtin_trap 413 412 -1 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/1 up/down: 19/-1) Total: 18 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
		@@ -143,7 +143,7 @@ int FAST_FUNC get_signum(const char *name)
 | 
			
		||||
	unsigned i;
 | 
			
		||||
 | 
			
		||||
	i = bb_strtou(name, NULL, 10);
 | 
			
		||||
	if (!errno)
 | 
			
		||||
	if (!errno && i < NSIG) /* for shells, we allow 0 too */
 | 
			
		||||
		return i;
 | 
			
		||||
	if (strncasecmp(name, "SIG", 3) == 0)
 | 
			
		||||
		name += 3;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user