Develop and Download Open Source Software

Browse Subversion Repository

Annotation of /trunk/ftp_quit.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 32 - (hide annotations) (download) (as text)
Sat Feb 28 15:03:18 2009 UTC (15 years, 1 month ago) by hirohitohigashi
File MIME type: text/x-csrc
File size: 2089 byte(s)
added get/put functions by descriptor.

1 hirohitohigashi 18 /*
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 hirohitohigashi 32 #include <unistd.h>
13 hirohitohigashi 18
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 hirohitohigashi 30 *@retval int ������������������
35 hirohitohigashi 18 *@note
36     */
37     int ftp_quit( LIBOFTP *ftp )
38     {
39     char str1[] = "QUIT\r\n";
40 hirohitohigashi 29 int res;
41 hirohitohigashi 18
42     /*
43     * send QUIT command
44     */
45 hirohitohigashi 20 if( ftp_send_command( ftp, str1 ) < 0 ) {
46 hirohitohigashi 29 DEBUGPRINT1( "command sending error. %s\n", str1 );
47     return LIBOFTP_ERROR_OS;
48 hirohitohigashi 18 }
49    
50 hirohitohigashi 29 res = ftp_receive_response( ftp, ftp->error_message, sizeof(ftp->error_message)-1 );
51 hirohitohigashi 32 if( res == 221 ) { /* 221: Service closing control connection. */
52     res = LIBOFTP_NOERROR;
53     } else {
54 hirohitohigashi 29 DEBUGPRINT1( "command response error. %d\n", res );
55 hirohitohigashi 32 if( res >= 0 ) res = LIBOFTP_ERROR_PROTOCOL;
56 hirohitohigashi 18 }
57    
58 hirohitohigashi 32 /*
59     * close socket.
60     */
61     close( ftp->socket );
62     ftp->socket = 0;
63    
64     return res;
65 hirohitohigashi 18 }

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