From f97cfec567d54e883e1b868714b6beee5420ba2d Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 17 Aug 2016 01:33:02 -0400 Subject: (systemd) more --- build-aux/Makefile.once.head/00-quote.mk | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 build-aux/Makefile.once.head/00-quote.mk (limited to 'build-aux/Makefile.once.head/00-quote.mk') diff --git a/build-aux/Makefile.once.head/00-quote.mk b/build-aux/Makefile.once.head/00-quote.mk new file mode 100644 index 0000000..23be614 --- /dev/null +++ b/build-aux/Makefile.once.head/00-quote.mk @@ -0,0 +1,23 @@ +# Copyright (C) 2016 Luke Shumaker +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . + +mod.quote.description = Macros to quote tricky strings + +quote.pattern = $(subst %,\%,$(subst \,\\,$1)) +quote.shell-each = $(foreach _quote.tmp,$1,$(call quote.shell,$(_mod.tmp))) + +# I put this as the last line in the file because it confuses Emacs syntax +# highlighting and makes the remainder of the file difficult to edit. +quote.shell = $(subst $(at.nl),'$$'\n'','$(subst ','\'',$1)') -- cgit v1.2.2 From 2728d489673f1d97a43e4f8d888b3591c233cfb7 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Tue, 6 Sep 2016 14:42:55 -0400 Subject: (systemd) build-aux: gitfiles --- build-aux/Makefile.once.head/00-quote.mk | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'build-aux/Makefile.once.head/00-quote.mk') diff --git a/build-aux/Makefile.once.head/00-quote.mk b/build-aux/Makefile.once.head/00-quote.mk index 23be614..17f6307 100644 --- a/build-aux/Makefile.once.head/00-quote.mk +++ b/build-aux/Makefile.once.head/00-quote.mk @@ -15,7 +15,13 @@ mod.quote.description = Macros to quote tricky strings -quote.pattern = $(subst %,\%,$(subst \,\\,$1)) +_quote.backslash = $(if $1,$(call _quote.backslash,$(wordlist 2,$(words $1),$1),$(subst $(firstword $1),\$(firstword $1),$2)),$2) + +quote.var = $(subst $(at.nl),\$(at.nl),$(subst $$,$$$$,$1)) +quote.pattern = $(call _quote.backslash, \ % ,$1) +quote.ere = $(call _quote.backslash, \ ^ . [ $$ ( ) | * + ? { ,$1) +quote.bre = $(call _quote.backslash, \ ^ . [ $$ * ,$1) + quote.shell-each = $(foreach _quote.tmp,$1,$(call quote.shell,$(_mod.tmp))) # I put this as the last line in the file because it confuses Emacs syntax -- cgit v1.2.2 From 8cf92796b94f8a7d1e4b27fbf86b3c790194cb6f Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Tue, 6 Sep 2016 16:06:45 -0400 Subject: (systemd) build-aux: quote.shell-each: fix --- build-aux/Makefile.once.head/00-quote.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'build-aux/Makefile.once.head/00-quote.mk') diff --git a/build-aux/Makefile.once.head/00-quote.mk b/build-aux/Makefile.once.head/00-quote.mk index 17f6307..9fce401 100644 --- a/build-aux/Makefile.once.head/00-quote.mk +++ b/build-aux/Makefile.once.head/00-quote.mk @@ -22,7 +22,7 @@ quote.pattern = $(call _quote.backslash, \ % ,$1) quote.ere = $(call _quote.backslash, \ ^ . [ $$ ( ) | * + ? { ,$1) quote.bre = $(call _quote.backslash, \ ^ . [ $$ * ,$1) -quote.shell-each = $(foreach _quote.tmp,$1,$(call quote.shell,$(_mod.tmp))) +quote.shell-each = $(foreach _quote.tmp,$1,$(call quote.shell,$(_quote.tmp))) # I put this as the last line in the file because it confuses Emacs syntax # highlighting and makes the remainder of the file difficult to edit. -- cgit v1.2.2 From 95d18493a5d3399993053b94cb1fc4542699f884 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Fri, 28 Oct 2016 12:45:33 -0400 Subject: (systemd) Autothing documentation --- build-aux/Makefile.once.head/00-quote.mk | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'build-aux/Makefile.once.head/00-quote.mk') diff --git a/build-aux/Makefile.once.head/00-quote.mk b/build-aux/Makefile.once.head/00-quote.mk index 9fce401..4c954b1 100644 --- a/build-aux/Makefile.once.head/00-quote.mk +++ b/build-aux/Makefile.once.head/00-quote.mk @@ -14,6 +14,24 @@ # along with this program. If not, see . mod.quote.description = Macros to quote tricky strings +define mod.quote.doc +# Inputs: +# (none) +# Outputs: +# - Global variable: `quote.var` : GNU Make variables +# - Global variable: `quote.pattern` : GNU Make patterns +# - Global variable: `quote.ere` : POSIX Extended Regular Expressions +# - Global variable: `quote.bre` : POSIX Basic Regular Expressions +# - Global variable: `quote.shell` : POSIX sh(1) strings +# - Global variable: `quote.shell-each`: POSIX sh(1) strings +# +# Escaping/quoting things is hard! This module provides a number of +# functions to escape/quote strings for various contexts. +# +# `quote.shell-each` quotes each list-item separately (munging +# whitespace), while `quote.shell` keeps them as one string (preserving +# whitespace). +endef _quote.backslash = $(if $1,$(call _quote.backslash,$(wordlist 2,$(words $1),$1),$(subst $(firstword $1),\$(firstword $1),$2)),$2) @@ -24,6 +42,7 @@ quote.bre = $(call _quote.backslash, \ ^ . [ $$ * ,$1) quote.shell-each = $(foreach _quote.tmp,$1,$(call quote.shell,$(_quote.tmp))) -# I put this as the last line in the file because it confuses Emacs syntax -# highlighting and makes the remainder of the file difficult to edit. +# I put this as the last line in the file because it confuses Emacs +# syntax highlighting and makes the remainder of the file difficult to +# edit. quote.shell = $(subst $(at.nl),'$$'\n'','$(subst ','\'',$1)') -- cgit v1.2.2 From 9384e763b00774603208b3d44977ed0e6762a09a Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 30 Oct 2016 19:27:23 -0400 Subject: (systemd) at: mod: don't call on .doc --- build-aux/Makefile.once.head/00-quote.mk | 1 + 1 file changed, 1 insertion(+) (limited to 'build-aux/Makefile.once.head/00-quote.mk') diff --git a/build-aux/Makefile.once.head/00-quote.mk b/build-aux/Makefile.once.head/00-quote.mk index 4c954b1..94bc943 100644 --- a/build-aux/Makefile.once.head/00-quote.mk +++ b/build-aux/Makefile.once.head/00-quote.mk @@ -32,6 +32,7 @@ define mod.quote.doc # whitespace), while `quote.shell` keeps them as one string (preserving # whitespace). endef +mod.quote.doc := $(value mod.quote.doc) _quote.backslash = $(if $1,$(call _quote.backslash,$(wordlist 2,$(words $1),$1),$(subst $(firstword $1),\$(firstword $1),$2)),$2) -- cgit v1.2.2