Skip to content
Snippets Groups Projects
Commit c1e0374a authored by Daniel Salzman's avatar Daniel Salzman Committed by Gerrit Code Review
Browse files

knsupdate: add removing of trailing whitespaces before line processing

refs #2137

Change-Id: Ie9998e1d3a44adb1c613bdcfb664c7104671bc31
parent c2fadf49
No related branches found
No related tags found
No related merge requests found
......@@ -419,10 +419,23 @@ static int nsupdate_process_line(char *lp, int len, void *arg)
{
nsupdate_params_t *params = (nsupdate_params_t *)arg;
if (lp[len - 1] == '\n') lp[len - 1] = '\0'; /* Discard nline */
if (lp[0] == '\0' || lp[0] == ';') return KNOT_EOK; /* Empty/comment */
/* Remove trailing white space chars. */
for (int i = len - 1; i >= 0; i--) {
if (isspace((unsigned char)lp[i]) == 0) {
break;
}
lp[i] = '\0';
}
/* Check for empty line or comment. */
if (lp[0] == '\0' || lp[0] == ';') {
return KNOT_EOK;
}
int ret = tok_find(lp, cmd_array);
if (ret < 0) return ret; /* Syntax error */
if (ret < 0) {
return ret; /* Syntax error. */
}
const char *cmd = cmd_array[ret];
const char *val = tok_skipspace(lp + TOK_L(cmd));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment