diff --git a/src/userinput.c b/src/userinput.c index c944a1f..9e7e51c 100644 --- a/src/userinput.c +++ b/src/userinput.c @@ -59,6 +59,11 @@ void trimRight(char *input) { } } +void trim(char *input) { + trimLeft(input); + trimRight(input); +} + char *readInput() { if (fakeInput != NULL) { if (fakeInput[0] == NULL) { @@ -88,8 +93,7 @@ char *readInput() { } while(c != '\n' && c != EOF); buffer[index - 1] = '\0'; - trimLeft(buffer); - trimRight(buffer); + trim(buffer); return buffer; }