Subversion Repositories Kolibri OS

Rev

Rev 1665 | Rev 3247 | 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)
  10.         {
  11.         #if LANG_ENG
  12.                 printf("  touch <filename>\n\r");
  13.         #elif LANG_RUS
  14.                 printf("  touch <¨¬ï ä ©« >\n\r");
  15.         #endif
  16.         return FALSE;
  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.        
  38.         if ( !file_check(temp) )
  39.                 k70.p00 = 2;
  40.         else
  41.                 k70.p00 = 3;
  42.         }
  43.  
  44. k70.p04 = 0;
  45. k70.p08 = 0;
  46. k70.p12 = 0;
  47. k70.p16 = 0;
  48. k70.p20 = 0;
  49. k70.p21 = temp;
  50.  
  51. result = kol_file_70(&k70);
  52.  
  53. if (0 == result)
  54.         return TRUE;
  55. else
  56.         return FALSE;
  57.  
  58. }
  59.