2 # save the output of ANY command to a file
4 # From an idea by Rene OZ1LQH
6 # Copyright (c) 2002 Dirk Koopman G1TLH
11 my ($self, $line) = @_;
12 return (1, $self->msg('e5')) if $self->priv < 9 || $self->remotecmd || $self->inscript;
14 my ($date_req, $time_req);
16 if ($line =~ /-d/) { # add a date to the end of the filename
17 $line =~ s/\s*-d\s*//;
20 if ($line =~ /-t/) { # add a time to the end of the filename
21 $line =~ s/\s*-t\s*//;
24 if ($line =~ /-a/) { # append to the file
25 $line =~ s/\s*-a\s*//;
31 my ($fn, $rest) = split /\s+/, $line, 2;
32 $fn = "$main::root/packclus/$fn" unless $fn =~ m|^/|;
35 $fn .= '_' . cldate if $date_req;
36 $fn .= '_' . ztime if $time_req;
40 if ($rest =~ /^\s*\"/) {
41 @cmd = split /\s*\"[\s,]?\"?/, $rest;
45 open OF, "$app_req$fn" or return (1, $self->msg('e30', $fn));
47 $self->{_nospawn} = 1;
48 print OF map {"$_\n"} $self->run_cmd($_);
49 delete $self->{_nospawn};
52 return (1, $self->msg('ok'));