Mercurial > hgrepos > FreeBSD > ports > sysutils > local-bsdtools
changeset 750:464fc11180a0
farray.sh: Allow some end indexes "0" when the array/alist is empty
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Thu, 10 Oct 2024 13:31:14 +0200 |
| parents | e8eb5e7ceb37 |
| children | 4101e755b3e7 |
| files | share/local-bsdtools/farray.sh |
| diffstat | 1 files changed, 2 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/share/local-bsdtools/farray.sh Thu Oct 10 13:27:50 2024 +0200 +++ b/share/local-bsdtools/farray.sh Thu Oct 10 13:31:14 2024 +0200 @@ -1392,7 +1392,7 @@ __farr_end="${4-}" [ -z "${__farr_end}" ] && __farr_end="${__farr_len}" _farr_make_index __farr_end "${__farr_end}" "${__farr_len}" - [ ${__farr_end} -lt 1 ] && _farr_fatal "end index must be >= 1" + [ ${__farr_end} -lt 1 ] && [ ${__farr_len} -gt 0 ] && _farr_fatal "end index must be >= 1" [ ${__farr_end} -gt "${__farr_len}" ] && _farr_fatal "end index exceeds array length" __farr_cur_find_idx=${__farr_start} @@ -2844,7 +2844,7 @@ __farr_end="${4-}" [ -z "${__farr_end}" ] && __farr_end="${__farr_len}" _farr_make_index __farr_end "${__farr_end}" "${__farr_len}" - [ ${__farr_end} -lt 1 ] && _farr_fatal "end index must be >= 1" + [ ${__farr_end} -lt 1 ] && [ ${__farr_len} -gt 0 ] && _farr_fatal "end index must be >= 1" [ ${__farr_end} -gt "${__farr_len}" ] && _farr_fatal "end index exceeds array length" __farr_cur_find_idx=${__farr_start}
