Develop and Download Open Source Software

Browse Subversion Repository

Annotation of /tags/REL-2.2/ftp_reset.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 38 - (hide annotations) (download) (as text)
Sun Mar 1 15:51:51 2009 UTC (15 years, 1 month ago) by hirohitohigashi
Original Path: trunk/ftp_reset.c
File MIME type: text/x-csrc
File size: 2284 byte(s)
modified some functions for robustness.

1 hirohitohigashi 36 /*
2     liboftp: this is an FTP library to simplify the work to a Developer
3     who want to work with FTP servers (RFC 959).
4    
5     Copyright (c) 2009 hirohito higashi. All rights reserved.
6     This file is distributed under BSD license.
7     */
8    
9    
10     /***** Feature test switches ************************************************/
11     /***** System headers *******************************************************/
12     /***** Local headers ********************************************************/
13     #include "liboftp.h"
14     #include "sub.h"
15    
16    
17     /***** Constat values *******************************************************/
18     /***** Macros ***************************************************************/
19     /***** Typedefs *************************************************************/
20     /***** Function prototypes **************************************************/
21     /***** Local variables ******************************************************/
22     /***** Global variables *****************************************************/
23     /***** Signal catching functions ********************************************/
24     /***** Local functions ******************************************************/
25     /***** Global functions *****************************************************/
26    
27     /****************************************************************************/
28     /*! ���������������
29     *
30     *@param ftp LIBOFTP���������������������
31     *@retval int ������������������
32     *@note
33     * ���������������������ftp������������������������������������������������������������������������������
34     * ���������������������������������������������
35     */
36     int ftp_reset( LIBOFTP *ftp )
37     {
38     int now_timeout_sec = ftp->timeout_sec;
39     int ret;
40 hirohitohigashi 38 int i;
41 hirohitohigashi 36
42     /*
43     * send "CRLF" only
44     */
45     if( ftp_send_command( ftp, "\r\n" ) < 0 ) {
46     DEBUGPRINT1( "command sending error. %s\n", "CRLF" );
47     return LIBOFTP_ERROR_OS;
48     }
49    
50     /*
51 hirohitohigashi 38 * receive response until timeout. 100 cycle maxmum.
52 hirohitohigashi 36 */
53     ftp_timeout( ftp, 1 ); /* set 1 sec */
54    
55 hirohitohigashi 38 for( i = 0; i < 100; i++ ) {
56 hirohitohigashi 36 ret = ftp_receive_response( ftp, 0, 0 );
57     if( ret == LIBOFTP_ERROR_TIMEOUT ) {
58     ret = LIBOFTP_NOERROR;
59     break;
60     }
61    
62     if( ret == LIBOFTP_ERROR_OS ) {
63     DEBUGPRINT1( "os level error occurred.\n%s", "" );
64     break;
65     }
66     }
67    
68     ftp_timeout( ftp, now_timeout_sec );
69     return ret;
70     }

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26