Subversion Repositories Kolibri OS

Rev

Rev 6826 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1.  
  2. int cmd_rm(char file[])
  3. {
  4.  
  5. kol_struct70    k70;
  6. char            temp[FILENAME_MAX];
  7. unsigned        result;
  8.  
  9. if (NULL == file || strlen(file) == 0)
  10.         {
  11.         #if LANG_ENG
  12.                 printf ("  rm <filename>\n\r");
  13.         #elif LANG_RUS
  14.                 printf ("  rm <¨¬ï ä ©« >\n\r");
  15.         #endif
  16.         return TRUE;
  17.         }
  18.  
  19. if ( '/' == file[0])
  20.         {
  21.         strcpy(temp, file);
  22.  
  23.         if ( !file_check(temp) )
  24.                 {
  25.                 return FALSE;
  26.                 }
  27.         }
  28. else
  29.         {
  30.         strcpy(temp, cur_dir);
  31.         if (temp[strlen(temp)-1] != '/')
  32.                 strcat(temp, "/"); // add slash
  33.         strcat(temp, file);
  34.        
  35.         if ( !file_check(temp) )
  36.                 {
  37.                 return FALSE;
  38.                 }
  39.         }
  40.  
  41. k70.p00 = 8;
  42. k70.p04 = 0;
  43. //k70.p08 = 0;
  44. k70.p12 = 0;
  45. k70.p16 = 0;
  46. k70.p20 = 0;
  47. k70.p21 = temp;
  48.  
  49. result = kol_file_70(&k70);
  50.  
  51. if (0 == result)
  52.         return TRUE;
  53. else
  54.         return FALSE;
  55.  
  56. }
  57.  
  58.