From: Eric S. Raymond Date: Tue, 21 Mar 2023 16:30:39 +0000 (-0400) Subject: Trim resume file names as required. X-Git-Url: https://jxself.org/git/?a=commitdiff_plain;h=0a63b5e2d6282aae6f6952b5247a319a1030b7c7;p=open-adventure.git Trim resume file names as required. --- diff --git a/misc.c b/misc.c index 9e18c74..0725ab5 100644 --- a/misc.c +++ b/misc.c @@ -994,6 +994,8 @@ L10: fclose(F); L20: printf("\nFile name: "); IGNORE(fgets(NAME, sizeof(NAME), stdin)); + if (NAME[strlen(NAME)-1] == '\n') + NAME[strlen(NAME)-1] = '\0'; F=fopen(NAME,(IN ? READ_MODE : WRITE_MODE)); if(F == NULL) {printf("Can't open file, try again.\n"); goto L20;} return;