fixed one ot two little buglets
[spider.git] / cmd / connect.pl
1 #
2 # connect a cluster station
3 #
4 my $self = shift;
5 my $call = uc shift;
6 my $lccall = lc $call;
7
8 return (0) if $self->priv < 8;
9 return (1, $self->msg('e6')) unless $call gt ' ';
10 return (1, $self->msg('already', $call)) if DXChannel->get($call);
11 return (1, $self->msg('conscript', $lccall)) unless -e "$main::root/connect/$lccall";
12
13 my $prog = "$main::root/local/client.pl";
14 $prog = "$main::root/perl/client.pl" if ! -e $prog;
15
16 my $pid = fork();
17 if (defined $pid) {
18         if (!$pid) {
19                 # in child
20                 exec $prog, $call, 'connect';
21         } else {
22                 return(1, $self->msg('constart', $call));
23         }
24 }
25 return (0, $self->msg('confail', $call, $!))
26
27
28