Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | 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.         printf("  touch filename\n\r");
  12.         return FALSE;
  13.         }
  14.  
  15. if (  ( 0 == strcmp(file, ".") ) || ( 0 == strcmp(file, "..") ) || ( 0 == strcmp(cur_dir, "/")) )
  16.         {
  17.         return FALSE;
  18.         }
  19.  
  20. if ( '/' == file[0])
  21.         {
  22.         strcpy(temp, file);
  23.  
  24.         if ( !file_check(temp) )
  25.                 k70.p00 = 2;
  26.         else
  27.                 k70.p00 = 3;
  28.         }
  29. else
  30.         {
  31.         strcpy(temp, cur_dir);
  32.         strcat(temp, file);
  33.        
  34.         if ( !file_check(temp) )
  35.                 k70.p00 = 2;
  36.         else
  37.                 k70.p00 = 3;
  38.         }
  39.  
  40. k70.p04 = 0;
  41. k70.p08 = 0;
  42. k70.p12 = 0;
  43. k70.p16 = 0;
  44. k70.p20 = 0;
  45. k70.p21 = temp;
  46.  
  47. result = kol_file_70(&k70);
  48.  
  49. if (0 == result)
  50.         return TRUE;
  51. else
  52.         return FALSE;
  53.  
  54. }
  55.