Exemplo n.º 1
0
int32_t  FTPc_pass(FTPc_CONTEXT_PTR context_ptr, int32_t argc, char *argv[] )
{
   int32_t   response=0;
   char *param_ptr;
   char     string[64];
   
   
   if (context_ptr->HANDLE == NULL)  {
      printf("Not connected.\n");
   } else if (argc > 2) {
      printf("Usage: pass <password>\n");
   } else  {
      if (argc == 1) {
         printf("Password: "******"PASS %s\r\n", param_ptr );
      response = FTP_command(context_ptr->HANDLE,context_ptr->BUFFER,stdout);
      printf("response = %d\n", response );
   }
   
   return response;
}
Exemplo n.º 2
0
int_32  FTPc_rename(FTPc_CONTEXT_PTR context_ptr, int_32 argc, char_ptr argv[] )
{
   int_32    response=0;
   
   if (context_ptr->HANDLE == NULL)  {
      printf("Not connected.\n");
   } else if (argc != 3) {
      printf("Usage: rename <oldname> <newname>\n");
   } else  {
      sprintf(context_ptr->BUFFER,"RNFR %s\r\n", argv[1] );
      response = FTP_command(context_ptr->HANDLE,context_ptr->BUFFER,stdout);

      if ((response >= 300) && (response < 400))  {
         sprintf(context_ptr->BUFFER,"RNTO %s\r\n", argv[2] );
         response = FTP_command(context_ptr->HANDLE,context_ptr->BUFFER,stdout);
      }
   }
   
   return response;
}
Exemplo n.º 3
0
int_32  FTPc_user(FTPc_CONTEXT_PTR context_ptr, int_32 argc, char_ptr argv[] )
{
   int_32   response = 0;
   char_ptr param_ptr = NULL;
   char     string[64];

   if (context_ptr->HANDLE == NULL)  {
      printf("Not connected.\n");
   } else if (argc > 2) {
      printf("Usage: user <username>\n");
   } else if (argc == 1) {
      printf("User: "******"USER %s\r\n", param_ptr );
      response = FTP_command(context_ptr->HANDLE,context_ptr->BUFFER,stdout);

      if ((response >= 300) && (response < 400))  {
         printf("Password: "******"PASS %s\r\n", string);
            response = FTP_command(context_ptr->HANDLE,context_ptr->BUFFER,stdout);
         }
      }
   }

   return response;
}
Exemplo n.º 4
0
int_32  FTPc_ascii(FTPc_CONTEXT_PTR context_ptr, int_32 argc, char_ptr argv[] )
{
   int_32    response=0;
   
   if (context_ptr->HANDLE == NULL)  {
      printf("Not connected.\n");
   } else if (argc != 1) {
      printf("Usage: ascii\n");
   } else {
      response = FTP_command(context_ptr->HANDLE,"TYPE A\r\n",stdout);
   }
   
   return response;
}
Exemplo n.º 5
0
int32_t  FTPc_binary(FTPc_CONTEXT_PTR context_ptr, int32_t argc, char *argv[] )
{
   int32_t    response=0;
   
   if (context_ptr->HANDLE == NULL)  {
      printf("Not connected.\n");
   } else if (argc != 1) {
      printf("Usage: binary\n");
   } else {
      response = FTP_command(context_ptr->HANDLE,"TYPE I\r\n",stdout);
   }
   
   return response;
}
Exemplo n.º 6
0
int_32  FTPc_rmdir(FTPc_CONTEXT_PTR context_ptr, int_32 argc, char_ptr argv[] )
{
   int_32    response=0;
   
   if (context_ptr->HANDLE == NULL)  {
      printf("Not connected.\n");
   } else if (argc != 2) {
      printf("Usage: rmdir <dir>\n");
   } else  {
      sprintf(context_ptr->BUFFER,"RMD %s\r\n", argv[1] );
      response = FTP_command(context_ptr->HANDLE,context_ptr->BUFFER,stdout);
   }
   
   return response;
}
Exemplo n.º 7
0
int_32  FTPc_cd(FTPc_CONTEXT_PTR context_ptr, int_32 argc, char_ptr argv[] )
{
   int_32    response=0;
   
   if (context_ptr->HANDLE == NULL)  {
      printf("Not connected.\n");
   } else if (argc > 2) {
      printf("Usage: cd <directory>\n");
   } else  {
      sprintf(context_ptr->BUFFER,"CWD %s\r\n", (argc > 1)?argv[1]:"" );
      response = FTP_command(context_ptr->HANDLE,context_ptr->BUFFER,stdout);
   }
   
   return response;
}
Exemplo n.º 8
0
int_32  FTPc_delete(FTPc_CONTEXT_PTR context_ptr, int_32 argc, char_ptr argv[] )
{
   int_32    response=0;
   
               
   if (context_ptr->HANDLE == NULL)  {
      printf("Not connected.\n");
   } else if (argc != 2) {
      printf("Usage: delete <filename>\n");
   } else {
      sprintf(context_ptr->BUFFER,"DELE %s\r\n", context_ptr->ARGV[1] );
      response = FTP_command(context_ptr->HANDLE,context_ptr->BUFFER,stdout);
   }
   
   return response;
}