summaryrefslogtreecommitdiff
path: root/utils/hp2ps
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2016-07-17 00:14:04 +0200
committerBen Gamari <ben@smart-cactus.org>2016-07-17 00:14:05 +0200
commit5df92f6776b31b375a80865e7db1f330d929c18f (patch)
treecbccc27f4cd90e98de3cf790bcd5b78afb88b83b /utils/hp2ps
parent89a8be71a3715c948cebcb19ac81f84da0e6270e (diff)
downloadhaskell-5df92f6776b31b375a80865e7db1f330d929c18f.tar.gz
hp2ps: fix invalid PostScript for names with parentheses
The names in the .hp files may contain un-matched opening parentheses, so escape them. GHC Trac: #9517 Reviewers: bgamari, austin Reviewed By: bgamari, austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2398 GHC Trac Issues: #9517
Diffstat (limited to 'utils/hp2ps')
-rw-r--r--utils/hp2ps/Key.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/utils/hp2ps/Key.c b/utils/hp2ps/Key.c
index 22ad106194..b7742cf563 100644
--- a/utils/hp2ps/Key.c
+++ b/utils/hp2ps/Key.c
@@ -44,7 +44,8 @@ escape(char *result, const char *name)
{
while (*name != '\0')
{
- if (*name == '\\')
+ // escape parentheses too, because "name" could contain un-matched ones
+ if (*name == '\\' || *name == '(' || *name == ')')
{
*result++ = '\\';
}