From 7eada756e5f19108fe989e7d9e4854c57877e637 Mon Sep 17 00:00:00 2001 From: klmp200 Date: Thu, 18 May 2017 02:09:44 +0200 Subject: [PATCH] =?UTF-8?q?Vrai=20op=C3=A9rateur=20ET=20et=20impl=C3=A9men?= =?UTF-8?q?tation=20du=20reverse=20ET?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- fish_shell/fish_commands.c | 2 +- fish_shell/fish_core.c | 8 ++++++++ fish_shell/fish_types.h | 3 ++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/fish_shell/fish_commands.c b/fish_shell/fish_commands.c index 7c3e40d..18d45b4 100644 --- a/fish_shell/fish_commands.c +++ b/fish_shell/fish_commands.c @@ -55,7 +55,7 @@ int fishHelp(WordArray *args) { } int fishExit(WordArray *args) { - freeWordArray(args); + args->size = args->size; return EXIT_SIGNAL; } diff --git a/fish_shell/fish_core.c b/fish_shell/fish_core.c index 922b4f6..1532aa1 100644 --- a/fish_shell/fish_core.c +++ b/fish_shell/fish_core.c @@ -171,6 +171,12 @@ int fishExecute(WordList *list) { if (splited != NULL) freeWordList(splited); } break; + case REVERSE_AND: + if (signal) signal = fishExecute(splited); + else { + if (splited != NULL) freeWordList(splited); + } + break; case OR: signal = fishExecute(splited); break; @@ -194,11 +200,13 @@ int loadRightCommand(WordArray *array){ WordList * parseWordList(WordList *list, shell_operator *an_operator) { char *op_str[] = { + (char*) ";", (char*) "||", (char*) "&&" }; shell_operator op[] = { OR, + REVERSE_AND, AND }; WordList *newList = NULL; diff --git a/fish_shell/fish_types.h b/fish_shell/fish_types.h index 860efa5..cef1a74 100644 --- a/fish_shell/fish_types.h +++ b/fish_shell/fish_types.h @@ -14,7 +14,8 @@ typedef enum { PIPE, BACKGROUND_PROCESS, AND, - OR + OR, + REVERSE_AND } shell_operator ; typedef struct {