mirror of
https://github.com/Llewellynvdm/conky.git
synced 2025-01-27 09:08:25 +00:00
Changed addr to print "No Address" when there is no address
git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky1@1167 7f574dfc-610e-0410-a909-a81674777703
This commit is contained in:
parent
bb80900ca6
commit
9ffbf32b1d
@ -5,7 +5,7 @@
|
|||||||
<option>interface</option>
|
<option>interface</option>
|
||||||
</term>
|
</term>
|
||||||
<listitem>
|
<listitem>
|
||||||
IP address for an interface
|
IP address for an interface, or "No Address" if no address is assigned.
|
||||||
<para></para></listitem>
|
<para></para></listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
|
17
src/conky.c
17
src/conky.c
@ -4718,11 +4718,18 @@ static void generate_text_internal(char *p, int p_max_size,
|
|||||||
}
|
}
|
||||||
#ifdef HAVE_POPEN
|
#ifdef HAVE_POPEN
|
||||||
OBJ(addr) {
|
OBJ(addr) {
|
||||||
snprintf(p, p_max_size, "%u.%u.%u.%u",
|
if ((obj->data.net->addr.sa_data[2] & 255) == 0
|
||||||
obj->data.net->addr.sa_data[2] & 255,
|
&& (obj->data.net->addr.sa_data[3] & 255) == 0
|
||||||
obj->data.net->addr.sa_data[3] & 255,
|
&& (obj->data.net->addr.sa_data[4] & 255) == 0
|
||||||
obj->data.net->addr.sa_data[4] & 255,
|
&& (obj->data.net->addr.sa_data[5] & 255) == 0) {
|
||||||
obj->data.net->addr.sa_data[5] & 255);
|
snprintf(p, p_max_size, "No Address");
|
||||||
|
} else {
|
||||||
|
snprintf(p, p_max_size, "%u.%u.%u.%u",
|
||||||
|
obj->data.net->addr.sa_data[2] & 255,
|
||||||
|
obj->data.net->addr.sa_data[3] & 255,
|
||||||
|
obj->data.net->addr.sa_data[4] & 255,
|
||||||
|
obj->data.net->addr.sa_data[5] & 255);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#if defined(__linux__)
|
#if defined(__linux__)
|
||||||
OBJ(addrs) {
|
OBJ(addrs) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user