First, I ask the user name and password to start a telnet/ssh session. Then I want to get the output of the telnet/ssh session to deterrmine the next action.
Use popen? The telnet/ssh session is still running, I afriad the buffer in fgets would overflow.