From: Eric S. Raymond Date: Mon, 4 Apr 2022 21:51:06 +0000 (-0400) Subject: Address Gitlib issu #57: Resume can't open save file... X-Git-Tag: 1.10~14 X-Git-Url: https://jxself.org/git/?a=commitdiff_plain;h=0799bc2f7981e9138c15c801eb46e61e635e1c60;p=open-adventure.git Address Gitlib issu #57: Resume can't open save file... ...when auto-completed filename is followed by a space character. --- diff --git a/saveresume.c b/saveresume.c index 783e671..15d14c1 100644 --- a/saveresume.c +++ b/saveresume.c @@ -108,6 +108,9 @@ int resume(void) while (fp == NULL) { char* name = readline("\nFile name: "); + // Autocomplete can leave the input with an extra traoling space. + if (name != NULL && strlen(name) > 0 && name[strlen(name) - 1] == ' ') + name[strlen(name) - 1] = '\0'; if (name == NULL) return GO_TOP; fp = fopen(name, READ_MODE);