Some suggestions

"Grenier,Michel [CMC]" <[email protected]> Fri, 2 Dec 2005 10:16:28 -0500
Newsgroups gmane.network.lftp.devel
Message-ID <[email protected]>

> Hi Alexander
> 
>     Me again...
> 
>     This time with a suggestion :
> 
	    I think it should be fairly easy for you to rearrange your
main
	    and open your super lftp to a usage as nice library too...

	    Your main could look as simple as :

	     lftp_setargs(argc,argv)
	     lftp_init()

	     cmd = lftp_getcmd()
	     while( cmd != NULL )
	            {
	            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 have used lftp_ for a  "C like"  syntax but you could
choose to
	    have lftp as a C++ class... no problem...

	    With this library, lftp could be used by users like me to
send commands 
	     and to make all kinds of decisions based on the error code
like if I fail
	    to open on one machine... open and send on its failsafe
counterpart... etc...
	   
	    With this library wrapping to all sorts of application would
simply come by itself...
	     python, tcl, ruby, perl... etc...

	     In the mean time, the use of expect, pty and tools similar
can somehow do partly
	     the work by feaking to be a user and parsing your error
messages or prompt... but
	     this is far from an ideal world...
	    
	    I am sure you got my point...

	    Thanks for your attention and time...
	    And congrads again !!!
	    
	            
	         


> Michel Grenier
> 
> Data Acquisition and Distribution Services
> Canadian Meteorological Center 
> Environment Canada
> (514) 421-7204
>