]> Lady’s Gitweb - Shushe/commitdiff
Don’t double‐newline specials in perdec
authorLady <redacted>
Tue, 16 Jan 2024 05:58:45 +0000 (00:58 -0500)
committerLady <redacted>
Thu, 18 Jan 2024 02:37:30 +0000 (21:37 -0500)
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.)

GNUmakefile

index 937ada5b8659df0318864f8a97956b510401a27a..76cebd43ff85585861f06689867ad9950519e5f5 100644 (file)
@@ -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.
 #
This page took 0.055302 seconds and 4 git commands to generate.