]> www.infradead.org Git - users/sagi/nvme-cli.git/commitdiff
nvme: disable output-format option json value without json-c
authorTokunori Ikegami <ikegami.t@gmail.com>
Wed, 18 Dec 2024 16:11:10 +0000 (01:11 +0900)
committerDaniel Wagner <wagi@monom.org>
Wed, 18 Dec 2024 16:55:40 +0000 (17:55 +0100)
Since only json print codes work with the json-c library.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
nvme.c

diff --git a/nvme.c b/nvme.c
index 0c6dac308d0b3ca399038a2be9a273baad9c8706..e10653ac211b806742aa25f1738b9f75c4b1178c 100644 (file)
--- a/nvme.c
+++ b/nvme.c
@@ -185,7 +185,11 @@ static struct program nvme = {
        .extensions = &builtin,
 };
 
+#ifdef CONFIG_JSONC
 const char *output_format = "Output format: normal|json|binary";
+#else /* CONFIG_JSONC */
+const char *output_format = "Output format: normal|binary";
+#endif /* CONFIG_JSONC */
 const char *timeout = "timeout value, in milliseconds";
 const char *verbose = "Increase output verbosity";
 
@@ -480,8 +484,10 @@ int validate_output_format(const char *format, nvme_print_flags_t *flags)
 
        if (!strcmp(format, "normal"))
                f = NORMAL;
+#ifdef CONFIG_JSONC
        else if (!strcmp(format, "json"))
                f = JSON;
+#endif /* CONFIG_JSONC */
        else if (!strcmp(format, "binary"))
                f = BINARY;
        else