Browse Subversion Repository
Diff of /trunk/ftp_put_buffer.c
Parent Directory
| Revision Log
| Patch
| 40 |
*@param bufsiz バッファサイズ |
*@param bufsiz バッファサイズ |
| 41 |
*@param fname サーバ上のファイル名 |
*@param fname サーバ上のファイル名 |
| 42 |
*@param cmd 送信するFTPコマンド |
*@param cmd 送信するFTPコマンド |
| 43 |
*@retval int 0: no error. -1: OS level error. -2: ftp protocol error. -3: buffer too small. |
*@retval int エラーコード |
| 44 |
*@note |
*@note |
| 45 |
*/ |
*/ |
| 46 |
static int ftp_put_buffer_main( LIBOFTP *ftp, char *buf, int bufsiz, const char *fname, const char *cmd ) |
static int ftp_put_buffer_main( LIBOFTP *ftp, char *buf, int bufsiz, const char *fname, const char *cmd ) |
| 47 |
{ |
{ |
| 48 |
int data_socket; |
int data_socket; |
| 49 |
char *p = buf; |
char *p = buf; |
| 50 |
int n; |
int n, res; |
| 51 |
|
|
| 52 |
/* |
/* |
| 53 |
* 送信準備 |
* 送信準備 |
| 72 |
n = sendn( data_socket, p, len, 0 ); |
n = sendn( data_socket, p, len, 0 ); |
| 73 |
DEBUGPRINT1( "SEND: n=%d\n", n ); |
DEBUGPRINT1( "SEND: n=%d\n", n ); |
| 74 |
if( n < 0 ) { |
if( n < 0 ) { |
| 75 |
|
DEBUGPRINT1( "recv error. %s\n", strerror(errno) ); |
| 76 |
|
copy_strerror(); |
| 77 |
close( data_socket ); |
close( data_socket ); |
| 78 |
return -1; |
return LIBOFTP_ERROR_OS; |
| 79 |
} |
} |
| 80 |
|
|
| 81 |
p += n; |
p += n; |
| 89 |
/* |
/* |
| 90 |
* receive response. |
* receive response. |
| 91 |
*/ |
*/ |
| 92 |
if( ftp_receive_response( ftp, 0, 0 ) != 226 ) { /* 226: Closing data connection. */ |
res = ftp_receive_response( ftp, ftp->error_message, sizeof(ftp->error_message)-1 ); |
| 93 |
return -2; |
if( res != 226 ) { /* 226: Closing data connection. */ |
| 94 |
|
DEBUGPRINT1( "got illegal response %d\n", res ); |
| 95 |
|
return res < 0? res: LIBOFTP_ERROR_PROTOCOL; |
| 96 |
} |
} |
| 97 |
|
|
| 98 |
return 0; |
return LIBOFTP_NOERROR; |
| 99 |
} |
} |
| 100 |
|
|
| 101 |
|
|
| 109 |
*@param buf バッファへのポインタ |
*@param buf バッファへのポインタ |
| 110 |
*@param bufsiz バッファサイズ |
*@param bufsiz バッファサイズ |
| 111 |
*@param fname サーバ上のファイル名 |
*@param fname サーバ上のファイル名 |
| 112 |
*@retval int 0: no error. -1: OS level error. -2: ftp protocol error. -3: buffer too small. |
*@retval int エラーコード |
| 113 |
*@note |
*@note |
| 114 |
*/ |
*/ |
| 115 |
int ftp_put_buffer( LIBOFTP *ftp, char *buf, int bufsiz, const char *fname ) |
int ftp_put_buffer( LIBOFTP *ftp, char *buf, int bufsiz, const char *fname ) |
| 126 |
*@param buf バッファへのポインタ |
*@param buf バッファへのポインタ |
| 127 |
*@param bufsiz バッファサイズ |
*@param bufsiz バッファサイズ |
| 128 |
*@param fname サーバ上のファイル名 |
*@param fname サーバ上のファイル名 |
| 129 |
*@retval int 0: no error. -1: OS level error. -2: ftp protocol error. -3: buffer too small. |
*@retval int エラーコード |
| 130 |
*@note |
*@note |
| 131 |
*/ |
*/ |
| 132 |
int ftp_append_buffer( LIBOFTP *ftp, char *buf, int bufsiz, const char *fname ) |
int ftp_append_buffer( LIBOFTP *ftp, char *buf, int bufsiz, const char *fname ) |
|
|
Legend:
| Removed from v.28 |
|
| changed lines |
| |
Added in v.30 |
|
|
| |