#!/usr/bin/perl ############################################################################### # citpage - Citadel/UX Express Message (page) utility # # By Ben Mehlman, August 26, 1999 # ############################################################################### use IO::Socket; use Getopt::Std; &Usage unless(getopts("du:p:r:h:p:")); $opt_h = 'uncnsrd.mt-kisco.ny.us' unless($opt_h); $opt_P = 504 unless($opt_P); $opt_r = $opt_u unless($opt_r); $debug = $opt_d; &Usage() unless($opt_u && $opt_p); while($_ = ) { chomp; last if /^\.$/; $msg .= " $_\n"; } print "connecting to $opt_h, port $opt_p\n" if($debug); $sock = new IO::Socket::INET( PeerAddr => $opt_h, PeerPort => $opt_P, Proto => 'tcp' ) || die "$!\n"; my $oldfh = select($sock); $|=1; select($oldfh); CitCmd("") == 2 || die "$resp\n"; CitCmd("USER $opt_u") == 3 || die "$resp\n"; CitCmd("PASS $opt_p") == 2 || die "$resp\n"; CitCmd("SEXP $opt_r|-") == 4 || die "$resp\n"; print $sock $msg, "000\n"; CitCmd("QUIT") == 2 || die "$resp\n"; exit 0; ############################################################################### sub Usage { print < $qry\n" if($debug); print $sock "$qry\n" || die "$!\n"; } $resp = <$sock>; chomp($resp); print "<-- $resp\n" if($debug); $resp || die "no response from server\n"; $resp =~ /^(\d)\d+[\s\*]+(.*)$/ || die "unparseable response: $resp\n"; return $1; }