Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- for(I = 0; I < v->inodes_num; I++)
- {
- if(v->inodes[I].flags & VFS_FLAG_IN_USE && v->inodes[I].flags & VFS_FLAG_IS_START
- && strncmp(v->inodes[I].name, destination_file_name, NAME_MAX) == 0)
- {
- int i, isConflict;
- do
- { isConflict = 0;
- //prepending "KH_" to a file name
- //strcpy(temp, v->inodes[I].name);
- //strcpy(v->inodes[I].name, "KH_");
- //strcat(v->inodes[I].name,temp);
- strcpy(temp1, v->inodes[I].name);
- strcpy(temp2, "KH_");
- strcat(temp2,temp1); //temp2 - my new file name
- //printf("\nCurrentFileName: %s\n", temp2);
- for(i=0; i< v->inodes_num; i++)
- { //printf("\n#%dxD\n", i);
- if(strcmp(temp2, v->inodes[i].name) == 0)//another file name conflict
- { //printf("\nZnaleziono konflikt nazw z: %s\n", v->inodes[i].name);
- //char ch;
- //ch = getchar();
- //ch += 0;
- isConflict = 1;
- break;
- }
- }
- strcpy(v->inodes[I].name, temp2);
- }
- while(isConflict == 1);
- if(strlen(v->inodes[I].name) > NAME_MAX) //name too long
- return -2;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement