summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRandall Spangler <rspangler@chromium.org>2011-04-08 14:26:46 -0700
committerRandall Spangler <rspangler@chromium.org>2011-04-08 14:26:46 -0700
commit55af5b539a50b1faea736487f8fb51047d9f41e9 (patch)
treee16b428a1ba0c04486642dfe3ce05fe0995cfca8
parent4115b89285dd549d9f875abb58d8c3b6633435e1 (diff)
downloadvboot-55af5b539a50b1faea736487f8fb51047d9f41e9.tar.gz
Add --all option to crossystem to print normally-hidden fields
Change-Id: I649b0d745316acc38b5a121dfd1c353c475ac44a R=reinauer@chromium.org BUG=chromium-os:13204 TEST=manual crossystem # should not print vdat_lfdebug and vdat_lkdebug crossystem --all # should print them Review URL: http://codereview.chromium.org/6824020
-rw-r--r--utility/crossystem_main.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/utility/crossystem_main.c b/utility/crossystem_main.c
index 1150cd08..7289ad1d 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], "-?")) {