[v2,2/3] batctl: Fix skipped substitutions of mac addresses with a following ', '

Message ID 1290514400-6887-3-git-send-email-linus.luessing@ascom.ch (mailing list archive)
State Accepted, archived
Commit 6a9173fdca7b271115c719232b88f86891f6d336
Headers

Commit Message

Linus Lüssing Nov. 23, 2010, 12:13 p.m. UTC
  When batctl does not find a matching name for a given mac address in the
bat-hosts file, then it unfortunately removes the following ',' instead
of leaving the string unmodified. batctl bisect is then not able to find
the mac address anymore. This commit fixes this issue.

Signed-off-by: Linus Lüssing <linus.luessing@ascom.ch>
---
 functions.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)
  

Patch

diff --git a/functions.c b/functions.c
index ce046ba..9b1e22b 100644
--- a/functions.c
+++ b/functions.c
@@ -201,16 +201,16 @@  read:
 				/* keep table format */
 				printf("%17s", bat_host->name);
 
-			if (extra_char != '\0')
-				printf("%c", extra_char);
-
-			printf(" ");
 			goto written;
 
 print_plain_buff:
-			printf("%s ", buff_ptr);
+			printf("%s", buff_ptr);
 
 written:
+			if (extra_char != '\0')
+				printf("%c", extra_char);
+
+			printf(" ");
 			buff_ptr = space_ptr + 1;
 		}