Term-ReadLine-Gnu
view release on metacpan or search on metacpan
use warnings;
use Term::ReadLine;
use POSIX; # for sigaction below
use vars qw($PS1 $PS2 $HISTFILE $HISTSIZE $INPUTRC $STRICT
$HOSTNAME $LOGNAME $CWP);
#$PS1 = '$ ';
$PS1='\w[\!]$ ';
$PS2 = '> ';
$HISTFILE = ($ENV{HOME} || ((getpwuid($<))[7])) . "/.perlsh_history";
$HISTSIZE = 256;
$INPUTRC = ($ENV{HOME} || ((getpwuid($<))[7])) . "/.perlshrc";
$STRICT = 0;
$HOSTNAME = $ENV{HOSTNAME};
$LOGNAME = $ENV{LOGNAME};
$CWP = 'main'; # current working package
package main;
if (-f $PerlSh::INPUTRC) {
do $PerlSh::INPUTRC;
}
accept bind connect getpeername getsockname
getsockopt listen recv send setsockopt shutdown
socket socketpair
msgctl msgget msgrcv msgsnd semctl semget
semop shmctl shmget shmread shmwrite
endgrent endhostent endnetent endpwent getgrent
getgrgid getgrnam getlogin getpwent getpwnam
getpwuid setgrent setpwent
endprotoent endservent gethostbyaddr
gethostbyname gethostent getnetbyaddr
getnetbyname getnetent getprotobyname
getprotobynumber getprotoent getservbyname
getservbyport getservent sethostent setnetent
setprotoent setservent
gmtime localtime time times
exit 0;
}
getopts('dugMh') or &usage;
&man if $opt_M;
&usage if $opt_h;
#
# setup Term::ReadLine::GNU
#
my $HOSTFILE = ($ENV{HOME} || (getpwuid($<))[7]) . "/.pftp_hosts";
my $term = Term::ReadLine->new('PFTP');
my $attribs = $term->Attribs;
$term->ornaments('md,me,,'); # bold face prompt
#
# read hostname to which login
#
my $host;
my @hosts = read_hosts($HOSTFILE);
Debug => $opt_d);
die "$0: cannot connect \`$host\'\n" unless $ftp;
print STDERR $ftp->message;
write_hosts($HOSTFILE, $host, @hosts);
#
# login
#
my $login = 'anonymous';
my $password = (getpwuid($<))[0] . '@' . hostdomain;
if ($opt_u) {
$login = $term->readline('login name> ', $login);
# mask typed characters for password
$attribs->{redisplay_function} = $attribs->{shadow_redisplay};
$password = $term->readline('password> ', $password);
undef $attribs->{redisplay_function};
}
$ftp->login($login, $password) or die "$0: cannot login: " . $ftp->message;
GETPROTOENT_R_PROTO|5.008000|5.008000|Vn
getpwent|5.009000||Viu
GETPWENT_R_HAS_BUFFER|5.008000||Viu
GETPWENT_R_HAS_FPTR|5.008000||Viu
GETPWENT_R_HAS_PTR|5.008000||Viu
GETPWENT_R_PROTO|5.008000|5.008000|Vn
getpwnam|5.009000||Viu
GETPWNAM_R_HAS_BUFFER|5.008000||Viu
GETPWNAM_R_HAS_PTR|5.008000||Viu
GETPWNAM_R_PROTO|5.008000|5.008000|Vn
getpwuid|5.009000||Viu
GETPWUID_R_HAS_PTR|5.008000||Viu
GETPWUID_R_PROTO|5.008000|5.008000|Vn
get_quantifier_value|5.033006||Viu
get_re_arg|||xciu
get_re_gclass_nonbitmap_data|5.031011||Viu
get_regclass_nonbitmap_data|5.031011||Viu
get_regex_charset_name|5.031004||Vniu
getservbyname|5.005000||Viu
GETSERVBYNAME_R_HAS_BUFFER|5.008000||Viu
GETSERVBYNAME_R_HAS_PTR|5.008000||Viu
KEY_getnetent|5.003007||Viu
KEY_getpeername|5.003007||Viu
KEY_getpgrp|5.003007||Viu
KEY_getppid|5.003007||Viu
KEY_getpriority|5.003007||Viu
KEY_getprotobyname|5.003007||Viu
KEY_getprotobynumber|5.003007||Viu
KEY_getprotoent|5.003007||Viu
KEY_getpwent|5.003007||Viu
KEY_getpwnam|5.003007||Viu
KEY_getpwuid|5.003007||Viu
KEY_getservbyname|5.003007||Viu
KEY_getservbyport|5.003007||Viu
KEY_getservent|5.003007||Viu
KEY_getsockname|5.003007||Viu
KEY_getsockopt|5.003007||Viu
KEY_getspnam|5.031011||Viu
KEY_given|5.009003||Viu
KEY_glob|5.003007||Viu
KEY_gmtime|5.003007||Viu
KEY_goto|5.003007||Viu
( run in 0.351 second using v1.01-cache-2.11-cpan-8d75d55dd25 )