diff options
Diffstat (limited to 'foomatic-gswrapper.in')
-rwxr-xr-x | foomatic-gswrapper.in | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/foomatic-gswrapper.in b/foomatic-gswrapper.in index f02bb52..1973013 100755 --- a/foomatic-gswrapper.in +++ b/foomatic-gswrapper.in @@ -1,6 +1,6 @@ #!@PERL@ # -*- perl -*- -# $Revision: 3.4.2.3 $ +# $Revision: 3.4.2.5 $ # This is a little Ghostscript regularization script. It massages # arguments to make Ghostscript execute properly as a filter, with @@ -43,7 +43,12 @@ grep (((m!^\-$!) || (m!^\-_$!)) my @myargs = grep (! m!^\-q$!, @ARGV); # Escape any quotes, and then quote everything just to be sure... -grep (s!\'!\\\'!g, @myargs); + +# Escaping a single quote inside single quotes is a bit complex as the shell +# takes everything literal there. So we have to assemble it by concatinating +# different quoted strings. +# Finally we get e.g.: 'x'"'"'y' or ''"'"'xy' or 'xy'"'"'' or ... +grep (s/\'/\'\"\'\"\'/g, @myargs); my $args = "'" . join("' '", @myargs) . "'"; # Execute Ghostscript, with both job and gs errors on stderr, and job @@ -64,7 +69,7 @@ sub readConfFile { if (open CONF, "< $file") { while (<CONF>) { - $conf{$1}="$2" if (m/^\s*([^\#\s]\S*)\s*:\s*(.*)\s*$/); + $conf{$1}="$2" if (m/^\s*([^\#\s]\S*)\s*:\s*(.*?)\s*$/); } close CONF; } |