fix: builtin strdup the executable
This commit is contained in:
parent
db184b4aee
commit
e402f9dcad
@ -18,10 +18,10 @@ int len(void** list)
|
|||||||
|
|
||||||
char* builtin_path(const char* executable)
|
char* builtin_path(const char* executable)
|
||||||
{
|
{
|
||||||
if (strcmp(executable, "cd") == 0)
|
if (strcmp(executable, "cd") == 0);
|
||||||
return "cd";
|
|
||||||
else
|
else
|
||||||
return NULL;
|
return NULL;
|
||||||
|
return strdup(executable);
|
||||||
}
|
}
|
||||||
|
|
||||||
int change_directory(char** args, lst** env)
|
int change_directory(char** args, lst** env)
|
||||||
|
@ -66,10 +66,10 @@ char *get_user_input(lst** env)
|
|||||||
if (prompt == NULL)
|
if (prompt == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
input = readline(prompt);
|
input = readline(prompt);
|
||||||
if (input != NULL && str_contain_only(input, "\t ") == 0)
|
|
||||||
add_history(input);
|
|
||||||
free(prompt);
|
free(prompt);
|
||||||
if (input == NULL)
|
if (input == NULL)
|
||||||
printf("exit");
|
printf("exit");
|
||||||
|
if (input != NULL && str_contain_only(input, "\t ") == 0)
|
||||||
|
add_history(input);
|
||||||
return (input);
|
return (input);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user