Skip to content

Commit

Permalink
Minor, whitespace adjustments in JSON output
Browse files Browse the repository at this point in the history
Signed-off-by: Joachim Wiberg <[email protected]>
  • Loading branch information
troglobit committed Mar 19, 2024
1 parent b3f35c3 commit 63ea327
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions src/bridge.c
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ void bridge_prop(FILE *fp, char *prop, int setval)

for (int i = 0; i < num; i++) {
logit(LOG_DEBUG, 0, "Array val: %s, index: %d", array[i], i);
fprintf(fp, "%s%s", i ? ", " : "", array[i]);
fprintf(fp, "%s%s", i ? ", " : " ", array[i]);
}

out:
Expand Down Expand Up @@ -390,9 +390,9 @@ void bridge_router_ports(FILE *fp)
logit(LOG_DEBUG, 0, "Found router port %s with %.2f s timeout\n", ifname, timer);
if (timer > 0.0 && !seen) {
if (json)
fprintf(fp, "%s\"%s\"", num ? ", " : "", ifname);
fprintf(fp, "%s\"%s\"", num ? ", " : " ", ifname);
else
fprintf(fp, "%s%s", num ? ", " : "", ifname);
fprintf(fp, "%s%s", num ? ", " : " ", ifname);
num++;
memcpy(prev_ifname, ifname, sizeof(prev_ifname));
}
Expand Down
18 changes: 9 additions & 9 deletions src/ipc.c
Original file line number Diff line number Diff line change
Expand Up @@ -409,21 +409,21 @@ static int show_igmp(FILE *fp)
show_status(fp);

if (json) {
fprintf(fp, ",\n%*s\"fast-leave-ports\": [ ", prefix, "");
fprintf(fp, ",\n%*s\"fast-leave-ports\": [", prefix, "");
bridge_prop(fp, "multicast_fast_leave", 1);
fprintf(fp, "],\n");
fprintf(fp, " ],\n");

fprintf(fp, "%*s\"multicast-router-ports\": [ ", prefix, "");
fprintf(fp, "%*s\"multicast-router-ports\": [", prefix, "");
bridge_router_ports(fp);
fprintf(fp, "],\n");
fprintf(fp, " ],\n");

fprintf(fp, "%*s\"multicast-flood-ports\": [ ", prefix, "");
fprintf(fp, "%*s\"multicast-flood-ports\": [", prefix, "");
bridge_prop(fp, "multicast_flood", 1);
fprintf(fp, "]");
fprintf(fp, " ]");
} else {
fprintf(fp, "%-23s : ", "Fast Leave Ports"); bridge_prop(fp, "multicast_fast_leave", 1);
fprintf(fp, "%-23s : ", "Router Ports"); bridge_router_ports(fp);
fprintf(fp, "%-23s : ", "Flood Ports"); bridge_prop(fp, "multicast_flood", 1);
fprintf(fp, "%-23s :", "Fast Leave Ports"); bridge_prop(fp, "multicast_fast_leave", 1);
fprintf(fp, "%-23s :", "Router Ports"); bridge_router_ports(fp);
fprintf(fp, "%-23s :", "Flood Ports"); bridge_prop(fp, "multicast_flood", 1);
fprintf(fp, "\n");
}

Expand Down

0 comments on commit 63ea327

Please sign in to comment.