[git commit] hush: code shrink

Denys Vlasenko vda.linux at googlemail.com
Mon Jan 4 02:05:34 UTC 2021


commit: https://git.busybox.net/busybox/commit/?id=3b053051c7c6f1e4776fce8a97d8f6a3c54f3f0e
branch: https://git.busybox.net/busybox/commit/?id=refs/heads/master

function                                             old     new   delta
hush_main                                           1071    1066      -5
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-5)               Total: -5 bytes
   text	   data	    bss	    dec	    hex	filename
1020110	    559	   5020	1025689	  fa699	busybox_old
1020037	    559	   5020	1025616	  fa650	busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
 shell/hush.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/shell/hush.c b/shell/hush.c
index 65f08659f..77f90f82f 100644
--- a/shell/hush.c
+++ b/shell/hush.c
@@ -10163,7 +10163,8 @@ int hush_main(int argc, char **argv)
 	/* http://www.opengroup.org/onlinepubs/9699919799/utilities/sh.html */
 	flags = (argv[0] && argv[0][0] == '-') ? OPT_login : 0;
 	while (1) {
-		int opt = getopt(argc, argv, "+cexinsl"
+		int opt = getopt(argc, argv, "+" /* stop at 1st non-option */
+				"cexinsl"
 #if !BB_MMU
 				"<:$:R:V:"
 # if ENABLE_HUSH_FUNCTIONS
@@ -10255,12 +10256,13 @@ int hush_main(int argc, char **argv)
 		}
 # endif
 #endif
-		case 'n':
-		case 'x':
-		case 'e':
+		/*case '?': invalid option encountered (set_mode('?') will fail) */
+		/*case 'n':*/
+		/*case 'x':*/
+		/*case 'e':*/
+		default:
 			if (set_mode(1, opt, NULL) == 0) /* no error */
 				break;
-		default:
 			bb_show_usage();
 		}
 	} /* option parsing loop */


More information about the busybox-cvs mailing list