parallel: --tagstring '\007' re-fixed.

This commit is contained in:
Ole Tange 2015-03-04 00:54:23 +01:00
parent d65fa2a35d
commit 3c05c6815b

View file

@ -860,8 +860,8 @@ sub parse_options {
if(defined $opt::X) { $Global::ContextReplace = 1; } if(defined $opt::X) { $Global::ContextReplace = 1; }
if(defined $opt::silent) { $Global::verbose = 0; } if(defined $opt::silent) { $Global::verbose = 0; }
if(defined $opt::0) { $/ = "\0"; } if(defined $opt::0) { $/ = "\0"; }
if(defined $opt::d) { my $e="sprintf qq{$opt::d}"; $/ = eval $e; } if(defined $opt::d) { $/ = unquote_printf($opt::d) }
if(defined $opt::tagstring) { my $e="sprintf qq{$opt::tagstring}"; $opt::tagstring = eval $e; } if(defined $opt::tagstring) { $opt::tagstring = unquote_printf($opt::tagstring); }
if(defined $opt::p) { $Global::interactive = $opt::p; } if(defined $opt::p) { $Global::interactive = $opt::p; }
if(defined $opt::q) { $Global::quoting = 1; } if(defined $opt::q) { $Global::quoting = 1; }
if(defined $opt::r) { $Global::ignore_empty = 1; } if(defined $opt::r) { $Global::ignore_empty = 1; }
@ -1567,6 +1567,17 @@ sub perl_quote_scalar {
return $a; 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__ {} sub __FILEHANDLES__ {}