summaryrefslogtreecommitdiffhomepage
path: root/subr.rtl
diff options
context:
space:
mode:
authorLucía Andrea Illanes Albornoz <lucia@luciaillanes.de>2023-02-19 07:19:26 +0100
committerLucía Andrea Illanes Albornoz <lucia@luciaillanes.de>2023-02-19 07:19:26 +0100
commitf6f7f2f65712e6fa114f5751a72ad26cd893e92f (patch)
tree28c2a2fed19f853670059a2d1d243dda6c7e8273 /subr.rtl
parent703de4a1f2032064f1505eb50f1aac63f3c3cfab (diff)
downloadmidipix_build-f6f7f2f65712e6fa114f5751a72ad26cd893e92f.tar.bz2
midipix_build-f6f7f2f65712e6fa114f5751a72ad26cd893e92f.tar.xz
Reject empty variables from the command line.
Diffstat (limited to 'subr.rtl')
-rw-r--r--subr.rtl/rtl_platform.subr16
1 files changed, 16 insertions, 0 deletions
diff --git a/subr.rtl/rtl_platform.subr b/subr.rtl/rtl_platform.subr
index 365d09eb..c5027d5f 100644
--- a/subr.rtl/rtl_platform.subr
+++ b/subr.rtl/rtl_platform.subr
@@ -144,6 +144,22 @@ rtl_run_cmd_unsplit() {
return ${_rrcu_rc};
};
+rtl_set_var_from_cmdline() {
+ local _rsvfc_rstatus="${1#\$}" _rsvfc_arg="${2}" \
+ _rsvfc_rc=0 _rsvfc_vname="" _rsvfc_vval="";
+
+ _rsvfc_vname="${_rsvfc_arg%%=*}";
+ _rsvfc_vval="${_rsvfc_arg#*=}";
+
+ if [ "${_rsvfc_vval:+1}" != 1 ]; then
+ _rsvfc_rc=1;
+ rtl_setrstatus "${_rsvfc_rstatus}" 'empty value specified for \${'"${_rsvfc_vname}"'}.';
+ else
+ rtl_set_var_unsafe "${_rsvfc_vname}" "${_rsvfc_vval}";
+ fi;
+ return "${_rsvfc_rc}";
+};
+
rtl_set_vars() {
local _rsv_vars_set_vname="${1}" _rsv_vname_dst="${2}" _rsv_vname_src_tmpls="${3}" \
_rsv_vars_set_old="" _rsv_vars_set_tmp="" _rsv_vname_src="" _rsv_vnames_src="";