diff options
author | Lucas de Castro Borges <lucas@gnuabordo.com.br> | 2024-04-22 00:35:56 -0300 |
---|---|---|
committer | Lucas de Castro Borges <lucas@gnuabordo.com.br> | 2024-04-22 00:35:56 -0300 |
commit | 754b5d1114f096778e483f8a6f3a5dc333225e26 (patch) | |
tree | 30911ec9da4cfd2f5572c27f7288fcbfa4cd212d /hardinfo2/hinote_util.c | |
parent | 35c2857da302ab8b3c308052f2cd1674fb4141a6 (diff) | |
parent | 5f01c706267c595de92406a32e7f31ef5056c2d0 (diff) |
Update upstream source from tag 'upstream/2.0.3pre'
Update to upstream version '2.0.3pre'
with Debian dir 6683980bf6b5c02f6847fd56765833301f75f4f3
Diffstat (limited to 'hardinfo2/hinote_util.c')
-rw-r--r-- | hardinfo2/hinote_util.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/hardinfo2/hinote_util.c b/hardinfo2/hinote_util.c new file mode 100644 index 00000000..efc85be0 --- /dev/null +++ b/hardinfo2/hinote_util.c @@ -0,0 +1,27 @@ + +#include "hardinfo.h" + +/* requires COMPILE_FLAGS "-std=c99" */ + +static const char bullet_yes[] = "<big><b>\u2713</b></big>"; +static const char bullet_no[] = "<big><b>\u2022<tt> </tt></b></big>"; +static const char bullet_yes_text[] = "[X]"; +static const char bullet_no_text[] = "[ ]"; + +gboolean note_cond_bullet(gboolean cond, gchar *note_buff, const gchar *desc_str) { + int l = strlen(note_buff); + if (params.markup_ok) + snprintf(note_buff + l, note_max_len - l - 1, "%s %s\n", + cond ? bullet_yes : bullet_no, desc_str); + else + snprintf(note_buff + l, note_max_len - l - 1, "%s %s\n", + cond ? bullet_yes_text : bullet_no_text, desc_str); + return cond; +} + +gboolean note_require_tool(const gchar *tool, gchar *note_buff, const gchar *desc_str) { + gchar *tl = find_program((gchar*)tool); + gboolean found = note_cond_bullet(!!tl, note_buff, desc_str); + g_free(tl); + return found; +} |