diff options
author | Leandro A. F. Pereira <leandro@hardinfo.org> | 2019-08-10 16:48:51 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-08-10 16:48:51 -0700 |
commit | b9157b3f6520f46e788157fbfe9753b209efe9b7 (patch) | |
tree | 80d72e25837f3b569734ba476df84d3462617e29 /hardinfo/info.c | |
parent | 7db082583f72598e2118553faf1ba3206d7c3ee7 (diff) | |
parent | 4827b88fa34807425640d2a9f07bbf4ac4119ab3 (diff) |
Merge branch 'master' into usb3
Diffstat (limited to 'hardinfo/info.c')
-rw-r--r-- | hardinfo/info.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/hardinfo/info.c b/hardinfo/info.c index bfc11fc2..cf6af9f9 100644 --- a/hardinfo/info.c +++ b/hardinfo/info.c @@ -17,6 +17,13 @@ */ #include "hardinfo.h" +#include "util_sysobj.h" /* for SEQ() */ + +/* Using a slightly modified gg_key_file_parse_string_as_value() + * from GLib in flatten(), to escape characters and the separator. + * The function is not public in GLib and we don't have a GKeyFile + * to pass it anyway. */ +#include "gg_key_file_parse_string_as_value.c" static const gchar *info_column_titles[] = { "TextValue", "Value", "Progress", "Extra1", "Extra2" @@ -267,7 +274,9 @@ static void flatten_group(GString *output, const struct InfoGroup *group, guint tp); } - g_string_append_printf(output, "%s=%s\n", field->name, field->value); + gchar *escaped_value = gg_key_file_parse_string_as_value(field->value, '|'); + g_string_append_printf(output, "%s=%s\n", field->name, escaped_value); + g_free(escaped_value); } } else if (group->computed) { g_string_append_printf(output, "%s\n", group->computed); @@ -369,8 +378,6 @@ gchar *info_flatten(struct Info *info) return g_string_free(values, FALSE); } -#define SEQ(a,b) (g_strcmp0(a,b) == 0) - struct InfoField *info_find_field(struct Info *info, const gchar *tag, const gchar *name) { struct InfoGroup *group; struct InfoField *field; |