parent
af2081caaf
commit
a862f8557e
2 changed files with 17 additions and 0 deletions
|
@ -40,6 +40,8 @@ int native_command(char *command[])
|
|||
change_dir(command);
|
||||
else if (!strcmp(command[0], "exit"))
|
||||
thus_exit(command);
|
||||
else if (!strcmp(command[0], "export"))
|
||||
thus_export(command);
|
||||
else if (!strcmp(command[0], "ouï-dire") || !strcmp(command[0], "oui-dire")
|
||||
|| !strcmp(command[0], "echo"))
|
||||
{
|
||||
|
@ -98,6 +100,20 @@ void thus_exit(char *command[])
|
|||
need_exit = 1;
|
||||
}
|
||||
|
||||
void thus_export(char *command[])
|
||||
{
|
||||
char f = '=';
|
||||
char *token = strtok(command[1], &f);
|
||||
char *var = token;
|
||||
token = strtok(NULL, &f);
|
||||
char *val;
|
||||
if (token == NULL)
|
||||
val = "";
|
||||
else
|
||||
val = token;
|
||||
setenv(var, val, 1);
|
||||
}
|
||||
|
||||
void ctrl_c_handler()
|
||||
{
|
||||
//kill(pid, SIGTERM);
|
||||
|
|
|
@ -26,6 +26,7 @@ extern int need_exit; /* 0 = pas besoin de sortir, 1 = commande exit appelée */
|
|||
int native_command(char *command[]);
|
||||
void change_dir(char *command[]);
|
||||
void thus_exit(char *command[]);
|
||||
void thus_export(char *command[]);
|
||||
void ctrl_c_handler();
|
||||
void error(int code, int type, char *message);
|
||||
|
||||
|
|
Loading…
Reference in a new issue