When specifying the \fIlist\fP argument, the string of option, equal sign (=), and
\fIlist\fP must not contain any blanks or other whitespace.
Examples: '\fB\-C=NAME,ONE-SIZE\fP' or '\fB\-\-caches=NAME,ONE-SIZE\fP'.
+
+The default list of columns may be extended if list is specified in the format +list
+(e.g., lscpu -C=+ALLOC-POLICY).
.TP
.BR \-c , " \-\-offline"
Limit the output to offline CPUs.
When specifying the \fIlist\fP argument, the string of option, equal sign (=), and
\fIlist\fP must not contain any blanks or other whitespace.
Examples: '\fB\-e=cpu,node\fP' or '\fB\-\-extended=cpu,node\fP'.
+
+The default list of columns may be extended if list is specified in the format +list
+(e.g., lscpu -e=+MHZ).
.TP
.BR \-h , " \-\-help"
Display help text and exit.
When specifying the \fIlist\fP argument, the string of option, equal sign (=), and
\fIlist\fP must not contain any blanks or other whitespace.
Examples: '\fB\-p=cpu,node\fP' or '\fB\-\-parse=cpu,node\fP'.
+
+The default list of columns may be extended if list is specified in the format +list
+(e.g., lscpu -p=+MHZ).
.TP
.BR \-s , " \-\-sysroot " \fIdirectory\fP
Gather CPU data for a Linux instance other than the instance from which the
int c, all = 0;
int columns[ARRAY_SIZE(coldescs_cpu)], ncolumns = 0;
int cpu_modifier_specified = 0;
+ char *outarg = NULL;
size_t i;
enum {
OPT_OUTPUT_ALL = CHAR_MAX + 1,
if (optarg) {
if (*optarg == '=')
optarg++;
- ncolumns = string_to_idarray(optarg,
- columns, ARRAY_SIZE(columns),
- cache_column_name_to_id);
- if (ncolumns < 0)
- return EXIT_FAILURE;
+ outarg = optarg;
}
cxt->mode = LSCPU_OUTPUT_CACHES;
break;
if (optarg) {
if (*optarg == '=')
optarg++;
- ncolumns = string_to_idarray(optarg,
- columns, ARRAY_SIZE(columns),
- cpu_column_name_to_id);
- if (ncolumns < 0)
- return EXIT_FAILURE;
+ outarg = optarg;
}
cxt->mode = c == 'p' ? LSCPU_OUTPUT_PARSABLE : LSCPU_OUTPUT_READABLE;
break;
columns[ncolumns++] = COL_CACHE_PHYLINE;
columns[ncolumns++] = COL_CACHE_COHERENCYSIZE;
}
+ if (outarg && string_add_to_idarray(outarg, columns,
+ ARRAY_SIZE(columns),
+ &ncolumns, cache_column_name_to_id) < 0)
+ return EXIT_FAILURE;
+
print_caches_readable(cxt, columns, ncolumns);
break;
case LSCPU_OUTPUT_READABLE:
columns[ncolumns++] = COL_CPU_MINMHZ;
}
}
+ if (outarg && string_add_to_idarray(outarg, columns,
+ ARRAY_SIZE(columns),
+ &ncolumns, cpu_column_name_to_id) < 0)
+ return EXIT_FAILURE;
print_cpus_readable(cxt, columns, ncolumns);
break;
case LSCPU_OUTPUT_PARSABLE:
columns[ncolumns++] = COL_CPU_CACHE;
cxt->show_compatible = 1;
}
+ if (outarg && string_add_to_idarray(outarg, columns,
+ ARRAY_SIZE(columns),
+ &ncolumns, cpu_column_name_to_id) < 0)
+ return EXIT_FAILURE;
+
print_cpus_parsable(cxt, columns, ncolumns);
break;
}