Develop and Download Open Source Software

Browse Subversion Repository

Diff of /trunk/ftp_type.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 20 by hirohitohigashi, Fri Feb 27 11:30:10 2009 UTC revision 29 by hirohitohigashi, Sat Feb 28 12:48:31 2009 UTC
# Line 42  Line 42 
42  int ftp_type( LIBOFTP *ftp, const char *type )  int ftp_type( LIBOFTP *ftp, const char *type )
43  {  {
44      char str1[256];      char str1[256];
45      int ret;      int res;
46    
47      if( strcmp( type, "ascii" ) == 0 ) {      if( strcmp( type, "ascii" ) == 0 ) {
48          snprintf( str1, sizeof(str1)-1, "TYPE A\r\n" );          snprintf( str1, sizeof(str1)-1, "TYPE A\r\n" );
# Line 57  int ftp_type( LIBOFTP *ftp, const char * Line 57  int ftp_type( LIBOFTP *ftp, const char *
57          ftp->data_type = IMAGE;          ftp->data_type = IMAGE;
58                    
59      } else {      } else {
60          DEBUGPRINT1( "type: argument error. %s\n", type );          DEBUGPRINT1( "argument error. %s\n", type );
61          return -1;          return LIBOFTP_ERROR;
62      }      }
63            
64      /*      /*
65       * send TYPE command       * send TYPE command
66       */       */
67      if( ftp_send_command( ftp, str1 ) < 0 ) {      if( ftp_send_command( ftp, str1 ) < 0 ) {
68          DEBUGPRINT1( "type: command sending error.%s\n", "" );          DEBUGPRINT1( "command sending error. %s\n", str1 );
69          return -1;          return LIBOFTP_ERROR_OS;
70      }      }
71    
72      if( (ret = ftp_receive_response( ftp, 0, 0 )) != 200 ) {            /* 200: Command okay. */      res = ftp_receive_response( ftp, ftp->error_message, sizeof(ftp->error_message)-1 );
73          DEBUGPRINT1( "type: command response error. %d\n", ret );      if( res != 200 ) {                                          /* 200: Command okay. */
74          return -2;          DEBUGPRINT1( "command response error. %d\n", res );
75            return res < 0? res: LIBOFTP_ERROR_PROTOCOL;
76      }      }
77    
78      return 0;      return LIBOFTP_NOERROR;
79  }  }

Legend:
Removed from v.20  
changed lines
  Added in v.29

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