Commit e72be8947e129f5ab274c0a9f235d2cc0014b2ea
Added support for comments in input to mkenvimage.
This patch adds support for comments in the input to mkenvimage, i.e. in the environment source: All lines starting with a # in the firs column will be ignored. Additionally empty lines will also be ignored. Signed-off-by: Dominik Muth <dominik.muth@bkvibro.com>
Showing 1 changed file with 8 additions and 3 deletions Side-by-side Diff
... | ... | @@ -37,6 +37,8 @@ |
37 | 37 | "\t\tkey1=value1\n" |
38 | 38 | "\t\tkey2=value2\n" |
39 | 39 | "\t\t...\n" |
40 | + "\tEmpty lines are skipped, and lines with a # in the first\n" | |
41 | + "\tcolumn are treated as comments (also skipped).\n" | |
40 | 42 | "\t-r : the environment has multiple copies in flash\n" |
41 | 43 | "\t-b : the target is big endian (default is little endian)\n" |
42 | 44 | "\t-p <byte> : fill the image with <byte> bytes instead of 0xff bytes\n" |
43 | 45 | |
... | ... | @@ -221,10 +223,9 @@ |
221 | 223 | /* Replace newlines separating variables with \0 */ |
222 | 224 | for (fp = 0, ep = 0 ; fp < filesize ; fp++) { |
223 | 225 | if (filebuf[fp] == '\n') { |
224 | - if (ep == 0) { | |
226 | + if (fp == 0 || filebuf[fp-1] == '\n') { | |
225 | 227 | /* |
226 | - * Newlines at the beginning of the file ? | |
227 | - * Ignore them. | |
228 | + * Skip empty lines. | |
228 | 229 | */ |
229 | 230 | continue; |
230 | 231 | } else if (filebuf[fp-1] == '\\') { |
... | ... | @@ -240,6 +241,10 @@ |
240 | 241 | /* End of a variable */ |
241 | 242 | envptr[ep++] = '\0'; |
242 | 243 | } |
244 | + } else if ((fp == 0 || filebuf[fp-1] == '\n') && filebuf[fp] == '#') { | |
245 | + /* Comment, skip the line. */ | |
246 | + while (++fp < filesize && filebuf[fp] != '\n') | |
247 | + continue; | |
243 | 248 | } else { |
244 | 249 | envptr[ep++] = filebuf[fp]; |
245 | 250 | } |
-
mentioned in commit 80ee01
-
mentioned in commit 80ee01
-
mentioned in commit 80ee01
-
mentioned in commit 80ee01
-
mentioned in commit 80ee01
-
mentioned in commit 80ee01
-
mentioned in commit 80ee01
-
mentioned in commit 80ee01
-
mentioned in commit 80ee01
-
mentioned in commit 80ee01
-
mentioned in commit 80ee01
-
mentioned in commit 80ee01
-
mentioned in commit 80ee01
-
mentioned in commit 80ee01
-
mentioned in commit 80ee01
-
mentioned in commit 80ee01
-
mentioned in commit 80ee01
-
mentioned in commit 80ee01
-
mentioned in commit 80ee01
-
mentioned in commit 80ee01
-
mentioned in commit 80ee01
-
mentioned in commit 80ee01
-
mentioned in commit 80ee01
-
mentioned in commit 80ee01
-
mentioned in commit 80ee01
-
mentioned in commit 80ee01
-
mentioned in commit 80ee01
-
mentioned in commit 80ee01
-
mentioned in commit 80ee01
-
mentioned in commit 80ee01
-
mentioned in commit 80ee01
-
mentioned in commit 80ee01
-
mentioned in commit 80ee01
-
mentioned in commit 80ee01
-
mentioned in commit 80ee01
-
mentioned in commit 80ee01
-
mentioned in commit 80ee01
-
mentioned in commit 80ee01
-
mentioned in commit 80ee01
-
mentioned in commit 80ee01
-
mentioned in commit 80ee01
-
mentioned in commit 80ee01
-
mentioned in commit 80ee01