diff --git a/src/parallel b/src/parallel index d69e0461..df6dc7d1 100755 --- a/src/parallel +++ b/src/parallel @@ -860,8 +860,8 @@ sub parse_options { if(defined $opt::X) { $Global::ContextReplace = 1; } if(defined $opt::silent) { $Global::verbose = 0; } if(defined $opt::0) { $/ = "\0"; } - if(defined $opt::d) { my $e="sprintf qq{$opt::d}"; $/ = eval $e; } - if(defined $opt::tagstring) { my $e="sprintf qq{$opt::tagstring}"; $opt::tagstring = eval $e; } + if(defined $opt::d) { $/ = unquote_printf($opt::d) } + if(defined $opt::tagstring) { $opt::tagstring = unquote_printf($opt::tagstring); } if(defined $opt::p) { $Global::interactive = $opt::p; } if(defined $opt::q) { $Global::quoting = 1; } if(defined $opt::r) { $Global::ignore_empty = 1; } @@ -1567,6 +1567,17 @@ sub perl_quote_scalar { return $a; } +sub unquote_printf { + # Convert \t \n \r \0 \000 + $_ = shift; + s/\\t/\t/g; + s/\\n/\n/g; + s/\\r/\r/g; + s/\\(\d\d\d)/eval 'sprintf "\\'.$1.'"'/ge; + s/\\(\d)/eval 'sprintf "\\'.$1.'"'/ge; + return $_; +} + sub __FILEHANDLES__ {}