From: Lady Date: Tue, 16 Jan 2024 05:58:45 +0000 (-0500) Subject: Don’t double‐newline specials in perdec X-Git-Tag: 0.3.1~1 X-Git-Url: https://git.ladys.computer/Shushe/commitdiff_plain/0497d2be04ca445982491ebf77437779416ec7b2?ds=inline;hp=540047bcda4be5d3782bf16af78965da64f61149 Don’t double‐newline specials in perdec It’s not necessary to insert newlines (as pipes) before and after the `sed` substitutions for pipe and backslash, because these substitutions take place before the substitution for percent‐encoded characters (which adds its own newlines). (The extra newlines are harmless, they just mean `awk` gets a few more empty records to process.) --- diff --git a/GNUmakefile b/GNUmakefile index 937ada5..76cebd4 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -208,7 +208,7 @@ override silent := $(if $(VERBOSE),,@) override sedesc = $(subst /,[/],$(subst $$,\$$,$(subst *,\*,$(subst .,\.,$(subst [,\[,$(subst ^,\^,$(subst \,\\,$1))))))) # (callable) Percent‐decode the given strings. -override perdec = $(foreach encoded,$1,$(shell $(PRINTF) '%s\n' $(call quote,$(encoded)) | $(SED) 's/|/|%7C|/g;s/[\]/|%5C|/g;s/%[0-9A-Fa-f]\{2\}/|&|/g' | $(TR) '|' '\n' | $(SED) '/^%[0-9A-Fa-f]\{2\}$$/!s/%/|%25|/' | $(TR) '|' '\n' | $(AWK) '$$0!~/%/{printf("%s",$$0)}/%/{sub("%","0x");printf("\\%04o",$$0)}' | $(XARGS) -0 $(PRINTF) '%b')) +override perdec = $(foreach encoded,$1,$(shell $(PRINTF) '%s\n' $(call quote,$(encoded)) | $(SED) 's/|/%7C/g;s/[\]/%5C/g;s/%[0-9A-Fa-f]\{2\}/|&|/g' | $(TR) '|' '\n' | $(SED) '/^%[0-9A-Fa-f]\{2\}$$/!s/%/|%25|/' | $(TR) '|' '\n' | $(AWK) '$$0!~/%/{printf("%s",$$0)}/%/{sub("%","0x");printf("\\%04o",$$0)}' | $(XARGS) -0 $(PRINTF) '%b')) # (callable) Percent‐encode the given strings. #