2 # save the output of ANY command to a file
4 # Copyright (c) 2002 Dirk Koopman G1TLH
9 my ($self, $line) = @_;
10 return (1, $self->msg('e5')) if $self->priv < 9 || $self->remotecmd;
12 my ($date_req, $time_req);
14 if ($line =~ /-d/) { # add a date to the end of the filename
15 $line =~ s/\s*-d\s*//;
18 if ($line =~ /-t/) { # add a time to the end of the filename
19 $line =~ s/\s*-t\s*//;
22 if ($line =~ /-a/) { # append to the file
23 $line =~ s/\s*-a\s*//;
27 my ($fn, $rest) = split /\s+/, $line, 2;
28 $fn = "$main::root/packclus/$fn" unless $fn =~ m|^/|;
31 $fn .= '_' . cldate if $date_req;
32 $fn .= '_' . ztime if $time_req;
36 if ($rest =~ /^\s*\"/) {
37 @cmd = split /\s*\"[\s,]?\"?/, $rest;
41 open OF, "$app_req$fn" or return (1, $self->msg('e30', $fn));
43 print OF map {"$_\n"} $self->run_cmd($_);
46 return (1, $self->msg('ok'));