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

Unified Diff: utility/crossystem_main.c

Issue 6582004: Print addresses as hex (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/vboot_reference.git@master
Patch Set: Created 9 years, 10 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 acf39e28ce8cf4f53ed8b2c990d9f41441e22e8f..07c14e4597513991cca1572f3d7e65441bc5828b 100644
--- a/utility/crossystem_main.c
+++ b/utility/crossystem_main.c
@@ -16,6 +16,7 @@ typedef struct Param {
int is_string; /* 0 if integer, 1 if string */
int can_write; /* 0 if read-only, 1 if writable */
const char* desc; /* Human-readable description */
+ const char* format; /* Format string, if non-NULL and 0==is_string*/
} Param;
/* List of parameters, terminated with a param with NULL name */
@@ -29,9 +30,9 @@ const Param sys_param_list[] = {
{"wpsw_cur", 0, 0, "Firmware write protect switch current position"},
{"wpsw_boot", 0, 0, "Firmware write protect switch position at boot"},
{"recovery_reason", 0, 0, "Recovery mode reason for current boot"},
- {"savedmem_base", 0, 0, "RAM debug data area physical address"},
+ {"savedmem_base", 0, 0, "RAM debug data area physical address", "0x%08x"},
{"savedmem_size", 0, 0, "RAM debug data area size in bytes"},
- {"fmap_base", 0, 0, "Main firmware flashmap physical address"},
+ {"fmap_base", 0, 0, "Main firmware flashmap physical address", "0x%08x"},
/* Read-only strings */
{"hwid", 1, 0, "Hardware ID"},
{"fwid", 1, 0, "Active firmware ID"},
@@ -117,7 +118,7 @@ int PrintParam(const Param* p) {
int v = VbGetSystemPropertyInt(p->name);
if (v == -1)
return 1;
- printf("%d", v);
+ printf(p->format ? p->format : "%d", v);
}
return 0;
}
@@ -140,7 +141,7 @@ int PrintAllParams(void) {
if (v == -1)
value = NULL;
else {
- snprintf(buf, sizeof(buf), "%d", v);
+ snprintf(buf, sizeof(buf), p->format ? p->format : "%d", v);
value = buf;
}
}
« 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