diff options
author | Lucía Andrea Illanes Albornoz <lucia@luciaillanes.de> | 2023-03-26 15:22:05 +0200 |
---|---|---|
committer | Lucía Andrea Illanes Albornoz <lucia@luciaillanes.de> | 2023-03-26 15:35:28 +0200 |
commit | 6a630d65522105b25363ab4ac10248fc13b1c783 (patch) | |
tree | fb7b0cc06f9a64a5a20bf18b8d31244d19a933b9 /subr.rtl/rtl_platform.subr | |
parent | d677b4ef2b668e64f85bcb55c96c7c8519ef9279 (diff) | |
download | midipix_build-6a630d65522105b25363ab4ac10248fc13b1c783.tar.bz2 midipix_build-6a630d65522105b25363ab4ac10248fc13b1c783.tar.xz |
Print group file pathname in ./pkgtool.sh -i output.
Diffstat (limited to 'subr.rtl/rtl_platform.subr')
-rw-r--r-- | subr.rtl/rtl_platform.subr | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/subr.rtl/rtl_platform.subr b/subr.rtl/rtl_platform.subr index 9bcf0734..9fc7b013 100644 --- a/subr.rtl/rtl_platform.subr +++ b/subr.rtl/rtl_platform.subr @@ -227,4 +227,25 @@ rtl_set_var() { return 0; }; +# +# rtl_set_var_unsafe() - set value of variable +# @[-u]: optionally convert variable name to upper case +# @_vname: variable name +# @_vval: variable value +# +# Returns: zero (0) on success, non-zero (>0) on failure +# N.B.: This function is *unsafe* and impossible to implement otherwise w/o filtering @_vname +# and implicitly allows for code execution and other undefined behaviour via @_vname. +# Do *not* pass untrusted input through @_vname. +rtl_set_var_unsafe() { + local _rsvu_vname="" _rsvu_vval=""; + if [ "x${1}" = "x-u" ]; then + shift; _rsvu_vname="${1}"; _rsvu_vval="${2}"; rtl_toupper \$_rsvu_vname; + else + _rsvu_vname="${1}"; _rsvu_vval="${2}"; + fi; + eval ${_rsvu_vname}='${_rsvu_vval}'; + return 0; +}; + # vim:filetype=sh textwidth=0 |