From: Karel Zak Date: Wed, 4 Mar 2020 13:58:18 +0000 (+0100) Subject: irqtop: use -J for JSON X-Git-Tag: v2.36-rc1~196^2~23 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f5377ca454ebd6e7de5f4fbef41921a15069cdc3;p=thirdparty%2Futil-linux.git irqtop: use -J for JSON * add -J to the man page * add note about default output * be compatible with another util-linux tools and use -J Signed-off-by: Karel Zak --- diff --git a/sys-utils/irqtop.1 b/sys-utils/irqtop.1 index ebc67549c9..42ca91495a 100644 --- a/sys-utils/irqtop.1 +++ b/sys-utils/irqtop.1 @@ -8,6 +8,10 @@ irqtop \- utility to display kernel interrupt information Display kernel interrupt counter information in .BR top (1) style view. +.PP +The default output is subject to change. So whenever +possible, you should avoid using default outputs in your scripts. Always explicitly define expected columns +by using \fB\-\-columns\fR. .SH OPTIONS .TP .BR \-d ,\ \-\-delay\ \c @@ -16,6 +20,10 @@ Update interrupt output every .I seconds intervals. .TP +.BR \-J ,\ \-\-json +Use JSON output format. It's strongly recommended to use --columns to keep +the output stable. +.TP .BR \-o ,\ \-\-once Collect interrupt information and output it. This mode does not use ncurses, so the output can easily be redirected to a pipe, file, or such. diff --git a/sys-utils/irqtop.c b/sys-utils/irqtop.c index 5bdac92f6a..3c12530058 100644 --- a/sys-utils/irqtop.c +++ b/sys-utils/irqtop.c @@ -628,7 +628,7 @@ static void parse_args(struct irqtop_ctl *const ctl, int const argc, {"delay", required_argument, NULL, 'd'}, {"sort", required_argument, NULL, 's'}, {"once", no_argument, NULL, 'o'}, - {"json", no_argument, NULL, JSON_OPT}, + {"json", no_argument, NULL, 'J'}, {"columns", required_argument, NULL, COLUMNS_OPT}, {"help", no_argument, NULL, 'h'}, {"version", no_argument, NULL, 'V'}, @@ -636,7 +636,7 @@ static void parse_args(struct irqtop_ctl *const ctl, int const argc, }; int o; - while ((o = getopt_long(argc, argv, "d:os:hV", longopts, NULL)) != -1) { + while ((o = getopt_long(argc, argv, "d:os:hJV", longopts, NULL)) != -1) { switch (o) { case 'd': { @@ -655,7 +655,7 @@ static void parse_args(struct irqtop_ctl *const ctl, int const argc, ctl->run_once = 1; ctl->request_exit = 1; break; - case JSON_OPT: + case 'J': ctl->json = 1; ctl->run_once = 1; ctl->request_exit = 1;