+# do we need to do a login and password job?
+if ($loginreq) {
+ my $user;
+ my $s;
+
+ DXUser->init($userfn);
+
+ for ($state = 0; $state < 2; ) {
+ alarm($timeout);
+
+ if ($state == 0) {
+ $stdout->print('login: ');
+ $stdout->flush();
+ local $/ = $mode == 1 ? "\r" : "\n";
+ $s = $stdin->getline();
+ chomp $s;
+ $call = uc $s;
+ $user = DXUser->get($call);
+ $state = 1;
+ } elsif ($state == 1) {
+ $stdout->print('password: ');
+ $stdout->flush();
+ local $/ = $mode == 1 ? "\r" : "\n";
+ $s = $stdin->getline();
+ chomp $s;
+ $state = 2;
+ cease(0) if !$user || ($user->passwd && $user->passwd ne $s);
+ }
+ }
+}
+
+# handle callsign and connection type firtling
+sub doclient
+{
+ my $line = shift;
+ my @f = split /\s+/, $line;
+ $call = uc $f[0] if $f[0];
+ $csort = $f[1] if $f[1];
+}
+