Develop and Download Open Source Software

Browse Subversion Repository

Contents of /tags/REL-2.1/ftp_delete.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 29 - (show annotations) (download) (as text)
Sat Feb 28 12:48:31 2009 UTC (15 years, 1 month ago) by hirohitohigashi
Original Path: trunk/ftp_delete.c
File MIME type: text/x-csrc
File size: 2102 byte(s)
changed error messageing system. and added ftp_timeout() function.

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 <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 /*! DELE������������
32 *
33 *@param ftp LIBOFTP���������������������
34 *@param fname ���������������������
35 *@retval int ������������������������������
36 *@note
37 */
38 int ftp_delete( LIBOFTP *ftp, const char *fname )
39 {
40 char str1[512];
41 int res;
42
43 /*
44 * send DELE command
45 */
46 snprintf( str1, sizeof(str1)-1, "DELE %s\r\n", fname );
47 if( ftp_send_command( ftp, str1 ) < 0 ) {
48 DEBUGPRINT1( "command sending error. %s\n", str1 );
49 return LIBOFTP_ERROR_OS;
50 }
51
52 res = ftp_receive_response( ftp, ftp->error_message, sizeof(ftp->error_message)-1 );
53 if( res != 250 ) { /* 250: Requested file action okay, completed. */
54 DEBUGPRINT1( "command response error. %d\n", res );
55 return res < 0? res: LIBOFTP_ERROR_PROTOCOL;
56 }
57
58 return LIBOFTP_NOERROR;
59 }

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