about remote login

mara ailiez sy <[email protected]> Wed, 28 Jan 2004 05:47:11 -0800 (PST)
Newsgroups gmane.linux.redhat.devel
Message-ID <[email protected]>
Hello... I am currently researching about remote login and came across Python's Telnetlib. However, I cannot find a similar library in C. Does anyone know if there is an equivalent library in C or the equivalent functions can be implemented in C. 
 
Attached here is the sample code in Python that I want to implement in C:
 
import getpass
import sys
import telnetlib

HOST = "localhost"
user = raw_input("Enter your remote account: ")
password = getpass.getpass()

tn = telnetlib.Telnet(HOST)

tn.read_until("login: ")
tn.write(user + "\n")
if password:
    tn.read_until("Password: ")
    tn.write(password + "\n")

tn.write("ls\n")
tn.write("exit\n")
 
thanks very much

print tn.read_all()
 


---------------------------------
Do you Yahoo!?
Yahoo! SiteBuilder - Free web site building tool. Try it!