diff options
Diffstat (limited to 'subr.rtl/rtl_fileop.subr')
-rw-r--r-- | subr.rtl/rtl_fileop.subr | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/subr.rtl/rtl_fileop.subr b/subr.rtl/rtl_fileop.subr index 4addffcd..6d258f5e 100644 --- a/subr.rtl/rtl_fileop.subr +++ b/subr.rtl/rtl_fileop.subr @@ -14,7 +14,7 @@ rtlp_fileop_check() { }; rtlp_fileop_log() { - rtl_log_msg "fileop" "${1}"; + rtl_log_msg "fileop" "0;${1}"; }; # @@ -25,27 +25,27 @@ rtl_fileop() { local _op="${1}" _dst="" _group="" _install_args="" _mode="" _owner="" _rc=0 _src=""; shift; case "${_op}" in cd) if [ \( -z "${1}" \) -o ! \( -L "${1}" -o -e "${1}" \) ]; then - rtl_log_msg "fatalexit" "Error: Invalid or non-existent directory \`%s'." "${1}"; + rtl_log_msg "fatalexit" "${MSG_rtl_fileop_invalid_dir}" "${1}"; elif rtlp_fileop_check "${PREFIX:-}" "${1}"; then rtlp_fileop_log "Changing working directory to \`${1}'."; cd -- "${1}"; _rc="${?}"; fi; ;; chmod) if [ "${#}" -lt 2 ]; then - rtl_log_msg "fatalexit" "Error: Missing parameters (in: chmod %s.)" "${*}"; + rtl_log_msg "fatalexit" "${MSG_rtl_fileop_invparm_chmod}" "${*}"; elif _mode="${1}" && shift\ && rtlp_fileop_check "${PREFIX:-}" "${*}"; then rtlp_fileop_log "Changing file mode bits of \`${*}' to \`${_mode}'."; chmod -- "${_mode}" "${@}"; _rc="${?}"; fi; ;; chgrp) if [ "${#}" -lt 2 ]; then - rtl_log_msg "fatalexit" "Error: Missing parameters (in: chgrp %s.)" "${*}"; + rtl_log_msg "fatalexit" "${MSG_rtl_fileop_invparm_chgrp}" "${*}"; elif _group="${1}" && shift\ && rtlp_fileop_check "${PREFIX:-}" "${*}"; then rtlp_fileop_log "Changing file group of \`${*}' to \`${_group}'."; chgrp -- "${_group}" "${@}"; _rc="${?}"; fi; ;; chown) if [ "${#}" -lt 2 ]; then - rtl_log_msg "fatalexit" "Error: Missing parameters (in: chown %s.)" "${*}"; + rtl_log_msg "fatalexit" "${MSG_rtl_fileop_invparm_chown}" "${*}"; elif _owner="${1}" && shift\ && rtlp_fileop_check "${PREFIX:-}" "${*}"; then rtlp_fileop_log "Changing file owner of \`${*}' to \`${_owner}'."; @@ -53,7 +53,7 @@ rtl_fileop() { fi; ;; cp_follow) if [ "${#}" -lt 2 ]; then - rtl_log_msg "fatalexit" "Error: Missing parameters (in: cp_follow %s}.)" "${*}"; + rtl_log_msg "fatalexit" "${MSG_rtl_fileop_invparm_cp_follow}" "${*}"; elif rtlp_fileop_check "${PREFIX:-}" "${*}"; then _src="${*}"; _src="${_src% *}"; _dst="${*}"; _dst="${_dst##* }"; @@ -61,7 +61,7 @@ rtl_fileop() { cp -pLR -- "${@}"; _rc="${?}"; fi; ;; cp) if [ "${#}" -lt 2 ]; then - rtl_log_msg "fatalexit" "Error: Missing parameters (in: cp %s.)" "${*}"; + rtl_log_msg "fatalexit" "${MSG_rtl_fileop_invparm_cp}" "${*}"; elif rtlp_fileop_check "${PREFIX:-}" "${*}"; then _src="${*}"; _src="${_src% *}"; _dst="${*}"; _dst="${_dst##* }"; @@ -70,7 +70,7 @@ rtl_fileop() { fi; ;; install) if [ "${#}" -lt 2 ]; then - rtl_log_msg "fatalexit" "Error: Missing parameters (in: install %s.)" "${*}"; + rtl_log_msg "fatalexit" "${MSG_rtl_fileop_invparm_install}" "${*}"; else _dst="$(while [ ""${#}"" -gt 2 ]; do shift; done; printf "%s" "${2}")"; _install_args="$(while [ ""${#}"" -gt 2 ]; do printf "%s" "${1}"; shift; done)"; _src="$(while [ ""${#}"" -gt 2 ]; do shift; done; printf "%s" "${1}")"; @@ -81,7 +81,7 @@ rtl_fileop() { fi; ;; ln_symbolic) if [ \( -z "${1}" \) -o \( -z "${2}" \) ]; then - rtl_log_msg "fatalexit" "Error: Missing parameters (in: ln_symbolic %s.)" "${*}"; + rtl_log_msg "fatalexit" "${MSG_rtl_fileop_invparm_ln_symbolic}" "${*}"; elif rtlp_fileop_check "${PREFIX:-}" "${2}"; then if rtl_fileop test "${2}"; then rtl_fileop rm "${2}"; @@ -92,13 +92,13 @@ rtl_fileop() { fi; fi; ;; mv) if [ \( -z "${1}" \) -o \( -z "${2}" \) ]; then - rtl_log_msg "fatalexit" "Error: Missing parameters (in: mv %s.)" "${*}"; + rtl_log_msg "fatalexit" "${MSG_rtl_fileop_invparm_mv}" "${*}"; elif rtlp_fileop_check "${PREFIX:-}" "${1}" "${2}"; then rtlp_fileop_log "Moving \`${1}' to \`${2}' w/ -fs"; mv -f -- "${1}" "${2}"; _rc="${?}"; fi; ;; touch) if [ -z "${1}" ]; then - rtl_log_msg "fatalexit" "Error: Missing parameters (in: touch %s.)" "${*}"; + rtl_log_msg "fatalexit" "${MSG_rtl_fileop_invparm_touch}" "${*}"; elif rtlp_fileop_check "${PREFIX:-}" "${1}"; then rtlp_fileop_log "Touching file \`${1}'${2:+ w/ timestamp \`${2}\'}."; touch ${2:+-t "${2}"} -- "${1}"; _rc="${?}"; @@ -106,7 +106,7 @@ rtl_fileop() { mkdir|mkfifo|rm|source|source_opt|test) while [ \( "${?}" -eq 0 \) -a \( ""${#}"" -gt 0 \) ]; do if [ -z "${1}" ]; then - rtl_log_msg "fatalexit" "Error: Missing parameters (in: %s %s.)" "${_op}" "${*}"; + rtl_log_msg "fatalexit" "${MSG_rtl_fileop_invparm}" "${_op}" "${*}"; elif [ "${_op}" = mkdir ]\ && [ ! -d "${1}" ]\ && rtlp_fileop_check "${PREFIX:-}" "${1}"; then @@ -143,7 +143,7 @@ rtl_fileop() { return 1; fi; shift; done; ;; - *) rtl_log_msg "fatalexit" "Error: rtl_fileop() called w/ invalid parameter(s): %s" "${*}"; ;; + *) rtl_log_msg "fatalexit" "${MSG_rtl_fileop_invparm_fileop}" "${*}"; ;; esac; return "${_rc}"; }; |