]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
lsfd: use SCOLS_JSON_FLOAT
authorKarel Zak <kzak@redhat.com>
Thu, 2 Nov 2023 12:22:00 +0000 (13:22 +0100)
committerKarel Zak <kzak@redhat.com>
Mon, 20 Nov 2023 21:25:47 +0000 (22:25 +0100)
* use a new SCOLS_JSON_FLOAT
* add "float" to the columns description
* add space before '?' operator

Reported-by: Masatake YAMATO <yamato@redhat.com>
Addresses: https://github.com/util-linux/util-linux/pull/2531#issuecomment-1780164195
Signed-off-by: Karel Zak <kzak@redhat.com>
misc-utils/lsfd.c

index d01bb7bfe84f07d288341c8eed66ce9f56a16b48..bac2bac3ca1506f820b950bfdc5b6d6b6708b07a 100644 (file)
@@ -331,10 +331,10 @@ static const struct colinfo infos[] = {
                                   0,   SCOLS_FL_RIGHT, SCOLS_JSON_STRING,
                                   N_("clockid") },
        [COL_TIMERFD_INTERVAL] = { "TIMERFD.INTERVAL",
-                                  0,   SCOLS_FL_RIGHT, SCOLS_JSON_NUMBER,
+                                  0,   SCOLS_FL_RIGHT, SCOLS_JSON_FLOAT,
                                   N_("interval") },
        [COL_TIMERFD_REMAINING]= { "TIMERFD.REMAINING",
-                                  0,   SCOLS_FL_RIGHT, SCOLS_JSON_NUMBER,
+                                  0,   SCOLS_FL_RIGHT, SCOLS_JSON_FLOAT,
                                   N_("remaining time") },
        [COL_TUN_IFACE]        = { "TUN.IFACE",
                                   0,   SCOLS_FL_RIGHT, SCOLS_JSON_STRING,
@@ -1796,10 +1796,11 @@ static void __attribute__((__noreturn__)) list_colunms(FILE *out)
        fputs(USAGE_COLUMNS, out);
        for (size_t i = 0; i < ARRAY_SIZE(infos); i++)
                fprintf(out, " %20s  %-10s%s\n", infos[i].name,
-                       infos[i].json_type == SCOLS_JSON_STRING?  "<string>":
-                       infos[i].json_type == SCOLS_JSON_ARRAY_STRING?  "<string>":
-                       infos[i].json_type == SCOLS_JSON_ARRAY_NUMBER?  "<string>":
-                       infos[i].json_type == SCOLS_JSON_NUMBER?  "<number>":
+                       infos[i].json_type == SCOLS_JSON_STRING ?  "<string>":
+                       infos[i].json_type == SCOLS_JSON_ARRAY_STRING ?  "<string>":
+                       infos[i].json_type == SCOLS_JSON_ARRAY_NUMBER ?  "<string>":
+                       infos[i].json_type == SCOLS_JSON_NUMBER ?  "<integer>":
+                       infos[i].json_type == SCOLS_JSON_FLOAT ?  "<float>":
                        "<boolean>",
                        _(infos[i].help));
        exit(EXIT_SUCCESS);