Improve M$ Windows compatibility
[spider.git] / cmd / nospawn.pl
1 #!/usr/bin/perl
2 #
3 # pretend that you are another user, useful for reseting
4 # those silly things that people insist on getting wrong
5 # like set/homenode et al
6 #
7 # Copyright (c) 1999 Dirk Koopman G1TLH
8 #
9 my ($self, $line) = @_;
10
11 my $mycall = $self->call;
12
13
14 if ($self->priv < 2) {
15         Log('DXCommand', "$mycall is trying to nospawn $line locally");
16         return (1, $self->msg('e5'));
17 }
18 if ($self->remotecmd || $self->inscript) {
19         Log('DXCommand', "$mycall is trying to nospawn remotely");
20         return (1, $self->msg('e5'));
21 }
22
23 Log('DXCommand', "nospawn '$line' by $mycall");
24 ++$self->{_nospawn};
25 my @out = $self->run_cmd($line);
26 $self->{_nospawn} = 0 if exists $self->{_nospawn} && --$self->{_nospawn} <= 0;
27
28 return (1, @out);