Switch from printf() to GLib/GKrellM logging (gkrellm_debug(), g_warning(), g_message())
Replace sprintf() calls with snprintf() for security reasons.
This commit is contained in:
parent
4ff5bbfeb9
commit
7e86c76f32
|
@ -436,9 +436,8 @@ check_mbox(Mailbox *mbox)
|
|||
mbox->mail_count = mbox->old_mail_count = mbox->new_mail_count = 0;
|
||||
mbox->last_mtime = 0;
|
||||
mbox->last_size = 0;
|
||||
if (_GK.debug_level & DEBUG_MAIL)
|
||||
printf("check_mbox can't stat(%s): %s\n", mbox->path,
|
||||
g_strerror(errno));
|
||||
gkrellm_debug(DEBUG_MAIL, "check_mbox can't stat(%s): %s\n",
|
||||
mbox->path, g_strerror(errno));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -451,9 +450,8 @@ check_mbox(Mailbox *mbox)
|
|||
{
|
||||
if ((f = fopen(mbox->path, "r")) == NULL)
|
||||
{
|
||||
if (_GK.debug_level & DEBUG_MAIL)
|
||||
printf("check_mbox can't fopen(%s): %s\n", mbox->path,
|
||||
g_strerror(errno));
|
||||
gkrellm_debug(DEBUG_MAIL, "check_mbox can't fopen(%s): %s\n",
|
||||
mbox->path, g_strerror(errno));
|
||||
return FALSE;
|
||||
}
|
||||
mbox->mail_count = 0;
|
||||
|
|
|
@ -97,7 +97,7 @@ gkrellmd_serve_data(GkrellmdMonitor *mon, gchar *line)
|
|||
}
|
||||
else
|
||||
{
|
||||
printf("gkrellmd: %s forgot to gkrellmd_set_serve_name()\n",
|
||||
g_warning("gkrellmd: %s forgot to gkrellmd_set_serve_name()\n",
|
||||
mon->name);
|
||||
return;
|
||||
}
|
||||
|
@ -201,7 +201,7 @@ serve_cpu_data(GkrellmdMonitor *mon, gboolean first_serve)
|
|||
for (list = cpu_list; list; list = list->next)
|
||||
{
|
||||
cpu = (CpuData *) list->data;
|
||||
sprintf(buf, "%d %lu %lu %lu %lu\n", cpu->instance,
|
||||
snprintf(buf, sizeof(buf), "%d %lu %lu %lu %lu\n", cpu->instance,
|
||||
cpu->user, cpu->nice, cpu->sys, cpu->idle);
|
||||
gkrellmd_serve_data(mon, buf);
|
||||
}
|
||||
|
@ -471,7 +471,7 @@ gkrellm_disk_assign_data_nth(gint n, guint64 rb, guint64 wb, gboolean virtual)
|
|||
disk = (DiskData *) g_list_nth_data(disk_list, n);
|
||||
else
|
||||
{
|
||||
sprintf(name, "%s%c", _("Disk"), 'A' + n);
|
||||
snprintf(name, sizeof(name), "%s%c", _("Disk"), 'A' + n);
|
||||
disk = add_disk(name, n, 0, 0);
|
||||
}
|
||||
disk_assign_data(disk, rb, wb, virtual);
|
||||
|
@ -741,7 +741,7 @@ serve_inet_data(GkrellmdMonitor *mon, gboolean first_serve)
|
|||
)
|
||||
{
|
||||
cp = inet_ntoa(tcp->remote_addr);
|
||||
sprintf(buf, "+0 %x %s:%x\n",
|
||||
snprintf(buf, sizeof(buf), "+0 %x %s:%x\n",
|
||||
tcp->local_port, cp, tcp->remote_port);
|
||||
}
|
||||
#if defined(INET6) && defined(HAVE_GETADDRINFO)
|
||||
|
@ -783,7 +783,7 @@ serve_inet_data(GkrellmdMonitor *mon, gboolean first_serve)
|
|||
if (tcp->family == AF_INET)
|
||||
{
|
||||
cp = inet_ntoa(tcp->remote_addr);
|
||||
sprintf(buf, "-0 %x %s:%x\n",
|
||||
snprintf(buf, sizeof(buf), "-0 %x %s:%x\n",
|
||||
tcp->local_port, cp, tcp->remote_port);
|
||||
}
|
||||
#if defined(INET6) && defined(HAVE_GETADDRINFO)
|
||||
|
@ -1089,7 +1089,7 @@ serve_net_data(GkrellmdMonitor *mon, gboolean first_serve)
|
|||
net = (NetData *) list->data;
|
||||
if (net->changed || first_serve)
|
||||
{
|
||||
sprintf(buf, "%s %lu %lu\n", net->name, net->rx, net->tx);
|
||||
snprintf(buf, sizeof(buf), "%s %lu %lu\n", net->name, net->rx, net->tx);
|
||||
gkrellmd_serve_data(mon, buf);
|
||||
}
|
||||
}
|
||||
|
@ -1106,7 +1106,7 @@ serve_net_data(GkrellmdMonitor *mon, gboolean first_serve)
|
|||
fake_up_event = (first_serve && net->up);
|
||||
if (net->up_event || net->down_event || fake_up_event)
|
||||
{
|
||||
sprintf(buf, "%s %d\n", net->name,
|
||||
snprintf(buf, sizeof(buf), "%s %d\n", net->name,
|
||||
fake_up_event ? TRUE : net->up_event);
|
||||
gkrellmd_serve_data(mon, buf);
|
||||
}
|
||||
|
@ -1120,7 +1120,7 @@ serve_net_data(GkrellmdMonitor *mon, gboolean first_serve)
|
|||
if (net_timer->timed_changed || first_serve)
|
||||
{
|
||||
gkrellmd_set_serve_name(mon, "net_timer");
|
||||
sprintf(buf, "%s %d\n", net_timer->name, (gint)net_timer->up_time);
|
||||
snprintf(buf, sizeof(buf), "%s %d\n", net_timer->name, (gint)net_timer->up_time);
|
||||
gkrellmd_serve_data(mon, buf);
|
||||
}
|
||||
}
|
||||
|
@ -1940,7 +1940,7 @@ serve_sensors_data(GkrellmdMonitor *mon, gboolean first_serve)
|
|||
continue;
|
||||
if (sr->changed || first_serve)
|
||||
{
|
||||
sprintf(buf, "%d \"%s\" %d %d %d %.2f\n",
|
||||
snprintf(buf, sizeof(buf), "%d \"%s\" %d %d %d %.2f\n",
|
||||
sr->type, sr->id_name,
|
||||
sr->id, sr->iodev, sr->inter, sr->raw_value);
|
||||
gkrellmd_serve_data(mon, buf);
|
||||
|
@ -1965,12 +1965,12 @@ serve_sensors_setup(GkrellmdMonitor *mon)
|
|||
if (s->group == SENSOR_GROUP_DISK && !sensor_disk_ok)
|
||||
continue;
|
||||
if (sensor_disk_ok)
|
||||
sprintf(buf, "%d \"%s\" %d %d %d %.4f %.4f \"%s\" \"%s\" %d\n",
|
||||
snprintf(buf, sizeof(buf), "%d \"%s\" %d %d %d %.4f %.4f \"%s\" \"%s\" %d\n",
|
||||
s->type, s->id_name,
|
||||
s->id, s->iodev, s->inter,
|
||||
s->factor, s->offset, s->vref, s->default_label, s->group);
|
||||
else
|
||||
sprintf(buf, "%d \"%s\" %d %d %d %.4f %.4f \"%s\" \"%s\"\n",
|
||||
snprintf(buf, sizeof(buf), "%d \"%s\" %d %d %d %.4f %.4f \"%s\" \"%s\"\n",
|
||||
s->type, s->id_name,
|
||||
s->id, s->iodev, s->inter,
|
||||
s->factor, s->offset, s->vref, s->default_label);
|
||||
|
@ -2057,7 +2057,7 @@ send_time(GkrellmdClient *client)
|
|||
gchar buf[128];
|
||||
|
||||
t = &gkrellmd_current_tm;
|
||||
sprintf(buf, "<time>\n%d %d %d %d %d %d %d %d %d\n",
|
||||
snprintf(buf, sizeof(buf), "<time>\n%d %d %d %d %d %d %d %d %d\n",
|
||||
t->tm_sec, t->tm_min, t->tm_hour,
|
||||
t->tm_mday, t->tm_mon, t->tm_year,
|
||||
t->tm_wday, t->tm_yday, t->tm_isdst);
|
||||
|
@ -2111,7 +2111,7 @@ gkrellmd_load_monitors(void)
|
|||
if (_GK.list_plugins)
|
||||
exit(0);
|
||||
if (_GK.log_plugins)
|
||||
printf("%s\n", plugin_install_log ? plugin_install_log :
|
||||
g_message("%s\n", plugin_install_log ? plugin_install_log :
|
||||
_("No plugins found\n"));
|
||||
for ( ; list; list = list->next)
|
||||
{
|
||||
|
@ -2201,7 +2201,7 @@ gkrellmd_update_monitors(void)
|
|||
send_time(client);
|
||||
else if (GK.second_tick)
|
||||
{
|
||||
sprintf(buf, "<.%d>\n", gkrellmd_current_tm.tm_sec);
|
||||
snprintf(buf, sizeof(buf), "<.%d>\n", gkrellmd_current_tm.tm_sec);
|
||||
gkrellmd_send_to_client(client, buf);
|
||||
}
|
||||
|
||||
|
@ -2241,7 +2241,7 @@ gkrellmd_serve_setup(GkrellmdClient *client)
|
|||
g_free(s);
|
||||
|
||||
lc = localeconv();
|
||||
sprintf(buf, "%c\n", *lc->decimal_point);
|
||||
snprintf(buf, sizeof(buf), "%c\n", *lc->decimal_point);
|
||||
s = g_strconcat("<decimal_point>\n", buf, "\n", NULL);
|
||||
gkrellmd_send_to_client(client, s);
|
||||
g_free(s);
|
||||
|
@ -2269,16 +2269,16 @@ gkrellmd_serve_setup(GkrellmdClient *client)
|
|||
for (list = gkrellmd_monitor_list; list; list = list->next)
|
||||
{
|
||||
mon = (GkrellmdMonitor *) list->data;
|
||||
sprintf(buf, "%s\n", mon->name);
|
||||
snprintf(buf, sizeof(buf), "%s\n", mon->name);
|
||||
gkrellmd_send_to_client(client, buf);
|
||||
}
|
||||
|
||||
sprintf(buf, "%d\n", _GK.io_timeout);
|
||||
snprintf(buf, sizeof(buf), "%d\n", _GK.io_timeout);
|
||||
s = g_strconcat("<io_timeout>\n", buf, "\n", NULL);
|
||||
gkrellmd_send_to_client(client, s);
|
||||
g_free(s);
|
||||
|
||||
sprintf(buf, "%d\n", _GK.reconnect_timeout);
|
||||
snprintf(buf, sizeof(buf), "%d\n", _GK.reconnect_timeout);
|
||||
s = g_strconcat("<reconnect_timeout>\n", buf, "\n", NULL);
|
||||
gkrellmd_send_to_client(client, s);
|
||||
g_free(s);
|
||||
|
|
|
@ -220,7 +220,8 @@ gkrellmd_plugin_scan(gchar *path)
|
|||
}
|
||||
if (_GK.list_plugins)
|
||||
{
|
||||
printf("%s (%s)\n", name, path);
|
||||
// TODO: list plugins support on win32
|
||||
g_message("%s (%s)\n", name, path);
|
||||
continue;
|
||||
}
|
||||
for (list = plugin_list; list; list = list->next)
|
||||
|
|
|
@ -173,10 +173,9 @@ gkrellm_connect_to(gchar *server, gint server_port)
|
|||
if ((fd = socket(res->ai_family, res->ai_socktype,
|
||||
res->ai_protocol)) < 0)
|
||||
continue;
|
||||
if (_GK.debug_level & DEBUG_SENSORS)
|
||||
printf("\t[gkrellm_connect_to: (%d,%d,%d) %s:%d]\n",
|
||||
res->ai_family, res->ai_socktype,
|
||||
res->ai_protocol, server, server_port);
|
||||
gkrellm_debug(DEBUG_SENSORS,
|
||||
"\t[gkrellm_connect_to: (%d,%d,%d) %s:%d]\n", res->ai_family,
|
||||
res->ai_socktype, res->ai_protocol, server, server_port);
|
||||
if (connect(fd, res->ai_addr, res->ai_addrlen) >= 0)
|
||||
break;
|
||||
#ifdef WIN32
|
||||
|
@ -188,8 +187,8 @@ gkrellm_connect_to(gchar *server, gint server_port)
|
|||
}
|
||||
freeaddrinfo(res0);
|
||||
#else
|
||||
if (_GK.debug_level & DEBUG_SENSORS)
|
||||
printf("\t[gkrellm_connect_to: %s:%d]\n", server, server_port);
|
||||
gkrellm_debug(DEBUG_SENSORS, "\t[gkrellm_connect_to: %s:%d]\n", server,
|
||||
server_port);
|
||||
addr = gethostbyname(server);
|
||||
if (addr)
|
||||
{
|
||||
|
|
22
src/chart.c
22
src/chart.c
|
@ -1019,9 +1019,9 @@ gkrellm_draw_chart_text(GkrellmChart *cp, gint style_id, gchar *str)
|
|||
|
||||
if (_GK.debug_level & DEBUG_CHART_TEXT)
|
||||
{
|
||||
printf("\n");
|
||||
g_debug("\n");
|
||||
if (!cp->text_format_reuse)
|
||||
printf("draw_chart_text: [%s]\n", str);
|
||||
g_debug("draw_chart_text: [%s]\n", str);
|
||||
}
|
||||
|
||||
if ( !cp->text_format_reuse
|
||||
|
@ -1171,7 +1171,7 @@ gkrellm_draw_chart_text(GkrellmChart *cp, gint style_id, gchar *str)
|
|||
|
||||
strncpy(buf, s, text_length);
|
||||
buf[text_length] = '\0';
|
||||
printf("draw_chart_text: [%s] ", buf);
|
||||
g_debug("draw_chart_text: [%s] ", buf);
|
||||
}
|
||||
|
||||
offset = cp->baseline_ref - tr->baseline; /* align baselines */
|
||||
|
@ -1183,7 +1183,7 @@ gkrellm_draw_chart_text(GkrellmChart *cp, gint style_id, gchar *str)
|
|||
if (!tr->cache_valid)
|
||||
{
|
||||
if (_GK.debug_level & DEBUG_CHART_TEXT)
|
||||
printf("pango ");
|
||||
g_debug("pango ");
|
||||
gdk_draw_drawable(cp->bg_text_pixmap, _GK.draw1_GC,
|
||||
cp->bg_pixmap,
|
||||
x - 1, y + tr->y_ink + offset - 1,
|
||||
|
@ -1193,7 +1193,7 @@ gkrellm_draw_chart_text(GkrellmChart *cp, gint style_id, gchar *str)
|
|||
text_length);
|
||||
}
|
||||
if (_GK.debug_level & DEBUG_CHART_TEXT)
|
||||
printf("x=%d y=%d w=%d h=%d\n",
|
||||
g_debug("x=%d y=%d w=%d h=%d\n",
|
||||
x - 1, y + tr->y_ink + offset - 1,
|
||||
tr->w + shadow + 2, tr->h + shadow + 1);
|
||||
gdk_draw_drawable(cp->pixmap, _GK.draw1_GC, cp->bg_text_pixmap,
|
||||
|
@ -1983,7 +1983,7 @@ gkrellm_125_sequence(gint value, gboolean use125,
|
|||
{
|
||||
for (i = 0; i < table_size; ++i)
|
||||
{
|
||||
/*printf(" mapping[%d] value=%d table=%d\n", i, value, table[i]); */
|
||||
/*g_debug(" mapping[%d] value=%d table=%d\n", i, value, table[i]); */
|
||||
if (value == table[i])
|
||||
return table[i];
|
||||
else if (value == table[i] - 1)
|
||||
|
@ -2742,20 +2742,20 @@ debug_dump_chart_list()
|
|||
GkrellmPanel *p;
|
||||
GkrellmChartdata *cd;
|
||||
|
||||
printf("\n");
|
||||
g_debug("\n");
|
||||
for (list = gkrellm_get_chart_list(); list; list = list->next)
|
||||
{
|
||||
cp = (GkrellmChart *) list->data;
|
||||
p = cp->panel;
|
||||
if (p && p->label && p->label->string)
|
||||
printf("%s [%d]: ", p->label->string, cp->style_id);
|
||||
g_debug("%s [%d]: ", p->label->string, cp->style_id);
|
||||
else
|
||||
printf("(null) [%d]: ", cp->style_id);
|
||||
g_debug("(null) [%d]: ", cp->style_id);
|
||||
for (cdlist = cp->cd_list; cdlist; cdlist = cdlist->next)
|
||||
{
|
||||
cd = (GkrellmChartdata *) cdlist->data;
|
||||
printf("%s %p->data ", cd->label, cd->data);
|
||||
g_debug("%s %p->data ", cd->label, cd->data);
|
||||
}
|
||||
printf("\n");
|
||||
g_debug("\n");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -209,7 +209,7 @@ strftime_format(gchar *format, gchar *alt_color)
|
|||
g_free (locale_format);
|
||||
format_alt_color(buf1, buf2, sizeof(buf2), alt_color);
|
||||
|
||||
// printf("%s\n", buf2);
|
||||
// g_debug("%s\n", buf2);
|
||||
|
||||
return g_locale_to_utf8 (buf2, -1, NULL, NULL, NULL);
|
||||
}
|
||||
|
|
|
@ -567,7 +567,7 @@ assign_custom_style(gchar *debug_name, GList *style_list, gint index,
|
|||
custom_style =
|
||||
(GkrellmStyle *) g_list_nth_data(_GK.custom_style_list, i);
|
||||
|
||||
//printf("assign_custom_style(%s, %s, %d, %s) %d\n",
|
||||
//g_debug("assign_custom_style(%s, %s, %d, %s) %d\n",
|
||||
//debug_name, custom_name, entry_flag, arg, i);
|
||||
assign_style_entry(custom_style, arg, entry_flag);
|
||||
set_themed(custom_style, entry_flag);
|
||||
|
|
|
@ -100,14 +100,14 @@ gdk_string_extents(void *font_desc, const char *string,
|
|||
int
|
||||
setuid(uid_t u)
|
||||
{
|
||||
// printf("setuid() intercepted\n");
|
||||
// g_debug("setuid() intercepted\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
setreuid(uid_t r, uid_t e)
|
||||
{
|
||||
// printf("setreuid() intercepted\n");
|
||||
// g_debug("setreuid() intercepted\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -305,8 +305,8 @@ gkrellm_disk_assign_data_nth(gint n, guint64 rb, guint64 wb, gboolean virtual)
|
|||
disk = (DiskMon *) g_list_nth_data(disk_mon_list, n + 1);
|
||||
else
|
||||
{
|
||||
sprintf(name, "%s%c", "Disk", 'A' + n);
|
||||
sprintf(label, "%s%c", _("Disk"), 'A' + n);
|
||||
snprintf(name, sizeof(name), "%s%c", "Disk", 'A' + n);
|
||||
snprintf(label, sizeof(label), "%s%c", _("Disk"), 'A' + n);
|
||||
disk = add_disk(name, label, 0, 0, n);
|
||||
}
|
||||
disk_assign_data(disk, rb, wb, virtual);
|
||||
|
@ -1250,7 +1250,7 @@ cb_tree_selection_changed(GtkTreeSelection *selection, gpointer data)
|
|||
path = gtk_tree_model_get_path(model, &iter);
|
||||
indices = gtk_tree_path_get_indices(path);
|
||||
depth = gtk_tree_path_get_depth(path);
|
||||
// printf("selection: indices=[%d,%d]:%d, path=%s\n",
|
||||
// g_debug("selection: indices=[%d,%d]:%d, path=%s\n",
|
||||
// indices[0], indices[1], gtk_tree_path_get_depth(path),
|
||||
// gtk_tree_path_to_string(path));
|
||||
change_row_reference(model, path);
|
||||
|
|
8
src/fs.c
8
src/fs.c
|
@ -754,9 +754,7 @@ fs_update(void)
|
|||
|
||||
if (!force_fs_check && (!GK.second_tick || (!fs_check && !nfs_check)))
|
||||
return;
|
||||
#if 0
|
||||
printf("fs update %d nfs %d force %d\n", fs_check, nfs_check, force_fs_check);
|
||||
#endif
|
||||
//g_debug("fs update %d nfs %d force %d\n", fs_check, nfs_check, force_fs_check);
|
||||
|
||||
refresh_mounts_list();
|
||||
|
||||
|
@ -1849,7 +1847,7 @@ cb_tree_selection_changed(GtkTreeSelection *selection, gpointer data)
|
|||
indices = gtk_tree_path_get_indices(path);
|
||||
secondary = indices[0];
|
||||
depth = gtk_tree_path_get_depth(path);
|
||||
// printf("selection: indices=[%d,%d]:%d, path=%s\n",
|
||||
// g_debug("selection: indices=[%d,%d]:%d, path=%s\n",
|
||||
// indices[0], indices[1], gtk_tree_path_get_depth(path),
|
||||
// gtk_tree_path_to_string(path));
|
||||
change_row_reference(model, path);
|
||||
|
@ -2208,7 +2206,7 @@ row_drop_possible(GtkTreeDragDest *drag_dest, GtkTreePath *path,
|
|||
return FALSE;
|
||||
src_path = gtk_tree_row_reference_get_path(row_reference);
|
||||
indices = gtk_tree_path_get_indices(path);
|
||||
// printf("drop path: indices=[%d,%d]:%d, path=%s\n",
|
||||
// g_debug("drop path: indices=[%d,%d]:%d, path=%s\n",
|
||||
// indices[0], indices[1], gtk_tree_path_get_depth(path),
|
||||
// gtk_tree_path_to_string(path));
|
||||
|
||||
|
|
24
src/gui.c
24
src/gui.c
|
@ -1630,8 +1630,7 @@ gkrellm_load_theme_config(void)
|
|||
{
|
||||
if ((s = strchr(buf, (gint) '\n')) != NULL)
|
||||
*s = '\0';
|
||||
if (_GK.debug_level & DEBUG_GUI)
|
||||
printf("gkrellm_load_theme_config: %s\n", buf);
|
||||
gkrellm_debug(DEBUG_GUI, "gkrellm_load_theme_config: %s\n", buf);
|
||||
s = buf;
|
||||
if (s && *s != '#' && *s != '\0' && strcmp(s, "Default"))
|
||||
{
|
||||
|
@ -1645,8 +1644,7 @@ gkrellm_load_theme_config(void)
|
|||
{
|
||||
if ((s = strchr(buf, (gint) '\n')) != NULL)
|
||||
*s = '\0';
|
||||
if (_GK.debug_level & DEBUG_GUI)
|
||||
printf("gkrellm_load_theme_config: %s\n", buf);
|
||||
gkrellm_debug(DEBUG_GUI, "gkrellm_load_theme_config: %s\n", buf);
|
||||
if (i == 0)
|
||||
sscanf(buf, "%d", &_GK.theme_alternative);
|
||||
if (i == 1 && !strstr(buf, "*-*")) /* XXX Trap out GdkFont */
|
||||
|
@ -1684,8 +1682,8 @@ gkrellm_read_theme_event(GtkSettings *settings)
|
|||
/* so get the current gtk theme name and switch to it */
|
||||
{
|
||||
g_object_get(_GK.gtk_settings, "gtk-theme-name", &theme_name, NULL);
|
||||
if ((_GK.debug_level & DEBUG_GUI) && theme_name)
|
||||
printf("notify::gtk-theme-name: %s\n", theme_name);
|
||||
if (theme_name)
|
||||
gkrellm_debug(DEBUG_GUI, "notify::gtk-theme-name: %s\n", theme_name);
|
||||
|
||||
if ( gkrellm_dup_string(&_GK.gtk_theme_name, theme_name)
|
||||
&& _GK.track_gtk_theme_name
|
||||
|
@ -2125,8 +2123,8 @@ create_config_page(GkrellmMonitor *mon, GtkTreeStore *tree, GtkTreeIter *iter,
|
|||
PAGE_COLUMN, page,
|
||||
-1);
|
||||
|
||||
if (_GK.debug_level & DEBUG_GUI)
|
||||
printf("create_config_page %d: %s\n", page, mon ? mon->name : "--");
|
||||
gkrellm_debug(DEBUG_GUI, "create_config_page %d: %s\n", page,
|
||||
mon ? mon->name : "--");
|
||||
|
||||
return vbox;
|
||||
}
|
||||
|
@ -2196,9 +2194,8 @@ gkrellm_remove_plugin_config_page(GkrellmMonitor *mon)
|
|||
if (mon->privat->config_page >= tmon->privat->config_page)
|
||||
continue;
|
||||
tmon->privat->config_page -= 1;
|
||||
if (_GK.debug_level & DEBUG_GUI)
|
||||
printf("config_page %d: %s\n",
|
||||
tmon->privat->config_page, tmon->name);
|
||||
gkrellm_debug(DEBUG_GUI, "config_page %d: %s\n",
|
||||
tmon->privat->config_page, tmon->name);
|
||||
}
|
||||
}
|
||||
mon->privat->config_page = -1;
|
||||
|
@ -2261,9 +2258,8 @@ cb_tree_selection_changed(GtkTreeSelection *selection, gpointer data)
|
|||
set_apply_mode(instant);
|
||||
|
||||
gtk_notebook_set_current_page(config_notebook, page);
|
||||
if (_GK.debug_level & DEBUG_GUI)
|
||||
printf("tree_selection_changed %d: %s\n",
|
||||
page, selected_monitor ? selected_monitor->name : "--");
|
||||
gkrellm_debug(DEBUG_GUI, "tree_selection_changed %d: %s\n",
|
||||
page, selected_monitor ? selected_monitor->name : "--");
|
||||
}
|
||||
|
||||
/* Monitors may want to present as instant apply monitors, but still need
|
||||
|
|
12
src/inet.c
12
src/inet.c
|
@ -170,7 +170,7 @@ _log_active_port(ActiveTCP *tcp)
|
|||
if (_GK.debug_level & DEBUG_INET)
|
||||
{
|
||||
ap = inet_ntoa(tcp->remote_addr);
|
||||
g_print("inet OO-----> %x %s:%x\n",
|
||||
g_debug("inet OO-----> %x %s:%x\n",
|
||||
tcp->local_port, ap, tcp->remote_port);
|
||||
}
|
||||
active_tcp_list = g_list_prepend(active_tcp_list, (gpointer) new_tcp);
|
||||
|
@ -248,7 +248,7 @@ gkrellm_inet_client_divert(void (*read_tcp_func)())
|
|||
|
||||
/* ======================================================================== */
|
||||
|
||||
#define DUMP_IN(in,tag) printf("%s: %s %s %ld %ld %ld %ld\n", \
|
||||
#define DUMP_IN(in,tag) g_debug("%s: %s %s %ld %ld %ld %ld\n", \
|
||||
tag, in->label0, in->label1, \
|
||||
in->port0_0, in->port0_1, in->port1_0, in->port1_1);
|
||||
|
||||
|
@ -560,7 +560,7 @@ update_inet(void)
|
|||
if (_GK.debug_level & DEBUG_INET)
|
||||
{
|
||||
ap = inet_ntoa(tcp->remote_addr);
|
||||
g_print("inet XX-----> %x %s:%x\n",
|
||||
g_debug("inet XX-----> %x %s:%x\n",
|
||||
tcp->local_port, ap, tcp->remote_port);
|
||||
}
|
||||
free_tcp_list = g_list_prepend(free_tcp_list, tcp);
|
||||
|
@ -1104,12 +1104,14 @@ fix_ports(InetMon *in)
|
|||
|
||||
if (!*in->label0)
|
||||
{
|
||||
in->port0_1 = in->port0_1 = in->data0_is_range = 0;
|
||||
in->port0_1 = 0;
|
||||
in->data0_is_range = 0;
|
||||
--cd_length;
|
||||
}
|
||||
if (!*in->label1)
|
||||
{
|
||||
in->port1_1 = in->port1_1 = in->data1_is_range = 0;
|
||||
in->port1_1 = 0;
|
||||
in->data1_is_range = 0;
|
||||
--cd_length;
|
||||
}
|
||||
if (in->data0_is_range && (in->port0_1 < in->port0_0))
|
||||
|
|
|
@ -958,7 +958,7 @@ gkrellm_create_krell(GkrellmPanel *p, GkrellmPiximage *im, GkrellmStyle *style)
|
|||
|
||||
if (im == NULL || style == NULL)
|
||||
{
|
||||
printf(_("create_krell: NULL image or style\n"));
|
||||
g_warning(_("create_krell: NULL image or style\n"));
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
|
|
@ -3220,12 +3220,12 @@ set_list_store_model_data(GtkListStore *store, GtkTreeIter *iter,
|
|||
{
|
||||
default_port = default_port_of_proto(account->protocol,
|
||||
account->use_ssl);
|
||||
sprintf(abuf, "%s",
|
||||
snprintf(abuf, sizeof(abuf), "%s",
|
||||
auth_string(account->protocol, account->authmech));
|
||||
mailbox = g_strdup(account->server);
|
||||
if (account->port != atoi(default_port))
|
||||
{
|
||||
sprintf(pbuf, ":%d", account->port);
|
||||
snprintf(pbuf, sizeof(pbuf), ":%d", account->port);
|
||||
s = g_strconcat(mailbox, pbuf, NULL);
|
||||
g_free(mailbox);
|
||||
mailbox = s;
|
||||
|
@ -3243,7 +3243,7 @@ set_list_store_model_data(GtkListStore *store, GtkTreeIter *iter,
|
|||
}
|
||||
else
|
||||
{
|
||||
sprintf(abuf, "%s", mbox_strings[account->mboxtype & 0xf]);
|
||||
snprintf(abuf, sizeof(abuf), "%s", mbox_strings[account->mboxtype & 0xf]);
|
||||
mailbox = g_strdup_printf("%s", account->homedir_path ?
|
||||
account->homedir_path : account->path);
|
||||
}
|
||||
|
@ -3466,7 +3466,7 @@ cb_tree_selection_changed(GtkTreeSelection *selection, gpointer data)
|
|||
account->port = default_port;
|
||||
active = (account->port == default_port) ? FALSE : TRUE;
|
||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(port_button), active);
|
||||
sprintf(buf, "%d", account->port);
|
||||
snprintf(buf, sizeof(buf), "%d", account->port);
|
||||
gtk_entry_set_text(GTK_ENTRY(port_entry), buf);
|
||||
}
|
||||
else if (local_supported)
|
||||
|
|
|
@ -2050,9 +2050,10 @@ gkrellm_abort(gint sig)
|
|||
do_xmessage = FALSE;
|
||||
}
|
||||
|
||||
// FIXME: xmessage is only available on X11
|
||||
snprintf(buf, sizeof(buf), "xmessage gkrellm %s: %s (%s)", fault,
|
||||
(mon && mon->name) ? mon->name : "", state);
|
||||
printf("%s\n", buf + 9);
|
||||
g_warning("%s\n", buf + 9);
|
||||
if (do_xmessage)
|
||||
g_spawn_command_line_async(buf, NULL);
|
||||
|
||||
|
|
|
@ -179,7 +179,7 @@ get_style_from_list(GList *list, gint n)
|
|||
l = list;
|
||||
if (l->data == NULL)
|
||||
{
|
||||
printf("Warning: NULL style returned %d\n", n);
|
||||
g_warning("Warning: NULL style returned %d\n", n);
|
||||
abort();
|
||||
}
|
||||
style = (GkrellmStyle *) l->data;
|
||||
|
@ -283,7 +283,7 @@ get_piximage_from_list(GList *list, gint n)
|
|||
l = list;
|
||||
if (l->data == NULL)
|
||||
{
|
||||
printf("Warning: NULL image returned %d\n", n);
|
||||
g_warning("Warning: NULL image returned %d\n", n);
|
||||
abort();
|
||||
}
|
||||
return (GkrellmPiximage *) l->data;
|
||||
|
|
|
@ -529,9 +529,9 @@ sensor_read_temperature(Sensor *sensor, gfloat *temp, gchar *units)
|
|||
else
|
||||
*units = '\0';
|
||||
}
|
||||
if ((_GK.debug_level & DEBUG_SENSORS) && sensor)
|
||||
printf("sensor_temp: %s %s t=%.2f\n",
|
||||
sensor->name_locale, sensor->path, sensor->value);
|
||||
if (sensor)
|
||||
gkrellm_debug(DEBUG_SENSORS, "sensor_temp: %s %s t=%.2f\n",
|
||||
sensor->name_locale, sensor->path, sensor->value);
|
||||
if (found_temp && sensor)
|
||||
gkrellm_check_alert(sensor->alert, sensor->value);
|
||||
return found_temp;
|
||||
|
@ -565,9 +565,9 @@ sensor_read_fan(Sensor *sensor, gfloat *fan)
|
|||
}
|
||||
if (fan)
|
||||
*fan = f;
|
||||
if ((_GK.debug_level & DEBUG_SENSORS) && sensor)
|
||||
printf("sensor_fan: %s %s rpm=%.0f\n",
|
||||
sensor->name_locale, sensor->path, sensor->value);
|
||||
if (sensor)
|
||||
gkrellm_debug(DEBUG_SENSORS, "sensor_fan: %s %s rpm=%.0f\n",
|
||||
sensor->name_locale, sensor->path, sensor->value);
|
||||
if (found_fan && sensor)
|
||||
gkrellm_check_alert(sensor->alert, sensor->value);
|
||||
return found_fan;
|
||||
|
@ -605,9 +605,9 @@ sensor_read_voltage(Sensor *sensor, gfloat *voltage)
|
|||
}
|
||||
if (voltage)
|
||||
*voltage = v;
|
||||
if ((_GK.debug_level & DEBUG_SENSORS) && sensor)
|
||||
printf("sensor_voltage: %s %s v=%.2f\n",
|
||||
sensor->name_locale, sensor->path, sensor->value);
|
||||
if (sensor)
|
||||
gkrellm_debug(DEBUG_SENSORS, "sensor_voltage: %s %s v=%.2f\n",
|
||||
sensor->name_locale, sensor->path, sensor->value);
|
||||
if (found_voltage && sensor)
|
||||
gkrellm_check_alert(sensor->alert, sensor->value);
|
||||
return found_voltage;
|
||||
|
@ -1731,7 +1731,7 @@ save_sensors_config(FILE *f_not_used)
|
|||
|
||||
if (!sensor_list || _GK.no_config)
|
||||
return;
|
||||
sprintf(buf, "%s/%s", GKRELLM_DIR, SENSOR_CONFIG_FILE);
|
||||
snprintf(buf, sizeof(buf), "%s/%s", GKRELLM_DIR, SENSOR_CONFIG_FILE);
|
||||
config = gkrellm_make_config_file_name(gkrellm_homedir(), buf);
|
||||
f = g_fopen(config, "w");
|
||||
g_free(config);
|
||||
|
@ -1810,8 +1810,8 @@ load_sensors_config(gchar *arg)
|
|||
n = sscanf(arg, "%31s %[^\n]", config, item);
|
||||
if (n != 2)
|
||||
return;
|
||||
if (_GK.debug_level & DEBUG_SENSORS)
|
||||
printf("load_sensors_config: <%s> <%s>\n", config, item);
|
||||
gkrellm_debug(DEBUG_SENSORS, "load_sensors_config: <%s> <%s>\n", config,
|
||||
item);
|
||||
if (!strcmp(config, "sensor_config_version"))
|
||||
sscanf(item, "%d", &sensor_config_version);
|
||||
else if (!strcmp(config, "sensor_sysdep_private"))
|
||||
|
@ -1912,14 +1912,14 @@ read_sensors_config(void)
|
|||
gchar *config;
|
||||
gchar buf[CFG_BUFSIZE];
|
||||
|
||||
sprintf(buf, "%s/%s", GKRELLM_DIR, SENSOR_CONFIG_FILE);
|
||||
snprintf(buf, sizeof(buf), "%s/%s", GKRELLM_DIR, SENSOR_CONFIG_FILE);
|
||||
config = gkrellm_make_config_file_name(gkrellm_homedir(), buf);
|
||||
f = g_fopen(config, "r");
|
||||
g_free(config);
|
||||
|
||||
if (!f)
|
||||
{
|
||||
sprintf(buf, "%s/%s", GKRELLM_DIR, SENSOR_2_1_14_CONFIG_FILE);
|
||||
snprintf(buf, sizeof(buf), "%s/%s", GKRELLM_DIR, SENSOR_2_1_14_CONFIG_FILE);
|
||||
config = gkrellm_make_config_file_name(gkrellm_homedir(), buf);
|
||||
f = g_fopen(config, "r");
|
||||
g_free(config);
|
||||
|
@ -2163,7 +2163,7 @@ row_drop_possible(GtkTreeDragDest *drag_dest, GtkTreePath *path,
|
|||
src_path = gtk_tree_row_reference_get_path(row_reference);
|
||||
src_indices = gtk_tree_path_get_indices(src_path);
|
||||
dst_indices = gtk_tree_path_get_indices(path);
|
||||
//printf("drop path: indices=[%d,%d]:%d, path=%s\n",
|
||||
//g_debug("drop path: indices=[%d,%d]:%d, path=%s\n",
|
||||
// dst_indices[0], dst_indices[1], gtk_tree_path_get_depth(path),
|
||||
// gtk_tree_path_to_string(path));
|
||||
|
||||
|
@ -2469,7 +2469,7 @@ cb_tree_selection_changed(GtkTreeSelection *selection, gpointer data)
|
|||
path = gtk_tree_model_get_path(model, &iter);
|
||||
indices = gtk_tree_path_get_indices(path);
|
||||
depth = gtk_tree_path_get_depth(path);
|
||||
//printf("selection: indices=[%d,%d]:%d, path=%s\n",
|
||||
//g_debug("selection: indices=[%d,%d]:%d, path=%s\n",
|
||||
// indices[0], indices[1], gtk_tree_path_get_depth(path),
|
||||
// gtk_tree_path_to_string(path));
|
||||
change_row_reference(model, path);
|
||||
|
|
|
@ -1648,7 +1648,7 @@ scan_for_sensors(void)
|
|||
chip_dir, dentry->d_name);
|
||||
if ((iodev = open(temp_file, O_RDWR)) == -1)
|
||||
continue;
|
||||
sprintf(id_name, "%s%3s", "temp", dentry->d_name + 3);
|
||||
snprintf(id_name, sizeof(id_name), "%s%3s", "temp", dentry->d_name + 3);
|
||||
interface = INTERFACE_SMB;
|
||||
if (!gkrellm_sys_sensors_get_temperature(NULL, 0, iodev,
|
||||
interface, NULL))
|
||||
|
@ -1693,7 +1693,7 @@ scan_for_sensors(void)
|
|||
if (!gkrellm_sys_sensors_get_fan(NULL, id, iodev,
|
||||
interface, NULL))
|
||||
continue;
|
||||
sprintf(id_name, "%s%d", "fan", id);
|
||||
snprintf(id_name, sizeof(id_name), "%s%d", "fan", id);
|
||||
sensors_add_sensor(SENSOR_FAN, id_name, id,
|
||||
iodev, interface,
|
||||
1.0 / (gfloat) fandiv[id], 0.0,
|
||||
|
@ -1705,7 +1705,7 @@ scan_for_sensors(void)
|
|||
if (!gkrellm_sys_sensors_get_voltage(NULL, id, iodev,
|
||||
interface, NULL))
|
||||
continue;
|
||||
sprintf(id_name, "%s%d", "in", id);
|
||||
snprintf(id_name, sizeof(id_name), "%s%d", "in", id);
|
||||
sensors_add_sensor(SENSOR_VOLTAGE, id_name, id,
|
||||
iodev, interface,
|
||||
voltdefault0[id].factor, 0.0,
|
||||
|
|
|
@ -718,9 +718,9 @@ gkrellm_sys_disk_init(void)
|
|||
}
|
||||
if (f)
|
||||
fclose(f);
|
||||
if (_GK.debug_level & DEBUG_SYSDEP)
|
||||
printf("diskstats=%d partition_stats=%d sysfs_stats=%d\n",
|
||||
have_diskstats, have_partition_stats, have_sysfs_stats);
|
||||
gkrellm_debug(DEBUG_SYSDEP,
|
||||
"diskstats=%d partition_stats=%d sysfs_stats=%d\n", have_diskstats,
|
||||
have_partition_stats, have_sysfs_stats);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -1050,7 +1050,7 @@ gkrellm_sys_net_isdn_online(void)
|
|||
)
|
||||
{
|
||||
if (_GK.debug_level & DEBUG_NET)
|
||||
printf("sys_net_isdn__online: no /dev/isdninfo?\n");
|
||||
g_debug("sys_net_isdn__online: no /dev/isdninfo?\n");
|
||||
return FALSE;
|
||||
}
|
||||
memset(buffer, 0, BUFSIZ);
|
||||
|
@ -1124,7 +1124,7 @@ get_io_indices(void)
|
|||
fclose(f);
|
||||
}
|
||||
if (_GK.debug_level & DEBUG_NET)
|
||||
printf("rx_bytes=%d tx_bytes=%d rx_packets=%d tx_packets=%d\n",
|
||||
g_debug("rx_bytes=%d tx_bytes=%d rx_packets=%d tx_packets=%d\n",
|
||||
rx_bytes_index, tx_bytes_index,
|
||||
rx_packets_index, tx_packets_index);
|
||||
}
|
||||
|
@ -1513,7 +1513,7 @@ setup_acpi_battery(gchar *bat)
|
|||
|
||||
info = g_strconcat(ACPI_BATTERY_DIR, bat, "/info", NULL);
|
||||
if (_GK.debug_level & DEBUG_BATTERY)
|
||||
printf("setup_acpi_battery: %s\n", info);
|
||||
g_debug("setup_acpi_battery: %s\n", info);
|
||||
if (!access(info, F_OK))
|
||||
{
|
||||
bf = g_new0(BatteryFile, 1);
|
||||
|
@ -1524,7 +1524,7 @@ setup_acpi_battery(gchar *bat)
|
|||
bf->state = get_acpi_battery_file(ACPI_BATTERY_DIR, bat, "status");
|
||||
acpi_battery_list = g_list_append(acpi_battery_list, bf);
|
||||
if (_GK.debug_level & DEBUG_BATTERY)
|
||||
printf("setup_acpi_battery: %s\n",
|
||||
g_debug("setup_acpi_battery: %s\n",
|
||||
bf->state ? bf->state : "no state");
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -1542,7 +1542,7 @@ setup_ac_adapter(gchar **state, gchar *ac)
|
|||
path = get_acpi_battery_file(ACPI_AC_ADAPTOR_DIR, ac, "status");
|
||||
*state = path;
|
||||
if (_GK.debug_level & DEBUG_BATTERY)
|
||||
printf("setup_ac_adaptor: %s\n", path ? path : "no state");
|
||||
g_debug("setup_ac_adaptor: %s\n", path ? path : "no state");
|
||||
|
||||
return path ? TRUE : FALSE;
|
||||
}
|
||||
|
@ -1614,7 +1614,7 @@ acpi_battery_data(BatteryFile *bf)
|
|||
if (!bf->got_full_cap) /* get battery capacity */
|
||||
{
|
||||
if (_GK.debug_level & DEBUG_BATTERY)
|
||||
printf("getting full capacity: %s\n", bf->info);
|
||||
g_debug("getting full capacity: %s\n", bf->info);
|
||||
if ((f = fopen(bf->info, "r")) == NULL)
|
||||
return FALSE;
|
||||
bf->got_full_cap = TRUE;
|
||||
|
@ -1636,10 +1636,10 @@ acpi_battery_data(BatteryFile *bf)
|
|||
*/
|
||||
if (sscanf(buf, "design capacity: %d", &bf->full_cap) == 1)
|
||||
if (_GK.debug_level & DEBUG_BATTERY)
|
||||
printf("%s: %d <- %s", bf->info, bf->full_cap, buf);
|
||||
g_debug("%s: %d <- %s", bf->info, bf->full_cap, buf);
|
||||
if (sscanf(buf, "last full capacity: %d", &bf->full_cap) == 1)
|
||||
if (_GK.debug_level & DEBUG_BATTERY)
|
||||
printf("%s: %d <- %s", bf->info, bf->full_cap, buf);
|
||||
g_debug("%s: %d <- %s", bf->info, bf->full_cap, buf);
|
||||
}
|
||||
fclose(f);
|
||||
}
|
||||
|
@ -1696,7 +1696,7 @@ acpi_battery_data(BatteryFile *bf)
|
|||
if (sscanf(buf, "remaining capacity: %d", &cur_cap) == 1)
|
||||
{
|
||||
if (_GK.debug_level & DEBUG_BATTERY)
|
||||
printf("%s: %d <- %s", bf->state, cur_cap, buf);
|
||||
g_debug("%s: %d <- %s", bf->state, cur_cap, buf);
|
||||
continue;
|
||||
}
|
||||
if (sscanf(buf, "present rate: %d", &cur_rate) == 1)
|
||||
|
@ -1709,7 +1709,7 @@ acpi_battery_data(BatteryFile *bf)
|
|||
fclose(f);
|
||||
|
||||
if (_GK.debug_level & DEBUG_BATTERY)
|
||||
printf(
|
||||
g_debug(
|
||||
"Battery: on_line=%d charging=%d have_charging=%d state_file=%d\n",
|
||||
on_line, charging, have_charging_state,
|
||||
acpi_ac_state_file ? TRUE : FALSE);
|
||||
|
@ -1743,9 +1743,9 @@ acpi_battery_data(BatteryFile *bf)
|
|||
|
||||
if (_GK.debug_level & DEBUG_BATTERY)
|
||||
{
|
||||
printf("Battery %d: percent=%d time_left=%d cur_cap=%d full_cap=%d\n",
|
||||
g_debug("Battery %d: percent=%d time_left=%d cur_cap=%d full_cap=%d\n",
|
||||
bf->id, percent, time_left, cur_cap, bf->full_cap);
|
||||
printf(" available=%d on_line=%d charging=%d fc_bug=%d\n",
|
||||
g_debug(" available=%d on_line=%d charging=%d fc_bug=%d\n",
|
||||
available, on_line, charging, bf->full_cap_bug);
|
||||
}
|
||||
gkrellm_battery_assign_data(bf->id, available, on_line, charging,
|
||||
|
@ -1810,14 +1810,14 @@ read_sysfs_entry (gchar *buf, gint buflen, gchar const *sysentry)
|
|||
*nl = '\0';
|
||||
fclose (f);
|
||||
if (_GK.debug_level & DEBUG_BATTERY)
|
||||
printf ("read_sysfs_entry: %s = %s\n",
|
||||
g_debug ("read_sysfs_entry: %s = %s\n",
|
||||
sysentry, buf);
|
||||
return TRUE;
|
||||
}
|
||||
fclose (f);
|
||||
}
|
||||
if (_GK.debug_level & DEBUG_BATTERY)
|
||||
printf ("read_sysfs_entry: cannot read %s\n", sysentry);
|
||||
g_debug ("read_sysfs_entry: cannot read %s\n", sysentry);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -1909,7 +1909,7 @@ setup_sysfs_ac_power (gchar const *sysdir)
|
|||
syspower *sp;
|
||||
|
||||
if (_GK.debug_level & DEBUG_BATTERY)
|
||||
printf ("setup_sysfs_ac_power: %s\n", sysdir);
|
||||
g_debug ("setup_sysfs_ac_power: %s\n", sysdir);
|
||||
sp = g_new0 (syspower, 1);
|
||||
sp->type = PWRTYPE_MAINS;
|
||||
sp->id = g_pwr_id++;
|
||||
|
@ -1940,7 +1940,7 @@ setup_sysfs_battery (gchar const *sysdir)
|
|||
* pretty.)
|
||||
*/
|
||||
if (_GK.debug_level & DEBUG_BATTERY)
|
||||
printf ("setup_sysfs_battery: %s\n", sysdir);
|
||||
g_debug ("setup_sysfs_battery: %s\n", sysdir);
|
||||
units = CHGUNITS_uWH;
|
||||
sys_charge_full = g_strconcat (sysdir, "/energy_full", NULL);
|
||||
if (access (sys_charge_full, F_OK | R_OK))
|
||||
|
@ -2005,7 +2005,7 @@ done:
|
|||
/* Battery power sources are appended to the end of the list. */
|
||||
g_sysfs_power_list = g_list_append (g_sysfs_power_list, sp);
|
||||
if (_GK.debug_level & DEBUG_BATTERY)
|
||||
printf ("setup_sysfs_battery: %s, %s\n",
|
||||
g_debug ("setup_sysfs_battery: %s, %s\n",
|
||||
sys_charge_full, sys_charge_now);
|
||||
retval = TRUE;
|
||||
|
||||
|
@ -2036,7 +2036,7 @@ setup_sysfs_power_entry (gchar const *sysentry)
|
|||
|
||||
type = g_strconcat (sysdir, "/type", NULL);
|
||||
if (_GK.debug_level & DEBUG_BATTERY)
|
||||
printf ("setup_sysfs_power_entry: checking %s\n", type);
|
||||
g_debug ("setup_sysfs_power_entry: checking %s\n", type);
|
||||
if (read_sysfs_entry (buf, sizeof (buf), type))
|
||||
{
|
||||
if (!strcasecmp (buf, SYSFS_TYPE_AC_ADAPTER))
|
||||
|
@ -2044,7 +2044,7 @@ setup_sysfs_power_entry (gchar const *sysentry)
|
|||
else if (!strcasecmp (buf, SYSFS_TYPE_BATTERY))
|
||||
retval = setup_sysfs_battery (sysdir);
|
||||
else if (_GK.debug_level & DEBUG_BATTERY)
|
||||
printf ("setup_sysfs_power_entry: unknown power type: %s\n",
|
||||
g_debug ("setup_sysfs_power_entry: unknown power type: %s\n",
|
||||
buf);
|
||||
}
|
||||
g_free (type);
|
||||
|
@ -2062,7 +2062,7 @@ sysfs_power_setup (void)
|
|||
gboolean retval = FALSE;
|
||||
|
||||
if (_GK.debug_level & DEBUG_BATTERY)
|
||||
printf ("sysfs_power_setup() entry\n");
|
||||
g_debug ("sysfs_power_setup() entry\n");
|
||||
if ((d = opendir (SYSFS_POWER_SUPPLIES)) == NULL)
|
||||
return retval;
|
||||
|
||||
|
@ -2366,7 +2366,7 @@ sensors_config_migrate(gchar *current_name, gchar *config_name,
|
|||
{
|
||||
if (_GK.debug_level & DEBUG_SENSORS)
|
||||
{
|
||||
printf("migrate name %s->%s: %s -> %s\n",
|
||||
g_debug("migrate name %s->%s: %s -> %s\n",
|
||||
(config == SENSOR_NAMES_I2C) ? "i2c" : "hwmon",
|
||||
(current == SENSOR_NAMES_LIBSENSORS) ?
|
||||
"libsensors" : "hwmon",
|
||||
|
@ -2401,7 +2401,7 @@ sensors_config_migrate(gchar *current_name, gchar *config_name,
|
|||
{
|
||||
if (_GK.debug_level & DEBUG_SENSORS)
|
||||
{
|
||||
printf("migrate name %s->%s: %s -> %s\n",
|
||||
g_debug("migrate name %s->%s: %s -> %s\n",
|
||||
(config == SENSOR_NAMES_LIBSENSORS) ?
|
||||
"libsensors" : "hwmon",
|
||||
(current == SENSOR_NAMES_I2C) ? "i2c" : "hwmon",
|
||||
|
@ -2458,20 +2458,20 @@ libsensors_init(void)
|
|||
if (!f)
|
||||
{
|
||||
if (_GK.debug_level & DEBUG_SENSORS)
|
||||
printf("libsensors: could not open /etc/sensors.conf\n");
|
||||
g_debug("libsensors: could not open /etc/sensors.conf\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (sensors_init(f) != 0)
|
||||
{
|
||||
if (_GK.debug_level & DEBUG_SENSORS)
|
||||
printf("libsensors: init failed!\n");
|
||||
g_debug("libsensors: init failed!\n");
|
||||
return FALSE;
|
||||
}
|
||||
fclose(f);
|
||||
|
||||
if (_GK.debug_level & DEBUG_SENSORS)
|
||||
printf("libsensors: init OK\n");
|
||||
g_debug("libsensors: init OK\n");
|
||||
|
||||
n_sensors_added = 0;
|
||||
nr = 0;
|
||||
|
@ -2506,7 +2506,7 @@ libsensors_init(void)
|
|||
else
|
||||
{
|
||||
if (_GK.debug_level & DEBUG_SENSORS)
|
||||
printf("libsensors: error determining type for: %s\n",
|
||||
g_debug("libsensors: error determining type for: %s\n",
|
||||
id_name);
|
||||
continue;
|
||||
}
|
||||
|
@ -2516,14 +2516,14 @@ libsensors_init(void)
|
|||
if (name->bus != ((name->bus << 16) >> 16))
|
||||
{
|
||||
if (_GK.debug_level & DEBUG_SENSORS)
|
||||
printf("libsensors: bus bigger than 16 bits: %s\n",
|
||||
g_debug("libsensors: bus bigger than 16 bits: %s\n",
|
||||
id_name);
|
||||
continue;
|
||||
}
|
||||
if (name->addr != ((name->addr << 16) >> 16))
|
||||
{
|
||||
if (_GK.debug_level & DEBUG_SENSORS)
|
||||
printf("libsensors: addr bigger than 16 bits: %s\n",
|
||||
g_debug("libsensors: addr bigger than 16 bits: %s\n",
|
||||
id_name);
|
||||
continue;
|
||||
}
|
||||
|
@ -2536,7 +2536,7 @@ libsensors_init(void)
|
|||
if (sensors_get_label(*name, feature->number, &label) != 0)
|
||||
{
|
||||
if (_GK.debug_level & DEBUG_SENSORS)
|
||||
printf("libsensors: error getting label for: %s\n",
|
||||
g_debug("libsensors: error getting label for: %s\n",
|
||||
id_name);
|
||||
label = NULL;
|
||||
}
|
||||
|
@ -2544,12 +2544,12 @@ libsensors_init(void)
|
|||
if (sensors_init(NULL) != 0)
|
||||
{
|
||||
if (_GK.debug_level & DEBUG_SENSORS)
|
||||
printf("libsensors: init failed!\n");
|
||||
g_debug("libsensors: init failed!\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (_GK.debug_level & DEBUG_SENSORS)
|
||||
printf("libsensors: init OK\n");
|
||||
g_debug("libsensors: init OK\n");
|
||||
|
||||
n_sensors_added = 0;
|
||||
nr = 0;
|
||||
|
@ -2597,7 +2597,7 @@ libsensors_init(void)
|
|||
break;
|
||||
default:
|
||||
if (_GK.debug_level & DEBUG_SENSORS)
|
||||
printf("libsensors: error determining type for: %s\n",
|
||||
g_debug("libsensors: error determining type for: %s\n",
|
||||
id_name);
|
||||
continue;
|
||||
}
|
||||
|
@ -2605,7 +2605,7 @@ libsensors_init(void)
|
|||
if (!feature)
|
||||
{
|
||||
if (_GK.debug_level & DEBUG_SENSORS)
|
||||
printf("libsensors: error could not get input subfeature for: %s\n",
|
||||
g_debug("libsensors: error could not get input subfeature for: %s\n",
|
||||
id_name);
|
||||
continue;
|
||||
}
|
||||
|
@ -2616,21 +2616,21 @@ libsensors_init(void)
|
|||
if (name->bus.type != ((name->bus.type << 24) >> 24))
|
||||
{
|
||||
if (_GK.debug_level & DEBUG_SENSORS)
|
||||
printf("libsensors: bus-type bigger than 8 bits: %s\n",
|
||||
g_debug("libsensors: bus-type bigger than 8 bits: %s\n",
|
||||
id_name);
|
||||
continue;
|
||||
}
|
||||
if (name->bus.nr != ((name->bus.nr << 24) >> 24))
|
||||
{
|
||||
if (_GK.debug_level & DEBUG_SENSORS)
|
||||
printf("libsensors: bus-nr bigger than 8 bits: %s\n",
|
||||
g_debug("libsensors: bus-nr bigger than 8 bits: %s\n",
|
||||
id_name);
|
||||
continue;
|
||||
}
|
||||
if (name->addr != ((name->addr << 16) >> 16))
|
||||
{
|
||||
if (_GK.debug_level & DEBUG_SENSORS)
|
||||
printf("libsensors: addr bigger than 16 bits: %s\n",
|
||||
g_debug("libsensors: addr bigger than 16 bits: %s\n",
|
||||
id_name);
|
||||
continue;
|
||||
}
|
||||
|
@ -2644,7 +2644,7 @@ libsensors_init(void)
|
|||
|
||||
label = sensors_get_label(name, main_feature);
|
||||
if (!label && (_GK.debug_level & DEBUG_SENSORS))
|
||||
printf("libsensors: error getting label for: %s\n",
|
||||
g_debug("libsensors: error getting label for: %s\n",
|
||||
id_name);
|
||||
|
||||
/* additional { to match "if (get_ignored(..) {"
|
||||
|
@ -2693,7 +2693,7 @@ libsensors_init(void)
|
|||
free(label);
|
||||
|
||||
if (_GK.debug_level & DEBUG_SENSORS)
|
||||
printf("%s %s %x\n",
|
||||
g_debug("%s %s %x\n",
|
||||
sensor_path, id_name,
|
||||
iodev);
|
||||
|
||||
|
@ -2730,7 +2730,7 @@ libsensors_get_value(char *sensor_path, int id, int iodev, float *value)
|
|||
if (!p)
|
||||
{
|
||||
if (_GK.debug_level & DEBUG_SENSORS)
|
||||
printf("libsensors: error parsing sensor_path: %s\n",
|
||||
g_debug("libsensors: error parsing sensor_path: %s\n",
|
||||
sensor_path);
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -2748,11 +2748,11 @@ libsensors_get_value(char *sensor_path, int id, int iodev, float *value)
|
|||
if (!result && (_GK.debug_level & DEBUG_SENSORS))
|
||||
{
|
||||
if (name.bus >= 0)
|
||||
printf(
|
||||
g_debug(
|
||||
"libsensors: error getting value for: %s@%d:%x feature: %d\n",
|
||||
name.prefix, name.bus, name.addr, id);
|
||||
else
|
||||
printf("libsensors: error getting value for: %s@%x feature: %d\n",
|
||||
g_debug("libsensors: error getting value for: %s@%x feature: %d\n",
|
||||
name.prefix, name.addr, id);
|
||||
}
|
||||
|
||||
|
@ -2771,12 +2771,12 @@ libsensors_get_value(char *sensor_path, int id, int iodev, float *value)
|
|||
{
|
||||
case SENSORS_BUS_TYPE_I2C:
|
||||
case SENSORS_BUS_TYPE_SPI:
|
||||
printf(
|
||||
g_debug(
|
||||
"libsensors: error getting value for: %s@%d:%x feature: %d\n",
|
||||
name.prefix, (int)name.bus.nr, name.addr, id);
|
||||
break;
|
||||
default:
|
||||
printf("libsensors: error getting value for: %s@%x feature: %d\n",
|
||||
g_debug("libsensors: error getting value for: %s@%x feature: %d\n",
|
||||
name.prefix, name.addr, id);
|
||||
}
|
||||
}
|
||||
|
@ -3407,7 +3407,7 @@ sysfs_sensors_init(void)
|
|||
}
|
||||
have_sysfs_sensors = TRUE;
|
||||
if (_GK.debug_level & DEBUG_SENSORS)
|
||||
printf("sysfs sensors dir: %s\n", path);
|
||||
g_debug("sysfs sensors dir: %s\n", path);
|
||||
|
||||
get_volt_default(chip_name, &voltdefault, &voltdefaultsize);
|
||||
while ((name = (gchar *) g_dir_read_name(chip_dir)) != NULL)
|
||||
|
@ -3454,7 +3454,7 @@ sysfs_sensors_init(void)
|
|||
id, 0, 0,
|
||||
factor, offset, vref, default_label);
|
||||
if (_GK.debug_level & DEBUG_SENSORS)
|
||||
printf("%s %s %d %d\n",
|
||||
g_debug("%s %s %d %d\n",
|
||||
sensor_path, id_name, id, type);
|
||||
|
||||
if (!using_i2c_dir)
|
||||
|
@ -3506,7 +3506,7 @@ sensors_nvidia_settings_ngpus(void)
|
|||
g_free(output);
|
||||
#endif
|
||||
if (_GK.debug_level & DEBUG_SENSORS)
|
||||
printf("nvidia-settings gpus = %d\n", n);
|
||||
g_debug("nvidia-settings gpus = %d\n", n);
|
||||
return n;
|
||||
}
|
||||
|
||||
|
@ -3532,7 +3532,7 @@ sensors_nvclock_ngpus(void)
|
|||
g_free(output);
|
||||
#endif
|
||||
if (_GK.debug_level & DEBUG_SENSORS)
|
||||
printf("nvclock gpus = %d\n", n);
|
||||
g_debug("nvclock gpus = %d\n", n);
|
||||
return n;
|
||||
}
|
||||
|
||||
|
@ -3921,7 +3921,7 @@ gkrellm_sys_sensors_init(void)
|
|||
}
|
||||
#else
|
||||
if (_GK.debug_level & DEBUG_SENSORS)
|
||||
printf("libsensors support is not compiled in.\n");
|
||||
g_debug("libsensors support is not compiled in.\n");
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -3943,7 +3943,7 @@ gkrellm_sys_sensors_init(void)
|
|||
continue;
|
||||
}
|
||||
if (_GK.debug_level & DEBUG_SENSORS)
|
||||
printf("lm_sensors dir: %s\n", path);
|
||||
g_debug("lm_sensors dir: %s\n", path);
|
||||
|
||||
get_volt_default(chip_name, &voltdefault, &voltdefaultsize);
|
||||
while ((sensor_name = (gchar *) g_dir_read_name(chip_dir)) != NULL)
|
||||
|
@ -3985,7 +3985,7 @@ gkrellm_sys_sensors_init(void)
|
|||
factor, offset, vref, default_label);
|
||||
|
||||
if (_GK.debug_level & DEBUG_SENSORS)
|
||||
printf("%s %s %d %d\n",
|
||||
g_debug("%s %s %d %d\n",
|
||||
sensor_path, id_name, id, type);
|
||||
g_free(sensor_path);
|
||||
}
|
||||
|
|
|
@ -32,7 +32,6 @@
|
|||
*/
|
||||
|
||||
|
||||
|
||||
/* A system dependent interface can include this file to get sensors
|
||||
| from daemons that can run under different operating systems.
|
||||
*/
|
||||
|
@ -85,9 +84,8 @@ mbmon_decimal_point_check(gchar *buf)
|
|||
if (mbmon_decimal_point_fix(s))
|
||||
{
|
||||
mbmon_need_decimal_point_fix = TRUE;
|
||||
if (_GK.debug_level & DEBUG_SENSORS)
|
||||
printf("mbmon_need_decimal_point_fix: %c -> %c\n",
|
||||
mbmon_decimal_point, gkrellm_decimal_point);
|
||||
gkrellm_debug(DEBUG_SENSORS, "mbmon_need_decimal_point_fix: %c -> %c\n",
|
||||
mbmon_decimal_point, gkrellm_decimal_point);
|
||||
}
|
||||
g_free(s);
|
||||
|
||||
|
@ -143,9 +141,9 @@ mbmon_daemon_read(void)
|
|||
|
||||
if ((fd = gkrellm_connect_to(server, _GK.mbmon_port)) < 0)
|
||||
{
|
||||
if (_GK.debug_level & DEBUG_SENSORS)
|
||||
printf("mbmon_daemon_read: can't connect to %s:%d.\n",
|
||||
server, _GK.mbmon_port);
|
||||
gkrellm_debug(DEBUG_SENSORS,
|
||||
"mbmon_daemon_read: can't connect to %s:%d.\n", server,
|
||||
_GK.mbmon_port);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -160,8 +158,7 @@ mbmon_daemon_read(void)
|
|||
}
|
||||
close(fd);
|
||||
|
||||
if (_GK.debug_level & DEBUG_SENSORS)
|
||||
printf("mbmon_daemon_read:\n%s\n", mbmon_gstring->str);
|
||||
gkrellm_debug(DEBUG_SENSORS, "mbmon_daemon_read:\n%s\n", mbmon_gstring->str);
|
||||
|
||||
while (gkrellm_getline_from_gstring(&mbmon_gstring, buf, sizeof(buf)))
|
||||
{
|
||||
|
@ -317,9 +314,9 @@ hddtemp_daemon_read(void)
|
|||
|
||||
if ((fd = gkrellm_connect_to(server, HDDTEMP_PORT)) < 0)
|
||||
{
|
||||
if (_GK.debug_level & DEBUG_SENSORS)
|
||||
printf("hddtemp_daemon_read: can't connect to %s:%d.\n",
|
||||
server, HDDTEMP_PORT);
|
||||
gkrellm_debug(DEBUG_SENSORS,
|
||||
"hddtemp_daemon_read: can't connect to %s:%d.\n", server,
|
||||
HDDTEMP_PORT);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -334,9 +331,8 @@ hddtemp_daemon_read(void)
|
|||
}
|
||||
close(fd);
|
||||
|
||||
if (_GK.debug_level & DEBUG_SENSORS)
|
||||
printf("hddtemp_daemon_read (once a minute):\n\t%s\n",
|
||||
hddtemp_gstring->str);
|
||||
gkrellm_debug(DEBUG_SENSORS, "hddtemp_daemon_read (once a minute):\n\t%s\n",
|
||||
hddtemp_gstring->str);
|
||||
|
||||
sep = hddtemp_gstring->str[0];
|
||||
if (sep == '\0')
|
||||
|
|
|
@ -468,9 +468,9 @@ check_media_type(kstat_t *ksp) {
|
|||
return 0; /* guess it's removable media */
|
||||
} else {
|
||||
#ifdef DEBUG
|
||||
printf("opening %s\n", devices_path);
|
||||
printf("unexpected errno: %d\n", errno);
|
||||
printf("disabled auto-detection/exclusion of removable media\n");
|
||||
g_message("opening %s\n", devices_path);
|
||||
g_message("unexpected errno: %d\n", errno);
|
||||
g_message("disabled auto-detection/exclusion of removable media\n");
|
||||
#endif
|
||||
close(fd);
|
||||
di_devfs_path_free(phys_path);
|
||||
|
@ -773,11 +773,11 @@ gkrellm_sys_net_sync(void)
|
|||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("interfaces probed: ");
|
||||
g_message("interfaces probed: ");
|
||||
for (i=0; i < numifs; i++) {
|
||||
printf("%s ", ifc.ifc_req[i].ifr_name);
|
||||
g_message("%s ", ifc.ifc_req[i].ifr_name);
|
||||
}
|
||||
printf("\n");
|
||||
g_message("\n");
|
||||
#endif
|
||||
|
||||
ifrp = ifc.ifc_req;
|
||||
|
|
|
@ -114,7 +114,7 @@ gkrellm_cut_quoted_string(gchar *src, gchar **endptr)
|
|||
{
|
||||
if (endptr)
|
||||
*endptr = src;
|
||||
printf(_("Unterminated quote\n"));
|
||||
g_warning(_("Unterminated quote\n"));
|
||||
return NULL;
|
||||
}
|
||||
*s = '\0';
|
||||
|
@ -230,7 +230,7 @@ gkrellm_make_home_subdir(gchar *subdir, gchar **path)
|
|||
if (!g_file_test(dir, G_FILE_TEST_IS_DIR))
|
||||
{
|
||||
if (g_mkdir(dir, 0755) < 0)
|
||||
printf(_("Cannot create directory: %s\n"), dir);
|
||||
g_warning(_("Cannot create directory: %s\n"), dir);
|
||||
else
|
||||
result = TRUE;
|
||||
}
|
||||
|
|
|
@ -129,7 +129,7 @@ gkrellm_winop_options(gint argc, gchar **argv)
|
|||
&& !_gkrellm_get_lock()
|
||||
)
|
||||
{
|
||||
printf("gkrellm: %s\n",
|
||||
g_message("gkrellm: %s\n",
|
||||
_("Exiting because multiple instances option is off.\n"));
|
||||
exit(0);
|
||||
}
|
||||
|
@ -163,8 +163,7 @@ gkrellm_winop_place_gkrellm(gchar *geom)
|
|||
_GK.y_position = y;
|
||||
_GK.x_position = x;
|
||||
_GK.position_valid = TRUE;
|
||||
if (_GK.debug_level & DEBUG_POSITION)
|
||||
printf("geometry moveto %d %d\n", x, y);
|
||||
gkrellm_debug(DEBUG_POSITION, "geometry moveto %d %d\n", x, y);
|
||||
*/
|
||||
}
|
||||
|
||||
|
|
|
@ -383,7 +383,7 @@ gkrellm_winop_options(gint argc, gchar **argv)
|
|||
&& !_gkrellm_get_lock()
|
||||
)
|
||||
{
|
||||
printf("gkrellm: %s\n",
|
||||
g_message("gkrellm: %s\n",
|
||||
_("Exiting because multiple instances option is off.\n"));
|
||||
exit(0);
|
||||
}
|
||||
|
@ -481,8 +481,7 @@ gkrellm_winop_place_gkrellm(gchar *geom)
|
|||
_GK.y_position = y;
|
||||
_GK.x_position = x;
|
||||
_GK.position_valid = TRUE;
|
||||
if (_GK.debug_level & DEBUG_POSITION)
|
||||
printf("geometry moveto %d %d\n", x, y);
|
||||
gkrellm_debug(DEBUG_POSITION, "geometry moveto %d %d\n", x, y);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
Loading…
Reference in New Issue