1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-12-27 04:32:55 +00:00

Make device argument optional for most net stats.

We can use DEFAULTNETDEV for more than just up/downspeedgraph.
This commit is contained in:
Brenden Matthews 2009-06-06 22:56:29 -06:00
parent 00e559aef8
commit a9c8ae4145
2 changed files with 80 additions and 32 deletions

View File

@ -31,7 +31,7 @@
<command> <command>
<option>addr</option> <option>addr</option>
</command> </command>
<option>interface</option> <option>(interface)</option>
</term> </term>
<listitem>IP address for an interface, or "No Address" if <listitem>IP address for an interface, or "No Address" if
no address is assigned. no address is assigned.
@ -42,7 +42,7 @@
<command> <command>
<option>addrs</option> <option>addrs</option>
</command> </command>
<option>interface</option> <option>(interface)</option>
</term> </term>
<listitem>IP addresses for an interface (if one - works <listitem>IP addresses for an interface (if one - works
like addr). Linux only. like addr). Linux only.
@ -745,7 +745,7 @@
<command> <command>
<option>downspeed</option> <option>downspeed</option>
</command> </command>
<option>net</option> <option>(net)</option>
</term> </term>
<listitem>Download speed in KiB <listitem>Download speed in KiB
<para /></listitem> <para /></listitem>
@ -755,7 +755,7 @@
<command> <command>
<option>downspeedf</option> <option>downspeedf</option>
</command> </command>
<option>net</option> <option>(net)</option>
</term> </term>
<listitem>Download speed in KiB with one decimal <listitem>Download speed in KiB with one decimal
<para /></listitem> <para /></listitem>
@ -2929,7 +2929,7 @@
<command> <command>
<option>totaldown</option> <option>totaldown</option>
</command> </command>
<option>net</option> <option>(net)</option>
</term> </term>
<listitem>Total download, overflows at 4 GB on Linux with <listitem>Total download, overflows at 4 GB on Linux with
32-bit arch and there doesn't seem to be a way to know how 32-bit arch and there doesn't seem to be a way to know how
@ -2942,7 +2942,7 @@
<command> <command>
<option>totalup</option> <option>totalup</option>
</command> </command>
<option>net</option> <option>(net)</option>
</term> </term>
<listitem>Total upload, this one too, may overflow <listitem>Total upload, this one too, may overflow
<para /></listitem> <para /></listitem>
@ -3041,7 +3041,7 @@
<command> <command>
<option>upspeed</option> <option>upspeed</option>
</command> </command>
<option>net</option> <option>(net)</option>
</term> </term>
<listitem>Upload speed in KiB <listitem>Upload speed in KiB
<para /></listitem> <para /></listitem>
@ -3051,7 +3051,7 @@
<command> <command>
<option>upspeedf</option> <option>upspeedf</option>
</command> </command>
<option>net</option> <option>(net)</option>
</term> </term>
<listitem>Upload speed in KiB with one decimal <listitem>Upload speed in KiB with one decimal
<para /></listitem> <para /></listitem>
@ -3176,7 +3176,7 @@
<command> <command>
<option>wireless_ap</option> <option>wireless_ap</option>
</command> </command>
<option>net</option> <option>(net)</option>
</term> </term>
<listitem>Wireless access point MAC address (Linux only) <listitem>Wireless access point MAC address (Linux only)
<para /></listitem> <para /></listitem>
@ -3186,7 +3186,7 @@
<command> <command>
<option>wireless_bitrate</option> <option>wireless_bitrate</option>
</command> </command>
<option>net</option> <option>(net)</option>
</term> </term>
<listitem>Wireless bitrate (ie 11 Mb/s) (Linux only) <listitem>Wireless bitrate (ie 11 Mb/s) (Linux only)
<para /></listitem> <para /></listitem>
@ -3196,7 +3196,7 @@
<command> <command>
<option>wireless_essid</option> <option>wireless_essid</option>
</command> </command>
<option>net</option> <option>(net)</option>
</term> </term>
<listitem>Wireless access point ESSID (Linux only) <listitem>Wireless access point ESSID (Linux only)
<para /></listitem> <para /></listitem>
@ -3206,7 +3206,7 @@
<command> <command>
<option>wireless_link_bar</option> <option>wireless_link_bar</option>
</command> </command>
<option>(height), (width) net</option> <option>(height),(width) (net)</option>
</term> </term>
<listitem>Wireless link quality bar (Linux only) <listitem>Wireless link quality bar (Linux only)
<para /></listitem> <para /></listitem>
@ -3216,7 +3216,7 @@
<command> <command>
<option>wireless_link_qual</option> <option>wireless_link_qual</option>
</command> </command>
<option>net</option> <option>(net)</option>
</term> </term>
<listitem>Wireless link quality (Linux only) <listitem>Wireless link quality (Linux only)
<para /></listitem> <para /></listitem>
@ -3226,7 +3226,7 @@
<command> <command>
<option>wireless_link_qual_max</option> <option>wireless_link_qual_max</option>
</command> </command>
<option>net</option> <option>(net)</option>
</term> </term>
<listitem>Wireless link quality maximum value (Linux only) <listitem>Wireless link quality maximum value (Linux only)
<para /></listitem> <para /></listitem>
@ -3236,7 +3236,7 @@
<command> <command>
<option>wireless_link_qual_perc</option> <option>wireless_link_qual_perc</option>
</command> </command>
<option>net</option> <option>(net)</option>
</term> </term>
<listitem>Wireless link quality in percents (Linux only) <listitem>Wireless link quality in percents (Linux only)
<para /></listitem> <para /></listitem>
@ -3246,7 +3246,7 @@
<command> <command>
<option>wireless_mode</option> <option>wireless_mode</option>
</command> </command>
<option>net</option> <option>(net)</option>
</term> </term>
<listitem>Wireless mode (Managed/Ad-Hoc/Master) (Linux <listitem>Wireless mode (Managed/Ad-Hoc/Master) (Linux
only) only)

View File

@ -1267,43 +1267,64 @@ static struct text_object *construct_text_object(const char *s,
if (arg) { if (arg) {
obj->data.net = get_net_stat(arg); obj->data.net = get_net_stat(arg);
} else { } else {
CRIT_ERR("wireless_essid: needs an argument"); // default to DEFAULTNETDEV
char *buf = strndup(DEFAULTNETDEV, text_buffer_size);
obj->data.net = get_net_stat(buf);
free(buf);
} }
END OBJ(wireless_mode, INFO_NET) END OBJ(wireless_mode, INFO_NET)
if (arg) { if (arg) {
obj->data.net = get_net_stat(arg); obj->data.net = get_net_stat(arg);
} else { } else {
CRIT_ERR("wireless_mode: needs an argument"); // default to DEFAULTNETDEV
char *buf = strndup(DEFAULTNETDEV, text_buffer_size);
obj->data.net = get_net_stat(buf);
free(buf);
} }
END OBJ(wireless_bitrate, INFO_NET) END OBJ(wireless_bitrate, INFO_NET)
if (arg) { if (arg) {
obj->data.net = get_net_stat(arg); obj->data.net = get_net_stat(arg);
} else { } else {
CRIT_ERR("wireless_bitrate: needs an argument"); // default to DEFAULTNETDEV
char *buf = strndup(DEFAULTNETDEV, text_buffer_size);
obj->data.net = get_net_stat(buf);
free(buf);
} }
END OBJ(wireless_ap, INFO_NET) END OBJ(wireless_ap, INFO_NET)
if (arg) { if (arg) {
obj->data.net = get_net_stat(arg); obj->data.net = get_net_stat(arg);
} else { } else {
CRIT_ERR("wireless_ap: needs an argument"); // default to DEFAULTNETDEV
char *buf = strndup(DEFAULTNETDEV, text_buffer_size);
obj->data.net = get_net_stat(buf);
free(buf);
} }
END OBJ(wireless_link_qual, INFO_NET) END OBJ(wireless_link_qual, INFO_NET)
if (arg) { if (arg) {
obj->data.net = get_net_stat(arg); obj->data.net = get_net_stat(arg);
} else { } else {
CRIT_ERR("wireless_link_qual: needs an argument"); // default to DEFAULTNETDEV
char *buf = strndup(DEFAULTNETDEV, text_buffer_size);
obj->data.net = get_net_stat(buf);
free(buf);
} }
END OBJ(wireless_link_qual_max, INFO_NET) END OBJ(wireless_link_qual_max, INFO_NET)
if (arg) { if (arg) {
obj->data.net = get_net_stat(arg); obj->data.net = get_net_stat(arg);
} else { } else {
CRIT_ERR("wireless_link_qual_max: needs an argument"); // default to DEFAULTNETDEV
char *buf = strndup(DEFAULTNETDEV, text_buffer_size);
obj->data.net = get_net_stat(buf);
free(buf);
} }
END OBJ(wireless_link_qual_perc, INFO_NET) END OBJ(wireless_link_qual_perc, INFO_NET)
if (arg) { if (arg) {
obj->data.net = get_net_stat(arg); obj->data.net = get_net_stat(arg);
} else { } else {
CRIT_ERR("wireless_link_qual_perc: needs an argument"); // default to DEFAULTNETDEV
char *buf = strndup(DEFAULTNETDEV, text_buffer_size);
obj->data.net = get_net_stat(buf);
free(buf);
} }
END OBJ(wireless_link_bar, INFO_NET) END OBJ(wireless_link_bar, INFO_NET)
SIZE_DEFAULTS(bar); SIZE_DEFAULTS(bar);
@ -1311,7 +1332,10 @@ static struct text_object *construct_text_object(const char *s,
arg = scan_bar(arg, &obj->a, &obj->b); arg = scan_bar(arg, &obj->a, &obj->b);
obj->data.net = get_net_stat(arg); obj->data.net = get_net_stat(arg);
} else { } else {
CRIT_ERR("wireless_link_bar: needs an argument"); // default to DEFAULTNETDEV
char *buf = strndup(DEFAULTNETDEV, text_buffer_size);
obj->data.net = get_net_stat(buf);
free(buf);
} }
#endif /* HAVE_IWLIB */ #endif /* HAVE_IWLIB */
@ -1586,13 +1610,19 @@ static struct text_object *construct_text_object(const char *s,
if (arg) { if (arg) {
obj->data.net = get_net_stat(arg); obj->data.net = get_net_stat(arg);
} else { } else {
CRIT_ERR("downspeed needs argument"); // default to DEFAULTNETDEV
char *buf = strndup(DEFAULTNETDEV, text_buffer_size);
obj->data.net = get_net_stat(buf);
free(buf);
} }
END OBJ(downspeedf, INFO_NET) END OBJ(downspeedf, INFO_NET)
if (arg) { if (arg) {
obj->data.net = get_net_stat(arg); obj->data.net = get_net_stat(arg);
} else { } else {
CRIT_ERR("downspeedf needs argument"); // default to DEFAULTNETDEV
char *buf = strndup(DEFAULTNETDEV, text_buffer_size);
obj->data.net = get_net_stat(buf);
free(buf);
} }
#ifdef X11 #ifdef X11
END OBJ(downspeedgraph, INFO_NET) END OBJ(downspeedgraph, INFO_NET)
@ -1927,14 +1957,20 @@ static struct text_object *construct_text_object(const char *s,
if (arg) { if (arg) {
obj->data.net = get_net_stat(arg); obj->data.net = get_net_stat(arg);
} else { } else {
CRIT_ERR("addr needs argument"); // default to DEFAULTNETDEV
char *buf = strndup(DEFAULTNETDEV, text_buffer_size);
obj->data.net = get_net_stat(buf);
free(buf);
} }
#if defined(__linux__) #if defined(__linux__)
END OBJ(addrs, INFO_NET) END OBJ(addrs, INFO_NET)
if (arg) { if (arg) {
obj->data.net = get_net_stat(arg); obj->data.net = get_net_stat(arg);
} else { } else {
CRIT_ERR("addrs needs argument"); // default to DEFAULTNETDEV
char *buf = strndup(DEFAULTNETDEV, text_buffer_size);
obj->data.net = get_net_stat(buf);
free(buf);
} }
#endif /* __linux__ */ #endif /* __linux__ */
END OBJ(tail, 0) END OBJ(tail, 0)
@ -2387,14 +2423,20 @@ static struct text_object *construct_text_object(const char *s,
if (arg) { if (arg) {
obj->data.net = get_net_stat(arg); obj->data.net = get_net_stat(arg);
} else { } else {
CRIT_ERR("totaldown needs argument"); // default to DEFAULTNETDEV
char *buf = strndup(DEFAULTNETDEV, text_buffer_size);
obj->data.net = get_net_stat(buf);
free(buf);
} }
END OBJ(totalup, INFO_NET) END OBJ(totalup, INFO_NET)
obj->data.net = get_net_stat(arg); obj->data.net = get_net_stat(arg);
if (arg) { if (arg) {
obj->data.net = get_net_stat(arg); obj->data.net = get_net_stat(arg);
} else { } else {
CRIT_ERR("totalup needs argument"); // default to DEFAULTNETDEV
char *buf = strndup(DEFAULTNETDEV, text_buffer_size);
obj->data.net = get_net_stat(buf);
free(buf);
} }
END OBJ(updates, 0) END OBJ(updates, 0)
END OBJ_IF(if_updatenr, 0) END OBJ_IF(if_updatenr, 0)
@ -2409,13 +2451,19 @@ static struct text_object *construct_text_object(const char *s,
if (arg) { if (arg) {
obj->data.net = get_net_stat(arg); obj->data.net = get_net_stat(arg);
} else { } else {
CRIT_ERR("upspeed needs argument"); // default to DEFAULTNETDEV
char *buf = strndup(DEFAULTNETDEV, text_buffer_size);
obj->data.net = get_net_stat(buf);
free(buf);
} }
END OBJ(upspeedf, INFO_NET) END OBJ(upspeedf, INFO_NET)
if (arg) { if (arg) {
obj->data.net = get_net_stat(arg); obj->data.net = get_net_stat(arg);
} else { } else {
CRIT_ERR("upspeedf needs argument"); // default to DEFAULTNETDEV
char *buf = strndup(DEFAULTNETDEV, text_buffer_size);
obj->data.net = get_net_stat(buf);
free(buf);
} }
#ifdef X11 #ifdef X11