Ignores spaces at the end of the line in the configuration file.

This commit is contained in:
Andrea Mazzoleni 2011-07-06 19:38:05 +02:00
parent 1876e2be50
commit c69590ffbe
3 changed files with 56 additions and 34 deletions

21
util.c
View file

@ -166,7 +166,7 @@ int sgettok(STREAM* f, char* str, int size)
*i = 0;
return 0;
return i - str;
}
int sgetline(STREAM* f, char* str, int size)
@ -219,7 +219,24 @@ int sgetline(STREAM* f, char* str, int size)
*i = 0;
return 0;
return i - str;
}
int sgetlasttok(STREAM* f, char* str, int size)
{
int ret;
ret = sgetline(f, str, size);
if (ret < 0)
return ret;
while (ret > 0 && (str[ret-1] == ' ' || str[ret-1] == '\t')) {
--ret;
}
str[ret] = 0;
return ret;
}
int sgetu32(STREAM* f, uint32_t* value)