From: Francesco Chemolli <5175948+kinkie@users.noreply.github.com> Date: Wed, 28 Feb 2024 03:37:39 +0000 (+0000) Subject: Portability: use printf(1) instead of echo -n (#1676) X-Git-Tag: SQUID_7_0_1~193 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=973231256684e29207d1aed109b88750604479f7;p=thirdparty%2Fsquid.git Portability: use printf(1) instead of echo -n (#1676) MacOS' implementation of echo(1) does not support the -n flag. --- diff --git a/errors/Makefile.am b/errors/Makefile.am index 843104c741..30cdb2f179 100644 --- a/errors/Makefile.am +++ b/errors/Makefile.am @@ -56,16 +56,19 @@ $(TRANSLATE_LANGUAGES): $(ERROR_TEMPLATES) NOTIDY=`$(PO2HTML) --help | grep -o "[-]-notidy"` .po.lang: - if test "$(PO2HTML)" != "" && test "$(PO2HTML)" != "no" && test "$(PO2HTML)" != "off" && test -f $(top_srcdir)/errors/en.po; then \ - lang=`basename $@ .lang`; \ + @if test "$(PO2HTML)" != "" && test "$(PO2HTML)" != "no" && test "$(PO2HTML)" != "off" && test -f $(top_srcdir)/errors/en.po; then \ + lang=$(@:.lang=); \ mkdir -p $(top_builddir)/errors/$$lang; \ - echo -n "Translate '$$lang' ..."; \ + echo "Translating $$lang ..."; \ for f in $(ERROR_TEMPLATES); do \ page=`basename $$f`; \ $(PO2HTML) $(NOTIDY) --progress=none -i $(top_srcdir)/errors/$$lang.po -t $(top_srcdir)/errors/$$f >$(top_builddir)/errors/$$lang/$$page || exit 1; \ done; \ cp $(top_srcdir)/errors/templates/error-details.txt $(top_builddir)/errors/$$lang/error-details.txt || exit 1; \ - echo "done."; \ + echo "Done translating $$lang"; \ + else \ + lang=$(@:.lang=); \ + echo "Translation of $$lang disabled\n"; \ fi; \ touch $@ diff --git a/scripts/source-maintenance.sh b/scripts/source-maintenance.sh index 2fdbfd6662..68946e0d7f 100755 --- a/scripts/source-maintenance.sh +++ b/scripts/source-maintenance.sh @@ -616,14 +616,13 @@ printRawAmFile () echo "## $GeneratedByMe" echo - echo -n "$1 =" + printf "%s =" "$1" # Only some files are formed from *.po filenames, but all such files # should list *.lang filenames instead. git ls-files $2$3 | sed -e s%$2%%g -e 's%\.po%\.lang%g' | while read f; do - echo " \\" - echo -n " ${f}" + printf ' \\\n\t%s' "${f}" done - echo "" + printf '\n' } generateAmFile () diff --git a/scripts/spell-check.sh b/scripts/spell-check.sh index 931f173e07..051bfe95f5 100755 --- a/scripts/spell-check.sh +++ b/scripts/spell-check.sh @@ -21,7 +21,7 @@ set -e -echo -n "Codespell version: " +printf "Codespell version: " if ! codespell --version; then echo "This script requires codespell which was not found." exit 1 diff --git a/scripts/update-pot.sh b/scripts/update-pot.sh index a723260473..88fa16c717 100755 --- a/scripts/update-pot.sh +++ b/scripts/update-pot.sh @@ -49,7 +49,7 @@ msgcat ./pot/*.pot -s -o errpages.pot.new && ## Update all existing dictionaries with the new content ... for f in `ls -1 ./*.po` ; do - echo -n "Update: ${f} ... " + printf "Update: %s ... " "${f}" msgmerge --verbose -s -o ${f}.new ${f} errpages.pot chown --reference=${f} ${f}.new mv ${f}.new ${f} diff --git a/test-suite/buildtest.sh b/test-suite/buildtest.sh index 01291065e8..089cbc7829 100755 --- a/test-suite/buildtest.sh +++ b/test-suite/buildtest.sh @@ -40,7 +40,7 @@ if test -e ${config} ; then echo "BUILD: ${config}" . ${config} else - echo -n "BUILD ERROR: Unable to locate test configuration '${config}' from " && pwd + printf "BUILD ERROR: Unable to locate test configuration '%s' from " "${config}" && pwd exit 1; fi