public inbox for b.a.t.m.a.n@lists.open-mesh.org
 help / color / mirror / Atom feed
* [B.A.T.M.A.N.] [PATCH] batctl: Fix JSON object output
@ 2011-04-23 14:34 Sven Eckelmann
  2011-04-25 23:16 ` Marek Lindner
  0 siblings, 1 reply; 2+ messages in thread
From: Sven Eckelmann @ 2011-04-23 14:34 UTC (permalink / raw)
  To: b.a.t.m.a.n

Each line is a single JSON object and has to start with '{' and no
spaces are allowed before it. Each pair has to be identified with a
string in double quotes.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
---
 vis.c |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/vis.c b/vis.c
index eb77872..adb12d0 100644
--- a/vis.c
+++ b/vis.c
@@ -126,33 +126,33 @@ static void json_print_tq(char *orig, char *from, const long tq)
 	int int_part = TQ_MAX_VALUE / tq;
 	int frac_part = (1000 * TQ_MAX_VALUE / tq) - (int_part * 1000);
 
-	printf("\t{ router : \"%s\", ",
+	printf("{ \"router\" : \"%s\", ",
 	       get_name_by_macstr(orig, (with_names ? USE_BAT_HOSTS : 0)));
-	printf("neighbor : \"%s\", label : \"%d.%03d\" }\n",
+	printf("\"neighbor\" : \"%s\", \"label\" : \"%d.%03d\" }\n",
 	       get_name_by_macstr(from, (with_names ? USE_BAT_HOSTS : 0)),
 	       int_part, frac_part);
 }
 
 static void json_print_HNA(char *orig, char *from)
 {
-	printf("\t{ router : \"%s\", ",
+	printf("{ \"router\" : \"%s\", ",
 	       get_name_by_macstr(orig, (with_names ? USE_BAT_HOSTS : 0)));
-	printf("gateway : \"%s\", label : \"HNA\" }\n",
+	printf("\"gateway\" : \"%s\", \"label\" : \"HNA\" }\n",
 	       get_name_by_macstr(from, (with_names ? USE_BAT_HOSTS : 0)));
 }
 
 static void json_print_1st(char *orig)
 {
-	printf("\t{ primary : \"%s\" }\n",
+	printf("{ \"primary\" : \"%s\" }\n",
 	       get_name_by_macstr(orig, (with_names ? USE_BAT_HOSTS : 0)));
 }
 
 static void json_print_2nd(char *orig, char *from)
 {
-	printf("\t{ secondary : \"%s\", ",
+	printf("{ \"secondary\" : \"%s\", ",
 	       get_name_by_macstr(from, (with_names ? USE_BAT_HOSTS : 0)));
 
-	printf("of : \"%s\" }\n",
+	printf("\"of\" : \"%s\" }\n",
 	       get_name_by_macstr(orig, (with_names ? USE_BAT_HOSTS : 0)));
 }
 
-- 
1.7.4.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [B.A.T.M.A.N.] [PATCH] batctl: Fix JSON object output
  2011-04-23 14:34 [B.A.T.M.A.N.] [PATCH] batctl: Fix JSON object output Sven Eckelmann
@ 2011-04-25 23:16 ` Marek Lindner
  0 siblings, 0 replies; 2+ messages in thread
From: Marek Lindner @ 2011-04-25 23:16 UTC (permalink / raw)
  To: The list for a Better Approach To Mobile Ad-hoc Networking

On Saturday 23 April 2011 16:34:00 Sven Eckelmann wrote:
> Each line is a single JSON object and has to start with '{' and no
> spaces are allowed before it. Each pair has to be identified with a
> string in double quotes.

Applied in revision 81bc728.

Thanks,
Marek

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-04-25 23:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-23 14:34 [B.A.T.M.A.N.] [PATCH] batctl: Fix JSON object output Sven Eckelmann
2011-04-25 23:16 ` Marek Lindner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox