diff --git a/CLI/CLI.c b/CLI/CLI.c index 66644ca..c474ec8 100644 --- a/CLI/CLI.c +++ b/CLI/CLI.c @@ -96,9 +96,10 @@ void CLI_PrintHistory() { char** historyList; int ret = History_getFullHistory(History, &historyList); + int i; if (ret >= 0) { - for (int i=0; *(historyList + i) != NULL; i++) + for (i=0; *(historyList + i) != NULL; i++) { printf("%03i: %s\n", i, *(historyList + i)); } @@ -263,6 +264,7 @@ bool CLI_charIn(char c) FIFOBuffChar_delete(fifo); break; + case 8: case 127: // backspace if (FIFOBuffChar_pop(FIFO)) { // pop something of the buffer diff --git a/History/History.c b/History/History.c index 10d60d9..bc52e05 100644 --- a/History/History.c +++ b/History/History.c @@ -153,7 +153,8 @@ int History_getFullHistory(History_t* history, char*** list) *list = malloc(sizeof(char**) * (History_getSize(history) + 1)); History_element_t* el = history->FirstEl_p; - for (int i = 0; (i < History_getSize(history)-1) && (retCode >= 0); i++) + int i; + for (i = 0; (i < History_getSize(history)-1) && (retCode >= 0); i++) { *((*list) + i) = el->line; if (el->nextEl_p == NULL) @@ -182,7 +183,8 @@ int History_getCurrPos(History_t* history) if (history->CurrEl_p != NULL) { History_element_t* el = history->FirstEl_p; - for (int i = 0; (el != history->CurrEl_p) && (retCode >= 0); i++) + int i; + for (i = 0; (el != history->CurrEl_p) && (retCode >= 0); i++) { if (el->nextEl_p == NULL) {