Re: Some suggestions

"Alexander V. Lukyanov" <[email protected]> Wed, 7 Dec 2005 10:52:01 +0300
Newsgroups gmane.network.lftp.devel
Message-ID <[email protected]>
On Fri, Dec 02, 2005 at 10:16:28AM -0500, Grenier,Michel [CMC] wrote:
> 	            errcod = lftp_sendcmd(cmd)
> 	            if( errcod != 0 )
> fprintf(stderr,"%s",lftp_errstring(errcod));
> 	            }
> 
> 	      errcod = lftp_cleanout()
> 	      exit(errcod)
> 
> 	    Your main would link lftplib.dll or lftplib.a or
> lftplib.so... whatever ...
> 	    Than with documented library modules and error codes....
> Everything would be perfect.

I think it is good enough already. There is CmdExec class which is fed with
commands (compare with your lftp_sendcmd).

You can load any custom module into lftp like this:

	lftp -c module /lib/module_name.so args...

The module will be loaded into lftp address space and module_init will be
called with the arguments. Then you can do practically anything. E.g. create
CmdExec and pass some commands to it.

The only caveat is cooperative threading model used by lftp. It was recently
discussed on lftp-devel, see mail archives.

-- 
   Alexander.