This commit is contained in:
Jakub Adamski 2019-01-10 14:53:53 +01:00
parent 8e90990779
commit b8c3cc7c4c
1 changed files with 2 additions and 3 deletions

View File

@ -38,7 +38,7 @@ int cut(char **argv, char *command){
int main (){ int main (){
int ile, i; int ile, i;
while (1){ while (1){
char** argv; char* argv[100];
char komenda[max], directory[max]; char komenda[max], directory[max];
if (getcwd(directory, sizeof(directory)) == NULL){ if (getcwd(directory, sizeof(directory)) == NULL){
perror("getcwd() error"); perror("getcwd() error");
@ -47,7 +47,7 @@ int main (){
printf("[%s]$ ", directory); printf("[%s]$ ", directory);
fgets(komenda, max, stdin); fgets(komenda, max, stdin);
ile = cut(argv, komenda); ile = cut(argv, komenda);
printf("\n%s\n\n", argv[0]);
if (argv[0]==NULL) if (argv[0]==NULL)
continue; continue;
else if (strcmp(argv[0], "exit") == 0) else if (strcmp(argv[0], "exit") == 0)
@ -60,7 +60,6 @@ int main (){
for(i=0; i<ile; i++) for(i=0; i<ile; i++)
free(argv[i]); free(argv[i]);
free(argv[i]);
} }
return 0; return 0;
} }