Skip to contentSkip to conversation

Correctly handle input files beginning with several newlines

PATCH New David Wagner 2 participants 2 messages Dec 21, 2011 – Jan 5, 2012 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH 9/10 Correctly handle input files beginning with several newlines

Also, fix some comments (minor)

---
 tools/mkenvimage.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)
tools/mkenvimage.c +5 -5
index 9899631..0c9194b 100644
@@ -224,18 +224,18 @@ int main(int argc, char **argv)
 	/* Replace newlines separating variables with \0 */
 	for (fp = 0, ep = 0 ; fp < filesize ; fp++) {
 		if (filebuf[fp] == '\n') {
-			if (fp == 0) {
+			if (ep == 0) {
 				/*
-				 * Newline at the beginning of the file ?
-				 * Ignore it.
+				 * Newlines@the beginning of the file ?
+				 * Ignore them.
 				 */
 				continue;
 			} else if (filebuf[fp-1] == '\\') {
 				/*
 				 * Embedded newline in a variable.
 				 *
-				 * The backslash was added to the envptr ;
-				 * rewind and replace it with a newline
+				 * The backslash was added to the envptr; rewind
+				 * and replace it with a newline
 				 */
 				ep--;
 				envptr[ep++] = '\n';
Signature · 1 line
1.7.5.4
#2 lore raw

PATCH 9/10 Correctly handle input files beginning with several newlines

Dear David Wagner,

Quoted 6 lines · In message <1324429169-10177-1-git-send-email-david.wagner@free-electrons.com>…

Also, fix some comments (minor)

---
 tools/mkenvimage.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 4 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Sorry, but my karma just ran over your dogma.