Develop and Download Open Source Software

Browse Subversion Repository

Annotation of /trunk/ftp_site.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 50 - (hide annotations) (download) (as text)
Wed Dec 2 15:13:30 2009 UTC (14 years, 3 months ago) by hirohitohigashi
File MIME type: text/x-csrc
File size: 2124 byte(s)
add error check
1 hirohitohigashi 23 /*
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 <stdio.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     /*! SITE������������
32     *
33     *@param ftp LIBOFTP���������������������
34     *@param cmdline ���������������������
35 hirohitohigashi 30 *@retval int ������������������
36 hirohitohigashi 23 *@note
37     */
38     int ftp_site( LIBOFTP *ftp, const char *cmdline )
39     {
40     char str1[512];
41 hirohitohigashi 29 int res;
42 hirohitohigashi 23
43 hirohitohigashi 50 if( ftp->socket < 0 ) return LIBOFTP_ERROR;
44    
45 hirohitohigashi 23 /*
46     * send SITE command
47     */
48     snprintf( str1, sizeof(str1)-1, "SITE %s\r\n", cmdline );
49     if( ftp_send_command( ftp, str1 ) < 0 ) {
50     DEBUGPRINT1( "site: command sending error. %s\n", str1 );
51 hirohitohigashi 29 return LIBOFTP_ERROR_OS;
52 hirohitohigashi 23 }
53    
54 hirohitohigashi 29 res = ftp_receive_response( ftp, ftp->error_message, sizeof(ftp->error_message)-1 );
55     if( res != 200 ) { /* 200: Command okay. */
56     DEBUGPRINT1( "command response error. %d\n", res );
57     return res < 0? res: LIBOFTP_ERROR_PROTOCOL;
58 hirohitohigashi 23 }
59    
60 hirohitohigashi 29 return LIBOFTP_NOERROR;
61 hirohitohigashi 23 }

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