home *** CD-ROM | disk | FTP | other *** search
- /*
- Library for ftpd clients.(libftp)
- Copyright by Oleg Orel
- All rights reserved.
-
- This library is desined for free, non-commercial software creation.
- It is changeable and can be improved. The author would greatly appreciate
- any advises, new components and patches of the existing programs.
- Commercial usage is also possible with participation of it's author.
-
-
-
- */
-
- #include "FtpLibrary.h"
- #include <setjmp.h>
- #include <signal.h>
-
- STATUS hook();
- jmp_buf env;
-
- STATUS FtpStorTimeout (FTP * con , char * command ,
- char *in , char * out,long timeout)
- {
- FILE *i;
- int c;
-
- if (setjmp(env)!=0)
- {
- if (con->data!=NULL) fclose(con->data);
- close(con->sock);
- return EXIT(con,QUIT);
- }
-
- signal(SIGALRM,hook);
-
- if ( FtpData(con,command,out,"w") < 1 )
- return EXIT(con,con->errno);
-
- if ( (i=Ftpfopen(in,"r")) == NULL )
- return EXIT(con,QUIT);
- while ( (c=getc(i)) != EOF )
- alarm(timeout),FtpWrite(con,c);
- fclose(i);
- return FtpClose(con);
- }
-
- static hook()
- {
- longjmp(env,1);
- }
-
-