mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-03-18 13:11:31 +00:00
tools: env: fw_parse_script: simplify removal of newline/carriage return
fgets returns when the first '\n' is found Signed-off-by: Andreas Fenkart <andreas.fenkart@digitalstrom.com>
This commit is contained in:
parent
938c29ff41
commit
69067a34b1
1 changed files with 4 additions and 6 deletions
10
tools/env/fw_env.c
vendored
10
tools/env/fw_env.c
vendored
|
@ -566,14 +566,12 @@ int fw_parse_script(char *fname)
|
|||
}
|
||||
|
||||
/* Drop ending line feed / carriage return */
|
||||
while (len > 0 && (dump[len - 1] == '\n' ||
|
||||
dump[len - 1] == '\r')) {
|
||||
dump[len - 1] = '\0';
|
||||
len--;
|
||||
}
|
||||
dump[--len] = '\0';
|
||||
if (len && dump[len - 1] == '\r')
|
||||
dump[--len] = '\0';
|
||||
|
||||
/* Skip comment or empty lines */
|
||||
if ((len == 0) || dump[0] == '#')
|
||||
if (len == 0 || dump[0] == '#')
|
||||
continue;
|
||||
|
||||
/*
|
||||
|
|
Loading…
Add table
Reference in a new issue