From 8a27f992e5b7c62e144dbbfc3435a90c470d92a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucio=20Andr=C3=A9s=20Illanes=20Albornoz?= Date: Wed, 11 Mar 2020 16:09:22 +0000 Subject: Initial implementation of pkgtool.sh. build.sh:build(): move cd(1) to $(dirname "${0}"). etc/{build.usage,README.md}: updated. midipix.env:${DEFAULT_CLEAR_ENV_VARS_EXCEPT}: allow inheriting ARCH, BUILD, BUILD_DLCACHEDIR, BUILD_WORKDIR, and PREFIX* from the environment. pkgtool.sh: initial implementation. subr/build_init.subr:buildp_init_defaults(): allow inheriting ARCH, BUILD, BUILD_DLCACHEDIR, BUILD_WORKDIR, and PREFIX* from the environment. subr/build_init.subr:buildp_init_env(): move cd(1) to $(dirname "${0}"). subr/build_init.subr:buildp_init_files(): correctly pass ${_status} from rtl_check_path_vars(). subr/ex_pkg_exec.subr:ex_pkg_exec(): dump subset of variables and exported variables on build failure and --dump-on-abort. subr/pkgtool_init.subr: adapted from subr/build_init.subr. subr/rtl_complex.subr:rtl_filter_vars(): initial implementation. subr/rtl_string.subr:rtl_subst(): initial implementation. --- subr/rtl_string.subr | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'subr/rtl_string.subr') diff --git a/subr/rtl_string.subr b/subr/rtl_string.subr index 0e549d3c..2d529786 100644 --- a/subr/rtl_string.subr +++ b/subr/rtl_string.subr @@ -12,6 +12,17 @@ rtl_isnumber() { return "${_rc}"; }; +rtl_subst() { + local _s="${1}" _find="${2}" _replace="${3}" _prefix="" _s_new=""; + while [ -n "${_s}" ]; do + case "${_s}" in + *${_find}*) _prefix="${_s%%${_find}*}"; _s="${_s#*${_find}}"; + _s_new="${_s_new:+${_s_new}}${_prefix}${_replace}"; ;; + *) _s_new="${_s_new:+${_s_new}}${_s}"; _s=""; ;; + esac; done; + echo "${_s_new}"; +}; + rtl_tolower() { local _s="${1}" _s_new=""; while [ -n "${_s}" ]; do -- cgit v1.2.3