* Please see COPYING for details
*
* Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen
- * Copyright (c) 2005-2009 Brenden Matthews, Philip Kovacs, et. al.
+ * Copyright (c) 2005-2010 Brenden Matthews, Philip Kovacs, et. al.
* (see AUTHORS)
* All rights reserved.
*
obj->data.opaque = get_net_stat(DEFAULTNETDEV, obj, free_at_crash);
}
-void print_downspeedgraph(struct text_object *obj, char *p)
+void print_downspeedgraph(struct text_object *obj, char *p, int p_max_size)
{
struct net_stat *ns = obj->data.opaque;
- if (!ns)
+ if (!ns || !p_max_size)
return;
- new_graph(obj, p, ns->recv_speed / 1024.0);
+ new_graph(obj, p, p_max_size, ns->recv_speed / 1024.0);
}
-void print_upspeedgraph(struct text_object *obj, char *p)
+void print_upspeedgraph(struct text_object *obj, char *p, int p_max_size)
{
struct net_stat *ns = obj->data.opaque;
- if (!ns)
+ if (!ns || !p_max_size)
return;
- new_graph(obj, p, ns->trans_speed / 1024.0);
+ new_graph(obj, p, p_max_size, ns->trans_speed / 1024.0);
}
#endif /* X11 */
if (!ns)
return;
-#ifdef X11
- if(output_methods & TO_X) {
- new_bar(obj, p, ((double) ns->link_qual /
- ns->link_qual_max) * 255.0);
- } else
-#endif /* X11 */
- new_bar_in_shell(obj, p, p_max_size, ((double) ns->link_qual /
- ns->link_qual_max) * 100.0);
+ new_bar(obj, p, p_max_size,
+ ((double) ns->link_qual / ns->link_qual_max) * 255.0);
}
#endif /* HAVE_IWLIB */
#endif /* __linux__ */
memset(&dns_data, 0, sizeof(dns_data));
}
-void update_dns_data(void)
+int update_dns_data(void)
{
FILE *fp;
char line[256];
free_dns_data();
if ((fp = fopen("/etc/resolv.conf", "r")) == NULL)
- return;
+ return 0;
while(!feof(fp)) {
if (fgets(line, 255, fp) == NULL) {
break;
}
}
fclose(fp);
+ return 0;
}
void parse_nameserver_arg(struct text_object *obj, const char *arg)