Develop and Download Open Source Software

Browse Subversion Repository

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 36 - (show annotations) (download) (as text)
Sun Mar 1 13:40:55 2009 UTC (15 years, 1 month ago) by hirohitohigashi
Original Path: trunk/ftp_reset.c
File MIME type: text/x-csrc
File size: 2239 byte(s)
added ftp_reset() function and fixed some bugs.

1 /*
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
41 /*
42 * send "CRLF" only
43 */
44 if( ftp_send_command( ftp, "\r\n" ) < 0 ) {
45 DEBUGPRINT1( "command sending error. %s\n", "CRLF" );
46 return LIBOFTP_ERROR_OS;
47 }
48
49 /*
50 * receive response until timeout.
51 */
52 ftp_timeout( ftp, 1 ); /* set 1 sec */
53
54 while( 1 ) {
55 ret = ftp_receive_response( ftp, 0, 0 );
56 if( ret == LIBOFTP_ERROR_TIMEOUT ) {
57 ret = LIBOFTP_NOERROR;
58 break;
59 }
60
61 if( ret == LIBOFTP_ERROR_OS ) {
62 DEBUGPRINT1( "os level error occurred.\n%s", "" );
63 break;
64 }
65 }
66
67 ftp_timeout( ftp, now_timeout_sec );
68 return ret;
69 }

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