the base terminal works as it should
This commit is contained in:
parent
5a7914e9d7
commit
2db1a26348
1 changed files with 8 additions and 3 deletions
11
main.c
11
main.c
|
@ -81,8 +81,12 @@ int getUserName(char* name)
|
||||||
int status;
|
int status;
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
char* path = (char *)malloc(sizeof(char));
|
char* path = (char *)malloc(sizeof(char));
|
||||||
|
char* exe = (char *)malloc(sizeof(char));
|
||||||
|
strcpy(exe,args[0]);
|
||||||
strcpy(path, PATH);
|
strcpy(path, PATH);
|
||||||
strcat(path, args[0]);
|
strcat(path, exe);
|
||||||
|
|
||||||
|
printf("try: %s \n",args[0]);
|
||||||
|
|
||||||
pid = fork();
|
pid = fork();
|
||||||
|
|
||||||
|
@ -134,7 +138,6 @@ int getUserName(char* name)
|
||||||
tok = strtok(NULL, " \n");
|
tok = strtok(NULL, " \n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if(wordCnt == 0) //if there are no "words" in input - return null
|
if(wordCnt == 0) //if there are no "words" in input - return null
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
@ -150,7 +153,9 @@ int getUserName(char* name)
|
||||||
tok = strtok(input," \n");
|
tok = strtok(input," \n");
|
||||||
while (tok != NULL)
|
while (tok != NULL)
|
||||||
{
|
{
|
||||||
returnArr[i] = tok;
|
returnArr[i] = (char *)malloc(strlen(tok)*sizeof(char));
|
||||||
|
//returnArr[i] = tok;
|
||||||
|
strcpy(returnArr[i], tok);
|
||||||
if(wordCnt == 1)
|
if(wordCnt == 1)
|
||||||
checkIfQuit(tok);
|
checkIfQuit(tok);
|
||||||
tok = strtok(NULL, " \n");
|
tok = strtok(NULL, " \n");
|
||||||
|
|
Loading…
Reference in a new issue