Subversion Repositories Kolibri OS

Rev

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

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