Subversion Repositories Kolibri OS

Rev

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

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