From patchwork Sat Apr 23 14:34:00 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Eckelmann X-Patchwork-Id: 898 Return-Path: Received: from v3-1039.vlinux.de (narfation.org [79.140.41.39]) by open-mesh.org (Postfix) with ESMTPS id A8F691541B3 for ; Sat, 23 Apr 2011 16:34:06 +0200 (CEST) Authentication-Results: open-mesh.org; dkim=pass (1024-bit key) header.i=@narfation.org; dkim-adsp=pass Received: from sven-desktop.home.narfation.org (unknown [89.246.169.14]) by v3-1039.vlinux.de (Postfix) with ESMTPSA id 2FC74940D8; Sat, 23 Apr 2011 16:34:12 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=narfation.org; s=mail; t=1303569252; bh=RyF4C+hbqHAc40UEqzk60LX4v49bSmv9qqEQ7HSeoqU=; h=From:To:Cc:Subject:Date:Message-Id; b=Pxfs95S9mMSe5EEL4fGFcgcMlkcl665OCAFAFbJrHCZGzXLChG1Tfm0Vt/XLGaI1C 2+gxqke5hnMll6Nnqfq2wAlHq1kFPiVD1198GcomIZsUwLAmFIiodBN724BAHfDssb ryHsOA4XJ9bXyKBOZilBRkQbF06ae34Ol8uVevf4= From: Sven Eckelmann To: b.a.t.m.a.n@lists.open-mesh.org Date: Sat, 23 Apr 2011 16:34:00 +0200 Message-Id: <1303569240-31956-1-git-send-email-sven@narfation.org> X-Mailer: git-send-email 1.7.4.4 Subject: [B.A.T.M.A.N.] [PATCH] batctl: Fix JSON object output X-BeenThere: b.a.t.m.a.n@lists.open-mesh.org X-Mailman-Version: 2.1.13 Precedence: list Reply-To: The list for a Better Approach To Mobile Ad-hoc Networking List-Id: The list for a Better Approach To Mobile Ad-hoc Networking List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Apr 2011 14:34:07 -0000 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 --- 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))); }