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

18
util.h
View file

@ -22,26 +22,16 @@
/* string */
/**
* Marks the end of the current token, and move to the next one.
* Marks the end of the current token, and skip one and only one separator if present.
*/
static inline char* strtoken(char* s)
{
while (*s && *s != ' ')
++s;
if (*s)
*s++ = 0;
while (*s == ' ')
++s;
return s;
}
/**
* Move to the next token skipping any separator.
*/
static inline char* strskip(char* s)
{
while (*s == ' ')
if (*s) {
*s = 0;
++s;
}
return s;
}