From 60f4ea4fb759276eb8ca9797263c1a28ff42426f Mon Sep 17 00:00:00 2001 From: Toni Spets Date: Mon, 17 Sep 2007 04:40:13 +0000 Subject: [PATCH] OpenBSD cleanups, remove unsupported printf flag and fix non-dynamic cpu_freq git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky1@964 7f574dfc-610e-0410-a909-a81674777703 --- src/conky.c | 14 ++++++++++++++ src/openbsd.c | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/conky.c b/src/conky.c index 6b59b896..f198fbac 100644 --- a/src/conky.c +++ b/src/conky.c @@ -3577,7 +3577,13 @@ static void generate_text_internal(char *p, int p_max_size, struct text_object * } OBJ(freq_g) { if (obj->a) { +#ifndef __OpenBSD__ obj->a = get_freq(p, p_max_size, "%'.2f", 1000, obj->data.cpu_index); +#else + /* OpenBSD has no such flag (SUSv2) */ + obj->a = get_freq(p, p_max_size, "%.2f", 1000, obj->data.cpu_index); +#endif + } } #if defined(__linux__) @@ -3640,9 +3646,17 @@ static void generate_text_internal(char *p, int p_max_size, struct text_object * } OBJ(freq_dyn_g) { if (use_spacer) { +#ifndef __OpenBSD__ get_freq_dynamic(p, 6, "%'.2f ", 1000); +#else + get_freq_dynamic(p, 6, "%.2f ", 1000); +#endif } else { +#ifndef __OpenBSD__ get_freq_dynamic(p, p_max_size, "%'.2f", 1000); +#else + get_freq_dynamic(p, p_max_size, "%.2f", 1000); +#endif } } #ifndef __OpenBSD__ diff --git a/src/openbsd.c b/src/openbsd.c index e4ac3f92..fe68f5ea 100644 --- a/src/openbsd.c +++ b/src/openbsd.c @@ -497,7 +497,7 @@ get_freq_dynamic(char *p_client_buffer, size_t client_buffer_size, snprintf(p_client_buffer, client_buffer_size, p_format, (float)((cycles[1] - cycles[0]) / microseconds) / divisor); #else - get_freq(p_client_buffer, client_buffer_size, p_format, divisor); + get_freq(p_client_buffer, client_buffer_size, p_format, divisor, 1); #endif }