From b2c1ea9526151c4fed9dca8348019d718f489e76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luc=C3=ADa=20Andrea=20Illanes=20Albornoz?= Date: Wed, 24 Apr 2024 15:24:48 +0200 Subject: Implements single package files. --- subr.rtl/rtl_fileop.subr | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'subr.rtl') diff --git a/subr.rtl/rtl_fileop.subr b/subr.rtl/rtl_fileop.subr index 0f999ad7..9dfc266d 100644 --- a/subr.rtl/rtl_fileop.subr +++ b/subr.rtl/rtl_fileop.subr @@ -16,6 +16,12 @@ rtlp_fileop_log() { rtl_log_msgV "fileop" "0;${1}"; }; +# +# Public globals +# + +RTL_FILEOP_SOURCE_FNAME=""; + # # Public subroutines # @@ -125,7 +131,7 @@ rtl_fileop() { touch ${2:+-t "${2}"} -- "${1}"; _rf_rc="${?}"; fi; ;; - mkdir|mkfifo|rm|source|source_opt|test) + mkdir|mkfifo|rm|source|source_with_fnamevar|source_opt|source_opt_with_fnamevar|test) while [ \( "${?}" -eq 0 \) -a \( ""${#}"" -gt 0 \) ]; do if [ "${1:+1}" != 1 ]; then rtl_log_msgV "fatalexit" "${MSG_rtl_fileop_invparm}" "${_rf_op}" "${*}"; @@ -154,11 +160,22 @@ rtl_fileop() { && rtlp_fileop_check "${PREFIX:-}" "${1}"; then rtlp_fileop_log "Sourcing file \`${1}'."; . "${1}"; _rf_rc="${?}"; + elif [ "${_rf_op}" = source_with_fnamevar ]\ + && rtlp_fileop_check "${PREFIX:-}" "${1}"; then + rtlp_fileop_log "Sourcing file \`${1}'."; + RTL_FILEOP_SOURCE_FNAME="${1}"; + . "${1}"; _rf_rc="${?}"; elif [ "${_rf_op}" = source_opt ]\ && rtl_fileop test "${1}"\ && rtlp_fileop_check "${PREFIX:-}" "${1}"; then rtlp_fileop_log "Sourcing file \`${1}'."; . "${1}"; _rf_rc="${?}"; + elif [ "${_rf_op}" = source_opt_with_fnamevar ]\ + && rtl_fileop test "${1}"\ + && rtlp_fileop_check "${PREFIX:-}" "${1}"; then + rtlp_fileop_log "Sourcing file \`${1}'."; + RTL_FILEOP_SOURCE_FNAME="${1}"; + . "${1}"; _rf_rc="${?}"; elif [ "${_rf_op}" = test ]\ && rtlp_fileop_check "${PREFIX:-}" "${1}"\ && ! [ \( -L "${1}" \) -o \( -e "${1}" \) ]; then -- cgit v1.2.3