Develop and Download Open Source Software

Browse Subversion Repository

Contents of /tags/REL-2.0/ftp_quit.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 43 - (show annotations) (download) (as text)
Tue Mar 3 14:51:49 2009 UTC (15 years, 1 month ago) by hirohitohigashi
File MIME type: text/x-csrc
File size: 2089 byte(s)
Tag release 2.0
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 #include <unistd.h>
13
14
15 /***** Local headers ********************************************************/
16 #include "liboftp.h"
17 #include "sub.h"
18
19
20 /***** Constat values *******************************************************/
21 /***** Macros ***************************************************************/
22 /***** Typedefs *************************************************************/
23 /***** Function prototypes **************************************************/
24 /***** Local variables ******************************************************/
25 /***** Global variables *****************************************************/
26 /***** Signal catching functions ********************************************/
27 /***** Local functions ******************************************************/
28 /***** Global functions *****************************************************/
29
30 /****************************************************************************/
31 /*! QUIT������������
32 *
33 *@param ftp LIBOFTP���������������������
34 *@retval int ������������������
35 *@note
36 */
37 int ftp_quit( LIBOFTP *ftp )
38 {
39 char str1[] = "QUIT\r\n";
40 int res;
41
42 /*
43 * send QUIT command
44 */
45 if( ftp_send_command( ftp, str1 ) < 0 ) {
46 DEBUGPRINT1( "command sending error. %s\n", str1 );
47 return LIBOFTP_ERROR_OS;
48 }
49
50 res = ftp_receive_response( ftp, ftp->error_message, sizeof(ftp->error_message)-1 );
51 if( res == 221 ) { /* 221: Service closing control connection. */
52 res = LIBOFTP_NOERROR;
53 } else {
54 DEBUGPRINT1( "command response error. %d\n", res );
55 if( res >= 0 ) res = LIBOFTP_ERROR_PROTOCOL;
56 }
57
58 /*
59 * close socket.
60 */
61 close( ftp->socket );
62 ftp->socket = 0;
63
64 return res;
65 }

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