mirror of
https://github.com/amadvance/snapraid.git
synced 2026-11-22 07:56:33 -05:00
Trims extra spaces in the configuration file.
This commit is contained in:
parent
2aa36a5df5
commit
09b8a3cd7c
4 changed files with 36 additions and 10 deletions
21
util.h
21
util.h
|
|
@ -35,9 +35,28 @@ static inline char* strtoken(char* s)
|
|||
return s;
|
||||
}
|
||||
|
||||
/**
|
||||
* Like strtoken() but trim spaces.
|
||||
*/
|
||||
static inline char* strtoken_trim(char* s)
|
||||
{
|
||||
while (*s && !isspace(*s))
|
||||
++s;
|
||||
if (*s) {
|
||||
*s = 0;
|
||||
++s;
|
||||
}
|
||||
|
||||
/* skip ending spaces */
|
||||
while (*s && isspace(*s))
|
||||
++s;
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a text line from a file.
|
||||
* Returns -1 on error, 0 on oef, and 1 if more data is available.
|
||||
* Returns -1 on error, 0 on oef, or the number of chars read.
|
||||
*/
|
||||
int strgets(char* s, unsigned size, FILE* f);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue