summaryrefslogtreecommitdiff
path: root/vpddecode.c
diff options
context:
space:
mode:
authorJean Delvare <jdelvare@suse.de>2005-10-03 20:06:26 +0000
committerJean Delvare <jdelvare@suse.de>2005-10-03 20:06:26 +0000
commit88c27c2852d642e6476adb00a6ef949e111cbe2f (patch)
tree6e76fb8a262f28f117e7dc9c6fa7f448dfea3760 /vpddecode.c
parent901f5e3bfe854649764103600db4dff7135484ca (diff)
downloaddmidecode-git-88c27c2852d642e6476adb00a6ef949e111cbe2f.tar.gz
Add option -s, --string. It prints one selected VPD string instead of the
regular output.
Diffstat (limited to 'vpddecode.c')
-rw-r--r--vpddecode.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/vpddecode.c b/vpddecode.c
index 6be50a5..6188a67 100644
--- a/vpddecode.c
+++ b/vpddecode.c
@@ -214,7 +214,8 @@ static void print_entry(const char *name, const u8 *p, size_t len)
{
size_t i;
- printf("%s: ", name);
+ if(name!=NULL)
+ printf("%s: ", name);
for(i=0; i<len; i++)
{
/* ASCII filtering */
@@ -266,9 +267,18 @@ static int decode(const u8 *p)
/* A few systems have a bad checksum (xSeries 325, 330, 335
and 345 with early BIOS) but the record is otherwise
valid. */
- printf("Bad checksum! Please report.\n");
+ if(!(opt.flags & FLAG_QUIET))
+ printf("Bad checksum! Please report.\n");
}
+ if(opt.string!=NULL)
+ {
+ if(opt.string->offset+opt.string->len<p[5])
+ print_entry(NULL, p+opt.string->offset,
+ opt.string->len);
+ return 1;
+ }
+
print_entry("BIOS Build ID", p+0x0D, 9);
printf("Product Name: %s\n", product_name((const char *)(p+0x0D)));
print_entry("Box Serial Number", p+0x16, 7);
@@ -318,7 +328,8 @@ int main(int argc, char * const argv[])
return 0;
}
- printf("# vpddecode %s\n", VERSION);
+ if(!(opt.flags & FLAG_QUIET))
+ printf("# vpddecode %s\n", VERSION);
if((buf=mem_chunk(0xF0000, 0x10000, opt.devmem))==NULL)
exit(1);