Browse Source

refactoring: combined trimLeft and trimRight in trim

remotes/origin/userinput
TheUltimateOptimist 11 months ago
parent
commit
8c334ca905
  1. 8
      src/userinput.c

8
src/userinput.c

@ -59,6 +59,11 @@ void trimRight(char *input) {
} }
} }
void trim(char *input) {
trimLeft(input);
trimRight(input);
}
char *readInput() { char *readInput() {
if (fakeInput != NULL) { if (fakeInput != NULL) {
if (fakeInput[0] == NULL) { if (fakeInput[0] == NULL) {
@ -88,8 +93,7 @@ char *readInput() {
} }
while(c != '\n' && c != EOF); while(c != '\n' && c != EOF);
buffer[index - 1] = '\0'; buffer[index - 1] = '\0';
trimLeft(buffer);
trimRight(buffer);
trim(buffer);
return buffer; return buffer;
} }

Loading…
Cancel
Save