diff options
author | Denys Vlasenko | 2017-08-17 12:36:39 +0200 |
---|---|---|
committer | Denys Vlasenko | 2017-08-17 12:36:39 +0200 |
commit | 048491fbdccc35edd481218baeedb31c5253aa12 (patch) | |
tree | c5a4ebb013068a300f8e3e907c88af3e0c98d208 | |
parent | a1799db4ac660a15285e1ac2464b5f622746d787 (diff) | |
download | busybox-048491fbdccc35edd481218baeedb31c5253aa12.zip busybox-048491fbdccc35edd481218baeedb31c5253aa12.tar.gz |
hush: trivial code shrink in builtin_getopts
function old new delta
builtin_getopts 368 363 -5
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | shell/hush.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/shell/hush.c b/shell/hush.c index 42f95ef..cdc3a86 100644 --- a/shell/hush.c +++ b/shell/hush.c @@ -9897,12 +9897,13 @@ Test that VAR is a valid variable name? return EXIT_FAILURE; } - if (optstring[0] == ':') { - opterr = 0; - } else { + c = 0; + if (optstring[0] != ':') { cp = get_local_var_value("OPTERR"); - opterr = cp ? atoi(cp) : 1; + /* 0 if "OPTERR=0", 1 otherwise */ + c = (!cp || NOT_LONE_CHAR(cp, '0')); } + opterr = c; cp = get_local_var_value("OPTIND"); optind = cp ? atoi(cp) : 0; optarg = NULL; |