output/csv: Drop last separators as needed.
This commit is contained in:
parent
ee38c8ba3e
commit
e36aae989c
|
@ -108,6 +108,9 @@ static int init(struct sr_output *o)
|
|||
continue;
|
||||
g_string_append_printf(ctx->header, " %s,", probe->name);
|
||||
}
|
||||
if (o->sdi->probes)
|
||||
/* Drop last separator. */
|
||||
g_string_truncate(ctx->header, ctx->header->len - 1);
|
||||
g_string_append_printf(ctx->header, "\n");
|
||||
|
||||
return SR_OK;
|
||||
|
@ -150,7 +153,7 @@ static int receive(struct sr_output *o, const struct sr_dev_inst *sdi,
|
|||
g_string_append_c(*out, c ? '1' : '0');
|
||||
g_string_append_c(*out, ctx->separator);
|
||||
}
|
||||
if (i && j) {
|
||||
if (j) {
|
||||
/* Drop last separator. */
|
||||
g_string_truncate(*out, (*out)->len - 1);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue