summaryrefslogtreecommitdiffhomepage
path: root/subr
diff options
context:
space:
mode:
authorLucio Andrés Illanes Albornoz (arab, vxp) <lucio@lucioillanes.de>2017-11-29 18:19:20 +0000
committerLucio Andrés Illanes Albornoz (arab, vxp) <lucio@lucioillanes.de>2017-11-29 18:19:20 +0000
commit1de7024f852bb7c20559b3dfc5efcd4f3913928f (patch)
treec4126527194d9006412ee1bb85ca65f41a2da658 /subr
parentd8074b3d2581c6e28eb05d4b01afcc404a432459 (diff)
downloadmidipix_build-1de7024f852bb7c20559b3dfc5efcd4f3913928f.tar.bz2
midipix_build-1de7024f852bb7c20559b3dfc5efcd4f3913928f.tar.xz
subr/ex_{rtl,pkg_steps}.subr: simplify ex_lfilter().
Diffstat (limited to 'subr')
-rw-r--r--subr/ex_pkg_steps.subr2
-rw-r--r--subr/ex_rtl.subr36
2 files changed, 24 insertions, 14 deletions
diff --git a/subr/ex_pkg_steps.subr b/subr/ex_pkg_steps.subr
index da2ce6b6..f756d815 100644
--- a/subr/ex_pkg_steps.subr
+++ b/subr/ex_pkg_steps.subr
@@ -8,7 +8,7 @@ ex_pkg_steps() {
_step _step_type \
_step_cmds _step_cmd_args \
_step_cmd_pfx _step_cmd _step_next;
- set -- $(ex_lfilter -not "${BUILD_STEPS}" "${PKG_BUILD_STEPS_DISABLE}");
+ set -- $(ex_lfilter_not "${BUILD_STEPS}" "${PKG_BUILD_STEPS_DISABLE}");
while [ ${#} -gt 0 ]; do
_step="${1}"; _step_next="${2}";
_step_cmds=""; _step_cmd_args="";
diff --git a/subr/ex_rtl.subr b/subr/ex_rtl.subr
index 150b0f4d..0ab30885 100644
--- a/subr/ex_rtl.subr
+++ b/subr/ex_rtl.subr
@@ -17,25 +17,35 @@ ex_test_cmd() { command -v "${1}" >/dev/null; };
ex_toupper() { echo "${1}" | tr a-z A-Z; };
ex_lfilter() {
- [ "x${1}" = "x-not" ] && { local _notfl=1; shift; }
- local _list="${1}" _filter="${2}" _lnew _litem _ex_lfilter _filterfl;
- [ -z "${_filter}" ] && { echo "${_list}"; return 0; };
- for _litem in ${_list}; do
+ local _list="${1}" _filter="${2}" _lnew _litem _litem_filter;
+ if [ -z "${_filter}" ]; then
+ echo "${_list}"; return 0;
+ else for _litem in ${_list}; do
+ for _litem_filter in ${_filter}; do
+ if [ "${_litem_filter}" = "${_litem}" ]; then
+ _lnew="${_lnew:+${_lnew} }${_litem}";
+ break;
+ fi;
+ done;
+ done; fi;
+ echo "${_lnew}";
+};
+
+ex_lfilter_not() {
+ local _list="${1}" _filter="${2}" _lnew _litem _litem_filter _filterfl;
+ if [ -z "${_filter}" ]; then
+ echo "${_list}"; return 0;
+ else for _litem in ${_list}; do
_filterfl=0;
- for _ex_lfilter in ${_filter}; do
- if [ "${_notfl:-0}" -eq 0 ]\
- && [ "${_ex_lfilter}" = "${_litem}" ]; then
- _lnew="${_lnew:+${_lnew} }${_litem}"; break;
- elif [ "${_notfl:-0}" -eq 1 ]\
- && [ "${_ex_lfilter}" = "${_litem}" ]; then
+ for _litem_filter in ${_filter}; do
+ if [ "${_litem_filter}" = "${_litem}" ]; then
_filterfl=1; break;
fi;
done;
- if [ "${_notfl:-0}" -eq 1 ]\
- && [ "${_filterfl:-0}" -eq 0 ]; then
+ if [ "${_filterfl:-0}" -eq 0 ]; then
_lnew="${_lnew:+${_lnew} }${_litem}";
fi;
- done;
+ done; fi;
echo "${_lnew}";
};