From: Lady <redacted>
Date: Fri, 3 May 2024 03:19:01 +0000 (-0400)
Subject: Remove dependency on echo
X-Git-Tag: 0.8.2~1
X-Git-Url: https://git.ladys.computer/Shushe/commitdiff_plain/868d7faa784990b0ec70975e6b1d736d2c2ab8c0?ds=inline

Remove dependency on echo

`printf` is always preferable to `echo` for portability reasons.
---

diff --git a/GNUmakefile b/GNUmakefile
index 0b0cd80..783d0d9 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -22,7 +22,6 @@ override define makefileinfo
 ║│ • cksum                                                    │║
 ║│ • cp                                                       │║
 ║│ • date                                                     │║
-║│ • echo                                                     │║
 ║│ • file                                                     │║
 ║│ • find                                                     │║
 ║│ • grep                                                     │║
@@ -104,7 +103,6 @@ CAT := cat
 CKSUM := cksum
 CP := cp
 DATE := date
-ECHO := echo
 FILE := file
 FIND := find
 GIT := git
@@ -576,18 +574,18 @@ $(call magicfile,$(MAGIC)) : $(BUILDDIR)/magic/% : $$(call magicsource,$$@)
 # It must be updated if any of the files in the magic directory change.
 $(BUILDDIR)/magic.mgc : $(call diffprereqs,magic,$(sort $(call magicfile,$(MAGIC))))
 	$(foreach outdated,$(filter-out $^,$(wildcard $(BUILDDIR)/magic/*)),$(silent)$(RM) $(call quote,$(outdated))$(newline))
-	@$(ECHO) "Compiling new magic…"
+	@$(PRINTF) '%s\n' 'Compiling new magic…'
 	$(silent)$(call ensuredirectory,$(dir $@))
 	$(silent)cd $(call quote,$(BUILDDIR)) && $(FILE) -C -m $(call quote,$(realpath $(BUILDDIR)/magic))
 	$(silent)$(TOUCH) $(call quote,$(BUILDDIR)/.update-types)
 
 # Generate the main parser.
 $(BUILDDIR)/parser.catalog : $(call diffprereqs,parsers,$(sort $(PARSERS)))
-	@$(ECHO) "Generating catalog of parsers…"
+	@$(PRINTF) '%s\n' 'Generating catalog of parsers…'
 	$(silent)$(XMLCATALOG) --create --noout $(call quote,$@)
 	$(foreach parser,$(PARSERS),$(silent){ $(call id,$(parser)); printf '%s\n' $(call quote,$(call fileuri,$(parser))) '--noout' $(call quote,$@); } | $(xargsmultiquote) | $(XARGS) -E '' $(XMLCATALOG) --add uri$(newline))
 $(BUILDDIR)/parser.xslt : $(BUILDDIR)/parser.catalog $(THISDIR)/lib/catalog2parser.xslt
-	@$(ECHO) "Generating main parser…"
+	@$(PRINTF) '%s\n' 'Generating main parser…'
 	$(silent)$(XSLTPROC) --nonet --novalid -o $(call quote,$@) $(call quote,$(THISDIR)/lib/catalog2parser.xslt) $(call quote,$<)
 	$(silent)$(TOUCH) $(call quote,$(BUILDDIR)/.update-types)
 
@@ -604,13 +602,13 @@ $(call parsed,$(sourcefiles) $(sourceincludes)) : % : $$(call unparsed,$$@) $(BU
 #
 # This does not depend on actually transforming the files.
 $(BUILDDIR)/catalog : $(call diffprereqs,sources,$(sort $(sourcefiles) $(sourceincludes))) $(typeupdates)
-	@$(ECHO) "Generating catalog of parsed files…"
+	@$(PRINTF) '%s\n' 'Generating catalog of parsed files…'
 	$(silent)$(XMLCATALOG) --create --noout $(call quote,$@)
 	$(foreach source,$(sourcefiles) $(sourceincludes),$(silent)$(XMLCATALOG) --add uri $(call quote,$(call localuri,$(source))) $(call quote,$(call fileuri,$(call parsed,$(source)))#$(if $(filter $(source),$(assetfiles)),asset,xml)) --noout $(call quote,$@)$(newline))
 
 # Build a list of dependencies for each parsed file.
 $(BUILDDIR)/dependencies : $(BUILDDIR)/catalog $(call parsed,$(plaintextfiles) $(xmlfiles)) $(THISDIR)/lib/catalog2dependencies.xslt
-	@$(ECHO) "Identifying dependencies…"
+	@$(PRINTF) '%s\n' 'Identifying dependencies…'
 	$(silent)$(TOUCH) $(call quote,$@)
 	$(silent)$(XSLTPROC) --nonet --novalid -o $(call quote,$@) $(call quote,$(THISDIR)/lib/catalog2dependencies.xslt) $(call quote,$<)
 
@@ -619,17 +617,17 @@ $(BUILDDIR)/dependencies : $(BUILDDIR)/catalog $(call parsed,$(plaintextfiles) $
 # This depends on parsing non·asset source files, but not assets or includes.
 # It does not require knowing the dependencies.
 $(BUILDDIR)/destinations : $(BUILDDIR)/catalog $(call parsed,$(filter-out $(assetfiles),$(sourcefiles))) $(THISDIR)/lib/catalog2destinations.xslt
-	@$(ECHO) "Identifying output destinations…"
+	@$(PRINTF) '%s\n' 'Identifying output destinations…'
 	$(silent)$(TOUCH) $(call quote,$@)
 	$(silent)$(XSLTPROC) --nonet --novalid -o $(call quote,$@) $(call quote,$(THISDIR)/lib/catalog2destinations.xslt) $(call quote,$<)
 
 # Generate the main transform.
 $(BUILDDIR)/transform.catalog : $(call diffprereqs,transforms,$(sort $(TRANSFORMS)))
-	@$(ECHO) "Generating catalog of transforms…"
+	@$(PRINTF) '%s\n' 'Generating catalog of transforms…'
 	$(silent)$(XMLCATALOG) --create --noout $(call quote,$@)
 	$(foreach transform,$(TRANSFORMS),$(silent){ $(call id,$(transform)); printf '%s\n' $(call quote,$(call fileuri,$(transform))) '--noout' $(call quote,$@); } | $(xargsmultiquote) | $(XARGS) -E '' $(XMLCATALOG) --add uri$(newline))
 $(BUILDDIR)/transform.xslt : $(BUILDDIR)/transform.catalog $(THISDIR)/lib/catalog2transform.xslt
-	@$(ECHO) "Generating main transform…"
+	@$(PRINTF) '%s\n' 'Generating main transform…'
 	$(silent)$(XSLTPROC) --nonet --novalid -o $(call quote,$@) $(call quote,$(THISDIR)/lib/catalog2transform.xslt) $(call quote,$<)
 
 # Compile the result files using the dependencies as necessary.
diff --git a/README.markdown b/README.markdown
index 6616df7..d459604 100644
--- a/README.markdown
+++ b/README.markdown
@@ -198,7 +198,6 @@ In every case, you may supply your own implementation by overriding the
 - `cksum`
 - `cp`
 - `date`
-- `echo`
 - `file`
 - `find`
 - `git` (optional; set `GIT=` to disable)