]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Portability: use printf(1) instead of echo -n (#1676)
authorFrancesco Chemolli <5175948+kinkie@users.noreply.github.com>
Wed, 28 Feb 2024 03:37:39 +0000 (03:37 +0000)
committerSquid Anubis <squid-anubis@squid-cache.org>
Wed, 28 Feb 2024 09:55:33 +0000 (09:55 +0000)
MacOS' implementation of echo(1) does not support the -n flag.

errors/Makefile.am
scripts/source-maintenance.sh
scripts/spell-check.sh
scripts/update-pot.sh
test-suite/buildtest.sh

index 843104c74105d1d14f91347245ee017d5a795ba5..30cdb2f179d67aea6fda5daafedfcdf9188e69da 100644 (file)
@@ -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 $@
 
index 2fdbfd66626cb19b771dba9192695b540ff3b5cc..68946e0d7f054ecc9111f8faf73e40d626e9390b 100755 (executable)
@@ -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 ()
index 931f173e07330ccc5261dffce006f3074171d93a..051bfe95f502a7ef254d648cfa1ce078c030d909 100755 (executable)
@@ -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
index a723260473e0b897550fa552c168a8410e0c4258..88fa16c7174525638bc5dcb1992b57b7a18638c0 100755 (executable)
@@ -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}
index 01291065e813f28a9449110dd237a876c44fd560..089cbc7829cf256cc965695d5ad9a49e06c0d256 100755 (executable)
@@ -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