summaryrefslogtreecommitdiffstats
path: root/sys-utils/rfkill.c
diff options
context:
space:
mode:
authorKarel Zak2018-04-18 16:08:15 +0200
committerKarel Zak2018-04-18 16:08:15 +0200
commit2d6d789b3aaf449b74036b22917599df225d28f8 (patch)
tree4984f78c6d5c5f0f28a95799cddb5f89f5a952b0 /sys-utils/rfkill.c
parentlsns: use scols_column_set_json_type() (diff)
downloadkernel-qcow2-util-linux-2d6d789b3aaf449b74036b22917599df225d28f8.tar.gz
kernel-qcow2-util-linux-2d6d789b3aaf449b74036b22917599df225d28f8.tar.xz
kernel-qcow2-util-linux-2d6d789b3aaf449b74036b22917599df225d28f8.zip
rfkill: use scols_column_set_json_type()
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'sys-utils/rfkill.c')
-rw-r--r--sys-utils/rfkill.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/sys-utils/rfkill.c b/sys-utils/rfkill.c
index 9c52fac3a..57e1dddab 100644
--- a/sys-utils/rfkill.c
+++ b/sys-utils/rfkill.c
@@ -462,9 +462,16 @@ static void rfkill_list_init(struct control *ctrl)
for (i = 0; i < (size_t) ncolumns; i++) {
const struct colinfo *col = get_column_info(i);
+ struct libscols_column *cl;
- if (!scols_table_new_column(ctrl->tb, col->name, col->whint, col->flags))
+ cl = scols_table_new_column(ctrl->tb, col->name, col->whint, col->flags);
+ if (!cl)
err(EXIT_FAILURE, _("failed to allocate output column"));
+ if (ctrl->json) {
+ int id = get_column_id(i);
+ if (id == COL_ID)
+ scols_column_set_json_type(cl, SCOLS_JSON_NUMBER);
+ }
}
}