Fixes support of file names starting or ending with a space.

This commit is contained in:
Andrea Mazzoleni 2011-05-24 21:03:30 +02:00
parent 58f191ef1f
commit 35f3c092ed
8 changed files with 65 additions and 23 deletions

5
util.c
View file

@ -58,9 +58,10 @@ int strgets(char* s, unsigned size, FILE* f)
return 0;
}
/* remove ending spaces */
while (i != s && isspace(i[-1]))
/* remove ending carrige return to support the Windows CR+LF format */
if (i != s && i[-1] == '\r')
--i;
*i = 0;
return 1;