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 | |
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')
-rw-r--r-- | subr.rtl/rtl.subr | 1 | ||||
-rw-r--r-- | subr.rtl/rtl_platform.subr | 21 |
2 files changed, 21 insertions, 1 deletions
diff --git a/subr.rtl/rtl.subr b/subr.rtl/rtl.subr index 50b7d188..1c51054a 100644 --- a/subr.rtl/rtl.subr +++ b/subr.rtl/rtl.subr @@ -13,7 +13,6 @@ RTL_NL=" rtl_date() { local _rdate="${1#\$}"; shift; eval ${_rdate}=\"\$\(command date \"+\${1:-\${DEFAULT_TIMESTAMP_FMT:-\"%Y/%m/%d %H:%M:%S\"}}\"\)\"; }; rtl_set_IFS_nl() { IFS="${RTL_NL}"; }; -rtl_set_var_unsafe() { [ "${2:+1}" = 1 ] && eval ${1}=\"${2}\" || return 0; }; rtl_test_cmd() { command -v "${1}" >/dev/null; }; rtl_uniq() { if [ "${#}" -gt 0 ]; then printf "%s" "${*}" | sed 's/ /\n/g' | awk '!x[$0]++' | paste -s -d" "; fi; }; rtl_uniq2() { eval set -- \${${1#\$}}; if [ "${#}" -gt 0 ]; then printf "%s" "${*}" | sed 's/ /\n/g' | awk '!x[$0]++' | paste -s -d" "; fi; }; 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 |