diff options
| author | Burt P <pburt0@gmail.com> | 2018-03-17 13:29:08 -0500 | 
|---|---|---|
| committer | Leandro A. F. Pereira <leandro@hardinfo.org> | 2018-04-24 07:42:19 -0700 | 
| commit | 1af727318af21e5a3b188fed290f3cebb5a8ba86 (patch) | |
| tree | da8a8e6b0aae896eb0f880ebdea0cac9757ac993 | |
| parent | 32ce70d9c65123a0c399ffb85bae536246d84a6c (diff) | |
dmi: ignore placeholder strings ("To Be Filled...", etc)
Signed-off-by: Burt P <pburt0@gmail.com>
| -rw-r--r-- | hardinfo/dmi_util.c | 16 | 
1 files changed, 16 insertions, 0 deletions
diff --git a/hardinfo/dmi_util.c b/hardinfo/dmi_util.c index 28b2c197..25ec8288 100644 --- a/hardinfo/dmi_util.c +++ b/hardinfo/dmi_util.c @@ -21,6 +21,21 @@  #include "hardinfo.h"  #include "dmi_util.h" +/* frees the string and sets it NULL if it is to be ignored + * returns -1 if error, 0 if ok, 1 if ignored */ +static int ignore_placeholder_strings(char **pstr) { +    if (pstr == NULL || *pstr == NULL) +        return -1; +#define DMI_IGNORE(m) if (strcasecmp(m, *pstr) == 0) { free(*pstr); *pstr = NULL; return 1; } +    DMI_IGNORE("To be filled by O.E.M."); +    DMI_IGNORE("System Product Name"); +    DMI_IGNORE("System Manufacturer"); +    DMI_IGNORE("System Version"); +    DMI_IGNORE("Default String"); +    /*... more, I'm sure. */ +    return 0; +} +  static const char *dmi_sysfs_root(void) {      char *candidates[] = {          "/sys/devices/virtual/dmi", @@ -105,6 +120,7 @@ dmi_str_done:              g_free(ret);              ret = NULL;          } +        ignore_placeholder_strings(&ret);      }      return ret;  }  | 
