Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(573)

Unified Diff: utility/crossystem_main.c

Issue 6824020: Add --all option to crossystem to print normally-hidden fields (Closed) Base URL: ssh://gitrw.chromium.org:9222/vboot_reference.git@master
Patch Set: Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: utility/crossystem_main.c
diff --git a/utility/crossystem_main.c b/utility/crossystem_main.c
index 1150cd08ca58dc25888d850f7db3a00beb9b93a8..7289ad1de85c81e8f488b527b53e8d58cccf4692 100644
--- a/utility/crossystem_main.c
+++ b/utility/crossystem_main.c
@@ -81,8 +81,9 @@ void PrintHelp(const char *progname) {
const Param *p;
printf("\nUsage:\n"
- " %s\n"
+ " %s [--all]\n"
" Prints all parameters with descriptions and current values.\n"
+ " If --all is specified, prints even normally hidden fields.\n"
" %s [param1 [param2 [...]]]\n"
" Prints the current value(s) of the parameter(s).\n"
" %s [param1=value1] [param2=value2 [...]]]\n"
@@ -173,17 +174,18 @@ int PrintParam(const Param* p) {
}
-/* Print all parameters with descriptions,
+/* Print all parameters with descriptions. If force_all!=0, prints even
+ * parameters that specify the NO_PRINT_ALL flag.
*
* Returns 0 if success, non-zero if error. */
-int PrintAllParams(void) {
+int PrintAllParams(int force_all) {
const Param* p;
int retval = 0;
char buf[MAX_STRING];
const char* value;
for (p = sys_param_list; p->name; p++) {
- if (p->flags & NO_PRINT_ALL)
+ if (0 == force_all && (p->flags & NO_PRINT_ALL))
continue;
if (p->flags & IS_STRING) {
value = VbGetSystemPropertyString(p->name, buf, sizeof(buf));
@@ -215,7 +217,10 @@ int main(int argc, char* argv[]) {
/* If no args specified, print all params */
if (argc == 1)
- return PrintAllParams();
+ return PrintAllParams(0);
+ /* --all or -a prints all params including normally hidden ones */
+ if (!strcasecmp(argv[1], "--all") || !strcmp(argv[1], "-a"))
+ return PrintAllParams(1);
/* Print help if needed */
if (!strcasecmp(argv[1], "-h") || !strcmp(argv[1], "-?")) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698