summaryrefslogtreecommitdiff
path: root/Debian
diff options
context:
space:
mode:
authorIan Jackson <ijackson@chiark.greenend.org.uk>2015-07-26 15:19:20 +0100
committerIan Jackson <ijackson@chiark.greenend.org.uk>2015-07-26 15:19:24 +0100
commitc04a69e8d6a4eeef6ee161a2fb39be3b4d7279d8 (patch)
tree9dfb771dd47605c352e836e4759048c27d384d29 /Debian
parent0717f9a00045e66531a1607e60fa470119624060 (diff)
Dgit.pm: Provide messagequote
Diffstat (limited to 'Debian')
-rw-r--r--Debian/Dgit.pm12
1 files changed, 11 insertions, 1 deletions
diff --git a/Debian/Dgit.pm b/Debian/Dgit.pm
index d66b712..9216dee 100644
--- a/Debian/Dgit.pm
+++ b/Debian/Dgit.pm
@@ -26,7 +26,7 @@ BEGIN {
initdebug enabledebug enabledebuglevel
printdebug debugcmd
$debugprefix *debuglevel *DEBUG
- shellquote printcmd);
+ shellquote printcmd messagequote);
# implicitly uses $main::us
%EXPORT_TAGS = ( policyflags => [qw(NOFFCHECK FRESHREPO)] );
@EXPORT_OK = @{ $EXPORT_TAGS{policyflags} };
@@ -81,6 +81,16 @@ sub printdebug {
print DEBUG $debugprefix, @_ or die $! if $debuglevel>0;
}
+sub messagequote ($) {
+ local ($_) = @_;
+ s{\\}{\\\\}g;
+ s{\n}{\\n}g;
+ s{\x08}{\\b}g;
+ s{\t}{\\t}g;
+ s{[\000-\037\177]}{ sprintf "\\x%02x", ord $& }ge;
+ $_;
+}
+
sub shellquote {
my @out;
local $_;