SFTP - Parsing stdout/stderr responses

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Any suggestions on parsing sftp stdout/stderr responses on UNIX?

I am writing a command interpreter that forks sftp/ssh processes and
sends sftp commands via stdin.

The stdout/stderr messages returned are all textual.  This is
different than ftp which returns coded messages from the ftp server.
It appears that I must read to /n newlines or to an "sftp>" prompt to
know when the sftp-server response message ends.  Then be intelligent
enough to look for a certain textual response such as "Fetching file
.. to file .. "  before I continue.

Has anyone had to do this?

Site Timeline