head	1.1;
branch	1.1.1;
access;
symbols
	ISELECT_1_4_0:1.1.1.2
	ISELECT_1_3_1:1.1.1.2
	ISELECT_1_3_0:1.1.1.2
	ISELECT_1_2_0:1.1.1.2
	ISELECT_1_1_0:1.1.1.2
	ISELECT_1_0_4:1.1.1.1
	vendor:1.1.1;
locks; strict;
comment	@# @;


1.1
date	97.10.11.09.55.25;	author rse;	state Exp;
branches
	1.1.1.1;
next	;

1.1.1.1
date	97.10.11.09.55.25;	author rse;	state Exp;
branches;
next	1.1.1.2;

1.1.1.2
date	98.04.05.16.39.37;	author rse;	state Exp;
branches;
next	;


desc
@@


1.1
log
@Initial revision
@
text
@#!/sw/bin/perl
##
##  iLogin -- Interactive Login
##  Copyright (c) 1997 Ralf S. Engelschall, All Rights Reserved. 
##

require "$ENV{HOME}/.ilogin";

$tmpfile = "/tmp/tmp.ilogin.$$";

unlink($tmpfile);
open(FP, ">$tmpfile");
print FP "\n";
print FP "Interactive Login (iLogin)\n";
foreach $l (@@CFG) {
    $area  = $l->{AREA};
    $hosts = $l->{HOSTS};
    print FP "\n";
    print FP "$area:\n";
    foreach $h (@@{$hosts}) {
        $name = $h->{NAME};
        $info = $h->{INFO};
        $type = $h->{TYPE};
        $opt  = $h->{OPT};
        if ($type eq 'ssh') {
            $cmd = "ssh $opt";
        }
        elsif ($type eq 'rlogin') {
            $cmd = "rlogin $opt";
        }
        elsif ($type eq 'expect') {
            $cmd = "expect";
            foreach $c (@@{$opt}) {
                $cmd .= " -c '".$c."'";
            }
        }
        print FP sprintf("  %-30s %-30s %10s %%%%S:%s%%%%\n", $name, $info, $type, $cmd);
    }
}
close(FP);
system("iselect -n iLogin -t 'Select Remote Host...' -p5 <$tmpfile"); 
unlink($tmpfile);

##EOF##
@


1.1.1.1
log
@Import iSelect 1.0.4
@
text
@@


1.1.1.2
log
@Import iSelect 1.1.0
@
text
@d3 1
a3 1
##  iLogin -- interactive login
d13 2
a14 2
%LOGINCMD = ();
%FTPCMD = ();
d21 4
a24 7
        $name   = $h->{NAME};
        $info   = $h->{INFO};
        $os     = $h->{OS};
        $type   = $h->{TYPE};
        $opt    = $h->{OPT};
        $passwd = $h->{PASSWD} || "$ENV{'LOGIN'}";
        $home   = $h->{HOME} || "/";
d32 1
a32 1
            $cmd = "expect -c 'set timeout 30'";
d37 1
a37 12
        $LOGINCMD{$name} = $cmd;

        ($login, $host) = ($name =~ m|^(.+)@@(.+)$|);
        if ($login eq 'ftp' or $login eq 'anonymous') {
            $user = '';
        }
        else {
            $user = "$login:$passwd\@@";
        }
        $FTPCMD{$name} = "cftp ftp://$user$host$home";

        print FP sprintf("%-33s %-15s %-20s %6s <S:%s>\n", $name, $info, $os, $type, $name);
d41 1
a41 13
$rc = `iselect -n iLogin -t 'Select Remote Host...' -p3 -K -kf:RETURN <$tmpfile`; 
if ($rc ne '') {
   $rc =~ m|^(.+?):(.*)|;
   ($key, $name) = ($1, $2);
   if ($key eq 'RETURN' or $key eq 'KEY_RIGHT') {
       # Terminal Session
       print $LOGINCMD{$name};
   } 
   elsif ($key eq 'f') {
       # FTP Session
       print $FTPCMD{$name};
   }
}
@

