1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-12-26 12:27:52 +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>
<option>addr</option>
</command>
<option>interface</option>
<option>(interface)</option>
</term>
<listitem>IP address for an interface, or "No Address" if
no address is assigned.
@ -42,7 +42,7 @@
<command>
<option>addrs</option>
</command>
<option>interface</option>
<option>(interface)</option>
</term>
<listitem>IP addresses for an interface (if one - works
like addr). Linux only.
@ -745,7 +745,7 @@
<command>
<option>downspeed</option>
</command>
<option>net</option>
<option>(net)</option>
</term>
<listitem>Download speed in KiB
<para /></listitem>
@ -755,7 +755,7 @@
<command>
<option>downspeedf</option>
</command>
<option>net</option>
<option>(net)</option>
</term>
<listitem>Download speed in KiB with one decimal
<para /></listitem>
@ -2929,7 +2929,7 @@
<command>
<option>totaldown</option>
</command>
<option>net</option>
<option>(net)</option>
</term>
<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
@ -2942,7 +2942,7 @@
<command>
<option>totalup</option>
</command>
<option>net</option>
<option>(net)</option>
</term>
<listitem>Total upload, this one too, may overflow
<para /></listitem>
@ -3041,7 +3041,7 @@
<command>
<option>upspeed</option>
</command>
<option>net</option>
<option>(net)</option>
</term>
<listitem>Upload speed in KiB
<para /></listitem>
@ -3051,7 +3051,7 @@
<command>
<option>upspeedf</option>
</command>
<option>net</option>
<option>(net)</option>
</term>
<listitem>Upload speed in KiB with one decimal
<para /></listitem>
@ -3176,7 +3176,7 @@
<command>
<option>wireless_ap</option>
</command>
<option>net</option>
<option>(net)</option>
</term>
<listitem>Wireless access point MAC address (Linux only)
<para /></listitem>
@ -3186,7 +3186,7 @@
<command>
<option>wireless_bitrate</option>
</command>
<option>net</option>
<option>(net)</option>
</term>
<listitem>Wireless bitrate (ie 11 Mb/s) (Linux only)
<para /></listitem>
@ -3196,7 +3196,7 @@
<command>
<option>wireless_essid</option>
</command>
<option>net</option>
<option>(net)</option>
</term>
<listitem>Wireless access point ESSID (Linux only)
<para /></listitem>
@ -3206,7 +3206,7 @@
<command>
<option>wireless_link_bar</option>
</command>
<option>(height), (width) net</option>
<option>(height),(width) (net)</option>
</term>
<listitem>Wireless link quality bar (Linux only)
<para /></listitem>
@ -3216,7 +3216,7 @@
<command>
<option>wireless_link_qual</option>
</command>
<option>net</option>
<option>(net)</option>
</term>
<listitem>Wireless link quality (Linux only)
<para /></listitem>
@ -3226,7 +3226,7 @@
<command>
<option>wireless_link_qual_max</option>
</command>
<option>net</option>
<option>(net)</option>
</term>
<listitem>Wireless link quality maximum value (Linux only)
<para /></listitem>
@ -3236,7 +3236,7 @@
<command>
<option>wireless_link_qual_perc</option>
</command>
<option>net</option>
<option>(net)</option>
</term>
<listitem>Wireless link quality in percents (Linux only)
<para /></listitem>
@ -3246,7 +3246,7 @@
<command>
<option>wireless_mode</option>
</command>
<option>net</option>
<option>(net)</option>
</term>
<listitem>Wireless mode (Managed/Ad-Hoc/Master) (Linux
only)

View File

@ -1267,43 +1267,64 @@ static struct text_object *construct_text_object(const char *s,
if (arg) {
obj->data.net = get_net_stat(arg);
} 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)
if (arg) {
obj->data.net = get_net_stat(arg);
} 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)
if (arg) {
obj->data.net = get_net_stat(arg);
} 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)
if (arg) {
obj->data.net = get_net_stat(arg);
} 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)
if (arg) {
obj->data.net = get_net_stat(arg);
} 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)
if (arg) {
obj->data.net = get_net_stat(arg);
} 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)
if (arg) {
obj->data.net = get_net_stat(arg);
} 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)
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);
obj->data.net = get_net_stat(arg);
} 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 */
@ -1586,13 +1610,19 @@ static struct text_object *construct_text_object(const char *s,
if (arg) {
obj->data.net = get_net_stat(arg);
} 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)
if (arg) {
obj->data.net = get_net_stat(arg);
} 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
END OBJ(downspeedgraph, INFO_NET)
@ -1927,14 +1957,20 @@ static struct text_object *construct_text_object(const char *s,
if (arg) {
obj->data.net = get_net_stat(arg);
} 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__)
END OBJ(addrs, INFO_NET)
if (arg) {
obj->data.net = get_net_stat(arg);
} 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__ */
END OBJ(tail, 0)
@ -2387,14 +2423,20 @@ static struct text_object *construct_text_object(const char *s,
if (arg) {
obj->data.net = get_net_stat(arg);
} 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)
obj->data.net = get_net_stat(arg);
if (arg) {
obj->data.net = get_net_stat(arg);
} 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_IF(if_updatenr, 0)
@ -2409,13 +2451,19 @@ static struct text_object *construct_text_object(const char *s,
if (arg) {
obj->data.net = get_net_stat(arg);
} 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)
if (arg) {
obj->data.net = get_net_stat(arg);
} 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