Browse Subversion Repository
Diff of /trunk/ftp_site.c
Parent Directory
| Revision Log
| Patch
| 32 |
* |
* |
| 33 |
*@param ftp LIBOFTPへのポインタ。 |
*@param ftp LIBOFTPへのポインタ。 |
| 34 |
*@param cmdline コマンドライン |
*@param cmdline コマンドライン |
| 35 |
*@retval int マイナス値ならエラー |
*@retval int エラーコード |
| 36 |
*@note |
*@note |
| 37 |
*/ |
*/ |
| 38 |
int ftp_site( LIBOFTP *ftp, const char *cmdline ) |
int ftp_site( LIBOFTP *ftp, const char *cmdline ) |
| 39 |
{ |
{ |
| 40 |
char str1[512]; |
char str1[512]; |
| 41 |
int ret; |
int res; |
| 42 |
|
|
| 43 |
|
if( ftp->socket < 0 ) return LIBOFTP_ERROR; |
| 44 |
|
|
| 45 |
/* |
/* |
| 46 |
* send SITE command |
* send SITE command |
| 48 |
snprintf( str1, sizeof(str1)-1, "SITE %s\r\n", cmdline ); |
snprintf( str1, sizeof(str1)-1, "SITE %s\r\n", cmdline ); |
| 49 |
if( ftp_send_command( ftp, str1 ) < 0 ) { |
if( ftp_send_command( ftp, str1 ) < 0 ) { |
| 50 |
DEBUGPRINT1( "site: command sending error. %s\n", str1 ); |
DEBUGPRINT1( "site: command sending error. %s\n", str1 ); |
| 51 |
return -1; |
return LIBOFTP_ERROR_OS; |
| 52 |
} |
} |
| 53 |
|
|
| 54 |
if( (ret = ftp_receive_response( ftp, str1, sizeof(str1) )) != 200 ) { /* 200: Command okay. */ |
res = ftp_receive_response( ftp, ftp->error_message, sizeof(ftp->error_message)-1 ); |
| 55 |
DEBUGPRINT1( "site: command response error. %d\n", ret ); |
if( res != 200 ) { /* 200: Command okay. */ |
| 56 |
return -2; |
DEBUGPRINT1( "command response error. %d\n", res ); |
| 57 |
|
return res < 0? res: LIBOFTP_ERROR_PROTOCOL; |
| 58 |
} |
} |
| 59 |
|
|
| 60 |
return 0; |
return LIBOFTP_NOERROR; |
| 61 |
} |
} |
|
|
Legend:
| Removed from v.23 |
|
| changed lines |
| |
Added in v.50 |
|
|
| |