From 0006ec53efd3d8d8b366f3688333fd00484897d3 Mon Sep 17 00:00:00 2001 From: Alexis Hildebrandt Date: Wed, 10 Jun 2015 19:01:13 +0200 Subject: [PATCH 1/5] Whitespace edit --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index cf52d90..1823f3d 100644 --- a/Makefile +++ b/Makefile @@ -47,8 +47,8 @@ ifeq ($(OS),OpenBSD) LIBS+=-lossaudio endif -ifeq ($(OS), NetBSD) -LIBS+= -lprop +ifeq ($(OS),NetBSD) +LIBS+=-lprop endif # This probably applies for any pkgsrc based system From fcabfc889a80232288b0c78eaa25fca92e98248f Mon Sep 17 00:00:00 2001 From: Alexis Hildebrandt Date: Wed, 10 Jun 2015 19:02:57 +0200 Subject: [PATCH 2/5] Add A2X_FLAGS to be able to optionally skip xmllint, which errors on Mac OS X. --- man/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/man/Makefile b/man/Makefile index ffcb80c..1db82a4 100644 --- a/man/Makefile +++ b/man/Makefile @@ -1,8 +1,9 @@ all: i3status.1 A2X?=a2x +A2X_FLAGS= i3status.1: asciidoc.conf i3status.man - ${A2X} -f manpage --asciidoc-opts="-f asciidoc.conf" i3status.man + ${A2X} -f manpage --asciidoc-opts="-f asciidoc.conf" ${A2X_FLAGS} i3status.man clean: rm -f i3status.xml i3status.1 i3status.html From d1cec2632dab678d6eb55c319756e98faf95a7f0 Mon Sep 17 00:00:00 2001 From: Alexis Hildebrandt Date: Wed, 10 Jun 2015 19:03:29 +0200 Subject: [PATCH 3/5] Fix undeclared identifier thermal_zone error when THERMAL_ZONE is not defined. --- src/print_cpu_temperature.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/print_cpu_temperature.c b/src/print_cpu_temperature.c index c0a6baa..71ee4d4 100644 --- a/src/print_cpu_temperature.c +++ b/src/print_cpu_temperature.c @@ -261,8 +261,8 @@ void print_cpu_temperature_info(yajl_gen json_gen, char *buffer, int zone, const OUTPUT_FULL_TEXT(buffer); return; error: -#endif free(thermal_zone); +#endif OUTPUT_FULL_TEXT("can't read temp"); (void)fputs("i3status: Cannot read temperature. Verify that you have a thermal zone in /sys/class/thermal or disable the cpu_temperature module in your i3status config.\n", stderr); From 2113737107c537e9cbc1a40d2d8d5fac5152e03e Mon Sep 17 00:00:00 2001 From: Alexis Hildebrandt Date: Mon, 6 Jul 2015 15:39:34 +0200 Subject: [PATCH 4/5] Use gettimeofday instead of clock_gettime on Mac since the latter is not available. --- i3status.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/i3status.c b/i3status.c index 46d557c..000584a 100644 --- a/i3status.c +++ b/i3status.c @@ -692,7 +692,12 @@ int main(int argc, char *argv[]) { * We also align to 60 seconds modulo interval such * that we start with :00 on every new minute. */ struct timespec ts; +#if defined(__APPLE__) + gettimeofday(&tv, NULL); + ts.tv_sec = tv.tv_sec; +#else clock_gettime(CLOCK_REALTIME, &ts); +#endif ts.tv_sec += interval - (ts.tv_sec % interval); ts.tv_nsec = 0; From 80e7b83d541044c698d6e9e40cc122e0cf287858 Mon Sep 17 00:00:00 2001 From: Alexis Hildebrandt Date: Mon, 6 Jul 2015 15:40:30 +0200 Subject: [PATCH 5/5] Add ifdef to compile print_disk_info on Mac --- src/print_disk_info.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/print_disk_info.c b/src/print_disk_info.c index 7fd47b9..e5e3ab1 100644 --- a/src/print_disk_info.c +++ b/src/print_disk_info.c @@ -7,7 +7,7 @@ #include #include #include -#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || (__OpenBSD__) || defined(__DragonFly__) +#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || (__OpenBSD__) || defined(__DragonFly__) || defined(__APPLE__) #include #include #else @@ -59,7 +59,7 @@ static int print_bytes_human(char *outwalk, uint64_t bytes, const char *prefix_t * Determines whether remaining bytes are below given threshold. * */ -#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__OpenBSD__) || defined(__DragonFly__) +#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__OpenBSD__) || defined(__DragonFly__) || defined(__APPLE__) static bool below_threshold(struct statfs buf, const char *prefix_type, const char *threshold_type, const double low_threshold) { #else static bool below_threshold(struct statvfs buf, const char *prefix_type, const char *threshold_type, const double low_threshold) { @@ -116,7 +116,7 @@ void print_disk_info(yajl_gen json_gen, char *buffer, const char *path, const ch INSTANCE(path); -#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__OpenBSD__) || defined(__DragonFly__) +#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__OpenBSD__) || defined(__DragonFly__) || defined(__APPLE__) struct statfs buf; if (statfs(path, &buf) == -1)