From 6a630d65522105b25363ab4ac10248fc13b1c783 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luc=C3=ADa=20Andrea=20Illanes=20Albornoz?= Date: Sun, 26 Mar 2023 15:22:05 +0200 Subject: Print group file pathname in ./pkgtool.sh -i output. --- subr.rtl/rtl_platform.subr | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'subr.rtl/rtl_platform.subr') 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 -- cgit v1.2.3