diff options
author | Lucía Andrea Illanes Albornoz <lucia@luciaillanes.de> | 2023-03-13 14:18:14 +0100 |
---|---|---|
committer | Lucía Andrea Illanes Albornoz <lucia@luciaillanes.de> | 2023-03-13 14:18:14 +0100 |
commit | 1380599ef36e89818d74a5e8ee8edd75846a4b7c (patch) | |
tree | b6493f80d2c4784b55ab5bad8c57467b872b98a5 /subr.rtl | |
parent | e94dc6d0cadb6703baced36ed82709146e80285b (diff) | |
download | midipix_build-1380599ef36e89818d74a5e8ee8edd75846a4b7c.tar.bz2 midipix_build-1380599ef36e89818d74a5e8ee8edd75846a4b7c.tar.xz |
Followup to <fd38dc025f5d31890abbf3d48c597114203b1421>.
Diffstat (limited to 'subr.rtl')
-rw-r--r-- | subr.rtl/rtl_filepath.subr | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/subr.rtl/rtl_filepath.subr b/subr.rtl/rtl_filepath.subr index 7588b7ef..7d4ec553 100644 --- a/subr.rtl/rtl_filepath.subr +++ b/subr.rtl/rtl_filepath.subr @@ -141,4 +141,29 @@ rtl_is_newer() { fi; }; +rtl_patch_files() { + local _rpf_patch_cwd="${1}" _rpf_strip_count="${2}" _rpf_fn="${3}" \ + _rpf_patch_fname="" _rpf_patch_idx=0; + shift $((3 + 2)); + + _rpf_patch_idx=1; + while "${_rpf_fn}" \ + \$_rpf_patch_fname "${_rpf_patch_idx}" \ + "${@}" \ + && [ "${_rpf_patch_fname:+1}" = 1 ]; + do + : $((_rpf_patch_idx += 1)); + if [ -r "${_rpf_patch_fname}" ]\ + && ! patch \ + -b \ + -d "${_rpf_patch_cwd}" \ + "-p${_rpf_strip_count}" \ + < "${_rpf_patch_fname}"; + then + return 1; + fi; + done; + return 0; +}; + # vim:filetype=sh textwidth=0 |