my $prog = shift;
$prog =~ s/'/\\'/g;
$out .= tab . "eval {$prog}";
+ $print_needed = 0;
} elsif ($_ eq 'depth') {
$find = 'finddepth';
next;
}
if ($print_needed) {
- $out .= "\n" . tab . '&& print("$name\n")';
+ my $t = tab;
+ if ($t !~ /&&\s*$/) { $t .= '&& ' }
+ $out .= "\n" . $t . 'print("$name\n")';
}
END
+if (exists $init{doexec}) {
+ print <<'END';
+use Cwd ();
+my $cwd = Cwd::cwd();
+
+END
+}
+
if (exists $init{ls}) {
print <<'END';
my @rwx = qw(--- --x -w- -wx r-- r-x rw- rwx);
if (exists $init{doexec}) {
print <<'END';
-use Cwd ();
-my $cwd = Cwd::cwd();
-
sub doexec ($@) {
my $ok = shift;
my @command = @_; # copy so we don't try to s/// aliases to constants