Send the produced tables to stdout instead of to a static screen.
This can be used for sending the output to other programs or to a file.
-*-c*, *--cpu-stat* _mode_::
-Show per-cpu statistics by specified mode. Available modes are: *auto*, *enable*, *disable*. The default option *auto* detects the width of window, then shows the per-cpu statistics if the width of window is large enough to show a full line of statistics.
+*-c*, *--cpu-stat* _when_::
+Whether to show the per-CPU statistics. Possible arguments are: *auto*, *never*, *always*.
+The default is *auto*: the per-CPU statistics are shown when the window is wide enough
+for the full list of CPUs.
*-C*, *--cpu-list* _list_::
Specify cpus in list format to show.
fputs(USAGE_OPTIONS, stdout);
fputs(_(" -b, --batch send tables to stdout, not to a static screen\n"), stdout);
- fputs(_(" -c, --cpu-stat <mode> whether to show the per-cpu stats (auto|enable|disable)\n"), stdout);
+ fputs(_(" -c, --cpu-stat <when> whether to show the per-cpu stats (auto|never|always)\n"), stdout);
fputs(_(" -C, --cpu-list <list> show IRQs only for the specified cpus\n"), stdout);
fputs(_(" -d, --delay <secs> wait this number of seconds between updates\n"), stdout);
fputs(_(" -J, --json use JSON output format (implies --batch)\n"), stdout);
case 'c':
if (!strcmp(optarg, "auto"))
ctl->cpustat_mode = IRQTOP_CPUSTAT_AUTO;
- else if (!strcmp(optarg, "enable"))
- ctl->cpustat_mode = IRQTOP_CPUSTAT_ENABLE;
- else if (!strcmp(optarg, "disable"))
- ctl->cpustat_mode = IRQTOP_CPUSTAT_DISABLE;
else
- errx(EXIT_FAILURE, _("unsupported mode '%s'"), optarg);
+ ctl->cpustat_mode = IRQTOP_CPUSTAT_DISABLE - parse_switch(optarg,
+ _("unsupported argument"), "yes", "no",
+ "always", "never", "enable", "disable",
+ "on", "off", "1", "0", NULL);
break;
case 'C':
{