showtree prints error
This commit is contained in:
parent
0f2b0f2919
commit
4f18787256
Binary file not shown.
@ -35,19 +35,21 @@ void rmChar(char *str, char garbage) { /*przesledzic jak to dziala!!!!! w opis
|
|||||||
*dst = '\0';
|
*dst = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
void cd (char **argv){
|
int cd (char **argv){
|
||||||
if(argv[1] == NULL){
|
if(argv[1] == NULL){
|
||||||
printf("Add arguments\n");
|
printf("Add arguments\n");
|
||||||
return;
|
return -1;
|
||||||
}
|
}
|
||||||
else if(argv[2] != NULL){
|
else if(argv[2] != NULL){
|
||||||
printf("Too many arguments\n");
|
printf("Too many arguments\n");
|
||||||
return;
|
return -1;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
if (chdir(argv[1]) != 0)
|
if (chdir(argv[1]) != 0){
|
||||||
perror("chdir error");
|
perror("chdir error");
|
||||||
return;
|
return -1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -117,7 +119,8 @@ void tree (char **argv, char * directory){
|
|||||||
printf("Showtree prints catalog and file structure\ntakes no arguments \nor exacly 1 argument for desired directory\n");
|
printf("Showtree prints catalog and file structure\ntakes no arguments \nor exacly 1 argument for desired directory\n");
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
cd(argv);
|
if(cd(argv) == -1)
|
||||||
|
exit(0);
|
||||||
getcwd(ndr, sizeof(ndr));
|
getcwd(ndr, sizeof(ndr));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user