mirror of
https://github.com/amadvance/snapraid.git
synced 2026-10-26 10:51:54 -04:00
Allow empty lines in the configuration file.
This commit is contained in:
parent
371a9ab667
commit
7acaf53dc9
3 changed files with 5 additions and 4 deletions
1
state.c
1
state.c
|
|
@ -111,6 +111,7 @@ void state_config(struct snapraid_state* state, const char* path, int verbose, i
|
|||
/* here we use strtoken_trim() to eat extra spaces inserted by the user */
|
||||
|
||||
/* skip ending spaces */
|
||||
--ret;
|
||||
while (ret>0 && isspace(s[ret-1])) {
|
||||
--ret;
|
||||
s[ret] = 0;
|
||||
|
|
|
|||
4
util.c
4
util.c
|
|
@ -40,7 +40,7 @@ int strgets(char* s, unsigned size, FILE* f)
|
|||
*i++ = c;
|
||||
|
||||
if (i == send) {
|
||||
return -1;
|
||||
return -1; /* return error if the buffer is full */
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -64,7 +64,7 @@ int strgets(char* s, unsigned size, FILE* f)
|
|||
|
||||
*i = 0;
|
||||
|
||||
return i - s;
|
||||
return i - s + 1;
|
||||
}
|
||||
|
||||
int stru32(const char* s, uint32_t* value)
|
||||
|
|
|
|||
4
util.h
4
util.h
|
|
@ -47,7 +47,7 @@ static inline char* strtoken_trim(char* s)
|
|||
++s;
|
||||
}
|
||||
|
||||
/* skip ending spaces */
|
||||
/* skip spaces */
|
||||
while (*s && isspace(*s))
|
||||
++s;
|
||||
|
||||
|
|
@ -56,7 +56,7 @@ static inline char* strtoken_trim(char* s)
|
|||
|
||||
/**
|
||||
* Gets a text line from a file.
|
||||
* Returns -1 on error, 0 on oef, or the number of chars read.
|
||||
* Returns -1 on error, 0 on OEF, or the number of chars returned in the buffer, including the ending 0.
|
||||
*/
|
||||
int strgets(char* s, unsigned size, FILE* f);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue