diff options
-rw-r--r-- | CHANGELOG | 27 | ||||
-rw-r--r-- | I3STATUS_VERSION | 2 | ||||
-rw-r--r-- | man/asciidoc.conf | 2 | ||||
-rw-r--r-- | man/i3status.man | 10 | ||||
-rw-r--r-- | src/first_network_device.c | 43 | ||||
-rw-r--r-- | src/print_cpu_temperature.c | 6 | ||||
-rw-r--r-- | src/print_ip_addr.c | 5 | ||||
-rw-r--r-- | src/print_wireless_info.c | 1 |
8 files changed, 65 insertions, 31 deletions
@@ -1,3 +1,30 @@ +2018-05-11 i3status 2.12 + + • fix NULL value on OpenBSD when there is no acpitz0 + • show IP address when address has a label + • man: explicitly use format_up/format_down in ethernet, wireless conf + • man: remove SLOC comment + • treat zero battery capacity as "not available" + • add IPv6 address when IPv4 isn't available + • call tzset at each time print to pick up time zone changes + • doc: fixed minor typos + • be more cautious about handling invalid battery measurements. + • Makefile: make PKG_CONFIG overridable + • fix CPU unit tests + • use local timezone for battery %emptytime + • fix memory leak/use BEGINS_WITH macro + • _first_: add check for virtual ethernet devices + • add battery capacity parsing + • multiple CPU support for cpu_usage + • remove useless checks (we use char, not unsigned char) to fix compilation warnings + • disk: sanitize trailing slashes + • plug an fd leak in the OpenBSD-specific code for + • suppress printing :00 seconds of remaining battery lifetime, as apm(4)'s + estimate only has a granularity of minutes. + • fix the deciKelvin to Celsius conversion on FreeBSD + • make first_eth_interface() work on OpenBSD + • include sys/select.h on OpenBSD + 2017-01-21 i3status 2.11 • re-add forgotten wakeup call from SIGUSR1 handler diff --git a/I3STATUS_VERSION b/I3STATUS_VERSION index 0b08ad7..19462c2 100644 --- a/I3STATUS_VERSION +++ b/I3STATUS_VERSION @@ -1 +1 @@ -2.11-non-git +2.12-non-git diff --git a/man/asciidoc.conf b/man/asciidoc.conf index 4993579..459c639 100644 --- a/man/asciidoc.conf +++ b/man/asciidoc.conf @@ -7,7 +7,7 @@ template::[header-declarations] <refentrytitle>{mantitle}</refentrytitle> <manvolnum>{manvolnum}</manvolnum> <refmiscinfo class="source">i3status</refmiscinfo> -<refmiscinfo class="version">v2.11</refmiscinfo> +<refmiscinfo class="version">v2.12</refmiscinfo> <refmiscinfo class="manual">i3 Manual</refmiscinfo> </refmeta> <refnamediv> diff --git a/man/i3status.man b/man/i3status.man index f8ce219..1d679a3 100644 --- a/man/i3status.man +++ b/man/i3status.man @@ -1,7 +1,7 @@ i3status(1) =========== Michael Stapelberg <michael@i3wm.org> -v2.11, January 2017 +v2.12, May 2018 == NAME @@ -307,7 +307,9 @@ network interface found on the system (excluding devices starting with "lo"). *Example order*: +wireless wlan0+ -*Example format*: +W: (%quality at %essid, %bitrate / %frequency) %ip+ +*Example format_up*: +W: (%quality at %essid, %bitrate / %frequency) %ip+ + +*Example format_down*: +W: down+ === Ethernet @@ -321,7 +323,9 @@ network interface found on the system (excluding devices starting with "lo"). *Example order*: +ethernet eth0+ -*Example format*: +E: %ip (%speed)+ +*Example format_up*: +E: %ip (%speed)+ + +*Example format_down*: +E: down+ === Battery diff --git a/src/first_network_device.c b/src/first_network_device.c index 3f34cf2..b930f53 100644 --- a/src/first_network_device.c +++ b/src/first_network_device.c @@ -14,10 +14,10 @@ #include "i3status.h" -#ifdef __linux__ -#define LOOPBACK_DEV "lo" -#else +#ifdef __OpenBSD__ #define LOOPBACK_DEV "lo0" +#else +#define LOOPBACK_DEV "lo" #endif static bool sysfs_devtype(char *dest, size_t n, const char *ifnam) { @@ -67,24 +67,7 @@ static bool is_virtual(const char *ifname) { } static net_type_t iface_type(const char *ifname) { -#ifdef __linux__ - char devtype[32]; - - if (!sysfs_devtype(devtype, sizeof(devtype), ifname)) - return NET_TYPE_OTHER; - - /* Default to Ethernet when no devtype is available */ - if (!devtype[0]) - return NET_TYPE_ETHERNET; - - if (strcmp(devtype, "wlan") == 0) - return NET_TYPE_WIRELESS; - - if (strcmp(devtype, "wwan") == 0) - return NET_TYPE_OTHER; - - return NET_TYPE_OTHER; -#elif __OpenBSD__ +#ifdef __OpenBSD__ /* *First determine if the device is a wireless device by trying two ioctl(2) * commands against it. If either succeeds we can be sure it's a wireless @@ -127,8 +110,24 @@ static net_type_t iface_type(const char *ifname) { return NET_TYPE_ETHERNET; } #else -#error Missing implementation to determine interface type. + char devtype[32]; + + if (!sysfs_devtype(devtype, sizeof(devtype), ifname)) + return NET_TYPE_OTHER; + + /* Default to Ethernet when no devtype is available */ + if (!devtype[0]) + return NET_TYPE_ETHERNET; + + if (strcmp(devtype, "wlan") == 0) + return NET_TYPE_WIRELESS; + + if (strcmp(devtype, "wwan") == 0) + return NET_TYPE_OTHER; + + return NET_TYPE_OTHER; #endif + return NET_TYPE_OTHER; } const char *first_eth_interface(const net_type_t type) { diff --git a/src/print_cpu_temperature.c b/src/print_cpu_temperature.c index 56ab62a..431664e 100644 --- a/src/print_cpu_temperature.c +++ b/src/print_cpu_temperature.c @@ -112,7 +112,7 @@ static int read_temperature(char *thermal_zone, temperature_t *temperature) { /* 'path' is the node within the full path (defaults to acpitz0). */ if (BEGINS_WITH(sensordev.xname, thermal_zone)) { mib[3] = SENSOR_TEMP; - /* Limit to temo0, but should retrieve from a full path... */ + /* Limit to temp0, but should retrieve from a full path... */ for (numt = 0; numt < 1 /*sensordev.maxnumt[SENSOR_TEMP]*/; numt++) { mib[4] = numt; if (sysctl(mib, 5, &sensor, &slen, NULL, 0) == -1) { @@ -205,7 +205,7 @@ error_netbsd1: /* * Reads the CPU temperature from /sys/class/thermal/thermal_zone%d/temp (or - * the user provided path) and returns the temperature in degree celcius. + * the user provided path) and returns the temperature in degree celsius. * */ void print_cpu_temperature_info(yajl_gen json_gen, char *buffer, int zone, const char *path, const char *format, const char *format_above_threshold, int max_threshold) { @@ -216,6 +216,8 @@ void print_cpu_temperature_info(yajl_gen json_gen, char *buffer, int zone, const bool colorful_output = false; char *thermal_zone; temperature_t temperature; + temperature.raw_value = 0; + sprintf(temperature.formatted_value, "%.2f", 0.0); if (path == NULL) asprintf(&thermal_zone, THERMAL_ZONE, zone); diff --git a/src/print_ip_addr.c b/src/print_ip_addr.c index f9cd1f4..c955c1c 100644 --- a/src/print_ip_addr.c +++ b/src/print_ip_addr.c @@ -29,6 +29,7 @@ const char *get_ip_addr(const char *interface, int family) { struct ifaddrs *ifaddr, *addrp; bool found = false; + int interface_len = strlen(interface); getifaddrs(&ifaddr); @@ -39,13 +40,13 @@ const char *get_ip_addr(const char *interface, int family) { for (addrp = ifaddr; (addrp != NULL && - (strcmp(addrp->ifa_name, interface) != 0 || + (strncmp(addrp->ifa_name, interface, interface_len) != 0 || addrp->ifa_addr == NULL || addrp->ifa_addr->sa_family != family)); addrp = addrp->ifa_next) { /* Check if the interface is down */ - if (strcmp(addrp->ifa_name, interface) != 0) + if (strncmp(addrp->ifa_name, interface, interface_len) != 0) continue; found = true; if ((addrp->ifa_flags & IFF_RUNNING) == 0) { diff --git a/src/print_wireless_info.c b/src/print_wireless_info.c index c3b5270..efdd59b 100644 --- a/src/print_wireless_info.c +++ b/src/print_wireless_info.c @@ -16,6 +16,7 @@ #endif #ifdef __APPLE__ +#include <sys/socket.h> #define IW_ESSID_MAX_SIZE 32 #endif |