diff options
Diffstat (limited to 'hardinfo')
-rw-r--r-- | hardinfo/gg_key_file_parse_string_as_value.c | 4 | ||||
-rw-r--r-- | hardinfo/info.c | 2 | ||||
-rw-r--r-- | hardinfo/problem_marker.c | 13 | ||||
-rw-r--r-- | hardinfo/util.c | 17 |
4 files changed, 33 insertions, 3 deletions
diff --git a/hardinfo/gg_key_file_parse_string_as_value.c b/hardinfo/gg_key_file_parse_string_as_value.c index 496b1d35..7e871bc1 100644 --- a/hardinfo/gg_key_file_parse_string_as_value.c +++ b/hardinfo/gg_key_file_parse_string_as_value.c @@ -21,7 +21,9 @@ * along with this library; if not, see <http://www.gnu.org/licenses/>. */ -static gchar * +#include <glib.h> + +gchar * gg_key_file_parse_string_as_value (const gchar *string, const gchar list_separator) { gchar *value, *p, *q; diff --git a/hardinfo/info.c b/hardinfo/info.c index cf6af9f9..5f108814 100644 --- a/hardinfo/info.c +++ b/hardinfo/info.c @@ -23,7 +23,7 @@ * 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" +/* Now in hardinfo.h -- #include "gg_key_file_parse_string_as_value.c" */ static const gchar *info_column_titles[] = { "TextValue", "Value", "Progress", "Extra1", "Extra2" diff --git a/hardinfo/problem_marker.c b/hardinfo/problem_marker.c new file mode 100644 index 00000000..1e0c2aed --- /dev/null +++ b/hardinfo/problem_marker.c @@ -0,0 +1,13 @@ + +#include "hardinfo.h" + +/* requires COMPILE_FLAGS "-std=c99" */ + +const char *problem_marker() { + static const char as_markup[] = "<big><b>\u26A0</b></big>"; + static const char as_text[] = "(!)"; + if (params.markup_ok) + return as_markup; + else + return as_text; +} diff --git a/hardinfo/util.c b/hardinfo/util.c index e690ff20..764415df 100644 --- a/hardinfo/util.c +++ b/hardinfo/util.c @@ -393,6 +393,7 @@ void parameters_init(int *argc, char ***argv, ProgramParameters * param) static gchar *report_format = NULL; static gchar *run_benchmark = NULL; static gchar *result_format = NULL; + static gchar *bench_user_note = NULL; static gchar **use_modules = NULL; static gint max_bench_results = 10; @@ -416,6 +417,12 @@ void parameters_init(int *argc, char ***argv, ProgramParameters * param) .arg_data = &run_benchmark, .description = N_("run benchmark; requires benchmark.so to be loaded")}, { + .long_name = "user-note", + .short_name = 'u', + .arg = G_OPTION_ARG_STRING, + .arg_data = &bench_user_note, + .description = N_("note attached to benchmark results")}, + { .long_name = "result-format", .short_name = 'g', .arg = G_OPTION_ARG_STRING, @@ -511,6 +518,14 @@ void parameters_init(int *argc, char ***argv, ProgramParameters * param) param->report_format = REPORT_FORMAT_SHELL; } + /* clean user note */ + if (bench_user_note) { + char *p = NULL; + while(p = strchr(bench_user_note, ';')) { *p = ','; } + param->bench_user_note = + gg_key_file_parse_string_as_value(bench_user_note, '|'); + } + /* html ok? * gui: yes * report html: yes @@ -522,7 +537,7 @@ void parameters_init(int *argc, char ***argv, ProgramParameters * param) gchar *confdir = g_build_filename(g_get_user_config_dir(), "hardinfo", NULL); if (!g_file_test(confdir, G_FILE_TEST_EXISTS)) { - mkdir(confdir, 0744); + mkdir(confdir, 0744); } g_free(confdir); } |