summaryrefslogtreecommitdiffhomepage
path: root/subr
diff options
context:
space:
mode:
authorLucio Andrés Illanes Albornoz <lucio@lucioillanes.de>2020-03-02 11:33:33 +0000
committerLucio Andrés Illanes Albornoz <lucio@lucioillanes.de>2020-03-02 11:33:33 +0000
commit974685c3e3758295d12bcfb5558389ef60d57ed8 (patch)
treea1951d648ea8efa76ab630eb6d26d0660f903f03 /subr
parent6054d40c03c13989692038f9ae860f9a873a19ee (diff)
downloadmidipix_build-974685c3e3758295d12bcfb5558389ef60d57ed8.tar.bz2
midipix_build-974685c3e3758295d12bcfb5558389ef60d57ed8.tar.xz
subr/build_init.subr:buildp_init_args(): reduce sed(1) usage.
subr/rtl_list.subr:rtl_llift(): added.
Diffstat (limited to 'subr')
-rw-r--r--subr/build_init.subr4
-rw-r--r--subr/rtl_list.subr6
2 files changed, 8 insertions, 2 deletions
diff --git a/subr/build_init.subr b/subr/build_init.subr
index 7cce5da3..42a5328e 100644
--- a/subr/build_init.subr
+++ b/subr/build_init.subr
@@ -20,8 +20,8 @@ buildp_init_args() {
ALL) ARG_RESTART_AT=ALL; ARG_RESTART_RECURSIVE=2; ;;
LAST) ARG_RESTART_AT=ALL; ARG_RESTART_RECURSIVE=0; ;;
"") ;;
- *:*) ARG_RESTART_AT="${ARG_RESTART#*:}"; ARG_RESTART="$(echo "${ARG_RESTART%%:*}" | sed "s/,/ /g")"; ;;
- *) ARG_RESTART="$(echo "${ARG_RESTART}" | sed "s/,/ /g")"; ARG_RESTART_AT=ALL; ;;
+ *:*) ARG_RESTART_AT="${ARG_RESTART#*:}"; ARG_RESTART="$(rtl_llift "${ARG_RESTART%%:*}" "," " ")"; ;;
+ *) ARG_RESTART="$(rtl_llift "${ARG_RESTART}" "," " ")"; ARG_RESTART_AT=ALL; ;;
esac;
if [ "${ARG_RESTART}" = "LAST" ]; then
if [ -n "${DEFAULT_BUILD_LAST_FAILED_PKG_FNAME}" ]\
diff --git a/subr/rtl_list.subr b/subr/rtl_list.subr
index 056d8016..479b0fd4 100644
--- a/subr/rtl_list.subr
+++ b/subr/rtl_list.subr
@@ -38,6 +38,12 @@ rtl_llength() {
echo "${_llength}";
};
+rtl_llift() {
+ local _list="${1}" _sep="${2}" _sep_new="${3}" IFS; IFS="${_sep}";
+ set -- ${_list}; IFS="${_sep_new}";
+ echo "${*}";
+};
+
rtl_lmatch() {
local _list="${1}" _item="${2}" _sep="${3}";
[ -n "$(rtl_lsearch "${_list}" "${_item}" "${_sep}")" ];