From dc07baeb4b5443131e0bd7f2c5f3b506e23d74dc Mon Sep 17 00:00:00 2001 From: Lucio Andrés Illanes Albornoz Date: Aug 27 2021 18:51:14 +0000 Subject: Implements localised message files, pt. II. --- diff --git a/build.sh b/build.sh index 34bb21c..8ccdfd0 100755 --- a/build.sh +++ b/build.sh @@ -142,9 +142,9 @@ build() { fi; fi; if [ "${_rc}" -ne 0 ]; then - rtl_log_msg "fatalexit" "${_status}"; + rtl_log_msg "fatalexit" "0;${_status}"; elif [ -n "${_status}" ]; then - rtl_log_msg "info" "${_status}"; + rtl_log_msg "info" "0;${_status}"; fi; }; diff --git a/etc/build.msgs.en b/etc/build.msgs.en index 9eee95b..59578e1 100644 --- a/etc/build.msgs.en +++ b/etc/build.msgs.en @@ -2,38 +2,38 @@ # en_* locale messages file for build.sh # -MSG_build_aborted="Build aborted."; -MSG_build_begin="Build started by %s@%s at %s."; -MSG_build_clean_prefix="-C prefix specified, cleaning prefix..."; -MSG_build_failed_in="Build failed in \`%s', check \`%s' for details."; -MSG_build_finish="%s finished, %s skipped, and %s failed package(s)."; -MSG_build_finish_time="Build time: %s hour(s), %s minute(s), and %s second(s)."; -MSG_build_killed_pids="Killed PID(s): %s"; -MSG_build_reset_pkg_state="Reset package state for: %s"; -MSG_build_resolved_deps="Resolved \`%s' dependencies."; -MSG_build_resolving_deps="Resolving \`%s' dependencies..."; -MSG_build_unknown_dep="Error: dependency \`%s' of \`%s' unknown."; +MSG_build_aborted="0;Build aborted."; +MSG_build_begin="3;Build started by %s@%s at %s."; +MSG_build_clean_prefix="0;-C prefix specified, cleaning prefix..."; +MSG_build_failed_in="2;Build failed in \`%s', check \`%s' for details."; +MSG_build_finish="3;%s finished, %s skipped, and %s failed package(s)."; +MSG_build_finish_time="3;Build time: %s hour(s), %s minute(s), and %s second(s)."; +MSG_build_killed_pids="1;Killed PID(s): %s"; +MSG_build_reset_pkg_state="1;Reset package state for: %s"; +MSG_build_resolved_deps="1;Resolved \`%s' dependencies."; +MSG_build_resolving_deps="1;Resolving \`%s' dependencies..."; +MSG_build_unknown_dep="2;Error: dependency \`%s' of \`%s' unknown."; -MSG_group_begin="[%3d%% ] [%03d/%03d] Starting \`%s' build group..."; -MSG_group_finish="[%3d%% ] [%03d/%03d] Finished \`%s' build group."; +MSG_group_begin="4;[%3d%% ] [%03d/%03d] Starting \`%s' build group..."; +MSG_group_finish="4;[%3d%% ] [%03d/%03d] Finished \`%s' build group."; -MSG_pkg_begin="[%3d%%/%3d%%] [%03d/%03d] Starting \`%s' build..."; -MSG_pkg_faildump1="Logged environment dump for failed package \`%s' to \`%s'."; -MSG_pkg_faildump2="Enter an interactive package build shell w/ the command line: ./pkgtool.sh -a %s -b %s \"%s\" PREFIX=\"%s\""; +MSG_pkg_begin="5;[%3d%%/%3d%%] [%03d/%03d] Starting \`%s' build..."; +MSG_pkg_faildump1="2;Logged environment dump for failed package \`%s' to \`%s'."; +MSG_pkg_faildump2="4;Enter an interactive package build shell w/ the command line: ./pkgtool.sh -a %s -b %s \"%s\" PREFIX=\"%s\""; MSG_pkg_fail_missing_vars="Error: \${PKG_SUBDIR} must be specified given both \${PKG_FNAME} and \${PKG_URLS_GIT}."; -MSG_pkg_finish="[%3d%%/%3d%%] [%03d/%03d] Finished \`%s' build."; -MSG_pkg_msg="%s/%s: %s"; -MSG_pkg_skip_disabled="Skipping disabled package \`%s'."; -MSG_pkg_skip_finished="Skipping finished package \`%s'."; -MSG_pkg_skip_unknown="Error: unknown package \`%s'."; -MSG_pkg_stderrout_log="%s/%s_stderrout.log:"; -MSG_pkg_step="Finished build step %s of package \`%s'."; -MSG_pkg_strip="Stripping %s..."; +MSG_pkg_finish="5;[%3d%%/%3d%%] [%03d/%03d] Finished \`%s' build."; +MSG_pkg_msg="3;%s/%s: %s"; +MSG_pkg_skip_disabled="1;Skipping disabled package \`%s'."; +MSG_pkg_skip_finished="1;Skipping finished package \`%s'."; +MSG_pkg_skip_unknown="1;Error: unknown package \`%s'."; +MSG_pkg_stderrout_log="2;%s/%s_stderrout.log:"; +MSG_pkg_step="2;Finished build step %s of package \`%s'."; +MSG_pkg_strip="1;Stripping %s..."; -MSG_zipdist_begin="Building deployable distribution ZIP archive..."; -MSG_zipdist_finished="Finished building deployable distribution ZIP archive."; -MSG_zipdist_missing_pkg_build_dir="Error: missing package build directory for package \`%s'."; -MSG_zipdist_signed="Signed deployable distribution ZIP archive."; -MSG_zipdist_signing="Signing deployable distribution ZIP archive..."; +MSG_zipdist_begin="0;Building deployable distribution ZIP archive..."; +MSG_zipdist_finished="0;Finished building deployable distribution ZIP archive."; +MSG_zipdist_missing_pkg_build_dir="1;Error: missing package build directory for package \`%s'."; +MSG_zipdist_signed="0;Signed deployable distribution ZIP archive."; +MSG_zipdist_signing="0;Signing deployable distribution ZIP archive..."; # vim:foldmethod=marker ft=sh diff --git a/etc/pkgtool.msgs.en b/etc/pkgtool.msgs.en index bf3fc77..55b1206 100644 --- a/etc/pkgtool.msgs.en +++ b/etc/pkgtool.msgs.en @@ -2,34 +2,34 @@ # en_* locale messages file for pkgtool.sh # -MSG_pkgtool_build_group="Build group: %s"; -MSG_pkgtool_no_env_dump="Warning: failed to locate environment dump for package \`%s' in \`%s'."; -MSG_pkgtool_pkg_archive_mirroring="Mirroring package \`%s', archive URL(s): \`%s'..."; -MSG_pkgtool_pkg_archive_mirroring_parent="Mirroring package \`%s' (parent package: \`%s'), archive URL(s): \`%s'..."; -MSG_pkgtool_pkg_deps_fail="Warning: failed to unfold dependency-expanded package name list for \`%s'."; -MSG_pkgtool_pkg_deps_full_disabled="Full dependencies of \`%s' (disabled packages:) %s"; -MSG_pkgtool_pkg_deps_full="Full dependencies of \`%s': %s"; -MSG_pkgtool_pkg_deps_rev_none="Package \`%s' has no reverse dependencies."; -MSG_pkgtool_pkg_direct_deps="Direct dependencies of \`%s': %s"; -MSG_pkgtool_pkg_disabled="Package \`%s' (parent package: \`%s') disabled, skipping."; -MSG_pkgtool_pkg_git_mirroring="Mirroring package \`%s', Git URL(s): \`%s'..."; -MSG_pkgtool_pkg_git_mirroring_parent="Mirroring package \`%s' (parent package: \`%s'), Git URL(s): \`%s'..."; -MSG_pkgtool_pkg_link_fail="Failed to create symbolic link \`%s' for package \`%s' w/ parent package \`%s'."; -MSG_pkgtool_pkg_mirror_fail="Failed to mirror package \`%s', skipping."; -MSG_pkgtool_pkg_no_deps="Package \`%s' has no dependencies."; -MSG_pkgtool_pkgs_deps_rev_disabled="Reverse dependencies of \`%s' (disabled packages:) %s"; -MSG_pkgtool_pkgs_deps_rev="Reverse dependencies of \`%s': %s"; -MSG_pkgtool_pkg_skip_archive_mirror="Archive URL(s) mirroring disabled, skipping \`%s'."; -MSG_pkgtool_pkg_skip_git_mirror_disabled="Package \`%s' specifies to skip Git URL(s) mirroring, skipping."; -MSG_pkgtool_pkg_skip_git_mirror="Git URL(s) mirroring disabled, skipping \`%s'."; -MSG_pkgtool_pkg_skip_no_urls="Package \`%s' has neither archive nor Git URL(s), skipping."; -MSG_pkgtool_rebuilding_pkg="Rebuilding package \`%s' w/ --dump-in build..."; -MSG_pkgtool_shell_env1="Launching shell \`%s' within package environment and \`%s'."; -MSG_pkgtool_shell_env2="Run \$R to rebuild \`%s'."; -MSG_pkgtool_shell_env3="Run \$RS to restart the specified build step of \`%s'"; -MSG_pkgtool_shell_env4="Run \$D to automatically regenerate the patch for \`%s'."; -MSG_pkgtool_tarball_created="Created compressed tarball of \`%s' and \`%s_stderrout.log'."; -MSG_pkgtool_tarball_creating="Creating compressed tarball of \`%s' and \`%s_stderrout.log'..."; -MSG_pkgtool_updated_patches="Updated \`%s/patches/%s'."; +MSG_pkgtool_build_group="1;Build group: %s"; +MSG_pkgtool_no_env_dump="2;Warning: failed to locate environment dump for package \`%s' in \`%s'."; +MSG_pkgtool_pkg_archive_mirroring="2;Mirroring package \`%s', archive URL(s): \`%s'..."; +MSG_pkgtool_pkg_archive_mirroring_parent="3;Mirroring package \`%s' (parent package: \`%s'), archive URL(s): \`%s'..."; +MSG_pkgtool_pkg_deps_fail="1;Warning: failed to unfold dependency-expanded package name list for \`%s'."; +MSG_pkgtool_pkg_deps_full_disabled="2;Full dependencies of \`%s' (disabled packages:) %s"; +MSG_pkgtool_pkg_deps_full="2;Full dependencies of \`%s': %s"; +MSG_pkgtool_pkg_deps_rev_none="1;Package \`%s' has no reverse dependencies."; +MSG_pkgtool_pkg_direct_deps="2;Direct dependencies of \`%s': %s"; +MSG_pkgtool_pkg_disabled="2;Package \`%s' (parent package: \`%s') disabled, skipping."; +MSG_pkgtool_pkg_git_mirroring="2;Mirroring package \`%s', Git URL(s): \`%s'..."; +MSG_pkgtool_pkg_git_mirroring_parent="3;Mirroring package \`%s' (parent package: \`%s'), Git URL(s): \`%s'..."; +MSG_pkgtool_pkg_link_fail="3;Failed to create symbolic link \`%s' for package \`%s' w/ parent package \`%s'."; +MSG_pkgtool_pkg_mirror_fail="1;Failed to mirror package \`%s', skipping."; +MSG_pkgtool_pkg_no_deps="1;Package \`%s' has no dependencies."; +MSG_pkgtool_pkgs_deps_rev_disabled="2;Reverse dependencies of \`%s' (disabled packages:) %s"; +MSG_pkgtool_pkgs_deps_rev="2;Reverse dependencies of \`%s': %s"; +MSG_pkgtool_pkg_skip_archive_mirror="1;Archive URL(s) mirroring disabled, skipping \`%s'."; +MSG_pkgtool_pkg_skip_git_mirror_disabled="1;Package \`%s' specifies to skip Git URL(s) mirroring, skipping."; +MSG_pkgtool_pkg_skip_git_mirror="1;Git URL(s) mirroring disabled, skipping \`%s'."; +MSG_pkgtool_pkg_skip_no_urls="1;Package \`%s' has neither archive nor Git URL(s), skipping."; +MSG_pkgtool_rebuilding_pkg="1;Rebuilding package \`%s' w/ --dump-in build..."; +MSG_pkgtool_shell_env1="2;Launching shell \`%s' within package environment and \`%s'."; +MSG_pkgtool_shell_env2="1;Run \$R to rebuild \`%s'."; +MSG_pkgtool_shell_env3="1;Run \$RS to restart the specified build step of \`%s'"; +MSG_pkgtool_shell_env4="1;Run \$D to automatically regenerate the patch for \`%s'."; +MSG_pkgtool_tarball_created="2;Created compressed tarball of \`%s' and \`%s_stderrout.log'."; +MSG_pkgtool_tarball_creating="2;Creating compressed tarball of \`%s' and \`%s_stderrout.log'..."; +MSG_pkgtool_updated_patches="2;Updated \`%s/patches/%s'."; # vim:foldmethod=marker ft=sh diff --git a/etc/rtl.msgs.en b/etc/rtl.msgs.en index aee15ab..4298dae 100644 --- a/etc/rtl.msgs.en +++ b/etc/rtl.msgs.en @@ -2,34 +2,34 @@ # en_* locale messages file for subr.rtl/*.subr # -MSG_rtl_fetch_fail="Error: failed to fetch URL \`%s' (wget(1) exit status: %s)"; -MSG_rtl_fetch_fail_retryurl="Warning: failed to fetch URL \`%s', retrying with alternative URL... (wget(1) exit status: %s)"; -MSG_rtl_fetch_hashfail1="Error: hash mismatch for URL \`%s' (should be: %s vs.: %s.)"; -MSG_rtl_fetch_hashfail2="Error: hash mismatch for URL \`%s' (should be: %s.)"; -MSG_rtl_fetch_hashfail_retryurl="Warning: hash mismatch for URL \`%s', retrying with alternative URL... (from build variables: %s.)"; -MSG_rtl_fetch_lockfail="Error: failed to acquire fetching lock for URL \`%s'."; -MSG_rtl_fetch_lockfail_retryurl="Warning: failed to acquire fetching lock for URL \`%s', retrying with alternative URL..."; -MSG_rtl_fetch_rm_redundant="Deleting redundant file \`%s' for package \`%s'."; +MSG_rtl_fetch_fail="2;Error: failed to fetch URL \`%s' (wget(1) exit status: %s)"; +MSG_rtl_fetch_fail_retryurl="2;Warning: failed to fetch URL \`%s', retrying with alternative URL... (wget(1) exit status: %s)"; +MSG_rtl_fetch_hashfail1="3;Error: hash mismatch for URL \`%s' (should be: %s vs.: %s.)"; +MSG_rtl_fetch_hashfail2="2;Error: hash mismatch for URL \`%s' (should be: %s.)"; +MSG_rtl_fetch_hashfail_retryurl="2;Warning: hash mismatch for URL \`%s', retrying with alternative URL... (from build variables: %s.)"; +MSG_rtl_fetch_lockfail="1;Error: failed to acquire fetching lock for URL \`%s'."; +MSG_rtl_fetch_lockfail_retryurl="1;Warning: failed to acquire fetching lock for URL \`%s', retrying with alternative URL..."; +MSG_rtl_fetch_rm_redundant="2;Deleting redundant file \`%s' for package \`%s'."; -MSG_rtl_fileop_invalid_dir="Error: Invalid or non-existent directory \`%s'."; -MSG_rtl_fileop_invparm_chgrp="Error: Missing parameters (in: chgrp %s.)"; -MSG_rtl_fileop_invparm_chmod="Error: Missing parameters (in: chmod %s.)"; -MSG_rtl_fileop_invparm_chown="Error: Missing parameters (in: chown %s.)"; -MSG_rtl_fileop_invparm_cp="Error: Missing parameters (in: cp %s.)"; -MSG_rtl_fileop_invparm_cp_follow="Error: Missing parameters (in: cp_follow %s}.)"; -MSG_rtl_fileop_invparm="Error: Missing parameters (in: %s %s.)"; -MSG_rtl_fileop_invparm_fileop="Error: rtl_fileop() called w/ invalid parameter(s): %s"; -MSG_rtl_fileop_invparm_install="Error: Missing parameters (in: install %s.)"; -MSG_rtl_fileop_invparm_ln_symbolic="Error: Missing parameters (in: ln_symbolic %s.)"; -MSG_rtl_fileop_invparm_mv="Error: Missing parameters (in: mv %s.)"; -MSG_rtl_fileop_invparm_touch="Error: Missing parameters (in: touch %s.)"; +MSG_rtl_fileop_invalid_dir="1;Error: Invalid or non-existent directory \`%s'."; +MSG_rtl_fileop_invparm_chgrp="1;Error: Missing parameters (in: chgrp %s.)"; +MSG_rtl_fileop_invparm_chmod="1;Error: Missing parameters (in: chmod %s.)"; +MSG_rtl_fileop_invparm_chown="1;Error: Missing parameters (in: chown %s.)"; +MSG_rtl_fileop_invparm_cp="1;Error: Missing parameters (in: cp %s.)"; +MSG_rtl_fileop_invparm_cp_follow="1;Error: Missing parameters (in: cp_follow %s.)"; +MSG_rtl_fileop_invparm="2;Error: Missing parameters (in: %s %s.)"; +MSG_rtl_fileop_invparm_fileop="1;Error: rtl_fileop() called w/ invalid parameter(s): %s"; +MSG_rtl_fileop_invparm_install="1;Error: Missing parameters (in: install %s.)"; +MSG_rtl_fileop_invparm_ln_symbolic="1;Error: Missing parameters (in: ln_symbolic %s.)"; +MSG_rtl_fileop_invparm_mv="1;Error: Missing parameters (in: mv %s.)"; +MSG_rtl_fileop_invparm_touch="1;Error: Missing parameters (in: touch %s.)"; -MSG_rtl_install_v2_rc="%s"; +MSG_rtl_install_v2_rc="1;%s"; -MSG_rtl_log_vars_header="Variables for this %s:"; -MSG_rtl_log_unknown_tag="==> FIXME TODO XXX UNKNOWN TAG \`%s' PASSED TO rtl_log_msg()\n"; +MSG_rtl_log_vars_header="1;Variables for this %s:"; +MSG_rtl_log_unknown_tag="1;==> FIXME TODO XXX UNKNOWN TAG \`%s' PASSED TO rtl_log_msg()\n"; -MSG_rtl_platform_rc1="Command line: %s %s"; -MSG_rtl_platform_rc2="Command line: %s"; +MSG_rtl_platform_rc1="2;Command line: %s %s"; +MSG_rtl_platform_rc2="1;Command line: %s"; # vim:foldmethod=marker ft=sh diff --git a/pkgtool.sh b/pkgtool.sh index 76faf5f..276ab7b 100755 --- a/pkgtool.sh +++ b/pkgtool.sh @@ -293,9 +293,9 @@ pkgtool() { esac; _rc="${?}"; fi; if [ "${_rc}" -ne 0 ]; then - rtl_log_msg "fatalexit" "${_status}"; + rtl_log_msg "fatalexit" "0;${_status}"; elif [ -n "${_status}" ]; then - rtl_log_msg "info" "${_status}"; + rtl_log_msg "info" "0;${_status}"; fi; }; diff --git a/subr.rtl/rtl_fetch.subr b/subr.rtl/rtl_fetch.subr index 461893b..5f55732 100644 --- a/subr.rtl/rtl_fetch.subr +++ b/subr.rtl/rtl_fetch.subr @@ -37,31 +37,26 @@ rtl_fetch_url_wget() { case "${_rc}" in 0) break; ;; 1) if [ "${_urls_count}" -ge 1 ]; then - rtl_log_msg "warning" "Warning: failed to acquire fetching lock for URL \`%s', retrying with alternative URL..." "${_url}"; + rtl_log_msg "warning" "${MSG_rtl_fetch_lockfail_retryurl}" "${_url}"; else - rtl_log_msg "fatal" "Error: failed to acquire fetching lock for URL \`%s'." "${_url}"; + rtl_log_msg "fatal" "${MSG_rtl_fetch_lockfail}" "${_url}"; rtl_fileop rm "${_target_fname_full}"; break; fi; ;; 2) if [ "${_urls_count}" -ge 1 ]; then - rtl_log_msg "warning" "Warning: hash mismatch for URL \`%s', retrying with alternative URL... (from build variables: %s.)"\ - "${_url}" "${_sha256sum_src}"; + rtl_log_msg "warning" "${MSG_rtl_fetch_hashfail_retryurl}" "${_url}" "${_sha256sum_src}"; else if _sha256sum_target="$(sha256sum "${_target_fname_full}" |\ awk '{print $1}' 2>/dev/null)"; then - rtl_log_msg "fatal" "Error: hash mismatch for URL \`%s' (should be: %s vs.: %s.)"\ - "${_url}" "${_sha256sum_src}" "${_sha256sum_target}"; + rtl_log_msg "fatal" "${MSG_rtl_fetch_hashfail1}" "${_url}" "${_sha256sum_src}" "${_sha256sum_target}"; else - rtl_log_msg "fatal" "Error: hash mismatch for URL \`%s' (should be: %s.)"\ - "${_url}" "${_sha256sum_src}"; + rtl_log_msg "fatal" "${MSG_rtl_fetch_hashfail2}" "${_url}" "${_sha256sum_src}"; fi; rtl_fileop rm "${_target_fname_full}"; break; fi; ;; *) if [ "${_urls_count}" -ge 1 ]; then - rtl_log_msg "warning" "Warning: failed to fetch URL \`%s', retrying with alternative URL... (wget(1) exit status: %s)"\ - "${_url}" "$((${_rc}-2))"; + rtl_log_msg "warning" "${MSG_rtl_fetch_fail_retryurl}" "${_url}" "$((${_rc}-2))"; else - rtl_log_msg "fatal" "Error: failed to fetch URL \`%s' (wget(1) exit status: %s)"\ - "${_url}" "$((${_rc}-2))"; + rtl_log_msg "fatal" "${MSG_rtl_fetch_fail}" "${_url}" "$((${_rc}-2))"; rtl_fileop rm "${_target_fname_full}"; break; fi; ;; esac; diff --git a/subr.rtl/rtl_fileop.subr b/subr.rtl/rtl_fileop.subr index 4addffc..6d258f5 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}"; }; diff --git a/subr.rtl/rtl_install_v2.subr b/subr.rtl/rtl_install_v2.subr index 210ade9..6366376 100644 --- a/subr.rtl/rtl_install_v2.subr +++ b/subr.rtl/rtl_install_v2.subr @@ -261,7 +261,7 @@ rtlp_install_rc() { if [ "${_rir_nflag}" -eq 1 ]\ || [ "${_rir_vflag}" -gt 0 ]; then - rtl_log_msg "install" "%s" "${_rir_fn}${_rir_fn:+ ${*}}"; + rtl_log_msg "install" "${MSG_rtl_install_v2_rc}" "${_rir_fn}${_rir_fn:+ ${*}}"; fi; if [ "${_rir_nflag}" -eq 0 ]; then "${_rir_fn}" "${@}"; _rir_rc="${?}"; diff --git a/subr.rtl/rtl_log.subr b/subr.rtl/rtl_log.subr index 0a1e275..3a7560a 100644 --- a/subr.rtl/rtl_log.subr +++ b/subr.rtl/rtl_log.subr @@ -11,7 +11,15 @@ RTLP_LOG_NO_ATTR=0; RTLP_LOG_TAGS=""; rtlp_log_printf() { - local _attr="${1}" _fmt="${2}"; shift 2; _msg="$(printf "${_fmt}" "${@}")"; + local _attr="${1}" _fmt_pfx="${2}" _fmt="${3#*;}" _fmt_argc="${3%%;*}"; shift 3; + if [ "${#}" -ne "${_fmt_argc}" ]; then + if [ "${_fmt_argc}" -eq 0 ]; then + shift "${#}"; + else + rtlp_log_printf "" "" "0;==> FIXME TODO XXX MESSAGE STRING ARGUMENT COUNT MISMATCH\n"; + fi; + fi; + _msg="$(printf "${_fmt_pfx}${_fmt}" "${@}")"; if [ -n "${RTLP_LOG_FNAME}" ]; then printf "%s\n" "${_msg}" >> "${RTLP_LOG_FNAME}"; @@ -43,11 +51,11 @@ rtl_log_enable_tags() { rtl_log_env_vars() { local _tag="${1}" _type="${2}" _arg_len_max=0; shift 2; - rtl_log_msg "${_tag}" "Variables for this ${_type}:"; + rtl_log_msg "${_tag}" "${MSG_rtl_log_vars_header}" "${_type}"; _arg_len_max="$(rtl_lmax "${@}")"; while [ "${#}" -gt 0 ]; do - rtl_log_msg "${_tag}" \ - "%${_arg_len_max}.${_arg_len_max}s=%s" \ + rtl_log_msg "${_tag}" \ + "2;%${_arg_len_max}.${_arg_len_max}s=%s" \ "${1%%=*}" "$(rtl_get_var_unsafe "${1#*=}")"; shift; done; return 0; @@ -60,9 +68,9 @@ rtl_log_msg() { if rtl_lmatch "${RTLP_LOG_TAGS}" "${_tag}" ","; then eval _attr='${LOG_TAG_'"${_tag}"':-}'; if [ "${#_attr}" -eq 0 ]; then - rtlp_log_printf "" "==> FIXME TODO XXX UNKNOWN TAG \`%s' PASSED TO rtl_log_msg()\n" "${_tag}"; + rtlp_log_printf "" "" "0;==> FIXME TODO XXX UNKNOWN TAG \`${_tag}' PASSED TO rtl_log_msg()\n"; fi; - rtlp_log_printf "${_attr}" "==> %s ${_fmt}" "$(rtl_date)" "${@}"; + rtlp_log_printf "${_attr}" "==> $(rtl_date) " "${_fmt}" "${@}"; if [ "${_exitfl}" -eq 1 ]; then exit 1; fi; diff --git a/subr.rtl/rtl_platform.subr b/subr.rtl/rtl_platform.subr index af3365e..dd50852 100644 --- a/subr.rtl/rtl_platform.subr +++ b/subr.rtl/rtl_platform.subr @@ -86,9 +86,9 @@ rtl_rc() { local _nflag="${1}" _cmd="${2}"; shift 2; case "${_nflag}" in 1) if [ "${#}" -gt 0 ]; then - rtl_log_msg "verbose" "Command line: %s %s" "${_cmd}" "${*}"; + rtl_log_msg "verbose" "${MSG_rtl_platform_rc1}" "${_cmd}" "${*}"; else - rtl_log_msg "verbose" "Command line: %s" "${_cmd}"; + rtl_log_msg "verbose" "${MSG_rtl_platform_rc2}" "${_cmd}"; fi; ;; *) "${_cmd}" "${@}"; esac;