From 88c27c2852d642e6476adb00a6ef949e111cbe2f Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Mon, 3 Oct 2005 20:06:26 +0000 Subject: Add option -s, --string. It prints one selected VPD string instead of the regular output. --- vpdopt.c | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 66 insertions(+), 1 deletion(-) (limited to 'vpdopt.c') diff --git a/vpdopt.c b/vpdopt.c index 932cd59..4ebb892 100644 --- a/vpdopt.c +++ b/vpdopt.c @@ -20,6 +20,7 @@ */ #include +#include #include #include @@ -31,6 +32,57 @@ struct opt opt; +/* + * Handling of option --string + */ + +/* This lookup table could admittedly be reworked for improved performance. + Due to the low count of items in there at the moment, it did not seem + worth the additional code complexity though. */ +static const struct string_keyword opt_string_keyword[]={ + { "bios-build-id", 0x0D, 9 }, + { "box-serial-number", 0x16, 7 }, + { "motherboard-serial-number", 0x1D, 11 }, + { "machine-type-model", 0x28, 7 }, + { "bios-release-date", 0x30, 8 }, +}; + +static void print_opt_string_list(void) +{ + unsigned int i; + + fprintf(stderr, "Valid string keywords are:\n"); + for(i=0; i