X-Git-Url: http://dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=cmd%2Fsave.pl;h=0b97a662297d5b7fbad7fc589815ce1ae630542a;hb=8e14149148baba63ce5ae2b95aacda8ab6dd0d87;hp=9d49244564954f5bbc89d199c3f25fe381fbd2ff;hpb=6ccf38d2c9db51eddfc0617f03b25b527b241001;p=spider.git diff --git a/cmd/save.pl b/cmd/save.pl index 9d492445..0b97a662 100644 --- a/cmd/save.pl +++ b/cmd/save.pl @@ -1,13 +1,15 @@ # # save the output of ANY command to a file # +# From an idea by Rene OZ1LQH +# # Copyright (c) 2002 Dirk Koopman G1TLH # -# $Id$ +# # my ($self, $line) = @_; -return (1, $self->msg('e5')) if $self->priv < 9 || $self->remotecmd; +return (1, $self->msg('e5')) if $self->priv < 9 || $self->remotecmd || $self->inscript; my ($date_req, $time_req); my $app_req = '>'; @@ -24,10 +26,12 @@ if ($line =~ /-a/) { # append to the file $app_req = '>>'; } +#$DB::single = 1; + my ($fn, $rest) = split /\s+/, $line, 2; $fn = "$main::root/packclus/$fn" unless $fn =~ m|^/|; -$fn =~ s/..//g; -$fn =~ m|/+|/|g; +$fn =~ s/\.\.//g; +$fn =~ s|/+|/|g; $fn .= '_' . cldate if $date_req; $fn .= '_' . ztime if $time_req; $fn =~ s/\s+//g; @@ -40,7 +44,9 @@ if ($rest =~ /^\s*\"/) { } open OF, "$app_req$fn" or return (1, $self->msg('e30', $fn)); for (@cmd) { + ++$self->{_nospawn}; print OF map {"$_\n"} $self->run_cmd($_); + $self->{_nospawn} = 0 if exists $self->{_nospawn} && --$self->{_nospawn} <= 0; } close OF; return (1, $self->msg('ok'));